@dxos/echo 0.8.4-main.84f28bd → 0.8.4-main.937b3ca
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 +2 -3
- package/dist/lib/browser/Annotation.mjs +33 -0
- package/dist/lib/browser/Annotation.mjs.map +7 -0
- package/dist/lib/browser/Database.mjs +18 -0
- package/dist/lib/browser/Database.mjs.map +7 -0
- package/dist/lib/browser/Entity.mjs +52 -0
- package/dist/lib/browser/Entity.mjs.map +7 -0
- package/dist/lib/browser/Err.mjs +11 -0
- package/dist/lib/browser/Err.mjs.map +7 -0
- package/dist/lib/browser/Filter.mjs +62 -0
- package/dist/lib/browser/Filter.mjs.map +7 -0
- package/dist/lib/browser/Format.mjs +67 -0
- package/dist/lib/browser/Format.mjs.map +7 -0
- package/dist/lib/browser/JsonSchema.mjs +20 -0
- package/dist/lib/browser/JsonSchema.mjs.map +7 -0
- package/dist/lib/browser/Key.mjs +13 -0
- package/dist/lib/browser/Key.mjs.map +7 -0
- package/dist/lib/browser/Obj.mjs +91 -0
- package/dist/lib/browser/Obj.mjs.map +7 -0
- package/dist/lib/browser/Order.mjs +13 -0
- package/dist/lib/browser/Order.mjs.map +7 -0
- package/dist/lib/browser/Query.mjs +27 -0
- package/dist/lib/browser/Query.mjs.map +7 -0
- package/dist/lib/browser/QueryResult.mjs +3 -0
- package/dist/lib/browser/QueryResult.mjs.map +7 -0
- package/dist/lib/browser/Ref.mjs +23 -0
- package/dist/lib/browser/Ref.mjs.map +7 -0
- package/dist/lib/browser/Relation.mjs +85 -0
- package/dist/lib/browser/Relation.mjs.map +7 -0
- package/dist/lib/browser/SchemaRegistry.mjs +3 -0
- package/dist/lib/browser/SchemaRegistry.mjs.map +7 -0
- package/dist/lib/browser/Tag.mjs +26 -0
- package/dist/lib/browser/Tag.mjs.map +7 -0
- package/dist/lib/browser/Type.mjs +48 -0
- package/dist/lib/browser/Type.mjs.map +7 -0
- package/dist/lib/browser/chunk-22JMFST2.mjs +24 -0
- package/dist/lib/browser/chunk-22JMFST2.mjs.map +7 -0
- package/dist/lib/browser/chunk-2SBB7OWV.mjs +250 -0
- package/dist/lib/browser/chunk-2SBB7OWV.mjs.map +7 -0
- package/dist/lib/browser/chunk-6L5HHUVU.mjs +158 -0
- package/dist/lib/browser/chunk-6L5HHUVU.mjs.map +7 -0
- package/dist/lib/browser/chunk-7STIBCP7.mjs +133 -0
- package/dist/lib/browser/chunk-7STIBCP7.mjs.map +7 -0
- package/dist/lib/browser/chunk-BJPE6CIC.mjs +3847 -0
- package/dist/lib/browser/chunk-BJPE6CIC.mjs.map +7 -0
- package/dist/lib/browser/chunk-CGS2ULMK.mjs +11 -0
- package/dist/lib/browser/chunk-CGS2ULMK.mjs.map +7 -0
- package/dist/lib/browser/chunk-CJ5YELTO.mjs +39 -0
- package/dist/lib/browser/chunk-CJ5YELTO.mjs.map +7 -0
- package/dist/lib/browser/chunk-FPOISFQK.mjs +40 -0
- package/dist/lib/browser/chunk-FPOISFQK.mjs.map +7 -0
- package/dist/lib/browser/chunk-FRDT7RA4.mjs +403 -0
- package/dist/lib/browser/chunk-FRDT7RA4.mjs.map +7 -0
- package/dist/lib/browser/chunk-INHXFXY5.mjs +22 -0
- package/dist/lib/browser/chunk-INHXFXY5.mjs.map +7 -0
- package/dist/lib/browser/chunk-IXVWLTG7.mjs +9 -0
- package/dist/lib/browser/chunk-IXVWLTG7.mjs.map +7 -0
- package/dist/lib/browser/chunk-JMKVF2YQ.mjs +43 -0
- package/dist/lib/browser/chunk-JMKVF2YQ.mjs.map +7 -0
- package/dist/lib/browser/chunk-KQQGVHFN.mjs +143 -0
- package/dist/lib/browser/chunk-KQQGVHFN.mjs.map +7 -0
- package/dist/lib/browser/chunk-MYCCGG2T.mjs +15 -0
- package/dist/lib/browser/chunk-MYCCGG2T.mjs.map +7 -0
- package/dist/lib/browser/chunk-NOPVNWPT.mjs +204 -0
- package/dist/lib/browser/chunk-NOPVNWPT.mjs.map +7 -0
- package/dist/lib/browser/chunk-PQZW3S6L.mjs +74 -0
- package/dist/lib/browser/chunk-PQZW3S6L.mjs.map +7 -0
- package/dist/lib/browser/chunk-RK4Z4JUZ.mjs +283 -0
- package/dist/lib/browser/chunk-RK4Z4JUZ.mjs.map +7 -0
- package/dist/lib/browser/chunk-U2J7TA7K.mjs +57 -0
- package/dist/lib/browser/chunk-U2J7TA7K.mjs.map +7 -0
- package/dist/lib/browser/chunk-W5D2GWAW.mjs +98 -0
- package/dist/lib/browser/chunk-W5D2GWAW.mjs.map +7 -0
- package/dist/lib/browser/chunk-XDIUHAAX.mjs +41 -0
- package/dist/lib/browser/chunk-XDIUHAAX.mjs.map +7 -0
- package/dist/lib/browser/chunk-YKTSSMDS.mjs +69 -0
- package/dist/lib/browser/chunk-YKTSSMDS.mjs.map +7 -0
- package/dist/lib/browser/chunk-ZAGAOZVY.mjs +288 -0
- package/dist/lib/browser/chunk-ZAGAOZVY.mjs.map +7 -0
- package/dist/lib/browser/chunk-ZHXZGIXD.mjs +9 -0
- package/dist/lib/browser/chunk-ZHXZGIXD.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +72 -9
- package/dist/lib/browser/internal/index.mjs +457 -0
- package/dist/lib/browser/internal/index.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +332 -35
- package/dist/lib/browser/testing/index.mjs.map +4 -4
- package/dist/lib/node-esm/Annotation.mjs +33 -0
- package/dist/lib/node-esm/Annotation.mjs.map +7 -0
- package/dist/lib/node-esm/Database.mjs +18 -0
- package/dist/lib/node-esm/Database.mjs.map +7 -0
- package/dist/lib/node-esm/Entity.mjs +52 -0
- package/dist/lib/node-esm/Entity.mjs.map +7 -0
- package/dist/lib/node-esm/Err.mjs +11 -0
- package/dist/lib/node-esm/Err.mjs.map +7 -0
- package/dist/lib/node-esm/Filter.mjs +62 -0
- package/dist/lib/node-esm/Filter.mjs.map +7 -0
- package/dist/lib/node-esm/Format.mjs +67 -0
- package/dist/lib/node-esm/Format.mjs.map +7 -0
- package/dist/lib/node-esm/JsonSchema.mjs +20 -0
- package/dist/lib/node-esm/JsonSchema.mjs.map +7 -0
- package/dist/lib/node-esm/Key.mjs +13 -0
- package/dist/lib/node-esm/Key.mjs.map +7 -0
- package/dist/lib/node-esm/Obj.mjs +91 -0
- package/dist/lib/node-esm/Obj.mjs.map +7 -0
- package/dist/lib/node-esm/Order.mjs +13 -0
- package/dist/lib/node-esm/Order.mjs.map +7 -0
- package/dist/lib/node-esm/Query.mjs +27 -0
- package/dist/lib/node-esm/Query.mjs.map +7 -0
- package/dist/lib/node-esm/QueryResult.mjs +3 -0
- package/dist/lib/node-esm/QueryResult.mjs.map +7 -0
- package/dist/lib/node-esm/Ref.mjs +23 -0
- package/dist/lib/node-esm/Ref.mjs.map +7 -0
- package/dist/lib/node-esm/Relation.mjs +85 -0
- package/dist/lib/node-esm/Relation.mjs.map +7 -0
- package/dist/lib/node-esm/SchemaRegistry.mjs +3 -0
- package/dist/lib/node-esm/SchemaRegistry.mjs.map +7 -0
- package/dist/lib/node-esm/Tag.mjs +26 -0
- package/dist/lib/node-esm/Tag.mjs.map +7 -0
- package/dist/lib/node-esm/Type.mjs +48 -0
- package/dist/lib/node-esm/Type.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-4PNXQA64.mjs +250 -0
- package/dist/lib/node-esm/chunk-4PNXQA64.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-5OBN7GZW.mjs +158 -0
- package/dist/lib/node-esm/chunk-5OBN7GZW.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-AJEMYSIR.mjs +22 -0
- package/dist/lib/node-esm/chunk-AJEMYSIR.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-ANLVLWME.mjs +98 -0
- package/dist/lib/node-esm/chunk-ANLVLWME.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-DMR7OAFK.mjs +57 -0
- package/dist/lib/node-esm/chunk-DMR7OAFK.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-FWTSPIFF.mjs +133 -0
- package/dist/lib/node-esm/chunk-FWTSPIFF.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-ILMLLM4R.mjs +204 -0
- package/dist/lib/node-esm/chunk-ILMLLM4R.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-K37NA7PO.mjs +43 -0
- package/dist/lib/node-esm/chunk-K37NA7PO.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-LT3H4JOX.mjs +3847 -0
- package/dist/lib/node-esm/chunk-LT3H4JOX.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-MOLNWFNL.mjs +9 -0
- package/dist/lib/node-esm/chunk-MOLNWFNL.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-MOWUEW5P.mjs +15 -0
- package/dist/lib/node-esm/chunk-MOWUEW5P.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-NBWL7UCZ.mjs +40 -0
- package/dist/lib/node-esm/chunk-NBWL7UCZ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-NRN3ZW2T.mjs +143 -0
- package/dist/lib/node-esm/chunk-NRN3ZW2T.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-QLI2EIJ2.mjs +41 -0
- package/dist/lib/node-esm/chunk-QLI2EIJ2.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-QYR67VBV.mjs +288 -0
- package/dist/lib/node-esm/chunk-QYR67VBV.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-UKGVOINP.mjs +9 -0
- package/dist/lib/node-esm/chunk-UKGVOINP.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-W6QIEBTQ.mjs +403 -0
- package/dist/lib/node-esm/chunk-W6QIEBTQ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-XHJRMQZD.mjs +69 -0
- package/dist/lib/node-esm/chunk-XHJRMQZD.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-Y75VU7LB.mjs +74 -0
- package/dist/lib/node-esm/chunk-Y75VU7LB.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-YOLH5KS4.mjs +283 -0
- package/dist/lib/node-esm/chunk-YOLH5KS4.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-YQ2NWGL5.mjs +39 -0
- package/dist/lib/node-esm/chunk-YQ2NWGL5.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-ZBB67AKD.mjs +24 -0
- package/dist/lib/node-esm/chunk-ZBB67AKD.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +72 -9
- package/dist/lib/node-esm/internal/index.mjs +457 -0
- package/dist/lib/node-esm/internal/index.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +332 -35
- package/dist/lib/node-esm/testing/index.mjs.map +4 -4
- package/dist/types/src/Annotation.d.ts +2 -0
- package/dist/types/src/Annotation.d.ts.map +1 -0
- package/dist/types/src/Database.d.ts +194 -0
- package/dist/types/src/Database.d.ts.map +1 -0
- package/dist/types/src/Entity.d.ts +142 -0
- package/dist/types/src/Entity.d.ts.map +1 -0
- package/dist/types/src/Entity.test.d.ts +2 -0
- package/dist/types/src/Entity.test.d.ts.map +1 -0
- package/dist/types/src/Err.d.ts +64 -0
- package/dist/types/src/Err.d.ts.map +1 -0
- package/dist/types/src/Filter.d.ts +120 -0
- package/dist/types/src/Filter.d.ts.map +1 -0
- package/dist/types/src/Format.d.ts +4 -0
- package/dist/types/src/Format.d.ts.map +1 -0
- package/dist/types/src/Hypergraph.d.ts +60 -0
- package/dist/types/src/Hypergraph.d.ts.map +1 -0
- package/dist/types/src/JsonSchema.d.ts +9 -0
- package/dist/types/src/JsonSchema.d.ts.map +1 -0
- package/dist/types/src/Key.d.ts +1 -0
- package/dist/types/src/Key.d.ts.map +1 -1
- package/dist/types/src/Obj.d.ts +344 -34
- package/dist/types/src/Obj.d.ts.map +1 -1
- package/dist/types/src/Obj.test.d.ts +2 -0
- package/dist/types/src/Obj.test.d.ts.map +1 -0
- package/dist/types/src/Order.d.ts +16 -0
- package/dist/types/src/Order.d.ts.map +1 -0
- package/dist/types/src/Query.d.ts +115 -0
- package/dist/types/src/Query.d.ts.map +1 -0
- package/dist/types/src/Query.test.d.ts +2 -0
- package/dist/types/src/Query.test.d.ts.map +1 -0
- package/dist/types/src/QueryResult.d.ts +80 -0
- package/dist/types/src/QueryResult.d.ts.map +1 -0
- package/dist/types/src/Ref.d.ts +13 -11
- package/dist/types/src/Ref.d.ts.map +1 -1
- package/dist/types/src/Relation.d.ts +242 -19
- package/dist/types/src/Relation.d.ts.map +1 -1
- package/dist/types/src/Relation.test.d.ts +2 -0
- package/dist/types/src/Relation.test.d.ts.map +1 -0
- package/dist/types/src/SchemaRegistry.d.ts +84 -0
- package/dist/types/src/SchemaRegistry.d.ts.map +1 -0
- package/dist/types/src/Tag.d.ts +17 -0
- package/dist/types/src/Tag.d.ts.map +1 -0
- package/dist/types/src/Type.d.ts +225 -73
- package/dist/types/src/Type.d.ts.map +1 -1
- package/dist/types/src/Type.test.d.ts +2 -0
- package/dist/types/src/Type.test.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +15 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/internal/annotations/annotations.d.ts +170 -0
- package/dist/types/src/internal/annotations/annotations.d.ts.map +1 -0
- package/dist/types/src/internal/annotations/annotations.test.d.ts +2 -0
- package/dist/types/src/internal/annotations/annotations.test.d.ts.map +1 -0
- package/dist/types/src/internal/annotations/index.d.ts +3 -0
- package/dist/types/src/internal/annotations/index.d.ts.map +1 -0
- package/dist/types/src/internal/annotations/util.d.ts +27 -0
- package/dist/types/src/internal/annotations/util.d.ts.map +1 -0
- package/dist/types/src/internal/api/annotations.d.ts +23 -0
- package/dist/types/src/internal/api/annotations.d.ts.map +1 -0
- package/dist/types/src/internal/api/entity.d.ts +13 -0
- package/dist/types/src/internal/api/entity.d.ts.map +1 -0
- package/dist/types/src/internal/api/index.d.ts +15 -0
- package/dist/types/src/internal/api/index.d.ts.map +1 -0
- package/dist/types/src/internal/api/meta.d.ts +42 -0
- package/dist/types/src/internal/api/meta.d.ts.map +1 -0
- package/dist/types/src/internal/api/sorting.d.ts +24 -0
- package/dist/types/src/internal/api/sorting.d.ts.map +1 -0
- package/dist/types/src/internal/api/version.d.ts +42 -0
- package/dist/types/src/internal/api/version.d.ts.map +1 -0
- package/dist/types/src/internal/entities/entity.d.ts +20 -0
- package/dist/types/src/internal/entities/entity.d.ts.map +1 -0
- package/dist/types/src/internal/entities/index.d.ts +6 -0
- package/dist/types/src/internal/entities/index.d.ts.map +1 -0
- package/dist/types/src/internal/entities/model.d.ts +77 -0
- package/dist/types/src/internal/entities/model.d.ts.map +1 -0
- package/dist/types/src/internal/entities/object.d.ts +18 -0
- package/dist/types/src/internal/entities/object.d.ts.map +1 -0
- package/dist/types/src/internal/entities/relation.d.ts +62 -0
- package/dist/types/src/internal/entities/relation.d.ts.map +1 -0
- package/dist/types/src/internal/entities/util.d.ts +2 -0
- package/dist/types/src/internal/entities/util.d.ts.map +1 -0
- package/dist/types/src/internal/formats/date.d.ts +63 -0
- package/dist/types/src/internal/formats/date.d.ts.map +1 -0
- package/dist/types/src/internal/formats/date.test.d.ts +2 -0
- package/dist/types/src/internal/formats/date.test.d.ts.map +1 -0
- package/dist/types/src/internal/formats/format.d.ts +32 -0
- package/dist/types/src/internal/formats/format.d.ts.map +1 -0
- package/dist/types/src/internal/formats/format.test.d.ts +2 -0
- package/dist/types/src/internal/formats/format.test.d.ts.map +1 -0
- package/dist/types/src/internal/formats/index.d.ts +8 -0
- package/dist/types/src/internal/formats/index.d.ts.map +1 -0
- package/dist/types/src/internal/formats/number.d.ts +31 -0
- package/dist/types/src/internal/formats/number.d.ts.map +1 -0
- package/dist/types/src/internal/formats/object.d.ts +35 -0
- package/dist/types/src/internal/formats/object.d.ts.map +1 -0
- package/dist/types/src/internal/formats/select.d.ts +13 -0
- package/dist/types/src/internal/formats/select.d.ts.map +1 -0
- package/dist/types/src/internal/formats/string.d.ts +42 -0
- package/dist/types/src/internal/formats/string.d.ts.map +1 -0
- package/dist/types/src/internal/formats/types.d.ts +72 -0
- package/dist/types/src/internal/formats/types.d.ts.map +1 -0
- package/dist/types/src/internal/index.d.ts +12 -0
- package/dist/types/src/internal/index.d.ts.map +1 -0
- package/dist/types/src/internal/json-schema/annotations.d.ts +19 -0
- package/dist/types/src/internal/json-schema/annotations.d.ts.map +1 -0
- package/dist/types/src/internal/json-schema/effect-schema.test.d.ts +2 -0
- package/dist/types/src/internal/json-schema/effect-schema.test.d.ts.map +1 -0
- package/dist/types/src/internal/json-schema/index.d.ts +5 -0
- package/dist/types/src/internal/json-schema/index.d.ts.map +1 -0
- package/dist/types/src/internal/json-schema/json-schema-normalize.d.ts +7 -0
- package/dist/types/src/internal/json-schema/json-schema-normalize.d.ts.map +1 -0
- package/dist/types/src/internal/json-schema/json-schema-type.d.ts +250 -0
- package/dist/types/src/internal/json-schema/json-schema-type.d.ts.map +1 -0
- package/dist/types/src/internal/json-schema/json-schema.d.ts +29 -0
- package/dist/types/src/internal/json-schema/json-schema.d.ts.map +1 -0
- package/dist/types/src/internal/json-schema/json-schema.test.d.ts +2 -0
- package/dist/types/src/internal/json-schema/json-schema.test.d.ts.map +1 -0
- package/dist/types/src/internal/object/clone.d.ts +8 -0
- package/dist/types/src/internal/object/clone.d.ts.map +1 -0
- package/dist/types/src/internal/object/common.d.ts +18 -0
- package/dist/types/src/internal/object/common.d.ts.map +1 -0
- package/dist/types/src/internal/object/create-object.d.ts +39 -0
- package/dist/types/src/internal/object/create-object.d.ts.map +1 -0
- package/dist/types/src/internal/object/create-object.test.d.ts +2 -0
- package/dist/types/src/internal/object/create-object.test.d.ts.map +1 -0
- package/dist/types/src/internal/object/deleted.d.ts +6 -0
- package/dist/types/src/internal/object/deleted.d.ts.map +1 -0
- package/dist/types/src/internal/object/ids.d.ts +6 -0
- package/dist/types/src/internal/object/ids.d.ts.map +1 -0
- package/dist/types/src/internal/object/index.d.ts +11 -0
- package/dist/types/src/internal/object/index.d.ts.map +1 -0
- package/dist/types/src/internal/object/inspect.d.ts +2 -0
- package/dist/types/src/internal/object/inspect.d.ts.map +1 -0
- package/dist/types/src/internal/object/json-serializer.d.ts +37 -0
- package/dist/types/src/internal/object/json-serializer.d.ts.map +1 -0
- package/dist/types/src/internal/object/json-serializer.test.d.ts +2 -0
- package/dist/types/src/internal/object/json-serializer.test.d.ts.map +1 -0
- package/dist/types/src/internal/object/schema-validator.d.ts +2 -0
- package/dist/types/src/internal/object/schema-validator.d.ts.map +1 -0
- package/dist/types/src/internal/object/schema-validator.test.d.ts +2 -0
- package/dist/types/src/internal/object/schema-validator.test.d.ts.map +1 -0
- package/dist/types/src/internal/object/set-value.d.ts +7 -0
- package/dist/types/src/internal/object/set-value.d.ts.map +1 -0
- package/dist/types/src/internal/object/set-value.test.d.ts +2 -0
- package/dist/types/src/internal/object/set-value.test.d.ts.map +1 -0
- package/dist/types/src/internal/object/snapshot.d.ts +6 -0
- package/dist/types/src/internal/object/snapshot.d.ts.map +1 -0
- package/dist/types/src/internal/object/typed-object.d.ts +25 -0
- package/dist/types/src/internal/object/typed-object.d.ts.map +1 -0
- package/dist/types/src/internal/object/typed-object.test.d.ts +2 -0
- package/dist/types/src/internal/object/typed-object.test.d.ts.map +1 -0
- package/dist/types/src/internal/proxy/change-context.d.ts +55 -0
- package/dist/types/src/internal/proxy/change-context.d.ts.map +1 -0
- package/dist/types/src/internal/proxy/change.test.d.ts +2 -0
- package/dist/types/src/internal/proxy/change.test.d.ts.map +1 -0
- package/dist/types/src/internal/proxy/define-hidden-property.d.ts +5 -0
- package/dist/types/src/internal/proxy/define-hidden-property.d.ts.map +1 -0
- package/dist/types/src/internal/proxy/errors.d.ts +19 -0
- package/dist/types/src/internal/proxy/errors.d.ts.map +1 -0
- package/dist/types/src/internal/proxy/event-batch.d.ts +10 -0
- package/dist/types/src/internal/proxy/event-batch.d.ts.map +1 -0
- package/dist/types/src/internal/proxy/handler.test.d.ts +2 -0
- package/dist/types/src/internal/proxy/handler.test.d.ts.map +1 -0
- package/dist/types/src/internal/proxy/index.d.ts +14 -0
- package/dist/types/src/internal/proxy/index.d.ts.map +1 -0
- package/dist/types/src/internal/proxy/json-serializer.d.ts +6 -0
- package/dist/types/src/internal/proxy/json-serializer.d.ts.map +1 -0
- package/dist/types/src/internal/proxy/make-object.d.ts +14 -0
- package/dist/types/src/internal/proxy/make-object.d.ts.map +1 -0
- package/dist/types/src/internal/proxy/ownership.d.ts +57 -0
- package/dist/types/src/internal/proxy/ownership.d.ts.map +1 -0
- package/dist/types/src/internal/proxy/proxy-types.d.ts +18 -0
- package/dist/types/src/internal/proxy/proxy-types.d.ts.map +1 -0
- package/dist/types/src/internal/proxy/proxy-utils.d.ts +47 -0
- package/dist/types/src/internal/proxy/proxy-utils.d.ts.map +1 -0
- package/dist/types/src/internal/proxy/reactive-array.d.ts +8 -0
- package/dist/types/src/internal/proxy/reactive-array.d.ts.map +1 -0
- package/dist/types/src/internal/proxy/reactive.d.ts +39 -0
- package/dist/types/src/internal/proxy/reactive.d.ts.map +1 -0
- package/dist/types/src/internal/proxy/schema-validator.d.ts +15 -0
- package/dist/types/src/internal/proxy/schema-validator.d.ts.map +1 -0
- package/dist/types/src/internal/proxy/schema.test.d.ts +2 -0
- package/dist/types/src/internal/proxy/schema.test.d.ts.map +1 -0
- package/dist/types/src/internal/proxy/symbols.d.ts +3 -0
- package/dist/types/src/internal/proxy/symbols.d.ts.map +1 -0
- package/dist/types/src/internal/proxy/typed-handler.d.ts +47 -0
- package/dist/types/src/internal/proxy/typed-handler.d.ts.map +1 -0
- package/dist/types/src/internal/proxy/typed-handler.test.d.ts +2 -0
- package/dist/types/src/internal/proxy/typed-handler.test.d.ts.map +1 -0
- package/dist/types/src/internal/proxy/typed-object.test.d.ts +2 -0
- package/dist/types/src/internal/proxy/typed-object.test.d.ts.map +1 -0
- package/dist/types/src/internal/ref/index.d.ts +3 -0
- package/dist/types/src/internal/ref/index.d.ts.map +1 -0
- package/dist/types/src/internal/ref/ref-array.d.ts +21 -0
- package/dist/types/src/internal/ref/ref-array.d.ts.map +1 -0
- package/dist/types/src/internal/ref/ref.d.ts +217 -0
- package/dist/types/src/internal/ref/ref.d.ts.map +1 -0
- package/dist/types/src/internal/ref/ref.test.d.ts +2 -0
- package/dist/types/src/internal/ref/ref.test.d.ts.map +1 -0
- package/dist/types/src/internal/schema/compose.d.ts +6 -0
- package/dist/types/src/internal/schema/compose.d.ts.map +1 -0
- package/dist/types/src/internal/schema/compose.test.d.ts +2 -0
- package/dist/types/src/internal/schema/compose.test.d.ts.map +1 -0
- package/dist/types/src/internal/schema/echo-schema.d.ts +180 -0
- package/dist/types/src/internal/schema/echo-schema.d.ts.map +1 -0
- package/dist/types/src/internal/schema/index.d.ts +4 -0
- package/dist/types/src/internal/schema/index.d.ts.map +1 -0
- package/dist/types/src/internal/schema/manipulation.d.ts +10 -0
- package/dist/types/src/internal/schema/manipulation.d.ts.map +1 -0
- package/dist/types/src/internal/schema/persistent-schema.d.ts +20 -0
- package/dist/types/src/internal/schema/persistent-schema.d.ts.map +1 -0
- package/dist/types/src/internal/types/base.d.ts +26 -0
- package/dist/types/src/internal/types/base.d.ts.map +1 -0
- package/dist/types/src/internal/types/entity.d.ts +37 -0
- package/dist/types/src/internal/types/entity.d.ts.map +1 -0
- package/dist/types/src/internal/types/index.d.ts +6 -0
- package/dist/types/src/internal/types/index.d.ts.map +1 -0
- package/dist/types/src/internal/types/meta.d.ts +32 -0
- package/dist/types/src/internal/types/meta.d.ts.map +1 -0
- package/dist/types/src/internal/types/typename.d.ts +13 -0
- package/dist/types/src/internal/types/typename.d.ts.map +1 -0
- package/dist/types/src/internal/types/version.d.ts +15 -0
- package/dist/types/src/internal/types/version.d.ts.map +1 -0
- package/dist/types/src/{test → testing}/api.test.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +3 -1
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-data.d.ts +18 -0
- package/dist/types/src/testing/test-data.d.ts.map +1 -0
- package/dist/types/src/testing/test-schema.d.ts +303 -0
- package/dist/types/src/testing/test-schema.d.ts.map +1 -0
- package/dist/types/src/testing/util.d.ts +21 -0
- package/dist/types/src/testing/util.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +166 -33
- package/src/Annotation.ts +18 -0
- package/src/Database.ts +336 -0
- package/src/Entity.test.ts +22 -0
- package/src/Entity.ts +217 -0
- package/src/Err.ts +18 -0
- package/src/Filter.ts +376 -0
- package/src/Format.ts +9 -0
- package/src/Hypergraph.ts +74 -0
- package/src/JsonSchema.ts +16 -0
- package/src/Key.ts +3 -0
- package/src/Obj.test.ts +386 -0
- package/src/Obj.ts +509 -85
- package/src/Order.ts +44 -0
- package/src/Query.test.ts +465 -0
- package/src/Query.ts +296 -0
- package/src/QueryResult.ts +106 -0
- package/src/Ref.ts +25 -9
- package/src/Relation.test.ts +82 -0
- package/src/Relation.ts +414 -51
- package/src/SchemaRegistry.ts +105 -0
- package/src/Tag.ts +40 -0
- package/src/Type.test.ts +52 -0
- package/src/Type.ts +360 -112
- package/src/index.ts +17 -4
- package/src/internal/README.md +102 -0
- package/src/internal/annotations/annotations.test.ts +96 -0
- package/src/internal/annotations/annotations.ts +460 -0
- package/src/internal/annotations/index.ts +6 -0
- package/src/internal/annotations/util.ts +72 -0
- package/src/internal/api/annotations.ts +60 -0
- package/src/internal/api/entity.ts +29 -0
- package/src/internal/api/index.ts +19 -0
- package/src/internal/api/meta.ts +88 -0
- package/src/internal/api/sorting.ts +53 -0
- package/src/internal/api/version.ts +96 -0
- package/src/internal/entities/entity.ts +126 -0
- package/src/internal/entities/index.ts +9 -0
- package/src/internal/entities/model.ts +134 -0
- package/src/internal/entities/object.ts +60 -0
- package/src/internal/entities/relation.ts +173 -0
- package/src/internal/entities/util.ts +33 -0
- package/src/internal/formats/date.test.ts +56 -0
- package/src/internal/formats/date.ts +217 -0
- package/src/internal/formats/format.test.ts +77 -0
- package/src/internal/formats/format.ts +54 -0
- package/src/internal/formats/index.ts +12 -0
- package/src/internal/formats/number.ts +89 -0
- package/src/internal/formats/object.ts +80 -0
- package/src/internal/formats/select.ts +18 -0
- package/src/internal/formats/string.ts +81 -0
- package/src/internal/formats/types.ts +186 -0
- package/src/internal/index.ts +39 -0
- package/src/internal/json-schema/annotations.ts +50 -0
- package/src/internal/json-schema/effect-schema.test.ts +143 -0
- package/src/internal/json-schema/index.ts +8 -0
- package/src/internal/json-schema/json-schema-normalize.ts +109 -0
- package/src/internal/json-schema/json-schema-type.ts +404 -0
- package/src/internal/json-schema/json-schema.test.ts +861 -0
- package/src/internal/json-schema/json-schema.ts +528 -0
- package/src/internal/object/clone.ts +48 -0
- package/src/internal/object/common.ts +75 -0
- package/src/internal/object/create-object.test.ts +116 -0
- package/src/internal/object/create-object.ts +95 -0
- package/src/internal/object/deleted.ts +19 -0
- package/src/internal/object/ids.ts +12 -0
- package/src/internal/object/index.ts +14 -0
- package/src/internal/object/inspect.ts +46 -0
- package/src/internal/object/json-serializer.test.ts +97 -0
- package/src/internal/object/json-serializer.ts +188 -0
- package/src/internal/object/schema-validator.test.ts +186 -0
- package/src/internal/object/schema-validator.ts +6 -0
- package/src/internal/object/set-value.test.ts +281 -0
- package/src/internal/object/set-value.ts +165 -0
- package/src/internal/object/snapshot.ts +70 -0
- package/src/internal/object/typed-object.test.ts +34 -0
- package/src/internal/object/typed-object.ts +30 -0
- package/src/internal/proxy/change-context.ts +138 -0
- package/src/internal/proxy/change.test.ts +519 -0
- package/src/internal/proxy/define-hidden-property.ts +14 -0
- package/src/internal/proxy/errors.ts +42 -0
- package/src/internal/proxy/event-batch.ts +44 -0
- package/src/internal/proxy/handler.test.ts +123 -0
- package/src/internal/proxy/index.ts +17 -0
- package/src/internal/proxy/json-serializer.ts +87 -0
- package/src/internal/proxy/make-object.ts +96 -0
- package/src/internal/proxy/ownership.ts +253 -0
- package/src/internal/proxy/proxy-types.ts +23 -0
- package/src/internal/proxy/proxy-utils.ts +150 -0
- package/src/internal/proxy/reactive-array.ts +71 -0
- package/src/internal/proxy/reactive.ts +69 -0
- package/src/internal/proxy/schema-validator.ts +244 -0
- package/src/internal/proxy/schema.test.ts +145 -0
- package/src/internal/proxy/symbols.ts +7 -0
- package/src/internal/proxy/typed-handler.test.ts +318 -0
- package/src/internal/proxy/typed-handler.ts +442 -0
- package/src/internal/proxy/typed-object.test.ts +116 -0
- package/src/internal/ref/index.ts +6 -0
- package/src/internal/ref/ref-array.ts +39 -0
- package/src/internal/ref/ref.test.ts +101 -0
- package/src/internal/ref/ref.ts +548 -0
- package/src/internal/schema/compose.test.ts +42 -0
- package/src/internal/schema/compose.ts +36 -0
- package/src/internal/schema/echo-schema.ts +423 -0
- package/src/internal/schema/index.ts +7 -0
- package/src/internal/schema/manipulation.ts +92 -0
- package/src/internal/schema/persistent-schema.ts +27 -0
- package/src/internal/types/base.ts +43 -0
- package/src/internal/types/entity.ts +54 -0
- package/src/internal/types/index.ts +9 -0
- package/src/internal/types/meta.ts +66 -0
- package/src/internal/types/typename.ts +45 -0
- package/src/internal/types/version.ts +20 -0
- package/src/testing/api.test.ts +126 -0
- package/src/testing/index.ts +3 -1
- package/src/testing/test-data.ts +130 -0
- package/src/testing/test-schema.ts +238 -0
- package/src/testing/util.ts +85 -0
- package/dist/lib/browser/chunk-SVSJEELN.mjs +0 -619
- package/dist/lib/browser/chunk-SVSJEELN.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-53HXWYR6.mjs +0 -619
- package/dist/lib/node-esm/chunk-53HXWYR6.mjs.map +0 -7
- package/dist/types/src/experimental/database.d.ts +0 -8
- package/dist/types/src/experimental/database.d.ts.map +0 -1
- package/dist/types/src/experimental/index.d.ts +0 -1
- package/dist/types/src/experimental/index.d.ts.map +0 -1
- package/dist/types/src/experimental/queue.d.ts +0 -8
- package/dist/types/src/experimental/queue.d.ts.map +0 -1
- package/dist/types/src/experimental/space.d.ts +0 -8
- package/dist/types/src/experimental/space.d.ts.map +0 -1
- package/dist/types/src/query/dsl.d.ts +0 -218
- package/dist/types/src/query/dsl.d.ts.map +0 -1
- package/dist/types/src/query/dsl.test.d.ts +0 -2
- package/dist/types/src/query/dsl.test.d.ts.map +0 -1
- package/dist/types/src/query/index.d.ts +0 -2
- package/dist/types/src/query/index.d.ts.map +0 -1
- package/dist/types/src/testing/types.d.ts +0 -113
- package/dist/types/src/testing/types.d.ts.map +0 -1
- package/src/experimental/database.ts +0 -11
- package/src/experimental/index.ts +0 -7
- package/src/experimental/queue.ts +0 -11
- package/src/experimental/space.ts +0 -11
- package/src/query/dsl.test.ts +0 -323
- package/src/query/dsl.ts +0 -646
- package/src/query/index.ts +0 -5
- package/src/test/api.test.ts +0 -173
- package/src/testing/types.ts +0 -91
- /package/dist/types/src/{test → testing}/api.test.d.ts +0 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
|
|
7
|
+
import { FormatAnnotation, TypeFormat } from './types';
|
|
8
|
+
|
|
9
|
+
const encodeMultipleOf = (divisor: number) => 1 / Math.pow(10, divisor);
|
|
10
|
+
|
|
11
|
+
const encodeMultiple =
|
|
12
|
+
<A extends number>(divisor?: number) =>
|
|
13
|
+
<I, R>(self: Schema.Schema<A, I, R>) =>
|
|
14
|
+
divisor === undefined || divisor === 0 ? self : self.pipe(Schema.multipleOf(encodeMultipleOf(divisor)));
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Convert number of digits to multipleOf annotation.
|
|
18
|
+
*/
|
|
19
|
+
export const DecimalPrecision = Schema.transform(Schema.Number, Schema.Number, {
|
|
20
|
+
strict: true,
|
|
21
|
+
encode: (value) => encodeMultipleOf(value),
|
|
22
|
+
decode: (value) => Math.log10(1 / value),
|
|
23
|
+
}).annotations({
|
|
24
|
+
title: 'Number of digits',
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export const CurrencyAnnotationId = Symbol.for('@dxos/schema/annotation/Currency');
|
|
28
|
+
|
|
29
|
+
export type CurrencyAnnotation = {
|
|
30
|
+
decimals?: number;
|
|
31
|
+
code?: string;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* ISO 4217 currency code.
|
|
36
|
+
*/
|
|
37
|
+
export const Currency = ({ decimals, code }: CurrencyAnnotation = { decimals: 2 }) =>
|
|
38
|
+
Schema.Number.pipe(
|
|
39
|
+
encodeMultiple(decimals),
|
|
40
|
+
FormatAnnotation.set(TypeFormat.Currency),
|
|
41
|
+
Schema.annotations({
|
|
42
|
+
title: 'Currency',
|
|
43
|
+
description: 'Currency value',
|
|
44
|
+
...(code ? { [CurrencyAnnotationId]: code.toUpperCase() } : {}),
|
|
45
|
+
}),
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
export type PercentAnnotation = {
|
|
49
|
+
decimals?: number;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Integer.
|
|
54
|
+
*/
|
|
55
|
+
export const Integer = () =>
|
|
56
|
+
Schema.Number.pipe(
|
|
57
|
+
Schema.int(),
|
|
58
|
+
FormatAnnotation.set(TypeFormat.Integer),
|
|
59
|
+
Schema.annotations({
|
|
60
|
+
title: 'Integer',
|
|
61
|
+
description: 'Integer value',
|
|
62
|
+
}),
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Percent.
|
|
67
|
+
*/
|
|
68
|
+
// TODO(burdon): Define min/max (e.g., 0, 1).
|
|
69
|
+
export const Percent = ({ decimals }: PercentAnnotation = { decimals: 2 }) =>
|
|
70
|
+
Schema.Number.pipe(
|
|
71
|
+
encodeMultiple(decimals),
|
|
72
|
+
FormatAnnotation.set(TypeFormat.Percent),
|
|
73
|
+
Schema.annotations({
|
|
74
|
+
title: 'Percent',
|
|
75
|
+
description: 'Percentage value',
|
|
76
|
+
}),
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Unix timestamp.
|
|
81
|
+
* https://en.wikipedia.org/wiki/Unix_time
|
|
82
|
+
*/
|
|
83
|
+
export const Timestamp = Schema.Number.pipe(
|
|
84
|
+
FormatAnnotation.set(TypeFormat.Timestamp),
|
|
85
|
+
Schema.annotations({
|
|
86
|
+
title: 'Timestamp',
|
|
87
|
+
description: 'Unix timestamp',
|
|
88
|
+
}),
|
|
89
|
+
);
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
|
|
7
|
+
import { clamp } from '@dxos/util';
|
|
8
|
+
|
|
9
|
+
import { FormatAnnotation, TypeFormat } from './types';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* GeoJSON Format
|
|
13
|
+
* https://datatracker.ietf.org/doc/html/rfc7946
|
|
14
|
+
* https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.1
|
|
15
|
+
* https://en.wikipedia.org/wiki/Geographic_coordinate_system
|
|
16
|
+
* https://geojson.org
|
|
17
|
+
* {
|
|
18
|
+
* "type": "Point",
|
|
19
|
+
* "coordinates": [0, 51.47] // [longitude, latitude]
|
|
20
|
+
* }
|
|
21
|
+
* Note: optional third element for altitude.
|
|
22
|
+
*/
|
|
23
|
+
export const GeoPoint = Schema.Tuple(
|
|
24
|
+
Schema.Number.pipe(Schema.annotations({ title: 'Longitude' }), Schema.clamp(-180, 180), Schema.multipleOf(0.000001)),
|
|
25
|
+
Schema.Number.pipe(Schema.annotations({ title: 'Latitude' }), Schema.clamp(-90, 90), Schema.multipleOf(0.000001)),
|
|
26
|
+
Schema.optionalElement(Schema.Number).annotations({
|
|
27
|
+
title: 'Height ASL (m)',
|
|
28
|
+
}),
|
|
29
|
+
).pipe(
|
|
30
|
+
FormatAnnotation.set(TypeFormat.GeoPoint),
|
|
31
|
+
Schema.annotations({
|
|
32
|
+
title: 'GeoPoint',
|
|
33
|
+
description: 'GeoJSON Position',
|
|
34
|
+
}),
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
export type GeoPoint = Schema.Schema.Type<typeof GeoPoint>;
|
|
38
|
+
|
|
39
|
+
export type GeoLocation = {
|
|
40
|
+
longitude: number;
|
|
41
|
+
latitude: number;
|
|
42
|
+
height?: number;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Geolocation utilities for working with GeoPoint format.
|
|
47
|
+
*/
|
|
48
|
+
export namespace GeoLocation {
|
|
49
|
+
/**
|
|
50
|
+
* Convert latitude and longitude to GeoPoint (GeoJSON format [longitude, latitude, height?]).
|
|
51
|
+
* Clamps values to valid ranges: latitude [-90, 90], longitude [-180, 180].
|
|
52
|
+
*/
|
|
53
|
+
export const toGeoPoint = ({ longitude, latitude, height }: GeoLocation): GeoPoint => {
|
|
54
|
+
// TODO(ZaymonFC): Use schema validation instead of doing this manually.
|
|
55
|
+
const clampedLongitude = clamp(longitude, -180, 180);
|
|
56
|
+
const clampedLatitude = clamp(latitude, -90, 90);
|
|
57
|
+
return height !== undefined ? [clampedLongitude, clampedLatitude, height] : [clampedLongitude, clampedLatitude];
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Extract latitude and longitude from GeoPoint (GeoJSON format [longitude, latitude, height?]).
|
|
62
|
+
*/
|
|
63
|
+
export const fromGeoPoint = (geoPoint: GeoPoint | undefined): GeoLocation => {
|
|
64
|
+
if (!geoPoint) {
|
|
65
|
+
return { longitude: 0, latitude: 0 };
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const result: GeoLocation = {
|
|
69
|
+
longitude: geoPoint[0],
|
|
70
|
+
latitude: geoPoint[1],
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
// Add height if defined.
|
|
74
|
+
if (geoPoint[2] !== undefined) {
|
|
75
|
+
result.height = geoPoint[2];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return result;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Schema for a single select option. Used to define choices in a {single|multi}-select field.
|
|
9
|
+
*/
|
|
10
|
+
export const SelectOption = Schema.Struct({
|
|
11
|
+
/** Stable identifier for the option. */
|
|
12
|
+
id: Schema.NonEmptyString,
|
|
13
|
+
title: Schema.String,
|
|
14
|
+
/** Color palette used for visual styling. */
|
|
15
|
+
color: Schema.String,
|
|
16
|
+
}).pipe(Schema.mutable);
|
|
17
|
+
|
|
18
|
+
export type SelectOption = Schema.Schema.Type<typeof SelectOption>;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
import * as SchemaAST from 'effect/SchemaAST';
|
|
7
|
+
|
|
8
|
+
import { FormatAnnotation, TypeFormat } from './types';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Email address (RFC 5321)
|
|
12
|
+
* https://datatracker.ietf.org/doc/html/rfc5321#section-4.1.2
|
|
13
|
+
*/
|
|
14
|
+
export const Email = Schema.String.pipe(
|
|
15
|
+
Schema.pattern(/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/),
|
|
16
|
+
FormatAnnotation.set(TypeFormat.Email),
|
|
17
|
+
Schema.annotations({
|
|
18
|
+
title: 'Email',
|
|
19
|
+
description: 'Email address',
|
|
20
|
+
}),
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
26
|
+
// TODO(burdon): Implement.
|
|
27
|
+
export const Formula = Schema.String.pipe(FormatAnnotation.set(TypeFormat.Formula));
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
// TODO(burdon): Implement.
|
|
33
|
+
export const Hostname = Schema.String.pipe(FormatAnnotation.set(TypeFormat.Hostname));
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
*/
|
|
38
|
+
// TODO(burdon): Implement.
|
|
39
|
+
export const JSON = Schema.String.pipe(FormatAnnotation.set(TypeFormat.JSON));
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
*
|
|
43
|
+
*/
|
|
44
|
+
// TODO(burdon): Implement.
|
|
45
|
+
export const Markdown = Schema.String.pipe(FormatAnnotation.set(TypeFormat.Markdown));
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Regex
|
|
49
|
+
* https://json-schema.org/understanding-json-schema/reference/regular_expressions
|
|
50
|
+
* https://ecma-international.org/publications-and-standards/standards/ecma-262
|
|
51
|
+
*/
|
|
52
|
+
// TODO(burdon): Implement.
|
|
53
|
+
export const Regex = Schema.String.pipe(FormatAnnotation.set(TypeFormat.Regex));
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Multi-line text.
|
|
57
|
+
*/
|
|
58
|
+
export const Text = Schema.String.pipe(FormatAnnotation.set(TypeFormat.Text));
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* https://datatracker.ietf.org/doc/html/rfc3986#section-1.1.3
|
|
62
|
+
*/
|
|
63
|
+
export const URL = Schema.String.pipe(
|
|
64
|
+
Schema.pattern(/^(\w+?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)*\/?$/i),
|
|
65
|
+
FormatAnnotation.set(TypeFormat.URL),
|
|
66
|
+
Schema.annotations({
|
|
67
|
+
title: 'URL',
|
|
68
|
+
description: 'URL',
|
|
69
|
+
}),
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* UUID (RFC 4122)
|
|
74
|
+
* https://datatracker.ietf.org/doc/html/rfc4122
|
|
75
|
+
*/
|
|
76
|
+
export const UUID = Schema.UUID.pipe(
|
|
77
|
+
FormatAnnotation.set(TypeFormat.UUID),
|
|
78
|
+
Schema.annotations({
|
|
79
|
+
[SchemaAST.ExamplesAnnotationId]: ['3e4666bf-d5e5-4aa7-b8ce-cefe41c7568a'],
|
|
80
|
+
}),
|
|
81
|
+
);
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Function from 'effect/Function';
|
|
6
|
+
import type * as JSONSchema from 'effect/JSONSchema';
|
|
7
|
+
import * as Option from 'effect/Option';
|
|
8
|
+
import * as SchemaAST from 'effect/SchemaAST';
|
|
9
|
+
|
|
10
|
+
import { createAnnotationHelper } from '../annotations';
|
|
11
|
+
import { type JsonSchemaType } from '../json-schema';
|
|
12
|
+
|
|
13
|
+
// TODO(burdon): Rename PropertyType.
|
|
14
|
+
export type ScalarType =
|
|
15
|
+
| JSONSchema.JsonSchema7Object
|
|
16
|
+
| JSONSchema.JsonSchema7String
|
|
17
|
+
| JSONSchema.JsonSchema7Number
|
|
18
|
+
| JSONSchema.JsonSchema7Boolean
|
|
19
|
+
| JSONSchema.JsonSchema7Ref;
|
|
20
|
+
|
|
21
|
+
// TODO(burdon): Rename ValueType and change to disciminated union.
|
|
22
|
+
// export type ValueType = 'array' | 'object' | 'string' | 'number' | 'boolean' | 'ref';
|
|
23
|
+
export enum TypeEnum {
|
|
24
|
+
Array = 'array', // TODO(burdon): Remove?
|
|
25
|
+
Object = 'object',
|
|
26
|
+
String = 'string',
|
|
27
|
+
Number = 'number',
|
|
28
|
+
Boolean = 'boolean',
|
|
29
|
+
Ref = 'ref',
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// TODO(burdon): Ref?
|
|
33
|
+
export const getTypeEnum = (property: JsonSchemaType): TypeEnum | undefined => {
|
|
34
|
+
switch (property.type) {
|
|
35
|
+
case 'array':
|
|
36
|
+
return TypeEnum.Array;
|
|
37
|
+
case 'object':
|
|
38
|
+
return TypeEnum.Object;
|
|
39
|
+
case 'string':
|
|
40
|
+
return TypeEnum.String;
|
|
41
|
+
case 'number':
|
|
42
|
+
return TypeEnum.Number;
|
|
43
|
+
case 'boolean':
|
|
44
|
+
return TypeEnum.Boolean;
|
|
45
|
+
default:
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* https://json-schema.org/understanding-json-schema/reference/schema
|
|
52
|
+
* https://json-schema.org/understanding-json-schema/reference/string#built-in-formats
|
|
53
|
+
*/
|
|
54
|
+
export const FormatAnnotationId = Symbol.for('@dxos/schema/annotation/Format');
|
|
55
|
+
|
|
56
|
+
export const FormatAnnotation = createAnnotationHelper<TypeFormat>(FormatAnnotationId);
|
|
57
|
+
|
|
58
|
+
/** @deprecated */
|
|
59
|
+
export const getFormatAnnotation = (node: SchemaAST.AST): TypeFormat | undefined =>
|
|
60
|
+
Function.pipe(SchemaAST.getAnnotation<TypeFormat>(FormatAnnotationId)(node), Option.getOrUndefined);
|
|
61
|
+
|
|
62
|
+
// TODO(burdon): Rename Format; Change to discriminated union?
|
|
63
|
+
export enum TypeFormat {
|
|
64
|
+
None = 'none',
|
|
65
|
+
|
|
66
|
+
//
|
|
67
|
+
// Scalar
|
|
68
|
+
//
|
|
69
|
+
|
|
70
|
+
String = 'string',
|
|
71
|
+
Number = 'number',
|
|
72
|
+
Boolean = 'boolean',
|
|
73
|
+
Ref = 'ref',
|
|
74
|
+
|
|
75
|
+
//
|
|
76
|
+
// { type: 'string' }
|
|
77
|
+
//
|
|
78
|
+
|
|
79
|
+
DID = 'did', // Users, etc.
|
|
80
|
+
DXN = 'dxn',
|
|
81
|
+
Email = 'email',
|
|
82
|
+
Formula = 'formula', // Spreadsheet formula.
|
|
83
|
+
Hostname = 'hostname',
|
|
84
|
+
JSON = 'json',
|
|
85
|
+
Markdown = 'markdown',
|
|
86
|
+
Regex = 'regex',
|
|
87
|
+
SingleSelect = 'single-select',
|
|
88
|
+
Text = 'text',
|
|
89
|
+
MultiSelect = 'multi-select',
|
|
90
|
+
URL = 'url',
|
|
91
|
+
UUID = 'uuid',
|
|
92
|
+
|
|
93
|
+
//
|
|
94
|
+
// { type: 'number' }
|
|
95
|
+
//
|
|
96
|
+
|
|
97
|
+
Currency = 'currency',
|
|
98
|
+
Integer = 'integer',
|
|
99
|
+
Percent = 'percent',
|
|
100
|
+
Timestamp = 'timestamp',
|
|
101
|
+
|
|
102
|
+
//
|
|
103
|
+
// { type: 'date' }
|
|
104
|
+
//
|
|
105
|
+
|
|
106
|
+
DateTime = 'date-time',
|
|
107
|
+
Date = 'date',
|
|
108
|
+
Time = 'time',
|
|
109
|
+
Duration = 'duration',
|
|
110
|
+
|
|
111
|
+
//
|
|
112
|
+
// { type: 'object' }
|
|
113
|
+
//
|
|
114
|
+
|
|
115
|
+
GeoPoint = 'lnglat',
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export const FormatEnums = Object.values(TypeFormat).sort();
|
|
119
|
+
|
|
120
|
+
export const PropertyKind = {
|
|
121
|
+
type: TypeEnum,
|
|
122
|
+
format: TypeFormat,
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Default formats
|
|
127
|
+
*/
|
|
128
|
+
export const typeToFormat: Partial<Record<TypeEnum, TypeFormat>> = {
|
|
129
|
+
[TypeEnum.String]: TypeFormat.String,
|
|
130
|
+
[TypeEnum.Number]: TypeFormat.Number,
|
|
131
|
+
[TypeEnum.Boolean]: TypeFormat.Boolean,
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Map of format to type.
|
|
136
|
+
*/
|
|
137
|
+
export const formatToType: Record<TypeFormat, TypeEnum> = {
|
|
138
|
+
[TypeFormat.None]: undefined as any,
|
|
139
|
+
[TypeFormat.String]: TypeEnum.String,
|
|
140
|
+
[TypeFormat.Number]: TypeEnum.Number,
|
|
141
|
+
[TypeFormat.Boolean]: TypeEnum.Boolean,
|
|
142
|
+
[TypeFormat.Ref]: TypeEnum.Ref,
|
|
143
|
+
|
|
144
|
+
// Strings
|
|
145
|
+
[TypeFormat.DID]: TypeEnum.String,
|
|
146
|
+
[TypeFormat.DXN]: TypeEnum.String,
|
|
147
|
+
[TypeFormat.Email]: TypeEnum.String,
|
|
148
|
+
[TypeFormat.Formula]: TypeEnum.String,
|
|
149
|
+
[TypeFormat.Hostname]: TypeEnum.String,
|
|
150
|
+
[TypeFormat.JSON]: TypeEnum.String,
|
|
151
|
+
[TypeFormat.Markdown]: TypeEnum.String,
|
|
152
|
+
[TypeFormat.Regex]: TypeEnum.String,
|
|
153
|
+
[TypeFormat.URL]: TypeEnum.String,
|
|
154
|
+
[TypeFormat.UUID]: TypeEnum.String,
|
|
155
|
+
[TypeFormat.SingleSelect]: TypeEnum.String,
|
|
156
|
+
[TypeFormat.Text]: TypeEnum.String,
|
|
157
|
+
[TypeFormat.MultiSelect]: TypeEnum.Object,
|
|
158
|
+
|
|
159
|
+
// Dates
|
|
160
|
+
[TypeFormat.Date]: TypeEnum.String,
|
|
161
|
+
[TypeFormat.DateTime]: TypeEnum.String,
|
|
162
|
+
[TypeFormat.Duration]: TypeEnum.String,
|
|
163
|
+
[TypeFormat.Time]: TypeEnum.String,
|
|
164
|
+
|
|
165
|
+
// Numbers
|
|
166
|
+
[TypeFormat.Currency]: TypeEnum.Number,
|
|
167
|
+
[TypeFormat.Integer]: TypeEnum.Number,
|
|
168
|
+
[TypeFormat.Percent]: TypeEnum.Number,
|
|
169
|
+
[TypeFormat.Timestamp]: TypeEnum.Number,
|
|
170
|
+
|
|
171
|
+
// Objects
|
|
172
|
+
[TypeFormat.GeoPoint]: TypeEnum.Array,
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Allowed value options for select.
|
|
177
|
+
*/
|
|
178
|
+
export const OptionsAnnotationId = Symbol.for('@dxos/schema/annotation/Options');
|
|
179
|
+
|
|
180
|
+
// TODO(wittjosiah): Reconcile with `SelectOption`.
|
|
181
|
+
export type Options = string | number;
|
|
182
|
+
export const OptionsAnnotation = createAnnotationHelper<Options[]>(OptionsAnnotationId);
|
|
183
|
+
|
|
184
|
+
/** @deprecated */
|
|
185
|
+
export const getOptionsAnnotation = (node: SchemaAST.AST): Options[] | undefined =>
|
|
186
|
+
Function.pipe(SchemaAST.getAnnotation<Options[]>(OptionsAnnotationId)(node), Option.getOrUndefined);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// TODO(burdon): Import directly (not part of ECHO API).
|
|
6
|
+
export { JsonPath, JsonProp, getValue, splitJsonPath } from '@dxos/effect';
|
|
7
|
+
|
|
8
|
+
export * from './annotations';
|
|
9
|
+
export * from './api';
|
|
10
|
+
export * from './entities';
|
|
11
|
+
export * from './formats';
|
|
12
|
+
export * from './json-schema';
|
|
13
|
+
export * from './ref';
|
|
14
|
+
export * from './types';
|
|
15
|
+
|
|
16
|
+
// TODO(wittjosiah): Required to ensure types are portable (need to export all types required for downstream inference).
|
|
17
|
+
export * from './object';
|
|
18
|
+
export * from './proxy';
|
|
19
|
+
export * from './schema';
|
|
20
|
+
|
|
21
|
+
// export {
|
|
22
|
+
// createObject,
|
|
23
|
+
// createQueueDXN,
|
|
24
|
+
// isDeleted,
|
|
25
|
+
// objectFromJSON,
|
|
26
|
+
// objectToJSON,
|
|
27
|
+
// setRefResolverOnData,
|
|
28
|
+
// SchemaValidator,
|
|
29
|
+
// TypedObject,
|
|
30
|
+
// } from './object';
|
|
31
|
+
// export { makeObject } from './proxy';
|
|
32
|
+
// export {
|
|
33
|
+
// type BaseSchema,
|
|
34
|
+
// EchoSchema,
|
|
35
|
+
// ImmutableSchema,
|
|
36
|
+
// RuntimeSchemaRegistry,
|
|
37
|
+
// PersistentSchema,
|
|
38
|
+
// isMutable,
|
|
39
|
+
// } from './schema';
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as SchemaAST from 'effect/SchemaAST';
|
|
6
|
+
|
|
7
|
+
import { GeneratorAnnotationId, LabelAnnotationId, PropertyMetaAnnotationId } from '../annotations';
|
|
8
|
+
import { CurrencyAnnotationId, FormatAnnotationId } from '../formats';
|
|
9
|
+
import { type JsonSchemaEchoAnnotations, type JsonSchemaType } from '../json-schema';
|
|
10
|
+
|
|
11
|
+
//
|
|
12
|
+
// This file configures annotations for JSON encoding/decoding.
|
|
13
|
+
//
|
|
14
|
+
|
|
15
|
+
// Go on the root level.
|
|
16
|
+
type RootJsonSchemaProperty = keyof JsonSchemaType;
|
|
17
|
+
|
|
18
|
+
// Go on the namespaced `annotations` property.
|
|
19
|
+
type NamespacedJsonSchemaProperty = keyof JsonSchemaEchoAnnotations;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* List of annotations for JSON encoding/decoding.
|
|
23
|
+
* Omits default effect-schema annotations since they are encoded with default serializer.
|
|
24
|
+
*/
|
|
25
|
+
// TODO(burdon): Reconcile with `EchoAnnotations`.
|
|
26
|
+
export const CustomAnnotations: Partial<Record<RootJsonSchemaProperty, symbol>> = {
|
|
27
|
+
format: FormatAnnotationId,
|
|
28
|
+
currency: CurrencyAnnotationId,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* List of annotations for JSON decoding only.
|
|
33
|
+
* Includes default effect annotations.
|
|
34
|
+
*/
|
|
35
|
+
export const DecodedAnnotations: Partial<Record<RootJsonSchemaProperty, symbol>> = {
|
|
36
|
+
title: SchemaAST.TitleAnnotationId,
|
|
37
|
+
description: SchemaAST.DescriptionAnnotationId,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Annotations that go into ECHO namespace in json-schema.
|
|
42
|
+
*/
|
|
43
|
+
// TODO(dmaretskyi): Consider removing ECHO namespace and putting them at the top level.
|
|
44
|
+
// TODO(dmaretskyi): Move to format.ts when circular imports are solved
|
|
45
|
+
export const EchoAnnotations: Partial<Record<NamespacedJsonSchemaProperty, symbol>> = {
|
|
46
|
+
// TODO(dmaretskyi): `FieldLookupAnnotationId` might go here, but lets remove it entirely and use LabelAnnotation instead.
|
|
47
|
+
meta: PropertyMetaAnnotationId,
|
|
48
|
+
generator: GeneratorAnnotationId,
|
|
49
|
+
labelProp: LabelAnnotationId,
|
|
50
|
+
};
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as JSONSchema from 'effect/JSONSchema';
|
|
6
|
+
import * as Option from 'effect/Option';
|
|
7
|
+
import * as Schema from 'effect/Schema';
|
|
8
|
+
import * as SchemaAST from 'effect/SchemaAST';
|
|
9
|
+
import { expect, test } from 'vitest';
|
|
10
|
+
|
|
11
|
+
import { log } from '@dxos/log';
|
|
12
|
+
|
|
13
|
+
test('json-schema annotations for filter refinement get combined', () => {
|
|
14
|
+
const type = Schema.Number.annotations({
|
|
15
|
+
jsonSchema: { foo: 'foo' },
|
|
16
|
+
}).pipe(Schema.filter(() => true, { jsonSchema: { bar: 'bar' } }));
|
|
17
|
+
|
|
18
|
+
const jsonSchema = JSONSchema.make(type);
|
|
19
|
+
expect(jsonSchema).toEqual({
|
|
20
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
21
|
+
foo: 'foo',
|
|
22
|
+
bar: 'bar',
|
|
23
|
+
type: 'number',
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
test('json-schema annotations on types do not override the default serialization', () => {
|
|
28
|
+
const type = Schema.Number.annotations({
|
|
29
|
+
jsonSchema: { foo: 'foo' },
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const jsonSchema = JSONSchema.make(type);
|
|
33
|
+
expect(jsonSchema).toEqual({
|
|
34
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
35
|
+
foo: 'foo',
|
|
36
|
+
type: 'number',
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// pass
|
|
41
|
+
test('number with title and description annotations', () => {
|
|
42
|
+
const number = Schema.Number.annotations({
|
|
43
|
+
title: 'My Title',
|
|
44
|
+
description: 'My Description',
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
expect(JSONSchema.make(number)).toEqual({
|
|
48
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
49
|
+
type: 'number',
|
|
50
|
+
title: 'My Title',
|
|
51
|
+
description: 'My Description',
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// pass
|
|
56
|
+
test('date with title and description annotations', () => {
|
|
57
|
+
const date = Schema.Date.annotations({
|
|
58
|
+
title: 'My Title',
|
|
59
|
+
description: 'My Description',
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
expect(JSONSchema.make(date)).toEqual({
|
|
63
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
64
|
+
$defs: {
|
|
65
|
+
DateFromString: {
|
|
66
|
+
description: 'a string to be decoded into a Date',
|
|
67
|
+
type: 'string',
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
$ref: '#/$defs/DateFromString',
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// fail
|
|
75
|
+
test('declare', () => {
|
|
76
|
+
class MyType {}
|
|
77
|
+
const type = Schema.declare<MyType>((x) => x instanceof MyType, {
|
|
78
|
+
jsonSchema: {
|
|
79
|
+
type: 'my-type',
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
expect(JSONSchema.make(type)).toEqual({
|
|
84
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
85
|
+
type: 'my-type',
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
expect(type.pipe(Schema.is)(new MyType())).toBe(true);
|
|
89
|
+
expect(type.pipe(Schema.is)({})).toBe(false);
|
|
90
|
+
|
|
91
|
+
const withAnnotations = type.annotations({
|
|
92
|
+
title: 'My Title',
|
|
93
|
+
description: 'My Description',
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
expect(JSONSchema.make(withAnnotations)).toEqual({
|
|
97
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
98
|
+
type: 'my-type',
|
|
99
|
+
title: 'My Title',
|
|
100
|
+
description: 'My Description',
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
// pass
|
|
105
|
+
test('declare with refinement', () => {
|
|
106
|
+
class MyType {}
|
|
107
|
+
const type = Schema.declare<MyType>((x) => x instanceof MyType, {
|
|
108
|
+
jsonSchema: {
|
|
109
|
+
type: 'my-type',
|
|
110
|
+
},
|
|
111
|
+
}).pipe(Schema.filter(() => true, { jsonSchema: {} }));
|
|
112
|
+
|
|
113
|
+
const named = type.annotations({
|
|
114
|
+
title: 'My Title',
|
|
115
|
+
description: 'My Description',
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
expect(JSONSchema.make(named)).toEqual({
|
|
119
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
120
|
+
type: 'my-type',
|
|
121
|
+
title: 'My Title',
|
|
122
|
+
description: 'My Description',
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
test("default title annotations don't get serialized", () => {
|
|
127
|
+
const schema = Schema.String;
|
|
128
|
+
|
|
129
|
+
expect(SchemaAST.getTitleAnnotation(schema.ast).pipe(Option.getOrUndefined)).toEqual('string');
|
|
130
|
+
expect(SchemaAST.getDescriptionAnnotation(schema.ast).pipe(Option.getOrUndefined)).toEqual('a string');
|
|
131
|
+
|
|
132
|
+
expect(JSONSchema.make(schema)).toEqual({
|
|
133
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
134
|
+
type: 'string',
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
test.skip('ast comparison', () => {
|
|
139
|
+
log.info('ast', {
|
|
140
|
+
default: Schema.String.ast,
|
|
141
|
+
annotated: Schema.String.annotations({ title: 'Custom title', description: 'Custom description' }).ast,
|
|
142
|
+
});
|
|
143
|
+
});
|