@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,235 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Option from 'effect/Option';
|
|
6
|
+
import * as Schema from 'effect/Schema';
|
|
7
|
+
import { describe, test } from 'vitest';
|
|
8
|
+
|
|
9
|
+
import * as Extension from './Extension';
|
|
10
|
+
|
|
11
|
+
describe('Extension', () => {
|
|
12
|
+
describe('make', () => {
|
|
13
|
+
test('creates an extension with a string schema', ({ expect }) => {
|
|
14
|
+
const ColorExtension = Extension.make('color', Schema.String);
|
|
15
|
+
|
|
16
|
+
expect(ColorExtension.key).toBe('color');
|
|
17
|
+
expect(ColorExtension.valueSchema).toBe(Schema.String);
|
|
18
|
+
expect(ColorExtension[Extension.TypeId]).toBeDefined();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test('creates an extension with a number schema', ({ expect }) => {
|
|
22
|
+
const PriorityExtension = Extension.make('priority', Schema.Number);
|
|
23
|
+
|
|
24
|
+
expect(PriorityExtension.key).toBe('priority');
|
|
25
|
+
expect(PriorityExtension.valueSchema).toBe(Schema.Number);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
test('creates an extension with a complex schema', ({ expect }) => {
|
|
29
|
+
const MetadataSchema = Schema.Struct({
|
|
30
|
+
author: Schema.String,
|
|
31
|
+
version: Schema.Number,
|
|
32
|
+
tags: Schema.Array(Schema.String),
|
|
33
|
+
});
|
|
34
|
+
const MetadataExtension = Extension.make('metadata', MetadataSchema);
|
|
35
|
+
|
|
36
|
+
expect(MetadataExtension.key).toBe('metadata');
|
|
37
|
+
expect(MetadataExtension.valueSchema).toBe(MetadataSchema);
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
describe('get and set', () => {
|
|
42
|
+
test('set and get a string value', ({ expect }) => {
|
|
43
|
+
const ColorExtension = Extension.make('color', Schema.String);
|
|
44
|
+
const values: Extension.Values = {};
|
|
45
|
+
|
|
46
|
+
Extension.set(values, ColorExtension, 'red');
|
|
47
|
+
const result = Extension.get(values, ColorExtension);
|
|
48
|
+
|
|
49
|
+
expect(Option.isSome(result)).toBe(true);
|
|
50
|
+
expect(Option.getOrThrow(result)).toBe('red');
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
test('set and get a number value', ({ expect }) => {
|
|
54
|
+
const PriorityExtension = Extension.make('priority', Schema.Number);
|
|
55
|
+
const values: Extension.Values = {};
|
|
56
|
+
|
|
57
|
+
Extension.set(values, PriorityExtension, 42);
|
|
58
|
+
const result = Extension.get(values, PriorityExtension);
|
|
59
|
+
|
|
60
|
+
expect(Option.isSome(result)).toBe(true);
|
|
61
|
+
expect(Option.getOrThrow(result)).toBe(42);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test('set and get a boolean value', ({ expect }) => {
|
|
65
|
+
const EnabledExtension = Extension.make('enabled', Schema.Boolean);
|
|
66
|
+
const values: Extension.Values = {};
|
|
67
|
+
|
|
68
|
+
Extension.set(values, EnabledExtension, true);
|
|
69
|
+
const result = Extension.get(values, EnabledExtension);
|
|
70
|
+
|
|
71
|
+
expect(Option.isSome(result)).toBe(true);
|
|
72
|
+
expect(Option.getOrThrow(result)).toBe(true);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
test('set and get a complex object value', ({ expect }) => {
|
|
76
|
+
const ConfigSchema = Schema.Struct({
|
|
77
|
+
theme: Schema.String,
|
|
78
|
+
fontSize: Schema.Number,
|
|
79
|
+
darkMode: Schema.Boolean,
|
|
80
|
+
});
|
|
81
|
+
const ConfigExtension = Extension.make('config', ConfigSchema);
|
|
82
|
+
const values: Extension.Values = {};
|
|
83
|
+
|
|
84
|
+
const config = { theme: 'modern', fontSize: 14, darkMode: true };
|
|
85
|
+
Extension.set(values, ConfigExtension, config);
|
|
86
|
+
const result = Extension.get(values, ConfigExtension);
|
|
87
|
+
|
|
88
|
+
expect(Option.isSome(result)).toBe(true);
|
|
89
|
+
expect(Option.getOrThrow(result)).toEqual(config);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
test('set and get an array value', ({ expect }) => {
|
|
93
|
+
const TagsExtension = Extension.make('tags', Schema.Array(Schema.String));
|
|
94
|
+
const values: Extension.Values = {};
|
|
95
|
+
|
|
96
|
+
const tags = ['important', 'urgent', 'review'];
|
|
97
|
+
Extension.set(values, TagsExtension, tags);
|
|
98
|
+
const result = Extension.get(values, TagsExtension);
|
|
99
|
+
|
|
100
|
+
expect(Option.isSome(result)).toBe(true);
|
|
101
|
+
expect(Option.getOrThrow(result)).toEqual(tags);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
test('get returns None for missing extension', ({ expect }) => {
|
|
105
|
+
const ColorExtension = Extension.make('color', Schema.String);
|
|
106
|
+
const values: Extension.Values = {};
|
|
107
|
+
|
|
108
|
+
const result = Extension.get(values, ColorExtension);
|
|
109
|
+
|
|
110
|
+
expect(Option.isNone(result)).toBe(true);
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
test('overwriting an extension value', ({ expect }) => {
|
|
114
|
+
const ColorExtension = Extension.make('color', Schema.String);
|
|
115
|
+
const values: Extension.Values = {};
|
|
116
|
+
|
|
117
|
+
Extension.set(values, ColorExtension, 'red');
|
|
118
|
+
Extension.set(values, ColorExtension, 'blue');
|
|
119
|
+
const result = Extension.get(values, ColorExtension);
|
|
120
|
+
|
|
121
|
+
expect(Option.isSome(result)).toBe(true);
|
|
122
|
+
expect(Option.getOrThrow(result)).toBe('blue');
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
test('multiple extensions on the same values object', ({ expect }) => {
|
|
126
|
+
const ColorExtension = Extension.make('color', Schema.String);
|
|
127
|
+
const PriorityExtension = Extension.make('priority', Schema.Number);
|
|
128
|
+
const EnabledExtension = Extension.make('enabled', Schema.Boolean);
|
|
129
|
+
const values: Extension.Values = {};
|
|
130
|
+
|
|
131
|
+
Extension.set(values, ColorExtension, 'green');
|
|
132
|
+
Extension.set(values, PriorityExtension, 5);
|
|
133
|
+
Extension.set(values, EnabledExtension, false);
|
|
134
|
+
|
|
135
|
+
expect(Option.getOrThrow(Extension.get(values, ColorExtension))).toBe('green');
|
|
136
|
+
expect(Option.getOrThrow(Extension.get(values, PriorityExtension))).toBe(5);
|
|
137
|
+
expect(Option.getOrThrow(Extension.get(values, EnabledExtension))).toBe(false);
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
describe('curried forms', () => {
|
|
142
|
+
test('get curried form', ({ expect }) => {
|
|
143
|
+
const ColorExtension = Extension.make('color', Schema.String);
|
|
144
|
+
const values: Extension.Values = {};
|
|
145
|
+
Extension.set(values, ColorExtension, 'purple');
|
|
146
|
+
|
|
147
|
+
const getColor = Extension.get(ColorExtension);
|
|
148
|
+
const result = getColor(values);
|
|
149
|
+
|
|
150
|
+
expect(Option.isSome(result)).toBe(true);
|
|
151
|
+
expect(Option.getOrThrow(result)).toBe('purple');
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
test('set curried form', ({ expect }) => {
|
|
155
|
+
const ColorExtension = Extension.make('color', Schema.String);
|
|
156
|
+
const values: Extension.Values = {};
|
|
157
|
+
|
|
158
|
+
const setOrange = Extension.set(ColorExtension, 'orange');
|
|
159
|
+
setOrange(values);
|
|
160
|
+
const result = Extension.get(values, ColorExtension);
|
|
161
|
+
|
|
162
|
+
expect(Option.isSome(result)).toBe(true);
|
|
163
|
+
expect(Option.getOrThrow(result)).toBe('orange');
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
test('curried forms work in pipelines', ({ expect }) => {
|
|
167
|
+
const ColorExtension = Extension.make('color', Schema.String);
|
|
168
|
+
const values: Extension.Values = {};
|
|
169
|
+
|
|
170
|
+
Extension.set(ColorExtension, 'cyan')(values);
|
|
171
|
+
const result = Extension.get(ColorExtension)(values);
|
|
172
|
+
|
|
173
|
+
expect(Option.isSome(result)).toBe(true);
|
|
174
|
+
expect(Option.getOrThrow(result)).toBe('cyan');
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
describe('Key', () => {
|
|
179
|
+
test('Key.make creates a branded key', ({ expect }) => {
|
|
180
|
+
const key = Extension.Key.make('my-extension');
|
|
181
|
+
|
|
182
|
+
expect(key).toBe('my-extension');
|
|
183
|
+
expect(typeof key).toBe('string');
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
describe('Values schema', () => {
|
|
188
|
+
test('Values can be used as a schema', ({ expect }) => {
|
|
189
|
+
const PersonWithExtensions = Schema.Struct({
|
|
190
|
+
name: Schema.String,
|
|
191
|
+
extensions: Extension.Values,
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
const person = Schema.decodeUnknownSync(PersonWithExtensions)({
|
|
195
|
+
name: 'Alice',
|
|
196
|
+
extensions: {},
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
expect(person.name).toBe('Alice');
|
|
200
|
+
expect(person.extensions).toEqual({});
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
test('Values schema accepts extension data', ({ expect }) => {
|
|
204
|
+
const ColorExtension = Extension.make('color', Schema.String);
|
|
205
|
+
const values: Extension.Values = {};
|
|
206
|
+
Extension.set(values, ColorExtension, 'red');
|
|
207
|
+
|
|
208
|
+
const PersonWithExtensions = Schema.Struct({
|
|
209
|
+
name: Schema.String,
|
|
210
|
+
extensions: Extension.Values,
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
const person = Schema.decodeUnknownSync(PersonWithExtensions)({
|
|
214
|
+
name: 'Bob',
|
|
215
|
+
extensions: values,
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
expect(person.name).toBe('Bob');
|
|
219
|
+
const color = Extension.get(person.extensions, ColorExtension);
|
|
220
|
+
expect(Option.getOrThrow(color)).toBe('red');
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
describe('TypeId', () => {
|
|
225
|
+
test('TypeId is a unique symbol-like string', ({ expect }) => {
|
|
226
|
+
expect(Extension.TypeId).toBe('~@dxos/echo/Extension');
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
test('extensions have TypeId property', ({ expect }) => {
|
|
230
|
+
const ColorExtension = Extension.make('color', Schema.String);
|
|
231
|
+
|
|
232
|
+
expect(Extension.TypeId in ColorExtension).toBe(true);
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
});
|
package/src/Extension.ts
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// @import-as-namespace
|
|
2
|
+
//
|
|
3
|
+
// Copyright 2026 DXOS.org
|
|
4
|
+
//
|
|
5
|
+
|
|
6
|
+
import * as Function from 'effect/Function';
|
|
7
|
+
import * as Option from 'effect/Option';
|
|
8
|
+
import * as Schema from 'effect/Schema';
|
|
9
|
+
import type * as Types from 'effect/Types';
|
|
10
|
+
|
|
11
|
+
// @import-as-namespace
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Extensions allow objects to contain typed properties that are not part of the schema.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export const TypeId = '~@dxos/echo/Extension' as const;
|
|
18
|
+
export type TypeId = typeof TypeId;
|
|
19
|
+
|
|
20
|
+
export interface Extension<T> extends Record<
|
|
21
|
+
TypeId,
|
|
22
|
+
{
|
|
23
|
+
_Type: T;
|
|
24
|
+
}
|
|
25
|
+
> {
|
|
26
|
+
readonly [TypeId]: {
|
|
27
|
+
_Type: T;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
readonly key: Key;
|
|
31
|
+
readonly valueSchema: Schema.Schema<T>;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Create a new typed extension.
|
|
36
|
+
*
|
|
37
|
+
* ```ts
|
|
38
|
+
* const ColorExtension = Extension.make('color', Schema.String);
|
|
39
|
+
*
|
|
40
|
+
* const obj = Obj.make(Person, {
|
|
41
|
+
* [Obj.Meta]: { keys: [{ source: 'external', id: '123' }] },
|
|
42
|
+
* name: 'John',
|
|
43
|
+
* email: 'john@example.com',
|
|
44
|
+
* });
|
|
45
|
+
*
|
|
46
|
+
* Obj.update(obj, (obj) => {
|
|
47
|
+
* Extension.set(obj.extensions, ColorExtension, 'red');
|
|
48
|
+
* });
|
|
49
|
+
*
|
|
50
|
+
* console.log(Extension.get(obj.extensions, ColorExtension)); // 'red'
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export const make = <S extends Schema.Schema.AnyNoContext>(
|
|
54
|
+
key: string,
|
|
55
|
+
valueSchema: S,
|
|
56
|
+
): Extension<Schema.Schema.Type<S>> => {
|
|
57
|
+
return {
|
|
58
|
+
[TypeId]: {} as any,
|
|
59
|
+
key: Key.make(key),
|
|
60
|
+
valueSchema,
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Unique identifier for an extension.
|
|
66
|
+
*/
|
|
67
|
+
// TODO(dmaretskyi): filter to be fully qualified: (e.g., org.dxos.extension.color)
|
|
68
|
+
export const Key = Schema.String.pipe(Schema.brand('~@dxos/echo/ExtensionKey'));
|
|
69
|
+
export type Key = Schema.Schema.Type<typeof Key>;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Set of extension values.
|
|
73
|
+
*
|
|
74
|
+
* Can be used inside an object/relation schema:
|
|
75
|
+
*
|
|
76
|
+
* ```ts
|
|
77
|
+
* const Person = Schema.Struct({
|
|
78
|
+
* name: Schema.String,
|
|
79
|
+
* extensions: Extension.Values,
|
|
80
|
+
* });
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
export const Values = Schema.Record({ key: Key, value: Schema.Unknown });
|
|
84
|
+
export interface Values extends Schema.Schema.Type<typeof Values> {}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Get the value of an extension from a set of values.
|
|
88
|
+
*/
|
|
89
|
+
export const get: {
|
|
90
|
+
<T>(extension: Extension<T>): (values: Values) => Option.Option<T>;
|
|
91
|
+
<T>(values: Values, extension: Extension<T>): Option.Option<T>;
|
|
92
|
+
} = Function.dual<
|
|
93
|
+
<T>(extension: Extension<T>) => (values: Values) => Option.Option<T>,
|
|
94
|
+
<T>(values: Values, extension: Extension<T>) => Option.Option<T>
|
|
95
|
+
>(2, (values, extension) => {
|
|
96
|
+
if (!(extension.key in values)) {
|
|
97
|
+
return Option.none();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return Function.pipe(values[extension.key], Schema.decodeUnknownSync(extension.valueSchema), Option.some);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Set the value of an extension in a set of values.
|
|
105
|
+
*
|
|
106
|
+
* Can also be used within Obj.update callback:
|
|
107
|
+
*
|
|
108
|
+
* ```ts
|
|
109
|
+
* Obj.update(obj, (obj) => {
|
|
110
|
+
* Extension.set(obj.extensions, ColorExtension, 'red');
|
|
111
|
+
* });
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
export const set: {
|
|
115
|
+
<T>(extension: Extension<T>, value: T): (values: Values) => void;
|
|
116
|
+
<T>(values: Types.Mutable<Values>, extension: Extension<T>, value: T): void;
|
|
117
|
+
} = Function.dual<
|
|
118
|
+
<T>(extension: Extension<T>, value: T) => (values: Values) => void,
|
|
119
|
+
<T>(values: Types.Mutable<Values>, extension: Extension<T>, value: T) => void
|
|
120
|
+
>(3, (values, extension, value) => {
|
|
121
|
+
values[extension.key] = Schema.encodeSync(extension.valueSchema)(value);
|
|
122
|
+
});
|
package/src/Feed.ts
ADDED
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// @import-as-namespace
|
|
6
|
+
|
|
7
|
+
import * as Context from 'effect/Context';
|
|
8
|
+
import * as Effect from 'effect/Effect';
|
|
9
|
+
import * as Layer from 'effect/Layer';
|
|
10
|
+
import type * as Option from 'effect/Option';
|
|
11
|
+
import * as Schema from 'effect/Schema';
|
|
12
|
+
|
|
13
|
+
import { DXN, EchoURI } from '@dxos/keys';
|
|
14
|
+
|
|
15
|
+
import * as Annotation from './Annotation';
|
|
16
|
+
import type * as Entity from './Entity';
|
|
17
|
+
import type * as Filter from './Filter';
|
|
18
|
+
import * as internal from './internal';
|
|
19
|
+
import * as Obj from './Obj';
|
|
20
|
+
import type * as Query from './Query';
|
|
21
|
+
import type * as QueryResult from './QueryResult';
|
|
22
|
+
import * as Type from './Type';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Runtime schema for a Feed object.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* const feed = Obj.make(Feed.Feed, { name: 'notifications', kind: 'org.dxos.plugin.notifications.v1' });
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export const Feed = Schema.Struct({
|
|
33
|
+
/** User-facing display name. */
|
|
34
|
+
name: Schema.String.pipe(Schema.optional),
|
|
35
|
+
/** Identifier for the feed's kind (e.g., plugin id). */
|
|
36
|
+
kind: Schema.String.pipe(internal.FormInputAnnotation.set(false), Schema.optional),
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Feed namespace.
|
|
40
|
+
* Controls how feed data is stored and replicated.
|
|
41
|
+
* - `data`: Data feed (default).
|
|
42
|
+
* - `trace`: Trace feed.
|
|
43
|
+
*/
|
|
44
|
+
namespace: Schema.optional(Schema.Literal('data', 'trace')),
|
|
45
|
+
}).pipe(
|
|
46
|
+
internal.SystemTypeAnnotation.set(true),
|
|
47
|
+
Annotation.IconAnnotation.set({
|
|
48
|
+
icon: 'ph--rows--regular',
|
|
49
|
+
hue: 'yellow',
|
|
50
|
+
}),
|
|
51
|
+
Type.makeObject(DXN.make('org.dxos.type.feed', '0.1.0')),
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* TypeScript instance type for a Feed object.
|
|
56
|
+
*/
|
|
57
|
+
export type Feed = Type.InstanceType<typeof Feed>;
|
|
58
|
+
|
|
59
|
+
//
|
|
60
|
+
// Types
|
|
61
|
+
//
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Opaque cursor for iterating over feed items.
|
|
65
|
+
*/
|
|
66
|
+
// TODO(dmaretskyi): T needs to be referenced in the type structure for typescript to respect it during inference and type-checking.
|
|
67
|
+
export interface Cursor<T = Obj.Snapshot> {
|
|
68
|
+
readonly _tag: 'Cursor';
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Retention options for a feed.
|
|
73
|
+
*/
|
|
74
|
+
export interface RetentionOptions {
|
|
75
|
+
/** Retain items after this cursor position. */
|
|
76
|
+
// TODO(wittjosiah): Use FeedCursor from @dxos/feed?
|
|
77
|
+
cursor?: string;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Sync options for a feed.
|
|
82
|
+
*/
|
|
83
|
+
export interface SyncOptions {
|
|
84
|
+
/** Push local changes to the server. Defaults to true. */
|
|
85
|
+
shouldPush?: boolean;
|
|
86
|
+
/** Pull remote changes from the server. Defaults to true. */
|
|
87
|
+
shouldPull?: boolean;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Queue replication backlog for a feed namespace.
|
|
92
|
+
* `0` / `0` means caught up on pull and push.
|
|
93
|
+
*/
|
|
94
|
+
export interface SyncState {
|
|
95
|
+
/** Blocks still to pull from remote. */
|
|
96
|
+
blocksToPull: number;
|
|
97
|
+
/** Unpositioned blocks still to push to remote. */
|
|
98
|
+
blocksToPush: number;
|
|
99
|
+
/** Total blocks stored locally for the feed namespace. */
|
|
100
|
+
totalBlocks: number;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
//
|
|
104
|
+
// Factory
|
|
105
|
+
//
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Creates a new feed object.
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```ts
|
|
112
|
+
* const feed = Feed.make({ name: 'notifications', kind: 'org.dxos.plugin.notifications.v1' });
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
// TODO(wittjosiah): How to control the feed namespace (data/trace)? Why do feeds have namespaces?
|
|
116
|
+
export const make = (props: Obj.MakeProps<typeof Feed> = {}): Feed => Obj.make(Feed, props);
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Returns the feed object's EchoURI when the feed is stored in a space.
|
|
120
|
+
*
|
|
121
|
+
* Used internally by the feed service layer.
|
|
122
|
+
*/
|
|
123
|
+
export const getQueueUri = (feed: Feed): EchoURI.EchoURI | undefined => EchoURI.tryParse(Obj.getURI(feed));
|
|
124
|
+
|
|
125
|
+
//
|
|
126
|
+
// Service
|
|
127
|
+
//
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Effect service for feed operations.
|
|
131
|
+
* Provides the bridge to the underlying storage implementation.
|
|
132
|
+
* Must be provided by the application layer (e.g., echo-db).
|
|
133
|
+
*/
|
|
134
|
+
export class FeedService extends Context.Tag('@dxos/echo/Feed/FeedService')<
|
|
135
|
+
FeedService,
|
|
136
|
+
{
|
|
137
|
+
/**
|
|
138
|
+
* Appends items to a feed.
|
|
139
|
+
*/
|
|
140
|
+
append(feed: Feed, items: Entity.Unknown[]): Promise<void>;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Removes items from a feed by ID.
|
|
144
|
+
*/
|
|
145
|
+
// TODO(dmaretskyi): Change type to ObjectId.
|
|
146
|
+
remove(feed: Feed, ids: string[]): Promise<void>;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Queries items in a feed.
|
|
150
|
+
*/
|
|
151
|
+
query: {
|
|
152
|
+
<Q extends Query.Any>(feed: Feed, query: Q): QueryResult.QueryResult<Query.Type<Q>>;
|
|
153
|
+
<F extends Filter.Any>(feed: Feed, filter: F): QueryResult.QueryResult<Filter.Type<F>>;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Syncs the feed with the server.
|
|
158
|
+
*/
|
|
159
|
+
sync(feed: Feed, options?: SyncOptions): Promise<void>;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Returns queue replication backlog for the feed's namespace.
|
|
163
|
+
*/
|
|
164
|
+
getSyncState(feed: Feed): Promise<SyncState>;
|
|
165
|
+
}
|
|
166
|
+
>() {}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* @deprecated Use `FeedService` instead.
|
|
170
|
+
*/
|
|
171
|
+
export type Service = FeedService;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* @deprecated Use `FeedService` instead.
|
|
175
|
+
*/
|
|
176
|
+
export const Service = FeedService;
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Effect context service that holds the current feed for a scoped operation.
|
|
180
|
+
*
|
|
181
|
+
* @deprecated Prefer threading a `Feed.Feed` explicitly through function signatures
|
|
182
|
+
* over hiding it behind a context service.
|
|
183
|
+
*/
|
|
184
|
+
export class ContextFeedService extends Context.Tag('@dxos/echo/Feed/ContextFeedService')<
|
|
185
|
+
ContextFeedService,
|
|
186
|
+
{
|
|
187
|
+
readonly feed: Feed;
|
|
188
|
+
}
|
|
189
|
+
>() {
|
|
190
|
+
static layer = (feed: Feed): Layer.Layer<ContextFeedService> => Layer.succeed(ContextFeedService, { feed });
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Layer that provides a Feed service that throws when accessed.
|
|
195
|
+
* Useful as a default layer when no feed service is available.
|
|
196
|
+
*/
|
|
197
|
+
export const notAvailable: Layer.Layer<FeedService> = Layer.succeed(FeedService, {
|
|
198
|
+
append: () => {
|
|
199
|
+
throw new Error('Feed.FeedService not available');
|
|
200
|
+
},
|
|
201
|
+
remove: () => {
|
|
202
|
+
throw new Error('Feed.FeedService not available');
|
|
203
|
+
},
|
|
204
|
+
query: () => {
|
|
205
|
+
throw new Error('Feed.FeedService not available');
|
|
206
|
+
},
|
|
207
|
+
sync: () => {
|
|
208
|
+
throw new Error('Feed.FeedService not available');
|
|
209
|
+
},
|
|
210
|
+
getSyncState: () => {
|
|
211
|
+
throw new Error('Feed.FeedService not available');
|
|
212
|
+
},
|
|
213
|
+
} as Context.Tag.Service<FeedService>);
|
|
214
|
+
|
|
215
|
+
//
|
|
216
|
+
// Operations
|
|
217
|
+
//
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Appends items to a feed.
|
|
221
|
+
*
|
|
222
|
+
* @example
|
|
223
|
+
* ```ts
|
|
224
|
+
* yield* Feed.append(feed, [Obj.make(Notification, { title: 'Hello' })]);
|
|
225
|
+
* ```
|
|
226
|
+
*/
|
|
227
|
+
export const append = (feed: Feed, items: Entity.Unknown[]): Effect.Effect<void, never, FeedService> =>
|
|
228
|
+
Effect.gen(function* () {
|
|
229
|
+
const service = yield* FeedService;
|
|
230
|
+
yield* Effect.promise(() => service.append(feed, items));
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Removes items from a feed.
|
|
235
|
+
*
|
|
236
|
+
* @example
|
|
237
|
+
* ```ts
|
|
238
|
+
* yield* Feed.remove(feed, [item]);
|
|
239
|
+
* ```
|
|
240
|
+
*/
|
|
241
|
+
// TODO(dmaretskyi): Should we allow snapshots here? - what does it mean to remove a snapshot?
|
|
242
|
+
export const remove = (feed: Feed, items: (Entity.Unknown | Obj.Snapshot)[]): Effect.Effect<void, never, FeedService> =>
|
|
243
|
+
Effect.gen(function* () {
|
|
244
|
+
const service = yield* FeedService;
|
|
245
|
+
const ids = items.map((item) => item.id);
|
|
246
|
+
yield* Effect.promise(() => service.remove(feed, ids));
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Creates a reactive query over items in a feed.
|
|
251
|
+
*
|
|
252
|
+
* @example
|
|
253
|
+
* ```ts
|
|
254
|
+
* const result = yield* Feed.query(feed, Filter.type(Person));
|
|
255
|
+
* ```
|
|
256
|
+
*/
|
|
257
|
+
// TODO(dmaretskyi): Suport chained queries:
|
|
258
|
+
// const result = yield* feed.pipe(Feed.query(Filter.type(Person))); result.subscribe(...)
|
|
259
|
+
// const objects = yield* feed.pipe(Feed.query(Filter.type(Person))).run;
|
|
260
|
+
// const object = yield* feed.pipe(Feed.query(Filter.type(Person))).first;
|
|
261
|
+
// ... unify for Database and schema queries.
|
|
262
|
+
export const query: {
|
|
263
|
+
<Q extends Query.Any>(
|
|
264
|
+
feed: Feed,
|
|
265
|
+
query: Q,
|
|
266
|
+
): Effect.Effect<QueryResult.QueryResult<Query.Type<Q>>, never, FeedService>;
|
|
267
|
+
<F extends Filter.Any>(
|
|
268
|
+
feed: Feed,
|
|
269
|
+
filter: F,
|
|
270
|
+
): Effect.Effect<QueryResult.QueryResult<Filter.Type<F>>, never, FeedService>;
|
|
271
|
+
} = (feed: Feed, queryOrFilter: Query.Any | Filter.Any) =>
|
|
272
|
+
FeedService.pipe(Effect.map((service) => service.query(feed, queryOrFilter as any) as QueryResult.QueryResult<any>));
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Executes a feed query once and returns the results.
|
|
276
|
+
*
|
|
277
|
+
* @example
|
|
278
|
+
* ```ts
|
|
279
|
+
* const items = yield* Feed.runQuery(feed, Filter.type(Person));
|
|
280
|
+
* ```
|
|
281
|
+
*/
|
|
282
|
+
export const runQuery: {
|
|
283
|
+
<Q extends Query.Any>(feed: Feed, query: Q): Effect.Effect<Query.Type<Q>[], never, FeedService>;
|
|
284
|
+
<F extends Filter.Any>(feed: Feed, filter: F): Effect.Effect<Filter.Type<F>[], never, FeedService>;
|
|
285
|
+
} = (feed: Feed, queryOrFilter: Query.Any | Filter.Any) =>
|
|
286
|
+
query(feed, queryOrFilter as any).pipe(Effect.flatMap((queryResult) => Effect.promise(() => queryResult.run())));
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Syncs the feed with the server.
|
|
290
|
+
*
|
|
291
|
+
* @example
|
|
292
|
+
* ```ts
|
|
293
|
+
* yield* Feed.sync(feed);
|
|
294
|
+
* yield* Feed.sync(feed, { shouldPush: false });
|
|
295
|
+
* ```
|
|
296
|
+
*/
|
|
297
|
+
export const sync = (feed: Feed, options?: SyncOptions): Effect.Effect<void, never, FeedService> =>
|
|
298
|
+
Effect.gen(function* () {
|
|
299
|
+
const service = yield* FeedService;
|
|
300
|
+
yield* Effect.promise(() => service.sync(feed, options));
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Returns queue replication backlog for the feed's namespace.
|
|
305
|
+
*
|
|
306
|
+
* @example
|
|
307
|
+
* ```ts
|
|
308
|
+
* const { blocksToPull, blocksToPush } = yield* Feed.getSyncState(feed);
|
|
309
|
+
* ```
|
|
310
|
+
*/
|
|
311
|
+
export const getSyncState = (feed: Feed): Effect.Effect<SyncState, never, FeedService> =>
|
|
312
|
+
Effect.gen(function* () {
|
|
313
|
+
const service = yield* FeedService;
|
|
314
|
+
return yield* Effect.promise(() => service.getSyncState(feed));
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Creates a cursor for iterating over feed items.
|
|
319
|
+
* Currently stubbed — cursor operations are not yet implemented.
|
|
320
|
+
*
|
|
321
|
+
* @example
|
|
322
|
+
* ```ts
|
|
323
|
+
* const cursor = yield* Feed.cursor<Person>(feed);
|
|
324
|
+
* const item = yield* Feed.next(cursor);
|
|
325
|
+
* ```
|
|
326
|
+
*/
|
|
327
|
+
// TODO(wittjosiah): Implement cursor operations. Use Effect streams?
|
|
328
|
+
export const cursor = <T = Obj.Snapshot>(_feed: Feed): Effect.Effect<Cursor<T>, never, FeedService> =>
|
|
329
|
+
Effect.succeed({ _tag: 'Cursor' } as Cursor<T>);
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Returns the next item from a feed cursor.
|
|
333
|
+
* Currently stubbed — cursor operations are not yet implemented.
|
|
334
|
+
*/
|
|
335
|
+
export const next = <T = Obj.Snapshot>(_cursor: Cursor<T>): Effect.Effect<T, never, FeedService> =>
|
|
336
|
+
Effect.die('Feed.next is not yet implemented');
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Returns the next item from a feed cursor as an Option.
|
|
340
|
+
* Currently stubbed — cursor operations are not yet implemented.
|
|
341
|
+
*/
|
|
342
|
+
export const nextOption = <T = Obj.Snapshot>(_cursor: Cursor<T>): Effect.Effect<Option.Option<T>, never, FeedService> =>
|
|
343
|
+
Effect.die('Feed.nextOption is not yet implemented');
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Sets the local retention policy for a feed.
|
|
347
|
+
* Currently stubbed — feeds do not yet support retention.
|
|
348
|
+
*
|
|
349
|
+
* @example
|
|
350
|
+
* ```ts
|
|
351
|
+
* yield* Feed.setRetention(feed, { count: 1000 });
|
|
352
|
+
* ```
|
|
353
|
+
*/
|
|
354
|
+
// TODO(dmaretskyi): Implement when feed retention is supported.
|
|
355
|
+
export const setRetention = (_feed: Feed, _options: RetentionOptions): Effect.Effect<void, never, FeedService> =>
|
|
356
|
+
Effect.void;
|