@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
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Function from 'effect/Function';
|
|
6
|
-
import * as Option from 'effect/Option';
|
|
7
|
-
import * as Schema from 'effect/Schema';
|
|
8
|
-
import * as SchemaAST from 'effect/SchemaAST';
|
|
9
|
-
|
|
10
|
-
import { assertArgument } from '@dxos/invariant';
|
|
11
|
-
import { DXN } from '@dxos/keys';
|
|
12
|
-
import { type Primitive } from '@dxos/util';
|
|
13
|
-
|
|
14
|
-
import { createAnnotationHelper } from './annotation-helper';
|
|
15
|
-
import { EntityKind } from './entity-kind';
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* If property is optional returns the nested property, otherwise returns the property.
|
|
19
|
-
*/
|
|
20
|
-
// TODO(wittjosiah): Is there a way to do this as a generic?
|
|
21
|
-
export const unwrapOptional = (property: SchemaAST.PropertySignature) => {
|
|
22
|
-
if (!property.isOptional || !SchemaAST.isUnion(property.type)) {
|
|
23
|
-
return property;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return property.type.types[0];
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* ECHO identifier (for a stored schema).
|
|
31
|
-
* Must be a `dxn:echo:` URI.
|
|
32
|
-
*/
|
|
33
|
-
export const TypeIdentifierAnnotationId = Symbol.for('@dxos/schema/annotation/TypeIdentifier');
|
|
34
|
-
|
|
35
|
-
export const getTypeIdentifierAnnotation = (schema: Schema.Schema.All) =>
|
|
36
|
-
Function.flow(
|
|
37
|
-
SchemaAST.getAnnotation<string>(TypeIdentifierAnnotationId),
|
|
38
|
-
Option.getOrElse(() => undefined),
|
|
39
|
-
)(schema.ast);
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* ECHO type.
|
|
43
|
-
*/
|
|
44
|
-
export const TypeAnnotationId = Symbol.for('@dxos/schema/annotation/Type');
|
|
45
|
-
|
|
46
|
-
// TODO(burdon): Create echo-schema Format types.
|
|
47
|
-
// TODO(burdon): Reconcile with "short" DXN.
|
|
48
|
-
export const Typename = Schema.String.pipe(Schema.pattern(/^[a-zA-Z]\w+\.[a-zA-Z]\w{1,}\/[\w/_-]+$/));
|
|
49
|
-
export const SchemaVersion = Schema.String.pipe(Schema.pattern(/^\d+.\d+.\d+$/));
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Payload stored under {@link TypeAnnotationId}.
|
|
53
|
-
*/
|
|
54
|
-
// TODO(dmaretskyi): Rename getTypeAnnotation to represent commonality between objects and relations (e.g. `entity`).
|
|
55
|
-
export const TypeAnnotation = Schema.Struct({
|
|
56
|
-
kind: Schema.Enums(EntityKind),
|
|
57
|
-
typename: Typename,
|
|
58
|
-
version: SchemaVersion,
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* If this is a relation, the schema of the source object.
|
|
62
|
-
* Must be present if entity kind is {@link EntityKind.Relation}.
|
|
63
|
-
*/
|
|
64
|
-
sourceSchema: Schema.optional(DXN.Schema),
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* If this is a relation, the schema of the target object.
|
|
68
|
-
* Must be present if entity kind is {@link EntityKind.Relation}.
|
|
69
|
-
*/
|
|
70
|
-
targetSchema: Schema.optional(DXN.Schema),
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
export interface TypeAnnotation extends Schema.Schema.Type<typeof TypeAnnotation> {}
|
|
74
|
-
|
|
75
|
-
export type TypeMeta = Pick<TypeAnnotation, 'typename' | 'version'>;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* @returns {@link TypeAnnotation} from a schema.
|
|
79
|
-
* Schema must have been created with {@link TypedObject} or {@link TypedLink} or manually assigned an appropriate annotation.
|
|
80
|
-
*/
|
|
81
|
-
export const getTypeAnnotation = (schema: Schema.Schema.All): TypeAnnotation | undefined => {
|
|
82
|
-
assertArgument(schema != null && schema.ast != null, 'schema', 'invalid schema');
|
|
83
|
-
return Function.flow(
|
|
84
|
-
SchemaAST.getAnnotation<TypeAnnotation>(TypeAnnotationId),
|
|
85
|
-
Option.getOrElse(() => undefined),
|
|
86
|
-
)(schema.ast);
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* @returns {@link EntityKind} from a schema.
|
|
91
|
-
*/
|
|
92
|
-
export const getEntityKind = (schema: Schema.Schema.All): EntityKind | undefined => getTypeAnnotation(schema)?.kind;
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* @deprecated Use {@link Type.getTypename} instead.
|
|
96
|
-
* @returns Schema typename (without dxn: prefix or version number).
|
|
97
|
-
*/
|
|
98
|
-
export const getSchemaTypename = (schema: Schema.Schema.All): string | undefined => getTypeAnnotation(schema)?.typename;
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* @deprecated Use {@link Type.getVersion} instead.
|
|
102
|
-
* @returns Schema version in semver format.
|
|
103
|
-
*/
|
|
104
|
-
export const getSchemaVersion = (schema: Schema.Schema.All): string | undefined => getTypeAnnotation(schema)?.version;
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* PropertyMeta (metadata for dynamic schema properties).
|
|
108
|
-
* For user-defined annotations.
|
|
109
|
-
*/
|
|
110
|
-
export const PropertyMetaAnnotationId = Symbol.for('@dxos/schema/annotation/PropertyMeta');
|
|
111
|
-
|
|
112
|
-
export type PropertyMetaValue = Primitive | Record<string, Primitive> | Primitive[];
|
|
113
|
-
|
|
114
|
-
export type PropertyMetaAnnotation = {
|
|
115
|
-
[name: string]: PropertyMetaValue;
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
export const PropertyMeta = (name: string, value: PropertyMetaValue) => {
|
|
119
|
-
return <A, I, R>(self: Schema.Schema<A, I, R>): Schema.Schema<A, I, R> => {
|
|
120
|
-
const existingMeta = self.ast.annotations[PropertyMetaAnnotationId] as PropertyMetaAnnotation;
|
|
121
|
-
return self.annotations({
|
|
122
|
-
[PropertyMetaAnnotationId]: {
|
|
123
|
-
...existingMeta,
|
|
124
|
-
[name]: value,
|
|
125
|
-
},
|
|
126
|
-
});
|
|
127
|
-
};
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
export const getPropertyMetaAnnotation = <T>(prop: SchemaAST.PropertySignature, name: string) =>
|
|
131
|
-
Function.pipe(
|
|
132
|
-
SchemaAST.getAnnotation<PropertyMetaAnnotation>(PropertyMetaAnnotationId)(prop.type),
|
|
133
|
-
Option.map((meta) => meta[name] as T),
|
|
134
|
-
Option.getOrElse(() => undefined),
|
|
135
|
-
);
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Schema reference.
|
|
139
|
-
*/
|
|
140
|
-
export const ReferenceAnnotationId = Symbol.for('@dxos/schema/annotation/Reference');
|
|
141
|
-
|
|
142
|
-
export type ReferenceAnnotationValue = TypeAnnotation;
|
|
143
|
-
|
|
144
|
-
export const getReferenceAnnotation = (schema: Schema.Schema.AnyNoContext) =>
|
|
145
|
-
Function.pipe(
|
|
146
|
-
SchemaAST.getAnnotation<ReferenceAnnotationValue>(ReferenceAnnotationId)(schema.ast),
|
|
147
|
-
Option.getOrElse(() => undefined),
|
|
148
|
-
);
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* SchemaMeta.
|
|
152
|
-
*/
|
|
153
|
-
export const SchemaMetaSymbol = Symbol.for('@dxos/schema/SchemaMeta');
|
|
154
|
-
|
|
155
|
-
export type SchemaMeta = TypeMeta & { id: string };
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Identifies a schema as a view.
|
|
159
|
-
*/
|
|
160
|
-
export const ViewAnnotationId = Symbol.for('@dxos/schema/annotation/View');
|
|
161
|
-
export const ViewAnnotation = createAnnotationHelper<boolean>(ViewAnnotationId);
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Identifies label property or JSON path expression.
|
|
165
|
-
* Either a string or an array of strings representing field accessors each matched in priority order.
|
|
166
|
-
*/
|
|
167
|
-
export const LabelAnnotationId = Symbol.for('@dxos/schema/annotation/Label');
|
|
168
|
-
export const LabelAnnotation = createAnnotationHelper<string[]>(LabelAnnotationId);
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Identifies description property or JSON path expression.
|
|
172
|
-
* A string representing field accessor.
|
|
173
|
-
*/
|
|
174
|
-
export const DescriptionAnnotationId = Symbol.for('@dxos/schema/annotation/Description');
|
|
175
|
-
export const DescriptionAnnotation = createAnnotationHelper<string>(DescriptionAnnotationId);
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Identifies if a property should be included in a form or not.
|
|
179
|
-
* By default, all properties are included in forms, so this is opt-out.
|
|
180
|
-
*/
|
|
181
|
-
export const FormAnnotationId = Symbol.for('@dxos/schema/annotation/Form');
|
|
182
|
-
export const FormAnnotation = createAnnotationHelper<boolean>(FormAnnotationId);
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* Default field to be used on referenced schema to lookup the value.
|
|
186
|
-
*/
|
|
187
|
-
export const FieldLookupAnnotationId = Symbol.for('@dxos/schema/annotation/FieldLookup');
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* Generate test data.
|
|
191
|
-
*/
|
|
192
|
-
export const GeneratorAnnotationId = Symbol.for('@dxos/schema/annotation/Generator');
|
|
193
|
-
|
|
194
|
-
export type GeneratorAnnotationValue =
|
|
195
|
-
| string
|
|
196
|
-
| {
|
|
197
|
-
generator: string;
|
|
198
|
-
args?: any[];
|
|
199
|
-
probability?: number;
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
export const GeneratorAnnotation = createAnnotationHelper<GeneratorAnnotationValue>(GeneratorAnnotationId);
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* @returns DXN of the schema.
|
|
206
|
-
*
|
|
207
|
-
* For non-stored schema returns `dxn:type:`.
|
|
208
|
-
* For stored schema returns `dxn:echo:`.
|
|
209
|
-
* @deprecated Use `Type.getDXN`.
|
|
210
|
-
*/
|
|
211
|
-
export const getSchemaDXN = (schema: Schema.Schema.All): DXN | undefined => {
|
|
212
|
-
assertArgument(Schema.isSchema(schema), 'schema', 'invalid schema');
|
|
213
|
-
|
|
214
|
-
const id = getTypeIdentifierAnnotation(schema);
|
|
215
|
-
if (id) {
|
|
216
|
-
return DXN.parse(id);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
// TODO(dmaretskyi): Add support for dynamic schema.
|
|
220
|
-
const objectAnnotation = getTypeAnnotation(schema);
|
|
221
|
-
if (!objectAnnotation) {
|
|
222
|
-
return undefined;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
return DXN.fromTypenameAndVersion(objectAnnotation.typename, objectAnnotation.version);
|
|
226
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Schema from 'effect/Schema';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Kinds of entities stored in ECHO: objects and relations.
|
|
9
|
-
*/
|
|
10
|
-
export enum EntityKind {
|
|
11
|
-
Object = 'object',
|
|
12
|
-
Relation = 'relation',
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const EntityKindSchema = Schema.Enums(EntityKind);
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { PropertyMeta } from './annotations';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @internal
|
|
9
|
-
*/
|
|
10
|
-
export const FIELD_PATH_ANNOTATION = 'path';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Sets the path for the field.
|
|
14
|
-
* @param path Data source path in the json path format. This is the field path in the source object.
|
|
15
|
-
*/
|
|
16
|
-
// TODO(burdon): Field, vs. path vs. property.
|
|
17
|
-
export const FieldPath = (path: string) => PropertyMeta(FIELD_PATH_ANNOTATION, path);
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Option from 'effect/Option';
|
|
6
|
-
import * as Schema from 'effect/Schema';
|
|
7
|
-
|
|
8
|
-
import { type JsonPath, getField } from '@dxos/effect';
|
|
9
|
-
import { assertArgument, invariant } from '@dxos/invariant';
|
|
10
|
-
import { DXN, ObjectId } from '@dxos/keys';
|
|
11
|
-
import { assumeType } from '@dxos/util';
|
|
12
|
-
|
|
13
|
-
import { DescriptionAnnotation, LabelAnnotation } from '../ast';
|
|
14
|
-
|
|
15
|
-
import { type InternalObjectProps, SchemaId, SelfDXNId } from './model';
|
|
16
|
-
|
|
17
|
-
//
|
|
18
|
-
// Accessors based on model.
|
|
19
|
-
//
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Returns a DXN for an object or schema.
|
|
23
|
-
* @deprecated Use `Obj.getDXN`.
|
|
24
|
-
*/
|
|
25
|
-
export const getObjectDXN = (object: any): DXN | undefined => {
|
|
26
|
-
invariant(!Schema.isSchema(object), 'schema not allowed in this function');
|
|
27
|
-
assertArgument(typeof object === 'object' && object != null, 'object', 'expected object');
|
|
28
|
-
assumeType<InternalObjectProps>(object);
|
|
29
|
-
|
|
30
|
-
if (object[SelfDXNId]) {
|
|
31
|
-
invariant(object[SelfDXNId] instanceof DXN, 'Invalid object model: invalid self dxn');
|
|
32
|
-
return object[SelfDXNId];
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if (!ObjectId.isValid(object.id)) {
|
|
36
|
-
throw new TypeError('Object id is not valid.');
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return DXN.fromLocalObjectId(object.id);
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Returns the schema for the given object if one is defined.
|
|
44
|
-
*/
|
|
45
|
-
// TODO(burdon): Reconcile with `getTypename`.
|
|
46
|
-
// TODO(dmaretskyi): For echo objects, this always returns the root schema.
|
|
47
|
-
export const getSchema = (obj: unknown | undefined): Schema.Schema.AnyNoContext | undefined => {
|
|
48
|
-
if (obj) {
|
|
49
|
-
return (obj as any)[SchemaId];
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Internal use only.
|
|
55
|
-
*/
|
|
56
|
-
export const setSchema = (obj: any, schema: Schema.Schema.AnyNoContext) => {
|
|
57
|
-
Object.defineProperty(obj, SchemaId, {
|
|
58
|
-
value: schema,
|
|
59
|
-
writable: false,
|
|
60
|
-
enumerable: false,
|
|
61
|
-
configurable: false,
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* @deprecated Use {@link Obj.getLabel} instead.
|
|
67
|
-
* Returns the label for a given object based on {@link LabelAnnotationId}.
|
|
68
|
-
*/
|
|
69
|
-
export const getLabelForObject = (obj: unknown | undefined): string | undefined => {
|
|
70
|
-
const schema = getSchema(obj);
|
|
71
|
-
if (schema) {
|
|
72
|
-
return getLabel(schema, obj);
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Returns the label for a given object based on {@link LabelAnnotationId}.
|
|
78
|
-
*/
|
|
79
|
-
// TODO(burdon): Convert to JsonPath?
|
|
80
|
-
export const getLabel = <S extends Schema.Schema.Any>(schema: S, object: Schema.Schema.Type<S>): string | undefined => {
|
|
81
|
-
const annotation = LabelAnnotation.get(schema).pipe(Option.getOrElse(() => ['name']));
|
|
82
|
-
for (const accessor of annotation) {
|
|
83
|
-
assertArgument(
|
|
84
|
-
typeof accessor === 'string',
|
|
85
|
-
'accessor',
|
|
86
|
-
'Label annotation must be a string or an array of strings',
|
|
87
|
-
);
|
|
88
|
-
const value = getField(object, accessor as JsonPath);
|
|
89
|
-
switch (typeof value) {
|
|
90
|
-
case 'string':
|
|
91
|
-
case 'number':
|
|
92
|
-
case 'boolean':
|
|
93
|
-
case 'bigint':
|
|
94
|
-
case 'symbol':
|
|
95
|
-
return value.toString();
|
|
96
|
-
case 'undefined':
|
|
97
|
-
case 'object':
|
|
98
|
-
case 'function':
|
|
99
|
-
continue;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
return undefined;
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Sets the label for a given object based on {@link LabelAnnotationId}.
|
|
108
|
-
*/
|
|
109
|
-
export const setLabel = <S extends Schema.Schema.Any>(schema: S, object: Schema.Schema.Type<S>, label: string) => {
|
|
110
|
-
const annotation = LabelAnnotation.get(schema).pipe(
|
|
111
|
-
Option.map((field) => field[0]),
|
|
112
|
-
Option.getOrElse(() => 'name'),
|
|
113
|
-
);
|
|
114
|
-
object[annotation] = label;
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Returns the label for a given object based on {@link LabelAnnotationId}.
|
|
119
|
-
*/
|
|
120
|
-
// TODO(burdon): Convert to JsonPath?
|
|
121
|
-
export const getDescription = <S extends Schema.Schema.Any>(
|
|
122
|
-
schema: S,
|
|
123
|
-
object: Schema.Schema.Type<S>,
|
|
124
|
-
): string | undefined => {
|
|
125
|
-
const accessor = DescriptionAnnotation.get(schema).pipe(Option.getOrElse(() => 'description'));
|
|
126
|
-
assertArgument(typeof accessor === 'string', 'accessor', 'Description annotation must be a string');
|
|
127
|
-
const value = getField(object, accessor as JsonPath);
|
|
128
|
-
switch (typeof value) {
|
|
129
|
-
case 'string':
|
|
130
|
-
case 'number':
|
|
131
|
-
case 'boolean':
|
|
132
|
-
case 'bigint':
|
|
133
|
-
case 'symbol':
|
|
134
|
-
return value.toString();
|
|
135
|
-
case 'undefined':
|
|
136
|
-
case 'object':
|
|
137
|
-
case 'function':
|
|
138
|
-
default:
|
|
139
|
-
return undefined;
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Sets the description for a given object based on {@link DescriptionAnnotationId}.
|
|
145
|
-
*/
|
|
146
|
-
export const setDescription = <S extends Schema.Schema.Any>(
|
|
147
|
-
schema: S,
|
|
148
|
-
object: Schema.Schema.Type<S>,
|
|
149
|
-
description: string,
|
|
150
|
-
) => {
|
|
151
|
-
const accessor = DescriptionAnnotation.get(schema).pipe(Option.getOrElse(() => 'description'));
|
|
152
|
-
object[accessor] = description;
|
|
153
|
-
};
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { inspect } from 'util';
|
|
6
|
-
|
|
7
|
-
import * as Schema from 'effect/Schema';
|
|
8
|
-
import { describe, expect, test } from 'vitest';
|
|
9
|
-
|
|
10
|
-
import { DXN } from '@dxos/keys';
|
|
11
|
-
|
|
12
|
-
import { getSchemaDXN } from '../ast';
|
|
13
|
-
import { Testing } from '../testing';
|
|
14
|
-
import { isInstanceOf } from '../types';
|
|
15
|
-
|
|
16
|
-
import { getSchema } from './accessors';
|
|
17
|
-
import { create } from './create';
|
|
18
|
-
import { objectToJSON } from './json-serializer';
|
|
19
|
-
import { RelationSourceId, RelationTargetId } from './model';
|
|
20
|
-
import { getType } from './typename';
|
|
21
|
-
|
|
22
|
-
describe('create (static version)', () => {
|
|
23
|
-
test('defaults', ({ expect }) => {
|
|
24
|
-
const Contact = Schema.Struct({
|
|
25
|
-
name: Schema.String.pipe(
|
|
26
|
-
Schema.optional,
|
|
27
|
-
Schema.withConstructorDefault(() => 'Anonymous'),
|
|
28
|
-
),
|
|
29
|
-
email: Schema.String.pipe(Schema.optional),
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
const obj = Contact.make({});
|
|
33
|
-
expect(obj.name).toBe('Anonymous');
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
test('create static object', () => {
|
|
37
|
-
const contact = create(Testing.Person, {
|
|
38
|
-
name: 'Bot',
|
|
39
|
-
email: 'bot@example.com',
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
expect(contact.id).toBeDefined();
|
|
43
|
-
expect(contact.name).toBe('Bot');
|
|
44
|
-
expect(contact.email).toBe('bot@example.com');
|
|
45
|
-
expect((contact as any)['@type']).toBeUndefined();
|
|
46
|
-
expect(getType(contact)?.toString()).toBe(getSchemaDXN(Testing.Person)!.toString());
|
|
47
|
-
expect(isInstanceOf(Testing.Person, contact)).toBe(true);
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
test('JSON encoding', () => {
|
|
51
|
-
const contact = create(Testing.Person, {
|
|
52
|
-
name: 'Bot',
|
|
53
|
-
email: 'bot@example.com',
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
const json = JSON.parse(JSON.stringify(contact));
|
|
57
|
-
expect(json).toEqual({
|
|
58
|
-
id: contact.id,
|
|
59
|
-
'@type': DXN.fromTypenameAndVersion(Testing.Person.typename, Testing.Person.version).toString(),
|
|
60
|
-
'@meta': {
|
|
61
|
-
keys: [],
|
|
62
|
-
},
|
|
63
|
-
name: 'Bot',
|
|
64
|
-
email: 'bot@example.com',
|
|
65
|
-
});
|
|
66
|
-
expect(objectToJSON(contact)).toStrictEqual(json);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
test('JSON encoding with relation', () => {
|
|
70
|
-
const contactA = create(Testing.Person, {
|
|
71
|
-
name: 'Bot',
|
|
72
|
-
email: 'bot@example.com',
|
|
73
|
-
});
|
|
74
|
-
const contactB = create(Testing.Person, {
|
|
75
|
-
name: 'Bot',
|
|
76
|
-
email: 'bot@example.com',
|
|
77
|
-
});
|
|
78
|
-
const hasManager = create(Testing.HasManager, {
|
|
79
|
-
[RelationSourceId]: contactA,
|
|
80
|
-
[RelationTargetId]: contactB,
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
const json = JSON.parse(JSON.stringify(hasManager));
|
|
84
|
-
expect(json).toEqual({
|
|
85
|
-
id: hasManager.id,
|
|
86
|
-
'@type': DXN.fromTypenameAndVersion(Testing.HasManager.typename, Testing.HasManager.version).toString(),
|
|
87
|
-
'@relationSource': DXN.fromLocalObjectId(contactA.id).toString(),
|
|
88
|
-
'@relationTarget': DXN.fromLocalObjectId(contactB.id).toString(),
|
|
89
|
-
'@meta': {
|
|
90
|
-
keys: [],
|
|
91
|
-
},
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
test('getSchema', () => {
|
|
96
|
-
const contact = create(Testing.Person, {
|
|
97
|
-
name: 'Bot',
|
|
98
|
-
email: 'bot@example.com',
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
expect(getSchema(contact)).toBe(Testing.Person);
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
test('inspect', () => {
|
|
105
|
-
const contact = create(Testing.Person, {
|
|
106
|
-
name: 'Bot',
|
|
107
|
-
email: 'bot@example.com',
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
// console.log(contact);
|
|
111
|
-
|
|
112
|
-
const text = inspect(contact);
|
|
113
|
-
expect(text).toContain('Bot');
|
|
114
|
-
expect(text).toContain('bot@example.com');
|
|
115
|
-
expect(text).toContain('example.com/type/Person');
|
|
116
|
-
expect(text).toContain('0.1.0');
|
|
117
|
-
});
|
|
118
|
-
});
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import type * as Schema from 'effect/Schema';
|
|
6
|
-
|
|
7
|
-
import { raise } from '@dxos/debug';
|
|
8
|
-
import { assertArgument, failedInvariant } from '@dxos/invariant';
|
|
9
|
-
import { ObjectId } from '@dxos/keys';
|
|
10
|
-
import { defineHiddenProperty } from '@dxos/live-object';
|
|
11
|
-
|
|
12
|
-
import { EntityKind, getSchemaDXN, getTypeAnnotation } from '../ast';
|
|
13
|
-
|
|
14
|
-
import { getObjectDXN, setSchema } from './accessors';
|
|
15
|
-
import { attachedTypedObjectInspector } from './inspect';
|
|
16
|
-
import { attachTypedJsonSerializer } from './json-serializer';
|
|
17
|
-
import {
|
|
18
|
-
EntityKindId,
|
|
19
|
-
MetaId,
|
|
20
|
-
RelationSourceDXNId,
|
|
21
|
-
RelationSourceId,
|
|
22
|
-
RelationTargetDXNId,
|
|
23
|
-
RelationTargetId,
|
|
24
|
-
assertObjectModelShape,
|
|
25
|
-
} from './model';
|
|
26
|
-
import { setTypename } from './typename';
|
|
27
|
-
|
|
28
|
-
// Make `id` optional.
|
|
29
|
-
type CreateData<T> = T extends { id: string } ? Omit<T, 'id' | typeof EntityKindId> & { id?: string } : T;
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Creates a new object instance from a schema and data, without signal reactivity.
|
|
33
|
-
* This static version creates plain JavaScript objects that are not reactive/observable.
|
|
34
|
-
* For reactive objects that automatically update UI when changed, use the regular live() function.
|
|
35
|
-
*
|
|
36
|
-
* @param schema - The Effect schema that defines the object's structure and type, piped into EchoObject
|
|
37
|
-
* @param data - The data to initialize the object with. The id and @type fields are handled automatically.
|
|
38
|
-
* @returns A new non-reactive object instance conforming to the schema
|
|
39
|
-
* @throws {Error} If the schema is not an object schema
|
|
40
|
-
* @throws {TypeError} If data contains an @type field
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* ```ts
|
|
44
|
-
* const Contact = Schema.Struct({
|
|
45
|
-
* name: Schema.String,
|
|
46
|
-
* email: Schema.String,
|
|
47
|
-
* }).pipe(Type.Obj({
|
|
48
|
-
* typename: 'example.com/type/Person',
|
|
49
|
-
* version: '0.1.0',
|
|
50
|
-
* }))
|
|
51
|
-
*
|
|
52
|
-
* // Creates a non-reactive contact object
|
|
53
|
-
* const contact = create(Contact, {
|
|
54
|
-
* name: "John",
|
|
55
|
-
* email: "john@example.com",
|
|
56
|
-
* })
|
|
57
|
-
* ```
|
|
58
|
-
*/
|
|
59
|
-
// TODO(burdon): Rename make.
|
|
60
|
-
// TODO(burdon): Handle defaults (see Schema.make).
|
|
61
|
-
// TODO(dmaretskyi): Use `Obj.make` and `Relation.make` from '@dxos/echo' instead.
|
|
62
|
-
export const create = <S extends Schema.Schema.AnyNoContext>(
|
|
63
|
-
schema: S,
|
|
64
|
-
data: CreateData<Schema.Schema.Type<S>>,
|
|
65
|
-
): CreateData<Schema.Schema.Type<S>> & { id: string } => {
|
|
66
|
-
const annotation = getTypeAnnotation(schema);
|
|
67
|
-
if (!annotation) {
|
|
68
|
-
throw new Error('Schema is not an object schema');
|
|
69
|
-
}
|
|
70
|
-
assertArgument(!('@type' in data), 'data', '@type is not allowed');
|
|
71
|
-
assertArgument(!(RelationSourceDXNId in data), 'data', 'Relation source DXN is not allowed in the constructor');
|
|
72
|
-
assertArgument(!(RelationTargetDXNId in data), 'data', 'Relation target DXN is not allowed in the constructor');
|
|
73
|
-
assertArgument(
|
|
74
|
-
RelationSourceId in data === RelationTargetId in data,
|
|
75
|
-
'data',
|
|
76
|
-
'Relation source and target must be provided together',
|
|
77
|
-
);
|
|
78
|
-
|
|
79
|
-
const obj = { ...data, id: data.id ?? ObjectId.random() };
|
|
80
|
-
const kind = RelationSourceId in data ? EntityKind.Relation : EntityKind.Object;
|
|
81
|
-
defineHiddenProperty(obj, EntityKindId, kind);
|
|
82
|
-
setTypename(obj, getSchemaDXN(schema) ?? failedInvariant('Missing schema DXN'));
|
|
83
|
-
setSchema(obj, schema);
|
|
84
|
-
attachTypedJsonSerializer(obj);
|
|
85
|
-
attachedTypedObjectInspector(obj);
|
|
86
|
-
defineHiddenProperty(obj, MetaId, { keys: [] });
|
|
87
|
-
if (kind === EntityKind.Relation) {
|
|
88
|
-
const sourceDXN = getObjectDXN(data[RelationSourceId]) ?? raise(new Error('Unresolved relation source'));
|
|
89
|
-
const targetDXN = getObjectDXN(data[RelationTargetId]) ?? raise(new Error('Unresolved relation target'));
|
|
90
|
-
defineHiddenProperty(obj, RelationSourceDXNId, sourceDXN);
|
|
91
|
-
defineHiddenProperty(obj, RelationTargetDXNId, targetDXN);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
assertObjectModelShape(obj);
|
|
95
|
-
return obj;
|
|
96
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import type { BaseObject } from '../types';
|
|
6
|
-
|
|
7
|
-
import { DeletedId } from './model';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @returns `true` if the object has been marked as deleted.
|
|
11
|
-
*/
|
|
12
|
-
export const isDeleted = (obj: BaseObject): boolean => {
|
|
13
|
-
if ((obj as any)[DeletedId] === undefined) {
|
|
14
|
-
// TODO(dmaretskyi): Return to prior behavior of throwing.
|
|
15
|
-
// throw new Error('Object does not support deletion marker');
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
return (obj as any)[DeletedId] ?? false;
|
|
19
|
-
};
|