@dxos/echo 0.8.4-main.70d3990 → 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/Extension.mjs.map +7 -0
- package/dist/lib/neutral/Feed.mjs +48 -0
- package/dist/lib/neutral/Feed.mjs.map +7 -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 +261 -123
- package/dist/lib/neutral/internal/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/{browser → neutral}/testing/index.mjs +98 -52
- package/dist/lib/neutral/testing/index.mjs.map +7 -0
- package/dist/types/src/Annotation.d.ts +23 -1
- package/dist/types/src/Annotation.d.ts.map +1 -1
- 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 +146 -87
- package/dist/types/src/Database.d.ts.map +1 -1
- 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 +141 -9
- package/dist/types/src/Entity.d.ts.map +1 -1
- package/dist/types/src/Entity.test.d.ts +2 -0
- package/dist/types/src/Entity.test.d.ts.map +1 -0
- package/dist/types/src/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 +3 -3
- package/dist/types/src/Format.d.ts.map +1 -1
- 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 +11 -4
- package/dist/types/src/JsonSchema.d.ts.map +1 -1
- package/dist/types/src/Obj.d.ts +403 -84
- 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 +281 -18
- package/dist/types/src/Relation.d.ts.map +1 -1
- package/dist/types/src/Relation.test.d.ts +2 -0
- package/dist/types/src/Relation.test.d.ts.map +1 -0
- package/dist/types/src/SchemaRegistry.d.ts +84 -0
- package/dist/types/src/SchemaRegistry.d.ts.map +1 -0
- package/dist/types/src/Tag.d.ts +8 -7
- package/dist/types/src/Tag.d.ts.map +1 -1
- package/dist/types/src/Type.d.ts +124 -90
- 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 +13 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/internal/{annotations → Annotation}/annotations.d.ts +84 -27
- 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/{annotations → Annotation}/util.d.ts +14 -1
- 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/{entities → Entity}/model.d.ts +14 -29
- 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.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 -4
- 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 +7 -3
- package/dist/types/src/internal/Format/types.d.ts.map +1 -0
- package/dist/types/src/internal/{json-schema → 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.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-schema → JsonSchema}/json-schema.d.ts +2 -1
- 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 → Obj}/create-object.d.ts +3 -3
- package/dist/types/src/internal/Obj/create-object.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/create-object.test.d.ts.map +1 -0
- package/dist/types/src/internal/{object → Obj}/deleted.d.ts +1 -1
- 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/{object → Obj}/index.d.ts +3 -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 +31 -9
- 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 +20 -7
- 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/{proxy → common/proxy}/make-object.d.ts +2 -4
- 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/{types → common/types}/base.d.ts +6 -16
- 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/{types → common/types}/index.d.ts +1 -0
- package/dist/types/src/internal/common/types/index.d.ts.map +1 -0
- package/dist/types/src/internal/{types → common/types}/meta.d.ts +8 -15
- 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/{types → common/types}/typename.d.ts +8 -0
- package/dist/types/src/internal/common/types/typename.d.ts.map +1 -0
- package/dist/types/src/internal/{types → common/types}/version.d.ts +2 -2
- package/dist/types/src/internal/common/types/version.d.ts.map +1 -0
- package/dist/types/src/internal/index.d.ts +10 -10
- package/dist/types/src/internal/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-data.d.ts.map +1 -1
- package/dist/types/src/testing/test-schema.d.ts +146 -179
- package/dist/types/src/testing/test-schema.d.ts.map +1 -1
- package/dist/types/src/testing/util.d.ts +6 -1
- package/dist/types/src/testing/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +99 -61
- package/src/Annotation.ts +36 -5
- package/src/Collection.ts +37 -0
- package/src/Database.ts +263 -122
- package/src/Dataset.ts +26 -0
- package/src/Entity.test.ts +22 -0
- package/src/Entity.ts +196 -11
- 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 +3 -5
- package/src/Hypergraph.ts +79 -0
- package/src/JsonSchema.ts +14 -4
- package/src/Obj.test.ts +539 -0
- package/src/Obj.ts +639 -289
- 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 +439 -68
- package/src/SchemaRegistry.ts +106 -0
- package/src/Tag.ts +7 -6
- package/src/Type.test.ts +52 -0
- package/src/Type.ts +167 -166
- package/src/View.ts +107 -0
- package/src/hierarchy.test.ts +33 -0
- package/src/index.ts +14 -5
- package/src/internal/{annotations → Annotation}/annotations.test.ts +62 -13
- package/src/internal/{annotations → Annotation}/annotations.ts +186 -71
- package/src/internal/{annotations → Annotation}/index.ts +1 -0
- package/src/internal/Annotation/sorting.ts +51 -0
- package/src/internal/{annotations → Annotation}/util.ts +16 -1
- package/src/internal/Entity/api.ts +30 -0
- package/src/internal/{entities → Entity}/entity.ts +39 -20
- package/src/internal/{entities → Entity}/index.ts +3 -1
- package/src/internal/{entities → Entity}/model.ts +29 -49
- package/src/internal/{entities → Entity}/object.ts +23 -11
- package/src/internal/{entities → Entity}/relation.ts +42 -43
- package/src/internal/Entity/version.ts +96 -0
- package/src/internal/{formats → Format}/date.test.ts +1 -2
- package/src/internal/{formats → Format}/format.test.ts +2 -3
- package/src/internal/{formats → Format}/format.ts +7 -8
- package/src/internal/{formats → Format}/object.ts +2 -2
- package/src/internal/{formats → Format}/select.ts +6 -4
- package/src/internal/{formats → Format}/string.ts +5 -0
- package/src/internal/{formats → Format}/types.ts +12 -6
- package/src/internal/{json-schema → JsonSchema}/annotations.ts +3 -3
- package/src/internal/{json-schema → JsonSchema}/json-schema-normalize.ts +4 -2
- package/src/internal/{json-schema → JsonSchema}/json-schema-type.ts +34 -35
- package/src/internal/{json-schema → JsonSchema}/json-schema.test.ts +67 -66
- package/src/internal/{json-schema → JsonSchema}/json-schema.ts +18 -13
- package/src/internal/Obj/clone.ts +48 -0
- package/src/internal/{object → Obj}/common.ts +2 -2
- package/src/internal/{object → Obj}/create-object.test.ts +5 -7
- package/src/internal/{object → Obj}/create-object.ts +6 -7
- package/src/internal/{object → Obj}/deleted.ts +2 -2
- package/src/internal/{object → Obj}/index.ts +3 -0
- package/src/internal/{object → Obj}/inspect.ts +4 -4
- package/src/internal/{object → Obj}/json-serializer.test.ts +33 -7
- package/src/internal/{object → Obj}/json-serializer.ts +77 -92
- 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 +5 -6
- package/src/internal/{ref → Ref}/ref.ts +90 -43
- package/src/internal/{schema → Type}/compose.test.ts +6 -7
- package/src/internal/{schema → Type}/compose.ts +14 -10
- package/src/internal/{schema → Type}/echo-schema.ts +55 -17
- package/src/internal/{schema → Type}/index.ts +0 -2
- package/src/internal/{schema → Type}/manipulation.ts +1 -1
- package/src/internal/Type/persistent-schema.ts +33 -0
- package/src/internal/{README.md → common/README.md} +36 -17
- package/src/internal/common/api/index.ts +15 -0
- package/src/internal/common/api/meta.ts +88 -0
- package/src/internal/common/index.ts +7 -0
- 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/{proxy → common/proxy}/handler.test.ts +32 -84
- 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 +3 -1
- package/src/internal/{proxy → common/proxy}/schema.test.ts +29 -21
- 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/{types → common/types}/base.ts +7 -22
- package/src/internal/common/types/entity.ts +54 -0
- package/src/internal/{types → common/types}/index.ts +1 -0
- package/src/internal/{types → common/types}/meta.ts +16 -25
- package/src/internal/common/types/model-symbols.ts +69 -0
- package/src/internal/{types → common/types}/typename.ts +10 -0
- package/src/internal/{types → common/types}/version.ts +2 -3
- package/src/internal/index.ts +10 -31
- package/src/testing/api.test.ts +32 -7
- package/src/testing/test-data.ts +0 -1
- package/src/testing/test-schema.ts +68 -41
- package/src/testing/util.ts +22 -15
- package/dist/lib/browser/chunk-7GH6RXJ3.mjs +0 -3683
- package/dist/lib/browser/chunk-7GH6RXJ3.mjs.map +0 -7
- package/dist/lib/browser/chunk-E4UTVJNF.mjs +0 -1111
- package/dist/lib/browser/chunk-E4UTVJNF.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -45
- package/dist/lib/browser/internal/index.mjs +0 -336
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/testing/index.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-JE5RXM2I.mjs +0 -1111
- package/dist/lib/node-esm/chunk-JE5RXM2I.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-M4B6BMD2.mjs +0 -3683
- package/dist/lib/node-esm/chunk-M4B6BMD2.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -45
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/testing/index.mjs +0 -328
- 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/annotations/annotations.d.ts.map +0 -1
- package/dist/types/src/internal/annotations/annotations.test.d.ts.map +0 -1
- package/dist/types/src/internal/annotations/index.d.ts +0 -3
- package/dist/types/src/internal/annotations/index.d.ts.map +0 -1
- package/dist/types/src/internal/annotations/util.d.ts.map +0 -1
- package/dist/types/src/internal/entities/entity.d.ts +0 -10
- package/dist/types/src/internal/entities/entity.d.ts.map +0 -1
- package/dist/types/src/internal/entities/expando.d.ts +0 -16
- package/dist/types/src/internal/entities/expando.d.ts.map +0 -1
- package/dist/types/src/internal/entities/index.d.ts +0 -6
- package/dist/types/src/internal/entities/index.d.ts.map +0 -1
- package/dist/types/src/internal/entities/model.d.ts.map +0 -1
- package/dist/types/src/internal/entities/object.d.ts +0 -11
- package/dist/types/src/internal/entities/object.d.ts.map +0 -1
- package/dist/types/src/internal/entities/relation.d.ts +0 -55
- package/dist/types/src/internal/entities/relation.d.ts.map +0 -1
- package/dist/types/src/internal/entities/util.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-schema/annotations.d.ts.map +0 -1
- package/dist/types/src/internal/json-schema/effect-schema.test.d.ts.map +0 -1
- 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/json-schema/json-schema.d.ts.map +0 -1
- package/dist/types/src/internal/json-schema/json-schema.test.d.ts.map +0 -1
- package/dist/types/src/internal/object/common.d.ts.map +0 -1
- package/dist/types/src/internal/object/create-object.d.ts.map +0 -1
- package/dist/types/src/internal/object/create-object.test.d.ts.map +0 -1
- package/dist/types/src/internal/object/deleted.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.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 -31
- 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/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/proxy/handler.test.d.ts.map +0 -1
- package/dist/types/src/internal/proxy/index.d.ts +0 -3
- package/dist/types/src/internal/proxy/index.d.ts.map +0 -1
- package/dist/types/src/internal/proxy/make-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/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/compose.d.ts +0 -6
- package/dist/types/src/internal/schema/compose.d.ts.map +0 -1
- package/dist/types/src/internal/schema/compose.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 -6
- 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/persistent-schema.d.ts +0 -18
- package/dist/types/src/internal/schema/persistent-schema.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/types/base.d.ts.map +0 -1
- package/dist/types/src/internal/types/entity.d.ts +0 -12
- package/dist/types/src/internal/types/entity.d.ts.map +0 -1
- package/dist/types/src/internal/types/index.d.ts.map +0 -1
- package/dist/types/src/internal/types/meta.d.ts.map +0 -1
- package/dist/types/src/internal/types/typename.d.ts.map +0 -1
- package/dist/types/src/internal/types/version.d.ts.map +0 -1
- package/dist/types/src/query/filter.d.ts +0 -167
- package/dist/types/src/query/filter.d.ts.map +0 -1
- package/dist/types/src/query/index.d.ts +0 -5
- package/dist/types/src/query/index.d.ts.map +0 -1
- package/dist/types/src/query/order.d.ts +0 -12
- package/dist/types/src/query/order.d.ts.map +0 -1
- package/dist/types/src/query/query.d.ts +0 -112
- package/dist/types/src/query/query.d.ts.map +0 -1
- package/dist/types/src/query/query.test.d.ts +0 -2
- package/dist/types/src/query/query.test.d.ts.map +0 -1
- package/dist/types/src/query/testing.d.ts +0 -51
- package/dist/types/src/query/testing.d.ts.map +0 -1
- package/dist/types/src/query/types.d.ts +0 -17
- package/dist/types/src/query/types.d.ts.map +0 -1
- package/dist/types/src/query/util.d.ts +0 -8
- package/dist/types/src/query/util.d.ts.map +0 -1
- package/src/errors.ts +0 -18
- package/src/internal/entities/expando.ts +0 -23
- package/src/internal/object/typed-object.ts +0 -94
- package/src/internal/proxy/index.ts +0 -6
- package/src/internal/proxy/make-object.ts +0 -113
- package/src/internal/proxy/typed-handler.test.ts +0 -102
- package/src/internal/proxy/typed-handler.ts +0 -233
- package/src/internal/proxy/typed-object.test.ts +0 -105
- package/src/internal/schema/persistent-schema.ts +0 -28
- package/src/internal/schema/runtime-schema-registry.ts +0 -78
- package/src/internal/schema/snapshot.ts +0 -25
- package/src/internal/types/entity.ts +0 -23
- package/src/query/filter.ts +0 -455
- package/src/query/index.ts +0 -9
- package/src/query/order.ts +0 -34
- package/src/query/query.test.ts +0 -334
- package/src/query/query.ts +0 -303
- package/src/query/testing.ts +0 -64
- package/src/query/types.ts +0 -23
- package/src/query/util.ts +0 -25
- /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/{node-esm/index.mjs.map → neutral/Entity.mjs.map} +0 -0
- /package/dist/lib/{node-esm/internal/index.mjs.map → neutral/Err.mjs.map} +0 -0
- /package/dist/types/src/internal/{annotations → Annotation}/annotations.test.d.ts +0 -0
- /package/dist/types/src/internal/{entities → Entity}/util.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-schema → JsonSchema}/effect-schema.test.d.ts +0 -0
- /package/dist/types/src/internal/{json-schema → JsonSchema}/index.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-schema → 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}/create-object.test.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/{schema → 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/src/internal/{entities → Entity}/util.ts +0 -0
- /package/src/internal/{formats → Format}/date.ts +0 -0
- /package/src/internal/{formats → Format}/index.ts +0 -0
- /package/src/internal/{formats → Format}/number.ts +0 -0
- /package/src/internal/{json-schema → JsonSchema}/effect-schema.test.ts +0 -0
- /package/src/internal/{json-schema → JsonSchema}/index.ts +0 -0
- /package/src/internal/{object → Obj}/ids.ts +0 -0
- /package/src/internal/{ref → Ref}/index.ts +0 -0
|
@@ -8,7 +8,8 @@ import { ForeignKey } from '@dxos/echo-protocol';
|
|
|
8
8
|
import { invariant } from '@dxos/invariant';
|
|
9
9
|
import { type Comparator, intersection } from '@dxos/util';
|
|
10
10
|
|
|
11
|
-
import
|
|
11
|
+
import type * as Entity from '../../../Entity';
|
|
12
|
+
import { type AnyProperties } from './base';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Property name for meta when object is serialized to JSON.
|
|
@@ -18,27 +19,27 @@ export const ATTR_META = '@meta';
|
|
|
18
19
|
/**
|
|
19
20
|
* Metadata section.
|
|
20
21
|
*/
|
|
21
|
-
export const MetaId = Symbol.for('@dxos/echo/Meta');
|
|
22
|
+
export const MetaId: Entity.Meta = Symbol.for('@dxos/echo/Meta') as any;
|
|
22
23
|
|
|
23
24
|
//
|
|
24
25
|
// ObjectMeta
|
|
25
26
|
//
|
|
26
27
|
|
|
27
28
|
// TODO(dmaretskyi): Rename to ObjectMeta
|
|
28
|
-
export const ObjectMetaSchema = Schema.
|
|
29
|
-
Schema.
|
|
30
|
-
|
|
29
|
+
export const ObjectMetaSchema = Schema.Struct({
|
|
30
|
+
keys: Schema.Array(ForeignKey),
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* A set of tags.
|
|
34
|
+
* Tags are arbitrary application-defined strings.
|
|
35
|
+
* ECHO makes no assumptions about the tag structure.
|
|
36
|
+
*/
|
|
37
|
+
// TODO(dmaretskyi): Has to be optional for compatibility with old data.
|
|
38
|
+
// Defaulting to an empty array is possible but requires a bit more work.
|
|
39
|
+
// TODO(dmaretskyi): In automerge this should be a map of { [tag]: boolean } for uniqueness and conflict resolution.
|
|
40
|
+
tags: Schema.optional(Schema.Array(Schema.String)),
|
|
41
|
+
});
|
|
31
42
|
|
|
32
|
-
/**
|
|
33
|
-
* A set of tags.
|
|
34
|
-
* Tags are arbitrary application-defined strings.
|
|
35
|
-
* ECHO makes no assumptions about the tag structure.
|
|
36
|
-
*/
|
|
37
|
-
// TODO(dmaretskyi): Has to be optional for compatibility with old data.
|
|
38
|
-
// Defaulting to an empty array is possible but requires a bit more work.
|
|
39
|
-
tags: Schema.optional(Schema.mutable(Schema.Array(Schema.String))),
|
|
40
|
-
}),
|
|
41
|
-
);
|
|
42
43
|
export type ObjectMeta = Schema.Schema.Type<typeof ObjectMetaSchema>;
|
|
43
44
|
|
|
44
45
|
/*
|
|
@@ -54,16 +55,6 @@ export const getMeta = (obj: AnyProperties): ObjectMeta => {
|
|
|
54
55
|
return metadata;
|
|
55
56
|
};
|
|
56
57
|
|
|
57
|
-
/**
|
|
58
|
-
* Utility to split meta property from raw object.
|
|
59
|
-
* @deprecated Bad API.
|
|
60
|
-
*/
|
|
61
|
-
export const splitMeta = <T>(object: T & WithMeta): { object: T; meta?: ObjectMeta } => {
|
|
62
|
-
const meta = object[ATTR_META];
|
|
63
|
-
delete object[ATTR_META];
|
|
64
|
-
return { meta, object };
|
|
65
|
-
};
|
|
66
|
-
|
|
67
58
|
//
|
|
68
59
|
// Foreign keys
|
|
69
60
|
//
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Internal symbol/string constants for the echo object model.
|
|
7
|
+
* Defined in common/ so proxy/ can use them without importing from Entity/.
|
|
8
|
+
* Entity/ re-exports these for external consumers.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Property name for self DXN when object is serialized to JSON.
|
|
13
|
+
*/
|
|
14
|
+
export const ATTR_SELF_DXN = '@dxn';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* DXN to the object itself.
|
|
18
|
+
*/
|
|
19
|
+
export const SelfDXNId = Symbol.for('@dxos/echo/DXN');
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Property name for deleted when object is serialized to JSON.
|
|
23
|
+
*/
|
|
24
|
+
export const ATTR_DELETED = '@deleted';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Deletion marker.
|
|
28
|
+
*/
|
|
29
|
+
export const ObjectDeletedId = Symbol.for('@dxos/echo/Deleted');
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Object version accessor symbol.
|
|
33
|
+
*/
|
|
34
|
+
export const ObjectVersionId: unique symbol = Symbol.for('@dxos/echo/Version');
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Object database accessor symbol.
|
|
38
|
+
*/
|
|
39
|
+
export const ObjectDatabaseId = Symbol.for('@dxos/echo/Database');
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Property name for relation source when object is serialized to JSON.
|
|
43
|
+
*/
|
|
44
|
+
export const ATTR_RELATION_SOURCE = '@relationSource';
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Used to access relation source ref on live ECHO objects.
|
|
48
|
+
*/
|
|
49
|
+
export const RelationSourceId: unique symbol = Symbol.for('@dxos/echo/RelationSource');
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Used to access relation source DXN on live ECHO objects.
|
|
53
|
+
*/
|
|
54
|
+
export const RelationSourceDXNId: unique symbol = Symbol.for('@dxos/echo/RelationSourceDXN');
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Property name for relation target when object is serialized to JSON.
|
|
58
|
+
*/
|
|
59
|
+
export const ATTR_RELATION_TARGET = '@relationTarget';
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Used to access relation target ref on live ECHO objects.
|
|
63
|
+
*/
|
|
64
|
+
export const RelationTargetId: unique symbol = Symbol.for('@dxos/echo/RelationTarget');
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Used to access relation target DXN on live ECHO objects.
|
|
68
|
+
*/
|
|
69
|
+
export const RelationTargetDXNId: unique symbol = Symbol.for('@dxos/echo/RelationTargetDXN');
|
|
@@ -19,6 +19,16 @@ export const TypeId = Symbol.for('@dxos/echo/Type');
|
|
|
19
19
|
*/
|
|
20
20
|
export const SchemaId = Symbol.for('@dxos/echo/Schema');
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Property name for parent when object is serialized to JSON.
|
|
24
|
+
*/
|
|
25
|
+
export const ATTR_PARENT = '@parent';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Reference to the object parent.
|
|
29
|
+
*/
|
|
30
|
+
export const ParentId = Symbol.for('@dxos/echo/Parent');
|
|
31
|
+
|
|
22
32
|
/**
|
|
23
33
|
* Returns the schema for the given object if one is defined.
|
|
24
34
|
*
|
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Version type
|
|
6
|
+
* Version type identifier.
|
|
7
7
|
*/
|
|
8
|
-
export const VersionTypeId
|
|
9
|
-
|
|
8
|
+
export const VersionTypeId = '~@dxos/echo/VersionTypeId' as const;
|
|
10
9
|
export type VersionTypeId = typeof VersionTypeId;
|
|
11
10
|
|
|
12
11
|
/**
|
package/src/internal/index.ts
CHANGED
|
@@ -3,36 +3,15 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
// TODO(burdon): Import directly (not part of ECHO API).
|
|
6
|
-
export { JsonPath, JsonProp, getValue,
|
|
7
|
-
|
|
8
|
-
export * from './annotations';
|
|
9
|
-
export * from './entities';
|
|
10
|
-
export * from './formats';
|
|
11
|
-
export * from './json-schema';
|
|
12
|
-
export * from './ref';
|
|
13
|
-
export * from './types';
|
|
6
|
+
export { JsonPath, JsonProp, getValue, splitJsonPath } from '@dxos/effect';
|
|
14
7
|
|
|
8
|
+
export * from './Annotation';
|
|
9
|
+
export * from './common';
|
|
10
|
+
export * from './Entity';
|
|
11
|
+
export * from './Format';
|
|
12
|
+
export * from './JsonSchema';
|
|
15
13
|
// TODO(wittjosiah): Required to ensure types are portable (need to export all types required for downstream inference).
|
|
16
|
-
export * from './
|
|
17
|
-
export * from './
|
|
18
|
-
export * from './
|
|
19
|
-
|
|
20
|
-
// export {
|
|
21
|
-
// createObject,
|
|
22
|
-
// createQueueDXN,
|
|
23
|
-
// isDeleted,
|
|
24
|
-
// objectFromJSON,
|
|
25
|
-
// objectToJSON,
|
|
26
|
-
// setRefResolverOnData,
|
|
27
|
-
// SchemaValidator,
|
|
28
|
-
// TypedObject,
|
|
29
|
-
// } from './object';
|
|
30
|
-
// export { makeObject } from './proxy';
|
|
31
|
-
// export {
|
|
32
|
-
// type BaseSchema,
|
|
33
|
-
// EchoSchema,
|
|
34
|
-
// ImmutableSchema,
|
|
35
|
-
// RuntimeSchemaRegistry,
|
|
36
|
-
// PersistentSchema,
|
|
37
|
-
// isMutable,
|
|
38
|
-
// } from './schema';
|
|
14
|
+
export * from './Obj';
|
|
15
|
+
export * from './Query';
|
|
16
|
+
export * from './Ref';
|
|
17
|
+
export * from './Type';
|
package/src/testing/api.test.ts
CHANGED
|
@@ -8,20 +8,19 @@ import { describe, test } from 'vitest';
|
|
|
8
8
|
import { raise } from '@dxos/debug';
|
|
9
9
|
|
|
10
10
|
import { Entity, Obj, Ref, Relation, Type } from '../index';
|
|
11
|
-
|
|
12
11
|
import { TestSchema } from './test-schema';
|
|
13
12
|
|
|
14
13
|
describe('Experimental API review', () => {
|
|
15
14
|
test('type checks', ({ expect }) => {
|
|
16
15
|
const contact = Obj.make(TestSchema.Person, { name: 'Test' });
|
|
17
|
-
const
|
|
16
|
+
const schema = Obj.getSchema(contact) ?? raise(new Error('No schema found'));
|
|
18
17
|
|
|
19
|
-
expect(Type.getDXN(
|
|
20
|
-
expect(Type.getTypename(
|
|
21
|
-
expect(Type.getVersion(
|
|
22
|
-
expect(Type.getMeta(
|
|
18
|
+
expect(Type.getDXN(schema)?.typename).to.eq(TestSchema.Person.typename);
|
|
19
|
+
expect(Type.getTypename(schema)).to.eq('com.example.type.person');
|
|
20
|
+
expect(Type.getVersion(schema)).to.eq('0.1.0');
|
|
21
|
+
expect(Type.getMeta(schema)).to.deep.eq({
|
|
23
22
|
kind: Entity.Kind.Object,
|
|
24
|
-
typename: 'example.
|
|
23
|
+
typename: 'com.example.type.person',
|
|
25
24
|
version: '0.1.0',
|
|
26
25
|
});
|
|
27
26
|
});
|
|
@@ -97,4 +96,30 @@ describe('Experimental API review', () => {
|
|
|
97
96
|
}
|
|
98
97
|
}
|
|
99
98
|
});
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Test that Obj.make return types are clean and don't expose internal markers like OfKind.
|
|
102
|
+
* The return type of Obj.make(Schema, props) should be assignable to Obj.Obj<InstanceType>.
|
|
103
|
+
*/
|
|
104
|
+
describe('Obj.make return type', () => {
|
|
105
|
+
test('Obj.make with custom schema should be assignable to Obj.Obj<Person>', ({ expect }) => {
|
|
106
|
+
{
|
|
107
|
+
const expando = Obj.make(TestSchema.Expando, { content: 'Test' });
|
|
108
|
+
expect(Obj.isObject(expando)).to.be.true;
|
|
109
|
+
expect(expando.content).to.eq('Test');
|
|
110
|
+
|
|
111
|
+
// This should work: assign to Obj.Obj of the schema's instance type
|
|
112
|
+
const _typed: Obj.OfShape<TestSchema.Expando> = expando;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
{
|
|
116
|
+
const person = Obj.make(TestSchema.Person, { name: 'Test' });
|
|
117
|
+
expect(Obj.isObject(person)).to.be.true;
|
|
118
|
+
expect(person.name).to.eq('Test');
|
|
119
|
+
|
|
120
|
+
// This should work: assign to Obj.Obj of the schema's instance type
|
|
121
|
+
const _typed: Obj.OfShape<TestSchema.Person> = person;
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
});
|
|
100
125
|
});
|
package/src/testing/test-data.ts
CHANGED
|
@@ -5,16 +5,34 @@
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
7
|
import * as Obj from '../Obj';
|
|
8
|
+
import * as Ref from '../Ref';
|
|
8
9
|
import * as Type from '../Type';
|
|
9
10
|
|
|
10
11
|
export namespace TestSchema {
|
|
12
|
+
//
|
|
13
|
+
// Expando
|
|
14
|
+
//
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Expando object is an object with an arbitrary set of properties.
|
|
18
|
+
* This is the test variant with example.com namespace.
|
|
19
|
+
*/
|
|
20
|
+
export const Expando = Schema.Struct({}, { key: Schema.String, value: Schema.Any }).pipe(
|
|
21
|
+
Type.object({
|
|
22
|
+
typename: 'com.example.type.expando',
|
|
23
|
+
version: '0.1.0',
|
|
24
|
+
}),
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
export interface Expando extends Schema.Schema.Type<typeof Expando> {}
|
|
28
|
+
|
|
11
29
|
//
|
|
12
30
|
// Example
|
|
13
31
|
//
|
|
14
32
|
|
|
15
33
|
const Nested = Schema.Struct({
|
|
16
34
|
field: Schema.String,
|
|
17
|
-
})
|
|
35
|
+
});
|
|
18
36
|
|
|
19
37
|
export class TestClass {
|
|
20
38
|
field = 'value';
|
|
@@ -30,24 +48,24 @@ export namespace TestSchema {
|
|
|
30
48
|
boolean: Schema.Boolean,
|
|
31
49
|
null: Schema.Null,
|
|
32
50
|
undefined: Schema.Undefined,
|
|
33
|
-
stringArray: Schema.
|
|
34
|
-
twoDimNumberArray: Schema.
|
|
35
|
-
nested:
|
|
36
|
-
nestedArray: Schema.
|
|
37
|
-
nestedNullableArray: Schema.
|
|
38
|
-
reference: Schema.suspend(():
|
|
39
|
-
referenceArray: Schema.
|
|
51
|
+
stringArray: Schema.Array(Schema.String),
|
|
52
|
+
twoDimNumberArray: Schema.Array(Schema.Array(Schema.Number)),
|
|
53
|
+
nested: Nested,
|
|
54
|
+
nestedArray: Schema.Array(Nested),
|
|
55
|
+
nestedNullableArray: Schema.Array(Schema.Union(Nested, Schema.Null)),
|
|
56
|
+
reference: Schema.suspend((): Ref.RefSchema<Example> => Ref.Ref(Example)),
|
|
57
|
+
referenceArray: Schema.Array(Schema.suspend((): Ref.RefSchema<Example> => Ref.Ref(Example))),
|
|
40
58
|
classInstance: Schema.instanceOf(TestClass),
|
|
41
59
|
other: Schema.Any,
|
|
42
|
-
}).pipe(Schema.partial
|
|
60
|
+
}).pipe(Schema.partial);
|
|
43
61
|
|
|
44
62
|
/** @deprecated Use another test schema or create a specific local test schema. */
|
|
45
63
|
export interface ExampleSchema extends Schema.Schema.Type<typeof ExampleSchema> {}
|
|
46
64
|
|
|
47
65
|
/** @deprecated Use another test schema or create a specific local test schema. */
|
|
48
66
|
export const Example = ExampleSchema.pipe(
|
|
49
|
-
Type.
|
|
50
|
-
typename: 'example.
|
|
67
|
+
Type.object({
|
|
68
|
+
typename: 'com.example.type.example',
|
|
51
69
|
version: '0.1.0',
|
|
52
70
|
}),
|
|
53
71
|
);
|
|
@@ -70,8 +88,8 @@ export namespace TestSchema {
|
|
|
70
88
|
});
|
|
71
89
|
|
|
72
90
|
export const Message = MessageStruct.pipe(
|
|
73
|
-
Type.
|
|
74
|
-
typename: 'example.
|
|
91
|
+
Type.object({
|
|
92
|
+
typename: 'com.example.type.message',
|
|
75
93
|
version: '0.1.0',
|
|
76
94
|
}),
|
|
77
95
|
);
|
|
@@ -84,9 +102,15 @@ export namespace TestSchema {
|
|
|
84
102
|
|
|
85
103
|
export const Organization = Schema.Struct({
|
|
86
104
|
name: Schema.String,
|
|
105
|
+
properties: Schema.optional(
|
|
106
|
+
Schema.Record({
|
|
107
|
+
key: Schema.String,
|
|
108
|
+
value: Schema.String,
|
|
109
|
+
}),
|
|
110
|
+
),
|
|
87
111
|
}).pipe(
|
|
88
|
-
Type.
|
|
89
|
-
typename: 'example.
|
|
112
|
+
Type.object({
|
|
113
|
+
typename: 'com.example.type.organization',
|
|
90
114
|
version: '0.1.0',
|
|
91
115
|
}),
|
|
92
116
|
);
|
|
@@ -101,8 +125,9 @@ export namespace TestSchema {
|
|
|
101
125
|
name: Schema.String,
|
|
102
126
|
username: Schema.String,
|
|
103
127
|
email: Schema.String,
|
|
104
|
-
|
|
105
|
-
|
|
128
|
+
age: Schema.Number.pipe(Schema.optional),
|
|
129
|
+
tasks: Schema.Array(Schema.suspend((): Ref.RefSchema<Task> => Ref.Ref(Task))),
|
|
130
|
+
employer: Schema.optional(Ref.Ref(Organization)),
|
|
106
131
|
address: Schema.Struct({
|
|
107
132
|
city: Schema.optional(Schema.String),
|
|
108
133
|
state: Schema.optional(Schema.String),
|
|
@@ -112,10 +137,14 @@ export namespace TestSchema {
|
|
|
112
137
|
lng: Schema.optional(Schema.Number),
|
|
113
138
|
}),
|
|
114
139
|
}),
|
|
140
|
+
fields: Schema.Struct({
|
|
141
|
+
label: Schema.String,
|
|
142
|
+
value: Schema.String,
|
|
143
|
+
}).pipe(Schema.Array, Schema.optional),
|
|
115
144
|
}).pipe(
|
|
116
145
|
Schema.partial,
|
|
117
|
-
Type.
|
|
118
|
-
typename: 'example.
|
|
146
|
+
Type.object({
|
|
147
|
+
typename: 'com.example.type.person',
|
|
119
148
|
version: '0.1.0',
|
|
120
149
|
}),
|
|
121
150
|
);
|
|
@@ -130,14 +159,14 @@ export namespace TestSchema {
|
|
|
130
159
|
title: Schema.optional(Schema.String),
|
|
131
160
|
deadline: Schema.optional(Schema.String),
|
|
132
161
|
completed: Schema.optional(Schema.Boolean),
|
|
133
|
-
assignee: Schema.optional(
|
|
134
|
-
previous: Schema.optional(Schema.suspend(():
|
|
135
|
-
subTasks: Schema.optional(Schema.
|
|
162
|
+
assignee: Schema.optional(Ref.Ref(Person)),
|
|
163
|
+
previous: Schema.optional(Schema.suspend((): Ref.RefSchema<Task> => Ref.Ref(Task))),
|
|
164
|
+
subTasks: Schema.optional(Schema.Array(Schema.suspend((): Ref.RefSchema<Task> => Ref.Ref(Task)))),
|
|
136
165
|
description: Schema.optional(Schema.String),
|
|
137
166
|
}).pipe(
|
|
138
167
|
Schema.partial,
|
|
139
|
-
Type.
|
|
140
|
-
typename: 'example.
|
|
168
|
+
Type.object({
|
|
169
|
+
typename: 'com.example.type.task',
|
|
141
170
|
version: '0.1.0',
|
|
142
171
|
}),
|
|
143
172
|
);
|
|
@@ -149,8 +178,8 @@ export namespace TestSchema {
|
|
|
149
178
|
//
|
|
150
179
|
|
|
151
180
|
export const HasManager = Schema.Struct({}).pipe(
|
|
152
|
-
Type.
|
|
153
|
-
typename: 'example.
|
|
181
|
+
Type.relation({
|
|
182
|
+
typename: 'com.example.type.has-manager',
|
|
154
183
|
version: '0.1.0',
|
|
155
184
|
source: Person,
|
|
156
185
|
target: Person,
|
|
@@ -167,8 +196,8 @@ export namespace TestSchema {
|
|
|
167
196
|
role: Schema.String,
|
|
168
197
|
since: Schema.optional(Schema.String),
|
|
169
198
|
}).pipe(
|
|
170
|
-
Type.
|
|
171
|
-
typename: 'example.
|
|
199
|
+
Type.relation({
|
|
200
|
+
typename: 'com.example.type.employed-by',
|
|
172
201
|
version: '0.1.0',
|
|
173
202
|
source: Person,
|
|
174
203
|
target: Organization,
|
|
@@ -188,23 +217,21 @@ export namespace TestSchema {
|
|
|
188
217
|
}
|
|
189
218
|
|
|
190
219
|
export const Container = Schema.Struct({
|
|
191
|
-
objects: Schema.
|
|
192
|
-
records: Schema.
|
|
193
|
-
Schema.
|
|
194
|
-
Schema.
|
|
195
|
-
Schema.
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
}),
|
|
201
|
-
),
|
|
220
|
+
objects: Schema.Array(Ref.Ref(Obj.Unknown)),
|
|
221
|
+
records: Schema.Array(
|
|
222
|
+
Schema.partial(
|
|
223
|
+
Schema.Struct({
|
|
224
|
+
title: Schema.String,
|
|
225
|
+
description: Schema.String,
|
|
226
|
+
contacts: Schema.Array(Ref.Ref(Person)),
|
|
227
|
+
type: Schema.Enums(RecordType),
|
|
228
|
+
}),
|
|
202
229
|
),
|
|
203
230
|
),
|
|
204
231
|
}).pipe(
|
|
205
232
|
Schema.partial,
|
|
206
|
-
Type.
|
|
207
|
-
typename: 'example.
|
|
233
|
+
Type.object({
|
|
234
|
+
typename: 'com.example.type.container',
|
|
208
235
|
version: '0.1.0',
|
|
209
236
|
}),
|
|
210
237
|
);
|
package/src/testing/util.ts
CHANGED
|
@@ -2,17 +2,13 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { effect } from '@preact/signals-core';
|
|
6
5
|
import type * as Schema from 'effect/Schema';
|
|
7
6
|
import type * as SchemaAST from 'effect/SchemaAST';
|
|
8
7
|
|
|
9
|
-
import { registerSignalsRuntime } from '@dxos/echo-signals';
|
|
10
8
|
import { assertArgument } from '@dxos/invariant';
|
|
11
9
|
import { deepMapValues } from '@dxos/util';
|
|
12
10
|
|
|
13
|
-
import { EchoSchema, PersistentSchema, getSchemaTypename, makeObject, toJsonSchema } from '../internal';
|
|
14
|
-
|
|
15
|
-
registerSignalsRuntime();
|
|
11
|
+
import { EchoSchema, PersistentSchema, getSchemaTypename, makeObject, subscribe, toJsonSchema } from '../internal';
|
|
16
12
|
|
|
17
13
|
/**
|
|
18
14
|
* Create a reactive mutable schema that updates when the JSON schema is updated.
|
|
@@ -25,8 +21,7 @@ export const createEchoSchema = (schema: Schema.Schema.AnyNoContext, version = '
|
|
|
25
21
|
const echoSchema = new EchoSchema(makeObject(PersistentSchema, { typename, version, jsonSchema }));
|
|
26
22
|
|
|
27
23
|
// TODO(burdon): Unsubscribe is never called.
|
|
28
|
-
|
|
29
|
-
const _ = echoSchema.jsonSchema;
|
|
24
|
+
subscribe(echoSchema.persistentSchema, () => {
|
|
30
25
|
echoSchema._invalidate();
|
|
31
26
|
});
|
|
32
27
|
|
|
@@ -60,17 +55,29 @@ export const prepareAstForCompare = (obj: SchemaAST.AST): any =>
|
|
|
60
55
|
return recurse(value);
|
|
61
56
|
});
|
|
62
57
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
58
|
+
/**
|
|
59
|
+
* Creates an update counter that tracks changes to reactive objects.
|
|
60
|
+
* @param objects - Reactive objects to subscribe to.
|
|
61
|
+
* @returns An object with a count property and Symbol.dispose for cleanup.
|
|
62
|
+
*/
|
|
63
|
+
export const updateCounter = (...objects: object[]) => {
|
|
64
|
+
let updateCount = 0;
|
|
65
|
+
|
|
66
|
+
const unsubscribes = objects.map((obj) =>
|
|
67
|
+
subscribe(obj, () => {
|
|
68
|
+
updateCount++;
|
|
69
|
+
}),
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
const unsubscribeAll = () => {
|
|
73
|
+
for (const unsub of unsubscribes) {
|
|
74
|
+
unsub();
|
|
75
|
+
}
|
|
76
|
+
};
|
|
70
77
|
|
|
71
78
|
return {
|
|
72
79
|
// https://github.com/tc39/proposal-explicit-resource-management
|
|
73
|
-
[Symbol.dispose]:
|
|
80
|
+
[Symbol.dispose]: unsubscribeAll,
|
|
74
81
|
get count() {
|
|
75
82
|
return updateCount;
|
|
76
83
|
},
|