Skip to main content

sanitizeModelText

@webda/core


Function: sanitizeModelText()

sanitizeModelText<T>(model, input): Promise<T>

Defined in: packages/core/src/services/domainservice.service.ts:83

Sanitize the texts of client input bound to a model, the way an operation on this model does: every string is HTML-sanitized, except the attributes the model gives another mode (@sanitize none, html or markdown)

For an entry point that receives model data outside the input of a model operation (a sync push, a batch import...), so a model stores the same text on every transport. It only deals with the texts: follow it with sanitizeModelInput to remove the attributes a client cannot write.

Type Parameters​

T​

T = any

Parameters​

model​

ModelClass<any>

the model class

input​

T

the client input, as received (not sanitized yet); it is not modified

Returns​

Promise<T>

a copy of the input, its texts sanitized