functional-models 2.1.8 → 2.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -328,7 +328,12 @@ A value that is calculated and save if it doesn't exist, using other values for
328
328
 
329
329
  NOTE: If the value is provided as part of the instance, it is not re-calculated. If you want to re-calculate it, you must use either the property's method `calculate()` method to get the value and replace the existing OR pass in undefined for the property.
330
330
 
331
+ <strong>Incremental data creation such as GUI forms:</strong>
332
+
333
+ If you are incrementally creating and validating model data, such as a GUI form, you should make your denormalization callback understand that there may be properties that are required, but are not present (yet). What this means, is if you need a particular property's value to be part of the denormalization value, but it isn't there, you should check for the value, and if not there, return undefined. This will allow it to be recalculated later.
334
+
331
335
  <strong>A Strong Word of Caution</strong>
336
+
332
337
  Generally, we would recommend not using this as a primary key in a database. However, if you want to use a DenormalizedProperty as primary key in a database and you want to make changes to an instance, you need to delete the previous entry and then recreate it for every update. A dynamic primary key is not tracked between changes.
333
338
 
334
339
  <strong>Example</strong>
package/interfaces.d.ts CHANGED
@@ -143,5 +143,5 @@ declare type OptionalModelOptions<T extends FunctionalModel, TModel extends Mode
143
143
  instanceCreatedCallback?: Nullable<Arrayable<(instance: TModelInstance) => void>>;
144
144
  [s: string]: any;
145
145
  }> | undefined;
146
- declare type CalculateDenormalization<T extends FunctionalValue, TModel extends FunctionalModel> = (modelData: TModel, modelInstance: ModelInstance<TModel>) => MaybePromise<T>;
146
+ declare type CalculateDenormalization<T extends FunctionalValue, TModel extends FunctionalModel> = (modelData: TModel, modelInstance: ModelInstance<TModel>) => MaybePromise<T | undefined>;
147
147
  export { MaybeFunction, Maybe, MaybePromise, Nullable, Arrayable, MaybeLazy, JsonAble, toObj, ModelInstance, Model, PropertyValidatorComponent, PropertyValidatorComponentSync, PropertyValidatorComponentAsync, PropertyValidator, ModelValidatorComponent, PropertyInstance, PropertyConfig, FunctionalValue, ValueGetter, ModelReference, ModelDefinition, ModelOptions, OptionalModelOptions, ModelReferencePropertyInstance, PropertyGetters, PropertyValidators, PropertyValidatorComponentTypeAdvanced, FunctionalModel, ModelReferenceFunctions, ModelErrors, PrimaryKeyType, ModelFactory, ModelFetcher, CreateParams, ValidatorConfiguration, ValuePropertyValidatorComponent, ValueRequired, ValueOptional, PropertyModifier, ValidationErrors, ModelError, IsAsync, TypedJsonObj, JsonObj, ValueRequiredR, ValueOptionalR, CalculateDenormalization, };
package/interfaces.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":";;AAuYA,kCAAkC"}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":";;AA0YA,kCAAkC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "functional-models",
3
- "version": "2.1.8",
3
+ "version": "2.1.9",
4
4
  "description": "A library for creating JavaScript function based models.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",