@dxos/echo 0.8.4-main.72ec0f3 → 0.8.4-main.74a063c4e0
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 +3 -4
- package/dist/lib/neutral/Annotation.mjs +37 -0
- package/dist/lib/neutral/Database.mjs +47 -0
- package/dist/lib/neutral/Entity.mjs +59 -0
- package/dist/lib/neutral/Err.mjs +12 -0
- package/dist/lib/neutral/Extension.mjs +18 -0
- package/dist/lib/neutral/Feed.mjs +48 -0
- package/dist/lib/neutral/Filter.mjs +70 -0
- package/dist/lib/neutral/Filter.mjs.map +7 -0
- package/dist/lib/neutral/Format.mjs +66 -0
- package/dist/lib/neutral/Format.mjs.map +7 -0
- package/dist/lib/neutral/JsonSchema.mjs +19 -0
- package/dist/lib/neutral/JsonSchema.mjs.map +7 -0
- package/dist/lib/neutral/Key.mjs +12 -0
- package/dist/lib/neutral/Key.mjs.map +7 -0
- package/dist/lib/neutral/Obj.mjs +113 -0
- package/dist/lib/neutral/Obj.mjs.map +7 -0
- package/dist/lib/neutral/Order.mjs +12 -0
- package/dist/lib/neutral/Order.mjs.map +7 -0
- package/dist/lib/neutral/Query.mjs +38 -0
- package/dist/lib/neutral/Query.mjs.map +7 -0
- package/dist/lib/neutral/QueryResult.mjs +2 -0
- package/dist/lib/neutral/QueryResult.mjs.map +7 -0
- package/dist/lib/neutral/Ref.mjs +24 -0
- package/dist/lib/neutral/Ref.mjs.map +7 -0
- package/dist/lib/neutral/Relation.mjs +94 -0
- package/dist/lib/neutral/Relation.mjs.map +7 -0
- package/dist/lib/neutral/SchemaRegistry.mjs +2 -0
- package/dist/lib/neutral/SchemaRegistry.mjs.map +7 -0
- package/dist/lib/neutral/Tag.mjs +29 -0
- package/dist/lib/neutral/Tag.mjs.map +7 -0
- package/dist/lib/neutral/Type.mjs +37 -0
- package/dist/lib/neutral/Type.mjs.map +7 -0
- package/dist/lib/neutral/chunk-2U2BZDLU.mjs +121 -0
- package/dist/lib/neutral/chunk-2U2BZDLU.mjs.map +7 -0
- package/dist/lib/neutral/chunk-46QNGNTY.mjs +45 -0
- package/dist/lib/neutral/chunk-46QNGNTY.mjs.map +7 -0
- package/dist/lib/neutral/chunk-66GBFH43.mjs +298 -0
- package/dist/lib/neutral/chunk-66GBFH43.mjs.map +7 -0
- package/dist/lib/neutral/chunk-6URFBQJH.mjs +361 -0
- package/dist/lib/neutral/chunk-6URFBQJH.mjs.map +7 -0
- package/dist/lib/neutral/chunk-7QQMUDE6.mjs +159 -0
- package/dist/lib/neutral/chunk-7QQMUDE6.mjs.map +7 -0
- package/dist/lib/neutral/chunk-ANHVGJI4.mjs +21 -0
- package/dist/lib/neutral/chunk-ANHVGJI4.mjs.map +7 -0
- package/dist/lib/neutral/chunk-BNCCGLJN.mjs +7 -0
- package/dist/lib/neutral/chunk-BNCCGLJN.mjs.map +7 -0
- package/dist/lib/neutral/chunk-DQYLD2RB.mjs +402 -0
- package/dist/lib/neutral/chunk-DQYLD2RB.mjs.map +7 -0
- package/dist/lib/neutral/chunk-E5PBQJWV.mjs +27 -0
- package/dist/lib/neutral/chunk-E5PBQJWV.mjs.map +7 -0
- package/dist/lib/neutral/chunk-EBVB5NOH.mjs +133 -0
- package/dist/lib/neutral/chunk-EBVB5NOH.mjs.map +7 -0
- package/dist/lib/neutral/chunk-FNEFSO2C.mjs +787 -0
- package/dist/lib/neutral/chunk-FNEFSO2C.mjs.map +7 -0
- package/dist/lib/neutral/chunk-GZQTCRJB.mjs +73 -0
- package/dist/lib/neutral/chunk-GZQTCRJB.mjs.map +7 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/neutral/chunk-KPY6FC5I.mjs +415 -0
- package/dist/lib/neutral/chunk-KPY6FC5I.mjs.map +7 -0
- package/dist/lib/neutral/chunk-MYMU4TWK.mjs +299 -0
- package/dist/lib/neutral/chunk-MYMU4TWK.mjs.map +7 -0
- package/dist/lib/neutral/chunk-MZXWVR3T.mjs +97 -0
- package/dist/lib/neutral/chunk-MZXWVR3T.mjs.map +7 -0
- package/dist/lib/neutral/chunk-OMUPQMLR.mjs +7 -0
- package/dist/lib/neutral/chunk-OMUPQMLR.mjs.map +7 -0
- package/dist/lib/neutral/chunk-QWAOTFCY.mjs +396 -0
- package/dist/lib/neutral/chunk-QWAOTFCY.mjs.map +7 -0
- package/dist/lib/neutral/chunk-R72KFH2X.mjs +34 -0
- package/dist/lib/neutral/chunk-R72KFH2X.mjs.map +7 -0
- package/dist/lib/neutral/chunk-TBKX6JQO.mjs +67 -0
- package/dist/lib/neutral/chunk-TBKX6JQO.mjs.map +7 -0
- package/dist/lib/neutral/chunk-UBEZSGXY.mjs +51 -0
- package/dist/lib/neutral/chunk-UBEZSGXY.mjs.map +7 -0
- package/dist/lib/neutral/chunk-UI6MWK5W.mjs +42 -0
- package/dist/lib/neutral/chunk-UI6MWK5W.mjs.map +7 -0
- package/dist/lib/neutral/chunk-VCAP4OOT.mjs +120 -0
- package/dist/lib/neutral/chunk-VCAP4OOT.mjs.map +7 -0
- package/dist/lib/neutral/chunk-WMFVS4KR.mjs +2830 -0
- package/dist/lib/neutral/chunk-WMFVS4KR.mjs.map +7 -0
- package/dist/lib/neutral/chunk-XZJUNTML.mjs +335 -0
- package/dist/lib/neutral/chunk-XZJUNTML.mjs.map +7 -0
- package/dist/lib/neutral/chunk-XZM7FERR.mjs +56 -0
- package/dist/lib/neutral/chunk-XZM7FERR.mjs.map +7 -0
- package/dist/lib/neutral/chunk-YS6Q3XAD.mjs +50 -0
- package/dist/lib/neutral/chunk-YS6Q3XAD.mjs.map +7 -0
- package/dist/lib/neutral/chunk-ZIXGDU6F.mjs +45 -0
- package/dist/lib/neutral/chunk-ZIXGDU6F.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +101 -0
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/{node-esm → neutral}/internal/index.mjs +290 -152
- package/dist/lib/neutral/internal/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/testing/index.mjs +374 -0
- package/dist/lib/neutral/testing/index.mjs.map +7 -0
- package/dist/types/src/Annotation.d.ts +24 -0
- package/dist/types/src/Annotation.d.ts.map +1 -0
- package/dist/types/src/Collection.d.ts +16 -0
- package/dist/types/src/Collection.d.ts.map +1 -0
- package/dist/types/src/Database.d.ts +196 -0
- package/dist/types/src/Database.d.ts.map +1 -0
- package/dist/types/src/Dataset.d.ts +19 -0
- package/dist/types/src/Dataset.d.ts.map +1 -0
- package/dist/types/src/Entity.d.ts +168 -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 +107 -0
- package/dist/types/src/Err.d.ts.map +1 -0
- package/dist/types/src/Extension.d.ts +80 -0
- package/dist/types/src/Extension.d.ts.map +1 -0
- package/dist/types/src/Extension.test.d.ts +2 -0
- package/dist/types/src/Extension.test.d.ts.map +1 -0
- package/dist/types/src/Feed.d.ts +171 -0
- package/dist/types/src/Feed.d.ts.map +1 -0
- package/dist/types/src/Filter.d.ts +136 -0
- package/dist/types/src/Filter.d.ts.map +1 -0
- package/dist/types/src/Filter.test.d.ts +2 -0
- package/dist/types/src/Filter.test.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 +65 -0
- package/dist/types/src/Hypergraph.d.ts.map +1 -0
- package/dist/types/src/JsonSchema.d.ts +16 -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 +432 -104
- 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 +209 -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 +61 -11
- package/dist/types/src/Ref.d.ts.map +1 -1
- package/dist/types/src/Relation.d.ts +287 -21
- 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 +8 -7
- package/dist/types/src/Tag.d.ts.map +1 -1
- package/dist/types/src/Type.d.ts +123 -99
- 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/View.d.ts +68 -0
- package/dist/types/src/View.d.ts.map +1 -0
- package/dist/types/src/hierarchy.test.d.ts +2 -0
- package/dist/types/src/hierarchy.test.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +19 -5
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/internal/Annotation/annotations.d.ts +231 -0
- package/dist/types/src/internal/Annotation/annotations.d.ts.map +1 -0
- package/dist/types/src/internal/Annotation/annotations.test.d.ts.map +1 -0
- package/dist/types/src/internal/Annotation/index.d.ts +4 -0
- package/dist/types/src/internal/Annotation/index.d.ts.map +1 -0
- package/dist/types/src/internal/Annotation/sorting.d.ts +24 -0
- package/dist/types/src/internal/Annotation/sorting.d.ts.map +1 -0
- package/dist/types/src/internal/Annotation/util.d.ts +39 -0
- package/dist/types/src/internal/Annotation/util.d.ts.map +1 -0
- package/dist/types/src/internal/Entity/api.d.ts +13 -0
- package/dist/types/src/internal/Entity/api.d.ts.map +1 -0
- package/dist/types/src/internal/Entity/entity.d.ts +20 -0
- package/dist/types/src/internal/Entity/entity.d.ts.map +1 -0
- package/dist/types/src/internal/Entity/index.d.ts +8 -0
- package/dist/types/src/internal/Entity/index.d.ts.map +1 -0
- package/dist/types/src/internal/Entity/model.d.ts +55 -0
- package/dist/types/src/internal/Entity/model.d.ts.map +1 -0
- package/dist/types/src/internal/Entity/object.d.ts +18 -0
- package/dist/types/src/internal/Entity/object.d.ts.map +1 -0
- package/dist/types/src/internal/Entity/relation.d.ts +35 -0
- package/dist/types/src/internal/Entity/relation.d.ts.map +1 -0
- package/dist/types/src/internal/Entity/util.d.ts +2 -0
- package/dist/types/src/internal/Entity/util.d.ts.map +1 -0
- package/dist/types/src/internal/Entity/version.d.ts +42 -0
- package/dist/types/src/internal/Entity/version.d.ts.map +1 -0
- package/dist/types/src/internal/Format/date.d.ts.map +1 -0
- package/dist/types/src/internal/Format/date.test.d.ts.map +1 -0
- package/dist/types/src/internal/{formats → Format}/format.d.ts +4 -2
- package/dist/types/src/internal/Format/format.d.ts.map +1 -0
- package/dist/types/src/internal/Format/format.test.d.ts.map +1 -0
- package/dist/types/src/internal/Format/index.d.ts.map +1 -0
- package/dist/types/src/internal/Format/number.d.ts.map +1 -0
- package/dist/types/src/internal/Format/object.d.ts.map +1 -0
- package/dist/types/src/internal/{formats → Format}/select.d.ts +6 -4
- package/dist/types/src/internal/Format/select.d.ts.map +1 -0
- package/dist/types/src/internal/{formats → Format}/string.d.ts +4 -0
- package/dist/types/src/internal/Format/string.d.ts.map +1 -0
- package/dist/types/src/internal/{formats → Format}/types.d.ts +14 -10
- package/dist/types/src/internal/Format/types.d.ts.map +1 -0
- package/dist/types/src/internal/{json → JsonSchema}/annotations.d.ts +1 -1
- package/dist/types/src/internal/JsonSchema/annotations.d.ts.map +1 -0
- package/dist/types/src/internal/JsonSchema/effect-schema.test.d.ts.map +1 -0
- package/dist/types/src/internal/JsonSchema/index.d.ts +5 -0
- package/dist/types/src/internal/JsonSchema/index.d.ts.map +1 -0
- package/dist/types/src/internal/JsonSchema/json-schema-normalize.d.ts.map +1 -0
- package/dist/types/src/internal/{json-schema → JsonSchema}/json-schema-type.d.ts +131 -30
- package/dist/types/src/internal/JsonSchema/json-schema-type.d.ts.map +1 -0
- package/dist/types/src/internal/{json → JsonSchema}/json-schema.d.ts +4 -2
- package/dist/types/src/internal/JsonSchema/json-schema.d.ts.map +1 -0
- package/dist/types/src/internal/JsonSchema/json-schema.test.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/clone.d.ts +8 -0
- package/dist/types/src/internal/Obj/clone.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/common.d.ts.map +1 -0
- package/dist/types/src/internal/{object/create.d.ts → Obj/create-object.d.ts} +10 -11
- package/dist/types/src/internal/Obj/create-object.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/create-object.test.d.ts +2 -0
- package/dist/types/src/internal/Obj/create-object.test.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/deleted.d.ts +6 -0
- package/dist/types/src/internal/Obj/deleted.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/ids.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/index.d.ts +11 -0
- package/dist/types/src/internal/Obj/index.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/inspect.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/json-serializer.d.ts +44 -0
- package/dist/types/src/internal/Obj/json-serializer.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/json-serializer.test.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/schema-validator.d.ts +2 -0
- package/dist/types/src/internal/Obj/schema-validator.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/schema-validator.test.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/set-value.d.ts +7 -0
- package/dist/types/src/internal/Obj/set-value.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/set-value.test.d.ts +2 -0
- package/dist/types/src/internal/Obj/set-value.test.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/snapshot.d.ts +6 -0
- package/dist/types/src/internal/Obj/snapshot.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/typed-object.d.ts +25 -0
- package/dist/types/src/internal/Obj/typed-object.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/typed-object.test.d.ts.map +1 -0
- package/dist/types/src/internal/Query.d.ts +10 -0
- package/dist/types/src/internal/Query.d.ts.map +1 -0
- package/dist/types/src/internal/Ref/index.d.ts.map +1 -0
- package/dist/types/src/internal/{ref → Ref}/ref-array.d.ts +4 -4
- package/dist/types/src/internal/Ref/ref-array.d.ts.map +1 -0
- package/dist/types/src/internal/{ref → Ref}/ref.d.ts +44 -19
- package/dist/types/src/internal/Ref/ref.d.ts.map +1 -0
- package/dist/types/src/internal/Ref/ref.test.d.ts.map +1 -0
- package/dist/types/src/internal/Type/compose.d.ts +7 -0
- package/dist/types/src/internal/Type/compose.d.ts.map +1 -0
- package/dist/types/src/internal/Type/compose.test.d.ts.map +1 -0
- package/dist/types/src/internal/{schema → Type}/echo-schema.d.ts +27 -14
- package/dist/types/src/internal/Type/echo-schema.d.ts.map +1 -0
- package/dist/types/src/internal/Type/index.d.ts +4 -0
- package/dist/types/src/internal/Type/index.d.ts.map +1 -0
- package/dist/types/src/internal/Type/manipulation.d.ts.map +1 -0
- package/dist/types/src/internal/Type/persistent-schema.d.ts +20 -0
- package/dist/types/src/internal/Type/persistent-schema.d.ts.map +1 -0
- package/dist/types/src/internal/common/api/index.d.ts +11 -0
- package/dist/types/src/internal/common/api/index.d.ts.map +1 -0
- package/dist/types/src/internal/common/api/meta.d.ts +42 -0
- package/dist/types/src/internal/common/api/meta.d.ts.map +1 -0
- package/dist/types/src/internal/common/index.d.ts +4 -0
- package/dist/types/src/internal/common/index.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/change-context.d.ts +55 -0
- package/dist/types/src/internal/common/proxy/change-context.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/change.test.d.ts +2 -0
- package/dist/types/src/internal/common/proxy/change.test.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/define-hidden-property.d.ts +5 -0
- package/dist/types/src/internal/common/proxy/define-hidden-property.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/errors.d.ts +19 -0
- package/dist/types/src/internal/common/proxy/errors.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/event-batch.d.ts +10 -0
- package/dist/types/src/internal/common/proxy/event-batch.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/handler.test.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/index.d.ts +14 -0
- package/dist/types/src/internal/common/proxy/index.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/json-serializer.d.ts +6 -0
- package/dist/types/src/internal/common/proxy/json-serializer.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/make-object.d.ts +14 -0
- package/dist/types/src/internal/common/proxy/make-object.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/ownership.d.ts +57 -0
- package/dist/types/src/internal/common/proxy/ownership.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/proxy-types.d.ts +18 -0
- package/dist/types/src/internal/common/proxy/proxy-types.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/proxy-utils.d.ts +47 -0
- package/dist/types/src/internal/common/proxy/proxy-utils.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/reactive-array.d.ts +8 -0
- package/dist/types/src/internal/common/proxy/reactive-array.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/reactive.d.ts +39 -0
- package/dist/types/src/internal/common/proxy/reactive.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/schema-validator.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/schema.test.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/symbols.d.ts +3 -0
- package/dist/types/src/internal/common/proxy/symbols.d.ts.map +1 -0
- package/dist/types/src/internal/{proxy → common/proxy}/typed-handler.d.ts +16 -12
- package/dist/types/src/internal/common/proxy/typed-handler.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/typed-handler.test.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/typed-object.test.d.ts.map +1 -0
- package/dist/types/src/internal/common/types/base.d.ts +27 -0
- package/dist/types/src/internal/common/types/base.d.ts.map +1 -0
- package/dist/types/src/internal/common/types/entity.d.ts +37 -0
- package/dist/types/src/internal/common/types/entity.d.ts.map +1 -0
- package/dist/types/src/internal/common/types/index.d.ts +7 -0
- package/dist/types/src/internal/common/types/index.d.ts.map +1 -0
- package/dist/types/src/internal/{object → common/types}/meta.d.ts +18 -16
- package/dist/types/src/internal/common/types/meta.d.ts.map +1 -0
- package/dist/types/src/internal/common/types/model-symbols.d.ts +54 -0
- package/dist/types/src/internal/common/types/model-symbols.d.ts.map +1 -0
- package/dist/types/src/internal/common/types/typename.d.ts +21 -0
- package/dist/types/src/internal/common/types/typename.d.ts.map +1 -0
- package/dist/types/src/internal/common/types/version.d.ts +15 -0
- package/dist/types/src/internal/common/types/version.d.ts.map +1 -0
- package/dist/types/src/internal/index.d.ts +10 -14
- package/dist/types/src/internal/index.d.ts.map +1 -1
- package/dist/types/src/{test → testing}/api.test.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +3 -3
- 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 +304 -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 +111 -65
- package/src/Annotation.ts +48 -0
- package/src/Collection.ts +37 -0
- package/src/Database.ts +330 -0
- package/src/Dataset.ts +26 -0
- package/src/Entity.test.ts +22 -0
- package/src/Entity.ts +236 -0
- package/src/Err.ts +40 -0
- package/src/Extension.test.ts +235 -0
- package/src/Extension.ts +122 -0
- package/src/Feed.ts +283 -0
- package/src/Filter.test.ts +90 -0
- package/src/Filter.ts +424 -0
- package/src/Format.ts +9 -0
- package/src/Hypergraph.ts +79 -0
- package/src/JsonSchema.ts +26 -0
- package/src/Key.ts +3 -0
- package/src/Obj.test.ts +539 -0
- package/src/Obj.ts +695 -278
- package/src/Order.ts +46 -0
- package/src/Query.test.ts +698 -0
- package/src/Query.ts +547 -0
- package/src/QueryResult.ts +106 -0
- package/src/Ref.ts +79 -9
- package/src/Relation.test.ts +88 -0
- package/src/Relation.ts +443 -58
- package/src/SchemaRegistry.ts +106 -0
- package/src/Tag.ts +7 -5
- package/src/Type.test.ts +52 -0
- package/src/Type.ts +167 -153
- package/src/View.ts +107 -0
- package/src/hierarchy.test.ts +33 -0
- package/src/index.ts +20 -6
- package/src/internal/Annotation/annotations.test.ts +145 -0
- package/src/internal/Annotation/annotations.ts +578 -0
- package/src/internal/Annotation/index.ts +7 -0
- package/src/internal/Annotation/sorting.ts +51 -0
- package/src/internal/Annotation/util.ts +85 -0
- package/src/internal/Entity/api.ts +30 -0
- package/src/internal/Entity/entity.ts +128 -0
- package/src/internal/Entity/index.ts +11 -0
- package/src/internal/Entity/model.ts +109 -0
- package/src/internal/Entity/object.ts +57 -0
- package/src/internal/Entity/relation.ts +154 -0
- package/src/internal/Entity/util.ts +33 -0
- package/src/internal/Entity/version.ts +96 -0
- package/src/internal/{formats → Format}/date.test.ts +1 -2
- package/src/internal/{formats → Format}/date.ts +5 -5
- package/src/internal/{formats → Format}/format.test.ts +6 -7
- package/src/internal/{formats → Format}/format.ts +8 -6
- package/src/internal/{formats → Format}/number.ts +5 -5
- package/src/internal/{formats → Format}/object.ts +4 -4
- package/src/internal/{formats → Format}/select.ts +6 -4
- package/src/internal/{formats → Format}/string.ts +14 -9
- package/src/internal/{formats → Format}/types.ts +54 -43
- package/src/internal/{json → JsonSchema}/annotations.ts +3 -3
- package/src/internal/{json-schema → JsonSchema}/index.ts +2 -0
- package/src/internal/{json-schema → JsonSchema}/json-schema-normalize.ts +4 -2
- package/src/internal/{json-schema → JsonSchema}/json-schema-type.ts +36 -36
- package/src/internal/{json → JsonSchema}/json-schema.test.ts +106 -95
- package/src/internal/{json → JsonSchema}/json-schema.ts +29 -15
- package/src/internal/Obj/clone.ts +48 -0
- package/src/internal/{object → Obj}/common.ts +3 -4
- package/src/internal/{object/create.test.ts → Obj/create-object.test.ts} +32 -36
- package/src/internal/{object/create.ts → Obj/create-object.ts} +35 -37
- package/src/internal/Obj/deleted.ts +19 -0
- package/src/internal/{object → Obj}/ids.ts +1 -1
- package/src/internal/Obj/index.ts +14 -0
- package/src/internal/{object → Obj}/inspect.ts +5 -7
- package/src/internal/Obj/json-serializer.test.ts +120 -0
- package/src/internal/{object → Obj}/json-serializer.ts +99 -109
- package/src/internal/{object → Obj}/schema-validator.test.ts +3 -7
- package/src/internal/Obj/schema-validator.ts +6 -0
- package/src/internal/Obj/set-value.test.ts +281 -0
- package/src/internal/Obj/set-value.ts +165 -0
- package/src/internal/Obj/snapshot.ts +105 -0
- package/src/internal/{object → Obj}/typed-object.test.ts +12 -12
- package/src/internal/Obj/typed-object.ts +30 -0
- package/src/internal/Query.ts +132 -0
- package/src/internal/{ref → Ref}/ref-array.ts +4 -5
- package/src/internal/{ref → Ref}/ref.test.ts +11 -11
- package/src/internal/{ref → Ref}/ref.ts +108 -57
- package/src/internal/{projection → Type}/compose.test.ts +8 -10
- package/src/internal/{projection → Type}/compose.ts +14 -9
- package/src/internal/{schema → Type}/echo-schema.ts +74 -34
- package/src/internal/Type/index.ts +7 -0
- package/src/internal/{schema → Type}/manipulation.ts +1 -1
- package/src/internal/Type/persistent-schema.ts +33 -0
- package/src/internal/common/README.md +102 -0
- package/src/internal/common/api/index.ts +15 -0
- package/src/internal/common/api/meta.ts +88 -0
- package/src/internal/{testing → common}/index.ts +2 -1
- package/src/internal/common/proxy/change-context.ts +138 -0
- package/src/internal/common/proxy/change.test.ts +519 -0
- package/src/internal/common/proxy/define-hidden-property.ts +14 -0
- package/src/internal/common/proxy/errors.ts +42 -0
- package/src/internal/common/proxy/event-batch.ts +44 -0
- package/src/internal/common/proxy/handler.test.ts +121 -0
- package/src/internal/common/proxy/index.ts +17 -0
- package/src/internal/common/proxy/json-serializer.ts +90 -0
- package/src/internal/common/proxy/make-object.ts +105 -0
- package/src/internal/common/proxy/ownership.ts +252 -0
- package/src/internal/common/proxy/proxy-types.ts +23 -0
- package/src/internal/common/proxy/proxy-utils.ts +150 -0
- package/src/internal/common/proxy/reactive-array.ts +71 -0
- package/src/internal/common/proxy/reactive.ts +68 -0
- package/src/internal/{object → common/proxy}/schema-validator.ts +6 -3
- package/src/internal/{proxy → common/proxy}/schema.test.ts +31 -22
- package/src/internal/common/proxy/symbols.ts +7 -0
- package/src/internal/common/proxy/typed-handler.test.ts +313 -0
- package/src/internal/common/proxy/typed-handler.ts +447 -0
- package/src/internal/common/proxy/typed-object.test.ts +115 -0
- package/src/internal/common/types/base.ts +43 -0
- package/src/internal/common/types/entity.ts +54 -0
- package/src/internal/common/types/index.ts +10 -0
- package/src/internal/common/types/meta.ts +67 -0
- package/src/internal/common/types/model-symbols.ts +69 -0
- package/src/internal/common/types/typename.ts +55 -0
- package/src/internal/common/types/version.ts +19 -0
- package/src/internal/index.ts +12 -17
- package/src/testing/api.test.ts +125 -0
- package/src/testing/index.ts +3 -3
- package/src/testing/test-data.ts +129 -0
- package/src/testing/test-schema.ts +240 -0
- package/src/testing/util.ts +85 -0
- package/dist/lib/browser/chunk-BIDAASFK.mjs +0 -3727
- package/dist/lib/browser/chunk-BIDAASFK.mjs.map +0 -7
- package/dist/lib/browser/chunk-ZDLCWGEW.mjs +0 -410
- package/dist/lib/browser/chunk-ZDLCWGEW.mjs.map +0 -7
- package/dist/lib/browser/chunk-ZFRJKT4A.mjs +0 -585
- package/dist/lib/browser/chunk-ZFRJKT4A.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -35
- package/dist/lib/browser/internal/index.mjs +0 -336
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/query/index.mjs +0 -13
- package/dist/lib/browser/testing/index.mjs +0 -267
- package/dist/lib/browser/testing/index.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3SVRRCUU.mjs +0 -3727
- package/dist/lib/node-esm/chunk-3SVRRCUU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CGDHRZWH.mjs +0 -585
- package/dist/lib/node-esm/chunk-CGDHRZWH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HWS6VBQC.mjs +0 -410
- package/dist/lib/node-esm/chunk-HWS6VBQC.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -35
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/query/index.mjs +0 -13
- package/dist/lib/node-esm/testing/index.mjs +0 -267
- package/dist/lib/node-esm/testing/index.mjs.map +0 -7
- package/dist/types/src/errors.d.ts +0 -68
- package/dist/types/src/errors.d.ts.map +0 -1
- package/dist/types/src/internal/ast/annotation-helper.d.ts +0 -8
- package/dist/types/src/internal/ast/annotation-helper.d.ts.map +0 -1
- package/dist/types/src/internal/ast/annotations.d.ts +0 -131
- package/dist/types/src/internal/ast/annotations.d.ts.map +0 -1
- package/dist/types/src/internal/ast/annotations.test.d.ts.map +0 -1
- package/dist/types/src/internal/ast/entity-kind.d.ts +0 -10
- package/dist/types/src/internal/ast/entity-kind.d.ts.map +0 -1
- package/dist/types/src/internal/ast/index.d.ts +0 -5
- package/dist/types/src/internal/ast/index.d.ts.map +0 -1
- package/dist/types/src/internal/ast/types.d.ts +0 -6
- package/dist/types/src/internal/ast/types.d.ts.map +0 -1
- package/dist/types/src/internal/formats/date.d.ts.map +0 -1
- package/dist/types/src/internal/formats/date.test.d.ts.map +0 -1
- package/dist/types/src/internal/formats/format.d.ts.map +0 -1
- package/dist/types/src/internal/formats/format.test.d.ts.map +0 -1
- package/dist/types/src/internal/formats/index.d.ts.map +0 -1
- package/dist/types/src/internal/formats/number.d.ts.map +0 -1
- package/dist/types/src/internal/formats/object.d.ts.map +0 -1
- package/dist/types/src/internal/formats/select.d.ts.map +0 -1
- package/dist/types/src/internal/formats/string.d.ts.map +0 -1
- package/dist/types/src/internal/formats/types.d.ts.map +0 -1
- package/dist/types/src/internal/json/annotations.d.ts.map +0 -1
- package/dist/types/src/internal/json/effect-schema.test.d.ts.map +0 -1
- package/dist/types/src/internal/json/index.d.ts +0 -2
- package/dist/types/src/internal/json/index.d.ts.map +0 -1
- package/dist/types/src/internal/json/json-schema.d.ts.map +0 -1
- package/dist/types/src/internal/json/json-schema.test.d.ts.map +0 -1
- package/dist/types/src/internal/json-schema/index.d.ts +0 -3
- package/dist/types/src/internal/json-schema/index.d.ts.map +0 -1
- package/dist/types/src/internal/json-schema/json-schema-normalize.d.ts.map +0 -1
- package/dist/types/src/internal/json-schema/json-schema-type.d.ts.map +0 -1
- package/dist/types/src/internal/object/accessors.d.ts +0 -37
- package/dist/types/src/internal/object/accessors.d.ts.map +0 -1
- package/dist/types/src/internal/object/common.d.ts.map +0 -1
- package/dist/types/src/internal/object/create.d.ts.map +0 -1
- package/dist/types/src/internal/object/create.test.d.ts +0 -2
- package/dist/types/src/internal/object/create.test.d.ts.map +0 -1
- package/dist/types/src/internal/object/deleted.d.ts +0 -6
- package/dist/types/src/internal/object/deleted.d.ts.map +0 -1
- package/dist/types/src/internal/object/entity.d.ts +0 -33
- package/dist/types/src/internal/object/entity.d.ts.map +0 -1
- package/dist/types/src/internal/object/expando.d.ts +0 -14
- package/dist/types/src/internal/object/expando.d.ts.map +0 -1
- package/dist/types/src/internal/object/ids.d.ts.map +0 -1
- package/dist/types/src/internal/object/index.d.ts +0 -16
- package/dist/types/src/internal/object/index.d.ts.map +0 -1
- package/dist/types/src/internal/object/inspect.d.ts.map +0 -1
- package/dist/types/src/internal/object/json-serializer.d.ts +0 -32
- package/dist/types/src/internal/object/json-serializer.d.ts.map +0 -1
- package/dist/types/src/internal/object/json-serializer.test.d.ts.map +0 -1
- package/dist/types/src/internal/object/meta.d.ts.map +0 -1
- package/dist/types/src/internal/object/model.d.ts +0 -117
- package/dist/types/src/internal/object/model.d.ts.map +0 -1
- package/dist/types/src/internal/object/relation.d.ts +0 -17
- package/dist/types/src/internal/object/relation.d.ts.map +0 -1
- package/dist/types/src/internal/object/schema-validator.d.ts.map +0 -1
- package/dist/types/src/internal/object/schema-validator.test.d.ts.map +0 -1
- package/dist/types/src/internal/object/typed-object.d.ts +0 -31
- package/dist/types/src/internal/object/typed-object.d.ts.map +0 -1
- package/dist/types/src/internal/object/typed-object.test.d.ts.map +0 -1
- package/dist/types/src/internal/object/typename.d.ts +0 -15
- package/dist/types/src/internal/object/typename.d.ts.map +0 -1
- package/dist/types/src/internal/object/version.d.ts +0 -14
- package/dist/types/src/internal/object/version.d.ts.map +0 -1
- package/dist/types/src/internal/projection/compose.d.ts +0 -6
- package/dist/types/src/internal/projection/compose.d.ts.map +0 -1
- package/dist/types/src/internal/projection/compose.test.d.ts.map +0 -1
- package/dist/types/src/internal/projection/index.d.ts +0 -2
- package/dist/types/src/internal/projection/index.d.ts.map +0 -1
- package/dist/types/src/internal/proxy/handler.test.d.ts.map +0 -1
- package/dist/types/src/internal/proxy/reactive-object.d.ts +0 -15
- package/dist/types/src/internal/proxy/reactive-object.d.ts.map +0 -1
- package/dist/types/src/internal/proxy/schema.test.d.ts.map +0 -1
- package/dist/types/src/internal/proxy/typed-handler.d.ts.map +0 -1
- package/dist/types/src/internal/proxy/typed-handler.test.d.ts.map +0 -1
- package/dist/types/src/internal/proxy/typed-object.test.d.ts.map +0 -1
- package/dist/types/src/internal/query/index.d.ts +0 -2
- package/dist/types/src/internal/query/index.d.ts.map +0 -1
- package/dist/types/src/internal/query/query.d.ts +0 -17
- package/dist/types/src/internal/query/query.d.ts.map +0 -1
- package/dist/types/src/internal/ref/index.d.ts.map +0 -1
- package/dist/types/src/internal/ref/ref-array.d.ts.map +0 -1
- package/dist/types/src/internal/ref/ref.d.ts.map +0 -1
- package/dist/types/src/internal/ref/ref.test.d.ts.map +0 -1
- package/dist/types/src/internal/schema/echo-schema.d.ts.map +0 -1
- package/dist/types/src/internal/schema/index.d.ts +0 -7
- package/dist/types/src/internal/schema/index.d.ts.map +0 -1
- package/dist/types/src/internal/schema/manipulation.d.ts.map +0 -1
- package/dist/types/src/internal/schema/runtime-schema-registry.d.ts +0 -18
- package/dist/types/src/internal/schema/runtime-schema-registry.d.ts.map +0 -1
- package/dist/types/src/internal/schema/snapshot.d.ts +0 -6
- package/dist/types/src/internal/schema/snapshot.d.ts.map +0 -1
- package/dist/types/src/internal/schema/stored-schema.d.ts +0 -13
- package/dist/types/src/internal/schema/stored-schema.d.ts.map +0 -1
- package/dist/types/src/internal/testing/index.d.ts +0 -3
- package/dist/types/src/internal/testing/index.d.ts.map +0 -1
- package/dist/types/src/internal/testing/types.d.ts +0 -381
- package/dist/types/src/internal/testing/types.d.ts.map +0 -1
- package/dist/types/src/internal/testing/utils.d.ts +0 -10
- package/dist/types/src/internal/testing/utils.d.ts.map +0 -1
- package/dist/types/src/internal/types/index.d.ts +0 -3
- package/dist/types/src/internal/types/index.d.ts.map +0 -1
- package/dist/types/src/internal/types/types.d.ts +0 -79
- package/dist/types/src/internal/types/types.d.ts.map +0 -1
- package/dist/types/src/internal/types/types.test.d.ts +0 -2
- package/dist/types/src/internal/types/types.test.d.ts.map +0 -1
- package/dist/types/src/internal/types/util.d.ts +0 -5
- package/dist/types/src/internal/types/util.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/query/query.d.ts +0 -248
- package/dist/types/src/query/query.d.ts.map +0 -1
- package/dist/types/src/query/query.test.d.ts +0 -2
- package/dist/types/src/query/query.test.d.ts.map +0 -1
- package/dist/types/src/testing/echo-schema.d.ts +0 -7
- package/dist/types/src/testing/echo-schema.d.ts.map +0 -1
- package/dist/types/src/testing/types.d.ts +0 -228
- package/dist/types/src/testing/types.d.ts.map +0 -1
- package/src/errors.ts +0 -18
- package/src/internal/ast/annotation-helper.ts +0 -22
- package/src/internal/ast/annotations.test.ts +0 -98
- package/src/internal/ast/annotations.ts +0 -226
- package/src/internal/ast/entity-kind.ts +0 -15
- package/src/internal/ast/index.ts +0 -8
- package/src/internal/ast/types.ts +0 -17
- package/src/internal/json/index.ts +0 -5
- package/src/internal/object/accessors.ts +0 -153
- package/src/internal/object/deleted.ts +0 -19
- package/src/internal/object/entity.ts +0 -248
- package/src/internal/object/expando.ts +0 -21
- package/src/internal/object/index.ts +0 -19
- package/src/internal/object/json-serializer.test.ts +0 -99
- package/src/internal/object/meta.ts +0 -61
- package/src/internal/object/model.ts +0 -170
- package/src/internal/object/relation.ts +0 -24
- package/src/internal/object/typed-object.ts +0 -88
- package/src/internal/object/typename.ts +0 -61
- package/src/internal/object/version.ts +0 -22
- package/src/internal/projection/index.ts +0 -5
- package/src/internal/proxy/handler.test.ts +0 -163
- package/src/internal/proxy/reactive-object.ts +0 -108
- package/src/internal/proxy/typed-handler.test.ts +0 -102
- package/src/internal/proxy/typed-handler.ts +0 -228
- package/src/internal/proxy/typed-object.test.ts +0 -100
- package/src/internal/query/index.ts +0 -5
- package/src/internal/query/query.ts +0 -23
- package/src/internal/schema/index.ts +0 -10
- package/src/internal/schema/runtime-schema-registry.ts +0 -78
- package/src/internal/schema/snapshot.ts +0 -25
- package/src/internal/schema/stored-schema.ts +0 -26
- package/src/internal/testing/types.ts +0 -144
- package/src/internal/testing/utils.ts +0 -54
- package/src/internal/types/index.ts +0 -6
- package/src/internal/types/types.test.ts +0 -48
- package/src/internal/types/types.ts +0 -176
- package/src/internal/types/util.ts +0 -9
- package/src/query/index.ts +0 -6
- package/src/query/query.test.ts +0 -401
- package/src/query/query.ts +0 -789
- package/src/test/api.test.ts +0 -180
- package/src/testing/echo-schema.ts +0 -39
- package/src/testing/types.ts +0 -108
- /package/dist/lib/{browser/index.mjs.map → neutral/Annotation.mjs.map} +0 -0
- /package/dist/lib/{browser/internal/index.mjs.map → neutral/Database.mjs.map} +0 -0
- /package/dist/lib/{browser/query/index.mjs.map → neutral/Entity.mjs.map} +0 -0
- /package/dist/lib/{node-esm/index.mjs.map → neutral/Err.mjs.map} +0 -0
- /package/dist/lib/{node-esm/internal/index.mjs.map → neutral/Extension.mjs.map} +0 -0
- /package/dist/lib/{node-esm/query/index.mjs.map → neutral/Feed.mjs.map} +0 -0
- /package/dist/types/src/internal/{ast → Annotation}/annotations.test.d.ts +0 -0
- /package/dist/types/src/internal/{formats → Format}/date.d.ts +0 -0
- /package/dist/types/src/internal/{formats → Format}/date.test.d.ts +0 -0
- /package/dist/types/src/internal/{formats → Format}/format.test.d.ts +0 -0
- /package/dist/types/src/internal/{formats → Format}/index.d.ts +0 -0
- /package/dist/types/src/internal/{formats → Format}/number.d.ts +0 -0
- /package/dist/types/src/internal/{formats → Format}/object.d.ts +0 -0
- /package/dist/types/src/internal/{json → JsonSchema}/effect-schema.test.d.ts +0 -0
- /package/dist/types/src/internal/{json-schema → JsonSchema}/json-schema-normalize.d.ts +0 -0
- /package/dist/types/src/internal/{json → JsonSchema}/json-schema.test.d.ts +0 -0
- /package/dist/types/src/internal/{object → Obj}/common.d.ts +0 -0
- /package/dist/types/src/internal/{object → Obj}/ids.d.ts +0 -0
- /package/dist/types/src/internal/{object → Obj}/inspect.d.ts +0 -0
- /package/dist/types/src/internal/{object → Obj}/json-serializer.test.d.ts +0 -0
- /package/dist/types/src/internal/{object → Obj}/schema-validator.test.d.ts +0 -0
- /package/dist/types/src/internal/{object → Obj}/typed-object.test.d.ts +0 -0
- /package/dist/types/src/internal/{ref → Ref}/index.d.ts +0 -0
- /package/dist/types/src/internal/{ref → Ref}/ref.test.d.ts +0 -0
- /package/dist/types/src/internal/{projection → Type}/compose.test.d.ts +0 -0
- /package/dist/types/src/internal/{schema → Type}/manipulation.d.ts +0 -0
- /package/dist/types/src/internal/{proxy → common/proxy}/handler.test.d.ts +0 -0
- /package/dist/types/src/internal/{object → common/proxy}/schema-validator.d.ts +0 -0
- /package/dist/types/src/internal/{proxy → common/proxy}/schema.test.d.ts +0 -0
- /package/dist/types/src/internal/{proxy → common/proxy}/typed-handler.test.d.ts +0 -0
- /package/dist/types/src/internal/{proxy → common/proxy}/typed-object.test.d.ts +0 -0
- /package/dist/types/src/{test → testing}/api.test.d.ts +0 -0
- /package/src/internal/{formats → Format}/index.ts +0 -0
- /package/src/internal/{json → JsonSchema}/effect-schema.test.ts +0 -0
- /package/src/internal/{ref → Ref}/index.ts +0 -0
package/src/Filter.ts
ADDED
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// @import-as-namespace
|
|
6
|
+
|
|
7
|
+
import * as Match from 'effect/Match';
|
|
8
|
+
import * as Schema from 'effect/Schema';
|
|
9
|
+
import * as SchemaAST from 'effect/SchemaAST';
|
|
10
|
+
import type * as Types from 'effect/Types';
|
|
11
|
+
|
|
12
|
+
import { type ForeignKey, type QueryAST } from '@dxos/echo-protocol';
|
|
13
|
+
import { assertArgument } from '@dxos/invariant';
|
|
14
|
+
import { DXN, ObjectId } from '@dxos/keys';
|
|
15
|
+
|
|
16
|
+
import * as internal from './internal';
|
|
17
|
+
import * as Ref from './Ref';
|
|
18
|
+
|
|
19
|
+
export interface Filter<T> {
|
|
20
|
+
// TODO(dmaretskyi): See new effect-schema approach to variance.
|
|
21
|
+
'~Filter': { value: Types.Covariant<T> };
|
|
22
|
+
|
|
23
|
+
ast: QueryAST.Filter;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type Props<T> = {
|
|
27
|
+
// Predicate or a value as a shorthand for `eq`.
|
|
28
|
+
[K in keyof T & string]?: Filter<T[K]> | T[K];
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type Any = Filter<any>;
|
|
32
|
+
|
|
33
|
+
export type Type<F extends Any> = F extends Filter<infer T> ? T : never;
|
|
34
|
+
|
|
35
|
+
class FilterClass implements Any {
|
|
36
|
+
private static 'variance': Any['~Filter'] = {} as Any['~Filter'];
|
|
37
|
+
|
|
38
|
+
constructor(public readonly ast: QueryAST.Filter) {}
|
|
39
|
+
|
|
40
|
+
'~Filter' = FilterClass.variance;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const is = (value: unknown): value is Any => {
|
|
44
|
+
return typeof value === 'object' && value !== null && '~Filter' in value;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/** Construct a filter from an ast. */
|
|
48
|
+
export const fromAst = (ast: QueryAST.Filter): Any => {
|
|
49
|
+
return new FilterClass(ast);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Filter that matches all objects.
|
|
54
|
+
*/
|
|
55
|
+
// TODO(dmaretskyi): `Entity.Any` would be more type-safe, but causes annoying errors in existing code
|
|
56
|
+
export const everything = (): FilterClass => {
|
|
57
|
+
return new FilterClass({
|
|
58
|
+
type: 'object',
|
|
59
|
+
typename: null,
|
|
60
|
+
props: {},
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Filter that matches no objects.
|
|
66
|
+
*/
|
|
67
|
+
export const nothing = (): FilterClass => {
|
|
68
|
+
return new FilterClass({
|
|
69
|
+
type: 'not',
|
|
70
|
+
filter: {
|
|
71
|
+
type: 'object',
|
|
72
|
+
typename: null,
|
|
73
|
+
props: {},
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
/*
|
|
79
|
+
* Filter by ObjectId.
|
|
80
|
+
*/
|
|
81
|
+
export const id = (...ids: ObjectId[]): Any => {
|
|
82
|
+
assertArgument(
|
|
83
|
+
ids.every((id) => ObjectId.isValid(id)),
|
|
84
|
+
'ids',
|
|
85
|
+
'ids must be valid',
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
if (ids.length === 0) {
|
|
89
|
+
return nothing();
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return new FilterClass({
|
|
93
|
+
type: 'object',
|
|
94
|
+
typename: null,
|
|
95
|
+
id: ids,
|
|
96
|
+
props: {},
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Filter by type.
|
|
102
|
+
*/
|
|
103
|
+
export const type = <S extends Schema.Schema.All>(
|
|
104
|
+
schema: S | string,
|
|
105
|
+
props?: Props<Schema.Schema.Type<S>>,
|
|
106
|
+
): Filter<Schema.Schema.Type<S>> => {
|
|
107
|
+
if (Schema.isSchema(schema) && SchemaAST.isUnion(schema.ast)) {
|
|
108
|
+
const typenames = schema.ast.types.map((type) => internal.getTypeDXNFromSpecifier(Schema.make(type)));
|
|
109
|
+
return new FilterClass({
|
|
110
|
+
type: 'or',
|
|
111
|
+
filters: typenames.map((typename) => ({
|
|
112
|
+
type: 'object',
|
|
113
|
+
typename: typename.toString(),
|
|
114
|
+
props: {},
|
|
115
|
+
})),
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const dxn = internal.getTypeDXNFromSpecifier(schema);
|
|
120
|
+
return new FilterClass({
|
|
121
|
+
type: 'object',
|
|
122
|
+
typename: dxn.toString(),
|
|
123
|
+
...propsFilterToAst(props ?? {}),
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Filter by non-qualified typename.
|
|
129
|
+
*/
|
|
130
|
+
export const typename = (typename: string): Any => {
|
|
131
|
+
assertArgument(!typename.startsWith('dxn:'), 'typename', 'Typename must no be qualified');
|
|
132
|
+
return new FilterClass({
|
|
133
|
+
type: 'object',
|
|
134
|
+
typename: DXN.fromTypename(typename).toString(),
|
|
135
|
+
props: {},
|
|
136
|
+
});
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Filter by fully qualified type DXN.
|
|
141
|
+
*/
|
|
142
|
+
export const typeDXN = (dxn: DXN): Any => {
|
|
143
|
+
return new FilterClass({
|
|
144
|
+
type: 'object',
|
|
145
|
+
typename: dxn.toString(),
|
|
146
|
+
props: {},
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Filter by tag.
|
|
152
|
+
*/
|
|
153
|
+
export const tag = (tag: string): Any => {
|
|
154
|
+
return new FilterClass({
|
|
155
|
+
type: 'tag',
|
|
156
|
+
tag,
|
|
157
|
+
});
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Filter by properties.
|
|
162
|
+
*/
|
|
163
|
+
export const props = <T>(props: Props<T>): Filter<T> => {
|
|
164
|
+
return new FilterClass({
|
|
165
|
+
type: 'object',
|
|
166
|
+
typename: null,
|
|
167
|
+
...propsFilterToAst(props),
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
export type TextSearchOptions = {
|
|
172
|
+
// TODO(dmaretskyi): Hybrid search.
|
|
173
|
+
type?: 'full-text' | 'vector';
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Full-text or vector search.
|
|
178
|
+
*/
|
|
179
|
+
export const text = (
|
|
180
|
+
// TODO(dmaretskyi): Consider passing a vector here, but really the embedding should be done on the query-executor side.
|
|
181
|
+
text: string,
|
|
182
|
+
options?: TextSearchOptions,
|
|
183
|
+
): Any => {
|
|
184
|
+
return new FilterClass({
|
|
185
|
+
type: 'text-search',
|
|
186
|
+
text,
|
|
187
|
+
searchKind: options?.type,
|
|
188
|
+
});
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Filter by foreign keys.
|
|
193
|
+
*/
|
|
194
|
+
export const foreignKeys = <S extends Schema.Schema.All>(
|
|
195
|
+
schema: S | string,
|
|
196
|
+
keys: ForeignKey[],
|
|
197
|
+
): Filter<Schema.Schema.Type<S>> => {
|
|
198
|
+
const dxn = internal.getTypeDXNFromSpecifier(schema);
|
|
199
|
+
return new FilterClass({
|
|
200
|
+
type: 'object',
|
|
201
|
+
typename: dxn.toString(),
|
|
202
|
+
props: {},
|
|
203
|
+
foreignKeys: keys,
|
|
204
|
+
});
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Predicate for property to be equal to the provided value.
|
|
209
|
+
*/
|
|
210
|
+
export const eq = <T>(value: T): Filter<T | undefined> => {
|
|
211
|
+
if (!Ref.isRef(value) && typeof value === 'object' && value !== null) {
|
|
212
|
+
throw new TypeError('Cannot use object as a value for eq filter');
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
return new FilterClass({
|
|
216
|
+
type: 'compare',
|
|
217
|
+
operator: 'eq',
|
|
218
|
+
value: Ref.isRef(value) ? value.noInline().encode() : value,
|
|
219
|
+
});
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Predicate for property to be not equal to the provided value.
|
|
224
|
+
*/
|
|
225
|
+
export const neq = <T>(value: T): Filter<T | undefined> => {
|
|
226
|
+
return new FilterClass({
|
|
227
|
+
type: 'compare',
|
|
228
|
+
operator: 'neq',
|
|
229
|
+
value,
|
|
230
|
+
});
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Predicate for property to be greater than the provided value.
|
|
235
|
+
*/
|
|
236
|
+
export const gt = <T>(value: T): Filter<T | undefined> => {
|
|
237
|
+
return new FilterClass({
|
|
238
|
+
type: 'compare',
|
|
239
|
+
operator: 'gt',
|
|
240
|
+
value,
|
|
241
|
+
});
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Predicate for property to be greater than or equal to the provided value.
|
|
246
|
+
*/
|
|
247
|
+
export const gte = <T>(value: T): Filter<T | undefined> => {
|
|
248
|
+
return new FilterClass({
|
|
249
|
+
type: 'compare',
|
|
250
|
+
operator: 'gte',
|
|
251
|
+
value,
|
|
252
|
+
});
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Predicate for property to be less than the provided value.
|
|
257
|
+
*/
|
|
258
|
+
export const lt = <T>(value: T): Filter<T | undefined> => {
|
|
259
|
+
return new FilterClass({
|
|
260
|
+
type: 'compare',
|
|
261
|
+
operator: 'lt',
|
|
262
|
+
value,
|
|
263
|
+
});
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Predicate for property to be less than or equal to the provided value.
|
|
268
|
+
*/
|
|
269
|
+
export const lte = <T>(value: T): Filter<T | undefined> => {
|
|
270
|
+
return new FilterClass({
|
|
271
|
+
type: 'compare',
|
|
272
|
+
operator: 'lte',
|
|
273
|
+
value,
|
|
274
|
+
});
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Predicate for property to be in the provided array.
|
|
279
|
+
* @param values - Values to check against.
|
|
280
|
+
*/
|
|
281
|
+
const in$ = <T>(...values: T[]): Filter<T> => {
|
|
282
|
+
return new FilterClass({
|
|
283
|
+
type: 'in',
|
|
284
|
+
values,
|
|
285
|
+
});
|
|
286
|
+
};
|
|
287
|
+
export { in$ as in };
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Predicate for an array property to contain the provided value.
|
|
291
|
+
* @param value - Value to check against.
|
|
292
|
+
*/
|
|
293
|
+
export const contains = <T>(value: T): Filter<readonly T[] | undefined> => {
|
|
294
|
+
return new FilterClass({
|
|
295
|
+
type: 'contains',
|
|
296
|
+
value,
|
|
297
|
+
});
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Predicate for property to be in the provided range.
|
|
302
|
+
* @param from - Start of the range (inclusive).
|
|
303
|
+
* @param to - End of the range (exclusive).
|
|
304
|
+
*/
|
|
305
|
+
export const between = <T>(from: T, to: T): Filter<T> => {
|
|
306
|
+
return new FilterClass({
|
|
307
|
+
type: 'range',
|
|
308
|
+
from,
|
|
309
|
+
to,
|
|
310
|
+
});
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
type TimeRange = { after?: Date | number; before?: Date | number };
|
|
314
|
+
|
|
315
|
+
const _toUnixMs = (date: Date | number): number => (typeof date === 'number' ? date : date.getTime());
|
|
316
|
+
|
|
317
|
+
const _timeRangeFilter = (field: 'updatedAt' | 'createdAt', range: TimeRange): Any => {
|
|
318
|
+
const filters: Any[] = [];
|
|
319
|
+
if (range.after != null) {
|
|
320
|
+
filters.push(new FilterClass({ type: 'timestamp', field, operator: 'gte', value: _toUnixMs(range.after) }));
|
|
321
|
+
}
|
|
322
|
+
if (range.before != null) {
|
|
323
|
+
filters.push(new FilterClass({ type: 'timestamp', field, operator: 'lte', value: _toUnixMs(range.before) }));
|
|
324
|
+
}
|
|
325
|
+
if (filters.length === 0) {
|
|
326
|
+
return everything();
|
|
327
|
+
}
|
|
328
|
+
return filters.length === 1 ? filters[0] : and(...filters);
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Filter objects by updatedAt timestamp.
|
|
333
|
+
*/
|
|
334
|
+
export const updated = (range: TimeRange): Any => _timeRangeFilter('updatedAt', range);
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Filter objects by createdAt timestamp.
|
|
338
|
+
*/
|
|
339
|
+
export const created = (range: TimeRange): Any => _timeRangeFilter('createdAt', range);
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Negate the filter.
|
|
343
|
+
*/
|
|
344
|
+
export const not = <F extends Any>(filter: F): Filter<Type<F>> => {
|
|
345
|
+
return new FilterClass({
|
|
346
|
+
type: 'not',
|
|
347
|
+
filter: filter.ast,
|
|
348
|
+
});
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Combine filters with a logical AND.
|
|
353
|
+
*/
|
|
354
|
+
export const and = <Filters extends readonly Any[]>(...filters: Filters): Filter<Type<Filters[number]>> => {
|
|
355
|
+
return new FilterClass({
|
|
356
|
+
type: 'and',
|
|
357
|
+
filters: filters.map((f) => f.ast),
|
|
358
|
+
});
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* Combine filters with a logical OR.
|
|
363
|
+
*/
|
|
364
|
+
export const or = <Filters extends readonly Any[]>(...filters: Filters): Filter<Type<Filters[number]>> => {
|
|
365
|
+
return new FilterClass({
|
|
366
|
+
type: 'or',
|
|
367
|
+
filters: filters.map((f) => f.ast),
|
|
368
|
+
});
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
// TODO(dmaretskyi): Add `Filter.match` to support pattern matching on string props.
|
|
372
|
+
|
|
373
|
+
const propsFilterToAst = (predicates: Props<any>): Pick<QueryAST.FilterObject, 'id' | 'props'> => {
|
|
374
|
+
let idFilter: readonly ObjectId[] | undefined;
|
|
375
|
+
if ('id' in predicates) {
|
|
376
|
+
assertArgument(
|
|
377
|
+
typeof predicates.id === 'string' || Array.isArray(predicates.id),
|
|
378
|
+
'predicates.id',
|
|
379
|
+
'invalid id filter',
|
|
380
|
+
);
|
|
381
|
+
idFilter = typeof predicates.id === 'string' ? [predicates.id] : predicates.id;
|
|
382
|
+
Schema.Array(ObjectId).pipe(Schema.validateSync)(idFilter);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
return {
|
|
386
|
+
id: idFilter,
|
|
387
|
+
props: Object.fromEntries(
|
|
388
|
+
Object.entries(predicates)
|
|
389
|
+
.filter(([prop, _value]) => prop !== 'id')
|
|
390
|
+
.map(([prop, predicate]) => [prop, processPredicate(predicate)]),
|
|
391
|
+
) as Record<string, QueryAST.Filter>,
|
|
392
|
+
};
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
const processPredicate = (predicate: any): QueryAST.Filter => {
|
|
396
|
+
return Match.value(predicate).pipe(
|
|
397
|
+
Match.withReturnType<QueryAST.Filter>(),
|
|
398
|
+
Match.when(is, (predicate) => predicate.ast),
|
|
399
|
+
// TODO(wittjosiah): Add support for array predicates.
|
|
400
|
+
Match.when(Array.isArray, (_predicate) => {
|
|
401
|
+
throw new Error('Array predicates are not yet supported.');
|
|
402
|
+
}),
|
|
403
|
+
Match.when(
|
|
404
|
+
(predicate: any) => !Ref.isRef(predicate) && typeof predicate === 'object' && predicate !== null,
|
|
405
|
+
(predicate) => {
|
|
406
|
+
const nestedProps = Object.fromEntries(
|
|
407
|
+
Object.entries(predicate).map(([key, value]) => [key, processPredicate(value)]),
|
|
408
|
+
);
|
|
409
|
+
|
|
410
|
+
return {
|
|
411
|
+
type: 'object',
|
|
412
|
+
typename: null,
|
|
413
|
+
props: nestedProps,
|
|
414
|
+
};
|
|
415
|
+
},
|
|
416
|
+
),
|
|
417
|
+
Match.orElse((value) => eq(value).ast),
|
|
418
|
+
);
|
|
419
|
+
};
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* Returns a human-readable string representation of a Filter AST.
|
|
423
|
+
*/
|
|
424
|
+
export const pretty = (filter: Any): string => internal.prettyFilter(filter.ast);
|
package/src/Format.ts
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type DXN } from '@dxos/keys';
|
|
6
|
+
|
|
7
|
+
import type * as Database from './Database';
|
|
8
|
+
import type * as Entity from './Entity';
|
|
9
|
+
import type * as internal from './internal';
|
|
10
|
+
import type * as Key from './Key';
|
|
11
|
+
import type * as Ref from './Ref';
|
|
12
|
+
import type * as SchemaRegistry from './SchemaRegistry';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Resolution context.
|
|
16
|
+
* Affects how non-absolute DXNs are resolved.
|
|
17
|
+
*/
|
|
18
|
+
export interface RefResolutionContext {
|
|
19
|
+
/**
|
|
20
|
+
* Space that the resolution is happening from.
|
|
21
|
+
*/
|
|
22
|
+
space?: Key.SpaceId;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Queue that the resolution is happening from.
|
|
26
|
+
* This queue will be searched first, and then the space it belongs to.
|
|
27
|
+
*/
|
|
28
|
+
queue?: DXN;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface RefResolverOptions {
|
|
32
|
+
/**
|
|
33
|
+
* Resolution context.
|
|
34
|
+
* Affects how non-absolute DXNs are resolved.
|
|
35
|
+
*/
|
|
36
|
+
context?: RefResolutionContext;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Middleware to change the resolved object before returning it.
|
|
40
|
+
* @deprecated On track to be removed.
|
|
41
|
+
*/
|
|
42
|
+
middleware?: (obj: internal.AnyProperties) => internal.AnyProperties;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Manages cross-space database interactions.
|
|
47
|
+
*/
|
|
48
|
+
export interface Hypergraph extends Database.Queryable {
|
|
49
|
+
get schemaRegistry(): SchemaRegistry.SchemaRegistry;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Query objects.
|
|
53
|
+
*/
|
|
54
|
+
query: Database.QueryFn;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Creates a reference to an existing object in the database.
|
|
58
|
+
*
|
|
59
|
+
* NOTE: The reference may be dangling if the object is not present in the database.
|
|
60
|
+
* NOTE: Difference from `Ref.fromDXN`
|
|
61
|
+
* `Ref.fromDXN(dxn)` returns an unhydrated reference. The `.load` and `.target` APIs will not work.
|
|
62
|
+
* `db.makeRef(dxn)` is preferable in cases with access to the database.
|
|
63
|
+
*/
|
|
64
|
+
makeRef<T extends Entity.Unknown = Entity.Unknown>(dxn: DXN): Ref.Ref<T>;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @param hostDb Host database for reference resolution.
|
|
68
|
+
* @param middleware Called with the loaded object. The caller may change the object.
|
|
69
|
+
* @returns Result of `onLoad`.
|
|
70
|
+
*/
|
|
71
|
+
// TODO(dmaretskyi): Restructure API: Remove middleware.
|
|
72
|
+
createRefResolver(options: RefResolverOptions): Ref.Resolver;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Get a database by space ID.
|
|
76
|
+
* @returns The database for the given space ID, or undefined if not found.
|
|
77
|
+
*/
|
|
78
|
+
getDatabase(spaceId: Key.SpaceId): Database.Database | undefined;
|
|
79
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// @import-as-namespace
|
|
6
|
+
|
|
7
|
+
import type * as Schema from 'effect/Schema';
|
|
8
|
+
|
|
9
|
+
import * as jsonSchemaInternal from './internal/JsonSchema';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Decode JSON Schema to Effect Schema.
|
|
13
|
+
*/
|
|
14
|
+
export const toEffectSchema = jsonSchemaInternal.toEffectSchema;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Encode Effect Schema to JSON Schema.
|
|
18
|
+
*/
|
|
19
|
+
export const toJsonSchema = jsonSchemaInternal.toJsonSchema;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Serializable JsonSchema type definition.
|
|
23
|
+
*/
|
|
24
|
+
export type JsonSchema = jsonSchemaInternal.JsonSchemaType;
|
|
25
|
+
|
|
26
|
+
export const JsonSchema: Schema.Schema<jsonSchemaInternal.JsonSchemaType> = jsonSchemaInternal.JsonSchemaType;
|