-
[UPDATE] Upgrade dependencies version to resolve vulnerabilities and use latest Typescript
-
[FEATURE] Add
foreignandtargetkeys toAttributeOptions
- [FIX] relax ModelProperties typing in a better way
- [FIX] relax ModelProperties typing slightly as typescript isn't quite there yet
- [UPDATE] update to modelsafe 2
- [FEATURE] add
targetAssocto associations
- [FEATURE] interpret de/serialisation depth of null as infinite depth
- [FIX] test defaultValue for undefined, not truthiness
- [FIX] reject invalid dates in date validator
- [FIX] deserialize ISO strings into Date objects
- [FEATURE] allow
defaultValueto be lazily loaded - [FEATURE] use
defaultValuein place of a nil value invalidate
- Revert to
es5TypeScript target due to transpile model issues - Upgrade to TypeScript 2.3
- [FIX]
isLazyLoad()should only match functions, not any object that's not a model constructor
- [FIX]
ModelErrorsshould havePropertyError[]per property, not a singlePropertyError
- [FIX] If
requiredis set tofalsewhen validating, then attribute type validations will be properly skipped
- [FIX] Make
associationsserialization options optional
- [FIX] Serialize/deserialize now no longer infinitely recursively serialize association values by default
- [FEATURE] Serialization/deserialization of associations can now be turned off, and you can provide a depth for serializing associations (defaults to 1 level)
- [FEATURE] Added
requiredoption withValidationOptionsto support skipping required attribute checks during validation
- [CHANGE] Uses the ES6 environment with
tsconfig.json - [CHANGE] Removed unused attribute types
DECIMAL,FLOAT/DOUBLE/ (in favour ofREAL),JSONB - [CHANGE] Renamed
JSONtoOBJECT, is now for plain object types. JSON strings should useSTRING - [CHANGE] Removed
Model.associatein favour of lazy-loaded association decoration - [FEATURE] A
defaultValueoption for attributes that will be automatically set on new model instances unless you provide thedefaultsoption in constructing the model asfalse - [FEATURE]
ValidationErrors now have acommonErrorsproperty, which is a list of errors that are either for a subset of the model's properties or the whole model - [FEATURE] Added multiple decorators for more declarative definitions of models
@defaultValuefor decorating the default value of an attribute@requiredfor decorating an association or attribute as required@optionalfor decorating an association or attribute as optional@readOnlyfor decorating an attribute as read-only@primaryfor decorating an attribute as a primary key@uniquefor decorating an attribute as unique
- [FEATURE] Added
validateto model instances for performing validations of model instance data. This will run a few types of validations:- Validates that the each property on the model data matches a type expected for the decorated attribute type
- Validates with any extra validations decorated through the
@validatedecorator - Validates that attributes that have
optionalset tofalsehave values provided
- Introduced a series of built-in decoratable validations, specifically:
@email@url@uuid@json@hex@alpha@alphanumeric@base64@uppercase@lowercase@ip@matches@gt@gte@lt@lte@length@minLength@maxLength
- [FEATURE] Add serialization and de-serialization from JSON. De-serialization performs validations by default but this can be disabled through an option. This can be used for sending or receiving the data of ModelSafe model instances.
- Catch errors during
hasModelOptionsin-case a non-object is given toreflect-metadata
- Fix
isLazyLoadto just check if the target has been decorated and assume lazy load otherwises - Add
hasModelOptionsto check whether a class has been decorated as a model - Have
Model.associatetake anAssociationTarget
- Add
readOnlymetadata for attributes and assocations
- Fix
ValidationErrorbeing able to use instanceof calls (gets around TypeScript 2.1+ issue)
- Add
isLazyLoadfunction for checking if association targets are lazily loaded
- Add option of instantiating model instance with initial data
- Add lazy-load support to association targets in the
@assocdecorator
- Add primary attribute option
- Add unqiue attribute option
- Add validation error and mapped model errors type
- Change metadata keys to prevent nameclash
- Move to es5 target
- Fix missing .npmignore
- Initial release