@dxos/echo 0.8.4-main.66e292d → 0.8.4-main.69d29f4
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 +1 -2
- 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-2RMVRVOB.mjs +250 -0
- package/dist/lib/browser/chunk-2RMVRVOB.mjs.map +7 -0
- package/dist/lib/browser/chunk-5RDNDPMX.mjs +74 -0
- package/dist/lib/browser/chunk-5RDNDPMX.mjs.map +7 -0
- package/dist/lib/browser/chunk-73M2G455.mjs +98 -0
- package/dist/lib/browser/chunk-73M2G455.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-AFGYYVVQ.mjs +57 -0
- package/dist/lib/browser/chunk-AFGYYVVQ.mjs.map +7 -0
- package/dist/lib/browser/chunk-BC6R4CAF.mjs +24 -0
- package/dist/lib/browser/chunk-BC6R4CAF.mjs.map +7 -0
- package/dist/lib/browser/chunk-BPYFLHWO.mjs +158 -0
- package/dist/lib/browser/chunk-BPYFLHWO.mjs.map +7 -0
- package/dist/lib/browser/chunk-CBPFF3ZO.mjs +204 -0
- package/dist/lib/browser/chunk-CBPFF3ZO.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-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-L4RXUJHJ.mjs +143 -0
- package/dist/lib/browser/chunk-L4RXUJHJ.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-7GH6RXJ3.mjs → chunk-PAM4KEXE.mjs} +2005 -1841
- package/dist/lib/browser/chunk-PAM4KEXE.mjs.map +7 -0
- package/dist/lib/browser/chunk-QIWDIPLR.mjs +41 -0
- package/dist/lib/browser/chunk-QIWDIPLR.mjs.map +7 -0
- package/dist/lib/browser/chunk-R3S54KRI.mjs +403 -0
- package/dist/lib/browser/chunk-R3S54KRI.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-TPIL3G6Y.mjs +288 -0
- package/dist/lib/browser/chunk-TPIL3G6Y.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-ZHXZGIXD.mjs +9 -0
- package/dist/lib/browser/chunk-ZHXZGIXD.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +65 -25
- package/dist/lib/browser/internal/index.mjs +213 -92
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +80 -41
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- 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-2RIFBW3A.mjs +250 -0
- package/dist/lib/node-esm/chunk-2RIFBW3A.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-5CB2ZW74.mjs +57 -0
- package/dist/lib/node-esm/chunk-5CB2ZW74.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-M4B6BMD2.mjs → chunk-5U5F4AWK.mjs} +2005 -1841
- package/dist/lib/node-esm/chunk-5U5F4AWK.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-BKYE5IW6.mjs +158 -0
- package/dist/lib/node-esm/chunk-BKYE5IW6.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-BYOD7EVP.mjs +98 -0
- package/dist/lib/node-esm/chunk-BYOD7EVP.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-K37NA7PO.mjs +43 -0
- package/dist/lib/node-esm/chunk-K37NA7PO.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-LIXUCQJM.mjs +41 -0
- package/dist/lib/node-esm/chunk-LIXUCQJM.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-OZEDKT4R.mjs +204 -0
- package/dist/lib/node-esm/chunk-OZEDKT4R.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-PW3VCWL5.mjs +24 -0
- package/dist/lib/node-esm/chunk-PW3VCWL5.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-TSTKBFST.mjs +403 -0
- package/dist/lib/node-esm/chunk-TSTKBFST.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-UV63HEHQ.mjs +143 -0
- package/dist/lib/node-esm/chunk-UV63HEHQ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-WXLVPCRJ.mjs +288 -0
- package/dist/lib/node-esm/chunk-WXLVPCRJ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-WZ6YBELW.mjs +74 -0
- package/dist/lib/node-esm/chunk-WZ6YBELW.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-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/index.mjs +65 -25
- package/dist/lib/node-esm/internal/index.mjs +213 -92
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +80 -41
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/types/src/Annotation.d.ts +1 -1
- package/dist/types/src/Annotation.d.ts.map +1 -1
- package/dist/types/src/Database.d.ts +117 -60
- package/dist/types/src/Database.d.ts.map +1 -1
- package/dist/types/src/Entity.d.ts +111 -5
- package/dist/types/src/Entity.d.ts.map +1 -1
- 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/{errors.d.ts → Err.d.ts} +13 -17
- 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.map +1 -1
- package/dist/types/src/Hypergraph.d.ts +60 -0
- package/dist/types/src/Hypergraph.d.ts.map +1 -0
- package/dist/types/src/Obj.d.ts +268 -76
- 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/query.d.ts → Query.d.ts} +53 -50
- 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 +9 -7
- package/dist/types/src/Ref.d.ts.map +1 -1
- package/dist/types/src/Relation.d.ts +235 -18
- 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 +6 -6
- package/dist/types/src/Tag.d.ts.map +1 -1
- package/dist/types/src/Type.d.ts +213 -50
- 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 +8 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/internal/annotations/annotations.d.ts +23 -27
- package/dist/types/src/internal/annotations/annotations.d.ts.map +1 -1
- package/dist/types/src/internal/annotations/util.d.ts +1 -0
- package/dist/types/src/internal/annotations/util.d.ts.map +1 -1
- 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 +13 -3
- package/dist/types/src/internal/entities/entity.d.ts.map +1 -1
- package/dist/types/src/internal/entities/index.d.ts +1 -1
- package/dist/types/src/internal/entities/index.d.ts.map +1 -1
- package/dist/types/src/internal/entities/model.d.ts +14 -7
- package/dist/types/src/internal/entities/model.d.ts.map +1 -1
- package/dist/types/src/internal/entities/object.d.ts +8 -1
- package/dist/types/src/internal/entities/object.d.ts.map +1 -1
- package/dist/types/src/internal/entities/relation.d.ts +8 -1
- package/dist/types/src/internal/entities/relation.d.ts.map +1 -1
- package/dist/types/src/internal/formats/format.d.ts +4 -4
- package/dist/types/src/internal/formats/format.d.ts.map +1 -1
- package/dist/types/src/internal/formats/select.d.ts +6 -4
- package/dist/types/src/internal/formats/select.d.ts.map +1 -1
- package/dist/types/src/internal/formats/string.d.ts +4 -0
- package/dist/types/src/internal/formats/string.d.ts.map +1 -1
- package/dist/types/src/internal/formats/types.d.ts +6 -2
- package/dist/types/src/internal/formats/types.d.ts.map +1 -1
- package/dist/types/src/internal/index.d.ts +2 -1
- package/dist/types/src/internal/index.d.ts.map +1 -1
- package/dist/types/src/internal/json-schema/json-schema-normalize.d.ts.map +1 -1
- package/dist/types/src/internal/json-schema/json-schema-type.d.ts +130 -29
- package/dist/types/src/internal/json-schema/json-schema-type.d.ts.map +1 -1
- package/dist/types/src/internal/json-schema/json-schema.d.ts +2 -1
- package/dist/types/src/internal/json-schema/json-schema.d.ts.map +1 -1
- 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/create-object.d.ts +1 -1
- package/dist/types/src/internal/object/index.d.ts +3 -0
- package/dist/types/src/internal/object/index.d.ts.map +1 -1
- package/dist/types/src/internal/object/json-serializer.d.ts +13 -7
- package/dist/types/src/internal/object/json-serializer.d.ts.map +1 -1
- package/dist/types/src/internal/object/schema-validator.d.ts +1 -14
- package/dist/types/src/internal/object/schema-validator.d.ts.map +1 -1
- 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 +7 -13
- package/dist/types/src/internal/object/typed-object.d.ts.map +1 -1
- 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/index.d.ts +11 -0
- package/dist/types/src/internal/proxy/index.d.ts.map +1 -1
- 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 +2 -4
- package/dist/types/src/internal/proxy/make-object.d.ts.map +1 -1
- 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/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 +14 -11
- package/dist/types/src/internal/proxy/typed-handler.d.ts.map +1 -1
- package/dist/types/src/internal/ref/ref-array.d.ts +4 -4
- package/dist/types/src/internal/ref/ref-array.d.ts.map +1 -1
- package/dist/types/src/internal/ref/ref.d.ts +16 -7
- package/dist/types/src/internal/ref/ref.d.ts.map +1 -1
- package/dist/types/src/internal/schema/compose.d.ts +2 -1
- package/dist/types/src/internal/schema/compose.d.ts.map +1 -1
- package/dist/types/src/internal/schema/echo-schema.d.ts +15 -3
- package/dist/types/src/internal/schema/echo-schema.d.ts.map +1 -1
- package/dist/types/src/internal/schema/index.d.ts +0 -2
- package/dist/types/src/internal/schema/index.d.ts.map +1 -1
- package/dist/types/src/internal/schema/persistent-schema.d.ts +9 -7
- package/dist/types/src/internal/schema/persistent-schema.d.ts.map +1 -1
- package/dist/types/src/internal/types/base.d.ts +5 -16
- package/dist/types/src/internal/types/base.d.ts.map +1 -1
- package/dist/types/src/internal/types/entity.d.ts +27 -2
- package/dist/types/src/internal/types/entity.d.ts.map +1 -1
- package/dist/types/src/internal/types/meta.d.ts +6 -14
- package/dist/types/src/internal/types/meta.d.ts.map +1 -1
- package/dist/types/src/testing/test-schema.d.ts +141 -175
- package/dist/types/src/testing/test-schema.d.ts.map +1 -1
- package/dist/types/src/testing/util.d.ts +6 -1
- package/dist/types/src/testing/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +130 -23
- package/src/Annotation.ts +5 -4
- package/src/Database.ts +229 -82
- package/src/Entity.test.ts +22 -0
- package/src/Entity.ts +173 -7
- package/src/{errors.ts → Err.ts} +2 -2
- package/src/Filter.ts +376 -0
- package/src/Format.ts +0 -2
- package/src/Hypergraph.ts +74 -0
- package/src/Obj.test.ts +386 -0
- package/src/Obj.ts +338 -250
- package/src/{query/order.ts → Order.ts} +19 -9
- package/src/{query/query.test.ts → Query.test.ts} +180 -49
- package/src/{query/query.ts → Query.ts} +115 -122
- package/src/QueryResult.ts +106 -0
- package/src/Ref.ts +20 -3
- package/src/Relation.test.ts +82 -0
- package/src/Relation.ts +364 -27
- package/src/SchemaRegistry.ts +105 -0
- package/src/Tag.ts +1 -1
- package/src/Type.test.ts +52 -0
- package/src/Type.ts +322 -88
- package/src/index.ts +9 -5
- package/src/internal/README.md +36 -17
- package/src/internal/annotations/annotations.test.ts +6 -6
- package/src/internal/annotations/annotations.ts +73 -76
- package/src/internal/annotations/util.ts +2 -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 +36 -19
- package/src/internal/entities/index.ts +1 -1
- package/src/internal/entities/model.ts +17 -12
- package/src/internal/entities/object.ts +21 -8
- package/src/internal/entities/relation.ts +23 -7
- package/src/internal/formats/format.test.ts +1 -1
- package/src/internal/formats/format.ts +7 -8
- package/src/internal/formats/object.ts +2 -2
- package/src/internal/formats/select.ts +6 -4
- package/src/internal/formats/string.ts +5 -0
- package/src/internal/formats/types.ts +9 -3
- package/src/internal/index.ts +2 -1
- package/src/internal/json-schema/json-schema-normalize.ts +4 -2
- package/src/internal/json-schema/json-schema-type.ts +31 -32
- package/src/internal/json-schema/json-schema.test.ts +19 -17
- package/src/internal/json-schema/json-schema.ts +14 -10
- package/src/internal/object/clone.ts +48 -0
- package/src/internal/object/create-object.ts +2 -2
- package/src/internal/object/index.ts +3 -0
- package/src/internal/object/inspect.ts +3 -3
- package/src/internal/object/json-serializer.test.ts +6 -2
- package/src/internal/object/json-serializer.ts +28 -70
- package/src/internal/object/schema-validator.test.ts +3 -7
- package/src/internal/object/schema-validator.ts +2 -238
- 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 +11 -11
- package/src/internal/object/typed-object.ts +8 -72
- 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 +30 -80
- package/src/internal/proxy/index.ts +11 -0
- package/src/internal/proxy/json-serializer.ts +87 -0
- package/src/internal/proxy/make-object.ts +33 -50
- 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 +23 -15
- package/src/internal/proxy/symbols.ts +7 -0
- package/src/internal/proxy/typed-handler.test.ts +247 -35
- package/src/internal/proxy/typed-handler.ts +265 -56
- package/src/internal/proxy/typed-object.test.ts +37 -26
- package/src/internal/ref/ref-array.ts +4 -4
- package/src/internal/ref/ref.test.ts +1 -1
- package/src/internal/ref/ref.ts +64 -40
- package/src/internal/schema/compose.test.ts +3 -3
- package/src/internal/schema/compose.ts +13 -9
- package/src/internal/schema/echo-schema.ts +49 -11
- package/src/internal/schema/index.ts +0 -2
- package/src/internal/schema/persistent-schema.ts +3 -4
- package/src/internal/types/base.ts +6 -21
- package/src/internal/types/entity.ts +35 -4
- package/src/internal/types/meta.ts +13 -24
- package/src/testing/api.test.ts +31 -5
- package/src/testing/test-schema.ts +55 -30
- package/src/testing/util.ts +22 -15
- package/dist/lib/browser/chunk-7GH6RXJ3.mjs.map +0 -7
- package/dist/lib/browser/chunk-E4UTVJNF.mjs +0 -1111
- package/dist/lib/browser/chunk-E4UTVJNF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-JE5RXM2I.mjs +0 -1111
- package/dist/lib/node-esm/chunk-JE5RXM2I.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-M4B6BMD2.mjs.map +0 -7
- package/dist/types/src/errors.d.ts.map +0 -1
- package/dist/types/src/internal/entities/expando.d.ts +0 -16
- package/dist/types/src/internal/entities/expando.d.ts.map +0 -1
- package/dist/types/src/internal/schema/runtime-schema-registry.d.ts +0 -18
- package/dist/types/src/internal/schema/runtime-schema-registry.d.ts.map +0 -1
- package/dist/types/src/internal/schema/snapshot.d.ts +0 -6
- package/dist/types/src/internal/schema/snapshot.d.ts.map +0 -1
- package/dist/types/src/query/filter.d.ts +0 -167
- package/dist/types/src/query/filter.d.ts.map +0 -1
- package/dist/types/src/query/index.d.ts +0 -5
- package/dist/types/src/query/index.d.ts.map +0 -1
- package/dist/types/src/query/order.d.ts +0 -12
- package/dist/types/src/query/order.d.ts.map +0 -1
- package/dist/types/src/query/query.d.ts.map +0 -1
- package/dist/types/src/query/query.test.d.ts +0 -2
- package/dist/types/src/query/query.test.d.ts.map +0 -1
- package/dist/types/src/query/testing.d.ts +0 -51
- package/dist/types/src/query/testing.d.ts.map +0 -1
- package/dist/types/src/query/types.d.ts +0 -17
- package/dist/types/src/query/types.d.ts.map +0 -1
- package/dist/types/src/query/util.d.ts +0 -8
- package/dist/types/src/query/util.d.ts.map +0 -1
- package/src/internal/entities/expando.ts +0 -23
- package/src/internal/schema/runtime-schema-registry.ts +0 -78
- package/src/internal/schema/snapshot.ts +0 -25
- package/src/query/filter.ts +0 -455
- package/src/query/index.ts +0 -9
- package/src/query/testing.ts +0 -64
- package/src/query/types.ts +0 -23
- package/src/query/util.ts +0 -25
|
@@ -9,33 +9,42 @@ import type * as Types from 'effect/Types';
|
|
|
9
9
|
import { type ToMutable } from '@dxos/util';
|
|
10
10
|
|
|
11
11
|
import { type TypeMeta } from '../annotations';
|
|
12
|
-
import { type
|
|
12
|
+
import { type AnyEntity, type EntityKind, SchemaKindId } from '../types';
|
|
13
13
|
|
|
14
14
|
// TODO(burdon): Define Schema type for `typename` and use consistently for all DXN-like properties.
|
|
15
15
|
|
|
16
16
|
// type RequiredKeys<T> = { [K in keyof T]-?: {} extends Pick<T, K> ? never : K }[keyof T];
|
|
17
|
-
export type EchoTypeSchemaProps<T, ExtraFields = {}> = Types.Simplify<
|
|
17
|
+
export type EchoTypeSchemaProps<T, ExtraFields = {}> = Types.Simplify<AnyEntity & ToMutable<T> & ExtraFields>;
|
|
18
18
|
|
|
19
19
|
// TODO(burdon): Rename EchoEntitySchema.
|
|
20
|
-
export interface EchoTypeSchema<
|
|
21
|
-
extends
|
|
20
|
+
export interface EchoTypeSchema<
|
|
21
|
+
Self extends Schema.Schema.Any,
|
|
22
|
+
ExtraFields = {},
|
|
23
|
+
K extends EntityKind = EntityKind,
|
|
24
|
+
Fields extends Schema.Struct.Fields = Schema.Struct.Fields,
|
|
25
|
+
> extends TypeMeta,
|
|
22
26
|
Schema.AnnotableClass<
|
|
23
|
-
EchoTypeSchema<Self, ExtraFields>,
|
|
27
|
+
EchoTypeSchema<Self, ExtraFields, K, Fields>,
|
|
24
28
|
EchoTypeSchemaProps<Schema.Schema.Type<Self>, ExtraFields>,
|
|
25
29
|
EchoTypeSchemaProps<Schema.Schema.Encoded<Self>, ExtraFields>,
|
|
26
30
|
Schema.Schema.Context<Self>
|
|
27
31
|
> {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Schema kind key that marks this as an ECHO schema and indicates its kind.
|
|
34
|
+
* Makes EchoTypeSchema satisfy the Type.Obj.Any or Type.Relation.Any type.
|
|
35
|
+
*/
|
|
36
|
+
readonly [SchemaKindId]: K;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The fields defined in the original struct schema.
|
|
40
|
+
* Allows accessing field definitions for introspection.
|
|
41
|
+
*/
|
|
42
|
+
readonly fields: Fields;
|
|
34
43
|
|
|
35
44
|
instanceOf(value: unknown): boolean;
|
|
36
45
|
}
|
|
37
46
|
|
|
38
|
-
// type
|
|
47
|
+
// type MakeProps =
|
|
39
48
|
// | boolean
|
|
40
49
|
// | {
|
|
41
50
|
// readonly disableValidation?: boolean;
|
|
@@ -63,18 +72,24 @@ export interface EchoTypeSchema<Self extends Schema.Schema.Any, ExtraFields = {}
|
|
|
63
72
|
// return out;
|
|
64
73
|
// };
|
|
65
74
|
|
|
66
|
-
// const _getDisableValidationMakeOption = (options:
|
|
75
|
+
// const _getDisableValidationMakeOption = (options: MakeProps | undefined): boolean =>
|
|
67
76
|
// Predicate.isBoolean(options) ? options : options?.disableValidation ?? false;
|
|
68
77
|
|
|
69
78
|
/**
|
|
70
79
|
* @internal
|
|
71
80
|
*/
|
|
72
|
-
export const makeEchoTypeSchema = <
|
|
73
|
-
|
|
81
|
+
export const makeEchoTypeSchema = <
|
|
82
|
+
Self extends Schema.Schema.Any,
|
|
83
|
+
K extends EntityKind = EntityKind,
|
|
84
|
+
// TODO(wittjosiah): Can this be inferred from the schema?
|
|
85
|
+
Fields extends Schema.Struct.Fields = Schema.Struct.Fields,
|
|
86
|
+
>(
|
|
87
|
+
fields: Fields,
|
|
74
88
|
ast: SchemaAST.AST,
|
|
75
89
|
typename: string,
|
|
76
90
|
version: string,
|
|
77
|
-
|
|
91
|
+
kind: K,
|
|
92
|
+
): EchoTypeSchema<Self, {}, K, Fields> => {
|
|
78
93
|
return class EchoObjectSchemaClass extends Schema.make<
|
|
79
94
|
EchoTypeSchemaProps<Schema.Schema.Type<Self>>,
|
|
80
95
|
EchoTypeSchemaProps<Schema.Schema.Encoded<Self>>,
|
|
@@ -82,19 +97,21 @@ export const makeEchoTypeSchema = <Self extends Schema.Schema.Any>(
|
|
|
82
97
|
>(ast) {
|
|
83
98
|
static readonly typename = typename;
|
|
84
99
|
static readonly version = version;
|
|
100
|
+
static readonly [SchemaKindId] = kind;
|
|
101
|
+
static readonly fields = fields;
|
|
85
102
|
|
|
86
103
|
static override annotations(
|
|
87
104
|
annotations: Schema.Annotations.GenericSchema<EchoTypeSchemaProps<Schema.Schema.Type<Self>>>,
|
|
88
|
-
): EchoTypeSchema<Self> {
|
|
105
|
+
): EchoTypeSchema<Self, {}, K, Fields> {
|
|
89
106
|
const schema = Schema.make<EchoTypeSchemaProps<Schema.Schema.Type<Self>>>(ast).annotations(annotations);
|
|
90
|
-
return makeEchoTypeSchema<Self>(
|
|
107
|
+
return makeEchoTypeSchema<Self, K, Fields>(fields, schema.ast, typename, version, kind);
|
|
91
108
|
}
|
|
92
109
|
|
|
93
110
|
// static make(
|
|
94
111
|
// props: RequiredKeys<Schema.TypeLiteral.Constructor<Fields, []>> extends never
|
|
95
112
|
// ? void | Simplify<Schema.TypeLiteral.Constructor<Fields, []>>
|
|
96
113
|
// : Simplify<Schema.TypeLiteral.Constructor<Fields, []>>,
|
|
97
|
-
// options?:
|
|
114
|
+
// options?: MakeProps,
|
|
98
115
|
// ): Simplify<Schema.TypeLiteral.Type<Fields, []>> {
|
|
99
116
|
// const propsWithDefaults: any = _lazilyMergeDefaults(fields, { ...(props as any) });
|
|
100
117
|
// return _getDisableValidationMakeOption(options)
|
|
@@ -9,6 +9,7 @@ import { invariant } from '@dxos/invariant';
|
|
|
9
9
|
import { DXN, ObjectId } from '@dxos/keys';
|
|
10
10
|
import { assumeType } from '@dxos/util';
|
|
11
11
|
|
|
12
|
+
import type * as Database from '../../Database';
|
|
12
13
|
import {
|
|
13
14
|
type ATTR_META,
|
|
14
15
|
type ATTR_TYPE,
|
|
@@ -59,25 +60,24 @@ export const ObjectDeletedId = Symbol.for('@dxos/echo/Deleted');
|
|
|
59
60
|
*/
|
|
60
61
|
export const ObjectVersionId: unique symbol = Symbol.for('@dxos/echo/Version');
|
|
61
62
|
|
|
63
|
+
/**
|
|
64
|
+
* Object database accessor symbol.
|
|
65
|
+
*/
|
|
66
|
+
export const ObjectDatabaseId = Symbol.for('@dxos/echo/Database');
|
|
67
|
+
|
|
62
68
|
/**
|
|
63
69
|
* Internal runtime representation of an object.
|
|
64
70
|
* The fields are accessed through getter functions.
|
|
65
71
|
*/
|
|
72
|
+
// NOTE: Each symbol has a jsdoc describing its purpose.
|
|
66
73
|
export interface InternalObjectProps {
|
|
67
|
-
id: ObjectId;
|
|
68
|
-
|
|
69
|
-
// Echo supports untyped objects O_O.
|
|
70
|
-
readonly [TypeId]?: DXN;
|
|
71
|
-
|
|
72
|
-
//
|
|
73
|
-
readonly [SelfDXNId]?: DXN;
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Returns the schema for the object.
|
|
77
|
-
*/
|
|
78
|
-
readonly [SchemaId]?: Schema.Schema.AnyNoContext;
|
|
74
|
+
readonly id: ObjectId;
|
|
75
|
+
readonly [SelfDXNId]: DXN;
|
|
79
76
|
readonly [KindId]: EntityKind;
|
|
77
|
+
readonly [SchemaId]: Schema.Schema.AnyNoContext;
|
|
78
|
+
readonly [TypeId]: DXN;
|
|
80
79
|
readonly [MetaId]?: ObjectMeta;
|
|
80
|
+
readonly [ObjectDatabaseId]?: Database.Database;
|
|
81
81
|
readonly [ObjectDeletedId]?: boolean;
|
|
82
82
|
readonly [ObjectVersionId]?: Version;
|
|
83
83
|
readonly [RelationSourceDXNId]?: DXN;
|
|
@@ -105,6 +105,11 @@ export interface ObjectJSON {
|
|
|
105
105
|
[ATTR_META]?: ObjectMetaJSON;
|
|
106
106
|
[ATTR_RELATION_SOURCE]?: DXN.String;
|
|
107
107
|
[ATTR_RELATION_TARGET]?: DXN.String;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Application-specific properties.
|
|
111
|
+
*/
|
|
112
|
+
[key: string]: unknown;
|
|
108
113
|
}
|
|
109
114
|
|
|
110
115
|
/**
|
|
@@ -12,22 +12,35 @@ import { EntityKind } from '../types';
|
|
|
12
12
|
|
|
13
13
|
import { type EchoTypeSchema, makeEchoTypeSchema } from './entity';
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Object schema type with kind marker.
|
|
17
|
+
*/
|
|
18
|
+
export type EchoObjectSchema<
|
|
19
|
+
Self extends Schema.Schema.Any,
|
|
20
|
+
Fields extends Schema.Struct.Fields = Schema.Struct.Fields,
|
|
21
|
+
> = EchoTypeSchema<Self, {}, EntityKind.Object, Fields>;
|
|
22
|
+
|
|
15
23
|
/**
|
|
16
24
|
* Schema for Obj entity types.
|
|
17
25
|
* Pipeable function to add ECHO object annotations to a schema.
|
|
18
26
|
*/
|
|
19
27
|
export const EchoObjectSchema: {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
28
|
+
(
|
|
29
|
+
meta: TypeMeta,
|
|
30
|
+
): <Self extends Schema.Schema.Any, Fields extends Schema.Struct.Fields = Schema.Struct.Fields>(
|
|
31
|
+
self: Self & { fields?: Fields },
|
|
32
|
+
) => EchoObjectSchema<Self, Fields>;
|
|
23
33
|
} = ({ typename, version }) => {
|
|
24
|
-
return <Self extends Schema.Schema.Any
|
|
34
|
+
return <Self extends Schema.Schema.Any, Fields extends Schema.Struct.Fields = Schema.Struct.Fields>(
|
|
35
|
+
self: Self & { fields?: Fields },
|
|
36
|
+
): EchoObjectSchema<Self, Fields> => {
|
|
25
37
|
invariant(typeof TypeAnnotationId === 'symbol', 'Sanity.');
|
|
26
38
|
invariant(SchemaAST.isTypeLiteral(self.ast), 'Schema must be a TypeLiteral.');
|
|
27
39
|
|
|
28
|
-
//
|
|
29
|
-
|
|
30
|
-
|
|
40
|
+
// Extract fields from the schema if available (Struct schemas have .fields).
|
|
41
|
+
const fields = ((self as any).fields ?? {}) as Fields;
|
|
42
|
+
|
|
43
|
+
const schemaWithId = Schema.extend(self, Schema.Struct({ id: Schema.String }));
|
|
31
44
|
const ast = SchemaAST.annotations(schemaWithId.ast, {
|
|
32
45
|
// TODO(dmaretskyi): `extend` kills the annotations.
|
|
33
46
|
...self.ast.annotations,
|
|
@@ -40,6 +53,6 @@ export const EchoObjectSchema: {
|
|
|
40
53
|
}),
|
|
41
54
|
});
|
|
42
55
|
|
|
43
|
-
return makeEchoTypeSchema<Self>(
|
|
56
|
+
return makeEchoTypeSchema<Self, EntityKind.Object, Fields>(fields, ast, typename, version, EntityKind.Object);
|
|
44
57
|
};
|
|
45
58
|
};
|
|
@@ -83,6 +83,21 @@ export type EchoRelationSchemaOptions<
|
|
|
83
83
|
target: TTarget;
|
|
84
84
|
};
|
|
85
85
|
|
|
86
|
+
/**
|
|
87
|
+
* Relation schema type with kind marker.
|
|
88
|
+
*/
|
|
89
|
+
export type EchoRelationSchema<
|
|
90
|
+
Self extends Schema.Schema.Any,
|
|
91
|
+
Source extends Schema.Schema.AnyNoContext,
|
|
92
|
+
Target extends Schema.Schema.AnyNoContext,
|
|
93
|
+
Fields extends Schema.Struct.Fields = Schema.Struct.Fields,
|
|
94
|
+
> = EchoTypeSchema<
|
|
95
|
+
Self,
|
|
96
|
+
RelationSourceTargetRefs<Schema.Schema.Type<Source>, Schema.Schema.Type<Target>>,
|
|
97
|
+
EntityKind.Relation,
|
|
98
|
+
Fields
|
|
99
|
+
>;
|
|
100
|
+
|
|
86
101
|
/**
|
|
87
102
|
* Schema for Relation entity types.
|
|
88
103
|
*/
|
|
@@ -106,14 +121,15 @@ export const EchoRelationSchema = <
|
|
|
106
121
|
raise(new Error('Target schema must be an echo object schema.'));
|
|
107
122
|
}
|
|
108
123
|
|
|
109
|
-
return <Self extends Schema.Schema.Any>(
|
|
110
|
-
self: Self,
|
|
111
|
-
):
|
|
124
|
+
return <Self extends Schema.Schema.Any, Fields extends Schema.Struct.Fields = Schema.Struct.Fields>(
|
|
125
|
+
self: Self & { fields?: Fields },
|
|
126
|
+
): EchoRelationSchema<Self, Source, Target, Fields> => {
|
|
112
127
|
invariant(SchemaAST.isTypeLiteral(self.ast), 'Schema must be a TypeLiteral.');
|
|
113
128
|
|
|
114
|
-
//
|
|
115
|
-
|
|
116
|
-
|
|
129
|
+
// Extract fields from the schema if available (Struct schemas have .fields).
|
|
130
|
+
const fields = ((self as any).fields ?? {}) as Fields;
|
|
131
|
+
|
|
132
|
+
const schemaWithId = Schema.extend(self, Schema.Struct({ id: Schema.String }));
|
|
117
133
|
const ast = SchemaAST.annotations(schemaWithId.ast, {
|
|
118
134
|
// TODO(dmaretskyi): `extend` kills the annotations.
|
|
119
135
|
...self.ast.annotations,
|
|
@@ -135,7 +151,7 @@ export const EchoRelationSchema = <
|
|
|
135
151
|
}),
|
|
136
152
|
});
|
|
137
153
|
|
|
138
|
-
return makeEchoTypeSchema<Self>(
|
|
154
|
+
return makeEchoTypeSchema<Self, EntityKind.Relation, Fields>(fields, ast, typename, version, EntityKind.Relation);
|
|
139
155
|
};
|
|
140
156
|
};
|
|
141
157
|
|
|
@@ -10,11 +10,10 @@ import * as DateUtil from './date';
|
|
|
10
10
|
import * as NumberUtil from './number';
|
|
11
11
|
import * as ObjectUtil from './object';
|
|
12
12
|
import * as StringUtil from './string';
|
|
13
|
-
import { TypeFormat as
|
|
13
|
+
import { TypeFormat as TypeFormat$ } from './types';
|
|
14
14
|
|
|
15
|
-
// TODO(burdon): Consider factoring out to separate `@dxos/json-schema`
|
|
16
15
|
// TODO(burdon): Media encoding.
|
|
17
|
-
//
|
|
16
|
+
// - https://json-schema.org/understanding-json-schema/reference/non_json_data
|
|
18
17
|
|
|
19
18
|
/**
|
|
20
19
|
* Formats.
|
|
@@ -23,9 +22,9 @@ import { TypeFormat as TypeFormatEnum } from './types';
|
|
|
23
22
|
*/
|
|
24
23
|
// TODO(burdon): Add fields for `examples`, `message`, etc.
|
|
25
24
|
export namespace Format {
|
|
26
|
-
export import TypeFormat =
|
|
25
|
+
export import TypeFormat = TypeFormat$;
|
|
27
26
|
|
|
28
|
-
//
|
|
27
|
+
// String
|
|
29
28
|
export const DXN = Keys.DXN.Schema;
|
|
30
29
|
export const Email = StringUtil.Email;
|
|
31
30
|
export const Formula = StringUtil.Formula;
|
|
@@ -44,12 +43,12 @@ export namespace Format {
|
|
|
44
43
|
export const Timestamp = NumberUtil.Timestamp;
|
|
45
44
|
|
|
46
45
|
// Dates and times
|
|
47
|
-
export const DateTime = DateUtil.DateTime;
|
|
48
46
|
export const Date = DateUtil.DateOnly;
|
|
49
|
-
export const
|
|
47
|
+
export const DateTime = DateUtil.DateTime;
|
|
50
48
|
export const Duration = DateUtil.Duration;
|
|
49
|
+
export const Time = DateUtil.TimeOnly;
|
|
51
50
|
|
|
52
51
|
// Objects
|
|
53
52
|
export const GeoPoint = ObjectUtil.GeoPoint;
|
|
54
|
-
export type GeoPoint = ObjectUtil.GeoPoint;
|
|
53
|
+
export type GeoPoint = ObjectUtil.GeoPoint; // TODO(burdon): Export types.
|
|
55
54
|
}
|
|
@@ -21,8 +21,8 @@ import { FormatAnnotation, TypeFormat } from './types';
|
|
|
21
21
|
* Note: optional third element for altitude.
|
|
22
22
|
*/
|
|
23
23
|
export const GeoPoint = Schema.Tuple(
|
|
24
|
-
Schema.Number.pipe(Schema.annotations({ title: 'Longitude' }), Schema.clamp(-180, 180), Schema.multipleOf(0.
|
|
25
|
-
Schema.Number.pipe(Schema.annotations({ title: 'Latitude' }), Schema.clamp(-90, 90), Schema.multipleOf(0.
|
|
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
26
|
Schema.optionalElement(Schema.Number).annotations({
|
|
27
27
|
title: 'Height ASL (m)',
|
|
28
28
|
}),
|
|
@@ -4,13 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
|
|
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({
|
|
9
11
|
/** Stable identifier for the option. */
|
|
10
12
|
id: Schema.NonEmptyString,
|
|
11
13
|
title: Schema.String,
|
|
12
14
|
/** Color palette used for visual styling. */
|
|
13
15
|
color: Schema.String,
|
|
14
|
-
})
|
|
16
|
+
});
|
|
15
17
|
|
|
16
|
-
export type SelectOption = Schema.Schema.Type<typeof
|
|
18
|
+
export type SelectOption = Schema.Schema.Type<typeof SelectOption>;
|
|
@@ -52,6 +52,11 @@ export const Markdown = Schema.String.pipe(FormatAnnotation.set(TypeFormat.Markd
|
|
|
52
52
|
// TODO(burdon): Implement.
|
|
53
53
|
export const Regex = Schema.String.pipe(FormatAnnotation.set(TypeFormat.Regex));
|
|
54
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Multi-line text.
|
|
57
|
+
*/
|
|
58
|
+
export const Text = Schema.String.pipe(FormatAnnotation.set(TypeFormat.Text));
|
|
59
|
+
|
|
55
60
|
/**
|
|
56
61
|
* https://datatracker.ietf.org/doc/html/rfc3986#section-1.1.3
|
|
57
62
|
*/
|
|
@@ -55,6 +55,7 @@ export const FormatAnnotationId = Symbol.for('@dxos/schema/annotation/Format');
|
|
|
55
55
|
|
|
56
56
|
export const FormatAnnotation = createAnnotationHelper<TypeFormat>(FormatAnnotationId);
|
|
57
57
|
|
|
58
|
+
/** @deprecated */
|
|
58
59
|
export const getFormatAnnotation = (node: SchemaAST.AST): TypeFormat | undefined =>
|
|
59
60
|
Function.pipe(SchemaAST.getAnnotation<TypeFormat>(FormatAnnotationId)(node), Option.getOrUndefined);
|
|
60
61
|
|
|
@@ -84,6 +85,7 @@ export enum TypeFormat {
|
|
|
84
85
|
Markdown = 'markdown',
|
|
85
86
|
Regex = 'regex',
|
|
86
87
|
SingleSelect = 'single-select',
|
|
88
|
+
Text = 'text',
|
|
87
89
|
MultiSelect = 'multi-select',
|
|
88
90
|
URL = 'url',
|
|
89
91
|
UUID = 'uuid',
|
|
@@ -151,6 +153,7 @@ export const formatToType: Record<TypeFormat, TypeEnum> = {
|
|
|
151
153
|
[TypeFormat.URL]: TypeEnum.String,
|
|
152
154
|
[TypeFormat.UUID]: TypeEnum.String,
|
|
153
155
|
[TypeFormat.SingleSelect]: TypeEnum.String,
|
|
156
|
+
[TypeFormat.Text]: TypeEnum.String,
|
|
154
157
|
[TypeFormat.MultiSelect]: TypeEnum.Object,
|
|
155
158
|
|
|
156
159
|
// Dates
|
|
@@ -174,7 +177,10 @@ export const formatToType: Record<TypeFormat, TypeEnum> = {
|
|
|
174
177
|
*/
|
|
175
178
|
export const OptionsAnnotationId = Symbol.for('@dxos/schema/annotation/Options');
|
|
176
179
|
|
|
177
|
-
|
|
178
|
-
|
|
180
|
+
// TODO(wittjosiah): Reconcile with `SelectOption`.
|
|
181
|
+
export type Options = string | number;
|
|
182
|
+
export const OptionsAnnotation = createAnnotationHelper<Options[]>(OptionsAnnotationId);
|
|
179
183
|
|
|
180
|
-
|
|
184
|
+
/** @deprecated */
|
|
185
|
+
export const getOptionsAnnotation = (node: SchemaAST.AST): Options[] | undefined =>
|
|
186
|
+
Function.pipe(SchemaAST.getAnnotation<Options[]>(OptionsAnnotationId)(node), Option.getOrUndefined);
|
package/src/internal/index.ts
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
// TODO(burdon): Import directly (not part of ECHO API).
|
|
6
|
-
export { JsonPath, JsonProp, getValue,
|
|
6
|
+
export { JsonPath, JsonProp, getValue, splitJsonPath } from '@dxos/effect';
|
|
7
7
|
|
|
8
8
|
export * from './annotations';
|
|
9
|
+
export * from './api';
|
|
9
10
|
export * from './entities';
|
|
10
11
|
export * from './formats';
|
|
11
12
|
export * from './json-schema';
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import type * as Types from 'effect/Types';
|
|
6
|
+
|
|
5
7
|
import { JsonSchemaFields, type JsonSchemaType } from './json-schema-type';
|
|
6
8
|
|
|
7
9
|
/**
|
|
@@ -9,12 +11,12 @@ import { JsonSchemaFields, type JsonSchemaType } from './json-schema-type';
|
|
|
9
11
|
* Note: the input type does not necessarily match the {@link JsonSchemaType} type.
|
|
10
12
|
*/
|
|
11
13
|
export const normalizeSchema = (schema: JsonSchemaType): JsonSchemaType => {
|
|
12
|
-
const copy = structuredClone(schema)
|
|
14
|
+
const copy = structuredClone(schema) as Types.DeepMutable<JsonSchemaType>;
|
|
13
15
|
go(copy);
|
|
14
16
|
return copy;
|
|
15
17
|
};
|
|
16
18
|
|
|
17
|
-
const go = (schema: JsonSchemaType) => {
|
|
19
|
+
const go = (schema: Types.DeepMutable<JsonSchemaType>) => {
|
|
18
20
|
if (typeof schema !== 'object' || schema === null) {
|
|
19
21
|
return;
|
|
20
22
|
}
|
|
@@ -7,6 +7,7 @@ import * as Schema from 'effect/Schema';
|
|
|
7
7
|
import { JsonPath, type JsonProp } from '@dxos/effect';
|
|
8
8
|
|
|
9
9
|
import { FormatAnnotation, TypeFormat } from '../formats';
|
|
10
|
+
import { type Mutable } from '../proxy';
|
|
10
11
|
import { EntityKindSchema } from '../types';
|
|
11
12
|
|
|
12
13
|
//
|
|
@@ -18,7 +19,7 @@ const SimpleTypes = Schema.Literal('array', 'boolean', 'integer', 'null', 'numbe
|
|
|
18
19
|
|
|
19
20
|
const NonNegativeInteger = Schema.Number.pipe(Schema.greaterThanOrEqualTo(0));
|
|
20
21
|
|
|
21
|
-
const StringArray = Schema.Array(Schema.String)
|
|
22
|
+
const StringArray = Schema.Array(Schema.String);
|
|
22
23
|
|
|
23
24
|
const JsonSchemaOrBoolean = Schema.Union(
|
|
24
25
|
Schema.suspend(() => JsonSchemaType),
|
|
@@ -48,13 +49,13 @@ export const JsonSchemaEchoAnnotations = Schema.Struct({
|
|
|
48
49
|
Schema.Record({
|
|
49
50
|
key: Schema.String,
|
|
50
51
|
value: Schema.Any,
|
|
51
|
-
})
|
|
52
|
+
}),
|
|
52
53
|
),
|
|
53
54
|
|
|
54
55
|
/**
|
|
55
56
|
* @deprecated
|
|
56
57
|
*/
|
|
57
|
-
// TODO(dmaretskyi): We risk old schema not passing validation due to the extra fields. Remove when we are sure this is safe
|
|
58
|
+
// TODO(dmaretskyi): We risk old schema not passing validation due to the extra fields. Remove when we are sure this is safe.
|
|
58
59
|
type: Schema.optional(
|
|
59
60
|
Schema.Struct({
|
|
60
61
|
typename: Schema.String,
|
|
@@ -62,7 +63,7 @@ export const JsonSchemaEchoAnnotations = Schema.Struct({
|
|
|
62
63
|
|
|
63
64
|
// Not used.
|
|
64
65
|
schemaId: Schema.optional(Schema.String),
|
|
65
|
-
})
|
|
66
|
+
}),
|
|
66
67
|
),
|
|
67
68
|
|
|
68
69
|
/**
|
|
@@ -72,9 +73,9 @@ export const JsonSchemaEchoAnnotations = Schema.Struct({
|
|
|
72
73
|
Schema.Record({
|
|
73
74
|
key: Schema.String,
|
|
74
75
|
value: Schema.Any,
|
|
75
|
-
})
|
|
76
|
+
}),
|
|
76
77
|
),
|
|
77
|
-
})
|
|
78
|
+
});
|
|
78
79
|
export type JsonSchemaEchoAnnotations = Schema.Schema.Type<typeof JsonSchemaEchoAnnotations>;
|
|
79
80
|
|
|
80
81
|
/**
|
|
@@ -257,23 +258,21 @@ const _JsonSchemaType = Schema.Struct({
|
|
|
257
258
|
Schema.Record({
|
|
258
259
|
key: Schema.String,
|
|
259
260
|
value: Schema.suspend(() => JsonSchemaType),
|
|
260
|
-
})
|
|
261
|
+
}),
|
|
261
262
|
),
|
|
262
263
|
patternProperties: Schema.optional(
|
|
263
264
|
Schema.Record({
|
|
264
265
|
key: Schema.String,
|
|
265
266
|
value: Schema.suspend(() => JsonSchemaType),
|
|
266
|
-
})
|
|
267
|
+
}),
|
|
267
268
|
),
|
|
268
269
|
propertyNames: Schema.optional(Schema.suspend(() => JsonSchemaType)),
|
|
269
270
|
|
|
270
271
|
definitions: Schema.optional(
|
|
271
|
-
Schema.
|
|
272
|
-
Schema.
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
}),
|
|
276
|
-
),
|
|
272
|
+
Schema.Record({
|
|
273
|
+
key: Schema.String,
|
|
274
|
+
value: Schema.suspend(() => JsonSchemaType),
|
|
275
|
+
}),
|
|
277
276
|
),
|
|
278
277
|
dependencies: Schema.optional(
|
|
279
278
|
Schema.Record({
|
|
@@ -296,12 +295,10 @@ const _JsonSchemaType = Schema.Struct({
|
|
|
296
295
|
oneOf: Schema.optional(Schema.Array(Schema.suspend(() => JsonSchemaType))),
|
|
297
296
|
not: Schema.optional(Schema.suspend(() => JsonSchemaType)),
|
|
298
297
|
$defs: Schema.optional(
|
|
299
|
-
Schema.
|
|
300
|
-
Schema.
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
}),
|
|
304
|
-
),
|
|
298
|
+
Schema.Record({
|
|
299
|
+
key: Schema.String,
|
|
300
|
+
value: Schema.suspend(() => JsonSchemaType),
|
|
301
|
+
}),
|
|
305
302
|
),
|
|
306
303
|
|
|
307
304
|
//
|
|
@@ -311,25 +308,23 @@ const _JsonSchemaType = Schema.Struct({
|
|
|
311
308
|
currency: Schema.optional(Schema.String),
|
|
312
309
|
|
|
313
310
|
reference: Schema.optional(
|
|
314
|
-
Schema.
|
|
315
|
-
Schema.
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
}),
|
|
320
|
-
),
|
|
311
|
+
Schema.Struct({
|
|
312
|
+
schema: Schema.suspend(() => JsonSchemaType),
|
|
313
|
+
schemaVersion: Schema.optional(Schema.String),
|
|
314
|
+
schemaObject: Schema.optional(Schema.String),
|
|
315
|
+
}),
|
|
321
316
|
),
|
|
322
317
|
|
|
323
318
|
/**
|
|
324
319
|
* ECHO-specific annotations.
|
|
325
320
|
*/
|
|
326
321
|
// TODO(dmaretskyi): Since we are adding a lot of new extensions to the JSON Schema, it is safer to namespace them here.
|
|
327
|
-
annotations: Schema.optional(
|
|
322
|
+
annotations: Schema.optional(JsonSchemaEchoAnnotations),
|
|
328
323
|
|
|
329
324
|
/**
|
|
330
325
|
* @deprecated Use `annotations` instead.
|
|
331
326
|
*/
|
|
332
|
-
echo: Schema.optional(
|
|
327
|
+
echo: Schema.optional(JsonSchemaEchoAnnotations),
|
|
333
328
|
}).annotations({ identifier: 'jsonSchema', description: 'JSON Schema' });
|
|
334
329
|
|
|
335
330
|
export const JsonSchemaFields = Object.keys(_JsonSchemaType.fields);
|
|
@@ -338,9 +333,9 @@ export const JsonSchemaFields = Object.keys(_JsonSchemaType.fields);
|
|
|
338
333
|
* https://json-schema.org/draft-07/schema
|
|
339
334
|
*/
|
|
340
335
|
// TODO(burdon): Reconcile with @effect/Schema/JSONSchema
|
|
341
|
-
export interface JsonSchemaType extends Schema.Schema.Type<
|
|
336
|
+
export interface JsonSchemaType extends Schema.Schema.Type<typeof _JsonSchemaType> {}
|
|
342
337
|
|
|
343
|
-
export const JsonSchemaType: Schema.Schema<JsonSchemaType> = _JsonSchemaType
|
|
338
|
+
export const JsonSchemaType: Schema.Schema<JsonSchemaType> = _JsonSchemaType;
|
|
344
339
|
|
|
345
340
|
// TODO(burdon): Factor out JSON schema utils.
|
|
346
341
|
|
|
@@ -349,7 +344,11 @@ export const getSchemaProperty = (schema: JsonSchemaType, property: JsonProp): J
|
|
|
349
344
|
};
|
|
350
345
|
|
|
351
346
|
// TODO(burdon): Properties should be ordered.
|
|
352
|
-
export const setSchemaProperty = (
|
|
347
|
+
export const setSchemaProperty = (
|
|
348
|
+
schema: Mutable<JsonSchemaType>,
|
|
349
|
+
property: JsonProp,
|
|
350
|
+
value: Mutable<JsonSchemaType>,
|
|
351
|
+
) => {
|
|
353
352
|
schema.properties ??= {};
|
|
354
353
|
schema.properties[property] = value;
|
|
355
354
|
return schema;
|