@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
package/src/Order.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type QueryAST } from '@dxos/echo-protocol';
|
|
6
|
+
|
|
7
|
+
export interface Order<T> {
|
|
8
|
+
// TODO(dmaretskyi): See new effect-schema approach to variance.
|
|
9
|
+
'~Order': { value: T };
|
|
10
|
+
|
|
11
|
+
ast: QueryAST.Order;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type Any = Order<any>;
|
|
15
|
+
|
|
16
|
+
class OrderClass implements Order<any> {
|
|
17
|
+
private static variance: Order<any>['~Order'] = {} as Order<any>['~Order'];
|
|
18
|
+
|
|
19
|
+
static is(value: unknown): value is Order<any> {
|
|
20
|
+
return typeof value === 'object' && value !== null && '~Order' in value;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
constructor(public readonly ast: QueryAST.Order) {}
|
|
24
|
+
|
|
25
|
+
'~Order' = OrderClass.variance;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const natural: Order<any> = new OrderClass({ kind: 'natural' });
|
|
29
|
+
export const property = <T>(property: keyof T & string, direction: QueryAST.OrderDirection): Order<T> =>
|
|
30
|
+
new OrderClass({
|
|
31
|
+
kind: 'property',
|
|
32
|
+
property,
|
|
33
|
+
direction,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Order by relevance rank (for FTS/vector search results).
|
|
38
|
+
* Higher rank = better match. Default direction is 'desc' (best matches first).
|
|
39
|
+
*/
|
|
40
|
+
export const rank = <T>(direction: QueryAST.OrderDirection = 'desc'): Order<T> =>
|
|
41
|
+
new OrderClass({
|
|
42
|
+
kind: 'rank',
|
|
43
|
+
direction,
|
|
44
|
+
});
|
|
@@ -0,0 +1,465 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
import { describe, expect, test } from 'vitest';
|
|
7
|
+
|
|
8
|
+
import { QueryAST } from '@dxos/echo-protocol';
|
|
9
|
+
import { DXN } from '@dxos/keys';
|
|
10
|
+
import { log } from '@dxos/log';
|
|
11
|
+
|
|
12
|
+
import * as Filter from './Filter';
|
|
13
|
+
import * as Obj from './Obj';
|
|
14
|
+
import * as Order from './Order';
|
|
15
|
+
import * as Query from './Query';
|
|
16
|
+
import * as Ref from './Ref';
|
|
17
|
+
import { TestSchema } from './testing';
|
|
18
|
+
|
|
19
|
+
describe('query api', () => {
|
|
20
|
+
describe('Query', () => {
|
|
21
|
+
test('get all people', () => {
|
|
22
|
+
const getAllPeople = Query.type(TestSchema.Person);
|
|
23
|
+
|
|
24
|
+
log('query', { ast: getAllPeople.ast });
|
|
25
|
+
Schema.validateSync(QueryAST.Query)(getAllPeople.ast);
|
|
26
|
+
log('getAllPeople', { ast: getAllPeople.ast });
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test('get all people ordered by name', () => {
|
|
30
|
+
const getAllPeopleOrderedByName = Query.type(TestSchema.Person).orderBy(Order.property('name', 'asc'));
|
|
31
|
+
|
|
32
|
+
log('query', { ast: getAllPeopleOrderedByName.ast });
|
|
33
|
+
Schema.validateSync(QueryAST.Query)(getAllPeopleOrderedByName.ast);
|
|
34
|
+
log('getAllPeopleOrderedByName', { ast: getAllPeopleOrderedByName.ast });
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test('get all people named Fred', () => {
|
|
38
|
+
const PeopleNamedFred = Query.select(Filter.type(TestSchema.Person, { name: 'Fred' }));
|
|
39
|
+
|
|
40
|
+
log('query', { ast: PeopleNamedFred.ast });
|
|
41
|
+
Schema.validateSync(QueryAST.Query)(PeopleNamedFred.ast);
|
|
42
|
+
log('PeopleNamedFred', { ast: PeopleNamedFred.ast });
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
test('get all people with field of "label" set to "Research"', () => {
|
|
46
|
+
const PeopleWithFieldLabelSetToResearch = Query.select(
|
|
47
|
+
Filter.type(TestSchema.Person, { fields: Filter.contains({ label: 'label', value: 'Research' }) }),
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
log('query', { ast: PeopleWithFieldLabelSetToResearch.ast });
|
|
51
|
+
Schema.validateSync(QueryAST.Query)(PeopleWithFieldLabelSetToResearch.ast);
|
|
52
|
+
log('PeopleWithFieldLabelSetToResearch', { ast: PeopleWithFieldLabelSetToResearch.ast });
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test('get all orgs with property "label" set to "Research"', () => {
|
|
56
|
+
const OrgsWithPropertyLabelSetToResearch = Query.select(
|
|
57
|
+
Filter.type(TestSchema.Organization, { properties: { label: 'Research' } }),
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
log('query', { ast: OrgsWithPropertyLabelSetToResearch.ast });
|
|
61
|
+
Schema.validateSync(QueryAST.Query)(OrgsWithPropertyLabelSetToResearch.ast);
|
|
62
|
+
log('OrgsWithPropertyLabelSetToResearch', { ast: OrgsWithPropertyLabelSetToResearch.ast });
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
test('get all orgs Fred worked for since 2020', () => {
|
|
66
|
+
const fred = Obj.make(TestSchema.Person, { name: 'Fred' });
|
|
67
|
+
const OrganizationsFredWorkedForSince2020 = Query.select(Filter.type(TestSchema.Person, { id: fred.id }))
|
|
68
|
+
.sourceOf(TestSchema.EmployedBy, { since: Filter.gt('2020') })
|
|
69
|
+
.target();
|
|
70
|
+
|
|
71
|
+
log('query', { ast: OrganizationsFredWorkedForSince2020.ast });
|
|
72
|
+
Schema.validateSync(QueryAST.Query)(OrganizationsFredWorkedForSince2020.ast);
|
|
73
|
+
log('OrganizationsFredWorkedForSince2020', { ast: OrganizationsFredWorkedForSince2020.ast });
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test('get all tasks for Fred', () => {
|
|
77
|
+
const fred = Obj.make(TestSchema.Person, { name: 'Fred' });
|
|
78
|
+
const TasksForFred = Query.select(Filter.type(TestSchema.Person, { id: fred.id })).referencedBy(
|
|
79
|
+
TestSchema.Task,
|
|
80
|
+
'assignee',
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
log('query', { ast: TasksForFred.ast });
|
|
84
|
+
Schema.validateSync(QueryAST.Query)(TasksForFred.ast);
|
|
85
|
+
log('TasksForFred', { ast: TasksForFred.ast });
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
test('get all objects referencing Fred (any type, specified property)', () => {
|
|
89
|
+
const fred = Obj.make(TestSchema.Person, { name: 'Fred' });
|
|
90
|
+
const ObjectsReferencingFred = Query.select(Filter.type(TestSchema.Person, { id: fred.id })).referencedBy(
|
|
91
|
+
TestSchema.Task,
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
log('query', { ast: ObjectsReferencingFred.ast });
|
|
95
|
+
Schema.validateSync(QueryAST.Query)(ObjectsReferencingFred.ast);
|
|
96
|
+
expect(ObjectsReferencingFred.ast).toMatchObject({
|
|
97
|
+
type: 'incoming-references',
|
|
98
|
+
property: null,
|
|
99
|
+
typename: 'dxn:type:example.com/type/Task:0.1.0',
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
test('get all objects referencing Fred (any type, any property)', () => {
|
|
104
|
+
const fred = Obj.make(TestSchema.Person, { name: 'Fred' });
|
|
105
|
+
const AllBacklinks = Query.select(Filter.type(TestSchema.Person, { id: fred.id })).referencedBy();
|
|
106
|
+
|
|
107
|
+
log('query', { ast: AllBacklinks.ast });
|
|
108
|
+
Schema.validateSync(QueryAST.Query)(AllBacklinks.ast);
|
|
109
|
+
expect(AllBacklinks.ast).toMatchObject({
|
|
110
|
+
type: 'incoming-references',
|
|
111
|
+
property: null,
|
|
112
|
+
typename: null,
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
test('get all tasks for employees of Cyberdyne', () => {
|
|
117
|
+
const TasksForEmployeesOfCyberdyne = Query.select(Filter.type(TestSchema.Organization, { name: 'Cyberdyne' }))
|
|
118
|
+
.targetOf(TestSchema.EmployedBy)
|
|
119
|
+
.source()
|
|
120
|
+
.referencedBy(TestSchema.Task, 'assignee');
|
|
121
|
+
|
|
122
|
+
log('query', { ast: TasksForEmployeesOfCyberdyne.ast });
|
|
123
|
+
Schema.validateSync(QueryAST.Query)(TasksForEmployeesOfCyberdyne.ast);
|
|
124
|
+
log('TasksForEmployeesOfCyberdyne', { ast: TasksForEmployeesOfCyberdyne.ast });
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
test('get all people or orgs', () => {
|
|
128
|
+
const PeopleOrOrganizations = Query.all(
|
|
129
|
+
Query.select(Filter.type(TestSchema.Person)),
|
|
130
|
+
Query.select(Filter.type(TestSchema.Organization)),
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
log('query', { ast: PeopleOrOrganizations.ast });
|
|
134
|
+
Schema.validateSync(QueryAST.Query)(PeopleOrOrganizations.ast);
|
|
135
|
+
log('PeopleOrOrganizations', { ast: PeopleOrOrganizations.ast });
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
test('get all people not in orgs', () => {
|
|
139
|
+
const PeopleNotInOrganizations = Query.without(
|
|
140
|
+
Query.select(Filter.type(TestSchema.Person)),
|
|
141
|
+
Query.select(Filter.type(TestSchema.Person)).sourceOf(TestSchema.EmployedBy).source(),
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
log('query', { ast: PeopleNotInOrganizations.ast });
|
|
145
|
+
Schema.validateSync(QueryAST.Query)(PeopleNotInOrganizations.ast);
|
|
146
|
+
log('PeopleNotInOrganizations', { ast: PeopleNotInOrganizations.ast });
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
test('get assignees of all tasks created after 2020', () => {
|
|
150
|
+
const AssigneesOfAllTasksCreatedAfter2020 = Query.select(
|
|
151
|
+
Filter.type(TestSchema.Task, { deadline: Filter.gt('2020') }),
|
|
152
|
+
).reference('assignee');
|
|
153
|
+
|
|
154
|
+
log('query', { ast: AssigneesOfAllTasksCreatedAfter2020.ast });
|
|
155
|
+
Schema.validateSync(QueryAST.Query)(AssigneesOfAllTasksCreatedAfter2020.ast);
|
|
156
|
+
log('AssigneesOfAllTasksCreatedAfter2020', { ast: AssigneesOfAllTasksCreatedAfter2020.ast });
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
test('untyped full-text search', () => {
|
|
160
|
+
const contactFullTextSearch = Query.select(Filter.text('Bill'));
|
|
161
|
+
|
|
162
|
+
log('query', { ast: contactFullTextSearch.ast });
|
|
163
|
+
Schema.validateSync(QueryAST.Query)(contactFullTextSearch.ast);
|
|
164
|
+
expect(contactFullTextSearch.ast).toMatchInlineSnapshot(`
|
|
165
|
+
{
|
|
166
|
+
"filter": {
|
|
167
|
+
"searchKind": undefined,
|
|
168
|
+
"text": "Bill",
|
|
169
|
+
"type": "text-search",
|
|
170
|
+
},
|
|
171
|
+
"type": "select",
|
|
172
|
+
}
|
|
173
|
+
`);
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
test('typed full-text search', () => {
|
|
177
|
+
const contactFullTextSearch = Query.select(Filter.type(TestSchema.Person)).select(Filter.text('Bill'));
|
|
178
|
+
|
|
179
|
+
log('query', { ast: contactFullTextSearch.ast });
|
|
180
|
+
Schema.validateSync(QueryAST.Query)(contactFullTextSearch.ast);
|
|
181
|
+
expect(contactFullTextSearch.ast).toMatchInlineSnapshot(`
|
|
182
|
+
{
|
|
183
|
+
"filter": {
|
|
184
|
+
"searchKind": undefined,
|
|
185
|
+
"text": "Bill",
|
|
186
|
+
"type": "text-search",
|
|
187
|
+
},
|
|
188
|
+
"selection": {
|
|
189
|
+
"filter": {
|
|
190
|
+
"id": undefined,
|
|
191
|
+
"props": {},
|
|
192
|
+
"type": "object",
|
|
193
|
+
"typename": "dxn:type:example.com/type/Person:0.1.0",
|
|
194
|
+
},
|
|
195
|
+
"type": "select",
|
|
196
|
+
},
|
|
197
|
+
"type": "filter",
|
|
198
|
+
}
|
|
199
|
+
`);
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
test('filter by ref', () => {
|
|
203
|
+
const fred = Obj.make(TestSchema.Person, { name: 'Fred' });
|
|
204
|
+
const tasksByFred = Filter.type(TestSchema.Task, { assignee: Ref.make(fred) });
|
|
205
|
+
expect(tasksByFred.ast).toEqual({
|
|
206
|
+
props: {
|
|
207
|
+
assignee: {
|
|
208
|
+
operator: 'eq',
|
|
209
|
+
type: 'compare',
|
|
210
|
+
value: {
|
|
211
|
+
'/': DXN.fromLocalObjectId(fred.id).toString(),
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
type: 'object',
|
|
216
|
+
typename: 'dxn:type:example.com/type/Task:0.1.0',
|
|
217
|
+
});
|
|
218
|
+
log('tasksByFred', { ast: tasksByFred.ast });
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
test('select orgs and people', () => {
|
|
222
|
+
const orgsAndPeople = Query.select(
|
|
223
|
+
Filter.or(Filter.type(TestSchema.Organization), Filter.type(TestSchema.Person)),
|
|
224
|
+
);
|
|
225
|
+
|
|
226
|
+
Schema.validateSync(QueryAST.Query)(orgsAndPeople.ast);
|
|
227
|
+
expect(orgsAndPeople.ast).toMatchInlineSnapshot(`
|
|
228
|
+
{
|
|
229
|
+
"filter": {
|
|
230
|
+
"filters": [
|
|
231
|
+
{
|
|
232
|
+
"id": undefined,
|
|
233
|
+
"props": {},
|
|
234
|
+
"type": "object",
|
|
235
|
+
"typename": "dxn:type:example.com/type/Organization:0.1.0",
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
"id": undefined,
|
|
239
|
+
"props": {},
|
|
240
|
+
"type": "object",
|
|
241
|
+
"typename": "dxn:type:example.com/type/Person:0.1.0",
|
|
242
|
+
},
|
|
243
|
+
],
|
|
244
|
+
"type": "or",
|
|
245
|
+
},
|
|
246
|
+
"type": "select",
|
|
247
|
+
}
|
|
248
|
+
`);
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
test('select everything but orgs and people', () => {
|
|
252
|
+
const everythingButOrgsAndPeople = Query.select(
|
|
253
|
+
Filter.not(Filter.or(Filter.type(TestSchema.Organization), Filter.type(TestSchema.Person))),
|
|
254
|
+
);
|
|
255
|
+
|
|
256
|
+
Schema.validateSync(QueryAST.Query)(everythingButOrgsAndPeople.ast);
|
|
257
|
+
expect(everythingButOrgsAndPeople.ast).toMatchInlineSnapshot(`
|
|
258
|
+
{
|
|
259
|
+
"filter": {
|
|
260
|
+
"filter": {
|
|
261
|
+
"filters": [
|
|
262
|
+
{
|
|
263
|
+
"id": undefined,
|
|
264
|
+
"props": {},
|
|
265
|
+
"type": "object",
|
|
266
|
+
"typename": "dxn:type:example.com/type/Organization:0.1.0",
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
"id": undefined,
|
|
270
|
+
"props": {},
|
|
271
|
+
"type": "object",
|
|
272
|
+
"typename": "dxn:type:example.com/type/Person:0.1.0",
|
|
273
|
+
},
|
|
274
|
+
],
|
|
275
|
+
"type": "or",
|
|
276
|
+
},
|
|
277
|
+
"type": "not",
|
|
278
|
+
},
|
|
279
|
+
"type": "select",
|
|
280
|
+
}
|
|
281
|
+
`);
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
test('select deleted tasks', () => {
|
|
285
|
+
const deletedTasks = Query.select(Filter.type(TestSchema.Task)).options({
|
|
286
|
+
deleted: 'only',
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
Schema.validateSync(QueryAST.Query)(deletedTasks.ast);
|
|
290
|
+
expect(deletedTasks.ast).toMatchInlineSnapshot(`
|
|
291
|
+
{
|
|
292
|
+
"options": {
|
|
293
|
+
"deleted": "only",
|
|
294
|
+
},
|
|
295
|
+
"query": {
|
|
296
|
+
"filter": {
|
|
297
|
+
"id": undefined,
|
|
298
|
+
"props": {},
|
|
299
|
+
"type": "object",
|
|
300
|
+
"typename": "dxn:type:example.com/type/Task:0.1.0",
|
|
301
|
+
},
|
|
302
|
+
"type": "select",
|
|
303
|
+
},
|
|
304
|
+
"type": "options",
|
|
305
|
+
}
|
|
306
|
+
`);
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
test('filter by tags', () => {
|
|
310
|
+
const query = Query.select(Filter.type(TestSchema.Task)).select(Filter.tag('important'));
|
|
311
|
+
Schema.validateSync(QueryAST.Query)(query.ast);
|
|
312
|
+
expect(query.ast).toMatchInlineSnapshot(`
|
|
313
|
+
{
|
|
314
|
+
"filter": {
|
|
315
|
+
"tag": "important",
|
|
316
|
+
"type": "tag",
|
|
317
|
+
},
|
|
318
|
+
"selection": {
|
|
319
|
+
"filter": {
|
|
320
|
+
"id": undefined,
|
|
321
|
+
"props": {},
|
|
322
|
+
"type": "object",
|
|
323
|
+
"typename": "dxn:type:example.com/type/Task:0.1.0",
|
|
324
|
+
},
|
|
325
|
+
"type": "select",
|
|
326
|
+
},
|
|
327
|
+
"type": "filter",
|
|
328
|
+
}
|
|
329
|
+
`);
|
|
330
|
+
});
|
|
331
|
+
|
|
332
|
+
test('limit results', () => {
|
|
333
|
+
const query = Query.select(Filter.type(TestSchema.Task)).limit(10);
|
|
334
|
+
Schema.validateSync(QueryAST.Query)(query.ast);
|
|
335
|
+
expect(query.ast).toMatchInlineSnapshot(`
|
|
336
|
+
{
|
|
337
|
+
"limit": 10,
|
|
338
|
+
"query": {
|
|
339
|
+
"filter": {
|
|
340
|
+
"id": undefined,
|
|
341
|
+
"props": {},
|
|
342
|
+
"type": "object",
|
|
343
|
+
"typename": "dxn:type:example.com/type/Task:0.1.0",
|
|
344
|
+
},
|
|
345
|
+
"type": "select",
|
|
346
|
+
},
|
|
347
|
+
"type": "limit",
|
|
348
|
+
}
|
|
349
|
+
`);
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
test('ordered and limited results', () => {
|
|
353
|
+
const query = Query.select(Filter.type(TestSchema.Task)).orderBy(Order.property('title', 'asc')).limit(10);
|
|
354
|
+
Schema.validateSync(QueryAST.Query)(query.ast);
|
|
355
|
+
expect(query.ast).toMatchInlineSnapshot(`
|
|
356
|
+
{
|
|
357
|
+
"limit": 10,
|
|
358
|
+
"query": {
|
|
359
|
+
"order": [
|
|
360
|
+
{
|
|
361
|
+
"direction": "asc",
|
|
362
|
+
"kind": "property",
|
|
363
|
+
"property": "title",
|
|
364
|
+
},
|
|
365
|
+
],
|
|
366
|
+
"query": {
|
|
367
|
+
"filter": {
|
|
368
|
+
"id": undefined,
|
|
369
|
+
"props": {},
|
|
370
|
+
"type": "object",
|
|
371
|
+
"typename": "dxn:type:example.com/type/Task:0.1.0",
|
|
372
|
+
},
|
|
373
|
+
"type": "select",
|
|
374
|
+
},
|
|
375
|
+
"type": "order",
|
|
376
|
+
},
|
|
377
|
+
"type": "limit",
|
|
378
|
+
}
|
|
379
|
+
`);
|
|
380
|
+
});
|
|
381
|
+
|
|
382
|
+
test('union of limited queries', () => {
|
|
383
|
+
const query = Query.all(
|
|
384
|
+
Query.select(Filter.type(TestSchema.Person)).limit(5),
|
|
385
|
+
Query.select(Filter.type(TestSchema.Organization)).limit(5),
|
|
386
|
+
);
|
|
387
|
+
Schema.validateSync(QueryAST.Query)(query.ast);
|
|
388
|
+
expect(query.ast).toMatchInlineSnapshot(`
|
|
389
|
+
{
|
|
390
|
+
"queries": [
|
|
391
|
+
{
|
|
392
|
+
"limit": 5,
|
|
393
|
+
"query": {
|
|
394
|
+
"filter": {
|
|
395
|
+
"id": undefined,
|
|
396
|
+
"props": {},
|
|
397
|
+
"type": "object",
|
|
398
|
+
"typename": "dxn:type:example.com/type/Person:0.1.0",
|
|
399
|
+
},
|
|
400
|
+
"type": "select",
|
|
401
|
+
},
|
|
402
|
+
"type": "limit",
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
"limit": 5,
|
|
406
|
+
"query": {
|
|
407
|
+
"filter": {
|
|
408
|
+
"id": undefined,
|
|
409
|
+
"props": {},
|
|
410
|
+
"type": "object",
|
|
411
|
+
"typename": "dxn:type:example.com/type/Organization:0.1.0",
|
|
412
|
+
},
|
|
413
|
+
"type": "select",
|
|
414
|
+
},
|
|
415
|
+
"type": "limit",
|
|
416
|
+
},
|
|
417
|
+
],
|
|
418
|
+
"type": "union",
|
|
419
|
+
}
|
|
420
|
+
`);
|
|
421
|
+
});
|
|
422
|
+
|
|
423
|
+
test.skip('chain', () => {
|
|
424
|
+
// NOTE: Can't support props without type since they can't be inferred.
|
|
425
|
+
// const f1: Filter<Person> = Filter.props({ name: 'Fred' });
|
|
426
|
+
|
|
427
|
+
// const x = Query.select(Filter.props({ id: '123' }));
|
|
428
|
+
const y = Query.select(Filter.type(TestSchema.Person));
|
|
429
|
+
|
|
430
|
+
const or = Filter.or(
|
|
431
|
+
Filter.type(TestSchema.Person, { id: Filter.in('1', '2', '3') }),
|
|
432
|
+
Filter.type(TestSchema.Organization),
|
|
433
|
+
);
|
|
434
|
+
|
|
435
|
+
const and = Filter.and(
|
|
436
|
+
Filter.type(TestSchema.Person, { id: Filter.in('1', '2', '3') }),
|
|
437
|
+
Filter.type(TestSchema.Person, { name: 'Fred' }),
|
|
438
|
+
);
|
|
439
|
+
|
|
440
|
+
const q = Query
|
|
441
|
+
//
|
|
442
|
+
// NOTE: Can't support functions since they can't be serialized (to server).
|
|
443
|
+
// .filter((object) => Math.random() > 0.5)
|
|
444
|
+
.select(Filter.type(TestSchema.Person))
|
|
445
|
+
.select(Filter.type(TestSchema.Person, { name: 'Fred' }))
|
|
446
|
+
.select({ age: Filter.between(20, 40) })
|
|
447
|
+
.select(
|
|
448
|
+
Filter.and(
|
|
449
|
+
Filter.type(TestSchema.Person),
|
|
450
|
+
Filter.type(TestSchema.Person, { name: Filter.in('bob', 'bill') }),
|
|
451
|
+
),
|
|
452
|
+
);
|
|
453
|
+
|
|
454
|
+
log('stuff', { fOr: or, fAnd: and, q, y });
|
|
455
|
+
});
|
|
456
|
+
});
|
|
457
|
+
|
|
458
|
+
describe('Filter', () => {
|
|
459
|
+
test('Filter.or(Filter.typename(...))', () => {
|
|
460
|
+
const filter = Filter.or(Filter.typename('example.com/type/Person'));
|
|
461
|
+
// TODO(dmaretskyi): Give vitest type-tests a try.
|
|
462
|
+
const _isAssignable: Obj.Unknown = null as any as Filter.Type<typeof filter>;
|
|
463
|
+
});
|
|
464
|
+
});
|
|
465
|
+
});
|