3.0.0
Changes
- Fix type validation:
- Type inferring doesn't throw when it cannot infer a node type; set the type to "any" or "primitive".
- Type inferring of each side of a binary expression, or of method argument accepts "any" or "primitive" and delay type validation until evaluation.
- Validate type of string and snapshot method arguments during evaluation.
- Validate type of each sides of binary expression during evaluation: most arithmetic expressions require numbers, addition also accept operation on string, comparison require string, number or null, equality operations require a primitive or a plain Object.
- Add live testing for Firebase parity.
- Stop evaluating child write rules.
- Add more debugging info.
- Fix snapshot root parent access.
- Fix data node snapshot priority handling.
- Refactor API:
- Plugins scripts should be imported directly, e.g.
require('targaryen/plugins/chai'):- Add
targaryen/plugins/chai. - Add
targaryen/plugins/jasmine. - Deprecate
targaryen.chai. - Deprecate
targaryen.jasmine. - Deprecate
targaryen.setFirebaseData. - Deprecate
targaryen.setFirebaseRules. - Deprecate
targaryen.setDebug. - Deprecate
targaryen.users.
- Add
- Simpler API to use targaryen directly:
- Add
targaryen.database(rules: object|Ruleset, data: object|DataNode, now: null|number): Database. - Add
targaryen.utilfunctions used by the CLI and the reference plugins for chai and jasmin - Remove
targaryen.Ruleset. - Remove
targaryen.DataSnapshot. - Remove
targaryen.helpers.
- Add
- Plugins scripts should be imported directly, e.g.
- Refactor internal:
- Refactor data access and Ruleset.
- Refactor public api.
- Format source based on eslint xo shared configuration.
- Refactor rule parser.
- Simpler tests.
- Move
lib/database. - Fix deleting a missing node.
- Add
DataNode.$merge(Database.root.$merge). - Better debug info when an operation doesn't trigger any read/write rules.
- Fix regression bug in removing and prune nodes.
- Describe operation in result info (were previously generated by error helpers in
targaryen.utils).
- Targaryen CLI can parse rules containing multi lines string (would previously only support comments).
- Chai and jasmine plugins include json parser helpers (supporting comments and multi line strings)
Thanks goes to @alisson446, @georgesboris, @mhuebert, @RomansBermans and @simenbrekken for their contributions.
install
npm install targaryen