Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@ofzza/entt

ofzza55MIT4.0.0-alpha-19TypeScript support: included

Modular TypeScript data-modeling solution, implementing nestable serialization/deserialization and flexible validation

entt, entity, data model, data-model, data modeling, data-modeling, change detection, validation

readme

enTT

enTT, read as "Entity", is an extensible TypeScript data-modeling solution with some of the typically required functionality, such as change-detection, easy import/export, composition/decomposition, data validation, etc., all available out of the box and easy to use.

Table of contents:

Get enTT

To start using enTT in your project, simply install it from NPM by running the following in your terminal:

$ npm install @ofzza/entt --save

Alternatively, get an extended implementation:

Using enTT

Using decorators and corresponding services

TODO: Static decorators ...

TODO: Property decorator A

TODO: Propperty decorator B

TODO: Class decorator C

EnTT-ifying your classes

TODO: ...

Using dynamic decorators and corresponding services

TODO: ... note about checking if decorated class was enTT-ified

TODO: Dynamic decrators ...

TODO: Property decorator D

TODO: Property decorator E

TODO: Class decorator F

Customizing enTT

Custom decorators and services

Custom class decorators

TODO: ...

Custom property decorators

TODO: ...

Contributing

Reporting Issues

When reporting issues, please keep to provided templates.

Before reporting issues, please read: GitHub Work-Flow

Contributing Code

For work-flow and general etiquette when contributing, please see:

Please accompany any work, fix or feature with their own issue, in it's own branch (see Git Source-Control Work-Flow for branch naming conventions), and once done, request merge via pull request.

When creating issues and PRs, please keep to provided templates.

changelog

Version 4.0

  • New, incompatible implementattion of the entire library with the following previously existing functionality reimplemented:
    • TODO: ...

Version 3.2.6

  • Updated documentation to update property definitions syntax from public prop = undefined as any to public prop?: any = undefined;
  • Updated tests to update property definitions syntax from public prop = undefined as any to public prop?: any = undefined;

Version 3.2.5

  • Fixed issue with cloning nested EnTT instances where properties marked with serialize: false or deserialize: false were not being cloned directly

Version 3.2.4

  • Further fix for issues with keeping track of nested EnTT instances when setting values of aliased properties by deserializing. This was causing validation errors and status not to propagate properly after deserializing a property configured with an alias.
  • Fixed issues stemming from overriding the .errors and/or .valid getters on a EnTT model class

Version 3.2.3

  • Fixed issues with keeping track of nested EnTT instances when setting values by deserializing. This was causing validation errors and status not to propagate properly after deserializing.

Version 3.2.2

  • Now allowing alternative (factory pattern) declaration of @Serializable({ cast }) argument, to help mitigate circular dependency problems when using nested models: @Serializable({ cast: () => MyEnTTClass })
  • Updated typescript version to 4.2.4
  • Updated yup version to 0.32.9
  • @Property custom getter/setter callback's second argument is now optional: (value: any, obj?: any) => any
  • @Serializable custom serialize/deserialize callback's second argument is now optional: (value: any, obj?: any) => any
  • @Validate custom provider validation function's second argument is now optional: (value: any, obj?: any) => Error[] | Error | string | boolean

Version 3.2.1

  • Fix making sure EnTT.cast() type definition is correct when base type and 'into' argument types aren't the same
  • Fix making .deserialize() return type definition pick up parent class being called from
  • Fix making .clone() return type definition pick up parent class being called from
  • Code-style cleanup of README code examples and unit tests

Version 3.2.0

Breaking changes
  • Arguments order changed in callbacks for:
    • @Property custom getter/setter callback functions changed from (obj: any, value: any) => any to (value: any, obj: any) => any
    • @Serializable custom serialize/deserialize callback functions changed from (obj: any, value: any) => any to (value: any, obj: any) => any
    • @Validate custom provider validation function changed from (obj: any, value: any) => Error[] | Error | string | boolean to (value: any, obj: any) => Error[] | Error | string | boolean
Non breaking changes
  • All methods are now strongly typed

Version 3.1.7

  • @Serializable direct serialization/deserialization via "serialize"/"deserialize" now directly uses returned value as property value with no additional processing

Version 3.1.5 / 3.1.6 (2020-07-15)

  • No longer forcing validation during deserialization, due to performance issues - replaced with single validation run once deserialization complete
  • .deserialize(), .cast() and .clone() methods now accept an additional, optional validate argument, allowing to circumvent validation of newly created instance

Version 3.1.4 (2020-06-09)

  • @Property now accepts a "tag" argument that can be searched via the static .findTaggedProperties() method
  • Clone now ignores custom "serialize"/"deserialize" configuration
  • Clone now supports an additional "target" argument

Version 3.1.3 (2020-05-25)

@Serializable replaced "serialize" property with "serialize"/"deserialize" properties supporting custom mapping functions

Version 3.0.2 (2020-05-11)

Added support for partially serializable properties via Serializable.serialize enum

Version 3.0.1 (2020-04-20)

Updated README.md to be inline with the published npm package name: @ofzza/entt

Version 3.0.0 (2020-04-20)

Initial release of new, TypeScript, implementation