@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
package/src/Dataset.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// @import-as-namespace
|
|
6
|
+
|
|
7
|
+
import { pipe } from 'effect/Function';
|
|
8
|
+
import * as Predicate from 'effect/Predicate';
|
|
9
|
+
import * as Schema from 'effect/Schema';
|
|
10
|
+
|
|
11
|
+
import * as Collection from './Collection';
|
|
12
|
+
import * as Feed from './Feed';
|
|
13
|
+
import * as Obj from './Obj';
|
|
14
|
+
import * as Type from './Type';
|
|
15
|
+
import * as View from './View';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Abstract set of objects, represented by a view, feed, or collection.
|
|
19
|
+
* Schema-level union of the underlying type entities (rebuilt via
|
|
20
|
+
* `Type.getSchema`) so this can still be consumed by Schema-side APIs such
|
|
21
|
+
* as `Filter.type(...)` on a union.
|
|
22
|
+
*/
|
|
23
|
+
export type Dataset = Feed.Feed | Collection.Collection | View.View;
|
|
24
|
+
export const Dataset = Schema.Union(
|
|
25
|
+
Type.getSchema(Feed.Feed),
|
|
26
|
+
Type.getSchema(Collection.Collection),
|
|
27
|
+
Type.getSchema(View.View),
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
export const isDataset: (value: unknown) => value is Dataset = pipe(
|
|
31
|
+
Obj.instanceOf(Feed.Feed),
|
|
32
|
+
Predicate.or(Obj.instanceOf(Collection.Collection)),
|
|
33
|
+
Predicate.or(Obj.instanceOf(View.View)),
|
|
34
|
+
);
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { describe, expect, test } from 'vitest';
|
|
6
|
+
|
|
7
|
+
import * as Entity from './Entity';
|
|
8
|
+
import * as Obj from './Obj';
|
|
9
|
+
import * as Relation from './Relation';
|
|
10
|
+
import { TestSchema } from './testing';
|
|
11
|
+
import * as Type from './Type';
|
|
12
|
+
|
|
13
|
+
const makeObject = () =>
|
|
14
|
+
Obj.make(TestSchema.Person, {
|
|
15
|
+
name: 'Test',
|
|
16
|
+
username: 'test',
|
|
17
|
+
email: 'test@example.com',
|
|
18
|
+
tasks: [],
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const makeRelation = (obj: TestSchema.Person) =>
|
|
22
|
+
Relation.make(TestSchema.HasManager, { [Relation.Source]: obj, [Relation.Target]: obj });
|
|
23
|
+
|
|
24
|
+
describe('Entity', () => {
|
|
25
|
+
test('Entity.Unknown accepts any object or relation', () => {
|
|
26
|
+
const obj = makeObject();
|
|
27
|
+
const rel = makeRelation(obj);
|
|
28
|
+
const doSomething = (entity: Entity.Unknown) => entity;
|
|
29
|
+
expect(doSomething(obj)).toBe(obj);
|
|
30
|
+
expect(doSomething(rel)).toBe(rel);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// `isEntity` is a bare brand check (`[KindId] !== undefined`). All three entity
|
|
34
|
+
// kinds — objects, relations, and type entities — carry the brand, so all three
|
|
35
|
+
// are recognised as entities. (Type entities brand with `EntityKind.Type`.)
|
|
36
|
+
describe('isEntity / isSnapshot', () => {
|
|
37
|
+
test('object instance is an entity', () => {
|
|
38
|
+
const obj = makeObject();
|
|
39
|
+
expect(Entity.isEntity(obj)).toBe(true);
|
|
40
|
+
expect(Entity.isSnapshot(obj)).toBe(false);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test('relation instance is an entity', () => {
|
|
44
|
+
const rel = makeRelation(makeObject());
|
|
45
|
+
expect(Entity.isEntity(rel)).toBe(true);
|
|
46
|
+
expect(Entity.isSnapshot(rel)).toBe(false);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test('type entity is an entity', () => {
|
|
50
|
+
expect(Entity.isEntity(TestSchema.Person)).toBe(true);
|
|
51
|
+
expect(Entity.isSnapshot(TestSchema.Person)).toBe(false);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test('non-entities are rejected', () => {
|
|
55
|
+
expect(Entity.isEntity(null)).toBe(false);
|
|
56
|
+
expect(Entity.isEntity({})).toBe(false);
|
|
57
|
+
expect(Entity.isEntity({ id: 'x' })).toBe(false);
|
|
58
|
+
expect(Entity.isEntity('string')).toBe(false);
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
// Object and relation instances behave identically across the Entity.* accessor
|
|
63
|
+
// surface: these accessors are written for runtime instances and read the
|
|
64
|
+
// instance's identity, type pointer and metadata.
|
|
65
|
+
describe.each([
|
|
66
|
+
['object', () => makeObject(), 'com.example.type.person'],
|
|
67
|
+
['relation', () => makeRelation(makeObject()), 'com.example.type.hasManager'],
|
|
68
|
+
] as const)('instance accessors (%s)', (_label, make, typename) => {
|
|
69
|
+
test('getURI returns an echo URI', () => {
|
|
70
|
+
const entity = make();
|
|
71
|
+
expect(Entity.getURI(entity)).toMatch(/^echo:/);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
test('getTypename returns the typename', () => {
|
|
75
|
+
expect(Entity.getTypename(make())).toBe(typename);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
test('getTypeURI returns the type DXN', () => {
|
|
79
|
+
expect(Entity.getTypeURI(make())).toBe(`dxn:${typename}:0.1.0`);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
test('getType resolves back to the type entity', () => {
|
|
83
|
+
const type = Entity.getType(make());
|
|
84
|
+
expect(type).toBeDefined();
|
|
85
|
+
expect(Type.getTypename(type!)).toBe(typename);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
test('getMeta returns metadata', () => {
|
|
89
|
+
expect(Entity.getMeta(make())).toBeDefined();
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
test('isDeleted is false for a live entity', () => {
|
|
93
|
+
expect(Entity.isDeleted(make())).toBe(false);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
test('toJSON serializes the entity', () => {
|
|
97
|
+
const json = Entity.toJSON(make());
|
|
98
|
+
expect(json).toMatchObject({ '@type': expect.stringContaining(typename) });
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// Type entities are first-class entities: the Entity.* accessors work on them too.
|
|
103
|
+
// `getURI`/`getTypename` return the type's OWN identity, while `getType`/`getTypeURI`
|
|
104
|
+
// (which mean "the type this entity is an instance of") resolve to the meta-type
|
|
105
|
+
// `Type.Type`.
|
|
106
|
+
describe('type entity', () => {
|
|
107
|
+
test('isEntity / getMeta / isDeleted', () => {
|
|
108
|
+
expect(Entity.isEntity(TestSchema.Person)).toBe(true);
|
|
109
|
+
expect(Entity.getMeta(TestSchema.Person)).toBeDefined();
|
|
110
|
+
expect(Entity.isDeleted(TestSchema.Person)).toBe(false);
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
test('getURI / getTypename return the type entity’s own identity', () => {
|
|
114
|
+
expect(Entity.getURI(TestSchema.Person)).toBe('dxn:com.example.type.person:0.1.0');
|
|
115
|
+
expect(Entity.getTypename(TestSchema.Person)).toBe('com.example.type.person');
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
test('getType / getTypeURI resolve to the meta-type (Type.Type)', () => {
|
|
119
|
+
expect(Entity.getType(TestSchema.Person)).toBe(Type.Type);
|
|
120
|
+
expect(Entity.getTypeURI(TestSchema.Person)).toBe('dxn:org.dxos.type.schema:0.1.0');
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
test('Entity.* and Type.* agree on type identity', () => {
|
|
124
|
+
expect(Entity.getURI(TestSchema.Person)).toBe(Type.getURI(TestSchema.Person));
|
|
125
|
+
expect(Entity.getTypename(TestSchema.Person)).toBe(Type.getTypename(TestSchema.Person));
|
|
126
|
+
expect(Type.isType(TestSchema.Person)).toBe(true);
|
|
127
|
+
expect(Type.isObject(TestSchema.Person)).toBe(true);
|
|
128
|
+
expect(Type.isRelation(TestSchema.HasManager)).toBe(true);
|
|
129
|
+
expect(Type.getVersion(TestSchema.Person)).toBe('0.1.0');
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
});
|
package/src/Entity.ts
ADDED
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// @import-as-namespace
|
|
6
|
+
|
|
7
|
+
import * as Schema from 'effect/Schema';
|
|
8
|
+
|
|
9
|
+
import type { ForeignKey } from '@dxos/echo-protocol';
|
|
10
|
+
import type { ObjectId, URI } from '@dxos/keys';
|
|
11
|
+
|
|
12
|
+
import * as internal from './internal';
|
|
13
|
+
import type * as Relation from './Relation';
|
|
14
|
+
import * as Type from './Type';
|
|
15
|
+
|
|
16
|
+
// Re-export KindId and SnapshotKindId from internal.
|
|
17
|
+
export const KindId = internal.KindId;
|
|
18
|
+
export type KindId = typeof internal.KindId;
|
|
19
|
+
export const SnapshotKindId = internal.SnapshotKindId;
|
|
20
|
+
export type SnapshotKindId = typeof internal.SnapshotKindId;
|
|
21
|
+
|
|
22
|
+
// NOTE: Relation does not extend Obj so that, for example, we can prevent Relations from being used as source and target objects.
|
|
23
|
+
// However, we generally refer to Obj and Relation instances as "objects",
|
|
24
|
+
// and many API methods accept both Obj.Unknown and Relation.Unknown (i.e., Entity.Unknown) instances.
|
|
25
|
+
|
|
26
|
+
export const Kind = internal.EntityKind;
|
|
27
|
+
export type Kind = internal.EntityKind;
|
|
28
|
+
export const KindSchema = internal.EntityKindSchema;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Assigns a kind to an Object or Relation instance.
|
|
32
|
+
* NOTE: Needed to make `isRelation` and `isObject` checks work.
|
|
33
|
+
*/
|
|
34
|
+
export interface OfKind<K extends Kind> {
|
|
35
|
+
readonly [KindId]: K;
|
|
36
|
+
readonly id: ObjectId;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Assigns a snapshot kind to an Object or Relation snapshot.
|
|
41
|
+
*/
|
|
42
|
+
export interface SnapshotOfKind<K extends Kind> {
|
|
43
|
+
readonly [SnapshotKindId]: K;
|
|
44
|
+
readonly id: ObjectId;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Obj or Relation with a specific set of properties.
|
|
49
|
+
*/
|
|
50
|
+
export type Entity<Props> = OfKind<Kind> & Props;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Unknown Obj or Relation (reactive).
|
|
54
|
+
*/
|
|
55
|
+
export interface Unknown extends OfKind<Kind> {}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Effect Schema for any ECHO entity (object or relation).
|
|
59
|
+
*
|
|
60
|
+
* Kind-agnostic counterpart to `Obj.Unknown` / `Relation.Unknown` — validates
|
|
61
|
+
* the structural shape (id + properties) without constraining `[KindId]`. Used
|
|
62
|
+
* in operation input schemas that accept any entity flavour (e.g.
|
|
63
|
+
* `Schema.Array(Entity.Unknown)`).
|
|
64
|
+
*
|
|
65
|
+
* The cast bridges the runtime structural schema to the branded `Unknown` type:
|
|
66
|
+
* `[KindId]` is a symbol brand that can't be expressed in a runtime `Struct`,
|
|
67
|
+
* so the entity guarantee is carried at the type level only (same approach as
|
|
68
|
+
* `Obj.Unknown` / `Relation.Unknown`). Unlike those, this is kind-agnostic so it
|
|
69
|
+
* isn't an `UnknownTypeSchema<_, K>` (there's no single `K`) and carries no
|
|
70
|
+
* `TypeAnnotation`.
|
|
71
|
+
*/
|
|
72
|
+
export const Unknown: Schema.Schema<Unknown> = Schema.Struct({
|
|
73
|
+
id: Schema.String,
|
|
74
|
+
}).pipe(
|
|
75
|
+
Schema.extend(Schema.Record({ key: Schema.String, value: Schema.Unknown })),
|
|
76
|
+
) as unknown as Schema.Schema<Unknown>;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Snapshot of an Obj or Relation.
|
|
80
|
+
* Branded with SnapshotKindId instead of KindId.
|
|
81
|
+
*/
|
|
82
|
+
export interface Snapshot extends SnapshotOfKind<Kind> {}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Object with arbitrary properties.
|
|
86
|
+
*
|
|
87
|
+
* NOTE: Due to how typescript works, this type is not assignable to a specific schema type.
|
|
88
|
+
* In that case, use `Obj.instanceOf` to check if an object is of a specific type.
|
|
89
|
+
*
|
|
90
|
+
* This type is very permissive and allows accessing any property on the object.
|
|
91
|
+
* We should move to Obj.Unknown that is not permissive and requires explicit instanceof checks..
|
|
92
|
+
*/
|
|
93
|
+
export interface Any extends OfKind<Kind> {
|
|
94
|
+
[key: string]: unknown;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Returns all properties of an object or relation except for the id and kind.
|
|
99
|
+
*/
|
|
100
|
+
export type Properties<T> = Omit<T, 'id' | KindId | Relation.Source | Relation.Target>;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Check if a value is an ECHO entity (object or relation).
|
|
104
|
+
* Returns `false` for snapshots.
|
|
105
|
+
*/
|
|
106
|
+
export const isEntity = (value: unknown): value is Unknown => {
|
|
107
|
+
if (typeof value !== 'object' || value === null) {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
return (value as any)[KindId] !== undefined;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Test if a value is an instance of a given object or relation type.
|
|
115
|
+
*
|
|
116
|
+
* Kind-agnostic counterpart to `Obj.instanceOf` / `Relation.instanceOf` —
|
|
117
|
+
* use this when the caller's input type is `Type.AnyObj | Type.AnyRelation`.
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```ts
|
|
121
|
+
* // Caller doesn't know whether `type` is object- or relation-kind.
|
|
122
|
+
* const matches = <T extends Type.AnyObj | Type.AnyRelation>(type: T, value: unknown) =>
|
|
123
|
+
* Entity.instanceOf(type, value);
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
export const instanceOf: {
|
|
127
|
+
<S extends Type.AnyEntity>(schema: S): (value: unknown) => value is Type.InstanceType<S>;
|
|
128
|
+
<S extends Type.AnyEntity>(schema: S, value: unknown): value is Type.InstanceType<S>;
|
|
129
|
+
} = ((...args: [schema: Type.AnyEntity, value?: unknown]) => {
|
|
130
|
+
if (args.length === 1) {
|
|
131
|
+
return (entity: unknown) => internal.isInstanceOf(args[0], entity);
|
|
132
|
+
}
|
|
133
|
+
return internal.isInstanceOf(args[0], args[1]);
|
|
134
|
+
}) as any;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Check if a value is an ECHO entity snapshot.
|
|
138
|
+
* Returns `false` for entities.
|
|
139
|
+
*/
|
|
140
|
+
export const isSnapshot = (value: unknown): value is Snapshot => {
|
|
141
|
+
if (typeof value !== 'object' || value === null) {
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
return (value as any)[SnapshotKindId] !== undefined;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
// TODO(dmaretskyi): Type introspection -- move to kind.
|
|
148
|
+
export const getKind = internal.getEntityKind;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Property that accesses metadata for an entity.
|
|
152
|
+
*/
|
|
153
|
+
export const Meta: unique symbol = internal.MetaId as any;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Property that accesses metadata for an entity.
|
|
157
|
+
*/
|
|
158
|
+
export type Meta = typeof Meta;
|
|
159
|
+
|
|
160
|
+
//
|
|
161
|
+
// Entity-level functions that work on any entity (object or relation).
|
|
162
|
+
// Use these when you don't know or care about the specific entity kind.
|
|
163
|
+
// For kind-specific functions, use Obj.* or Relation.*.
|
|
164
|
+
//
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* JSON representation of an entity.
|
|
168
|
+
*/
|
|
169
|
+
export type JSON = internal.ObjectJSON;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Whether the entity is a type-kind entity (a `Type.Type` produced by
|
|
173
|
+
* `Type.makeObject` / `Type.makeRelation`, or a persisted schema). Type entities
|
|
174
|
+
* carry their identity (typename/version) on themselves rather than referencing a
|
|
175
|
+
* separate type, so the accessors below route them through the `Type.*` module.
|
|
176
|
+
*/
|
|
177
|
+
const isTypeEntity = (entity: unknown): boolean => internal.getEntityKindBrand(entity) === internal.EntityKind.Type;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Any value the read accessors operate on: a reactive entity or a snapshot.
|
|
181
|
+
* Type entities (`Type.AnyEntity`) are also accepted — they're first-class
|
|
182
|
+
* entities, and `Unknown`'s kind-agnostic brand already subsumes them.
|
|
183
|
+
*/
|
|
184
|
+
export type AnyInput = Unknown | Snapshot;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Get the canonical URI of an entity (object, relation, or type). Returns `URI.URI` —
|
|
188
|
+
* an `EchoURI` for object/relation instances and persisted types, or a typename
|
|
189
|
+
* `DXN` for static type entities; narrow with `EchoURI.parse(uri)` or
|
|
190
|
+
* `DXN.tryMake(uri)` at the point of use.
|
|
191
|
+
*/
|
|
192
|
+
export const getURI = (entity: AnyInput): URI.URI =>
|
|
193
|
+
isTypeEntity(entity) ? Type.getURI(entity as Type.AnyEntity) : internal.getUri(entity as Unknown);
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Get the DXN of an entity's type. For object/relation instances this is the URI
|
|
197
|
+
* of the type they were created from; for a type entity it is the URI of the
|
|
198
|
+
* meta-type ({@link Type.Type}, `dxn:org.dxos.type.schema:0.1.0`).
|
|
199
|
+
*/
|
|
200
|
+
export const getTypeURI = (entity: AnyInput): URI.URI | undefined =>
|
|
201
|
+
isTypeEntity(entity) ? Type.getURI(Type.Type) : internal.getTypeURI(entity as Unknown);
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Get the type entity (`Type.AnyEntity`) the instance was created from.
|
|
205
|
+
*
|
|
206
|
+
* Returns `undefined` when the entity's type isn't registered in this runtime
|
|
207
|
+
* (e.g. a freshly deserialized snapshot whose type entity hasn't been wired
|
|
208
|
+
* up yet, or an entity loaded from storage before its schema is known). To
|
|
209
|
+
* get the Effect Schema from the returned entity, use `Type.getSchema(...)`.
|
|
210
|
+
*
|
|
211
|
+
* For a type entity, returns the meta-type {@link Type.Type} (a type entity's
|
|
212
|
+
* type is "Type").
|
|
213
|
+
*/
|
|
214
|
+
export const getType = (entity: AnyInput): Type.AnyEntity | undefined =>
|
|
215
|
+
isTypeEntity(entity) ? Type.Type : (internal.getType(entity) as Type.AnyEntity | undefined);
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Get the typename of an entity's type. For object/relation instances this is the
|
|
219
|
+
* typename of the type they were created from; for a type entity it is the type's
|
|
220
|
+
* own typename (e.g. `com.example.type.person`).
|
|
221
|
+
*/
|
|
222
|
+
export const getTypename = (entity: AnyInput): string | undefined =>
|
|
223
|
+
isTypeEntity(entity) ? Type.getTypename(entity as Type.AnyEntity) : internal.getTypename(entity as Unknown);
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Get the database an entity belongs to.
|
|
227
|
+
*/
|
|
228
|
+
export const getDatabase = (entity: Unknown | Snapshot): any | undefined => internal.getDatabase(entity);
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Get the metadata for an entity.
|
|
232
|
+
* Returns mutable meta when passed a mutable entity (inside change callback).
|
|
233
|
+
* Returns read-only meta when passed a regular entity or snapshot.
|
|
234
|
+
*/
|
|
235
|
+
// TODO(wittjosiah): When passed a Snapshot, should return a snapshot of meta, not the live meta proxy.
|
|
236
|
+
export function getMeta(entity: Mutable<Unknown>): internal.ObjectMeta;
|
|
237
|
+
export function getMeta(entity: Unknown | Snapshot): internal.ReadonlyMeta;
|
|
238
|
+
export function getMeta(entity: Unknown | Snapshot | Mutable<Unknown>): internal.ObjectMeta | internal.ReadonlyMeta {
|
|
239
|
+
return internal.getMetaChecked(entity);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Get foreign keys for an entity from the specified source.
|
|
244
|
+
*/
|
|
245
|
+
export const getKeys = (entity: Unknown | Snapshot, source: string): ForeignKey[] => internal.getKeys(entity, source);
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Check if an entity is deleted.
|
|
249
|
+
*/
|
|
250
|
+
export const isDeleted = (entity: Unknown | Snapshot): boolean => internal.isDeleted(entity);
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Get the label of an entity.
|
|
254
|
+
*
|
|
255
|
+
* @param options.fallback `'typename'` returns the entity's typename when no
|
|
256
|
+
* label is set (e.g. `org.dxos.type.table`).
|
|
257
|
+
*/
|
|
258
|
+
export const getLabel = (entity: Unknown | Snapshot, options?: internal.GetLabelOptions): string | undefined =>
|
|
259
|
+
internal.getLabel(entity, options);
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Set the label of an entity.
|
|
263
|
+
* Must be called within an `Entity.update` / `Obj.update` / `Relation.update` callback.
|
|
264
|
+
*/
|
|
265
|
+
export const setLabel = (entity: Mutable<Unknown>, label: string): void => internal.setLabel(entity, label);
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Get the description of an entity.
|
|
269
|
+
*/
|
|
270
|
+
export const getDescription = (entity: Unknown | Snapshot): string | undefined => internal.getDescription(entity);
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Convert an entity to its JSON representation.
|
|
274
|
+
*/
|
|
275
|
+
export const toJSON = (entity: Unknown | Snapshot): JSON => internal.objectToJSON(entity);
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Subscribe to changes on an entity (object or relation).
|
|
279
|
+
* @returns Unsubscribe function.
|
|
280
|
+
*/
|
|
281
|
+
export const subscribe = (entity: Unknown, callback: () => void): (() => void) => {
|
|
282
|
+
return internal.subscribe(entity, callback);
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
//
|
|
286
|
+
// Change
|
|
287
|
+
//
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Used to provide a mutable view of an entity within `Entity.update`.
|
|
291
|
+
*/
|
|
292
|
+
export type Mutable<T> = internal.Mutable<T>;
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Perform mutations on an entity (object or relation) within a change context.
|
|
296
|
+
*
|
|
297
|
+
* Entities are read-only by default. Mutations are batched and notifications fire
|
|
298
|
+
* when the callback completes. Direct mutations outside of `Entity.update` will throw
|
|
299
|
+
* at runtime.
|
|
300
|
+
*
|
|
301
|
+
* @param entity - The echo entity (object or relation) to mutate.
|
|
302
|
+
* @param callback - Receives a mutable view of the entity. All mutations must occur here.
|
|
303
|
+
*
|
|
304
|
+
* @example
|
|
305
|
+
* ```typescript
|
|
306
|
+
* // Mutate within Entity.update
|
|
307
|
+
* Entity.update(entity, (obj) => {
|
|
308
|
+
* obj.name = 'Updated';
|
|
309
|
+
* obj.count = 42;
|
|
310
|
+
* });
|
|
311
|
+
*
|
|
312
|
+
* // Direct mutation throws
|
|
313
|
+
* entity.name = 'Bob'; // Error: Cannot modify outside Entity.update()
|
|
314
|
+
* ```
|
|
315
|
+
*
|
|
316
|
+
* Note: For type-specific operations, prefer `Obj.update` or `Relation.update`.
|
|
317
|
+
*/
|
|
318
|
+
export const update = <T extends Unknown>(entity: T, callback: internal.ChangeCallback<T>): void => {
|
|
319
|
+
internal.change(entity, callback);
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Add a tag to an entity.
|
|
324
|
+
* Must be called within an `Entity.update`, `Obj.update`, or `Relation.update` callback.
|
|
325
|
+
*/
|
|
326
|
+
export const addTag = (entity: Mutable<Unknown>, tag: string): void => internal.addTag(entity, tag);
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Remove a tag from an entity.
|
|
330
|
+
* Must be called within an `Entity.update`, `Obj.update`, or `Relation.update` callback.
|
|
331
|
+
*/
|
|
332
|
+
export const removeTag = (entity: Mutable<Unknown>, tag: string): void => internal.removeTag(entity, tag);
|
package/src/Err.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// @import-as-namespace
|
|
6
|
+
|
|
7
|
+
import { BaseError, type BaseErrorOptions } from '@dxos/errors';
|
|
8
|
+
import { type URI } from '@dxos/keys';
|
|
9
|
+
|
|
10
|
+
export class SchemaNotFoundError extends BaseError.extend('SchemaNotFoundError', 'Schema not found') {
|
|
11
|
+
constructor(schema: string, options?: BaseErrorOptions) {
|
|
12
|
+
super({ context: { schema }, ...options });
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export class ObjectNotFoundError extends BaseError.extend('ObjectNotFoundError', 'Object not found') {
|
|
17
|
+
constructor(uri: URI.URI, options?: BaseErrorOptions) {
|
|
18
|
+
super({ context: { uri }, ...options });
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Reason why getting a reactive object from a snapshot failed.
|
|
24
|
+
* - `no-database`: The snapshot is not associated with a database.
|
|
25
|
+
* - `object-not-found`: The object was removed or does not exist in the database.
|
|
26
|
+
*/
|
|
27
|
+
export type GetReactiveErrorReason = 'no-database' | 'object-not-found';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Error thrown when a reactive object cannot be resolved from a snapshot.
|
|
31
|
+
* Extends `BaseError` with a `reason` and optional `snapshotId` in its context.
|
|
32
|
+
*/
|
|
33
|
+
export class GetReactiveError extends BaseError.extend(
|
|
34
|
+
'GetReactiveError',
|
|
35
|
+
'Failed to get reactive object from snapshot',
|
|
36
|
+
) {
|
|
37
|
+
constructor(options: { reason: GetReactiveErrorReason; snapshotId?: string } & BaseErrorOptions) {
|
|
38
|
+
super({ context: { reason: options.reason, snapshotId: options.snapshotId }, ...options });
|
|
39
|
+
}
|
|
40
|
+
}
|