@dxos/echo 0.8.4-main.ead640a → 0.8.4-main.effb148878
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 +39 -0
- package/dist/lib/neutral/Database.mjs +49 -0
- package/dist/lib/neutral/Entity.mjs +68 -0
- package/dist/lib/neutral/Err.mjs +12 -0
- package/dist/lib/neutral/Extension.mjs +18 -0
- package/dist/lib/neutral/Feed.mjs +54 -0
- package/dist/lib/neutral/Filter.mjs +74 -0
- package/dist/lib/neutral/Filter.mjs.map +7 -0
- package/dist/lib/neutral/Format.mjs +86 -0
- package/dist/lib/neutral/Format.mjs.map +7 -0
- package/dist/lib/neutral/JsonSchema.mjs +19 -0
- package/dist/lib/neutral/JsonSchema.mjs.map +7 -0
- package/dist/lib/neutral/Key.mjs +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 +114 -0
- package/dist/lib/neutral/Obj.mjs.map +7 -0
- package/dist/lib/neutral/Order.mjs +12 -0
- package/dist/lib/neutral/Order.mjs.map +7 -0
- package/dist/lib/neutral/Query.mjs +38 -0
- package/dist/lib/neutral/Query.mjs.map +7 -0
- package/dist/lib/neutral/QueryResult.mjs +2 -0
- package/dist/lib/neutral/QueryResult.mjs.map +7 -0
- package/dist/lib/neutral/Ref.mjs +26 -0
- package/dist/lib/neutral/Ref.mjs.map +7 -0
- package/dist/lib/neutral/Relation.mjs +95 -0
- package/dist/lib/neutral/Relation.mjs.map +7 -0
- package/dist/lib/neutral/SchemaRegistry.mjs +2 -0
- package/dist/lib/neutral/SchemaRegistry.mjs.map +7 -0
- package/dist/lib/neutral/Tag.mjs +29 -0
- package/dist/lib/neutral/Tag.mjs.map +7 -0
- package/dist/lib/neutral/Type.mjs +63 -0
- package/dist/lib/neutral/Type.mjs.map +7 -0
- package/dist/lib/neutral/chunk-4SYHDOQA.mjs +48 -0
- package/dist/lib/neutral/chunk-4SYHDOQA.mjs.map +7 -0
- package/dist/lib/neutral/chunk-4U7OD55H.mjs +47 -0
- package/dist/lib/neutral/chunk-4U7OD55H.mjs.map +7 -0
- package/dist/lib/neutral/chunk-52NG2XEE.mjs +34 -0
- package/dist/lib/neutral/chunk-52NG2XEE.mjs.map +7 -0
- package/dist/lib/neutral/chunk-A5HDDVKS.mjs +94 -0
- package/dist/lib/neutral/chunk-A5HDDVKS.mjs.map +7 -0
- package/dist/lib/neutral/chunk-EZ4XJFHJ.mjs +54 -0
- package/dist/lib/neutral/chunk-EZ4XJFHJ.mjs.map +7 -0
- package/dist/lib/neutral/chunk-F625JEZB.mjs +365 -0
- package/dist/lib/neutral/chunk-F625JEZB.mjs.map +7 -0
- package/dist/lib/neutral/chunk-FFCN66OF.mjs +420 -0
- package/dist/lib/neutral/chunk-FFCN66OF.mjs.map +7 -0
- package/dist/lib/neutral/chunk-GOHDOJE3.mjs +51 -0
- package/dist/lib/neutral/chunk-GOHDOJE3.mjs.map +7 -0
- package/dist/lib/neutral/chunk-GWFFC34K.mjs +50 -0
- package/dist/lib/neutral/chunk-GWFFC34K.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-J7QWJQQV.mjs +318 -0
- package/dist/lib/neutral/chunk-J7QWJQQV.mjs.map +7 -0
- package/dist/lib/neutral/chunk-JTHNDGAR.mjs +27 -0
- package/dist/lib/neutral/chunk-JTHNDGAR.mjs.map +7 -0
- package/dist/lib/neutral/chunk-K5RH2PBH.mjs +361 -0
- package/dist/lib/neutral/chunk-K5RH2PBH.mjs.map +7 -0
- package/dist/lib/neutral/chunk-KHRAQDYX.mjs +343 -0
- package/dist/lib/neutral/chunk-KHRAQDYX.mjs.map +7 -0
- package/dist/lib/neutral/chunk-L65CW5EI.mjs +156 -0
- package/dist/lib/neutral/chunk-L65CW5EI.mjs.map +7 -0
- package/dist/lib/neutral/chunk-LNZIPZX6.mjs +2186 -0
- package/dist/lib/neutral/chunk-LNZIPZX6.mjs.map +7 -0
- package/dist/lib/neutral/chunk-MPXUNTME.mjs +41 -0
- package/dist/lib/neutral/chunk-MPXUNTME.mjs.map +7 -0
- package/dist/lib/neutral/chunk-O2EOH7XQ.mjs +420 -0
- package/dist/lib/neutral/chunk-O2EOH7XQ.mjs.map +7 -0
- package/dist/lib/neutral/chunk-Q7ID37KF.mjs +278 -0
- package/dist/lib/neutral/chunk-Q7ID37KF.mjs.map +7 -0
- package/dist/lib/neutral/chunk-QLYEQ5VA.mjs +205 -0
- package/dist/lib/neutral/chunk-QLYEQ5VA.mjs.map +7 -0
- package/dist/lib/neutral/chunk-SSDGRJ3A.mjs +747 -0
- package/dist/lib/neutral/chunk-SSDGRJ3A.mjs.map +7 -0
- package/dist/lib/neutral/chunk-TTCSATUD.mjs +42 -0
- package/dist/lib/neutral/chunk-TTCSATUD.mjs.map +7 -0
- package/dist/lib/neutral/chunk-UEFRFUYC.mjs +25 -0
- package/dist/lib/neutral/chunk-UEFRFUYC.mjs.map +7 -0
- package/dist/lib/neutral/chunk-UN7K472Q.mjs +132 -0
- package/dist/lib/neutral/chunk-UN7K472Q.mjs.map +7 -0
- package/dist/lib/neutral/chunk-UQAMAXDU.mjs +243 -0
- package/dist/lib/neutral/chunk-UQAMAXDU.mjs.map +7 -0
- package/dist/lib/neutral/chunk-V5NE2X7Y.mjs +7 -0
- package/dist/lib/neutral/chunk-V5NE2X7Y.mjs.map +7 -0
- package/dist/lib/neutral/chunk-V72DY6LU.mjs +7 -0
- package/dist/lib/neutral/chunk-V72DY6LU.mjs.map +7 -0
- package/dist/lib/neutral/chunk-ZII2BGPM.mjs +269 -0
- package/dist/lib/neutral/chunk-ZII2BGPM.mjs.map +7 -0
- package/dist/lib/neutral/chunk-ZM7VFIS2.mjs +93 -0
- package/dist/lib/neutral/chunk-ZM7VFIS2.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 +513 -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 +418 -0
- package/dist/lib/neutral/testing/index.mjs.map +7 -0
- package/dist/types/src/Annotation.d.ts +24 -0
- package/dist/types/src/Annotation.d.ts.map +1 -0
- package/dist/types/src/Collection.d.ts +15 -0
- package/dist/types/src/Collection.d.ts.map +1 -0
- package/dist/types/src/Database.d.ts +201 -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 +236 -0
- package/dist/types/src/Entity.d.ts.map +1 -0
- package/dist/types/src/Entity.test.d.ts +2 -0
- package/dist/types/src/Entity.test.d.ts.map +1 -0
- package/dist/types/src/Err.d.ts +107 -0
- package/dist/types/src/Err.d.ts.map +1 -0
- package/dist/types/src/Extension.d.ts +80 -0
- package/dist/types/src/Extension.d.ts.map +1 -0
- package/dist/types/src/Extension.test.d.ts +2 -0
- package/dist/types/src/Extension.test.d.ts.map +1 -0
- package/dist/types/src/Feed.d.ts +229 -0
- package/dist/types/src/Feed.d.ts.map +1 -0
- package/dist/types/src/Filter.d.ts +183 -0
- package/dist/types/src/Filter.d.ts.map +1 -0
- package/dist/types/src/Filter.test.d.ts +2 -0
- package/dist/types/src/Filter.test.d.ts.map +1 -0
- package/dist/types/src/Format.d.ts +4 -0
- package/dist/types/src/Format.d.ts.map +1 -0
- package/dist/types/src/Hypergraph.d.ts +65 -0
- package/dist/types/src/Hypergraph.d.ts.map +1 -0
- package/dist/types/src/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 +459 -107
- package/dist/types/src/Obj.d.ts.map +1 -1
- package/dist/types/src/Obj.test.d.ts +2 -0
- package/dist/types/src/Obj.test.d.ts.map +1 -0
- package/dist/types/src/Order.d.ts +16 -0
- package/dist/types/src/Order.d.ts.map +1 -0
- package/dist/types/src/Query.d.ts +225 -0
- package/dist/types/src/Query.d.ts.map +1 -0
- package/dist/types/src/Query.test.d.ts +2 -0
- package/dist/types/src/Query.test.d.ts.map +1 -0
- package/dist/types/src/QueryResult.d.ts +80 -0
- package/dist/types/src/QueryResult.d.ts.map +1 -0
- package/dist/types/src/Ref.d.ts +69 -11
- package/dist/types/src/Ref.d.ts.map +1 -1
- package/dist/types/src/Relation.d.ts +316 -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/SchemaRegistry.d.ts +83 -0
- package/dist/types/src/SchemaRegistry.d.ts.map +1 -0
- package/dist/types/src/Tag.d.ts +18 -0
- package/dist/types/src/Tag.d.ts.map +1 -0
- package/dist/types/src/Type.d.ts +378 -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 +22 -5
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/internal/Annotation/annotations.d.ts +251 -0
- package/dist/types/src/internal/Annotation/annotations.d.ts.map +1 -0
- package/dist/types/src/internal/Annotation/annotations.test.d.ts.map +1 -0
- package/dist/types/src/internal/Annotation/index.d.ts +4 -0
- package/dist/types/src/internal/Annotation/index.d.ts.map +1 -0
- package/dist/types/src/internal/Annotation/sorting.d.ts +24 -0
- package/dist/types/src/internal/Annotation/sorting.d.ts.map +1 -0
- package/dist/types/src/internal/Annotation/util.d.ts +48 -0
- package/dist/types/src/internal/Annotation/util.d.ts.map +1 -0
- package/dist/types/src/internal/Entity/api.d.ts +13 -0
- package/dist/types/src/internal/Entity/api.d.ts.map +1 -0
- package/dist/types/src/internal/Entity/entity.d.ts +67 -0
- package/dist/types/src/internal/Entity/entity.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 +57 -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 +51 -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 +25 -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 +6 -3
- 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/Format/object.d.ts.map +1 -0
- package/dist/types/src/internal/{formats → Format}/select.d.ts +6 -4
- package/dist/types/src/internal/Format/select.d.ts.map +1 -0
- package/dist/types/src/internal/{formats → Format}/string.d.ts +4 -0
- package/dist/types/src/internal/Format/string.d.ts.map +1 -0
- package/dist/types/src/internal/{formats → Format}/types.d.ts +14 -10
- package/dist/types/src/internal/Format/types.d.ts.map +1 -0
- package/dist/types/src/internal/{json → JsonSchema}/annotations.d.ts +1 -1
- package/dist/types/src/internal/JsonSchema/annotations.d.ts.map +1 -0
- package/dist/types/src/internal/JsonSchema/effect-schema.test.d.ts.map +1 -0
- package/dist/types/src/internal/JsonSchema/index.d.ts +5 -0
- package/dist/types/src/internal/JsonSchema/index.d.ts.map +1 -0
- package/dist/types/src/internal/JsonSchema/json-schema-normalize.d.ts.map +1 -0
- package/dist/types/src/internal/{json-schema → JsonSchema}/json-schema-type.d.ts +131 -30
- package/dist/types/src/internal/JsonSchema/json-schema-type.d.ts.map +1 -0
- package/dist/types/src/internal/{json → JsonSchema}/json-schema.d.ts +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/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} +13 -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 +10 -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.d.ts +10 -0
- package/dist/types/src/internal/Query.d.ts.map +1 -0
- package/dist/types/src/internal/Ref/index.d.ts.map +1 -0
- package/dist/types/src/internal/{ref → Ref}/ref-array.d.ts +4 -4
- package/dist/types/src/internal/Ref/ref-array.d.ts.map +1 -0
- package/dist/types/src/internal/{ref → Ref}/ref.d.ts +79 -31
- package/dist/types/src/internal/Ref/ref.d.ts.map +1 -0
- package/dist/types/src/internal/Ref/ref.test.d.ts.map +1 -0
- package/dist/types/src/internal/Type/compose.d.ts +7 -0
- package/dist/types/src/internal/Type/compose.d.ts.map +1 -0
- package/dist/types/src/internal/Type/compose.test.d.ts.map +1 -0
- package/dist/types/src/internal/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 +42 -0
- package/dist/types/src/internal/common/api/meta.d.ts.map +1 -0
- package/dist/types/src/internal/common/index.d.ts +4 -0
- package/dist/types/src/internal/common/index.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/change-context.d.ts +55 -0
- package/dist/types/src/internal/common/proxy/change-context.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/change.test.d.ts +2 -0
- package/dist/types/src/internal/common/proxy/change.test.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/define-hidden-property.d.ts +5 -0
- package/dist/types/src/internal/common/proxy/define-hidden-property.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/errors.d.ts +19 -0
- package/dist/types/src/internal/common/proxy/errors.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/event-batch.d.ts +10 -0
- package/dist/types/src/internal/common/proxy/event-batch.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/handler.test.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/index.d.ts +14 -0
- package/dist/types/src/internal/common/proxy/index.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/json-serializer.d.ts +6 -0
- package/dist/types/src/internal/common/proxy/json-serializer.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/make-object.d.ts +19 -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 +43 -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 +58 -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/index.d.ts +10 -14
- package/dist/types/src/internal/index.d.ts.map +1 -1
- package/dist/types/src/{test → testing}/api.test.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +3 -3
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-data.d.ts +18 -0
- package/dist/types/src/testing/test-data.d.ts.map +1 -0
- package/dist/types/src/testing/test-schema.d.ts +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 +117 -66
- package/src/Annotation.ts +49 -0
- package/src/Collection.ts +36 -0
- package/src/Database.ts +356 -0
- package/src/Dataset.ts +34 -0
- package/src/Entity.test.ts +132 -0
- package/src/Entity.ts +332 -0
- package/src/Err.ts +40 -0
- package/src/Extension.test.ts +235 -0
- package/src/Extension.ts +122 -0
- package/src/Feed.ts +356 -0
- package/src/Filter.test.ts +90 -0
- package/src/Filter.ts +507 -0
- package/src/Format.ts +9 -0
- package/src/Hypergraph.ts +79 -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 +550 -0
- package/src/Obj.ts +754 -267
- package/src/Order.ts +46 -0
- package/src/Query.test.ts +822 -0
- package/src/Query.ts +589 -0
- package/src/QueryResult.ts +106 -0
- package/src/Ref.ts +98 -10
- package/src/Relation.test.ts +88 -0
- package/src/Relation.ts +491 -67
- package/src/SchemaRegistry.ts +101 -0
- package/src/{query/tag.ts → Tag.ts} +15 -12
- package/src/Type.test.ts +197 -0
- package/src/Type.ts +605 -151
- package/src/View.ts +101 -0
- package/src/exemplars.test.ts +21 -0
- package/src/hierarchy.test.ts +33 -0
- package/src/index.ts +23 -6
- package/src/internal/Annotation/annotations.test.ts +165 -0
- package/src/internal/Annotation/annotations.ts +567 -0
- package/src/internal/Annotation/index.ts +7 -0
- package/src/internal/Annotation/sorting.ts +51 -0
- package/src/internal/Annotation/util.ts +93 -0
- package/src/internal/Entity/api.ts +30 -0
- package/src/internal/Entity/entity.ts +246 -0
- package/src/internal/Entity/index.ts +13 -0
- package/src/internal/Entity/model.ts +120 -0
- package/src/internal/Entity/object.ts +65 -0
- package/src/internal/Entity/relation.ts +179 -0
- package/src/internal/Entity/type-kind.ts +67 -0
- package/src/internal/Entity/type-uri.ts +87 -0
- package/src/internal/Entity/util.ts +34 -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 +6 -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 +4 -4
- package/src/internal/{formats → Format}/select.ts +6 -4
- package/src/internal/{formats → Format}/string.ts +14 -9
- package/src/internal/{formats → Format}/types.ts +54 -43
- package/src/internal/{json → JsonSchema}/annotations.ts +3 -3
- package/src/internal/{json-schema → JsonSchema}/index.ts +2 -0
- package/src/internal/{json-schema → JsonSchema}/json-schema-normalize.ts +4 -2
- package/src/internal/{json-schema → JsonSchema}/json-schema-type.ts +36 -36
- package/src/internal/{json → JsonSchema}/json-schema.test.ts +92 -175
- package/src/internal/{json → JsonSchema}/json-schema.ts +69 -37
- package/src/internal/Obj/clone.ts +52 -0
- package/src/internal/{object → Obj}/common.ts +3 -4
- package/src/internal/{object/create.test.ts → Obj/create-object.test.ts} +34 -37
- package/src/internal/Obj/create-object.ts +135 -0
- package/src/internal/Obj/deleted.ts +19 -0
- package/src/internal/Obj/index.ts +13 -0
- package/src/internal/{object → Obj}/inspect.ts +5 -7
- package/src/internal/Obj/json-serializer.test.ts +185 -0
- package/src/internal/Obj/json-serializer.ts +260 -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 +165 -0
- package/src/internal/Obj/snapshot.ts +111 -0
- package/src/internal/Obj/typed-object.test.ts +32 -0
- package/src/internal/Obj/typed-object.ts +30 -0
- package/src/internal/Query.ts +156 -0
- package/src/internal/{ref → Ref}/ref-array.ts +4 -5
- package/src/internal/{ref → Ref}/ref.test.ts +21 -30
- package/src/internal/{ref → Ref}/ref.ts +209 -98
- 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 +88 -0
- package/src/internal/{testing → common}/index.ts +2 -1
- package/src/internal/common/proxy/change-context.ts +138 -0
- package/src/internal/common/proxy/change.test.ts +519 -0
- package/src/internal/common/proxy/define-hidden-property.ts +14 -0
- package/src/internal/common/proxy/errors.ts +42 -0
- package/src/internal/common/proxy/event-batch.ts +44 -0
- package/src/internal/common/proxy/handler.test.ts +121 -0
- package/src/internal/common/proxy/index.ts +17 -0
- package/src/internal/common/proxy/json-serializer.ts +93 -0
- package/src/internal/common/proxy/make-object.ts +128 -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 +507 -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 +10 -0
- package/src/internal/common/types/meta.ts +79 -0
- package/src/internal/common/types/model-symbols.ts +74 -0
- package/src/internal/common/types/typename.ts +91 -0
- package/src/internal/common/types/version.ts +19 -0
- package/src/internal/index.ts +12 -17
- package/src/testing/api.test.ts +129 -0
- package/src/testing/index.ts +3 -3
- 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-HKFCK2GL.mjs +0 -175
- package/dist/lib/browser/chunk-HKFCK2GL.mjs.map +0 -7
- package/dist/lib/browser/chunk-MAAYELT7.mjs +0 -830
- package/dist/lib/browser/chunk-MAAYELT7.mjs.map +0 -7
- package/dist/lib/browser/chunk-MB6MMNFP.mjs +0 -3857
- package/dist/lib/browser/chunk-MB6MMNFP.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -35
- package/dist/lib/browser/internal/index.mjs +0 -332
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/query/index.mjs +0 -15
- package/dist/lib/browser/testing/index.mjs +0 -298
- package/dist/lib/browser/testing/index.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-5NWDGIBT.mjs +0 -830
- package/dist/lib/node-esm/chunk-5NWDGIBT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-AUAH4E2J.mjs +0 -175
- package/dist/lib/node-esm/chunk-AUAH4E2J.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BQRA4VLX.mjs +0 -3857
- package/dist/lib/node-esm/chunk-BQRA4VLX.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -35
- package/dist/lib/node-esm/internal/index.mjs +0 -332
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/query/index.mjs +0 -15
- package/dist/lib/node-esm/testing/index.mjs +0 -298
- package/dist/lib/node-esm/testing/index.mjs.map +0 -7
- package/dist/types/src/errors.d.ts +0 -72
- 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 -125
- 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.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 -455
- 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 -3
- 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/query/tag.d.ts +0 -17
- package/dist/types/src/query/tag.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 -113
- 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 -219
- package/src/internal/ast/entity-kind.ts +0 -15
- package/src/internal/ast/index.ts +0 -8
- package/src/internal/ast/types.ts +0 -17
- package/src/internal/json/index.ts +0 -5
- package/src/internal/object/accessors.ts +0 -153
- package/src/internal/object/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/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 -211
- 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 -91
- /package/dist/lib/{browser/index.mjs.map → neutral/Annotation.mjs.map} +0 -0
- /package/dist/lib/{browser/internal/index.mjs.map → neutral/Database.mjs.map} +0 -0
- /package/dist/lib/{browser/query/index.mjs.map → neutral/Entity.mjs.map} +0 -0
- /package/dist/lib/{node-esm/index.mjs.map → neutral/Err.mjs.map} +0 -0
- /package/dist/lib/{node-esm/internal/index.mjs.map → neutral/Extension.mjs.map} +0 -0
- /package/dist/lib/{node-esm/query/index.mjs.map → neutral/Feed.mjs.map} +0 -0
- /package/dist/types/src/internal/{ast → Annotation}/annotations.test.d.ts +0 -0
- /package/dist/types/src/internal/{formats → Format}/date.d.ts +0 -0
- /package/dist/types/src/internal/{formats → Format}/date.test.d.ts +0 -0
- /package/dist/types/src/internal/{formats → Format}/format.test.d.ts +0 -0
- /package/dist/types/src/internal/{formats → Format}/number.d.ts +0 -0
- /package/dist/types/src/internal/{formats → Format}/object.d.ts +0 -0
- /package/dist/types/src/internal/{json → JsonSchema}/effect-schema.test.d.ts +0 -0
- /package/dist/types/src/internal/{json-schema → JsonSchema}/json-schema-normalize.d.ts +0 -0
- /package/dist/types/src/internal/{json → JsonSchema}/json-schema.test.d.ts +0 -0
- /package/dist/types/src/internal/{object → Obj}/common.d.ts +0 -0
- /package/dist/types/src/internal/{object → Obj}/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
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
|
|
7
|
+
// NOTE: String literals are used instead of unique symbols for both KindId and SchemaKindId.
|
|
8
|
+
// Unique symbols cause TS4023 "cannot be named" errors when external packages
|
|
9
|
+
// try to export types that reference this key (e.g., `export const Graph = ...`).
|
|
10
|
+
// TypeScript cannot emit declaration files that reference unique symbols from
|
|
11
|
+
// external modules. Using a string literal allows the type to be inlined in
|
|
12
|
+
// declaration files, making the API portable across package boundaries.
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* String key used to identify the kind of an entity instance (object or relation).
|
|
16
|
+
*/
|
|
17
|
+
export const KindId = '~@dxos/echo/Kind' as const;
|
|
18
|
+
export type KindId = typeof KindId;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* String key used to identify the kind of a schema (object schema or relation schema).
|
|
22
|
+
* Parallels KindId which identifies instance kinds.
|
|
23
|
+
*/
|
|
24
|
+
export const SchemaKindId = '~@dxos/echo/SchemaKind' as const;
|
|
25
|
+
export type SchemaKindId = typeof SchemaKindId;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* String key used to brand snapshot types.
|
|
29
|
+
* Snapshots have SnapshotKindId instead of KindId, making them
|
|
30
|
+
* distinguishable from reactive objects at the type level.
|
|
31
|
+
*/
|
|
32
|
+
export const SnapshotKindId = '~@dxos/echo/SnapshotKind' as const;
|
|
33
|
+
export type SnapshotKindId = typeof SnapshotKindId;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Hidden slot on a static `Type.Type` entity that holds the source Effect
|
|
37
|
+
* Schema. `Type.getSchema(...)` reads this for static types; persisted types
|
|
38
|
+
* rebuild from `jsonSchema` instead. Stored as a string key for declaration
|
|
39
|
+
* portability (see KindId comment above).
|
|
40
|
+
*/
|
|
41
|
+
export const StaticTypeSchemaSlot = '~@dxos/echo/Type.StaticSchema' as const;
|
|
42
|
+
export type StaticTypeSchemaSlot = typeof StaticTypeSchemaSlot;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Read the hidden `StaticTypeSchemaSlot` off any value that may carry one.
|
|
46
|
+
* Returns `undefined` for raw schemas (no slot) and non-object inputs.
|
|
47
|
+
* Single point-of-cast for the slot lookup.
|
|
48
|
+
*/
|
|
49
|
+
export const getStaticTypeSchema = (value: unknown): Schema.Schema.AnyNoContext | undefined => {
|
|
50
|
+
if (value == null || typeof value !== 'object') {
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
return (value as { [StaticTypeSchemaSlot]?: Schema.Schema.AnyNoContext })[StaticTypeSchemaSlot];
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Read the `[SchemaKindId]` brand off a value. Returns `undefined` for raw
|
|
58
|
+
* schemas (which don't carry the brand on their static type) and non-object
|
|
59
|
+
* inputs. Single point-of-cast for the brand lookup.
|
|
60
|
+
*/
|
|
61
|
+
export const getSchemaKind = (value: unknown): EntityKind | undefined => {
|
|
62
|
+
if (value == null || typeof value !== 'object') {
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
return (value as { [SchemaKindId]?: EntityKind })[SchemaKindId];
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Read the `[KindId]` brand off a value. Returns `undefined` for raw schemas
|
|
70
|
+
* and non-object inputs. Companion to {@link getSchemaKind}.
|
|
71
|
+
*/
|
|
72
|
+
export const getEntityKindBrand = (value: unknown): EntityKind | undefined => {
|
|
73
|
+
if (value == null || typeof value !== 'object') {
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
return (value as { [KindId]?: EntityKind })[KindId];
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Phantom string key on `Type<A>` entities that carries the instance type `A`.
|
|
81
|
+
* Lets internal helpers (`makeObject`, `createObject`, etc.) pattern-match the
|
|
82
|
+
* instance type from an entity input without importing from the top-level
|
|
83
|
+
* `Type` module. Mirrors `Type.InstancePhantomId` (declared in `Type.ts`).
|
|
84
|
+
*
|
|
85
|
+
* Stored as a string key so declarations remain portable across packages
|
|
86
|
+
* (see KindId comment above).
|
|
87
|
+
*/
|
|
88
|
+
export const InstancePhantomId = '~@dxos/echo/Type.Instance' as const;
|
|
89
|
+
export type InstancePhantomId = typeof InstancePhantomId;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Nominal brand carried by the well-known "any object" / "any relation"
|
|
93
|
+
* schemas (`Obj.Unknown`, `Relation.Unknown`). The brand lets `Ref.Ref`,
|
|
94
|
+
* `Filter.type`, and `Query.type` accept these schemas in addition to
|
|
95
|
+
* `Type.Type` entities, without opening the door to arbitrary raw schemas.
|
|
96
|
+
*
|
|
97
|
+
* Stored as a string key so declarations remain portable across packages
|
|
98
|
+
* (see KindId comment above).
|
|
99
|
+
*/
|
|
100
|
+
export const UnknownTypeSchemaBrandId = '~@dxos/echo/UnknownTypeSchemaBrand' as const;
|
|
101
|
+
export type UnknownTypeSchemaBrandId = typeof UnknownTypeSchemaBrandId;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Schema-side companion to `Type.Type` entities for the "any object" /
|
|
105
|
+
* "any relation" cases. Branded so `Ref.Ref` / `Filter.type` / `Query.type`
|
|
106
|
+
* can pattern-match on it; arbitrary `Schema.Schema` values do not satisfy
|
|
107
|
+
* this shape.
|
|
108
|
+
*/
|
|
109
|
+
export interface UnknownTypeSchema<A, K extends EntityKind> extends Schema.Schema<A, any, never> {
|
|
110
|
+
readonly [UnknownTypeSchemaBrandId]: K;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Kinds of entities stored in ECHO: objects, relations, and types.
|
|
115
|
+
*/
|
|
116
|
+
export enum EntityKind {
|
|
117
|
+
Object = 'object',
|
|
118
|
+
Relation = 'relation',
|
|
119
|
+
Type = 'type',
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export const EntityKindSchema = Schema.Enums(EntityKind);
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Typename for generic object references (Type.Obj / Ref.Ref(Obj.Unknown)).
|
|
126
|
+
* Used when referencing any object without a specific schema.
|
|
127
|
+
*/
|
|
128
|
+
export const ANY_OBJECT_TYPENAME = 'org.dxos.schema.anyObject';
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Version for generic object references.
|
|
132
|
+
*/
|
|
133
|
+
export const ANY_OBJECT_VERSION = '0.0.0';
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
|
|
7
|
+
import { ForeignKey } from '@dxos/echo-protocol';
|
|
8
|
+
import { invariant } from '@dxos/invariant';
|
|
9
|
+
import { type Comparator, intersection } from '@dxos/util';
|
|
10
|
+
|
|
11
|
+
import type * as Entity from '../../../Entity';
|
|
12
|
+
import { type AnyProperties } from './base';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Property name for meta when object is serialized to JSON.
|
|
16
|
+
*/
|
|
17
|
+
export const ATTR_META = '@meta';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Metadata section.
|
|
21
|
+
*/
|
|
22
|
+
export const MetaId: Entity.Meta = Symbol.for('@dxos/echo/Meta') as any;
|
|
23
|
+
|
|
24
|
+
//
|
|
25
|
+
// ObjectMeta
|
|
26
|
+
//
|
|
27
|
+
|
|
28
|
+
// TODO(dmaretskyi): Rename to ObjectMeta
|
|
29
|
+
export const ObjectMetaSchema = Schema.Struct({
|
|
30
|
+
keys: Schema.Array(ForeignKey),
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* A set of tags.
|
|
34
|
+
* Tags are arbitrary application-defined strings.
|
|
35
|
+
* ECHO makes no assumptions about the tag structure.
|
|
36
|
+
*/
|
|
37
|
+
// TODO(dmaretskyi): Has to be optional for compatibility with old data.
|
|
38
|
+
// Defaulting to an empty array is possible but requires a bit more work.
|
|
39
|
+
// TODO(dmaretskyi): In automerge this should be a map of { [tag]: boolean } for uniqueness and conflict resolution.
|
|
40
|
+
tags: Schema.optional(Schema.Array(Schema.String)),
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Fully-qualified registry key for the object (FQN format, e.g. `org.example.type.foo`).
|
|
44
|
+
* Identifies the canonical registry entry the object instance was created from.
|
|
45
|
+
*/
|
|
46
|
+
key: Schema.optional(Schema.String),
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Semantic version of the registry entry the object was created from.
|
|
50
|
+
* Must be a valid semver string (e.g. `1.2.3`).
|
|
51
|
+
*/
|
|
52
|
+
version: Schema.optional(Schema.String),
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
export type ObjectMeta = Schema.Schema.Type<typeof ObjectMetaSchema>;
|
|
56
|
+
|
|
57
|
+
/*
|
|
58
|
+
* Get metadata from object.
|
|
59
|
+
* Only callable on the object root.
|
|
60
|
+
*
|
|
61
|
+
* @internal (use Obj.getMeta or Relation.getMeta)
|
|
62
|
+
*/
|
|
63
|
+
// TODO(burdon): Refine type to BaseObj.
|
|
64
|
+
export const getMeta = (obj: AnyProperties): ObjectMeta => {
|
|
65
|
+
const metadata = (obj as any)[MetaId];
|
|
66
|
+
invariant(metadata, 'ObjectMeta not found.');
|
|
67
|
+
return metadata;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
//
|
|
71
|
+
// Foreign keys
|
|
72
|
+
//
|
|
73
|
+
|
|
74
|
+
export const foreignKey = (source: string, id: string): ForeignKey => ({ source, id });
|
|
75
|
+
export const foreignKeyEquals = (a: ForeignKey, b: ForeignKey) => a.source === b.source && a.id === b.id;
|
|
76
|
+
|
|
77
|
+
// TODO(dmaretskyi): Move to echo-schema.
|
|
78
|
+
export const compareForeignKeys: Comparator<AnyProperties> = (a: AnyProperties, b: AnyProperties) =>
|
|
79
|
+
intersection(getMeta(a).keys, getMeta(b).keys, foreignKeyEquals).length > 0;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Internal symbol/string constants for the echo object model.
|
|
7
|
+
* Defined in common/ so proxy/ can use them without importing from Entity/.
|
|
8
|
+
* Entity/ re-exports these for external consumers.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Property name for the object's own URI when serialized to JSON.
|
|
13
|
+
*/
|
|
14
|
+
export const ATTR_SELF_URI = '@uri';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated Legacy JSON property name accepted on read for backward compat.
|
|
18
|
+
*/
|
|
19
|
+
export const ATTR_SELF_URI_LEGACY = '@dxn';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Symbol carrying the object's own URI on live entities.
|
|
23
|
+
*/
|
|
24
|
+
export const SelfURIId = Symbol.for('@dxos/echo/URI');
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Property name for deleted when object is serialized to JSON.
|
|
28
|
+
*/
|
|
29
|
+
export const ATTR_DELETED = '@deleted';
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Deletion marker.
|
|
33
|
+
*/
|
|
34
|
+
export const ObjectDeletedId = Symbol.for('@dxos/echo/Deleted');
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Object version accessor symbol.
|
|
38
|
+
*/
|
|
39
|
+
export const ObjectVersionId: unique symbol = Symbol.for('@dxos/echo/Version');
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Object database accessor symbol.
|
|
43
|
+
*/
|
|
44
|
+
export const ObjectDatabaseId = Symbol.for('@dxos/echo/Database');
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Property name for relation source when object is serialized to JSON.
|
|
48
|
+
*/
|
|
49
|
+
export const ATTR_RELATION_SOURCE = '@relationSource';
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Used to access relation source ref on live ECHO objects.
|
|
53
|
+
*/
|
|
54
|
+
export const RelationSourceId: unique symbol = Symbol.for('@dxos/echo/RelationSource');
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Used to access relation source DXN on live ECHO objects.
|
|
58
|
+
*/
|
|
59
|
+
export const RelationSourceDXNId: unique symbol = Symbol.for('@dxos/echo/RelationSourceDXN');
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Property name for relation target when object is serialized to JSON.
|
|
63
|
+
*/
|
|
64
|
+
export const ATTR_RELATION_TARGET = '@relationTarget';
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Used to access relation target ref on live ECHO objects.
|
|
68
|
+
*/
|
|
69
|
+
export const RelationTargetId: unique symbol = Symbol.for('@dxos/echo/RelationTarget');
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Used to access relation target DXN on live ECHO objects.
|
|
73
|
+
*/
|
|
74
|
+
export const RelationTargetDXNId: unique symbol = Symbol.for('@dxos/echo/RelationTargetDXN');
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import type * as Schema from 'effect/Schema';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Property name for typename when object is serialized to JSON.
|
|
9
|
+
*/
|
|
10
|
+
export const ATTR_TYPE = '@type';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* DXN to the object type.
|
|
14
|
+
*/
|
|
15
|
+
export const TypeId = Symbol.for('@dxos/echo/Type');
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Reference to the object schema.
|
|
19
|
+
*/
|
|
20
|
+
export const SchemaId = Symbol.for('@dxos/echo/Schema');
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Property name for parent when object is serialized to JSON.
|
|
24
|
+
*/
|
|
25
|
+
export const ATTR_PARENT = '@parent';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Reference to the object parent.
|
|
29
|
+
*/
|
|
30
|
+
export const ParentId = Symbol.for('@dxos/echo/Parent');
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Reference to the object's type entity (`Type.Obj`, `Type.Relation`, or
|
|
34
|
+
* `Type.Type`). Set at instance creation by `createObject` / `makeObject`
|
|
35
|
+
* when the entity is known. Public read-back via `Obj.getType` / `Relation.getType`
|
|
36
|
+
* / `Entity.getType`.
|
|
37
|
+
*/
|
|
38
|
+
export const TypeEntityId = Symbol.for('@dxos/echo/TypeEntity');
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Returns the Effect Schema for the given object if one is defined.
|
|
42
|
+
*
|
|
43
|
+
* @internal
|
|
44
|
+
* Internal callers needing schema-side validation read from `SchemaId`.
|
|
45
|
+
* Public callers should use `Type.getSchema(Obj.getType(obj))` instead.
|
|
46
|
+
*/
|
|
47
|
+
// TODO(dmaretskyi): For echo objects, this always returns the root schema.
|
|
48
|
+
export const getSchema = (obj: unknown | undefined): Schema.Schema.AnyNoContext | undefined => {
|
|
49
|
+
if (obj) {
|
|
50
|
+
return (obj as any)[SchemaId];
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @internal
|
|
56
|
+
*/
|
|
57
|
+
export const setSchema = (obj: any, schema: Schema.Schema.AnyNoContext): void => {
|
|
58
|
+
Object.defineProperty(obj, SchemaId, {
|
|
59
|
+
value: schema,
|
|
60
|
+
writable: false,
|
|
61
|
+
enumerable: false,
|
|
62
|
+
configurable: false,
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Returns the type entity (`Type.AnyEntity`) for the given instance.
|
|
68
|
+
* Set at instance creation; every entity has a type. Defensive: returns
|
|
69
|
+
* undefined for null/undefined input so callers can safely probe arbitrary
|
|
70
|
+
* values via this helper.
|
|
71
|
+
*
|
|
72
|
+
* @internal Re-exported via `Obj.getType` / `Relation.getType` / `Entity.getType`.
|
|
73
|
+
*/
|
|
74
|
+
export const getType = (obj: unknown): unknown => {
|
|
75
|
+
if (obj == null) {
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
return (obj as any)[TypeEntityId];
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* @internal
|
|
83
|
+
*/
|
|
84
|
+
export const setType = (obj: any, type: unknown): void => {
|
|
85
|
+
Object.defineProperty(obj, TypeEntityId, {
|
|
86
|
+
value: type,
|
|
87
|
+
writable: false,
|
|
88
|
+
enumerable: false,
|
|
89
|
+
configurable: true,
|
|
90
|
+
});
|
|
91
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Version type identifier.
|
|
7
|
+
*/
|
|
8
|
+
export const VersionTypeId = '~@dxos/echo/VersionTypeId' as const;
|
|
9
|
+
export type VersionTypeId = typeof VersionTypeId;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Represents the object version.
|
|
13
|
+
* May be backed by Automerge.
|
|
14
|
+
* Objects with no history are not versioned.
|
|
15
|
+
*/
|
|
16
|
+
export interface Version {
|
|
17
|
+
[VersionTypeId]: {};
|
|
18
|
+
automergeHeads?: string[];
|
|
19
|
+
}
|
package/src/internal/index.ts
CHANGED
|
@@ -2,21 +2,16 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// TODO(burdon): Import directly (not part of ECHO API).
|
|
6
|
+
export { JsonPath, JsonProp, getValue, splitJsonPath } from '@dxos/effect';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
export * from './
|
|
12
|
-
export
|
|
13
|
-
export * from './
|
|
14
|
-
export * from './
|
|
15
|
-
export * from './
|
|
16
|
-
export * from './
|
|
17
|
-
export { defineHiddenProperty } from '@dxos/live-object';
|
|
18
|
-
export * from './ref';
|
|
19
|
-
export * from './projection';
|
|
20
|
-
export * from './schema';
|
|
21
|
-
// TODO(dmaretskyi): Remove
|
|
22
|
-
export { live } from './proxy/reactive-object';
|
|
8
|
+
export * from './Annotation';
|
|
9
|
+
export * from './common';
|
|
10
|
+
export * from './Entity';
|
|
11
|
+
export * from './Format';
|
|
12
|
+
export * from './JsonSchema';
|
|
13
|
+
// TODO(wittjosiah): Required to ensure types are portable (need to export all types required for downstream inference).
|
|
14
|
+
export * from './Obj';
|
|
15
|
+
export * from './Query';
|
|
16
|
+
export * from './Ref';
|
|
17
|
+
export * from './Type';
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
import { describe, test } from 'vitest';
|
|
7
|
+
|
|
8
|
+
import { raise } from '@dxos/debug';
|
|
9
|
+
|
|
10
|
+
import { Entity, Obj, Ref, Relation, Type } from '../index';
|
|
11
|
+
import { TestSchema } from './test-schema';
|
|
12
|
+
|
|
13
|
+
describe('Experimental API review', () => {
|
|
14
|
+
test('type checks', ({ expect }) => {
|
|
15
|
+
const contact = Obj.make(TestSchema.Person, { name: 'Test' });
|
|
16
|
+
const type = Obj.getType(contact) ?? raise(new Error('No type found'));
|
|
17
|
+
|
|
18
|
+
expect(Type.getTypename(type)).to.eq(Type.getTypename(TestSchema.Person));
|
|
19
|
+
expect(Type.getTypename(type)).to.eq('com.example.type.person');
|
|
20
|
+
expect(Type.getVersion(type)).to.eq('0.1.0');
|
|
21
|
+
// `Type.getMeta` returns `ObjectMeta` (`{ keys, tags?, key?, version? }`) —
|
|
22
|
+
// the same shape `Obj.getMeta` and `Relation.getMeta` return. The
|
|
23
|
+
// schema-kind brand lives on `[SchemaKindId]`, not in meta.
|
|
24
|
+
expect(Type.getMeta(type)).to.deep.eq({
|
|
25
|
+
keys: [],
|
|
26
|
+
key: 'com.example.type.person',
|
|
27
|
+
version: '0.1.0',
|
|
28
|
+
});
|
|
29
|
+
expect(Type.isObject(type)).to.be.true;
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test('instance checks', ({ expect }) => {
|
|
33
|
+
const organization = Obj.make(TestSchema.Organization, { name: 'DXOS' });
|
|
34
|
+
const contact = Obj.make(TestSchema.Person, {
|
|
35
|
+
name: 'Test',
|
|
36
|
+
employer: Ref.make(organization),
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
expect(Schema.is(Type.getSchema(TestSchema.Person))(contact)).to.be.true;
|
|
40
|
+
expect(Obj.instanceOf(TestSchema.Person, contact)).to.be.true;
|
|
41
|
+
expect(Obj.instanceOf(TestSchema.Organization, organization)).to.be.true;
|
|
42
|
+
|
|
43
|
+
const isPerson = Obj.instanceOf(TestSchema.Person);
|
|
44
|
+
const x: any = {};
|
|
45
|
+
if (isPerson(x)) {
|
|
46
|
+
x.name;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
test('default props', ({ expect }) => {
|
|
51
|
+
const message = Obj.make(TestSchema.Message, TestSchema.MessageStruct.make({}));
|
|
52
|
+
expect(message.timestamp).to.exist;
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test('Obj.isObject', ({ expect }) => {
|
|
56
|
+
const guy = Obj.make(TestSchema.Person, { name: 'Test' });
|
|
57
|
+
expect(Obj.isObject(guy)).to.be.true;
|
|
58
|
+
expect(Obj.isObject(null)).to.be.false;
|
|
59
|
+
expect(Obj.isObject(undefined)).to.be.false;
|
|
60
|
+
expect(Obj.isObject(1)).to.be.false;
|
|
61
|
+
expect(Obj.isObject('string')).to.be.false;
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test('create relation', ({ expect }) => {
|
|
65
|
+
const person = Obj.make(TestSchema.Person, { name: 'Test' });
|
|
66
|
+
const organization = Obj.make(TestSchema.Organization, { name: 'DXOS' });
|
|
67
|
+
const worksFor = Relation.make(TestSchema.EmployedBy, {
|
|
68
|
+
[Relation.Source]: person,
|
|
69
|
+
[Relation.Target]: organization,
|
|
70
|
+
role: 'CEO',
|
|
71
|
+
});
|
|
72
|
+
expect(Relation.getSource(worksFor)).to.eq(person);
|
|
73
|
+
expect(Relation.getTarget(worksFor)).to.eq(organization);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test('version', ({ expect }) => {
|
|
77
|
+
const person = Obj.make(TestSchema.Person, { name: 'Test' });
|
|
78
|
+
const version = Obj.version(person);
|
|
79
|
+
expect(Obj.isVersion(version)).to.be.true;
|
|
80
|
+
expect(Obj.versionValid(version)).to.be.false;
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
// TODO(burdon): Implement test.
|
|
84
|
+
test.skip('type narrowing', () => {
|
|
85
|
+
const any: Entity.Unknown = null as any;
|
|
86
|
+
|
|
87
|
+
{
|
|
88
|
+
if (Obj.isObject(any)) {
|
|
89
|
+
any;
|
|
90
|
+
} else {
|
|
91
|
+
any;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
{
|
|
96
|
+
if (Relation.isRelation(any)) {
|
|
97
|
+
any;
|
|
98
|
+
} else {
|
|
99
|
+
any;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Test that Obj.make return types are clean and don't expose internal markers like OfKind.
|
|
106
|
+
* The return type of Obj.make(Schema, props) should be assignable to Obj.Obj<InstanceType>.
|
|
107
|
+
*/
|
|
108
|
+
describe('Obj.make return type', () => {
|
|
109
|
+
test('Obj.make with custom schema should be assignable to Obj.Obj<Person>', ({ expect }) => {
|
|
110
|
+
{
|
|
111
|
+
const expando = Obj.make(TestSchema.Expando, { content: 'Test' });
|
|
112
|
+
expect(Obj.isObject(expando)).to.be.true;
|
|
113
|
+
expect(expando.content).to.eq('Test');
|
|
114
|
+
|
|
115
|
+
// This should work: assign to Obj.Obj of the schema's instance type
|
|
116
|
+
const _typed: Obj.OfShape<TestSchema.Expando> = expando;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
{
|
|
120
|
+
const person = Obj.make(TestSchema.Person, { name: 'Test' });
|
|
121
|
+
expect(Obj.isObject(person)).to.be.true;
|
|
122
|
+
expect(person.name).to.eq('Test');
|
|
123
|
+
|
|
124
|
+
// This should work: assign to Obj.Obj of the schema's instance type
|
|
125
|
+
const _typed: Obj.OfShape<TestSchema.Person> = person;
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
});
|
package/src/testing/index.ts
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
export
|
|
6
|
-
export * from './
|
|
7
|
-
export * from './
|
|
5
|
+
export * from './test-data';
|
|
6
|
+
export * from './test-schema';
|
|
7
|
+
export * from './util';
|