@dxos/echo 0.8.4-main.fffef41 → 0.8.4-staging.60fe92afc8
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/LICENSE +102 -5
- package/README.md +10 -11
- package/dist/lib/neutral/Annotation.mjs +68 -0
- package/dist/lib/neutral/Database.mjs +38 -0
- package/dist/lib/neutral/Entity.mjs +72 -0
- package/dist/lib/neutral/Err.mjs +12 -0
- package/dist/lib/neutral/Feed.mjs +54 -0
- package/dist/lib/neutral/Filter.mjs +70 -0
- package/dist/lib/neutral/Format.mjs +86 -0
- package/dist/lib/neutral/Format.mjs.map +7 -0
- package/dist/lib/neutral/JsonSchema.mjs +18 -0
- package/dist/lib/neutral/JsonSchema.mjs.map +7 -0
- package/dist/lib/neutral/Key.mjs +16 -0
- package/dist/lib/neutral/Key.mjs.map +7 -0
- package/dist/lib/neutral/Migration.mjs +18 -0
- package/dist/lib/neutral/Migration.mjs.map +7 -0
- package/dist/lib/neutral/Obj.mjs +122 -0
- package/dist/lib/neutral/Obj.mjs.map +7 -0
- package/dist/lib/neutral/Order.mjs +16 -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 +25 -0
- package/dist/lib/neutral/Ref.mjs.map +7 -0
- package/dist/lib/neutral/Registry.mjs +14 -0
- package/dist/lib/neutral/Registry.mjs.map +7 -0
- package/dist/lib/neutral/Relation.mjs +97 -0
- package/dist/lib/neutral/Relation.mjs.map +7 -0
- package/dist/lib/neutral/Scope.mjs +12 -0
- package/dist/lib/neutral/Scope.mjs.map +7 -0
- package/dist/lib/neutral/Tag.mjs +32 -0
- package/dist/lib/neutral/Tag.mjs.map +7 -0
- package/dist/lib/neutral/Type.mjs +65 -0
- package/dist/lib/neutral/Type.mjs.map +7 -0
- package/dist/lib/neutral/chunk-35INCYOE.mjs +7 -0
- package/dist/lib/neutral/chunk-35INCYOE.mjs.map +7 -0
- package/dist/lib/neutral/chunk-3PBP4V4O.mjs +101 -0
- package/dist/lib/neutral/chunk-3PBP4V4O.mjs.map +7 -0
- package/dist/lib/neutral/chunk-4ZUHOTCG.mjs +184 -0
- package/dist/lib/neutral/chunk-4ZUHOTCG.mjs.map +7 -0
- package/dist/lib/neutral/chunk-5SMDBFVB.mjs +108 -0
- package/dist/lib/neutral/chunk-5SMDBFVB.mjs.map +7 -0
- package/dist/lib/neutral/chunk-5SUJPHAE.mjs +34 -0
- package/dist/lib/neutral/chunk-5SUJPHAE.mjs.map +7 -0
- package/dist/lib/neutral/chunk-6M2Z6WBH.mjs +93 -0
- package/dist/lib/neutral/chunk-6M2Z6WBH.mjs.map +7 -0
- package/dist/lib/neutral/chunk-6YDI3J37.mjs +346 -0
- package/dist/lib/neutral/chunk-6YDI3J37.mjs.map +7 -0
- package/dist/lib/neutral/chunk-7FPIAJIV.mjs +2279 -0
- package/dist/lib/neutral/chunk-7FPIAJIV.mjs.map +7 -0
- package/dist/lib/neutral/chunk-7LOUAPYZ.mjs +25 -0
- package/dist/lib/neutral/chunk-7LOUAPYZ.mjs.map +7 -0
- package/dist/lib/neutral/chunk-7PI7C4EF.mjs +747 -0
- package/dist/lib/neutral/chunk-7PI7C4EF.mjs.map +7 -0
- package/dist/lib/neutral/chunk-BBFJWWAV.mjs +51 -0
- package/dist/lib/neutral/chunk-BBFJWWAV.mjs.map +7 -0
- package/dist/lib/neutral/chunk-EVK6XBXO.mjs +56 -0
- package/dist/lib/neutral/chunk-EVK6XBXO.mjs.map +7 -0
- package/dist/lib/neutral/chunk-IGK6FN65.mjs +27 -0
- package/dist/lib/neutral/chunk-IGK6FN65.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-LWXVKPPW.mjs +281 -0
- package/dist/lib/neutral/chunk-LWXVKPPW.mjs.map +7 -0
- package/dist/lib/neutral/chunk-MZ7K3MLL.mjs +48 -0
- package/dist/lib/neutral/chunk-MZ7K3MLL.mjs.map +7 -0
- package/dist/lib/neutral/chunk-O6BH7EPN.mjs +94 -0
- package/dist/lib/neutral/chunk-O6BH7EPN.mjs.map +7 -0
- package/dist/lib/neutral/chunk-QQIYS74I.mjs +336 -0
- package/dist/lib/neutral/chunk-QQIYS74I.mjs.map +7 -0
- package/dist/lib/neutral/chunk-R5W6DXR4.mjs +678 -0
- package/dist/lib/neutral/chunk-R5W6DXR4.mjs.map +7 -0
- package/dist/lib/neutral/chunk-RIVWNMSF.mjs +41 -0
- package/dist/lib/neutral/chunk-RIVWNMSF.mjs.map +7 -0
- package/dist/lib/neutral/chunk-SBVFRTST.mjs +160 -0
- package/dist/lib/neutral/chunk-SBVFRTST.mjs.map +7 -0
- package/dist/lib/neutral/chunk-T6E37YIP.mjs +251 -0
- package/dist/lib/neutral/chunk-T6E37YIP.mjs.map +7 -0
- package/dist/lib/neutral/chunk-TFEWTY5A.mjs +428 -0
- package/dist/lib/neutral/chunk-TFEWTY5A.mjs.map +7 -0
- package/dist/lib/neutral/chunk-TYGKCRMK.mjs +437 -0
- package/dist/lib/neutral/chunk-TYGKCRMK.mjs.map +7 -0
- package/dist/lib/neutral/chunk-UUP46KUQ.mjs +205 -0
- package/dist/lib/neutral/chunk-UUP46KUQ.mjs.map +7 -0
- package/dist/lib/neutral/chunk-WISOH2XH.mjs +36 -0
- package/dist/lib/neutral/chunk-WISOH2XH.mjs.map +7 -0
- package/dist/lib/neutral/chunk-WTQJHC75.mjs +395 -0
- package/dist/lib/neutral/chunk-WTQJHC75.mjs.map +7 -0
- package/dist/lib/neutral/chunk-WU3GIANS.mjs +31 -0
- package/dist/lib/neutral/chunk-WU3GIANS.mjs.map +7 -0
- package/dist/lib/neutral/chunk-ZGNNFYHS.mjs +132 -0
- package/dist/lib/neutral/chunk-ZGNNFYHS.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +111 -0
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/internal/index.mjs +539 -0
- package/dist/lib/neutral/internal/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/testing/index.mjs +458 -0
- package/dist/lib/neutral/testing/index.mjs.map +7 -0
- package/dist/types/src/Annotation.d.ts +128 -0
- package/dist/types/src/Annotation.d.ts.map +1 -0
- package/dist/types/src/Annotation.test.d.ts +2 -0
- package/dist/types/src/Annotation.test.d.ts.map +1 -0
- package/dist/types/src/Collection.d.ts +15 -0
- package/dist/types/src/Collection.d.ts.map +1 -0
- package/dist/types/src/Database.d.ts +208 -0
- package/dist/types/src/Database.d.ts.map +1 -0
- package/dist/types/src/Dataset.d.ts +29 -0
- package/dist/types/src/Dataset.d.ts.map +1 -0
- package/dist/types/src/Entity.d.ts +247 -0
- package/dist/types/src/Entity.d.ts.map +1 -0
- package/dist/types/src/Entity.test.d.ts +2 -0
- package/dist/types/src/Entity.test.d.ts.map +1 -0
- package/dist/types/src/Err.d.ts +107 -0
- package/dist/types/src/Err.d.ts.map +1 -0
- package/dist/types/src/Feed.d.ts +229 -0
- package/dist/types/src/Feed.d.ts.map +1 -0
- package/dist/types/src/Filter.d.ts +175 -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 +2 -0
- package/dist/types/src/Format.d.ts.map +1 -0
- package/dist/types/src/Hypergraph.d.ts +70 -0
- package/dist/types/src/Hypergraph.d.ts.map +1 -0
- package/dist/types/src/Json.d.ts +33 -0
- package/dist/types/src/Json.d.ts.map +1 -0
- package/dist/types/src/Json.test.d.ts +2 -0
- package/dist/types/src/Json.test.d.ts.map +1 -0
- package/dist/types/src/JsonSchema.d.ts +16 -0
- package/dist/types/src/JsonSchema.d.ts.map +1 -0
- package/dist/types/src/Key.d.ts +2 -1
- package/dist/types/src/Key.d.ts.map +1 -1
- package/dist/types/src/Migration.d.ts +72 -0
- package/dist/types/src/Migration.d.ts.map +1 -0
- package/dist/types/src/Obj.d.ts +483 -110
- 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 +26 -0
- package/dist/types/src/Order.d.ts.map +1 -0
- package/dist/types/src/Query.d.ts +231 -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 +101 -0
- package/dist/types/src/QueryResult.d.ts.map +1 -0
- package/dist/types/src/Ref.d.ts +69 -11
- package/dist/types/src/Ref.d.ts.map +1 -1
- package/dist/types/src/Registry.d.ts +131 -0
- package/dist/types/src/Registry.d.ts.map +1 -0
- package/dist/types/src/Relation.d.ts +321 -23
- 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/Scope.d.ts +35 -0
- package/dist/types/src/Scope.d.ts.map +1 -0
- package/dist/types/src/Tag.d.ts +26 -9
- package/dist/types/src/Tag.d.ts.map +1 -1
- package/dist/types/src/Type.d.ts +397 -106
- 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 +65 -0
- package/dist/types/src/View.d.ts.map +1 -0
- package/dist/types/src/exemplars.test.d.ts +2 -0
- package/dist/types/src/exemplars.test.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 +21 -5
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/internal/Annotation/annotations.d.ts +272 -0
- package/dist/types/src/internal/Annotation/annotations.d.ts.map +1 -0
- package/dist/types/src/internal/Annotation/annotations.test.d.ts.map +1 -0
- package/dist/types/src/internal/Annotation/dictionary.d.ts +24 -0
- package/dist/types/src/internal/Annotation/dictionary.d.ts.map +1 -0
- package/dist/types/src/internal/Annotation/entity-dictionary.d.ts +14 -0
- package/dist/types/src/internal/Annotation/entity-dictionary.d.ts.map +1 -0
- package/dist/types/src/internal/Annotation/index.d.ts +6 -0
- package/dist/types/src/internal/Annotation/index.d.ts.map +1 -0
- package/dist/types/src/internal/Annotation/sorting.d.ts +24 -0
- package/dist/types/src/internal/Annotation/sorting.d.ts.map +1 -0
- package/dist/types/src/internal/Annotation/util.d.ts +48 -0
- package/dist/types/src/internal/Annotation/util.d.ts.map +1 -0
- package/dist/types/src/internal/Entity/api.d.ts +27 -0
- package/dist/types/src/internal/Entity/api.d.ts.map +1 -0
- package/dist/types/src/internal/Entity/entity.d.ts +84 -0
- package/dist/types/src/internal/Entity/entity.d.ts.map +1 -0
- package/dist/types/src/internal/Entity/guard.d.ts +10 -0
- package/dist/types/src/internal/Entity/guard.d.ts.map +1 -0
- package/dist/types/src/internal/Entity/index.d.ts +10 -0
- package/dist/types/src/internal/Entity/index.d.ts.map +1 -0
- package/dist/types/src/internal/Entity/model.d.ts +59 -0
- package/dist/types/src/internal/Entity/model.d.ts.map +1 -0
- package/dist/types/src/internal/Entity/object.d.ts +18 -0
- package/dist/types/src/internal/Entity/object.d.ts.map +1 -0
- package/dist/types/src/internal/Entity/relation.d.ts +58 -0
- package/dist/types/src/internal/Entity/relation.d.ts.map +1 -0
- package/dist/types/src/internal/Entity/type-kind.d.ts +24 -0
- package/dist/types/src/internal/Entity/type-kind.d.ts.map +1 -0
- package/dist/types/src/internal/Entity/type-uri.d.ts +24 -0
- package/dist/types/src/internal/Entity/type-uri.d.ts.map +1 -0
- package/dist/types/src/internal/Entity/util.d.ts +2 -0
- package/dist/types/src/internal/Entity/util.d.ts.map +1 -0
- package/dist/types/src/internal/Entity/version.d.ts +42 -0
- package/dist/types/src/internal/Entity/version.d.ts.map +1 -0
- package/dist/types/src/internal/Format/date.d.ts.map +1 -0
- package/dist/types/src/internal/Format/date.test.d.ts.map +1 -0
- package/dist/types/src/internal/{formats → Format}/format.d.ts +7 -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/{formats → Format}/index.d.ts +2 -2
- 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/{formats → Format}/object.d.ts +3 -1
- package/dist/types/src/internal/Format/object.d.ts.map +1 -0
- package/dist/types/src/internal/{formats → Format}/select.d.ts +6 -4
- package/dist/types/src/internal/Format/select.d.ts.map +1 -0
- package/dist/types/src/internal/{formats → Format}/string.d.ts +4 -0
- package/dist/types/src/internal/Format/string.d.ts.map +1 -0
- package/dist/types/src/internal/{formats → Format}/types.d.ts +14 -10
- package/dist/types/src/internal/Format/types.d.ts.map +1 -0
- package/dist/types/src/internal/{json → JsonSchema}/annotations.d.ts +1 -1
- package/dist/types/src/internal/JsonSchema/annotations.d.ts.map +1 -0
- package/dist/types/src/internal/JsonSchema/effect-schema.test.d.ts.map +1 -0
- package/dist/types/src/internal/JsonSchema/index.d.ts +5 -0
- package/dist/types/src/internal/JsonSchema/index.d.ts.map +1 -0
- package/dist/types/src/internal/JsonSchema/json-schema-normalize.d.ts.map +1 -0
- package/dist/types/src/internal/{json-schema → JsonSchema}/json-schema-type.d.ts +136 -35
- package/dist/types/src/internal/JsonSchema/json-schema-type.d.ts.map +1 -0
- package/dist/types/src/internal/{json → JsonSchema}/json-schema.d.ts +6 -3
- 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/atoms.d.ts +38 -0
- package/dist/types/src/internal/Obj/atoms.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/clone.d.ts +8 -0
- package/dist/types/src/internal/Obj/clone.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/common.d.ts.map +1 -0
- package/dist/types/src/internal/{object/create.d.ts → Obj/create-object.d.ts} +15 -16
- package/dist/types/src/internal/Obj/create-object.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/create-object.test.d.ts +2 -0
- package/dist/types/src/internal/Obj/create-object.test.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/deleted.d.ts +6 -0
- package/dist/types/src/internal/Obj/deleted.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/index.d.ts +11 -0
- package/dist/types/src/internal/Obj/index.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/inspect.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/json-serializer.d.ts +45 -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/index.d.ts +2 -0
- package/dist/types/src/internal/Query/index.d.ts.map +1 -0
- package/dist/types/src/internal/Query/pretty.d.ts +10 -0
- package/dist/types/src/internal/Query/pretty.d.ts.map +1 -0
- package/dist/types/src/internal/Ref/atoms.d.ts +10 -0
- package/dist/types/src/internal/Ref/atoms.d.ts.map +1 -0
- package/dist/types/src/internal/Ref/index.d.ts.map +1 -0
- package/dist/types/src/internal/Ref/ref-array.d.ts +21 -0
- package/dist/types/src/internal/Ref/ref-array.d.ts.map +1 -0
- package/dist/types/src/internal/{ref → Ref}/ref.d.ts +88 -32
- 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/Ref/utils.d.ts +8 -0
- package/dist/types/src/internal/Ref/utils.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/Type/index.d.ts +3 -0
- package/dist/types/src/internal/Type/index.d.ts.map +1 -0
- package/dist/types/src/internal/{schema → Type}/manipulation.d.ts +0 -1
- package/dist/types/src/internal/Type/manipulation.d.ts.map +1 -0
- package/dist/types/src/internal/Type/type-schema.d.ts +52 -0
- package/dist/types/src/internal/Type/type-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 +45 -0
- package/dist/types/src/internal/common/api/meta.d.ts.map +1 -0
- package/dist/types/src/internal/common/index.d.ts +4 -0
- package/dist/types/src/internal/common/index.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/change-context.d.ts +55 -0
- package/dist/types/src/internal/common/proxy/change-context.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/change.test.d.ts +2 -0
- package/dist/types/src/internal/common/proxy/change.test.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/define-hidden-property.d.ts +5 -0
- package/dist/types/src/internal/common/proxy/define-hidden-property.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/errors.d.ts +19 -0
- package/dist/types/src/internal/common/proxy/errors.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/event-batch.d.ts +10 -0
- package/dist/types/src/internal/common/proxy/event-batch.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/handler.test.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/index.d.ts +14 -0
- package/dist/types/src/internal/common/proxy/index.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/json-serializer.d.ts +6 -0
- package/dist/types/src/internal/common/proxy/json-serializer.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/make-object.d.ts +20 -0
- package/dist/types/src/internal/common/proxy/make-object.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/ownership.d.ts +57 -0
- package/dist/types/src/internal/common/proxy/ownership.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/proxy-types.d.ts +18 -0
- package/dist/types/src/internal/common/proxy/proxy-types.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/proxy-utils.d.ts +47 -0
- package/dist/types/src/internal/common/proxy/proxy-utils.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/reactive-array.d.ts +8 -0
- package/dist/types/src/internal/common/proxy/reactive-array.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/reactive.d.ts +39 -0
- package/dist/types/src/internal/common/proxy/reactive.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/reactive.test.d.ts +2 -0
- package/dist/types/src/internal/common/proxy/reactive.test.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/common/proxy/typed-handler.d.ts +64 -0
- package/dist/types/src/internal/common/proxy/typed-handler.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/typed-handler.test.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/typed-object.test.d.ts.map +1 -0
- package/dist/types/src/internal/common/types/base.d.ts +27 -0
- package/dist/types/src/internal/common/types/base.d.ts.map +1 -0
- package/dist/types/src/internal/common/types/entity.d.ts +94 -0
- package/dist/types/src/internal/common/types/entity.d.ts.map +1 -0
- package/dist/types/src/internal/common/types/index.d.ts +7 -0
- package/dist/types/src/internal/common/types/index.d.ts.map +1 -0
- package/dist/types/src/internal/common/types/meta.d.ts +54 -0
- package/dist/types/src/internal/common/types/meta.d.ts.map +1 -0
- package/dist/types/src/internal/common/types/model-symbols.d.ts +65 -0
- package/dist/types/src/internal/common/types/model-symbols.d.ts.map +1 -0
- package/dist/types/src/internal/common/types/typename.d.ts +28 -0
- package/dist/types/src/internal/common/types/typename.d.ts.map +1 -0
- package/dist/types/src/internal/common/types/version.d.ts +15 -0
- package/dist/types/src/internal/common/types/version.d.ts.map +1 -0
- package/dist/types/src/internal/common/types/well-known-types.d.ts +11 -0
- package/dist/types/src/internal/common/types/well-known-types.d.ts.map +1 -0
- package/dist/types/src/internal/index.d.ts +10 -14
- package/dist/types/src/internal/index.d.ts.map +1 -1
- package/dist/types/src/{test → testing}/api.test.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +4 -3
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/registry.d.ts +9 -0
- package/dist/types/src/testing/registry.d.ts.map +1 -0
- package/dist/types/src/testing/test-data.d.ts +18 -0
- package/dist/types/src/testing/test-data.d.ts.map +1 -0
- package/dist/types/src/testing/test-schema.d.ts +298 -0
- package/dist/types/src/testing/test-schema.d.ts.map +1 -0
- package/dist/types/src/testing/util.d.ts +23 -0
- package/dist/types/src/testing/util.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +119 -66
- package/src/Annotation.test.ts +439 -0
- package/src/Annotation.ts +202 -0
- package/src/Collection.ts +33 -0
- package/src/Database.ts +345 -0
- package/src/Dataset.ts +34 -0
- package/src/Entity.test.ts +132 -0
- package/src/Entity.ts +345 -0
- package/src/Err.ts +40 -0
- package/src/Feed.ts +352 -0
- package/src/Filter.test.ts +90 -0
- package/src/Filter.ts +484 -0
- package/src/Format.ts +5 -0
- package/src/Hypergraph.ts +84 -0
- package/src/Json.test.ts +175 -0
- package/src/Json.ts +103 -0
- package/src/JsonSchema.ts +26 -0
- package/src/Key.ts +4 -1
- package/src/Migration.ts +114 -0
- package/src/Obj.test.ts +641 -0
- package/src/Obj.ts +778 -281
- package/src/Order.ts +68 -0
- package/src/Query.test.ts +835 -0
- package/src/Query.ts +634 -0
- package/src/QueryResult.ts +132 -0
- package/src/Ref.ts +98 -10
- package/src/Registry.ts +155 -0
- package/src/Relation.test.ts +88 -0
- package/src/Relation.ts +503 -67
- package/src/Scope.ts +50 -0
- package/src/Tag.md +88 -0
- package/src/Tag.ts +53 -8
- package/src/Type.test.ts +257 -0
- package/src/Type.ts +643 -151
- package/src/View.ts +98 -0
- package/src/exemplars.test.ts +21 -0
- package/src/hierarchy.test.ts +33 -0
- package/src/index.ts +22 -6
- package/src/internal/Annotation/annotations.test.ts +165 -0
- package/src/internal/Annotation/annotations.ts +609 -0
- package/src/internal/Annotation/dictionary.ts +47 -0
- package/src/internal/Annotation/entity-dictionary.ts +74 -0
- package/src/internal/Annotation/index.ts +9 -0
- package/src/internal/Annotation/sorting.ts +51 -0
- package/src/internal/Annotation/util.ts +94 -0
- package/src/internal/Entity/api.ts +77 -0
- package/src/internal/Entity/entity.ts +277 -0
- package/src/internal/Entity/guard.ts +26 -0
- package/src/internal/Entity/index.ts +13 -0
- package/src/internal/Entity/model.ts +119 -0
- package/src/internal/Entity/object.ts +73 -0
- package/src/internal/Entity/relation.ts +188 -0
- package/src/internal/Entity/type-kind.ts +75 -0
- package/src/internal/Entity/type-uri.ts +92 -0
- package/src/internal/Entity/util.ts +33 -0
- package/src/internal/Entity/version.ts +96 -0
- package/src/internal/{formats → Format}/date.test.ts +1 -2
- package/src/internal/{formats → Format}/date.ts +5 -9
- package/src/internal/{formats → Format}/format.test.ts +27 -7
- package/src/internal/{formats → Format}/format.ts +8 -6
- package/src/internal/{formats → Format}/index.ts +2 -3
- package/src/internal/{formats → Format}/number.ts +5 -5
- package/src/internal/{formats → Format}/object.ts +23 -6
- package/src/internal/{formats → Format}/select.ts +6 -4
- package/src/internal/{formats → Format}/string.ts +14 -9
- package/src/internal/{formats → Format}/types.ts +54 -43
- package/src/internal/{json → JsonSchema}/annotations.ts +3 -3
- package/src/internal/{json-schema → JsonSchema}/index.ts +2 -0
- package/src/internal/{json-schema → JsonSchema}/json-schema-normalize.ts +4 -2
- package/src/internal/{json-schema → JsonSchema}/json-schema-type.ts +39 -39
- package/src/internal/{json → JsonSchema}/json-schema.test.ts +119 -182
- package/src/internal/{json → JsonSchema}/json-schema.ts +70 -42
- package/src/internal/Obj/atoms.ts +244 -0
- package/src/internal/Obj/clone.ts +53 -0
- package/src/internal/{object → Obj}/common.ts +3 -4
- package/src/internal/Obj/create-object.test.ts +116 -0
- package/src/internal/Obj/create-object.ts +140 -0
- package/src/internal/Obj/deleted.ts +19 -0
- package/src/internal/Obj/index.ts +14 -0
- package/src/internal/{object → Obj}/inspect.ts +7 -7
- package/src/internal/Obj/json-serializer.test.ts +199 -0
- package/src/internal/Obj/json-serializer.ts +278 -0
- 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 +258 -0
- package/src/internal/Obj/set-value.ts +158 -0
- package/src/internal/Obj/snapshot.ts +114 -0
- package/src/internal/Obj/typed-object.test.ts +32 -0
- package/src/internal/Obj/typed-object.ts +30 -0
- package/src/internal/{json → Query}/index.ts +1 -1
- package/src/internal/Query/pretty.ts +162 -0
- package/src/internal/Ref/atoms.ts +20 -0
- package/src/internal/{ref → Ref}/ref-array.ts +6 -7
- package/src/internal/Ref/ref.test.ts +91 -0
- package/src/internal/{ref → Ref}/ref.ts +230 -101
- package/src/internal/Ref/utils.ts +45 -0
- package/src/internal/{projection → Type}/compose.test.ts +9 -9
- package/src/internal/{projection → Type}/compose.ts +14 -9
- package/src/internal/Type/index.ts +6 -0
- package/src/internal/{schema → Type}/manipulation.ts +0 -25
- package/src/internal/Type/type-schema.ts +60 -0
- package/src/internal/common/README.md +102 -0
- package/src/internal/common/api/index.ts +15 -0
- package/src/internal/common/api/meta.ts +90 -0
- package/src/internal/{testing → common}/index.ts +2 -1
- package/src/internal/common/proxy/change-context.ts +138 -0
- package/src/internal/common/proxy/change.test.ts +527 -0
- package/src/internal/common/proxy/define-hidden-property.ts +14 -0
- package/src/internal/common/proxy/errors.ts +42 -0
- package/src/internal/common/proxy/event-batch.ts +44 -0
- package/src/internal/common/proxy/handler.test.ts +121 -0
- package/src/internal/common/proxy/index.ts +17 -0
- package/src/internal/common/proxy/json-serializer.ts +101 -0
- package/src/internal/common/proxy/make-object.ts +129 -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.test.ts +54 -0
- package/src/internal/common/proxy/reactive.ts +77 -0
- package/src/internal/{object → common/proxy}/schema-validator.ts +6 -3
- package/src/internal/common/proxy/schema.test.ts +107 -0
- package/src/internal/common/proxy/symbols.ts +7 -0
- package/src/internal/common/proxy/typed-handler.test.ts +314 -0
- package/src/internal/common/proxy/typed-handler.ts +509 -0
- package/src/internal/common/proxy/typed-object.test.ts +103 -0
- package/src/internal/common/types/base.ts +43 -0
- package/src/internal/common/types/entity.ts +133 -0
- package/src/internal/common/types/index.ts +15 -0
- package/src/internal/common/types/meta.ts +109 -0
- package/src/internal/common/types/model-symbols.ts +89 -0
- package/src/internal/common/types/typename.ts +91 -0
- package/src/internal/common/types/version.ts +19 -0
- package/src/internal/common/types/well-known-types.ts +15 -0
- package/src/internal/index.ts +14 -17
- package/src/testing/api.test.ts +131 -0
- package/src/testing/index.ts +4 -3
- package/src/testing/registry.ts +44 -0
- package/src/testing/test-data.ts +189 -0
- package/src/testing/test-schema.ts +204 -0
- package/src/testing/util.ts +88 -0
- package/dist/lib/browser/chunk-BIDAASFK.mjs +0 -3727
- package/dist/lib/browser/chunk-BIDAASFK.mjs.map +0 -7
- package/dist/lib/browser/chunk-ZDLCWGEW.mjs +0 -410
- package/dist/lib/browser/chunk-ZDLCWGEW.mjs.map +0 -7
- package/dist/lib/browser/chunk-ZFRJKT4A.mjs +0 -585
- package/dist/lib/browser/chunk-ZFRJKT4A.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -35
- package/dist/lib/browser/internal/index.mjs +0 -336
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/query/index.mjs +0 -13
- package/dist/lib/browser/testing/index.mjs +0 -267
- package/dist/lib/browser/testing/index.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3SVRRCUU.mjs +0 -3727
- package/dist/lib/node-esm/chunk-3SVRRCUU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CGDHRZWH.mjs +0 -585
- package/dist/lib/node-esm/chunk-CGDHRZWH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HWS6VBQC.mjs +0 -410
- package/dist/lib/node-esm/chunk-HWS6VBQC.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -35
- package/dist/lib/node-esm/internal/index.mjs +0 -336
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/query/index.mjs +0 -13
- package/dist/lib/node-esm/testing/index.mjs +0 -267
- package/dist/lib/node-esm/testing/index.mjs.map +0 -7
- package/dist/types/src/errors.d.ts +0 -68
- package/dist/types/src/errors.d.ts.map +0 -1
- package/dist/types/src/internal/ast/annotation-helper.d.ts +0 -8
- package/dist/types/src/internal/ast/annotation-helper.d.ts.map +0 -1
- package/dist/types/src/internal/ast/annotations.d.ts +0 -131
- package/dist/types/src/internal/ast/annotations.d.ts.map +0 -1
- package/dist/types/src/internal/ast/annotations.test.d.ts.map +0 -1
- package/dist/types/src/internal/ast/entity-kind.d.ts +0 -10
- package/dist/types/src/internal/ast/entity-kind.d.ts.map +0 -1
- package/dist/types/src/internal/ast/index.d.ts +0 -5
- package/dist/types/src/internal/ast/index.d.ts.map +0 -1
- package/dist/types/src/internal/ast/types.d.ts +0 -6
- package/dist/types/src/internal/ast/types.d.ts.map +0 -1
- package/dist/types/src/internal/formats/date.d.ts.map +0 -1
- package/dist/types/src/internal/formats/date.test.d.ts.map +0 -1
- package/dist/types/src/internal/formats/format.d.ts.map +0 -1
- package/dist/types/src/internal/formats/format.test.d.ts.map +0 -1
- package/dist/types/src/internal/formats/index.d.ts.map +0 -1
- package/dist/types/src/internal/formats/number.d.ts.map +0 -1
- package/dist/types/src/internal/formats/object.d.ts.map +0 -1
- package/dist/types/src/internal/formats/select.d.ts.map +0 -1
- package/dist/types/src/internal/formats/string.d.ts.map +0 -1
- package/dist/types/src/internal/formats/types.d.ts.map +0 -1
- package/dist/types/src/internal/json/annotations.d.ts.map +0 -1
- package/dist/types/src/internal/json/effect-schema.test.d.ts.map +0 -1
- package/dist/types/src/internal/json/index.d.ts +0 -2
- package/dist/types/src/internal/json/index.d.ts.map +0 -1
- package/dist/types/src/internal/json/json-schema.d.ts.map +0 -1
- package/dist/types/src/internal/json/json-schema.test.d.ts.map +0 -1
- package/dist/types/src/internal/json-schema/index.d.ts +0 -3
- package/dist/types/src/internal/json-schema/index.d.ts.map +0 -1
- package/dist/types/src/internal/json-schema/json-schema-normalize.d.ts.map +0 -1
- package/dist/types/src/internal/json-schema/json-schema-type.d.ts.map +0 -1
- package/dist/types/src/internal/object/accessors.d.ts +0 -37
- package/dist/types/src/internal/object/accessors.d.ts.map +0 -1
- package/dist/types/src/internal/object/common.d.ts.map +0 -1
- package/dist/types/src/internal/object/create.d.ts.map +0 -1
- package/dist/types/src/internal/object/create.test.d.ts +0 -2
- package/dist/types/src/internal/object/create.test.d.ts.map +0 -1
- package/dist/types/src/internal/object/deleted.d.ts +0 -6
- package/dist/types/src/internal/object/deleted.d.ts.map +0 -1
- package/dist/types/src/internal/object/entity.d.ts +0 -33
- package/dist/types/src/internal/object/entity.d.ts.map +0 -1
- package/dist/types/src/internal/object/expando.d.ts +0 -14
- package/dist/types/src/internal/object/expando.d.ts.map +0 -1
- package/dist/types/src/internal/object/ids.d.ts +0 -6
- package/dist/types/src/internal/object/ids.d.ts.map +0 -1
- package/dist/types/src/internal/object/index.d.ts +0 -16
- package/dist/types/src/internal/object/index.d.ts.map +0 -1
- package/dist/types/src/internal/object/inspect.d.ts.map +0 -1
- package/dist/types/src/internal/object/json-serializer.d.ts +0 -32
- package/dist/types/src/internal/object/json-serializer.d.ts.map +0 -1
- package/dist/types/src/internal/object/json-serializer.test.d.ts.map +0 -1
- package/dist/types/src/internal/object/meta.d.ts +0 -31
- package/dist/types/src/internal/object/meta.d.ts.map +0 -1
- package/dist/types/src/internal/object/model.d.ts +0 -117
- package/dist/types/src/internal/object/model.d.ts.map +0 -1
- package/dist/types/src/internal/object/relation.d.ts +0 -17
- package/dist/types/src/internal/object/relation.d.ts.map +0 -1
- package/dist/types/src/internal/object/schema-validator.d.ts.map +0 -1
- package/dist/types/src/internal/object/schema-validator.test.d.ts.map +0 -1
- package/dist/types/src/internal/object/typed-object.d.ts +0 -31
- package/dist/types/src/internal/object/typed-object.d.ts.map +0 -1
- package/dist/types/src/internal/object/typed-object.test.d.ts.map +0 -1
- package/dist/types/src/internal/object/typename.d.ts +0 -15
- package/dist/types/src/internal/object/typename.d.ts.map +0 -1
- package/dist/types/src/internal/object/version.d.ts +0 -14
- package/dist/types/src/internal/object/version.d.ts.map +0 -1
- package/dist/types/src/internal/projection/compose.d.ts +0 -6
- package/dist/types/src/internal/projection/compose.d.ts.map +0 -1
- package/dist/types/src/internal/projection/compose.test.d.ts.map +0 -1
- package/dist/types/src/internal/projection/index.d.ts +0 -2
- package/dist/types/src/internal/projection/index.d.ts.map +0 -1
- package/dist/types/src/internal/proxy/handler.test.d.ts.map +0 -1
- package/dist/types/src/internal/proxy/reactive-object.d.ts +0 -15
- package/dist/types/src/internal/proxy/reactive-object.d.ts.map +0 -1
- package/dist/types/src/internal/proxy/schema.test.d.ts.map +0 -1
- package/dist/types/src/internal/proxy/typed-handler.d.ts +0 -44
- package/dist/types/src/internal/proxy/typed-handler.d.ts.map +0 -1
- package/dist/types/src/internal/proxy/typed-handler.test.d.ts.map +0 -1
- package/dist/types/src/internal/proxy/typed-object.test.d.ts.map +0 -1
- package/dist/types/src/internal/query/index.d.ts +0 -2
- package/dist/types/src/internal/query/index.d.ts.map +0 -1
- package/dist/types/src/internal/query/query.d.ts +0 -17
- package/dist/types/src/internal/query/query.d.ts.map +0 -1
- package/dist/types/src/internal/ref/index.d.ts.map +0 -1
- package/dist/types/src/internal/ref/ref-array.d.ts +0 -21
- package/dist/types/src/internal/ref/ref-array.d.ts.map +0 -1
- package/dist/types/src/internal/ref/ref.d.ts.map +0 -1
- package/dist/types/src/internal/ref/ref.test.d.ts.map +0 -1
- package/dist/types/src/internal/schema/echo-schema.d.ts +0 -168
- package/dist/types/src/internal/schema/echo-schema.d.ts.map +0 -1
- package/dist/types/src/internal/schema/index.d.ts +0 -7
- package/dist/types/src/internal/schema/index.d.ts.map +0 -1
- package/dist/types/src/internal/schema/manipulation.d.ts.map +0 -1
- package/dist/types/src/internal/schema/runtime-schema-registry.d.ts +0 -18
- package/dist/types/src/internal/schema/runtime-schema-registry.d.ts.map +0 -1
- package/dist/types/src/internal/schema/snapshot.d.ts +0 -6
- package/dist/types/src/internal/schema/snapshot.d.ts.map +0 -1
- package/dist/types/src/internal/schema/stored-schema.d.ts +0 -13
- package/dist/types/src/internal/schema/stored-schema.d.ts.map +0 -1
- package/dist/types/src/internal/testing/index.d.ts +0 -3
- package/dist/types/src/internal/testing/index.d.ts.map +0 -1
- package/dist/types/src/internal/testing/types.d.ts +0 -381
- package/dist/types/src/internal/testing/types.d.ts.map +0 -1
- package/dist/types/src/internal/testing/utils.d.ts +0 -10
- package/dist/types/src/internal/testing/utils.d.ts.map +0 -1
- package/dist/types/src/internal/types/index.d.ts +0 -3
- package/dist/types/src/internal/types/index.d.ts.map +0 -1
- package/dist/types/src/internal/types/types.d.ts +0 -79
- package/dist/types/src/internal/types/types.d.ts.map +0 -1
- package/dist/types/src/internal/types/types.test.d.ts +0 -2
- package/dist/types/src/internal/types/types.test.d.ts.map +0 -1
- package/dist/types/src/internal/types/util.d.ts +0 -5
- package/dist/types/src/internal/types/util.d.ts.map +0 -1
- package/dist/types/src/query/index.d.ts +0 -2
- package/dist/types/src/query/index.d.ts.map +0 -1
- package/dist/types/src/query/query.d.ts +0 -248
- package/dist/types/src/query/query.d.ts.map +0 -1
- package/dist/types/src/query/query.test.d.ts +0 -2
- package/dist/types/src/query/query.test.d.ts.map +0 -1
- package/dist/types/src/testing/echo-schema.d.ts +0 -7
- package/dist/types/src/testing/echo-schema.d.ts.map +0 -1
- package/dist/types/src/testing/types.d.ts +0 -228
- package/dist/types/src/testing/types.d.ts.map +0 -1
- package/src/errors.ts +0 -18
- package/src/internal/ast/annotation-helper.ts +0 -22
- package/src/internal/ast/annotations.test.ts +0 -98
- package/src/internal/ast/annotations.ts +0 -226
- package/src/internal/ast/entity-kind.ts +0 -15
- package/src/internal/ast/index.ts +0 -8
- package/src/internal/ast/types.ts +0 -17
- package/src/internal/object/accessors.ts +0 -153
- package/src/internal/object/create.test.ts +0 -118
- package/src/internal/object/create.ts +0 -96
- package/src/internal/object/deleted.ts +0 -19
- package/src/internal/object/entity.ts +0 -248
- package/src/internal/object/expando.ts +0 -21
- package/src/internal/object/ids.ts +0 -12
- package/src/internal/object/index.ts +0 -19
- package/src/internal/object/json-serializer.test.ts +0 -99
- package/src/internal/object/json-serializer.ts +0 -225
- package/src/internal/object/meta.ts +0 -61
- package/src/internal/object/model.ts +0 -170
- package/src/internal/object/relation.ts +0 -24
- package/src/internal/object/typed-object.test.ts +0 -34
- package/src/internal/object/typed-object.ts +0 -88
- package/src/internal/object/typename.ts +0 -61
- package/src/internal/object/version.ts +0 -22
- package/src/internal/projection/index.ts +0 -5
- package/src/internal/proxy/handler.test.ts +0 -163
- package/src/internal/proxy/reactive-object.ts +0 -108
- package/src/internal/proxy/schema.test.ts +0 -136
- package/src/internal/proxy/typed-handler.test.ts +0 -102
- package/src/internal/proxy/typed-handler.ts +0 -228
- package/src/internal/proxy/typed-object.test.ts +0 -100
- package/src/internal/query/index.ts +0 -5
- package/src/internal/query/query.ts +0 -23
- package/src/internal/ref/ref.test.ts +0 -100
- package/src/internal/schema/echo-schema.ts +0 -383
- package/src/internal/schema/index.ts +0 -10
- package/src/internal/schema/runtime-schema-registry.ts +0 -78
- package/src/internal/schema/snapshot.ts +0 -25
- package/src/internal/schema/stored-schema.ts +0 -26
- package/src/internal/testing/types.ts +0 -144
- package/src/internal/testing/utils.ts +0 -54
- package/src/internal/types/index.ts +0 -6
- package/src/internal/types/types.test.ts +0 -48
- package/src/internal/types/types.ts +0 -176
- package/src/internal/types/util.ts +0 -9
- package/src/query/index.ts +0 -6
- package/src/query/query.test.ts +0 -401
- package/src/query/query.ts +0 -789
- package/src/test/api.test.ts +0 -180
- package/src/testing/echo-schema.ts +0 -39
- package/src/testing/types.ts +0 -108
- /package/dist/lib/{browser/index.mjs.map → neutral/Annotation.mjs.map} +0 -0
- /package/dist/lib/{browser/internal/index.mjs.map → neutral/Database.mjs.map} +0 -0
- /package/dist/lib/{browser/query/index.mjs.map → neutral/Entity.mjs.map} +0 -0
- /package/dist/lib/{node-esm/index.mjs.map → neutral/Err.mjs.map} +0 -0
- /package/dist/lib/{node-esm/internal/index.mjs.map → neutral/Feed.mjs.map} +0 -0
- /package/dist/lib/{node-esm/query/index.mjs.map → neutral/Filter.mjs.map} +0 -0
- /package/dist/types/src/internal/{ast → Annotation}/annotations.test.d.ts +0 -0
- /package/dist/types/src/internal/{formats → Format}/date.d.ts +0 -0
- /package/dist/types/src/internal/{formats → Format}/date.test.d.ts +0 -0
- /package/dist/types/src/internal/{formats → Format}/format.test.d.ts +0 -0
- /package/dist/types/src/internal/{formats → Format}/number.d.ts +0 -0
- /package/dist/types/src/internal/{json → JsonSchema}/effect-schema.test.d.ts +0 -0
- /package/dist/types/src/internal/{json-schema → JsonSchema}/json-schema-normalize.d.ts +0 -0
- /package/dist/types/src/internal/{json → JsonSchema}/json-schema.test.d.ts +0 -0
- /package/dist/types/src/internal/{object → Obj}/common.d.ts +0 -0
- /package/dist/types/src/internal/{object → Obj}/inspect.d.ts +0 -0
- /package/dist/types/src/internal/{object → Obj}/json-serializer.test.d.ts +0 -0
- /package/dist/types/src/internal/{object → Obj}/schema-validator.test.d.ts +0 -0
- /package/dist/types/src/internal/{object → Obj}/typed-object.test.d.ts +0 -0
- /package/dist/types/src/internal/{ref → Ref}/index.d.ts +0 -0
- /package/dist/types/src/internal/{ref → Ref}/ref.test.d.ts +0 -0
- /package/dist/types/src/internal/{projection → Type}/compose.test.d.ts +0 -0
- /package/dist/types/src/internal/{proxy → common/proxy}/handler.test.d.ts +0 -0
- /package/dist/types/src/internal/{object → common/proxy}/schema-validator.d.ts +0 -0
- /package/dist/types/src/internal/{proxy → common/proxy}/schema.test.d.ts +0 -0
- /package/dist/types/src/internal/{proxy → common/proxy}/typed-handler.test.d.ts +0 -0
- /package/dist/types/src/internal/{proxy → common/proxy}/typed-object.test.d.ts +0 -0
- /package/dist/types/src/{test → testing}/api.test.d.ts +0 -0
- /package/src/internal/{json → JsonSchema}/effect-schema.test.ts +0 -0
- /package/src/internal/{ref → Ref}/index.ts +0 -0
|
@@ -5,23 +5,23 @@
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
import { describe, test } from 'vitest';
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
import { FormatAnnotation, FormatEnum } from '../formats';
|
|
10
|
-
import { toJsonSchema } from '../json';
|
|
11
|
-
import { ECHO_ANNOTATIONS_NS_KEY } from '../json-schema';
|
|
12
|
-
import { TypedObject } from '../object';
|
|
8
|
+
import { DXN } from '@dxos/keys';
|
|
13
9
|
|
|
10
|
+
import { FieldPath } from '../Annotation';
|
|
11
|
+
import { EchoObjectSchema } from '../Entity';
|
|
12
|
+
import { FormatAnnotation, TypeFormat } from '../Format';
|
|
13
|
+
import { ECHO_ANNOTATIONS_NS_KEY, toJsonSchema } from '../JsonSchema';
|
|
14
14
|
import { composeSchema } from './compose';
|
|
15
15
|
|
|
16
16
|
describe('schema composition', () => {
|
|
17
17
|
test('schema composition', ({ expect }) => {
|
|
18
|
-
|
|
18
|
+
const BaseType = Schema.Struct({
|
|
19
19
|
name: Schema.String,
|
|
20
20
|
email: Schema.String,
|
|
21
|
-
})
|
|
21
|
+
}).pipe(EchoObjectSchema(DXN.make('com.example.person', '0.1.0')));
|
|
22
22
|
|
|
23
23
|
const OverlaySchema = Schema.Struct({
|
|
24
|
-
email: Schema.String.pipe(FieldPath('$.email'), FormatAnnotation.set(
|
|
24
|
+
email: Schema.String.pipe(FieldPath('$.email'), FormatAnnotation.set(TypeFormat.Email)),
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
const baseSchema = toJsonSchema(BaseType);
|
|
@@ -30,7 +30,7 @@ describe('schema composition', () => {
|
|
|
30
30
|
expect(composedSchema.properties).to.deep.eq({
|
|
31
31
|
email: {
|
|
32
32
|
type: 'string',
|
|
33
|
-
format:
|
|
33
|
+
format: TypeFormat.Email,
|
|
34
34
|
// TODO(dmaretskyi): Should use the new field.
|
|
35
35
|
[ECHO_ANNOTATIONS_NS_KEY]: {
|
|
36
36
|
meta: {
|
|
@@ -2,18 +2,22 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import type * as Types from 'effect/Types';
|
|
6
|
+
|
|
5
7
|
import { invariant } from '@dxos/invariant';
|
|
6
8
|
|
|
7
|
-
import { type JsonSchemaType } from '../
|
|
8
|
-
import { getSnapshot } from '../schema';
|
|
9
|
+
import { type JsonSchemaType } from '../JsonSchema';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Creates a composite schema from the source and projection schemas.
|
|
12
13
|
*/
|
|
13
14
|
// TODO(burdon): Use effect schema projections.
|
|
14
15
|
// TODO(burdon): Can avoid having to call this every time we modify any property on the view?
|
|
15
|
-
export const composeSchema = (
|
|
16
|
-
|
|
16
|
+
export const composeSchema = (
|
|
17
|
+
source: Types.Mutable<JsonSchemaType>,
|
|
18
|
+
target: Types.Mutable<JsonSchemaType>,
|
|
19
|
+
): Types.Mutable<JsonSchemaType> => {
|
|
20
|
+
const result = structuredClone(target);
|
|
17
21
|
invariant('type' in result && result.type === 'object', 'source schema must be an object');
|
|
18
22
|
invariant('type' in source && source.type === 'object', 'target schema must be an object');
|
|
19
23
|
|
|
@@ -21,12 +25,13 @@ export const composeSchema = (source: JsonSchemaType, target: JsonSchemaType): J
|
|
|
21
25
|
const propSchema = source.properties![prop]; // TODO(dmaretskyi): Find by json-path instead.
|
|
22
26
|
const annotations = (propSchema as JsonSchemaType)?.annotations?.meta;
|
|
23
27
|
if (annotations) {
|
|
24
|
-
|
|
25
|
-
|
|
28
|
+
const resultProp = result.properties[prop] as Record<string, any>;
|
|
29
|
+
resultProp.annotations ??= {};
|
|
30
|
+
resultProp.annotations.meta ??= {};
|
|
26
31
|
for (const key in annotations) {
|
|
27
|
-
|
|
28
|
-
Object.assign(
|
|
29
|
-
...
|
|
32
|
+
resultProp.annotations.meta[key] ??= {};
|
|
33
|
+
Object.assign(resultProp.annotations.meta[key], annotations[key], {
|
|
34
|
+
...resultProp.annotations.meta[key],
|
|
30
35
|
});
|
|
31
36
|
}
|
|
32
37
|
}
|
|
@@ -6,9 +6,6 @@ import * as Schema from 'effect/Schema';
|
|
|
6
6
|
import * as SchemaAST from 'effect/SchemaAST';
|
|
7
7
|
|
|
8
8
|
import { invariant } from '@dxos/invariant';
|
|
9
|
-
import { DXN } from '@dxos/keys';
|
|
10
|
-
|
|
11
|
-
import { type TypeAnnotation, TypeAnnotationId, TypeIdentifierAnnotationId } from '../ast';
|
|
12
9
|
|
|
13
10
|
// TODO(ZaymonFC): Do this one at a time. This might be dangerous.
|
|
14
11
|
export const addFieldsToSchema = (
|
|
@@ -68,25 +65,3 @@ export const updateFieldNameInSchema = (
|
|
|
68
65
|
),
|
|
69
66
|
);
|
|
70
67
|
};
|
|
71
|
-
|
|
72
|
-
export const setTypenameInSchema = (
|
|
73
|
-
schema: Schema.Schema.AnyNoContext,
|
|
74
|
-
typename: string,
|
|
75
|
-
): Schema.Schema.AnyNoContext => {
|
|
76
|
-
const existingAnnotation = schema.ast.annotations[TypeAnnotationId] as TypeAnnotation;
|
|
77
|
-
invariant(existingAnnotation, `Missing ${String(TypeAnnotationId)}`);
|
|
78
|
-
|
|
79
|
-
return schema.annotations({
|
|
80
|
-
...schema.ast.annotations,
|
|
81
|
-
[TypeAnnotationId]: {
|
|
82
|
-
kind: existingAnnotation.kind,
|
|
83
|
-
typename,
|
|
84
|
-
version: existingAnnotation.version,
|
|
85
|
-
} satisfies TypeAnnotation,
|
|
86
|
-
[SchemaAST.JSONSchemaAnnotationId]: {
|
|
87
|
-
...(schema.ast.annotations[SchemaAST.JSONSchemaAnnotationId] ?? {}),
|
|
88
|
-
$id: schema.ast.annotations[TypeIdentifierAnnotationId] ?? DXN.fromTypename(typename).toString(),
|
|
89
|
-
typename,
|
|
90
|
-
},
|
|
91
|
-
});
|
|
92
|
-
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
|
|
7
|
+
import { IconAnnotation, LabelAnnotation } from '../Annotation';
|
|
8
|
+
import { EntityKind, KindId, SchemaKindId, StaticTypeSchemaSlot } from '../common/types';
|
|
9
|
+
import { EchoTypeKindSchema, TypeMetaSchemaDXN } from '../Entity';
|
|
10
|
+
import { JsonSchemaType } from '../JsonSchema';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Raw struct backing {@link TypeSchema}. Exposed only so `TypeSchema`
|
|
14
|
+
* (the TS type) can derive its data fields via `Schema.Schema.Type<typeof ...>`;
|
|
15
|
+
* runtime callers should use {@link TypeSchema} (the piped, branded entity).
|
|
16
|
+
*
|
|
17
|
+
* `typename` and `version` are NOT data fields — they live in `EntityMeta.key` /
|
|
18
|
+
* `EntityMeta.version` (the canonical registry-provenance pair, queryable via
|
|
19
|
+
* `Filter.key(...)`). The same `jsonSchema` payload also embeds them so a
|
|
20
|
+
* standalone JSON-Schema export remains self-describing, but the schema-registry
|
|
21
|
+
* reads/writes them through meta.
|
|
22
|
+
*/
|
|
23
|
+
const TypeSchemaStruct = Schema.Struct({
|
|
24
|
+
name: Schema.optional(Schema.String),
|
|
25
|
+
jsonSchema: JsonSchemaType,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Persistent representation of a schema.
|
|
30
|
+
*/
|
|
31
|
+
export const TypeSchema = TypeSchemaStruct.pipe(
|
|
32
|
+
LabelAnnotation.set(['name']),
|
|
33
|
+
IconAnnotation.set({
|
|
34
|
+
icon: 'ph--database--regular',
|
|
35
|
+
hue: 'green',
|
|
36
|
+
}),
|
|
37
|
+
EchoTypeKindSchema(TypeMetaSchemaDXN),
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Persistent representation of a schema — the runtime shape that
|
|
42
|
+
* `db.addType(Type.makeObjectFromJsonSchema(...))` produces
|
|
43
|
+
* and `Filter.type(Type.Type).run()` returns.
|
|
44
|
+
*
|
|
45
|
+
* Structurally identical to a static `Type.Type` entity: the entity-handler's
|
|
46
|
+
* `get` trap exposes `[SchemaKindId]` (derived from `system.kind` and
|
|
47
|
+
* `data.jsonSchema.entityKind`) and rebuilds `[StaticTypeSchemaSlot]` lazily
|
|
48
|
+
* from `jsonSchema`, so a persisted instance satisfies the public `Type<A>`
|
|
49
|
+
* interface without casting.
|
|
50
|
+
*/
|
|
51
|
+
export type TypeSchema = Schema.Schema.Type<typeof TypeSchemaStruct> & {
|
|
52
|
+
/** Object identifier — injected by `EchoTypeKindSchema` and stamped at construction. */
|
|
53
|
+
readonly id: string;
|
|
54
|
+
/** Entity-kind discriminator (object/relation/type) carried on every entity instance. */
|
|
55
|
+
readonly [KindId]: EntityKind.Type;
|
|
56
|
+
/** Kind of schema described by this meta-instance — always `EntityKind.Type` for `Type.Type` itself. */
|
|
57
|
+
readonly [SchemaKindId]: EntityKind.Type;
|
|
58
|
+
/** Effect Schema rebuilt lazily from `jsonSchema`; satisfies `Type.getSchema(...)` without an extra cast. */
|
|
59
|
+
readonly [StaticTypeSchemaSlot]: Schema.Schema.AnyNoContext;
|
|
60
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
## Refactor
|
|
2
|
+
|
|
3
|
+
1. Remove access from outisde of @dxos/echo-db
|
|
4
|
+
|
|
5
|
+
- [x] completely restructure @dxos/echo src/internal
|
|
6
|
+
- [x] Remove import "." and ".."! (create lint rule).
|
|
7
|
+
- [x] Unify FOUR different nests of test schema.
|
|
8
|
+
- [x] Remove @deprecated from internal methods and mark @internal (e.g., getSchemaDXN).
|
|
9
|
+
- NOTE: Internal methods should not use the import \* from Obj/Type APIs.
|
|
10
|
+
- [x] import EntityId => @dxos/keys
|
|
11
|
+
- [x] Entity.Any = Obj.Any | Relation.Any
|
|
12
|
+
- NOTE: Relation does not extend (in not polymorphic with) Obj.
|
|
13
|
+
- [x] import LabelAnnotation => Annotation.LabelAnnotation
|
|
14
|
+
- [x] import Expando => @dxos/schema (Expando.Expando)
|
|
15
|
+
- [x] live => Obj.make
|
|
16
|
+
- [x] Rename live => makeObject
|
|
17
|
+
- [x] Rename {EchoObject, EchoRelation} => {EchoObjecSchema, EchoRelationSchema}
|
|
18
|
+
- [x] Rename AnyProperties => AnyProperties
|
|
19
|
+
- [x] Created Entity.Any (=> AnyEchoObject).
|
|
20
|
+
- [x] TypeFormat => TypeFormat
|
|
21
|
+
- [x] JsonSchemaType defs
|
|
22
|
+
- [x] Fix database.add() input/output types and search for "Obj.Any = db.add" (also QueryResult types).
|
|
23
|
+
- [x] TODO(burdon): FIX!!!
|
|
24
|
+
- [x] Fix failing tests.
|
|
25
|
+
- [x] Reconcile types/version with entities/model/version
|
|
26
|
+
- [x] Expando moved to @dxos/schema
|
|
27
|
+
- [x] Narrow QueryResult and match Schema and Object generics.
|
|
28
|
+
|
|
29
|
+
2. Clean-up
|
|
30
|
+
|
|
31
|
+
- [x] QueryResult namespace
|
|
32
|
+
- [x] SchemaRegistry interface
|
|
33
|
+
- [x] Schema registry should return Type.AnyEntity instead of Schema.Schema.AnyNoContext.
|
|
34
|
+
- [x] Hypergraph interface
|
|
35
|
+
- [x] Obj.getDatabase
|
|
36
|
+
- [x] SpaceAction.AddObject target should be a db not a space.
|
|
37
|
+
- [x] Add Relation.MakeProps
|
|
38
|
+
- [x] Add Obj.Unknown and Relation.Unknown to match Entity.Unknown.
|
|
39
|
+
- [x] TODO(wittjosiah): Should be Type.obj<...> or equivalent.
|
|
40
|
+
- [x] TODO(wittjosiah): Find a simpler way to define this type.
|
|
41
|
+
- [x] Ref.Array.targets doesn't satisfy Obj.Any because it uses AnyEchoObject.
|
|
42
|
+
- [x] Remove echo-db/AnyLiveObject<T> => Obj.Obj<T>
|
|
43
|
+
- [x] Rename AnyEchoObject => AnyEntity
|
|
44
|
+
- [x] Remove WithId => AnyEntity
|
|
45
|
+
- [x] Remove WithMeta => AnyEntity
|
|
46
|
+
- [x] Obj.Any => Obj.Unknown
|
|
47
|
+
- [x] Relation.Any => Relation.Unknown
|
|
48
|
+
- [x] Ref.Any => Ref.Unknown
|
|
49
|
+
- [x] Obj.AnyProps => Obj.Any
|
|
50
|
+
- [x] Factor Expando out of @dxos/echo (moved to @dxos/schema)
|
|
51
|
+
- [x] Obj.instanceOf works with Expando (tested in @dxos/schema)
|
|
52
|
+
- [x] Obj.Snapshot should be same shape as Obj.Obj but with a different brand
|
|
53
|
+
- [x] Mutators should only work on object after it is made mutable
|
|
54
|
+
|
|
55
|
+
- [ ] Review usage of Obj.Any, see if it could be stricter
|
|
56
|
+
- [ ] Type.Obj should validate using the echo object brand
|
|
57
|
+
- [ ] Mutable could be a branded type to fix "NOTE: TypeScript's structural typing allows readonly objects to be passed to `Mutable<T>`"
|
|
58
|
+
- [ ] space properties, queues, messagins preventing getSpace from being removed
|
|
59
|
+
- [ ] Schema registry should use Query.Query.
|
|
60
|
+
- [ ] Move EchoSchemaRegistry into hypergraph
|
|
61
|
+
- [ ] Narrow QueryResult and match Schema and Object generics.
|
|
62
|
+
- [ ] BaseSchema
|
|
63
|
+
- [ ] Directly import JSONPath, etc. from @dxos/effect.
|
|
64
|
+
- [ ] Promote parts of src/internal/ref to Ref.ts
|
|
65
|
+
- [ ] JsonPath, JsonProp, getValue, setValue => Json.Path?
|
|
66
|
+
- [ ] DISCUSS: Standradize $ suffix to disambuguate imports (GPT recommended).
|
|
67
|
+
|
|
68
|
+
3. Audit usage from @dxos/echo-db
|
|
69
|
+
|
|
70
|
+
- [ ] Ability to extract Struct from Type.Obj
|
|
71
|
+
- [ ] created/updated system props (const { created } = Obj.getTimestamps)?
|
|
72
|
+
- [ ] QueryFn, QueryOptions => Database
|
|
73
|
+
- [ ] Datatbase.query() options?
|
|
74
|
+
- [ ] Expando type is used as a fallback in many plance.
|
|
75
|
+
- [ ] Standardize '@automerge/automerge' imports (A vs. next).
|
|
76
|
+
|
|
77
|
+
## NOTES
|
|
78
|
+
|
|
79
|
+
- Marking types as @internal (even for unexported types) erases type information.
|
|
80
|
+
|
|
81
|
+
## 0.9.0
|
|
82
|
+
|
|
83
|
+
- [ ] Database, Queue, Space, Type, namespaces.
|
|
84
|
+
- [ ] Support class variant for types.
|
|
85
|
+
- [ ] Support defaults.
|
|
86
|
+
- [ ] Support effect Date, Timestamp formats.
|
|
87
|
+
- [ ] Metadata for created, updated timestamps.
|
|
88
|
+
- [ ] Effect team design review.
|
|
89
|
+
- [ ] @category annotations to group types in the API.
|
|
90
|
+
- [ ] TSdoc and LLM training for function generation.
|
|
91
|
+
- [ ] Rename TypeFormat => Primitive?
|
|
92
|
+
- [ ] Don't re-export effect?
|
|
93
|
+
|
|
94
|
+
## Issues
|
|
95
|
+
|
|
96
|
+
- [ ] Build error when changing from TypedObject using Ref$: Type 'Task' does not satisfy the constraint 'WithId' (see echo-schema/testing/schema.ts)
|
|
97
|
+
- [ ] Reconcile all schema variants (Base, Immutable, TypedObject, EchoObject, etc.)
|
|
98
|
+
- [ ] Consolidate getters (getType, getSchema, getTypename, getSchemaTypename, etc.)
|
|
99
|
+
- [ ] ReactiveObject should specify id property? Reconcile AnyProperties, ReactiveObject, HasId, WithId, etc.
|
|
100
|
+
- [ ] Can we us S.is(MyType) to detect objects with our types system? (Branding?)
|
|
101
|
+
- [ ] Type.Expando doesn't work with AtomQuery result type (have to use Obj.Any instead).
|
|
102
|
+
- [ ] Obj.Any doesn't work with Obj.update callback types (have to use `any` for the mutable parameter).
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Shared API helpers for Obj and Relation modules.
|
|
7
|
+
* These implementations use generic Entity types.
|
|
8
|
+
* Obj and Relation modules re-export with strongly-typed signatures.
|
|
9
|
+
*
|
|
10
|
+
* TODO(wittjosiah): Could this become the new "internal" where we slowly refactor
|
|
11
|
+
* existing internal modules into here? This would provide a cleaner boundary
|
|
12
|
+
* and prevent external packages from using internals directly.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
export * from './meta';
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import type { ForeignKey } from '@dxos/echo-protocol';
|
|
6
|
+
import { assertArgument, invariant } from '@dxos/invariant';
|
|
7
|
+
import type { DeepReadonly } from '@dxos/util';
|
|
8
|
+
|
|
9
|
+
import type * as Tag from '../../../Tag';
|
|
10
|
+
import type { Ref } from '../../Ref/ref';
|
|
11
|
+
import { type Mutable } from '../proxy';
|
|
12
|
+
import { type AnyProperties } from '../types';
|
|
13
|
+
import { type EntityMeta, getMeta as getMeta$ } from '../types/meta';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Deeply read-only version of EntityMeta.
|
|
17
|
+
*/
|
|
18
|
+
export type ReadonlyMeta = DeepReadonly<EntityMeta>;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Mutable meta type received in meta mutation callbacks.
|
|
22
|
+
*/
|
|
23
|
+
export type Meta = Mutable<EntityMeta>;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Get the metadata for an entity with validation.
|
|
27
|
+
* Returns mutable meta when passed a mutable entity (inside change callback).
|
|
28
|
+
* Returns read-only meta when passed a regular entity or snapshot.
|
|
29
|
+
*
|
|
30
|
+
* TODO(burdon): When passed a Snapshot, should return a snapshot of meta, not the live meta proxy.
|
|
31
|
+
*/
|
|
32
|
+
export function getMetaChecked(entity: Mutable<AnyProperties>): Meta;
|
|
33
|
+
export function getMetaChecked(entity: AnyProperties): ReadonlyMeta;
|
|
34
|
+
export function getMetaChecked(entity: AnyProperties): Meta | ReadonlyMeta {
|
|
35
|
+
assertArgument(entity, 'entity', 'Should be an entity.');
|
|
36
|
+
const meta = getMeta$(entity);
|
|
37
|
+
invariant(meta != null, 'Invalid entity.');
|
|
38
|
+
return meta;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @returns Foreign keys for the entity from the specified source.
|
|
43
|
+
* Accepts both reactive entities and snapshots.
|
|
44
|
+
*/
|
|
45
|
+
export const getKeys = (entity: AnyProperties, source: string): ForeignKey[] => {
|
|
46
|
+
assertArgument(entity, 'entity', 'Should be an entity.');
|
|
47
|
+
const meta = getMetaChecked(entity);
|
|
48
|
+
invariant(meta != null, 'Invalid entity.');
|
|
49
|
+
return meta.keys.filter((key) => key.source === source);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Delete all keys from the entity for the specified source.
|
|
54
|
+
* Must be called within an Obj.update or Relation.update callback.
|
|
55
|
+
*/
|
|
56
|
+
export const deleteKeys = (entity: Mutable<AnyProperties>, source: string) => {
|
|
57
|
+
const meta = getMetaChecked(entity);
|
|
58
|
+
for (let i = 0; i < meta.keys.length; i++) {
|
|
59
|
+
if (meta.keys[i].source === source) {
|
|
60
|
+
meta.keys.splice(i, 1);
|
|
61
|
+
i--;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Add a tag (a reference to a {@link Tag} object) to the entity. Idempotent.
|
|
68
|
+
* Must be called within an Obj.update or Relation.update callback.
|
|
69
|
+
*/
|
|
70
|
+
export const addTag = (entity: Mutable<AnyProperties>, tag: Ref<Tag.Tag>) => {
|
|
71
|
+
const meta = getMetaChecked(entity);
|
|
72
|
+
// Two refs to the same target are not `===`; dedupe by URI.
|
|
73
|
+
if (!meta.tags.some((existing) => existing.uri === tag.uri)) {
|
|
74
|
+
meta.tags.push(tag);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Remove a tag (a reference to a {@link Tag} object) from the entity. No-op when not present.
|
|
80
|
+
* Must be called within an Obj.update or Relation.update callback.
|
|
81
|
+
*/
|
|
82
|
+
export const removeTag = (entity: Mutable<AnyProperties>, tag: Ref<Tag.Tag>) => {
|
|
83
|
+
const meta = getMetaChecked(entity);
|
|
84
|
+
for (let i = 0; i < meta.tags.length; i++) {
|
|
85
|
+
if (meta.tags[i].uri === tag.uri) {
|
|
86
|
+
meta.tags.splice(i, 1);
|
|
87
|
+
i--;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { batchEvents } from './event-batch';
|
|
6
|
+
import { EventId } from './symbols';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Generic change context tracking.
|
|
10
|
+
* Only one object can be in a change context at a time (synchronous changes).
|
|
11
|
+
*
|
|
12
|
+
* This module provides a unified change context mechanism used by both:
|
|
13
|
+
* - TypedReactiveHandler (for non-database objects, using target as key)
|
|
14
|
+
* - EchoReactiveHandler (for database objects, using ObjectCore as key)
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The object currently in a change context.
|
|
19
|
+
* Can be a target object (for typed reactive) or ObjectCore (for database objects).
|
|
20
|
+
*/
|
|
21
|
+
let currentChangeContext: object | null = null;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The primary object that has pending notifications, if any.
|
|
25
|
+
* This uses the contextKey (target or ObjectCore).
|
|
26
|
+
*/
|
|
27
|
+
let pendingNotificationKey: object | null = null;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Additional objects (owner chain) that need notifications.
|
|
31
|
+
* These are separate from the primary notification because they use EventId directly.
|
|
32
|
+
*/
|
|
33
|
+
const pendingOwnerNotifications = new Set<object>();
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Enter a change context for the given key.
|
|
37
|
+
* While in a change context, mutations are allowed on the associated object.
|
|
38
|
+
* Nested Obj.update calls are not supported.
|
|
39
|
+
*
|
|
40
|
+
* @param key - The key to enter the change context for (target object or ObjectCore).
|
|
41
|
+
* @returns A cleanup function that exits the change context.
|
|
42
|
+
*/
|
|
43
|
+
export const enterChangeContext = (key: object): (() => void) => {
|
|
44
|
+
currentChangeContext = key;
|
|
45
|
+
return () => {
|
|
46
|
+
currentChangeContext = null;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Check if the given key is currently in a change context.
|
|
52
|
+
*
|
|
53
|
+
* @param key - The key to check (target object or ObjectCore).
|
|
54
|
+
* @returns True if the key is in a change context, false otherwise.
|
|
55
|
+
*/
|
|
56
|
+
export const isInChangeContext = (key: object): boolean => {
|
|
57
|
+
return currentChangeContext === key;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Queue a notification for the given key to be fired when the change context exits.
|
|
62
|
+
*
|
|
63
|
+
* @param key - The key to queue a notification for.
|
|
64
|
+
*/
|
|
65
|
+
export const queueNotification = (key: object): void => {
|
|
66
|
+
if (currentChangeContext === key) {
|
|
67
|
+
pendingNotificationKey = key;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Queue an owner notification. Owner notifications are for objects in the ownership
|
|
73
|
+
* chain that should be notified when a nested object changes.
|
|
74
|
+
* These objects have EventId and emit directly.
|
|
75
|
+
* Skip if the target is already the current change context (to avoid duplicate notifications).
|
|
76
|
+
*
|
|
77
|
+
* @param target - The owner target that has EventId.
|
|
78
|
+
*/
|
|
79
|
+
export const queueOwnerNotification = (target: object): void => {
|
|
80
|
+
// Skip if this is the object already being changed (primary notification handles it).
|
|
81
|
+
if (currentChangeContext !== null && target !== currentChangeContext) {
|
|
82
|
+
pendingOwnerNotifications.add(target);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Check if there are any pending notifications for the given key.
|
|
88
|
+
*
|
|
89
|
+
* @param key - The key to check.
|
|
90
|
+
* @returns True if there are pending notifications, false otherwise.
|
|
91
|
+
*/
|
|
92
|
+
export const hasPendingNotifications = (key: object): boolean => {
|
|
93
|
+
return pendingNotificationKey === key;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Clear any pending notifications for the given key.
|
|
98
|
+
*
|
|
99
|
+
* @param key - The key to clear notifications for.
|
|
100
|
+
*/
|
|
101
|
+
export const clearPendingNotifications = (key: object): void => {
|
|
102
|
+
if (pendingNotificationKey === key) {
|
|
103
|
+
pendingNotificationKey = null;
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Execute a callback within a change context.
|
|
109
|
+
* This is the shared implementation used by both TypedReactiveHandler and EchoReactiveHandler.
|
|
110
|
+
*
|
|
111
|
+
* @param contextKey - The key for the change context (target for typed, ObjectCore for db).
|
|
112
|
+
* @param eventTarget - The object that has the EventId for notifications.
|
|
113
|
+
* @param proxy - The proxy object to pass to the callback.
|
|
114
|
+
* @param callback - The callback to execute with mutations allowed.
|
|
115
|
+
*/
|
|
116
|
+
export const executeChange = (
|
|
117
|
+
contextKey: object,
|
|
118
|
+
eventTarget: object,
|
|
119
|
+
proxy: any,
|
|
120
|
+
callback: (proxy: any) => void,
|
|
121
|
+
): void => {
|
|
122
|
+
const exitContext = enterChangeContext(contextKey);
|
|
123
|
+
try {
|
|
124
|
+
batchEvents(() => callback(proxy));
|
|
125
|
+
} finally {
|
|
126
|
+
exitContext();
|
|
127
|
+
// Fire primary notification.
|
|
128
|
+
if (hasPendingNotifications(contextKey)) {
|
|
129
|
+
clearPendingNotifications(contextKey);
|
|
130
|
+
(eventTarget as any)[EventId]?.emit();
|
|
131
|
+
}
|
|
132
|
+
// Fire owner chain notifications.
|
|
133
|
+
for (const ownerTarget of pendingOwnerNotifications) {
|
|
134
|
+
(ownerTarget as any)[EventId]?.emit();
|
|
135
|
+
}
|
|
136
|
+
pendingOwnerNotifications.clear();
|
|
137
|
+
}
|
|
138
|
+
};
|