Skip to content

Type Alias: FactoryOptions ​

FactoryOptions = object

Defined in: src/types.ts:244

Options of Model.create().

Properties ​

history? ​

optional history?: boolean | { limit?: number; }

Defined in: src/types.ts:258

Record every later field write so it can be undo()ne and redo()ne; { limit } caps the steps kept (default 100).


lazy? ​

optional lazy?: boolean

Defined in: src/types.ts:246

Return an existing instance of the model as-is instead of rebuilding it.


sanitize? ​

optional sanitize?: boolean

Defined in: src/types.ts:248

Deep-clone the input first so the model never shares references with it. Default true.


tracked? ​

optional tracked?: boolean | "shallow"

Defined in: src/types.ts:254

Keep the baseline that isTouched(), changes() and revert() compare to: true keeps a deep copy of the model and compares by content; 'shallow' keeps the field values themselves and compares them by reference (Object.is), so a nested model or collection counts as changed only once the field is reassigned.


validate? ​

optional validate?: boolean

Defined in: src/types.ts:256

Run validate() after filling and throw a ValidationError listing every problem.