@dxos/echo 0.8.4-main.9735255 → 0.8.4-main.9be5663bfe
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/lib/neutral/Annotation.mjs +8 -3
- package/dist/lib/neutral/Database.mjs +36 -6
- package/dist/lib/neutral/Entity.mjs +18 -10
- package/dist/lib/neutral/Err.mjs +3 -1
- 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 +21 -10
- package/dist/lib/neutral/Format.mjs +3 -3
- package/dist/lib/neutral/JsonSchema.mjs +9 -9
- package/dist/lib/neutral/Obj.mjs +38 -15
- package/dist/lib/neutral/Order.mjs +1 -1
- package/dist/lib/neutral/Query.mjs +21 -9
- package/dist/lib/neutral/Ref.mjs +9 -7
- package/dist/lib/neutral/Relation.mjs +21 -11
- package/dist/lib/neutral/SchemaRegistry.mjs +1 -1
- package/dist/lib/neutral/Tag.mjs +14 -10
- package/dist/lib/neutral/Type.mjs +13 -23
- package/dist/lib/neutral/{chunk-HMOXCO27.mjs → chunk-46QNGNTY.mjs} +8 -3
- package/dist/lib/neutral/chunk-46QNGNTY.mjs.map +7 -0
- package/dist/lib/neutral/chunk-5VKHCUDA.mjs +299 -0
- package/dist/lib/neutral/chunk-5VKHCUDA.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-CUDIBUM4.mjs → chunk-6URFBQJH.mjs} +104 -25
- package/dist/lib/neutral/chunk-6URFBQJH.mjs.map +7 -0
- package/dist/lib/neutral/chunk-7SQD3FRZ.mjs +159 -0
- package/dist/lib/neutral/chunk-7SQD3FRZ.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-4L6DOFXP.mjs → chunk-BNCCGLJN.mjs} +1 -1
- package/dist/lib/neutral/{chunk-4L6DOFXP.mjs.map → chunk-BNCCGLJN.mjs.map} +1 -1
- package/dist/lib/neutral/{chunk-62DWJ6CE.mjs → chunk-DQYLD2RB.mjs} +14 -14
- package/dist/lib/neutral/chunk-DQYLD2RB.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-3ZEAZF7T.mjs → chunk-E5PBQJWV.mjs} +8 -4
- 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-SU2LVM7J.mjs → chunk-FW7UJX25.mjs} +1701 -2713
- package/dist/lib/neutral/chunk-FW7UJX25.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-4TT624YA.mjs → chunk-GZQTCRJB.mjs} +2 -2
- package/dist/lib/neutral/{chunk-4TT624YA.mjs.map → chunk-GZQTCRJB.mjs.map} +1 -1
- package/dist/lib/neutral/chunk-HBJ7JT5A.mjs +120 -0
- package/dist/lib/neutral/chunk-HBJ7JT5A.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-IP2GHXWA.mjs → chunk-OLFCVPOO.mjs} +5 -5
- package/dist/lib/neutral/chunk-OLFCVPOO.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-VB5HVDCA.mjs → chunk-T2JOLN37.mjs} +72 -5
- package/dist/lib/neutral/chunk-T2JOLN37.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-YQYMWZAD.mjs → chunk-TBKX6JQO.mjs} +4 -4
- package/dist/lib/neutral/chunk-TBKX6JQO.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-RPB6V4BE.mjs → chunk-UBEZSGXY.mjs} +14 -1
- package/dist/lib/neutral/chunk-UBEZSGXY.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-ROKO4RKJ.mjs → chunk-UI6MWK5W.mjs} +2 -2
- package/dist/lib/neutral/chunk-UI6MWK5W.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-XMIDBDE6.mjs → chunk-UPWIIW2V.mjs} +11 -56
- package/dist/lib/neutral/chunk-UPWIIW2V.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-6QPSGMEF.mjs → chunk-WVLOCXB5.mjs} +32 -8
- package/dist/lib/neutral/chunk-WVLOCXB5.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-VR4A4WGG.mjs → chunk-YSLSJ7QS.mjs} +72 -23
- package/dist/lib/neutral/chunk-YSLSJ7QS.mjs.map +7 -0
- package/dist/lib/neutral/chunk-ZGVZNBBJ.mjs +415 -0
- package/dist/lib/neutral/chunk-ZGVZNBBJ.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-NWUO5FKZ.mjs → chunk-ZIXGDU6F.mjs} +8 -2
- package/dist/lib/neutral/chunk-ZIXGDU6F.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +43 -26
- package/dist/lib/neutral/internal/index.mjs +56 -38
- package/dist/lib/neutral/meta.json +1 -1
- package/dist/lib/neutral/testing/index.mjs +42 -34
- package/dist/lib/neutral/testing/index.mjs.map +3 -3
- 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 +86 -84
- 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 +41 -15
- package/dist/types/src/Entity.d.ts.map +1 -1
- package/dist/types/src/Err.d.ts +43 -0
- package/dist/types/src/Err.d.ts.map +1 -1
- 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 +32 -5
- package/dist/types/src/Filter.d.ts.map +1 -1
- 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 +8 -3
- package/dist/types/src/Hypergraph.d.ts.map +1 -1
- 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 +172 -44
- package/dist/types/src/Obj.d.ts.map +1 -1
- package/dist/types/src/Order.d.ts.map +1 -1
- package/dist/types/src/Query.d.ts +109 -15
- package/dist/types/src/Query.d.ts.map +1 -1
- package/dist/types/src/Ref.d.ts +58 -10
- package/dist/types/src/Ref.d.ts.map +1 -1
- package/dist/types/src/Relation.d.ts +74 -28
- package/dist/types/src/Relation.d.ts.map +1 -1
- package/dist/types/src/SchemaRegistry.d.ts +4 -4
- package/dist/types/src/SchemaRegistry.d.ts.map +1 -1
- package/dist/types/src/Tag.d.ts +4 -3
- package/dist/types/src/Tag.d.ts.map +1 -1
- package/dist/types/src/Type.d.ts +51 -180
- package/dist/types/src/Type.d.ts.map +1 -1
- 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 +5 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/internal/{annotations → Annotation}/annotations.d.ts +69 -8
- 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/{api → Annotation}/sorting.d.ts +1 -1
- package/dist/types/src/internal/Annotation/sorting.d.ts.map +1 -0
- package/dist/types/src/internal/{annotations → Annotation}/util.d.ts +13 -1
- package/dist/types/src/internal/Annotation/util.d.ts.map +1 -0
- package/dist/types/src/internal/{api/entity.d.ts → Entity/api.d.ts} +2 -2
- package/dist/types/src/internal/Entity/api.d.ts.map +1 -0
- package/dist/types/src/internal/{entities → Entity}/entity.d.ts +3 -3
- package/dist/types/src/internal/Entity/entity.d.ts.map +1 -0
- package/dist/types/src/internal/{entities → Entity}/index.d.ts +2 -0
- package/dist/types/src/internal/Entity/index.d.ts.map +1 -0
- package/dist/types/src/internal/{entities → Entity}/model.d.ts +4 -26
- package/dist/types/src/internal/Entity/model.d.ts.map +1 -0
- package/dist/types/src/internal/{entities → Entity}/object.d.ts +2 -2
- package/dist/types/src/internal/Entity/object.d.ts.map +1 -0
- package/dist/types/src/internal/{entities → Entity}/relation.d.ts +3 -30
- 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/{api → Entity}/version.d.ts +1 -1
- 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/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/Format/select.d.ts.map +1 -0
- package/dist/types/src/internal/Format/string.d.ts.map +1 -0
- package/dist/types/src/internal/{formats → Format}/types.d.ts +1 -1
- 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 +19 -19
- package/dist/types/src/internal/JsonSchema/json-schema-type.d.ts.map +1 -0
- 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.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 +2 -2
- 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/Obj/index.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/inspect.d.ts.map +1 -0
- package/dist/types/src/internal/{object → Obj}/json-serializer.d.ts +13 -5
- 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/{object → Obj}/set-value.d.ts +1 -1
- package/dist/types/src/internal/Obj/set-value.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/set-value.test.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/snapshot.d.ts.map +1 -0
- package/dist/types/src/internal/{object → Obj}/typed-object.d.ts +4 -4
- 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 +1 -1
- package/dist/types/src/internal/Ref/ref-array.d.ts.map +1 -0
- package/dist/types/src/internal/{ref → Ref}/ref.d.ts +16 -3
- 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/{schema → Type}/compose.d.ts +1 -1
- 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 +8 -7
- package/dist/types/src/internal/Type/echo-schema.d.ts.map +1 -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/{schema → Type}/persistent-schema.d.ts +2 -2
- package/dist/types/src/internal/Type/persistent-schema.d.ts.map +1 -0
- package/dist/types/src/internal/{api → common/api}/index.d.ts +0 -4
- package/dist/types/src/internal/common/api/index.d.ts.map +1 -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.map +1 -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.map +1 -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.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.map +1 -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.map +1 -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.map +1 -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.map +1 -0
- package/dist/types/src/internal/{proxy → common/proxy}/reactive.d.ts +1 -1
- 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.map +1 -0
- package/dist/types/src/internal/{proxy → common/proxy}/typed-handler.d.ts +2 -1
- 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 +1 -0
- package/dist/types/src/internal/common/types/base.d.ts.map +1 -0
- package/dist/types/src/internal/{types → common/types}/entity.d.ts +2 -2
- 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 +2 -1
- 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 +9 -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 +19 -18
- package/dist/types/src/testing/test-schema.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +24 -14
- package/src/Annotation.ts +31 -1
- package/src/Collection.ts +37 -0
- package/src/Database.ts +167 -173
- package/src/Dataset.ts +26 -0
- package/src/Entity.ts +73 -54
- package/src/Err.ts +22 -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 +81 -7
- package/src/Format.ts +3 -3
- package/src/Hypergraph.ts +9 -4
- package/src/JsonSchema.ts +14 -4
- package/src/Obj.test.ts +166 -13
- package/src/Obj.ts +404 -142
- package/src/Order.ts +3 -1
- package/src/Query.test.ts +339 -15
- package/src/Query.ts +275 -24
- package/src/Ref.ts +64 -11
- package/src/Relation.test.ts +8 -2
- package/src/Relation.ts +165 -131
- package/src/SchemaRegistry.ts +5 -4
- package/src/Tag.ts +6 -5
- package/src/Type.test.ts +10 -10
- package/src/Type.ts +70 -303
- package/src/View.ts +107 -0
- package/src/hierarchy.test.ts +33 -0
- package/src/index.ts +5 -0
- package/src/internal/{annotations → Annotation}/annotations.test.ts +56 -7
- package/src/internal/{annotations → Annotation}/annotations.ts +134 -16
- package/src/internal/{annotations → Annotation}/index.ts +1 -0
- package/src/internal/{api → Annotation}/sorting.ts +2 -4
- package/src/internal/{annotations → Annotation}/util.ts +14 -1
- package/src/internal/{api/entity.ts → Entity/api.ts} +3 -2
- package/src/internal/{entities → Entity}/entity.ts +6 -4
- package/src/internal/{entities → Entity}/index.ts +2 -0
- package/src/internal/{entities → Entity}/model.ts +17 -42
- package/src/internal/{entities → Entity}/object.ts +2 -3
- package/src/internal/{entities → Entity}/relation.ts +19 -36
- package/src/internal/{api → Entity}/version.ts +2 -2
- package/src/internal/{formats → Format}/date.test.ts +1 -2
- package/src/internal/{formats → Format}/format.test.ts +1 -2
- package/src/internal/{formats → Format}/types.ts +3 -3
- package/src/internal/{json-schema → JsonSchema}/annotations.ts +3 -3
- package/src/internal/{json-schema → JsonSchema}/json-schema-type.ts +4 -4
- package/src/internal/{json-schema → JsonSchema}/json-schema.test.ts +48 -49
- package/src/internal/{json-schema → JsonSchema}/json-schema.ts +6 -5
- package/src/internal/{object → Obj}/clone.ts +3 -3
- 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 +5 -6
- package/src/internal/{object → Obj}/deleted.ts +2 -2
- package/src/internal/{object → Obj}/inspect.ts +2 -2
- package/src/internal/{object → Obj}/json-serializer.test.ts +31 -9
- package/src/internal/{object → Obj}/json-serializer.ts +58 -24
- package/src/internal/{object → Obj}/schema-validator.ts +1 -1
- package/src/internal/{object → Obj}/set-value.test.ts +24 -24
- package/src/internal/{object → Obj}/set-value.ts +2 -2
- package/src/internal/Obj/snapshot.ts +105 -0
- package/src/internal/{object → Obj}/typed-object.test.ts +3 -3
- package/src/internal/{object → Obj}/typed-object.ts +4 -4
- package/src/internal/Query.ts +134 -0
- package/src/internal/{ref → Ref}/ref-array.ts +1 -2
- package/src/internal/{ref → Ref}/ref.test.ts +4 -5
- package/src/internal/{ref → Ref}/ref.ts +27 -4
- package/src/internal/{schema → Type}/compose.test.ts +5 -6
- package/src/internal/{schema → Type}/compose.ts +1 -1
- package/src/internal/{schema → Type}/echo-schema.ts +11 -11
- package/src/internal/{schema → Type}/manipulation.ts +1 -1
- package/src/internal/{schema → Type}/persistent-schema.ts +10 -4
- package/src/internal/{README.md → common/README.md} +1 -1
- package/src/internal/{api → common/api}/index.ts +0 -4
- package/src/internal/common/index.ts +7 -0
- package/src/internal/{proxy → common/proxy}/change.test.ts +65 -65
- package/src/internal/{proxy → common/proxy}/handler.test.ts +2 -4
- package/src/internal/{proxy → common/proxy}/json-serializer.ts +6 -3
- package/src/internal/{proxy → common/proxy}/make-object.ts +13 -4
- package/src/internal/{proxy → common/proxy}/ownership.ts +0 -1
- package/src/internal/{proxy → common/proxy}/reactive.ts +1 -2
- package/src/internal/{proxy → common/proxy}/schema.test.ts +10 -10
- package/src/internal/{proxy → common/proxy}/typed-handler.test.ts +6 -7
- package/src/internal/{proxy → common/proxy}/typed-handler.ts +11 -6
- package/src/internal/{proxy → common/proxy}/typed-object.test.ts +4 -5
- package/src/internal/{types → common/types}/base.ts +1 -1
- package/src/internal/{types → common/types}/entity.ts +2 -2
- package/src/internal/{types → common/types}/index.ts +1 -0
- package/src/internal/{types → common/types}/meta.ts +3 -1
- 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 +9 -31
- package/src/testing/api.test.ts +4 -5
- package/src/testing/test-data.ts +0 -1
- package/src/testing/test-schema.ts +20 -18
- package/dist/lib/neutral/chunk-2MTHJ5UW.mjs +0 -203
- package/dist/lib/neutral/chunk-2MTHJ5UW.mjs.map +0 -7
- package/dist/lib/neutral/chunk-3ZEAZF7T.mjs.map +0 -7
- package/dist/lib/neutral/chunk-62DWJ6CE.mjs.map +0 -7
- package/dist/lib/neutral/chunk-6QPSGMEF.mjs.map +0 -7
- package/dist/lib/neutral/chunk-CUDIBUM4.mjs.map +0 -7
- package/dist/lib/neutral/chunk-HMOXCO27.mjs.map +0 -7
- package/dist/lib/neutral/chunk-IP2GHXWA.mjs.map +0 -7
- package/dist/lib/neutral/chunk-KRHDMXSU.mjs +0 -132
- package/dist/lib/neutral/chunk-KRHDMXSU.mjs.map +0 -7
- package/dist/lib/neutral/chunk-NWUO5FKZ.mjs.map +0 -7
- package/dist/lib/neutral/chunk-ROKO4RKJ.mjs.map +0 -7
- package/dist/lib/neutral/chunk-RPB6V4BE.mjs.map +0 -7
- package/dist/lib/neutral/chunk-SU2LVM7J.mjs.map +0 -7
- package/dist/lib/neutral/chunk-VB5HVDCA.mjs.map +0 -7
- package/dist/lib/neutral/chunk-VR4A4WGG.mjs.map +0 -7
- package/dist/lib/neutral/chunk-X2MPMYYN.mjs +0 -13
- package/dist/lib/neutral/chunk-X2MPMYYN.mjs.map +0 -7
- package/dist/lib/neutral/chunk-XK5OUUBY.mjs +0 -157
- package/dist/lib/neutral/chunk-XK5OUUBY.mjs.map +0 -7
- package/dist/lib/neutral/chunk-XMIDBDE6.mjs.map +0 -7
- package/dist/lib/neutral/chunk-YQYMWZAD.mjs.map +0 -7
- 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/api/annotations.d.ts +0 -23
- package/dist/types/src/internal/api/annotations.d.ts.map +0 -1
- package/dist/types/src/internal/api/entity.d.ts.map +0 -1
- package/dist/types/src/internal/api/index.d.ts.map +0 -1
- package/dist/types/src/internal/api/meta.d.ts.map +0 -1
- package/dist/types/src/internal/api/sorting.d.ts.map +0 -1
- package/dist/types/src/internal/api/version.d.ts.map +0 -1
- package/dist/types/src/internal/entities/entity.d.ts.map +0 -1
- 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.map +0 -1
- 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/clone.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.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 +0 -2
- 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/set-value.d.ts.map +0 -1
- package/dist/types/src/internal/object/set-value.test.d.ts.map +0 -1
- package/dist/types/src/internal/object/snapshot.d.ts.map +0 -1
- 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/change-context.d.ts.map +0 -1
- package/dist/types/src/internal/proxy/change.test.d.ts.map +0 -1
- package/dist/types/src/internal/proxy/define-hidden-property.d.ts.map +0 -1
- package/dist/types/src/internal/proxy/errors.d.ts.map +0 -1
- package/dist/types/src/internal/proxy/event-batch.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.map +0 -1
- package/dist/types/src/internal/proxy/json-serializer.d.ts.map +0 -1
- package/dist/types/src/internal/proxy/make-object.d.ts.map +0 -1
- package/dist/types/src/internal/proxy/ownership.d.ts.map +0 -1
- package/dist/types/src/internal/proxy/proxy-types.d.ts.map +0 -1
- package/dist/types/src/internal/proxy/proxy-utils.d.ts.map +0 -1
- package/dist/types/src/internal/proxy/reactive-array.d.ts.map +0 -1
- package/dist/types/src/internal/proxy/reactive.d.ts.map +0 -1
- package/dist/types/src/internal/proxy/schema-validator.d.ts.map +0 -1
- package/dist/types/src/internal/proxy/schema.test.d.ts.map +0 -1
- package/dist/types/src/internal/proxy/symbols.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.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.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.map +0 -1
- package/dist/types/src/internal/types/base.d.ts.map +0 -1
- 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/src/internal/api/annotations.ts +0 -60
- package/src/internal/object/snapshot.ts +0 -70
- /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.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/{formats → Format}/select.d.ts +0 -0
- /package/dist/types/src/internal/{formats → Format}/string.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.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}/clone.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}/index.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}/set-value.test.d.ts +0 -0
- /package/dist/types/src/internal/{object → Obj}/snapshot.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}/index.d.ts +0 -0
- /package/dist/types/src/internal/{schema → Type}/manipulation.d.ts +0 -0
- /package/dist/types/src/internal/{api → common/api}/meta.d.ts +0 -0
- /package/dist/types/src/internal/{proxy → common/proxy}/change-context.d.ts +0 -0
- /package/dist/types/src/internal/{proxy → common/proxy}/change.test.d.ts +0 -0
- /package/dist/types/src/internal/{proxy → common/proxy}/define-hidden-property.d.ts +0 -0
- /package/dist/types/src/internal/{proxy → common/proxy}/errors.d.ts +0 -0
- /package/dist/types/src/internal/{proxy → common/proxy}/event-batch.d.ts +0 -0
- /package/dist/types/src/internal/{proxy → common/proxy}/handler.test.d.ts +0 -0
- /package/dist/types/src/internal/{proxy → common/proxy}/index.d.ts +0 -0
- /package/dist/types/src/internal/{proxy → common/proxy}/json-serializer.d.ts +0 -0
- /package/dist/types/src/internal/{proxy → common/proxy}/make-object.d.ts +0 -0
- /package/dist/types/src/internal/{proxy → common/proxy}/ownership.d.ts +0 -0
- /package/dist/types/src/internal/{proxy → common/proxy}/proxy-types.d.ts +0 -0
- /package/dist/types/src/internal/{proxy → common/proxy}/proxy-utils.d.ts +0 -0
- /package/dist/types/src/internal/{proxy → common/proxy}/reactive-array.d.ts +0 -0
- /package/dist/types/src/internal/{proxy → 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}/symbols.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}/format.ts +0 -0
- /package/src/internal/{formats → Format}/index.ts +0 -0
- /package/src/internal/{formats → Format}/number.ts +0 -0
- /package/src/internal/{formats → Format}/object.ts +0 -0
- /package/src/internal/{formats → Format}/select.ts +0 -0
- /package/src/internal/{formats → Format}/string.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/{json-schema → JsonSchema}/json-schema-normalize.ts +0 -0
- /package/src/internal/{object → Obj}/ids.ts +0 -0
- /package/src/internal/{object → Obj}/index.ts +0 -0
- /package/src/internal/{object → Obj}/schema-validator.test.ts +0 -0
- /package/src/internal/{ref → Ref}/index.ts +0 -0
- /package/src/internal/{schema → Type}/index.ts +0 -0
- /package/src/internal/{api → common/api}/meta.ts +0 -0
- /package/src/internal/{proxy → common/proxy}/change-context.ts +0 -0
- /package/src/internal/{proxy → common/proxy}/define-hidden-property.ts +0 -0
- /package/src/internal/{proxy → common/proxy}/errors.ts +0 -0
- /package/src/internal/{proxy → common/proxy}/event-batch.ts +0 -0
- /package/src/internal/{proxy → common/proxy}/index.ts +0 -0
- /package/src/internal/{proxy → common/proxy}/proxy-types.ts +0 -0
- /package/src/internal/{proxy → common/proxy}/proxy-utils.ts +0 -0
- /package/src/internal/{proxy → common/proxy}/reactive-array.ts +0 -0
- /package/src/internal/{proxy → common/proxy}/schema-validator.ts +0 -0
- /package/src/internal/{proxy → common/proxy}/symbols.ts +0 -0
|
@@ -6,14 +6,14 @@ import * as Schema from 'effect/Schema';
|
|
|
6
6
|
import * as SchemaAST from 'effect/SchemaAST';
|
|
7
7
|
import { describe, expect, test } from 'vitest';
|
|
8
8
|
|
|
9
|
-
import { createEchoSchema } from '
|
|
10
|
-
import { PropertyMeta, getPropertyMetaAnnotation, getTypeAnnotation } from '
|
|
11
|
-
import { EchoObjectSchema } from '
|
|
9
|
+
import { createEchoSchema } from '../../../testing';
|
|
10
|
+
import { PropertyMeta, getPropertyMetaAnnotation, getTypeAnnotation } from '../../Annotation';
|
|
11
|
+
import { EchoObjectSchema } from '../../Entity';
|
|
12
12
|
|
|
13
13
|
// TODO(dmaretskyi): Comment.
|
|
14
14
|
const EmptySchemaType = Schema.Struct({}).pipe(
|
|
15
15
|
EchoObjectSchema({
|
|
16
|
-
typename: 'example.
|
|
16
|
+
typename: 'com.example.type.empty',
|
|
17
17
|
version: '0.1.0',
|
|
18
18
|
}),
|
|
19
19
|
);
|
|
@@ -27,7 +27,7 @@ describe('dynamic schema', () => {
|
|
|
27
27
|
field2: Schema.Boolean,
|
|
28
28
|
}).pipe(
|
|
29
29
|
EchoObjectSchema({
|
|
30
|
-
typename: 'example.
|
|
30
|
+
typename: 'com.example.type.test',
|
|
31
31
|
version: '0.1.0',
|
|
32
32
|
}),
|
|
33
33
|
);
|
|
@@ -44,7 +44,7 @@ describe('dynamic schema', () => {
|
|
|
44
44
|
field1: Schema.String,
|
|
45
45
|
}).pipe(
|
|
46
46
|
EchoObjectSchema({
|
|
47
|
-
typename: 'example.
|
|
47
|
+
typename: 'com.example.type.test',
|
|
48
48
|
version: '0.1.0',
|
|
49
49
|
}),
|
|
50
50
|
);
|
|
@@ -95,7 +95,7 @@ describe('dynamic schema', () => {
|
|
|
95
95
|
registered.updateFields({ field3: Schema.Boolean });
|
|
96
96
|
registered.removeFields(['field2']);
|
|
97
97
|
expect(getTypeAnnotation(registered)).to.deep.contain({
|
|
98
|
-
typename: 'example.
|
|
98
|
+
typename: 'com.example.type.empty',
|
|
99
99
|
version: '0.1.0',
|
|
100
100
|
});
|
|
101
101
|
expect(getPropertyMetaAnnotation(registered.getProperties()[0], metaNamespace)).to.deep.eq(metaInfo);
|
|
@@ -111,7 +111,7 @@ describe('dynamic schema', () => {
|
|
|
111
111
|
});
|
|
112
112
|
|
|
113
113
|
// First update.
|
|
114
|
-
const newTypename1 = 'example.
|
|
114
|
+
const newTypename1 = 'com.example.type.individual';
|
|
115
115
|
registered.updateTypename(newTypename1);
|
|
116
116
|
|
|
117
117
|
// Basic typename update checks.
|
|
@@ -132,13 +132,13 @@ describe('dynamic schema', () => {
|
|
|
132
132
|
expect(nameMeta).toEqual({ maxLength: 10 });
|
|
133
133
|
|
|
134
134
|
// Second update to ensure multiple updates work.
|
|
135
|
-
const newTypename2 = 'example.
|
|
135
|
+
const newTypename2 = 'com.example.type.person';
|
|
136
136
|
registered.updateTypename(newTypename2);
|
|
137
137
|
expect(registered.typename).toBe(newTypename2);
|
|
138
138
|
expect(registered.jsonSchema.$id).toBe(`dxn:type:${newTypename2}`);
|
|
139
139
|
expect(registered.jsonSchema.typename).toBe(newTypename2);
|
|
140
140
|
expect(getTypeAnnotation(registered)).to.deep.contain({
|
|
141
|
-
typename: 'example.
|
|
141
|
+
typename: 'com.example.type.person',
|
|
142
142
|
version: '0.1.0',
|
|
143
143
|
});
|
|
144
144
|
});
|
|
@@ -5,12 +5,11 @@
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
import { describe, expect, test } from 'vitest';
|
|
7
7
|
|
|
8
|
-
import { TestSchema } from '
|
|
9
|
-
import { EchoObjectSchema } from '
|
|
10
|
-
import { setValue } from '
|
|
11
|
-
import { Ref } from '
|
|
8
|
+
import { TestSchema } from '../../../testing';
|
|
9
|
+
import { EchoObjectSchema } from '../../Entity';
|
|
10
|
+
import { setValue } from '../../Obj';
|
|
11
|
+
import { Ref } from '../../Ref';
|
|
12
12
|
import { foreignKey, getMeta } from '../types';
|
|
13
|
-
|
|
14
13
|
import { makeObject } from './make-object';
|
|
15
14
|
import { change, subscribe } from './reactive';
|
|
16
15
|
|
|
@@ -40,10 +39,10 @@ describe('complex schema validations', () => {
|
|
|
40
39
|
|
|
41
40
|
test('references', () => {
|
|
42
41
|
const Foo = Schema.Struct({ field: Schema.String }).pipe(
|
|
43
|
-
EchoObjectSchema({ typename: 'example.
|
|
42
|
+
EchoObjectSchema({ typename: 'com.example.type.foo', version: '0.1.0' }),
|
|
44
43
|
);
|
|
45
44
|
const Bar = Schema.Struct({ fooRef: Ref(Foo) }).pipe(
|
|
46
|
-
EchoObjectSchema({ typename: 'example.
|
|
45
|
+
EchoObjectSchema({ typename: 'com.example.type.bar', version: '0.1.0' }),
|
|
47
46
|
);
|
|
48
47
|
const field = 'hello';
|
|
49
48
|
expect(() => makeObject(Bar, { fooRef: { id: '1', field } as any })).to.throw();
|
|
@@ -2,19 +2,16 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type InspectOptionsStylized } from 'node:util';
|
|
6
|
-
|
|
7
5
|
import * as Schema from 'effect/Schema';
|
|
8
6
|
import * as SchemaAST from 'effect/SchemaAST';
|
|
7
|
+
import { type InspectOptionsStylized } from 'node:util';
|
|
9
8
|
|
|
10
9
|
import { Event } from '@dxos/async';
|
|
11
10
|
import { inspectCustom } from '@dxos/debug';
|
|
12
11
|
import { invariant } from '@dxos/invariant';
|
|
13
12
|
|
|
14
|
-
import { getSchemaDXN } from '
|
|
15
|
-
import { ObjectDeletedId } from '../
|
|
16
|
-
import { SchemaId, TypeId } from '../types';
|
|
17
|
-
|
|
13
|
+
import { getSchemaDXN } from '../../Annotation';
|
|
14
|
+
import { ObjectDeletedId, ParentId, SchemaId, TypeId } from '../types';
|
|
18
15
|
import { executeChange, isInChangeContext, queueNotification } from './change-context';
|
|
19
16
|
import { defineHiddenProperty } from './define-hidden-property';
|
|
20
17
|
import { createPropertyDeleteError } from './errors';
|
|
@@ -47,6 +44,7 @@ type ProxyTarget = {
|
|
|
47
44
|
* Schema for the root.
|
|
48
45
|
*/
|
|
49
46
|
[SchemaId]: Schema.Schema.AnyNoContext;
|
|
47
|
+
[ParentId]?: any;
|
|
50
48
|
|
|
51
49
|
/**
|
|
52
50
|
* For modifications.
|
|
@@ -320,6 +318,10 @@ export class TypedReactiveHandler implements ReactiveHandler<ProxyTarget> {
|
|
|
320
318
|
): { echoRoot: object; preparedValue: any } {
|
|
321
319
|
const echoRoot = getEchoRoot(target);
|
|
322
320
|
|
|
321
|
+
if (prop === ParentId) {
|
|
322
|
+
return { echoRoot, preparedValue: value }; // Short-circuit for parent assignment.
|
|
323
|
+
}
|
|
324
|
+
|
|
323
325
|
// Check for cycles before assignment.
|
|
324
326
|
if (isValidProxyTarget(value) || isProxy(value)) {
|
|
325
327
|
if (wouldCreateCycle(echoRoot, value)) {
|
|
@@ -363,6 +365,9 @@ export class TypedReactiveHandler implements ReactiveHandler<ProxyTarget> {
|
|
|
363
365
|
}
|
|
364
366
|
|
|
365
367
|
private _validateValue(target: any, prop: string | symbol, value: any) {
|
|
368
|
+
if (prop === ParentId) {
|
|
369
|
+
return value;
|
|
370
|
+
}
|
|
366
371
|
const schema = SchemaValidator.getTargetPropertySchema(target, prop);
|
|
367
372
|
const _ = Schema.asserts(schema)(value);
|
|
368
373
|
if (isValidProxyTarget(value)) {
|
|
@@ -6,9 +6,8 @@ import * as Schema from 'effect/Schema';
|
|
|
6
6
|
import type * as Types from 'effect/Types';
|
|
7
7
|
import { describe, expect, test } from 'vitest';
|
|
8
8
|
|
|
9
|
-
import { EchoObjectSchema } from '
|
|
9
|
+
import { EchoObjectSchema } from '../../Entity';
|
|
10
10
|
import { getSchema } from '../types';
|
|
11
|
-
|
|
12
11
|
import { makeObject } from './make-object';
|
|
13
12
|
import { change } from './reactive';
|
|
14
13
|
|
|
@@ -16,7 +15,7 @@ const Organization = Schema.Struct({
|
|
|
16
15
|
name: Schema.String,
|
|
17
16
|
}).pipe(
|
|
18
17
|
EchoObjectSchema({
|
|
19
|
-
typename: 'example.
|
|
18
|
+
typename: 'com.example.type.organization',
|
|
20
19
|
version: '0.1.0',
|
|
21
20
|
}),
|
|
22
21
|
);
|
|
@@ -34,7 +33,7 @@ const Contact = Schema.Struct(
|
|
|
34
33
|
).pipe(
|
|
35
34
|
Schema.partial,
|
|
36
35
|
EchoObjectSchema({
|
|
37
|
-
typename: 'example.
|
|
36
|
+
typename: 'com.example.type.person',
|
|
38
37
|
version: '0.1.0',
|
|
39
38
|
}),
|
|
40
39
|
);
|
|
@@ -101,7 +100,7 @@ describe('EchoObjectSchema class DSL', () => {
|
|
|
101
100
|
meta: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.Any })),
|
|
102
101
|
}).pipe(
|
|
103
102
|
EchoObjectSchema({
|
|
104
|
-
typename: 'dxos.
|
|
103
|
+
typename: 'org.dxos.type.functionTrigger',
|
|
105
104
|
version: '0.1.0',
|
|
106
105
|
}),
|
|
107
106
|
);
|
|
@@ -14,12 +14,12 @@ import { type ATTR_META, type ObjectMeta } from './meta';
|
|
|
14
14
|
* NOTE: This describes the base type for all database objects.
|
|
15
15
|
* It is stricter than `T extends {}` or `T extends object`.
|
|
16
16
|
*/
|
|
17
|
-
// TODO(burdon): Make internal.
|
|
18
17
|
// TODO(burdon): Prefer Record<string, unknown>.
|
|
19
18
|
export type AnyProperties = Record<string, any>;
|
|
20
19
|
|
|
21
20
|
/**
|
|
22
21
|
* Canonical type for all ECHO entities (objects and relations).
|
|
22
|
+
* @depreacted Remove, use Entity.Unknown instead.
|
|
23
23
|
*/
|
|
24
24
|
// TODO(wittjosiah): Remove. Prefer higher level types (e.g. Entity.Unknown).
|
|
25
25
|
export interface AnyEntity {
|
|
@@ -43,10 +43,10 @@ export enum EntityKind {
|
|
|
43
43
|
export const EntityKindSchema = Schema.Enums(EntityKind);
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
|
-
* Typename for generic object references (Type.Obj /
|
|
46
|
+
* Typename for generic object references (Type.Obj / Ref.Ref(Obj.Unknown)).
|
|
47
47
|
* Used when referencing any object without a specific schema.
|
|
48
48
|
*/
|
|
49
|
-
export const ANY_OBJECT_TYPENAME = 'dxos.
|
|
49
|
+
export const ANY_OBJECT_TYPENAME = 'org.dxos.schema.anyObject';
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* Version for generic object references.
|
|
@@ -8,6 +8,7 @@ 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 type * as Entity from '../../../Entity';
|
|
11
12
|
import { type AnyProperties } from './base';
|
|
12
13
|
|
|
13
14
|
/**
|
|
@@ -18,7 +19,7 @@ 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
|
|
@@ -35,6 +36,7 @@ export const ObjectMetaSchema = Schema.Struct({
|
|
|
35
36
|
*/
|
|
36
37
|
// TODO(dmaretskyi): Has to be optional for compatibility with old data.
|
|
37
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.
|
|
38
40
|
tags: Schema.optional(Schema.Array(Schema.String)),
|
|
39
41
|
});
|
|
40
42
|
|
|
@@ -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
|
@@ -5,35 +5,13 @@
|
|
|
5
5
|
// TODO(burdon): Import directly (not part of ECHO API).
|
|
6
6
|
export { JsonPath, JsonProp, getValue, splitJsonPath } from '@dxos/effect';
|
|
7
7
|
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './
|
|
10
|
-
export * from './
|
|
11
|
-
export * from './
|
|
12
|
-
export * from './
|
|
13
|
-
export * from './ref';
|
|
14
|
-
export * from './types';
|
|
15
|
-
|
|
8
|
+
export * from './Annotation';
|
|
9
|
+
export * from './common';
|
|
10
|
+
export * from './Entity';
|
|
11
|
+
export * from './Format';
|
|
12
|
+
export * from './JsonSchema';
|
|
16
13
|
// TODO(wittjosiah): Required to ensure types are portable (need to export all types required for downstream inference).
|
|
17
|
-
export * from './
|
|
18
|
-
export * from './
|
|
19
|
-
export * from './
|
|
20
|
-
|
|
21
|
-
// export {
|
|
22
|
-
// createObject,
|
|
23
|
-
// createQueueDXN,
|
|
24
|
-
// isDeleted,
|
|
25
|
-
// objectFromJSON,
|
|
26
|
-
// objectToJSON,
|
|
27
|
-
// setRefResolverOnData,
|
|
28
|
-
// SchemaValidator,
|
|
29
|
-
// TypedObject,
|
|
30
|
-
// } from './object';
|
|
31
|
-
// export { makeObject } from './proxy';
|
|
32
|
-
// export {
|
|
33
|
-
// type BaseSchema,
|
|
34
|
-
// EchoSchema,
|
|
35
|
-
// ImmutableSchema,
|
|
36
|
-
// RuntimeSchemaRegistry,
|
|
37
|
-
// PersistentSchema,
|
|
38
|
-
// isMutable,
|
|
39
|
-
// } 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,7 +8,6 @@ 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', () => {
|
|
@@ -17,11 +16,11 @@ describe('Experimental API review', () => {
|
|
|
17
16
|
const schema = Obj.getSchema(contact) ?? raise(new Error('No schema found'));
|
|
18
17
|
|
|
19
18
|
expect(Type.getDXN(schema)?.typename).to.eq(TestSchema.Person.typename);
|
|
20
|
-
expect(Type.getTypename(schema)).to.eq('example.
|
|
19
|
+
expect(Type.getTypename(schema)).to.eq('com.example.type.person');
|
|
21
20
|
expect(Type.getVersion(schema)).to.eq('0.1.0');
|
|
22
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
|
});
|
|
@@ -110,7 +109,7 @@ describe('Experimental API review', () => {
|
|
|
110
109
|
expect(expando.content).to.eq('Test');
|
|
111
110
|
|
|
112
111
|
// This should work: assign to Obj.Obj of the schema's instance type
|
|
113
|
-
const _typed: Obj.
|
|
112
|
+
const _typed: Obj.OfShape<TestSchema.Expando> = expando;
|
|
114
113
|
}
|
|
115
114
|
|
|
116
115
|
{
|
|
@@ -119,7 +118,7 @@ describe('Experimental API review', () => {
|
|
|
119
118
|
expect(person.name).to.eq('Test');
|
|
120
119
|
|
|
121
120
|
// This should work: assign to Obj.Obj of the schema's instance type
|
|
122
|
-
const _typed: Obj.
|
|
121
|
+
const _typed: Obj.OfShape<TestSchema.Person> = person;
|
|
123
122
|
}
|
|
124
123
|
});
|
|
125
124
|
});
|
package/src/testing/test-data.ts
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
+
import * as Obj from '../Obj';
|
|
8
|
+
import * as Ref from '../Ref';
|
|
7
9
|
import * as Type from '../Type';
|
|
8
10
|
|
|
9
11
|
export namespace TestSchema {
|
|
@@ -17,7 +19,7 @@ export namespace TestSchema {
|
|
|
17
19
|
*/
|
|
18
20
|
export const Expando = Schema.Struct({}, { key: Schema.String, value: Schema.Any }).pipe(
|
|
19
21
|
Type.object({
|
|
20
|
-
typename: 'example.
|
|
22
|
+
typename: 'com.example.type.expando',
|
|
21
23
|
version: '0.1.0',
|
|
22
24
|
}),
|
|
23
25
|
);
|
|
@@ -51,8 +53,8 @@ export namespace TestSchema {
|
|
|
51
53
|
nested: Nested,
|
|
52
54
|
nestedArray: Schema.Array(Nested),
|
|
53
55
|
nestedNullableArray: Schema.Array(Schema.Union(Nested, Schema.Null)),
|
|
54
|
-
reference: Schema.suspend(():
|
|
55
|
-
referenceArray: Schema.Array(Schema.suspend(():
|
|
56
|
+
reference: Schema.suspend((): Ref.RefSchema<Example> => Ref.Ref(Example)),
|
|
57
|
+
referenceArray: Schema.Array(Schema.suspend((): Ref.RefSchema<Example> => Ref.Ref(Example))),
|
|
56
58
|
classInstance: Schema.instanceOf(TestClass),
|
|
57
59
|
other: Schema.Any,
|
|
58
60
|
}).pipe(Schema.partial);
|
|
@@ -63,7 +65,7 @@ export namespace TestSchema {
|
|
|
63
65
|
/** @deprecated Use another test schema or create a specific local test schema. */
|
|
64
66
|
export const Example = ExampleSchema.pipe(
|
|
65
67
|
Type.object({
|
|
66
|
-
typename: 'example.
|
|
68
|
+
typename: 'com.example.type.example',
|
|
67
69
|
version: '0.1.0',
|
|
68
70
|
}),
|
|
69
71
|
);
|
|
@@ -87,7 +89,7 @@ export namespace TestSchema {
|
|
|
87
89
|
|
|
88
90
|
export const Message = MessageStruct.pipe(
|
|
89
91
|
Type.object({
|
|
90
|
-
typename: 'example.
|
|
92
|
+
typename: 'com.example.type.message',
|
|
91
93
|
version: '0.1.0',
|
|
92
94
|
}),
|
|
93
95
|
);
|
|
@@ -108,7 +110,7 @@ export namespace TestSchema {
|
|
|
108
110
|
),
|
|
109
111
|
}).pipe(
|
|
110
112
|
Type.object({
|
|
111
|
-
typename: 'example.
|
|
113
|
+
typename: 'com.example.type.organization',
|
|
112
114
|
version: '0.1.0',
|
|
113
115
|
}),
|
|
114
116
|
);
|
|
@@ -124,8 +126,8 @@ export namespace TestSchema {
|
|
|
124
126
|
username: Schema.String,
|
|
125
127
|
email: Schema.String,
|
|
126
128
|
age: Schema.Number.pipe(Schema.optional),
|
|
127
|
-
tasks: Schema.Array(Schema.suspend(():
|
|
128
|
-
employer: Schema.optional(
|
|
129
|
+
tasks: Schema.Array(Schema.suspend((): Ref.RefSchema<Task> => Ref.Ref(Task))),
|
|
130
|
+
employer: Schema.optional(Ref.Ref(Organization)),
|
|
129
131
|
address: Schema.Struct({
|
|
130
132
|
city: Schema.optional(Schema.String),
|
|
131
133
|
state: Schema.optional(Schema.String),
|
|
@@ -142,7 +144,7 @@ export namespace TestSchema {
|
|
|
142
144
|
}).pipe(
|
|
143
145
|
Schema.partial,
|
|
144
146
|
Type.object({
|
|
145
|
-
typename: 'example.
|
|
147
|
+
typename: 'com.example.type.person',
|
|
146
148
|
version: '0.1.0',
|
|
147
149
|
}),
|
|
148
150
|
);
|
|
@@ -157,14 +159,14 @@ export namespace TestSchema {
|
|
|
157
159
|
title: Schema.optional(Schema.String),
|
|
158
160
|
deadline: Schema.optional(Schema.String),
|
|
159
161
|
completed: Schema.optional(Schema.Boolean),
|
|
160
|
-
assignee: Schema.optional(
|
|
161
|
-
previous: Schema.optional(Schema.suspend(():
|
|
162
|
-
subTasks: Schema.optional(Schema.Array(Schema.suspend(():
|
|
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)))),
|
|
163
165
|
description: Schema.optional(Schema.String),
|
|
164
166
|
}).pipe(
|
|
165
167
|
Schema.partial,
|
|
166
168
|
Type.object({
|
|
167
|
-
typename: 'example.
|
|
169
|
+
typename: 'com.example.type.task',
|
|
168
170
|
version: '0.1.0',
|
|
169
171
|
}),
|
|
170
172
|
);
|
|
@@ -177,7 +179,7 @@ export namespace TestSchema {
|
|
|
177
179
|
|
|
178
180
|
export const HasManager = Schema.Struct({}).pipe(
|
|
179
181
|
Type.relation({
|
|
180
|
-
typename: 'example.
|
|
182
|
+
typename: 'com.example.type.has-manager',
|
|
181
183
|
version: '0.1.0',
|
|
182
184
|
source: Person,
|
|
183
185
|
target: Person,
|
|
@@ -195,7 +197,7 @@ export namespace TestSchema {
|
|
|
195
197
|
since: Schema.optional(Schema.String),
|
|
196
198
|
}).pipe(
|
|
197
199
|
Type.relation({
|
|
198
|
-
typename: 'example.
|
|
200
|
+
typename: 'com.example.type.employed-by',
|
|
199
201
|
version: '0.1.0',
|
|
200
202
|
source: Person,
|
|
201
203
|
target: Organization,
|
|
@@ -215,13 +217,13 @@ export namespace TestSchema {
|
|
|
215
217
|
}
|
|
216
218
|
|
|
217
219
|
export const Container = Schema.Struct({
|
|
218
|
-
objects: Schema.Array(
|
|
220
|
+
objects: Schema.Array(Ref.Ref(Obj.Unknown)),
|
|
219
221
|
records: Schema.Array(
|
|
220
222
|
Schema.partial(
|
|
221
223
|
Schema.Struct({
|
|
222
224
|
title: Schema.String,
|
|
223
225
|
description: Schema.String,
|
|
224
|
-
contacts: Schema.Array(
|
|
226
|
+
contacts: Schema.Array(Ref.Ref(Person)),
|
|
225
227
|
type: Schema.Enums(RecordType),
|
|
226
228
|
}),
|
|
227
229
|
),
|
|
@@ -229,7 +231,7 @@ export namespace TestSchema {
|
|
|
229
231
|
}).pipe(
|
|
230
232
|
Schema.partial,
|
|
231
233
|
Type.object({
|
|
232
|
-
typename: 'example.
|
|
234
|
+
typename: 'com.example.type.container',
|
|
233
235
|
version: '0.1.0',
|
|
234
236
|
}),
|
|
235
237
|
);
|