@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,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/SchemaRegistry.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport type * as Types from 'effect/Types';\n\nimport type * as JsonSchema from './JsonSchema';\nimport type * as Key from './Key';\nimport type * as QueryResult from './QueryResult';\nimport type * as Type from './Type';\n\n// TODO(wittjosiah): Replace w/ Query.Query.\nexport type Query = {\n /**\n * Filter by schema ID.\n * Schema id is a DXN with `echo` or `type` kind.\n */\n id?: string | string[];\n\n /**\n * Id of the backing ECHO object.\n */\n backingObjectId?: Key.ObjectId | Key.ObjectId[];\n\n /**\n * One or more typenames to filter by.\n */\n typename?: string | string[];\n\n /**\n * [Semver Range](https://docs.npmjs.com/cli/v6/using-npm/semver#ranges) for the schema version.\n */\n version?: string;\n\n /**\n * Where to look for the schema.\n *\n * Database schema are stored in the database of the current space.\n * Runtime schema are registered in the runtime.\n *\n * @default ['database']\n */\n location?: ('database' | 'runtime')[];\n\n /**\n * Include system schemas.\n * @default false\n *\n * The system schema include but are not limited to:\n * - dxos.org/type/Schema\n */\n includeSystem?: boolean;\n};\n\n/**\n * Input for schema registration.\n * The typename, version and schema mutability metadata is read from the schema annotations.\n *\n * Accepts:\n * - Branded ECHO schemas created with Type.Obj() or Type.Relation()\n * - JSON schema with typename and version\n */\nexport type RegisterSchemaInput =\n | Type.Entity.Any\n | {\n typename: string;\n version: string;\n jsonSchema: JsonSchema.JsonSchema;\n /**\n * Display name of the schema.\n */\n name?: string;\n };\n\nexport type ExtractQueryResult<Query> = Query extends { location: ('database' | 'runtime')[] }\n ? Type.Entity.Any\n : Type.RuntimeType;\n\nexport interface SchemaRegistry {\n /**\n * Checks if the provided schema is registered.\n */\n // TODO(burdon): Type?\n hasSchema(schema: Type.Entity.Any): boolean;\n\n /**\n * Registers the provided schema.\n *\n * @returns Mutable runtime instances of schemas that were registered.\n *\n * The behavior of this method depends on the state of the database.\n * The general principle is that the schema will be upserted into the space.\n * If an equivalent schema with the same name and version already exists, the method does nothing.\n * If a different schema with the same name and version exists, the method throws an error.\n * If no schema with the same name and version exists, a new schema will be inserted based on semantic versioning rules.\n */\n register(input: RegisterSchemaInput[]): Promise<Type.RuntimeType[]>;\n\n /**\n *\n */\n query<Q extends Types.NoExcessProperties<Query, Q>>(\n query?: Q & Query,\n ): QueryResult.QueryResult<ExtractQueryResult<Q>>;\n}\n"],
|
|
5
|
+
"mappings": ";;;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// src/index.ts
|
|
4
|
+
import { QueryAST } from "@dxos/echo-protocol";
|
|
5
|
+
import { DXN } from "@dxos/keys";
|
|
6
|
+
|
|
7
|
+
// src/Hypergraph.ts
|
|
8
|
+
var Hypergraph_exports = {};
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
Hypergraph_exports,
|
|
12
|
+
QueryAST,
|
|
13
|
+
DXN
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=chunk-MOWUEW5P.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/index.ts", "../../../src/Hypergraph.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nexport { QueryAST } from '@dxos/echo-protocol';\n// TODO(wittjosiah): Refactor DXN to not use statics similar to Query.\nexport { DXN } from '@dxos/keys';\n\nexport * as Annotation from './Annotation';\nexport * as Database from './Database';\nexport * as Entity from './Entity';\nexport * as Err from './Err';\nexport * as Filter from './Filter';\nexport * as Format from './Format';\nexport * as Hypergraph from './Hypergraph';\nexport * as JsonSchema from './JsonSchema';\nexport * as Key from './Key';\nexport * as Obj from './Obj';\nexport * as Order from './Order';\nexport * as Query from './Query';\nexport * as QueryResult from './QueryResult';\nexport * as Ref from './Ref';\nexport * as Relation from './Relation';\nexport * as SchemaRegistry from './SchemaRegistry';\nexport * as Tag from './Tag';\nexport * as Type from './Type';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type DXN } from '@dxos/keys';\n\nimport type * as Database from './Database';\nimport type * as Entity from './Entity';\nimport { type AnyProperties } from './internal';\nimport type * as Key from './Key';\nimport type * as Ref from './Ref';\nimport type * as SchemaRegistry from './SchemaRegistry';\n\n/**\n * Resolution context.\n * Affects how non-absolute DXNs are resolved.\n */\nexport interface RefResolutionContext {\n /**\n * Space that the resolution is happening from.\n */\n space?: Key.SpaceId;\n\n /**\n * Queue that the resolution is happening from.\n * This queue will be searched first, and then the space it belongs to.\n */\n queue?: DXN;\n}\n\nexport interface RefResolverOptions {\n /**\n * Resolution context.\n * Affects how non-absolute DXNs are resolved.\n */\n context?: RefResolutionContext;\n\n /**\n * Middleware to change the resolved object before returning it.\n * @deprecated On track to be removed.\n */\n middleware?: (obj: AnyProperties) => AnyProperties;\n}\n\n/**\n *\n */\n// TODO(burdon): Comment required.\nexport interface Hypergraph extends Database.Queryable {\n get schemaRegistry(): SchemaRegistry.SchemaRegistry;\n\n /**\n * Query objects.\n */\n query: Database.QueryFn;\n\n /**\n * Creates a reference to an existing object in the database.\n *\n * NOTE: The reference may be dangling if the object is not present in the database.\n * NOTE: Difference from `Ref.fromDXN`\n * `Ref.fromDXN(dxn)` returns an unhydrated reference. The `.load` and `.target` APIs will not work.\n * `db.makeRef(dxn)` is preferable in cases with access to the database.\n */\n makeRef<T extends Entity.Unknown = Entity.Unknown>(dxn: DXN): Ref.Ref<T>;\n\n /**\n * @param hostDb Host database for reference resolution.\n * @param middleware Called with the loaded object. The caller may change the object.\n * @returns Result of `onLoad`.\n */\n // TODO(dmaretskyi): Restructure API: Remove middleware.\n createRefResolver(options: RefResolverOptions): Ref.Resolver;\n}\n"],
|
|
5
|
+
"mappings": ";;;AAIA,SAASA,gBAAgB;AAEzB,SAASC,WAAW;;;ACNpB;",
|
|
6
|
+
"names": ["QueryAST", "DXN"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
DescriptionAnnotation,
|
|
4
|
+
FormInputAnnotation,
|
|
5
|
+
GeneratorAnnotation,
|
|
6
|
+
LabelAnnotation,
|
|
7
|
+
ReferenceAnnotation,
|
|
8
|
+
SystemTypeAnnotation,
|
|
9
|
+
TypeAnnotation,
|
|
10
|
+
getDescriptionWithSchema,
|
|
11
|
+
getLabelWithSchema,
|
|
12
|
+
getTypeAnnotation,
|
|
13
|
+
setDescriptionWithSchema,
|
|
14
|
+
setLabelWithSchema
|
|
15
|
+
} from "./chunk-YOLH5KS4.mjs";
|
|
16
|
+
import {
|
|
17
|
+
__export
|
|
18
|
+
} from "./chunk-HSLMI22Q.mjs";
|
|
19
|
+
|
|
20
|
+
// src/Annotation.ts
|
|
21
|
+
var Annotation_exports = {};
|
|
22
|
+
__export(Annotation_exports, {
|
|
23
|
+
DescriptionAnnotation: () => DescriptionAnnotation,
|
|
24
|
+
FormInputAnnotation: () => FormInputAnnotation,
|
|
25
|
+
GeneratorAnnotation: () => GeneratorAnnotation,
|
|
26
|
+
LabelAnnotation: () => LabelAnnotation,
|
|
27
|
+
ReferenceAnnotation: () => ReferenceAnnotation,
|
|
28
|
+
SystemTypeAnnotation: () => SystemTypeAnnotation,
|
|
29
|
+
TypeAnnotation: () => TypeAnnotation,
|
|
30
|
+
getDescriptionWithSchema: () => getDescriptionWithSchema,
|
|
31
|
+
getLabelWithSchema: () => getLabelWithSchema,
|
|
32
|
+
getTypeAnnotation: () => getTypeAnnotation,
|
|
33
|
+
setDescriptionWithSchema: () => setDescriptionWithSchema,
|
|
34
|
+
setLabelWithSchema: () => setLabelWithSchema
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export {
|
|
38
|
+
Annotation_exports
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=chunk-NBWL7UCZ.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/Annotation.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nexport {\n DescriptionAnnotation,\n FormInputAnnotation,\n GeneratorAnnotation,\n LabelAnnotation,\n ReferenceAnnotation,\n SystemTypeAnnotation,\n TypeAnnotation,\n getDescriptionWithSchema,\n getLabelWithSchema,\n getTypeAnnotation,\n setDescriptionWithSchema,\n setLabelWithSchema,\n} from './internal/annotations';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
EchoObjectSchema,
|
|
4
|
+
EchoRelationSchema,
|
|
5
|
+
EchoSchema,
|
|
6
|
+
PersistentSchema,
|
|
7
|
+
Ref,
|
|
8
|
+
isMutable,
|
|
9
|
+
toEffectSchema,
|
|
10
|
+
toJsonSchema
|
|
11
|
+
} from "./chunk-LT3H4JOX.mjs";
|
|
12
|
+
import {
|
|
13
|
+
getSchemaDXN,
|
|
14
|
+
getSchemaTypename,
|
|
15
|
+
getSchemaVersion,
|
|
16
|
+
getTypeAnnotation
|
|
17
|
+
} from "./chunk-YOLH5KS4.mjs";
|
|
18
|
+
import {
|
|
19
|
+
ANY_OBJECT_TYPENAME,
|
|
20
|
+
ANY_OBJECT_VERSION,
|
|
21
|
+
EntityKind,
|
|
22
|
+
SchemaKindId
|
|
23
|
+
} from "./chunk-XHJRMQZD.mjs";
|
|
24
|
+
import {
|
|
25
|
+
__export
|
|
26
|
+
} from "./chunk-HSLMI22Q.mjs";
|
|
27
|
+
|
|
28
|
+
// src/Type.ts
|
|
29
|
+
var Type_exports = {};
|
|
30
|
+
__export(Type_exports, {
|
|
31
|
+
Entity: () => Entity,
|
|
32
|
+
Obj: () => Obj,
|
|
33
|
+
PersistentType: () => PersistentType,
|
|
34
|
+
Ref: () => Ref2,
|
|
35
|
+
Relation: () => Relation,
|
|
36
|
+
RuntimeType: () => EchoSchema,
|
|
37
|
+
getDXN: () => getDXN,
|
|
38
|
+
getMeta: () => getMeta,
|
|
39
|
+
getTypename: () => getTypename,
|
|
40
|
+
getVersion: () => getVersion,
|
|
41
|
+
isMutable: () => isMutable2,
|
|
42
|
+
isObjectSchema: () => isObjectSchema,
|
|
43
|
+
isRelationSchema: () => isRelationSchema,
|
|
44
|
+
object: () => object,
|
|
45
|
+
relation: () => relation,
|
|
46
|
+
toEffectSchema: () => toEffectSchema,
|
|
47
|
+
toJsonSchema: () => toJsonSchema
|
|
48
|
+
});
|
|
49
|
+
import * as Schema from "effect/Schema";
|
|
50
|
+
import { invariant } from "@dxos/invariant";
|
|
51
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/core/echo/echo/src/Type.ts";
|
|
52
|
+
var ObjSchema = Schema.Struct({
|
|
53
|
+
id: Schema.String
|
|
54
|
+
}).pipe(Schema.extend(Schema.Record({
|
|
55
|
+
key: Schema.String,
|
|
56
|
+
value: Schema.Unknown
|
|
57
|
+
})), EchoObjectSchema({
|
|
58
|
+
typename: ANY_OBJECT_TYPENAME,
|
|
59
|
+
version: ANY_OBJECT_VERSION
|
|
60
|
+
}));
|
|
61
|
+
var Obj = Object.assign(ObjSchema, {
|
|
62
|
+
[SchemaKindId]: ObjSchema[SchemaKindId]
|
|
63
|
+
});
|
|
64
|
+
var object = EchoObjectSchema;
|
|
65
|
+
var PersistentType = PersistentSchema;
|
|
66
|
+
var RelationSchema = Schema.Struct({
|
|
67
|
+
id: Schema.String
|
|
68
|
+
}).pipe(Schema.extend(Schema.Record({
|
|
69
|
+
key: Schema.String,
|
|
70
|
+
value: Schema.Unknown
|
|
71
|
+
})), EchoRelationSchema({
|
|
72
|
+
typename: "dxos.org/schema/AnyRelation",
|
|
73
|
+
version: "0.0.0",
|
|
74
|
+
source: ObjSchema,
|
|
75
|
+
target: ObjSchema
|
|
76
|
+
}));
|
|
77
|
+
var Relation = Object.assign(RelationSchema, {
|
|
78
|
+
[SchemaKindId]: RelationSchema[SchemaKindId]
|
|
79
|
+
});
|
|
80
|
+
var relation = EchoRelationSchema;
|
|
81
|
+
(function(Entity2) {
|
|
82
|
+
Entity2.Any = Schema.Union(Obj, Relation);
|
|
83
|
+
})(Entity || (Entity = {}));
|
|
84
|
+
var isObjectSchema = (schema) => {
|
|
85
|
+
return schema[SchemaKindId] === EntityKind.Object;
|
|
86
|
+
};
|
|
87
|
+
var isRelationSchema = (schema) => {
|
|
88
|
+
return schema[SchemaKindId] === EntityKind.Relation;
|
|
89
|
+
};
|
|
90
|
+
var Ref2 = Ref;
|
|
91
|
+
var getDXN = (schema) => {
|
|
92
|
+
return getSchemaDXN(schema);
|
|
93
|
+
};
|
|
94
|
+
var getTypename = (schema) => {
|
|
95
|
+
const typename = getSchemaTypename(schema);
|
|
96
|
+
invariant(typeof typename === "string" && !typename.startsWith("dxn:"), "Invalid typename", {
|
|
97
|
+
F: __dxlog_file,
|
|
98
|
+
L: 463,
|
|
99
|
+
S: void 0,
|
|
100
|
+
A: [
|
|
101
|
+
"typeof typename === 'string' && !typename.startsWith('dxn:')",
|
|
102
|
+
"'Invalid typename'"
|
|
103
|
+
]
|
|
104
|
+
});
|
|
105
|
+
return typename;
|
|
106
|
+
};
|
|
107
|
+
var getVersion = (schema) => {
|
|
108
|
+
const version = getSchemaVersion(schema);
|
|
109
|
+
invariant(typeof version === "string" && version.match(/^\d+\.\d+\.\d+$/), "Invalid version", {
|
|
110
|
+
F: __dxlog_file,
|
|
111
|
+
L: 473,
|
|
112
|
+
S: void 0,
|
|
113
|
+
A: [
|
|
114
|
+
"typeof version === 'string' && version.match(/^\\d+\\.\\d+\\.\\d+$/)",
|
|
115
|
+
"'Invalid version'"
|
|
116
|
+
]
|
|
117
|
+
});
|
|
118
|
+
return version;
|
|
119
|
+
};
|
|
120
|
+
var isMutable2 = isMutable;
|
|
121
|
+
var getMeta = (schema) => {
|
|
122
|
+
return getTypeAnnotation(schema);
|
|
123
|
+
};
|
|
124
|
+
var Entity;
|
|
125
|
+
|
|
126
|
+
export {
|
|
127
|
+
Obj,
|
|
128
|
+
object,
|
|
129
|
+
PersistentType,
|
|
130
|
+
Relation,
|
|
131
|
+
relation,
|
|
132
|
+
isObjectSchema,
|
|
133
|
+
isRelationSchema,
|
|
134
|
+
Ref2 as Ref,
|
|
135
|
+
getDXN,
|
|
136
|
+
getTypename,
|
|
137
|
+
getVersion,
|
|
138
|
+
isMutable2 as isMutable,
|
|
139
|
+
getMeta,
|
|
140
|
+
Entity,
|
|
141
|
+
Type_exports
|
|
142
|
+
};
|
|
143
|
+
//# sourceMappingURL=chunk-NRN3ZW2T.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/Type.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { type EncodedReference } from '@dxos/echo-protocol';\nimport { invariant } from '@dxos/invariant';\nimport { type DXN, type ObjectId } from '@dxos/keys';\nimport { type ToMutable } from '@dxos/util';\n\nimport type * as Entity$ from './Entity';\nimport {\n ANY_OBJECT_TYPENAME,\n ANY_OBJECT_VERSION,\n type ATTR_RELATION_SOURCE,\n type ATTR_RELATION_TARGET,\n type AnyEntity,\n type AnyProperties,\n EchoObjectSchema,\n EchoRelationSchema,\n type EchoRelationSchemaOptions,\n EchoSchema,\n EntityKind,\n PersistentSchema,\n Ref as Ref$,\n type RefFn,\n type RefSchema,\n SchemaKindId,\n type TypeAnnotation,\n type TypeMeta,\n getSchemaDXN,\n getSchemaTypename,\n getSchemaVersion,\n getTypeAnnotation,\n isMutable as isMutable$,\n toEffectSchema,\n toJsonSchema,\n} from './internal';\nimport type * as Relation$ from './Relation';\n\n// TODO(burdon): Remove toEffectSchema, toJsonSchema (moved to JsonSchema export).\nexport { toEffectSchema, toJsonSchema };\n\n/**\n * Returns all properties of an object or relation except for the id and kind.\n */\nexport type Properties<T = any> = Omit<T, 'id' | Entity$.KindId | Relation$.Source | Relation$.Target>;\n\n//\n// Internal types (not exported)\n//\n\n/**\n * Type that marks a schema as an ECHO schema.\n * The value indicates the entity kind (Object or Relation).\n */\ntype EchoSchemaKind<K extends EntityKind = EntityKind> = {\n readonly [SchemaKindId]: K;\n};\n\n/**\n * JSON-encoded properties for objects.\n */\ninterface ObjJsonProps {\n id: string;\n}\n\n/**\n * JSON-encoded properties for relations.\n */\ninterface RelationJsonProps {\n id: string;\n [ATTR_RELATION_SOURCE]: string;\n [ATTR_RELATION_TARGET]: string;\n}\n\n//\n// Obj - Runtime schema for any ECHO object\n//\n\n// Internal type for the Obj schema constant.\n// NOTE: The `any` in the type intersection is intentional - it makes this type bidirectionally\n// assignable with specific object types (e.g., Type.Obj can be assigned to/from Meeting.Meeting).\n// This is needed because operation schemas erase type information.\n// TODO(wittjosiah): Consider alternatives to the `any` intersection hack:\n// - Generic operation schemas that preserve input type in output\n// - Branded types that specific schemas also carry\n// - Accept the limitation and require explicit type narrowing at call sites\ntype ObjSchemaType = Schema.Schema<\n any & AnyEntity & Entity$.OfKind<typeof Entity$.Kind.Object> & AnyProperties,\n { id: string } & AnyProperties\n> &\n EchoSchemaKind<EntityKind.Object> &\n TypeMeta;\n\n// Internal schema definition.\n// NOTE: The EchoObjectSchema annotation is required for Type.Ref(Type.Obj) to work.\n// The typename/version only satisfy ECHO schema machinery for reference targets.\nconst ObjSchema = Schema.Struct({\n id: Schema.String,\n}).pipe(\n Schema.extend(Schema.Record({ key: Schema.String, value: Schema.Unknown })),\n EchoObjectSchema({ typename: ANY_OBJECT_TYPENAME, version: ANY_OBJECT_VERSION }),\n);\n\n/**\n * Runtime Effect schema for any ECHO object.\n * Use for validation, parsing, or as a reference target for collections.\n *\n * NOTE: `Schema.is(Type.Obj)` does STRUCTURAL validation only (checks for `id` field).\n * Use `Obj.isObject()` for proper ECHO instance type guards that check the KindId brand.\n *\n * @example\n * ```ts\n * // Structural type guard (accepts any object with id field)\n * if (Schema.is(Type.Obj)(unknownValue)) { ... }\n *\n * // ECHO instance type guard (checks KindId brand)\n * if (Obj.isObject(unknownValue)) { ... }\n *\n * // Reference to any object type\n * const Collection = Schema.Struct({\n * objects: Schema.Array(Type.Ref(Type.Obj)),\n * }).pipe(Type.object({ typename: 'Collection', version: '0.1.0' }));\n * ```\n */\n// TODO(wittjosiah): Investigate if Schema.filter can validate KindId on ECHO instances.\n// Effect Schema normalizes proxy objects to plain objects before calling filter predicates.\n// Possible approaches: custom Schema.declare, AST manipulation, or upstream contribution.\nexport const Obj: ObjSchemaType = Object.assign(ObjSchema, {\n [SchemaKindId]: (ObjSchema as any)[SchemaKindId],\n}) as unknown as ObjSchemaType;\n\n/**\n * TypeScript type for an ECHO object schema.\n * `T` is the instance type produced by the schema.\n * `Fields` is the optional struct fields type for introspection.\n *\n * @example\n * ```ts\n * const PersonSchema: Type.Obj<Person> = Schema.Struct({\n * name: Schema.String,\n * }).pipe(Type.object({ typename: 'Person', version: '0.1.0' }));\n *\n * // Access fields for introspection:\n * Object.keys(PersonSchema.fields); // ['name']\n * ```\n */\nexport interface Obj<T = any, Fields extends Schema.Struct.Fields = Schema.Struct.Fields>\n extends TypeMeta,\n EchoSchemaKind<EntityKind.Object>,\n Schema.AnnotableClass<\n Obj<T, Fields>,\n Entity$.OfKind<typeof Entity$.Kind.Object> & T,\n Schema.Simplify<ObjJsonProps & ToMutable<T>>,\n never\n > {\n /**\n * The fields defined in the original struct schema.\n * Allows accessing field definitions for introspection.\n */\n readonly fields: Fields;\n}\n\n/**\n * Structural base type for any ECHO object schema.\n * Accepts both static schemas (created with Type.object()) and EchoSchema.\n * NOTE: Does not include the brand symbol to avoid TS4053 declaration portability issues.\n * Use Type.isObjectSchema() for runtime type guards.\n */\ntype ObjectSchemaBase = Schema.Schema.AnyNoContext & {\n readonly typename: string;\n readonly version: string;\n};\n\nexport namespace Obj {\n /**\n * Type that represents any ECHO object schema.\n * Accepts both static schemas (Type.object()) and mutable schemas (EchoSchema).\n */\n export type Any = ObjectSchemaBase;\n}\n\n/**\n * Factory function to create an ECHO object schema.\n * Adds object metadata annotations to an Effect schema.\n *\n * @example\n * ```ts\n * const Person = Schema.Struct({\n * name: Schema.String,\n * }).pipe(Type.object({ typename: 'example.com/type/Person', version: '0.1.0' }));\n * ```\n */\nexport const object: {\n (opts: TypeMeta): <Self extends Schema.Schema.Any>(self: Self) => Obj<Schema.Schema.Type<Self>>;\n} = EchoObjectSchema as any;\n\n//\n// PersistentType (Schema stored in database)\n//\n\nexport const PersistentType: Obj<PersistentSchema> = PersistentSchema as any;\n\nexport interface PersistentType extends Schema.Schema.Type<typeof PersistentType> {}\n\nexport { EchoSchema as RuntimeType };\n\n//\n// Relation - Runtime schema for any ECHO relation\n//\n\n// Internal type for the Relation schema constant.\ntype RelationSchemaType = Schema.Schema<\n { id: ObjectId } & Record<string, unknown>,\n { id: string } & Record<string, unknown>\n> &\n EchoSchemaKind<EntityKind.Relation> &\n TypeMeta;\n\n// Internal schema definition.\n// NOTE: The EchoRelationSchema annotation is required for Type.Ref(Type.Relation) to work.\n// The typename/version/source/target only satisfy ECHO schema machinery for reference targets.\nconst RelationSchema = Schema.Struct({\n id: Schema.String,\n}).pipe(\n Schema.extend(Schema.Record({ key: Schema.String, value: Schema.Unknown })),\n EchoRelationSchema({\n typename: 'dxos.org/schema/AnyRelation',\n version: '0.0.0',\n source: ObjSchema,\n target: ObjSchema,\n }),\n);\n\n/**\n * Runtime Effect schema for any ECHO relation.\n * Use for validation, parsing, or as a reference target for collections.\n * A relation has `id`, source, and target fields plus any additional properties.\n *\n * NOTE: `Schema.is(Type.Relation)` does STRUCTURAL validation only (checks for `id` field).\n * Use `Relation.isRelation()` for proper ECHO instance type guards that check the KindId brand.\n *\n * @example\n * ```ts\n * // Structural type guard (accepts any object with id field)\n * if (Schema.is(Type.Relation)(unknownValue)) { ... }\n *\n * // ECHO instance type guard (checks KindId brand)\n * if (Relation.isRelation(unknownValue)) { ... }\n * ```\n */\nexport const Relation: RelationSchemaType = Object.assign(RelationSchema, {\n [SchemaKindId]: (RelationSchema as any)[SchemaKindId],\n}) as unknown as RelationSchemaType;\n\n/**\n * TypeScript type for an ECHO relation schema.\n * `T` is the instance type produced by the schema (excluding source/target).\n * `Source` and `Target` are the endpoint types.\n * `Fields` is the optional struct fields type for introspection.\n */\nexport interface Relation<\n T = any,\n Source = any,\n Target = any,\n Fields extends Schema.Struct.Fields = Schema.Struct.Fields,\n> extends TypeMeta,\n EchoSchemaKind<EntityKind.Relation>,\n Schema.AnnotableClass<\n Relation<T, Source, Target, Fields>,\n Entity$.OfKind<typeof Entity$.Kind.Relation> & Relation.Endpoints<Source, Target> & T,\n Schema.Simplify<RelationJsonProps & ToMutable<T>>,\n never\n > {\n /**\n * The fields defined in the original struct schema.\n * Allows accessing field definitions for introspection.\n */\n readonly fields: Fields;\n}\n\n/**\n * Structural base type for any ECHO relation schema.\n * Accepts static schemas (created with Type.relation()).\n * NOTE: Does not include the brand symbol to avoid TS4053 declaration portability issues.\n * Use Type.isRelationSchema() for runtime type guards.\n */\ntype RelationSchemaBase = Schema.Schema.AnyNoContext & {\n readonly typename: string;\n readonly version: string;\n};\n\nexport namespace Relation {\n /**\n * Type that represents any ECHO relation schema.\n * Accepts static schemas (Type.relation()).\n */\n export type Any = RelationSchemaBase;\n\n /**\n * Get relation source type.\n */\n export type Source<A> = A extends Relation.Endpoints<infer S, infer _T> ? S : never;\n\n /**\n * Get relation target type.\n */\n export type Target<A> = A extends Relation.Endpoints<infer _S, infer T> ? T : never;\n\n export type Endpoints<Source, Target> = {\n [Relation$.Source]: Source;\n [Relation$.Target]: Target;\n };\n}\n\n/**\n * Factory function to create an ECHO relation schema.\n * Adds relation metadata annotations to an Effect schema.\n *\n * @example\n * ```ts\n * const WorksFor = Schema.Struct({\n * role: Schema.String,\n * }).pipe(Type.relation({\n * typename: 'example.com/type/WorksFor',\n * version: '0.1.0',\n * source: Person,\n * target: Company,\n * }));\n * ```\n */\nexport const relation: {\n <SourceSchema extends Schema.Schema.AnyNoContext, TargetSchema extends Schema.Schema.AnyNoContext>(\n opts: EchoRelationSchemaOptions<SourceSchema, TargetSchema>,\n ): <Self extends Schema.Schema.Any>(\n self: Self,\n ) => Relation<Schema.Schema.Type<Self>, Schema.Schema.Type<SourceSchema>, Schema.Schema.Type<TargetSchema>>;\n} = EchoRelationSchema as any;\n\n//\n// Entity - Entity schema types (union of Object | Relation)\n//\n\nexport namespace Entity {\n /**\n * Runtime Effect schema for any ECHO entity (object or relation).\n * Use for validation, parsing, or type guards on unknown values.\n *\n * @example\n * ```ts\n * if (Schema.is(Type.Entity.Any)(unknownValue)) {\n * // unknownValue is an ECHO entity\n * }\n * ```\n */\n export const Any: Schema.Schema<\n { id: ObjectId } & Record<string, unknown>,\n { id: string } & Record<string, unknown>\n > = Schema.Union(Obj, Relation);\n\n /**\n * Type alias for any ECHO entity schema (object or relation).\n * Use this in type annotations for schema parameters.\n */\n export type Any = Obj.Any | Relation.Any;\n}\n\n/**\n * Type guard to check if a schema is an object schema.\n * NOTE: This checks SCHEMAS, not instances. Use Obj.isObject for instances.\n */\nexport const isObjectSchema = (schema: Entity.Any): schema is Obj.Any => {\n return (schema as any)[SchemaKindId] === EntityKind.Object;\n};\n\n/**\n * Type guard to check if a schema is a relation schema.\n * NOTE: This checks SCHEMAS, not instances. Use Relation.isRelation for instances.\n */\nexport const isRelationSchema = (schema: Entity.Any): schema is Relation.Any => {\n return (schema as any)[SchemaKindId] === EntityKind.Relation;\n};\n\n//\n// Ref\n//\n// NOTE: `Type.Ref` vs `Ref.Ref`:\n// - `Type.Ref<T>` is the SCHEMA type - a schema that produces `Ref.Ref<T>` instances.\n// - `Ref.Ref<T>` is the INSTANCE type - the actual runtime ref object.\n//\n// Example:\n// const taskRef: Ref.Ref<Task> = Ref.make(task); // Instance\n// const schema: Type.Ref<Task> = Type.Ref(Task); // Schema\n//\n\n/**\n * Return type of the `Ref` schema constructor.\n *\n * This typedef avoids `TS4023` error (name from external module cannot be used named).\n * See Effect's note on interface types.\n */\nexport interface ref<TargetSchema extends Schema.Schema.Any> extends RefSchema<Schema.Schema.Type<TargetSchema>> {}\n\n/**\n * Factory function to create a Ref schema for the given target schema.\n * Use this in schema definitions to declare reference fields.\n *\n * @example\n * ```ts\n * const Task = Schema.Struct({\n * assignee: Type.Ref(Person), // Creates a Ref schema\n * }).pipe(Type.object({ typename: 'Task', version: '0.1.0' }));\n * ```\n */\nexport const Ref: RefFn = Ref$;\n\n/**\n * TypeScript type for a Ref schema.\n * This is the type of the SCHEMA itself, not the runtime ref instance.\n * For the instance type, use `Ref.Ref<T>` from the Ref module.\n *\n * @example\n * ```ts\n * // Schema type annotation (rarely needed, usually inferred):\n * const refSchema: Type.Ref<Task> = Type.Ref(Task);\n *\n * // Instance type annotation (use Ref.Ref instead):\n * const refInstance: Ref.Ref<Task> = Ref.make(task);\n * ```\n */\nexport interface Ref<T> extends Schema.SchemaClass<Ref$<T>, EncodedReference> {}\n\nexport namespace Ref {\n /**\n * Type that represents any Ref schema (with unknown target type).\n * This is a schema type, not an instance type.\n */\n export type Any = Schema.Schema<Ref$<any>, EncodedReference>;\n}\n\n//\n// Schema utility functions\n//\n\n/**\n * Gets the full DXN of the schema.\n * Will include the version if it's a `type` DXN.\n * @example \"dxn:example.com/type/Person:0.1.0\"\n * @example \"dxn:echo:SSSSSSSSSS:XXXXXXXXXXXXX\"\n */\nexport const getDXN = (schema: Entity.Any): DXN | undefined => {\n return getSchemaDXN(schema);\n};\n\n/**\n * @param schema - Schema to get the typename from.\n * @returns The typename of the schema. Example: `example.com/type/Person`.\n */\nexport const getTypename = (schema: Entity.Any): string => {\n const typename = getSchemaTypename(schema);\n invariant(typeof typename === 'string' && !typename.startsWith('dxn:'), 'Invalid typename');\n return typename;\n};\n\n/**\n * Gets the version of the schema.\n * @example 0.1.0\n */\nexport const getVersion = (schema: Entity.Any): string => {\n const version = getSchemaVersion(schema);\n invariant(typeof version === 'string' && version.match(/^\\d+\\.\\d+\\.\\d+$/), 'Invalid version');\n return version;\n};\n\n/**\n * @returns True if the schema is mutable.\n */\nexport const isMutable = isMutable$;\n\n/**\n * ECHO type metadata.\n */\nexport type Meta = TypeAnnotation;\n\n/**\n * Gets the meta data of the schema.\n */\nexport const getMeta = (schema: Entity.Any): Meta | undefined => {\n return getTypeAnnotation(schema);\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;aAAAA;EAAA;;;;;;mBAAAC;EAAA;;;;;;;AAIA,YAAYC,YAAY;AAGxB,SAASC,iBAAiB;A;AA4F1B,IAAMC,YAAmBC,cAAO;EAC9BC,IAAWC;AACb,CAAA,EAAGC,KACMC,cAAcC,cAAO;EAAEC,KAAYJ;EAAQK,OAAcC;AAAQ,CAAA,CAAA,GACxEC,iBAAiB;EAAEC,UAAUC;EAAqBC,SAASC;AAAmB,CAAA,CAAA;AA2BzE,IAAMC,MAAqBC,OAAOC,OAAOjB,WAAW;EACzD,CAACkB,YAAAA,GAAgBlB,UAAkBkB,YAAAA;AACrC,CAAA;AA+DO,IAAMC,SAETT;AAMG,IAAMU,iBAAwCC;AAqBrD,IAAMC,iBAAwBC,cAAO;EACnCC,IAAWC;AACb,CAAA,EAAGC,KACMC,cAAcC,cAAO;EAAEC,KAAYJ;EAAQK,OAAcC;AAAQ,CAAA,CAAA,GACxEC,mBAAmB;EACjBC,UAAU;EACVC,SAAS;EACTC,QAAQC;EACRC,QAAQD;AACV,CAAA,CAAA;AAoBK,IAAME,WAA+BC,OAAOC,OAAOlB,gBAAgB;EACxE,CAACmB,YAAAA,GAAgBnB,eAAuBmB,YAAAA;AAC1C,CAAA;AA8EO,IAAMC,WAMTV;UAMaW,SAAAA;UAYFC,MAGFC,aAAMC,KAAKR,QAAAA;AAOxB,GAtBiBK,WAAAA,SAAAA,CAAAA,EAAAA;AA4BV,IAAMI,iBAAiB,CAACC,WAAAA;AAC7B,SAAQA,OAAeP,YAAAA,MAAkBQ,WAAWV;AACtD;AAMO,IAAMW,mBAAmB,CAACF,WAAAA;AAC/B,SAAQA,OAAeP,YAAAA,MAAkBQ,WAAWX;AACtD;AAiCO,IAAMa,OAAaC;AAoCnB,IAAMC,SAAS,CAACL,WAAAA;AACrB,SAAOM,aAAaN,MAAAA;AACtB;AAMO,IAAMO,cAAc,CAACP,WAAAA;AAC1B,QAAMf,WAAWuB,kBAAkBR,MAAAA;AACnCS,YAAU,OAAOxB,aAAa,YAAY,CAACA,SAASyB,WAAW,MAAA,GAAS,oBAAA;;;;;;;;;AACxE,SAAOzB;AACT;AAMO,IAAM0B,aAAa,CAACX,WAAAA;AACzB,QAAMd,UAAU0B,iBAAiBZ,MAAAA;AACjCS,YAAU,OAAOvB,YAAY,YAAYA,QAAQ2B,MAAM,iBAAA,GAAoB,mBAAA;;;;;;;;;AAC3E,SAAO3B;AACT;AAKO,IAAM4B,aAAYC;AAUlB,IAAMC,UAAU,CAAChB,WAAAA;AACtB,SAAOiB,kBAAkBjB,MAAAA;AAC3B;;",
|
|
6
|
+
"names": ["Ref", "isMutable", "Schema", "invariant", "ObjSchema", "Struct", "id", "String", "pipe", "extend", "Record", "key", "value", "Unknown", "EchoObjectSchema", "typename", "ANY_OBJECT_TYPENAME", "version", "ANY_OBJECT_VERSION", "Obj", "Object", "assign", "SchemaKindId", "object", "PersistentType", "PersistentSchema", "RelationSchema", "Struct", "id", "String", "pipe", "extend", "Record", "key", "value", "Unknown", "EchoRelationSchema", "typename", "version", "source", "ObjSchema", "target", "Relation", "Object", "assign", "SchemaKindId", "relation", "Entity", "Any", "Union", "Obj", "isObjectSchema", "schema", "EntityKind", "isRelationSchema", "Ref", "Ref$", "getDXN", "getSchemaDXN", "getTypename", "getSchemaTypename", "invariant", "startsWith", "getVersion", "getSchemaVersion", "match", "isMutable", "isMutable$", "getMeta", "getTypeAnnotation"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
Ref,
|
|
4
|
+
RefArray,
|
|
5
|
+
getSchemaReference
|
|
6
|
+
} from "./chunk-LT3H4JOX.mjs";
|
|
7
|
+
import {
|
|
8
|
+
__export
|
|
9
|
+
} from "./chunk-HSLMI22Q.mjs";
|
|
10
|
+
|
|
11
|
+
// src/Ref.ts
|
|
12
|
+
var Ref_exports = {};
|
|
13
|
+
__export(Ref_exports, {
|
|
14
|
+
Array: () => Array,
|
|
15
|
+
fromDXN: () => fromDXN,
|
|
16
|
+
isRef: () => isRef,
|
|
17
|
+
isRefType: () => isRefType,
|
|
18
|
+
make: () => make
|
|
19
|
+
});
|
|
20
|
+
import * as Option from "effect/Option";
|
|
21
|
+
import * as SchemaAST from "effect/SchemaAST";
|
|
22
|
+
var Array = RefArray;
|
|
23
|
+
var isRef = Ref.isRef;
|
|
24
|
+
var make = Ref.make;
|
|
25
|
+
var fromDXN = Ref.fromDXN;
|
|
26
|
+
var isRefType = (ast) => {
|
|
27
|
+
return SchemaAST.getAnnotation(ast, SchemaAST.JSONSchemaAnnotationId).pipe(Option.flatMap((jsonSchema) => "$id" in jsonSchema ? Option.some(jsonSchema) : Option.none()), Option.flatMap((jsonSchema) => {
|
|
28
|
+
const { typename } = getSchemaReference(jsonSchema) ?? {};
|
|
29
|
+
return typename ? Option.some(true) : Option.some(false);
|
|
30
|
+
}), Option.getOrElse(() => false));
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export {
|
|
34
|
+
Array,
|
|
35
|
+
isRef,
|
|
36
|
+
make,
|
|
37
|
+
fromDXN,
|
|
38
|
+
isRefType,
|
|
39
|
+
Ref_exports
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=chunk-QLI2EIJ2.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/Ref.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Option from 'effect/Option';\nimport * as SchemaAST from 'effect/SchemaAST';\n\nimport { Ref as Ref$, RefArray, type RefResolver } from './internal';\nimport { getSchemaReference } from './internal';\nimport type * as JsonSchema from './JsonSchema';\nimport type * as Obj from './Obj';\n\nexport type Ref<T> = Ref$<T>;\nexport type Unknown = Ref$<Obj.Unknown>;\n\nexport const Array = RefArray;\n\n/**\n * Extract reference target.\n */\nexport type Target<R extends Unknown> = R extends Ref$<infer T> ? T : never;\n\n/**\n * Reference resolver.\n */\nexport type Resolver = RefResolver;\n\nexport const isRef: (value: unknown) => value is Unknown = Ref$.isRef;\n\nexport const make = Ref$.make;\n\n// TODO(dmaretskyi): Consider just allowing `make` to accept DXN.\nexport const fromDXN = Ref$.fromDXN;\n\n// TODO(wittjosiah): Factor out?\nexport const isRefType = (ast: SchemaAST.AST): boolean => {\n return SchemaAST.getAnnotation<JsonSchema.JsonSchema>(ast, SchemaAST.JSONSchemaAnnotationId).pipe(\n Option.flatMap((jsonSchema) => ('$id' in jsonSchema ? Option.some(jsonSchema) : Option.none())),\n Option.flatMap((jsonSchema) => {\n const { typename } = getSchemaReference(jsonSchema) ?? {};\n return typename ? Option.some(true) : Option.some(false);\n }),\n Option.getOrElse(() => false),\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;AAAA;;;;;;;;AAIA,YAAYA,YAAY;AACxB,YAAYC,eAAe;AAUpB,IAAMC,QAAQC;AAYd,IAAMC,QAA8CC,IAAKD;AAEzD,IAAME,OAAOD,IAAKC;AAGlB,IAAMC,UAAUF,IAAKE;AAGrB,IAAMC,YAAY,CAACC,QAAAA;AACxB,SAAiBC,wBAAqCD,KAAeE,gCAAsB,EAAEC,KACpFC,eAAQ,CAACC,eAAgB,SAASA,aAAoBC,YAAKD,UAAAA,IAAqBE,YAAI,CAAA,GACpFH,eAAQ,CAACC,eAAAA;AACd,UAAM,EAAEG,SAAQ,IAAKC,mBAAmBJ,UAAAA,KAAe,CAAC;AACxD,WAAOG,WAAkBF,YAAK,IAAA,IAAeA,YAAK,KAAA;EACpD,CAAA,GACOI,iBAAU,MAAM,KAAA,CAAA;AAE3B;",
|
|
6
|
+
"names": ["Option", "SchemaAST", "Array", "RefArray", "isRef", "Ref$", "make", "fromDXN", "isRefType", "ast", "getAnnotation", "JSONSchemaAnnotationId", "pipe", "flatMap", "jsonSchema", "some", "none", "typename", "getSchemaReference", "getOrElse"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
isRef
|
|
4
|
+
} from "./chunk-QLI2EIJ2.mjs";
|
|
5
|
+
import {
|
|
6
|
+
getTypeDXNFromSpecifier
|
|
7
|
+
} from "./chunk-YOLH5KS4.mjs";
|
|
8
|
+
import {
|
|
9
|
+
__export
|
|
10
|
+
} from "./chunk-HSLMI22Q.mjs";
|
|
11
|
+
|
|
12
|
+
// src/Filter.ts
|
|
13
|
+
var Filter_exports = {};
|
|
14
|
+
__export(Filter_exports, {
|
|
15
|
+
and: () => and,
|
|
16
|
+
between: () => between,
|
|
17
|
+
contains: () => contains,
|
|
18
|
+
eq: () => eq,
|
|
19
|
+
everything: () => everything,
|
|
20
|
+
foreignKeys: () => foreignKeys,
|
|
21
|
+
fromAst: () => fromAst,
|
|
22
|
+
gt: () => gt,
|
|
23
|
+
gte: () => gte,
|
|
24
|
+
id: () => id,
|
|
25
|
+
in: () => in$,
|
|
26
|
+
is: () => is,
|
|
27
|
+
lt: () => lt,
|
|
28
|
+
lte: () => lte,
|
|
29
|
+
neq: () => neq,
|
|
30
|
+
not: () => not,
|
|
31
|
+
nothing: () => nothing,
|
|
32
|
+
or: () => or,
|
|
33
|
+
props: () => props,
|
|
34
|
+
tag: () => tag,
|
|
35
|
+
text: () => text,
|
|
36
|
+
type: () => type,
|
|
37
|
+
typeDXN: () => typeDXN,
|
|
38
|
+
typename: () => typename
|
|
39
|
+
});
|
|
40
|
+
import * as Match from "effect/Match";
|
|
41
|
+
import * as Schema from "effect/Schema";
|
|
42
|
+
import { assertArgument } from "@dxos/invariant";
|
|
43
|
+
import { DXN, ObjectId } from "@dxos/keys";
|
|
44
|
+
var FilterClass = class _FilterClass {
|
|
45
|
+
ast;
|
|
46
|
+
static variance = {};
|
|
47
|
+
constructor(ast) {
|
|
48
|
+
this.ast = ast;
|
|
49
|
+
}
|
|
50
|
+
"~Filter" = _FilterClass.variance;
|
|
51
|
+
};
|
|
52
|
+
var is = (value2) => {
|
|
53
|
+
return typeof value2 === "object" && value2 !== null && "~Filter" in value2;
|
|
54
|
+
};
|
|
55
|
+
var fromAst = (ast) => {
|
|
56
|
+
return new FilterClass(ast);
|
|
57
|
+
};
|
|
58
|
+
var everything = () => {
|
|
59
|
+
return new FilterClass({
|
|
60
|
+
type: "object",
|
|
61
|
+
typename: null,
|
|
62
|
+
props: {}
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
var nothing = () => {
|
|
66
|
+
return new FilterClass({
|
|
67
|
+
type: "not",
|
|
68
|
+
filter: {
|
|
69
|
+
type: "object",
|
|
70
|
+
typename: null,
|
|
71
|
+
props: {}
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
var id = (...ids) => {
|
|
76
|
+
assertArgument(ids.every((id2) => ObjectId.isValid(id2)), "ids", "ids must be valid");
|
|
77
|
+
if (ids.length === 0) {
|
|
78
|
+
return nothing();
|
|
79
|
+
}
|
|
80
|
+
return new FilterClass({
|
|
81
|
+
type: "object",
|
|
82
|
+
typename: null,
|
|
83
|
+
id: ids,
|
|
84
|
+
props: {}
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
var type = (schema, props2) => {
|
|
88
|
+
const dxn = getTypeDXNFromSpecifier(schema);
|
|
89
|
+
return new FilterClass({
|
|
90
|
+
type: "object",
|
|
91
|
+
typename: dxn.toString(),
|
|
92
|
+
...propsFilterToAst(props2 ?? {})
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
var typename = (typename2) => {
|
|
96
|
+
assertArgument(!typename2.startsWith("dxn:"), "typename", "Typename must no be qualified");
|
|
97
|
+
return new FilterClass({
|
|
98
|
+
type: "object",
|
|
99
|
+
typename: DXN.fromTypename(typename2).toString(),
|
|
100
|
+
props: {}
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
var typeDXN = (dxn) => {
|
|
104
|
+
return new FilterClass({
|
|
105
|
+
type: "object",
|
|
106
|
+
typename: dxn.toString(),
|
|
107
|
+
props: {}
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
var tag = (tag2) => {
|
|
111
|
+
return new FilterClass({
|
|
112
|
+
type: "tag",
|
|
113
|
+
tag: tag2
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
var props = (props2) => {
|
|
117
|
+
return new FilterClass({
|
|
118
|
+
type: "object",
|
|
119
|
+
typename: null,
|
|
120
|
+
...propsFilterToAst(props2)
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
var text = (text2, options) => {
|
|
124
|
+
return new FilterClass({
|
|
125
|
+
type: "text-search",
|
|
126
|
+
text: text2,
|
|
127
|
+
searchKind: options?.type
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
var foreignKeys = (schema, keys) => {
|
|
131
|
+
const dxn = getTypeDXNFromSpecifier(schema);
|
|
132
|
+
return new FilterClass({
|
|
133
|
+
type: "object",
|
|
134
|
+
typename: dxn.toString(),
|
|
135
|
+
props: {},
|
|
136
|
+
foreignKeys: keys
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
var eq = (value2) => {
|
|
140
|
+
if (!isRef(value2) && typeof value2 === "object" && value2 !== null) {
|
|
141
|
+
throw new TypeError("Cannot use object as a value for eq filter");
|
|
142
|
+
}
|
|
143
|
+
return new FilterClass({
|
|
144
|
+
type: "compare",
|
|
145
|
+
operator: "eq",
|
|
146
|
+
value: isRef(value2) ? value2.noInline().encode() : value2
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
var neq = (value2) => {
|
|
150
|
+
return new FilterClass({
|
|
151
|
+
type: "compare",
|
|
152
|
+
operator: "neq",
|
|
153
|
+
value: value2
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
var gt = (value2) => {
|
|
157
|
+
return new FilterClass({
|
|
158
|
+
type: "compare",
|
|
159
|
+
operator: "gt",
|
|
160
|
+
value: value2
|
|
161
|
+
});
|
|
162
|
+
};
|
|
163
|
+
var gte = (value2) => {
|
|
164
|
+
return new FilterClass({
|
|
165
|
+
type: "compare",
|
|
166
|
+
operator: "gte",
|
|
167
|
+
value: value2
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
var lt = (value2) => {
|
|
171
|
+
return new FilterClass({
|
|
172
|
+
type: "compare",
|
|
173
|
+
operator: "lt",
|
|
174
|
+
value: value2
|
|
175
|
+
});
|
|
176
|
+
};
|
|
177
|
+
var lte = (value2) => {
|
|
178
|
+
return new FilterClass({
|
|
179
|
+
type: "compare",
|
|
180
|
+
operator: "lte",
|
|
181
|
+
value: value2
|
|
182
|
+
});
|
|
183
|
+
};
|
|
184
|
+
var in$ = (...values) => {
|
|
185
|
+
return new FilterClass({
|
|
186
|
+
type: "in",
|
|
187
|
+
values
|
|
188
|
+
});
|
|
189
|
+
};
|
|
190
|
+
var contains = (value2) => {
|
|
191
|
+
return new FilterClass({
|
|
192
|
+
type: "contains",
|
|
193
|
+
value: value2
|
|
194
|
+
});
|
|
195
|
+
};
|
|
196
|
+
var between = (from, to) => {
|
|
197
|
+
return new FilterClass({
|
|
198
|
+
type: "range",
|
|
199
|
+
from,
|
|
200
|
+
to
|
|
201
|
+
});
|
|
202
|
+
};
|
|
203
|
+
var not = (filter) => {
|
|
204
|
+
return new FilterClass({
|
|
205
|
+
type: "not",
|
|
206
|
+
filter: filter.ast
|
|
207
|
+
});
|
|
208
|
+
};
|
|
209
|
+
var and = (...filters) => {
|
|
210
|
+
return new FilterClass({
|
|
211
|
+
type: "and",
|
|
212
|
+
filters: filters.map((f) => f.ast)
|
|
213
|
+
});
|
|
214
|
+
};
|
|
215
|
+
var or = (...filters) => {
|
|
216
|
+
return new FilterClass({
|
|
217
|
+
type: "or",
|
|
218
|
+
filters: filters.map((f) => f.ast)
|
|
219
|
+
});
|
|
220
|
+
};
|
|
221
|
+
var propsFilterToAst = (predicates) => {
|
|
222
|
+
let idFilter;
|
|
223
|
+
if ("id" in predicates) {
|
|
224
|
+
assertArgument(typeof predicates.id === "string" || Array.isArray(predicates.id), "predicates.id", "invalid id filter");
|
|
225
|
+
idFilter = typeof predicates.id === "string" ? [
|
|
226
|
+
predicates.id
|
|
227
|
+
] : predicates.id;
|
|
228
|
+
Schema.Array(ObjectId).pipe(Schema.validateSync)(idFilter);
|
|
229
|
+
}
|
|
230
|
+
return {
|
|
231
|
+
id: idFilter,
|
|
232
|
+
props: Object.fromEntries(Object.entries(predicates).filter(([prop, _value]) => prop !== "id").map(([prop, predicate]) => [
|
|
233
|
+
prop,
|
|
234
|
+
processPredicate(predicate)
|
|
235
|
+
]))
|
|
236
|
+
};
|
|
237
|
+
};
|
|
238
|
+
var processPredicate = (predicate) => {
|
|
239
|
+
return Match.value(predicate).pipe(
|
|
240
|
+
Match.withReturnType(),
|
|
241
|
+
Match.when(is, (predicate2) => predicate2.ast),
|
|
242
|
+
// TODO(wittjosiah): Add support for array predicates.
|
|
243
|
+
Match.when(Array.isArray, (_predicate) => {
|
|
244
|
+
throw new Error("Array predicates are not yet supported.");
|
|
245
|
+
}),
|
|
246
|
+
Match.when((predicate2) => !isRef(predicate2) && typeof predicate2 === "object" && predicate2 !== null, (predicate2) => {
|
|
247
|
+
const nestedProps = Object.fromEntries(Object.entries(predicate2).map(([key, value2]) => [
|
|
248
|
+
key,
|
|
249
|
+
processPredicate(value2)
|
|
250
|
+
]));
|
|
251
|
+
return {
|
|
252
|
+
type: "object",
|
|
253
|
+
typename: null,
|
|
254
|
+
props: nestedProps
|
|
255
|
+
};
|
|
256
|
+
}),
|
|
257
|
+
Match.orElse((value2) => eq(value2).ast)
|
|
258
|
+
);
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
export {
|
|
262
|
+
is,
|
|
263
|
+
fromAst,
|
|
264
|
+
everything,
|
|
265
|
+
nothing,
|
|
266
|
+
id,
|
|
267
|
+
type,
|
|
268
|
+
typename,
|
|
269
|
+
typeDXN,
|
|
270
|
+
tag,
|
|
271
|
+
props,
|
|
272
|
+
text,
|
|
273
|
+
foreignKeys,
|
|
274
|
+
eq,
|
|
275
|
+
neq,
|
|
276
|
+
gt,
|
|
277
|
+
gte,
|
|
278
|
+
lt,
|
|
279
|
+
lte,
|
|
280
|
+
in$,
|
|
281
|
+
contains,
|
|
282
|
+
between,
|
|
283
|
+
not,
|
|
284
|
+
and,
|
|
285
|
+
or,
|
|
286
|
+
Filter_exports
|
|
287
|
+
};
|
|
288
|
+
//# sourceMappingURL=chunk-QYR67VBV.mjs.map
|