@dxos/echo 0.8.4-main.fffef41 → 0.8.4-staging.60fe92afc8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +102 -5
- package/README.md +10 -11
- package/dist/lib/neutral/Annotation.mjs +68 -0
- package/dist/lib/neutral/Database.mjs +38 -0
- package/dist/lib/neutral/Entity.mjs +72 -0
- package/dist/lib/neutral/Err.mjs +12 -0
- package/dist/lib/neutral/Feed.mjs +54 -0
- package/dist/lib/neutral/Filter.mjs +70 -0
- package/dist/lib/neutral/Format.mjs +86 -0
- package/dist/lib/neutral/Format.mjs.map +7 -0
- package/dist/lib/neutral/JsonSchema.mjs +18 -0
- package/dist/lib/neutral/JsonSchema.mjs.map +7 -0
- package/dist/lib/neutral/Key.mjs +16 -0
- package/dist/lib/neutral/Key.mjs.map +7 -0
- package/dist/lib/neutral/Migration.mjs +18 -0
- package/dist/lib/neutral/Migration.mjs.map +7 -0
- package/dist/lib/neutral/Obj.mjs +122 -0
- package/dist/lib/neutral/Obj.mjs.map +7 -0
- package/dist/lib/neutral/Order.mjs +16 -0
- package/dist/lib/neutral/Order.mjs.map +7 -0
- package/dist/lib/neutral/Query.mjs +38 -0
- package/dist/lib/neutral/Query.mjs.map +7 -0
- package/dist/lib/neutral/QueryResult.mjs +2 -0
- package/dist/lib/neutral/QueryResult.mjs.map +7 -0
- package/dist/lib/neutral/Ref.mjs +25 -0
- package/dist/lib/neutral/Ref.mjs.map +7 -0
- package/dist/lib/neutral/Registry.mjs +14 -0
- package/dist/lib/neutral/Registry.mjs.map +7 -0
- package/dist/lib/neutral/Relation.mjs +97 -0
- package/dist/lib/neutral/Relation.mjs.map +7 -0
- package/dist/lib/neutral/Scope.mjs +12 -0
- package/dist/lib/neutral/Scope.mjs.map +7 -0
- package/dist/lib/neutral/Tag.mjs +32 -0
- package/dist/lib/neutral/Tag.mjs.map +7 -0
- package/dist/lib/neutral/Type.mjs +65 -0
- package/dist/lib/neutral/Type.mjs.map +7 -0
- package/dist/lib/neutral/chunk-35INCYOE.mjs +7 -0
- package/dist/lib/neutral/chunk-35INCYOE.mjs.map +7 -0
- package/dist/lib/neutral/chunk-3PBP4V4O.mjs +101 -0
- package/dist/lib/neutral/chunk-3PBP4V4O.mjs.map +7 -0
- package/dist/lib/neutral/chunk-4ZUHOTCG.mjs +184 -0
- package/dist/lib/neutral/chunk-4ZUHOTCG.mjs.map +7 -0
- package/dist/lib/neutral/chunk-5SMDBFVB.mjs +108 -0
- package/dist/lib/neutral/chunk-5SMDBFVB.mjs.map +7 -0
- package/dist/lib/neutral/chunk-5SUJPHAE.mjs +34 -0
- package/dist/lib/neutral/chunk-5SUJPHAE.mjs.map +7 -0
- package/dist/lib/neutral/chunk-6M2Z6WBH.mjs +93 -0
- package/dist/lib/neutral/chunk-6M2Z6WBH.mjs.map +7 -0
- package/dist/lib/neutral/chunk-6YDI3J37.mjs +346 -0
- package/dist/lib/neutral/chunk-6YDI3J37.mjs.map +7 -0
- package/dist/lib/neutral/chunk-7FPIAJIV.mjs +2279 -0
- package/dist/lib/neutral/chunk-7FPIAJIV.mjs.map +7 -0
- package/dist/lib/neutral/chunk-7LOUAPYZ.mjs +25 -0
- package/dist/lib/neutral/chunk-7LOUAPYZ.mjs.map +7 -0
- package/dist/lib/neutral/chunk-7PI7C4EF.mjs +747 -0
- package/dist/lib/neutral/chunk-7PI7C4EF.mjs.map +7 -0
- package/dist/lib/neutral/chunk-BBFJWWAV.mjs +51 -0
- package/dist/lib/neutral/chunk-BBFJWWAV.mjs.map +7 -0
- package/dist/lib/neutral/chunk-EVK6XBXO.mjs +56 -0
- package/dist/lib/neutral/chunk-EVK6XBXO.mjs.map +7 -0
- package/dist/lib/neutral/chunk-IGK6FN65.mjs +27 -0
- package/dist/lib/neutral/chunk-IGK6FN65.mjs.map +7 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/neutral/chunk-LWXVKPPW.mjs +281 -0
- package/dist/lib/neutral/chunk-LWXVKPPW.mjs.map +7 -0
- package/dist/lib/neutral/chunk-MZ7K3MLL.mjs +48 -0
- package/dist/lib/neutral/chunk-MZ7K3MLL.mjs.map +7 -0
- package/dist/lib/neutral/chunk-O6BH7EPN.mjs +94 -0
- package/dist/lib/neutral/chunk-O6BH7EPN.mjs.map +7 -0
- package/dist/lib/neutral/chunk-QQIYS74I.mjs +336 -0
- package/dist/lib/neutral/chunk-QQIYS74I.mjs.map +7 -0
- package/dist/lib/neutral/chunk-R5W6DXR4.mjs +678 -0
- package/dist/lib/neutral/chunk-R5W6DXR4.mjs.map +7 -0
- package/dist/lib/neutral/chunk-RIVWNMSF.mjs +41 -0
- package/dist/lib/neutral/chunk-RIVWNMSF.mjs.map +7 -0
- package/dist/lib/neutral/chunk-SBVFRTST.mjs +160 -0
- package/dist/lib/neutral/chunk-SBVFRTST.mjs.map +7 -0
- package/dist/lib/neutral/chunk-T6E37YIP.mjs +251 -0
- package/dist/lib/neutral/chunk-T6E37YIP.mjs.map +7 -0
- package/dist/lib/neutral/chunk-TFEWTY5A.mjs +428 -0
- package/dist/lib/neutral/chunk-TFEWTY5A.mjs.map +7 -0
- package/dist/lib/neutral/chunk-TYGKCRMK.mjs +437 -0
- package/dist/lib/neutral/chunk-TYGKCRMK.mjs.map +7 -0
- package/dist/lib/neutral/chunk-UUP46KUQ.mjs +205 -0
- package/dist/lib/neutral/chunk-UUP46KUQ.mjs.map +7 -0
- package/dist/lib/neutral/chunk-WISOH2XH.mjs +36 -0
- package/dist/lib/neutral/chunk-WISOH2XH.mjs.map +7 -0
- package/dist/lib/neutral/chunk-WTQJHC75.mjs +395 -0
- package/dist/lib/neutral/chunk-WTQJHC75.mjs.map +7 -0
- package/dist/lib/neutral/chunk-WU3GIANS.mjs +31 -0
- package/dist/lib/neutral/chunk-WU3GIANS.mjs.map +7 -0
- package/dist/lib/neutral/chunk-ZGNNFYHS.mjs +132 -0
- package/dist/lib/neutral/chunk-ZGNNFYHS.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +111 -0
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/internal/index.mjs +539 -0
- package/dist/lib/neutral/internal/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/testing/index.mjs +458 -0
- package/dist/lib/neutral/testing/index.mjs.map +7 -0
- package/dist/types/src/Annotation.d.ts +128 -0
- package/dist/types/src/Annotation.d.ts.map +1 -0
- package/dist/types/src/Annotation.test.d.ts +2 -0
- package/dist/types/src/Annotation.test.d.ts.map +1 -0
- package/dist/types/src/Collection.d.ts +15 -0
- package/dist/types/src/Collection.d.ts.map +1 -0
- package/dist/types/src/Database.d.ts +208 -0
- package/dist/types/src/Database.d.ts.map +1 -0
- package/dist/types/src/Dataset.d.ts +29 -0
- package/dist/types/src/Dataset.d.ts.map +1 -0
- package/dist/types/src/Entity.d.ts +247 -0
- package/dist/types/src/Entity.d.ts.map +1 -0
- package/dist/types/src/Entity.test.d.ts +2 -0
- package/dist/types/src/Entity.test.d.ts.map +1 -0
- package/dist/types/src/Err.d.ts +107 -0
- package/dist/types/src/Err.d.ts.map +1 -0
- package/dist/types/src/Feed.d.ts +229 -0
- package/dist/types/src/Feed.d.ts.map +1 -0
- package/dist/types/src/Filter.d.ts +175 -0
- package/dist/types/src/Filter.d.ts.map +1 -0
- package/dist/types/src/Filter.test.d.ts +2 -0
- package/dist/types/src/Filter.test.d.ts.map +1 -0
- package/dist/types/src/Format.d.ts +2 -0
- package/dist/types/src/Format.d.ts.map +1 -0
- package/dist/types/src/Hypergraph.d.ts +70 -0
- package/dist/types/src/Hypergraph.d.ts.map +1 -0
- package/dist/types/src/Json.d.ts +33 -0
- package/dist/types/src/Json.d.ts.map +1 -0
- package/dist/types/src/Json.test.d.ts +2 -0
- package/dist/types/src/Json.test.d.ts.map +1 -0
- package/dist/types/src/JsonSchema.d.ts +16 -0
- package/dist/types/src/JsonSchema.d.ts.map +1 -0
- package/dist/types/src/Key.d.ts +2 -1
- package/dist/types/src/Key.d.ts.map +1 -1
- package/dist/types/src/Migration.d.ts +72 -0
- package/dist/types/src/Migration.d.ts.map +1 -0
- package/dist/types/src/Obj.d.ts +483 -110
- package/dist/types/src/Obj.d.ts.map +1 -1
- package/dist/types/src/Obj.test.d.ts +2 -0
- package/dist/types/src/Obj.test.d.ts.map +1 -0
- package/dist/types/src/Order.d.ts +26 -0
- package/dist/types/src/Order.d.ts.map +1 -0
- package/dist/types/src/Query.d.ts +231 -0
- package/dist/types/src/Query.d.ts.map +1 -0
- package/dist/types/src/Query.test.d.ts +2 -0
- package/dist/types/src/Query.test.d.ts.map +1 -0
- package/dist/types/src/QueryResult.d.ts +101 -0
- package/dist/types/src/QueryResult.d.ts.map +1 -0
- package/dist/types/src/Ref.d.ts +69 -11
- package/dist/types/src/Ref.d.ts.map +1 -1
- package/dist/types/src/Registry.d.ts +131 -0
- package/dist/types/src/Registry.d.ts.map +1 -0
- package/dist/types/src/Relation.d.ts +321 -23
- package/dist/types/src/Relation.d.ts.map +1 -1
- package/dist/types/src/Relation.test.d.ts +2 -0
- package/dist/types/src/Relation.test.d.ts.map +1 -0
- package/dist/types/src/Scope.d.ts +35 -0
- package/dist/types/src/Scope.d.ts.map +1 -0
- package/dist/types/src/Tag.d.ts +26 -9
- package/dist/types/src/Tag.d.ts.map +1 -1
- package/dist/types/src/Type.d.ts +397 -106
- package/dist/types/src/Type.d.ts.map +1 -1
- package/dist/types/src/Type.test.d.ts +2 -0
- package/dist/types/src/Type.test.d.ts.map +1 -0
- package/dist/types/src/View.d.ts +65 -0
- package/dist/types/src/View.d.ts.map +1 -0
- package/dist/types/src/exemplars.test.d.ts +2 -0
- package/dist/types/src/exemplars.test.d.ts.map +1 -0
- package/dist/types/src/hierarchy.test.d.ts +2 -0
- package/dist/types/src/hierarchy.test.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +21 -5
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/internal/Annotation/annotations.d.ts +272 -0
- package/dist/types/src/internal/Annotation/annotations.d.ts.map +1 -0
- package/dist/types/src/internal/Annotation/annotations.test.d.ts.map +1 -0
- package/dist/types/src/internal/Annotation/dictionary.d.ts +24 -0
- package/dist/types/src/internal/Annotation/dictionary.d.ts.map +1 -0
- package/dist/types/src/internal/Annotation/entity-dictionary.d.ts +14 -0
- package/dist/types/src/internal/Annotation/entity-dictionary.d.ts.map +1 -0
- package/dist/types/src/internal/Annotation/index.d.ts +6 -0
- package/dist/types/src/internal/Annotation/index.d.ts.map +1 -0
- package/dist/types/src/internal/Annotation/sorting.d.ts +24 -0
- package/dist/types/src/internal/Annotation/sorting.d.ts.map +1 -0
- package/dist/types/src/internal/Annotation/util.d.ts +48 -0
- package/dist/types/src/internal/Annotation/util.d.ts.map +1 -0
- package/dist/types/src/internal/Entity/api.d.ts +27 -0
- package/dist/types/src/internal/Entity/api.d.ts.map +1 -0
- package/dist/types/src/internal/Entity/entity.d.ts +84 -0
- package/dist/types/src/internal/Entity/entity.d.ts.map +1 -0
- package/dist/types/src/internal/Entity/guard.d.ts +10 -0
- package/dist/types/src/internal/Entity/guard.d.ts.map +1 -0
- package/dist/types/src/internal/Entity/index.d.ts +10 -0
- package/dist/types/src/internal/Entity/index.d.ts.map +1 -0
- package/dist/types/src/internal/Entity/model.d.ts +59 -0
- package/dist/types/src/internal/Entity/model.d.ts.map +1 -0
- package/dist/types/src/internal/Entity/object.d.ts +18 -0
- package/dist/types/src/internal/Entity/object.d.ts.map +1 -0
- package/dist/types/src/internal/Entity/relation.d.ts +58 -0
- package/dist/types/src/internal/Entity/relation.d.ts.map +1 -0
- package/dist/types/src/internal/Entity/type-kind.d.ts +24 -0
- package/dist/types/src/internal/Entity/type-kind.d.ts.map +1 -0
- package/dist/types/src/internal/Entity/type-uri.d.ts +24 -0
- package/dist/types/src/internal/Entity/type-uri.d.ts.map +1 -0
- package/dist/types/src/internal/Entity/util.d.ts +2 -0
- package/dist/types/src/internal/Entity/util.d.ts.map +1 -0
- package/dist/types/src/internal/Entity/version.d.ts +42 -0
- package/dist/types/src/internal/Entity/version.d.ts.map +1 -0
- package/dist/types/src/internal/Format/date.d.ts.map +1 -0
- package/dist/types/src/internal/Format/date.test.d.ts.map +1 -0
- package/dist/types/src/internal/{formats → Format}/format.d.ts +7 -4
- package/dist/types/src/internal/Format/format.d.ts.map +1 -0
- package/dist/types/src/internal/Format/format.test.d.ts.map +1 -0
- package/dist/types/src/internal/{formats → Format}/index.d.ts +2 -2
- package/dist/types/src/internal/Format/index.d.ts.map +1 -0
- package/dist/types/src/internal/Format/number.d.ts.map +1 -0
- package/dist/types/src/internal/{formats → Format}/object.d.ts +3 -1
- package/dist/types/src/internal/Format/object.d.ts.map +1 -0
- package/dist/types/src/internal/{formats → Format}/select.d.ts +6 -4
- package/dist/types/src/internal/Format/select.d.ts.map +1 -0
- package/dist/types/src/internal/{formats → Format}/string.d.ts +4 -0
- package/dist/types/src/internal/Format/string.d.ts.map +1 -0
- package/dist/types/src/internal/{formats → Format}/types.d.ts +14 -10
- package/dist/types/src/internal/Format/types.d.ts.map +1 -0
- package/dist/types/src/internal/{json → JsonSchema}/annotations.d.ts +1 -1
- package/dist/types/src/internal/JsonSchema/annotations.d.ts.map +1 -0
- package/dist/types/src/internal/JsonSchema/effect-schema.test.d.ts.map +1 -0
- package/dist/types/src/internal/JsonSchema/index.d.ts +5 -0
- package/dist/types/src/internal/JsonSchema/index.d.ts.map +1 -0
- package/dist/types/src/internal/JsonSchema/json-schema-normalize.d.ts.map +1 -0
- package/dist/types/src/internal/{json-schema → JsonSchema}/json-schema-type.d.ts +136 -35
- package/dist/types/src/internal/JsonSchema/json-schema-type.d.ts.map +1 -0
- package/dist/types/src/internal/{json → JsonSchema}/json-schema.d.ts +6 -3
- package/dist/types/src/internal/JsonSchema/json-schema.d.ts.map +1 -0
- package/dist/types/src/internal/JsonSchema/json-schema.test.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/atoms.d.ts +38 -0
- package/dist/types/src/internal/Obj/atoms.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/clone.d.ts +8 -0
- package/dist/types/src/internal/Obj/clone.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/common.d.ts.map +1 -0
- package/dist/types/src/internal/{object/create.d.ts → Obj/create-object.d.ts} +15 -16
- package/dist/types/src/internal/Obj/create-object.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/create-object.test.d.ts +2 -0
- package/dist/types/src/internal/Obj/create-object.test.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/deleted.d.ts +6 -0
- package/dist/types/src/internal/Obj/deleted.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/index.d.ts +11 -0
- package/dist/types/src/internal/Obj/index.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/inspect.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/json-serializer.d.ts +45 -0
- package/dist/types/src/internal/Obj/json-serializer.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/json-serializer.test.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/schema-validator.d.ts +2 -0
- package/dist/types/src/internal/Obj/schema-validator.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/schema-validator.test.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/set-value.d.ts +7 -0
- package/dist/types/src/internal/Obj/set-value.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/set-value.test.d.ts +2 -0
- package/dist/types/src/internal/Obj/set-value.test.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/snapshot.d.ts +6 -0
- package/dist/types/src/internal/Obj/snapshot.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/typed-object.d.ts +25 -0
- package/dist/types/src/internal/Obj/typed-object.d.ts.map +1 -0
- package/dist/types/src/internal/Obj/typed-object.test.d.ts.map +1 -0
- package/dist/types/src/internal/Query/index.d.ts +2 -0
- package/dist/types/src/internal/Query/index.d.ts.map +1 -0
- package/dist/types/src/internal/Query/pretty.d.ts +10 -0
- package/dist/types/src/internal/Query/pretty.d.ts.map +1 -0
- package/dist/types/src/internal/Ref/atoms.d.ts +10 -0
- package/dist/types/src/internal/Ref/atoms.d.ts.map +1 -0
- package/dist/types/src/internal/Ref/index.d.ts.map +1 -0
- package/dist/types/src/internal/Ref/ref-array.d.ts +21 -0
- package/dist/types/src/internal/Ref/ref-array.d.ts.map +1 -0
- package/dist/types/src/internal/{ref → Ref}/ref.d.ts +88 -32
- package/dist/types/src/internal/Ref/ref.d.ts.map +1 -0
- package/dist/types/src/internal/Ref/ref.test.d.ts.map +1 -0
- package/dist/types/src/internal/Ref/utils.d.ts +8 -0
- package/dist/types/src/internal/Ref/utils.d.ts.map +1 -0
- package/dist/types/src/internal/Type/compose.d.ts +7 -0
- package/dist/types/src/internal/Type/compose.d.ts.map +1 -0
- package/dist/types/src/internal/Type/compose.test.d.ts.map +1 -0
- package/dist/types/src/internal/Type/index.d.ts +3 -0
- package/dist/types/src/internal/Type/index.d.ts.map +1 -0
- package/dist/types/src/internal/{schema → Type}/manipulation.d.ts +0 -1
- package/dist/types/src/internal/Type/manipulation.d.ts.map +1 -0
- package/dist/types/src/internal/Type/type-schema.d.ts +52 -0
- package/dist/types/src/internal/Type/type-schema.d.ts.map +1 -0
- package/dist/types/src/internal/common/api/index.d.ts +11 -0
- package/dist/types/src/internal/common/api/index.d.ts.map +1 -0
- package/dist/types/src/internal/common/api/meta.d.ts +45 -0
- package/dist/types/src/internal/common/api/meta.d.ts.map +1 -0
- package/dist/types/src/internal/common/index.d.ts +4 -0
- package/dist/types/src/internal/common/index.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/change-context.d.ts +55 -0
- package/dist/types/src/internal/common/proxy/change-context.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/change.test.d.ts +2 -0
- package/dist/types/src/internal/common/proxy/change.test.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/define-hidden-property.d.ts +5 -0
- package/dist/types/src/internal/common/proxy/define-hidden-property.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/errors.d.ts +19 -0
- package/dist/types/src/internal/common/proxy/errors.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/event-batch.d.ts +10 -0
- package/dist/types/src/internal/common/proxy/event-batch.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/handler.test.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/index.d.ts +14 -0
- package/dist/types/src/internal/common/proxy/index.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/json-serializer.d.ts +6 -0
- package/dist/types/src/internal/common/proxy/json-serializer.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/make-object.d.ts +20 -0
- package/dist/types/src/internal/common/proxy/make-object.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/ownership.d.ts +57 -0
- package/dist/types/src/internal/common/proxy/ownership.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/proxy-types.d.ts +18 -0
- package/dist/types/src/internal/common/proxy/proxy-types.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/proxy-utils.d.ts +47 -0
- package/dist/types/src/internal/common/proxy/proxy-utils.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/reactive-array.d.ts +8 -0
- package/dist/types/src/internal/common/proxy/reactive-array.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/reactive.d.ts +39 -0
- package/dist/types/src/internal/common/proxy/reactive.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/reactive.test.d.ts +2 -0
- package/dist/types/src/internal/common/proxy/reactive.test.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/schema-validator.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/schema.test.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/symbols.d.ts +3 -0
- package/dist/types/src/internal/common/proxy/symbols.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/typed-handler.d.ts +64 -0
- package/dist/types/src/internal/common/proxy/typed-handler.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/typed-handler.test.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/typed-object.test.d.ts.map +1 -0
- package/dist/types/src/internal/common/types/base.d.ts +27 -0
- package/dist/types/src/internal/common/types/base.d.ts.map +1 -0
- package/dist/types/src/internal/common/types/entity.d.ts +94 -0
- package/dist/types/src/internal/common/types/entity.d.ts.map +1 -0
- package/dist/types/src/internal/common/types/index.d.ts +7 -0
- package/dist/types/src/internal/common/types/index.d.ts.map +1 -0
- package/dist/types/src/internal/common/types/meta.d.ts +54 -0
- package/dist/types/src/internal/common/types/meta.d.ts.map +1 -0
- package/dist/types/src/internal/common/types/model-symbols.d.ts +65 -0
- package/dist/types/src/internal/common/types/model-symbols.d.ts.map +1 -0
- package/dist/types/src/internal/common/types/typename.d.ts +28 -0
- package/dist/types/src/internal/common/types/typename.d.ts.map +1 -0
- package/dist/types/src/internal/common/types/version.d.ts +15 -0
- package/dist/types/src/internal/common/types/version.d.ts.map +1 -0
- package/dist/types/src/internal/common/types/well-known-types.d.ts +11 -0
- package/dist/types/src/internal/common/types/well-known-types.d.ts.map +1 -0
- package/dist/types/src/internal/index.d.ts +10 -14
- package/dist/types/src/internal/index.d.ts.map +1 -1
- package/dist/types/src/{test → testing}/api.test.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +4 -3
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/registry.d.ts +9 -0
- package/dist/types/src/testing/registry.d.ts.map +1 -0
- package/dist/types/src/testing/test-data.d.ts +18 -0
- package/dist/types/src/testing/test-data.d.ts.map +1 -0
- package/dist/types/src/testing/test-schema.d.ts +298 -0
- package/dist/types/src/testing/test-schema.d.ts.map +1 -0
- package/dist/types/src/testing/util.d.ts +23 -0
- package/dist/types/src/testing/util.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +119 -66
- package/src/Annotation.test.ts +439 -0
- package/src/Annotation.ts +202 -0
- package/src/Collection.ts +33 -0
- package/src/Database.ts +345 -0
- package/src/Dataset.ts +34 -0
- package/src/Entity.test.ts +132 -0
- package/src/Entity.ts +345 -0
- package/src/Err.ts +40 -0
- package/src/Feed.ts +352 -0
- package/src/Filter.test.ts +90 -0
- package/src/Filter.ts +484 -0
- package/src/Format.ts +5 -0
- package/src/Hypergraph.ts +84 -0
- package/src/Json.test.ts +175 -0
- package/src/Json.ts +103 -0
- package/src/JsonSchema.ts +26 -0
- package/src/Key.ts +4 -1
- package/src/Migration.ts +114 -0
- package/src/Obj.test.ts +641 -0
- package/src/Obj.ts +778 -281
- package/src/Order.ts +68 -0
- package/src/Query.test.ts +835 -0
- package/src/Query.ts +634 -0
- package/src/QueryResult.ts +132 -0
- package/src/Ref.ts +98 -10
- package/src/Registry.ts +155 -0
- package/src/Relation.test.ts +88 -0
- package/src/Relation.ts +503 -67
- package/src/Scope.ts +50 -0
- package/src/Tag.md +88 -0
- package/src/Tag.ts +53 -8
- package/src/Type.test.ts +257 -0
- package/src/Type.ts +643 -151
- package/src/View.ts +98 -0
- package/src/exemplars.test.ts +21 -0
- package/src/hierarchy.test.ts +33 -0
- package/src/index.ts +22 -6
- package/src/internal/Annotation/annotations.test.ts +165 -0
- package/src/internal/Annotation/annotations.ts +609 -0
- package/src/internal/Annotation/dictionary.ts +47 -0
- package/src/internal/Annotation/entity-dictionary.ts +74 -0
- package/src/internal/Annotation/index.ts +9 -0
- package/src/internal/Annotation/sorting.ts +51 -0
- package/src/internal/Annotation/util.ts +94 -0
- package/src/internal/Entity/api.ts +77 -0
- package/src/internal/Entity/entity.ts +277 -0
- package/src/internal/Entity/guard.ts +26 -0
- package/src/internal/Entity/index.ts +13 -0
- package/src/internal/Entity/model.ts +119 -0
- package/src/internal/Entity/object.ts +73 -0
- package/src/internal/Entity/relation.ts +188 -0
- package/src/internal/Entity/type-kind.ts +75 -0
- package/src/internal/Entity/type-uri.ts +92 -0
- package/src/internal/Entity/util.ts +33 -0
- package/src/internal/Entity/version.ts +96 -0
- package/src/internal/{formats → Format}/date.test.ts +1 -2
- package/src/internal/{formats → Format}/date.ts +5 -9
- package/src/internal/{formats → Format}/format.test.ts +27 -7
- package/src/internal/{formats → Format}/format.ts +8 -6
- package/src/internal/{formats → Format}/index.ts +2 -3
- package/src/internal/{formats → Format}/number.ts +5 -5
- package/src/internal/{formats → Format}/object.ts +23 -6
- package/src/internal/{formats → Format}/select.ts +6 -4
- package/src/internal/{formats → Format}/string.ts +14 -9
- package/src/internal/{formats → Format}/types.ts +54 -43
- package/src/internal/{json → JsonSchema}/annotations.ts +3 -3
- package/src/internal/{json-schema → JsonSchema}/index.ts +2 -0
- package/src/internal/{json-schema → JsonSchema}/json-schema-normalize.ts +4 -2
- package/src/internal/{json-schema → JsonSchema}/json-schema-type.ts +39 -39
- package/src/internal/{json → JsonSchema}/json-schema.test.ts +119 -182
- package/src/internal/{json → JsonSchema}/json-schema.ts +70 -42
- package/src/internal/Obj/atoms.ts +244 -0
- package/src/internal/Obj/clone.ts +53 -0
- package/src/internal/{object → Obj}/common.ts +3 -4
- package/src/internal/Obj/create-object.test.ts +116 -0
- package/src/internal/Obj/create-object.ts +140 -0
- package/src/internal/Obj/deleted.ts +19 -0
- package/src/internal/Obj/index.ts +14 -0
- package/src/internal/{object → Obj}/inspect.ts +7 -7
- package/src/internal/Obj/json-serializer.test.ts +199 -0
- package/src/internal/Obj/json-serializer.ts +278 -0
- package/src/internal/{object → Obj}/schema-validator.test.ts +3 -7
- package/src/internal/Obj/schema-validator.ts +6 -0
- package/src/internal/Obj/set-value.test.ts +258 -0
- package/src/internal/Obj/set-value.ts +158 -0
- package/src/internal/Obj/snapshot.ts +114 -0
- package/src/internal/Obj/typed-object.test.ts +32 -0
- package/src/internal/Obj/typed-object.ts +30 -0
- package/src/internal/{json → Query}/index.ts +1 -1
- package/src/internal/Query/pretty.ts +162 -0
- package/src/internal/Ref/atoms.ts +20 -0
- package/src/internal/{ref → Ref}/ref-array.ts +6 -7
- package/src/internal/Ref/ref.test.ts +91 -0
- package/src/internal/{ref → Ref}/ref.ts +230 -101
- package/src/internal/Ref/utils.ts +45 -0
- package/src/internal/{projection → Type}/compose.test.ts +9 -9
- package/src/internal/{projection → Type}/compose.ts +14 -9
- package/src/internal/Type/index.ts +6 -0
- package/src/internal/{schema → Type}/manipulation.ts +0 -25
- package/src/internal/Type/type-schema.ts +60 -0
- package/src/internal/common/README.md +102 -0
- package/src/internal/common/api/index.ts +15 -0
- package/src/internal/common/api/meta.ts +90 -0
- package/src/internal/{testing → common}/index.ts +2 -1
- package/src/internal/common/proxy/change-context.ts +138 -0
- package/src/internal/common/proxy/change.test.ts +527 -0
- package/src/internal/common/proxy/define-hidden-property.ts +14 -0
- package/src/internal/common/proxy/errors.ts +42 -0
- package/src/internal/common/proxy/event-batch.ts +44 -0
- package/src/internal/common/proxy/handler.test.ts +121 -0
- package/src/internal/common/proxy/index.ts +17 -0
- package/src/internal/common/proxy/json-serializer.ts +101 -0
- package/src/internal/common/proxy/make-object.ts +129 -0
- package/src/internal/common/proxy/ownership.ts +252 -0
- package/src/internal/common/proxy/proxy-types.ts +23 -0
- package/src/internal/common/proxy/proxy-utils.ts +150 -0
- package/src/internal/common/proxy/reactive-array.ts +71 -0
- package/src/internal/common/proxy/reactive.test.ts +54 -0
- package/src/internal/common/proxy/reactive.ts +77 -0
- package/src/internal/{object → common/proxy}/schema-validator.ts +6 -3
- package/src/internal/common/proxy/schema.test.ts +107 -0
- package/src/internal/common/proxy/symbols.ts +7 -0
- package/src/internal/common/proxy/typed-handler.test.ts +314 -0
- package/src/internal/common/proxy/typed-handler.ts +509 -0
- package/src/internal/common/proxy/typed-object.test.ts +103 -0
- package/src/internal/common/types/base.ts +43 -0
- package/src/internal/common/types/entity.ts +133 -0
- package/src/internal/common/types/index.ts +15 -0
- package/src/internal/common/types/meta.ts +109 -0
- package/src/internal/common/types/model-symbols.ts +89 -0
- package/src/internal/common/types/typename.ts +91 -0
- package/src/internal/common/types/version.ts +19 -0
- package/src/internal/common/types/well-known-types.ts +15 -0
- package/src/internal/index.ts +14 -17
- package/src/testing/api.test.ts +131 -0
- package/src/testing/index.ts +4 -3
- package/src/testing/registry.ts +44 -0
- package/src/testing/test-data.ts +189 -0
- package/src/testing/test-schema.ts +204 -0
- package/src/testing/util.ts +88 -0
- package/dist/lib/browser/chunk-BIDAASFK.mjs +0 -3727
- package/dist/lib/browser/chunk-BIDAASFK.mjs.map +0 -7
- package/dist/lib/browser/chunk-ZDLCWGEW.mjs +0 -410
- package/dist/lib/browser/chunk-ZDLCWGEW.mjs.map +0 -7
- package/dist/lib/browser/chunk-ZFRJKT4A.mjs +0 -585
- package/dist/lib/browser/chunk-ZFRJKT4A.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -35
- package/dist/lib/browser/internal/index.mjs +0 -336
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/query/index.mjs +0 -13
- package/dist/lib/browser/testing/index.mjs +0 -267
- package/dist/lib/browser/testing/index.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3SVRRCUU.mjs +0 -3727
- package/dist/lib/node-esm/chunk-3SVRRCUU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CGDHRZWH.mjs +0 -585
- package/dist/lib/node-esm/chunk-CGDHRZWH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HWS6VBQC.mjs +0 -410
- package/dist/lib/node-esm/chunk-HWS6VBQC.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -35
- package/dist/lib/node-esm/internal/index.mjs +0 -336
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/query/index.mjs +0 -13
- package/dist/lib/node-esm/testing/index.mjs +0 -267
- package/dist/lib/node-esm/testing/index.mjs.map +0 -7
- package/dist/types/src/errors.d.ts +0 -68
- package/dist/types/src/errors.d.ts.map +0 -1
- package/dist/types/src/internal/ast/annotation-helper.d.ts +0 -8
- package/dist/types/src/internal/ast/annotation-helper.d.ts.map +0 -1
- package/dist/types/src/internal/ast/annotations.d.ts +0 -131
- package/dist/types/src/internal/ast/annotations.d.ts.map +0 -1
- package/dist/types/src/internal/ast/annotations.test.d.ts.map +0 -1
- package/dist/types/src/internal/ast/entity-kind.d.ts +0 -10
- package/dist/types/src/internal/ast/entity-kind.d.ts.map +0 -1
- package/dist/types/src/internal/ast/index.d.ts +0 -5
- package/dist/types/src/internal/ast/index.d.ts.map +0 -1
- package/dist/types/src/internal/ast/types.d.ts +0 -6
- package/dist/types/src/internal/ast/types.d.ts.map +0 -1
- package/dist/types/src/internal/formats/date.d.ts.map +0 -1
- package/dist/types/src/internal/formats/date.test.d.ts.map +0 -1
- package/dist/types/src/internal/formats/format.d.ts.map +0 -1
- package/dist/types/src/internal/formats/format.test.d.ts.map +0 -1
- package/dist/types/src/internal/formats/index.d.ts.map +0 -1
- package/dist/types/src/internal/formats/number.d.ts.map +0 -1
- package/dist/types/src/internal/formats/object.d.ts.map +0 -1
- package/dist/types/src/internal/formats/select.d.ts.map +0 -1
- package/dist/types/src/internal/formats/string.d.ts.map +0 -1
- package/dist/types/src/internal/formats/types.d.ts.map +0 -1
- package/dist/types/src/internal/json/annotations.d.ts.map +0 -1
- package/dist/types/src/internal/json/effect-schema.test.d.ts.map +0 -1
- package/dist/types/src/internal/json/index.d.ts +0 -2
- package/dist/types/src/internal/json/index.d.ts.map +0 -1
- package/dist/types/src/internal/json/json-schema.d.ts.map +0 -1
- package/dist/types/src/internal/json/json-schema.test.d.ts.map +0 -1
- package/dist/types/src/internal/json-schema/index.d.ts +0 -3
- package/dist/types/src/internal/json-schema/index.d.ts.map +0 -1
- package/dist/types/src/internal/json-schema/json-schema-normalize.d.ts.map +0 -1
- package/dist/types/src/internal/json-schema/json-schema-type.d.ts.map +0 -1
- package/dist/types/src/internal/object/accessors.d.ts +0 -37
- package/dist/types/src/internal/object/accessors.d.ts.map +0 -1
- package/dist/types/src/internal/object/common.d.ts.map +0 -1
- package/dist/types/src/internal/object/create.d.ts.map +0 -1
- package/dist/types/src/internal/object/create.test.d.ts +0 -2
- package/dist/types/src/internal/object/create.test.d.ts.map +0 -1
- package/dist/types/src/internal/object/deleted.d.ts +0 -6
- package/dist/types/src/internal/object/deleted.d.ts.map +0 -1
- package/dist/types/src/internal/object/entity.d.ts +0 -33
- package/dist/types/src/internal/object/entity.d.ts.map +0 -1
- package/dist/types/src/internal/object/expando.d.ts +0 -14
- package/dist/types/src/internal/object/expando.d.ts.map +0 -1
- package/dist/types/src/internal/object/ids.d.ts +0 -6
- package/dist/types/src/internal/object/ids.d.ts.map +0 -1
- package/dist/types/src/internal/object/index.d.ts +0 -16
- package/dist/types/src/internal/object/index.d.ts.map +0 -1
- package/dist/types/src/internal/object/inspect.d.ts.map +0 -1
- package/dist/types/src/internal/object/json-serializer.d.ts +0 -32
- package/dist/types/src/internal/object/json-serializer.d.ts.map +0 -1
- package/dist/types/src/internal/object/json-serializer.test.d.ts.map +0 -1
- package/dist/types/src/internal/object/meta.d.ts +0 -31
- package/dist/types/src/internal/object/meta.d.ts.map +0 -1
- package/dist/types/src/internal/object/model.d.ts +0 -117
- package/dist/types/src/internal/object/model.d.ts.map +0 -1
- package/dist/types/src/internal/object/relation.d.ts +0 -17
- package/dist/types/src/internal/object/relation.d.ts.map +0 -1
- package/dist/types/src/internal/object/schema-validator.d.ts.map +0 -1
- package/dist/types/src/internal/object/schema-validator.test.d.ts.map +0 -1
- package/dist/types/src/internal/object/typed-object.d.ts +0 -31
- package/dist/types/src/internal/object/typed-object.d.ts.map +0 -1
- package/dist/types/src/internal/object/typed-object.test.d.ts.map +0 -1
- package/dist/types/src/internal/object/typename.d.ts +0 -15
- package/dist/types/src/internal/object/typename.d.ts.map +0 -1
- package/dist/types/src/internal/object/version.d.ts +0 -14
- package/dist/types/src/internal/object/version.d.ts.map +0 -1
- package/dist/types/src/internal/projection/compose.d.ts +0 -6
- package/dist/types/src/internal/projection/compose.d.ts.map +0 -1
- package/dist/types/src/internal/projection/compose.test.d.ts.map +0 -1
- package/dist/types/src/internal/projection/index.d.ts +0 -2
- package/dist/types/src/internal/projection/index.d.ts.map +0 -1
- package/dist/types/src/internal/proxy/handler.test.d.ts.map +0 -1
- package/dist/types/src/internal/proxy/reactive-object.d.ts +0 -15
- package/dist/types/src/internal/proxy/reactive-object.d.ts.map +0 -1
- package/dist/types/src/internal/proxy/schema.test.d.ts.map +0 -1
- package/dist/types/src/internal/proxy/typed-handler.d.ts +0 -44
- package/dist/types/src/internal/proxy/typed-handler.d.ts.map +0 -1
- package/dist/types/src/internal/proxy/typed-handler.test.d.ts.map +0 -1
- package/dist/types/src/internal/proxy/typed-object.test.d.ts.map +0 -1
- package/dist/types/src/internal/query/index.d.ts +0 -2
- package/dist/types/src/internal/query/index.d.ts.map +0 -1
- package/dist/types/src/internal/query/query.d.ts +0 -17
- package/dist/types/src/internal/query/query.d.ts.map +0 -1
- package/dist/types/src/internal/ref/index.d.ts.map +0 -1
- package/dist/types/src/internal/ref/ref-array.d.ts +0 -21
- package/dist/types/src/internal/ref/ref-array.d.ts.map +0 -1
- package/dist/types/src/internal/ref/ref.d.ts.map +0 -1
- package/dist/types/src/internal/ref/ref.test.d.ts.map +0 -1
- package/dist/types/src/internal/schema/echo-schema.d.ts +0 -168
- package/dist/types/src/internal/schema/echo-schema.d.ts.map +0 -1
- package/dist/types/src/internal/schema/index.d.ts +0 -7
- package/dist/types/src/internal/schema/index.d.ts.map +0 -1
- package/dist/types/src/internal/schema/manipulation.d.ts.map +0 -1
- package/dist/types/src/internal/schema/runtime-schema-registry.d.ts +0 -18
- package/dist/types/src/internal/schema/runtime-schema-registry.d.ts.map +0 -1
- package/dist/types/src/internal/schema/snapshot.d.ts +0 -6
- package/dist/types/src/internal/schema/snapshot.d.ts.map +0 -1
- package/dist/types/src/internal/schema/stored-schema.d.ts +0 -13
- package/dist/types/src/internal/schema/stored-schema.d.ts.map +0 -1
- package/dist/types/src/internal/testing/index.d.ts +0 -3
- package/dist/types/src/internal/testing/index.d.ts.map +0 -1
- package/dist/types/src/internal/testing/types.d.ts +0 -381
- package/dist/types/src/internal/testing/types.d.ts.map +0 -1
- package/dist/types/src/internal/testing/utils.d.ts +0 -10
- package/dist/types/src/internal/testing/utils.d.ts.map +0 -1
- package/dist/types/src/internal/types/index.d.ts +0 -3
- package/dist/types/src/internal/types/index.d.ts.map +0 -1
- package/dist/types/src/internal/types/types.d.ts +0 -79
- package/dist/types/src/internal/types/types.d.ts.map +0 -1
- package/dist/types/src/internal/types/types.test.d.ts +0 -2
- package/dist/types/src/internal/types/types.test.d.ts.map +0 -1
- package/dist/types/src/internal/types/util.d.ts +0 -5
- package/dist/types/src/internal/types/util.d.ts.map +0 -1
- package/dist/types/src/query/index.d.ts +0 -2
- package/dist/types/src/query/index.d.ts.map +0 -1
- package/dist/types/src/query/query.d.ts +0 -248
- package/dist/types/src/query/query.d.ts.map +0 -1
- package/dist/types/src/query/query.test.d.ts +0 -2
- package/dist/types/src/query/query.test.d.ts.map +0 -1
- package/dist/types/src/testing/echo-schema.d.ts +0 -7
- package/dist/types/src/testing/echo-schema.d.ts.map +0 -1
- package/dist/types/src/testing/types.d.ts +0 -228
- package/dist/types/src/testing/types.d.ts.map +0 -1
- package/src/errors.ts +0 -18
- package/src/internal/ast/annotation-helper.ts +0 -22
- package/src/internal/ast/annotations.test.ts +0 -98
- package/src/internal/ast/annotations.ts +0 -226
- package/src/internal/ast/entity-kind.ts +0 -15
- package/src/internal/ast/index.ts +0 -8
- package/src/internal/ast/types.ts +0 -17
- package/src/internal/object/accessors.ts +0 -153
- package/src/internal/object/create.test.ts +0 -118
- package/src/internal/object/create.ts +0 -96
- package/src/internal/object/deleted.ts +0 -19
- package/src/internal/object/entity.ts +0 -248
- package/src/internal/object/expando.ts +0 -21
- package/src/internal/object/ids.ts +0 -12
- package/src/internal/object/index.ts +0 -19
- package/src/internal/object/json-serializer.test.ts +0 -99
- package/src/internal/object/json-serializer.ts +0 -225
- package/src/internal/object/meta.ts +0 -61
- package/src/internal/object/model.ts +0 -170
- package/src/internal/object/relation.ts +0 -24
- package/src/internal/object/typed-object.test.ts +0 -34
- package/src/internal/object/typed-object.ts +0 -88
- package/src/internal/object/typename.ts +0 -61
- package/src/internal/object/version.ts +0 -22
- package/src/internal/projection/index.ts +0 -5
- package/src/internal/proxy/handler.test.ts +0 -163
- package/src/internal/proxy/reactive-object.ts +0 -108
- package/src/internal/proxy/schema.test.ts +0 -136
- package/src/internal/proxy/typed-handler.test.ts +0 -102
- package/src/internal/proxy/typed-handler.ts +0 -228
- package/src/internal/proxy/typed-object.test.ts +0 -100
- package/src/internal/query/index.ts +0 -5
- package/src/internal/query/query.ts +0 -23
- package/src/internal/ref/ref.test.ts +0 -100
- package/src/internal/schema/echo-schema.ts +0 -383
- package/src/internal/schema/index.ts +0 -10
- package/src/internal/schema/runtime-schema-registry.ts +0 -78
- package/src/internal/schema/snapshot.ts +0 -25
- package/src/internal/schema/stored-schema.ts +0 -26
- package/src/internal/testing/types.ts +0 -144
- package/src/internal/testing/utils.ts +0 -54
- package/src/internal/types/index.ts +0 -6
- package/src/internal/types/types.test.ts +0 -48
- package/src/internal/types/types.ts +0 -176
- package/src/internal/types/util.ts +0 -9
- package/src/query/index.ts +0 -6
- package/src/query/query.test.ts +0 -401
- package/src/query/query.ts +0 -789
- package/src/test/api.test.ts +0 -180
- package/src/testing/echo-schema.ts +0 -39
- package/src/testing/types.ts +0 -108
- /package/dist/lib/{browser/index.mjs.map → neutral/Annotation.mjs.map} +0 -0
- /package/dist/lib/{browser/internal/index.mjs.map → neutral/Database.mjs.map} +0 -0
- /package/dist/lib/{browser/query/index.mjs.map → neutral/Entity.mjs.map} +0 -0
- /package/dist/lib/{node-esm/index.mjs.map → neutral/Err.mjs.map} +0 -0
- /package/dist/lib/{node-esm/internal/index.mjs.map → neutral/Feed.mjs.map} +0 -0
- /package/dist/lib/{node-esm/query/index.mjs.map → neutral/Filter.mjs.map} +0 -0
- /package/dist/types/src/internal/{ast → Annotation}/annotations.test.d.ts +0 -0
- /package/dist/types/src/internal/{formats → Format}/date.d.ts +0 -0
- /package/dist/types/src/internal/{formats → Format}/date.test.d.ts +0 -0
- /package/dist/types/src/internal/{formats → Format}/format.test.d.ts +0 -0
- /package/dist/types/src/internal/{formats → Format}/number.d.ts +0 -0
- /package/dist/types/src/internal/{json → JsonSchema}/effect-schema.test.d.ts +0 -0
- /package/dist/types/src/internal/{json-schema → JsonSchema}/json-schema-normalize.d.ts +0 -0
- /package/dist/types/src/internal/{json → JsonSchema}/json-schema.test.d.ts +0 -0
- /package/dist/types/src/internal/{object → Obj}/common.d.ts +0 -0
- /package/dist/types/src/internal/{object → Obj}/inspect.d.ts +0 -0
- /package/dist/types/src/internal/{object → Obj}/json-serializer.test.d.ts +0 -0
- /package/dist/types/src/internal/{object → Obj}/schema-validator.test.d.ts +0 -0
- /package/dist/types/src/internal/{object → Obj}/typed-object.test.d.ts +0 -0
- /package/dist/types/src/internal/{ref → Ref}/index.d.ts +0 -0
- /package/dist/types/src/internal/{ref → Ref}/ref.test.d.ts +0 -0
- /package/dist/types/src/internal/{projection → Type}/compose.test.d.ts +0 -0
- /package/dist/types/src/internal/{proxy → common/proxy}/handler.test.d.ts +0 -0
- /package/dist/types/src/internal/{object → common/proxy}/schema-validator.d.ts +0 -0
- /package/dist/types/src/internal/{proxy → common/proxy}/schema.test.d.ts +0 -0
- /package/dist/types/src/internal/{proxy → common/proxy}/typed-handler.test.d.ts +0 -0
- /package/dist/types/src/internal/{proxy → common/proxy}/typed-object.test.d.ts +0 -0
- /package/dist/types/src/{test → testing}/api.test.d.ts +0 -0
- /package/src/internal/{json → JsonSchema}/effect-schema.test.ts +0 -0
- /package/src/internal/{ref → Ref}/index.ts +0 -0
|
@@ -7,27 +7,26 @@ import * as Schema from 'effect/Schema';
|
|
|
7
7
|
import * as SchemaAST from 'effect/SchemaAST';
|
|
8
8
|
import { describe, expect, test } from 'vitest';
|
|
9
9
|
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { SchemaEx } from '@dxos/effect';
|
|
11
|
+
import { DXN, EntityId } from '@dxos/keys';
|
|
12
12
|
import { log } from '@dxos/log';
|
|
13
13
|
|
|
14
|
-
import {
|
|
15
|
-
import
|
|
14
|
+
import { TestSchema, prepareAstForCompare } from '../../testing';
|
|
15
|
+
import * as Type from '../../Type';
|
|
16
16
|
import {
|
|
17
|
-
EntityKind,
|
|
18
17
|
FieldLookupAnnotationId,
|
|
19
18
|
GeneratorAnnotation,
|
|
20
19
|
LabelAnnotation,
|
|
21
20
|
PropertyMeta,
|
|
22
21
|
getTypeAnnotation,
|
|
23
22
|
getTypeIdentifierAnnotation,
|
|
24
|
-
} from '../
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
|
|
23
|
+
} from '../Annotation';
|
|
24
|
+
import { EntityKind } from '../common/types';
|
|
25
|
+
import { EchoObjectSchema } from '../Entity';
|
|
26
|
+
import { Email, FormatAnnotation, TypeFormat } from '../Format';
|
|
27
|
+
import { JsonSchemaType, getNormalizedEchoAnnotations, getSchemaProperty, setSchemaProperty } from '../JsonSchema';
|
|
28
|
+
import { Ref, createSchemaReference, getReferenceAst, getSchemaReference } from '../Ref';
|
|
29
|
+
import { TypeSchema } from '../Type';
|
|
31
30
|
import { toEffectSchema, toJsonSchema } from './json-schema';
|
|
32
31
|
|
|
33
32
|
const EXAMPLE_NAMESPACE = '@example';
|
|
@@ -35,26 +34,18 @@ const EXAMPLE_NAMESPACE = '@example';
|
|
|
35
34
|
describe('effect-to-json', () => {
|
|
36
35
|
test('type annotation', () => {
|
|
37
36
|
const Test = Schema.Struct({ name: Schema.String }).pipe(
|
|
38
|
-
Type.
|
|
39
|
-
typename: 'example.com/type/Test',
|
|
40
|
-
version: '0.1.0',
|
|
41
|
-
}),
|
|
37
|
+
Type.makeObject(DXN.make('com.example.type.test', '0.1.0')),
|
|
42
38
|
);
|
|
43
39
|
const jsonSchema = toJsonSchema(Test);
|
|
44
|
-
expect(
|
|
45
|
-
expect(
|
|
40
|
+
expect(jsonSchema.$id).toEqual('dxn:com.example.type.test:0.1.0');
|
|
41
|
+
expect(jsonSchema.version).toEqual('0.1.0');
|
|
46
42
|
});
|
|
47
43
|
|
|
48
44
|
test('property meta annotation', () => {
|
|
49
45
|
const meta = { maxLength: 0 };
|
|
50
46
|
const Test = Schema.Struct({
|
|
51
47
|
name: Schema.String.pipe(PropertyMeta(EXAMPLE_NAMESPACE, meta)),
|
|
52
|
-
}).pipe(
|
|
53
|
-
Type.Obj({
|
|
54
|
-
typename: 'example.com/type/Test',
|
|
55
|
-
version: '0.1.0',
|
|
56
|
-
}),
|
|
57
|
-
);
|
|
48
|
+
}).pipe(Type.makeObject(DXN.make('com.example.type.test', '0.1.0')));
|
|
58
49
|
const jsonSchema = toJsonSchema(Test);
|
|
59
50
|
expect(getNormalizedEchoAnnotations(jsonSchema.properties!.name!)!.meta![EXAMPLE_NAMESPACE]).to.deep.eq(meta);
|
|
60
51
|
});
|
|
@@ -62,20 +53,10 @@ describe('effect-to-json', () => {
|
|
|
62
53
|
test('reference annotation', () => {
|
|
63
54
|
const Nested = Schema.Struct({
|
|
64
55
|
name: Schema.String,
|
|
65
|
-
}).pipe(
|
|
66
|
-
Type.Obj({
|
|
67
|
-
typename: 'example.com/type/TestNested',
|
|
68
|
-
version: '0.1.0',
|
|
69
|
-
}),
|
|
70
|
-
);
|
|
56
|
+
}).pipe(Type.makeObject(DXN.make('com.example.type.testNested', '0.1.0')));
|
|
71
57
|
const Test = Schema.Struct({
|
|
72
58
|
name: Ref(Nested),
|
|
73
|
-
}).pipe(
|
|
74
|
-
Type.Obj({
|
|
75
|
-
typename: 'example.com/type/Test',
|
|
76
|
-
version: '0.1.0',
|
|
77
|
-
}),
|
|
78
|
-
);
|
|
59
|
+
}).pipe(Type.makeObject(DXN.make('com.example.type.test', '0.1.0')));
|
|
79
60
|
const jsonSchema = toJsonSchema(Test);
|
|
80
61
|
// log.info('schema', { jsonSchema });
|
|
81
62
|
const nested = jsonSchema.properties!.name;
|
|
@@ -87,44 +68,24 @@ describe('effect-to-json', () => {
|
|
|
87
68
|
test.skip('reference annotation with lookup property', () => {
|
|
88
69
|
const Nested = Schema.Struct({
|
|
89
70
|
name: Schema.String,
|
|
90
|
-
}).pipe(
|
|
91
|
-
Type.Obj({
|
|
92
|
-
typename: 'example.com/type/TestNested',
|
|
93
|
-
version: '0.1.0',
|
|
94
|
-
}),
|
|
95
|
-
);
|
|
71
|
+
}).pipe(Type.makeObject(DXN.make('com.example.type.testNested', '0.1.0')));
|
|
96
72
|
const Test = Schema.Struct({
|
|
97
73
|
name: Ref(Nested).annotations({ [FieldLookupAnnotationId]: 'name' }),
|
|
98
|
-
}).pipe(
|
|
99
|
-
Type.Obj({
|
|
100
|
-
typename: 'example.com/type/Test',
|
|
101
|
-
version: '0.1.0',
|
|
102
|
-
}),
|
|
103
|
-
);
|
|
74
|
+
}).pipe(Type.makeObject(DXN.make('com.example.type.test', '0.1.0')));
|
|
104
75
|
const jsonSchema = toJsonSchema(Test);
|
|
105
76
|
const effectSchema = toEffectSchema(jsonSchema);
|
|
106
77
|
|
|
107
|
-
const annotation = findAnnotation<string>(effectSchema.ast, FieldLookupAnnotationId);
|
|
78
|
+
const annotation = SchemaEx.findAnnotation<string>(effectSchema.ast, FieldLookupAnnotationId);
|
|
108
79
|
expect(annotation).to.not.toBeUndefined();
|
|
109
80
|
});
|
|
110
81
|
|
|
111
82
|
test('array of references', () => {
|
|
112
83
|
const Nested = Schema.Struct({
|
|
113
84
|
name: Schema.String,
|
|
114
|
-
}).pipe(
|
|
115
|
-
Type.Obj({
|
|
116
|
-
typename: 'example.com/type/TestNested',
|
|
117
|
-
version: '0.1.0',
|
|
118
|
-
}),
|
|
119
|
-
);
|
|
85
|
+
}).pipe(Type.makeObject(DXN.make('com.example.type.testNested', '0.1.0')));
|
|
120
86
|
const Test = Schema.Struct({
|
|
121
87
|
name: Schema.Array(Ref(Nested)),
|
|
122
|
-
}).pipe(
|
|
123
|
-
Type.Obj({
|
|
124
|
-
typename: 'example.com/type/Test',
|
|
125
|
-
version: '0.1.0',
|
|
126
|
-
}),
|
|
127
|
-
);
|
|
88
|
+
}).pipe(Type.makeObject(DXN.make('com.example.type.test', '0.1.0')));
|
|
128
89
|
|
|
129
90
|
const jsonSchema = toJsonSchema(Test);
|
|
130
91
|
expectReferenceAnnotation((jsonSchema.properties!.name as any).items);
|
|
@@ -133,20 +94,10 @@ describe('effect-to-json', () => {
|
|
|
133
94
|
test('optional references', () => {
|
|
134
95
|
const Nested = Schema.Struct({
|
|
135
96
|
name: Schema.String,
|
|
136
|
-
}).pipe(
|
|
137
|
-
Type.Obj({
|
|
138
|
-
typename: 'example.com/type/TestNested',
|
|
139
|
-
version: '0.1.0',
|
|
140
|
-
}),
|
|
141
|
-
);
|
|
97
|
+
}).pipe(Type.makeObject(DXN.make('com.example.type.testNested', '0.1.0')));
|
|
142
98
|
const Test = Schema.Struct({
|
|
143
99
|
name: Schema.optional(Ref(Nested)),
|
|
144
|
-
}).pipe(
|
|
145
|
-
Type.Obj({
|
|
146
|
-
typename: 'example.com/type/Test',
|
|
147
|
-
version: '0.1.0',
|
|
148
|
-
}),
|
|
149
|
-
);
|
|
100
|
+
}).pipe(Type.makeObject(DXN.make('com.example.type.test', '0.1.0')));
|
|
150
101
|
const jsonSchema = toJsonSchema(Test);
|
|
151
102
|
expectReferenceAnnotation(jsonSchema.properties!.name);
|
|
152
103
|
});
|
|
@@ -159,24 +110,20 @@ describe('effect-to-json', () => {
|
|
|
159
110
|
});
|
|
160
111
|
|
|
161
112
|
test('annotations', () => {
|
|
162
|
-
const
|
|
113
|
+
const TempSchema = Schema.Struct({
|
|
163
114
|
name: Schema.String.annotations({ description: 'Person name', title: 'Name' }),
|
|
164
|
-
email: Schema.String.pipe(FormatAnnotation.set(
|
|
115
|
+
email: Schema.String.pipe(FormatAnnotation.set(TypeFormat.Email)).annotations({
|
|
165
116
|
description: 'Email address',
|
|
166
117
|
}),
|
|
167
|
-
}).pipe(
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
version: '0.1.0',
|
|
171
|
-
}),
|
|
172
|
-
);
|
|
173
|
-
const jsonSchema = toJsonSchema(TestSchema);
|
|
118
|
+
}).pipe(Type.makeObject(DXN.make('com.example.type.person', '0.1.0')));
|
|
119
|
+
|
|
120
|
+
const jsonSchema = toJsonSchema(TempSchema);
|
|
174
121
|
expect(jsonSchema).to.deep.eq({
|
|
175
122
|
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
176
|
-
$id: 'dxn:type:
|
|
123
|
+
$id: 'dxn:com.example.type.person:0.1.0',
|
|
177
124
|
|
|
178
125
|
entityKind: EntityKind.Object,
|
|
179
|
-
typename: 'example.
|
|
126
|
+
typename: 'com.example.type.person',
|
|
180
127
|
version: '0.1.0',
|
|
181
128
|
|
|
182
129
|
type: 'object',
|
|
@@ -197,39 +144,39 @@ describe('effect-to-json', () => {
|
|
|
197
144
|
});
|
|
198
145
|
|
|
199
146
|
test('handles suspend -- Contact schema serialization', () => {
|
|
200
|
-
const schema = toJsonSchema(
|
|
201
|
-
expect(Object.keys(schema.properties!)).toEqual([
|
|
147
|
+
const schema = toJsonSchema(TestSchema.Person);
|
|
148
|
+
expect(Object.keys(schema.properties!)).toEqual([
|
|
149
|
+
'id',
|
|
150
|
+
'name',
|
|
151
|
+
'username',
|
|
152
|
+
'email',
|
|
153
|
+
'age',
|
|
154
|
+
'tasks',
|
|
155
|
+
'employer',
|
|
156
|
+
'address',
|
|
157
|
+
'fields',
|
|
158
|
+
]);
|
|
202
159
|
});
|
|
203
160
|
|
|
204
161
|
test('reference property by ref', () => {
|
|
205
162
|
const Organization = Schema.Struct({
|
|
206
163
|
field: Schema.String,
|
|
207
|
-
}).pipe(
|
|
208
|
-
Type.Obj({
|
|
209
|
-
typename: 'example.com/type/Organization',
|
|
210
|
-
version: '0.1.0',
|
|
211
|
-
}),
|
|
212
|
-
);
|
|
164
|
+
}).pipe(Type.makeObject(DXN.make('com.example.type.organization', '0.1.0')));
|
|
213
165
|
|
|
214
166
|
const Contact = Schema.Struct({
|
|
215
167
|
name: Schema.String,
|
|
216
168
|
organization: Ref(Organization).annotations({ description: 'Contact organization' }),
|
|
217
|
-
}).pipe(
|
|
218
|
-
Type.Obj({
|
|
219
|
-
typename: 'example.com/type/Person',
|
|
220
|
-
version: '0.1.0',
|
|
221
|
-
}),
|
|
222
|
-
);
|
|
169
|
+
}).pipe(Type.makeObject(DXN.make('com.example.type.person', '0.1.0')));
|
|
223
170
|
|
|
224
171
|
// log.info('Contact', { ast: Contact.ast });
|
|
225
172
|
|
|
226
173
|
const jsonSchema = toJsonSchema(Contact);
|
|
227
174
|
expect(jsonSchema).toEqual({
|
|
228
175
|
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
229
|
-
$id: 'dxn:type:
|
|
176
|
+
$id: 'dxn:com.example.type.person:0.1.0',
|
|
230
177
|
|
|
231
178
|
entityKind: EntityKind.Object,
|
|
232
|
-
typename: 'example.
|
|
179
|
+
typename: 'com.example.type.person',
|
|
233
180
|
version: '0.1.0',
|
|
234
181
|
|
|
235
182
|
type: 'object',
|
|
@@ -249,7 +196,7 @@ describe('effect-to-json', () => {
|
|
|
249
196
|
$ref: '/schemas/echo/ref',
|
|
250
197
|
reference: {
|
|
251
198
|
schema: {
|
|
252
|
-
$ref: 'dxn:
|
|
199
|
+
$ref: 'dxn:com.example.type.organization',
|
|
253
200
|
},
|
|
254
201
|
schemaVersion: '0.1.0',
|
|
255
202
|
},
|
|
@@ -266,31 +213,26 @@ describe('effect-to-json', () => {
|
|
|
266
213
|
test('add reference property', () => {
|
|
267
214
|
const Organization = Schema.Struct({
|
|
268
215
|
field: Schema.String,
|
|
269
|
-
}).pipe(
|
|
270
|
-
Type.Obj({
|
|
271
|
-
typename: 'example.com/type/Organization',
|
|
272
|
-
version: '0.1.0',
|
|
273
|
-
}),
|
|
274
|
-
);
|
|
216
|
+
}).pipe(Type.makeObject(DXN.make('com.example.type.organization', '0.1.0')));
|
|
275
217
|
|
|
276
218
|
const Contact = Schema.Struct({
|
|
277
219
|
name: Schema.String,
|
|
278
220
|
organization: Ref(Organization).annotations({ description: 'Contact organization' }),
|
|
279
|
-
}).pipe(
|
|
280
|
-
Type.Obj({
|
|
281
|
-
typename: 'example.com/type/Person',
|
|
282
|
-
version: '0.1.0',
|
|
283
|
-
}),
|
|
284
|
-
);
|
|
221
|
+
}).pipe(Type.makeObject(DXN.make('com.example.type.person', '0.1.0')));
|
|
285
222
|
|
|
286
223
|
const jsonSchema = toJsonSchema(Contact);
|
|
287
|
-
setSchemaProperty(
|
|
288
|
-
|
|
289
|
-
|
|
224
|
+
setSchemaProperty(
|
|
225
|
+
jsonSchema,
|
|
226
|
+
'organization' as SchemaEx.JsonProp,
|
|
227
|
+
createSchemaReference(Type.getTypename(Organization)),
|
|
228
|
+
);
|
|
229
|
+
const { typename } =
|
|
230
|
+
getSchemaReference(getSchemaProperty(jsonSchema, 'organization' as SchemaEx.JsonProp) ?? {}) ?? {};
|
|
231
|
+
expect(typename).to.eq(Type.getTypename(Organization));
|
|
290
232
|
});
|
|
291
233
|
|
|
292
|
-
test('serialize circular schema (
|
|
293
|
-
const jsonSchema = toJsonSchema(
|
|
234
|
+
test('serialize circular schema (TypeSchema)', () => {
|
|
235
|
+
const jsonSchema = toJsonSchema(TypeSchema);
|
|
294
236
|
expect(Object.keys(jsonSchema.properties!).length).toBeGreaterThan(0);
|
|
295
237
|
|
|
296
238
|
// TODO(dmaretskyi): Currently unable to deserialize.
|
|
@@ -313,7 +255,7 @@ describe('effect-to-json', () => {
|
|
|
313
255
|
|
|
314
256
|
test('reference with title annotation', () => {
|
|
315
257
|
const schema = Schema.Struct({
|
|
316
|
-
contact: Ref(
|
|
258
|
+
contact: Ref(TestSchema.Person).annotations({ title: 'Custom Title' }),
|
|
317
259
|
});
|
|
318
260
|
|
|
319
261
|
// log.info('schema before', { ast: schema.ast });
|
|
@@ -336,54 +278,51 @@ describe('effect-to-json', () => {
|
|
|
336
278
|
});
|
|
337
279
|
|
|
338
280
|
test('relation schema', () => {
|
|
339
|
-
const schema =
|
|
281
|
+
const schema = TestSchema.EmployedBy;
|
|
340
282
|
const jsonSchema = toJsonSchema(schema);
|
|
341
283
|
expect(jsonSchema).toEqual({
|
|
342
|
-
$id: 'dxn:type:
|
|
284
|
+
$id: 'dxn:com.example.type.employedBy:0.1.0',
|
|
343
285
|
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
344
286
|
entityKind: 'relation',
|
|
345
|
-
typename: 'example.
|
|
287
|
+
typename: 'com.example.type.employedBy',
|
|
346
288
|
version: '0.1.0',
|
|
347
289
|
relationSource: {
|
|
348
290
|
// TODO(dmaretskyi): Should those point to specific schema version?
|
|
349
|
-
$ref: 'dxn:
|
|
291
|
+
$ref: 'dxn:com.example.type.person',
|
|
350
292
|
},
|
|
351
293
|
relationTarget: {
|
|
352
294
|
// TODO(dmaretskyi): Should those point to specific schema version?
|
|
353
|
-
$ref: 'dxn:
|
|
295
|
+
$ref: 'dxn:com.example.type.organization',
|
|
354
296
|
},
|
|
355
297
|
type: 'object',
|
|
356
298
|
properties: {
|
|
357
299
|
id: {
|
|
358
300
|
type: 'string',
|
|
359
301
|
},
|
|
302
|
+
role: {
|
|
303
|
+
type: 'string',
|
|
304
|
+
},
|
|
360
305
|
since: {
|
|
361
306
|
type: 'string',
|
|
362
307
|
},
|
|
363
308
|
},
|
|
364
|
-
propertyOrder: ['since', 'id'],
|
|
365
|
-
required: ['id'],
|
|
309
|
+
propertyOrder: ['role', 'since', 'id'],
|
|
310
|
+
required: ['role', 'id'],
|
|
366
311
|
additionalProperties: false,
|
|
367
312
|
});
|
|
368
313
|
});
|
|
369
314
|
|
|
370
315
|
test('label prop', () => {
|
|
371
316
|
const Organization = Schema.Struct({
|
|
372
|
-
id:
|
|
317
|
+
id: EntityId,
|
|
373
318
|
name: Schema.String,
|
|
374
|
-
}).pipe(
|
|
375
|
-
EchoObject({
|
|
376
|
-
typename: 'example.com/type/Organization',
|
|
377
|
-
version: '0.1.0',
|
|
378
|
-
}),
|
|
379
|
-
LabelAnnotation.set(['name']),
|
|
380
|
-
);
|
|
319
|
+
}).pipe(LabelAnnotation.set(['name']), EchoObjectSchema(DXN.make('com.example.type.organization', '0.1.0')));
|
|
381
320
|
|
|
382
321
|
const jsonSchema = toJsonSchema(Organization);
|
|
383
322
|
expect(jsonSchema).toEqual({
|
|
384
|
-
$id: 'dxn:type:
|
|
323
|
+
$id: 'dxn:com.example.type.organization:0.1.0',
|
|
385
324
|
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
386
|
-
typename: 'example.
|
|
325
|
+
typename: 'com.example.type.organization',
|
|
387
326
|
version: '0.1.0',
|
|
388
327
|
entityKind: 'object',
|
|
389
328
|
type: 'object',
|
|
@@ -408,9 +347,9 @@ describe('effect-to-json', () => {
|
|
|
408
347
|
|
|
409
348
|
test('object id with description', () => {
|
|
410
349
|
const schema = Schema.Struct({
|
|
411
|
-
id:
|
|
350
|
+
id: EntityId.annotations({ description: 'The id' }),
|
|
412
351
|
});
|
|
413
|
-
// log.info('schema', { schema:
|
|
352
|
+
// log.info('schema', { schema: EntityId.ast });
|
|
414
353
|
const jsonSchema = toJsonSchema(schema);
|
|
415
354
|
expect(jsonSchema).toMatchInlineSnapshot(`
|
|
416
355
|
{
|
|
@@ -454,7 +393,7 @@ describe('effect-to-json', () => {
|
|
|
454
393
|
const expectReferenceAnnotation = (object: JsonSchemaType) => {
|
|
455
394
|
expect(object.reference).to.deep.eq({
|
|
456
395
|
schema: {
|
|
457
|
-
$ref: 'dxn:
|
|
396
|
+
$ref: 'dxn:com.example.type.testNested',
|
|
458
397
|
},
|
|
459
398
|
schemaVersion: '0.1.0',
|
|
460
399
|
});
|
|
@@ -481,12 +420,7 @@ describe('json-to-effect', () => {
|
|
|
481
420
|
test(`deserialized equals original ${partial ? 'with partial' : ''}`, () => {
|
|
482
421
|
const Organization = Schema.Struct({
|
|
483
422
|
field: Schema.String,
|
|
484
|
-
}).pipe(
|
|
485
|
-
Type.Obj({
|
|
486
|
-
typename: 'example.com/type/Organization',
|
|
487
|
-
version: '0.1.0',
|
|
488
|
-
}),
|
|
489
|
-
);
|
|
423
|
+
}).pipe(Type.makeObject(DXN.make('com.example.type.organization', '0.1.0')));
|
|
490
424
|
|
|
491
425
|
const fields = {
|
|
492
426
|
string: Schema.String,
|
|
@@ -498,15 +432,12 @@ describe('json-to-effect', () => {
|
|
|
498
432
|
object: Schema.Struct({ id: Schema.String, field: Ref(Organization) }),
|
|
499
433
|
echoObject: Ref(Organization),
|
|
500
434
|
echoObjectArray: Schema.Array(Ref(Organization)),
|
|
501
|
-
email: Schema.String.pipe(FormatAnnotation.set(
|
|
435
|
+
email: Schema.String.pipe(FormatAnnotation.set(TypeFormat.Email)),
|
|
502
436
|
null: Schema.Null,
|
|
503
437
|
} as const;
|
|
504
438
|
|
|
505
439
|
const Test = (partial ? Schema.partial(Schema.Struct(fields)) : Schema.Struct(fields)).pipe(
|
|
506
|
-
Type.
|
|
507
|
-
typename: 'example.com/type/Test',
|
|
508
|
-
version: '0.1.0',
|
|
509
|
-
}),
|
|
440
|
+
Type.makeObject(DXN.make('com.example.type.test', '0.1.0')),
|
|
510
441
|
);
|
|
511
442
|
|
|
512
443
|
const jsonSchema = toJsonSchema(Test);
|
|
@@ -514,11 +445,12 @@ describe('json-to-effect', () => {
|
|
|
514
445
|
|
|
515
446
|
const schema = toEffectSchema(jsonSchema);
|
|
516
447
|
|
|
517
|
-
|
|
518
|
-
expect(() => expect(
|
|
519
|
-
expect(() => expect(
|
|
448
|
+
const testAst = Type.getSchema(Test).ast;
|
|
449
|
+
expect(() => expect(schema.ast).to.deep.eq(testAst)).to.throw();
|
|
450
|
+
expect(() => expect(prepareAstForCompare(testAst)).to.deep.eq(testAst)).to.throw();
|
|
451
|
+
expect(() => expect(schema.ast).to.deep.eq(prepareAstForCompare(testAst))).to.throw();
|
|
520
452
|
// log.info('', { original: prepareAstForCompare(Schema.ast), deserialized: prepareAstForCompare(schema.ast) });
|
|
521
|
-
expect(prepareAstForCompare(schema.ast)).to.deep.eq(prepareAstForCompare(
|
|
453
|
+
expect(prepareAstForCompare(schema.ast)).to.deep.eq(prepareAstForCompare(testAst));
|
|
522
454
|
|
|
523
455
|
// TODO(dmaretskyi): Fix.
|
|
524
456
|
// expect(
|
|
@@ -529,15 +461,15 @@ describe('json-to-effect', () => {
|
|
|
529
461
|
});
|
|
530
462
|
}
|
|
531
463
|
|
|
532
|
-
test('legacy schema with
|
|
464
|
+
test('legacy schema with echo.type annotation gets decoded', () => {
|
|
533
465
|
const jsonSchema: JsonSchemaType = {
|
|
534
|
-
$id: 'dxn:
|
|
466
|
+
$id: 'dxn:com.example.type.project',
|
|
535
467
|
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
536
468
|
additionalProperties: false,
|
|
537
469
|
echo: {
|
|
538
470
|
type: {
|
|
539
471
|
schemaId: '01JERV1HQCQZDQ4NVCJ42QB38F',
|
|
540
|
-
typename: 'example.
|
|
472
|
+
typename: 'com.example.type.project',
|
|
541
473
|
version: '0.1.0',
|
|
542
474
|
},
|
|
543
475
|
},
|
|
@@ -563,15 +495,15 @@ describe('json-to-effect', () => {
|
|
|
563
495
|
const schema = toEffectSchema(jsonSchema);
|
|
564
496
|
expect(getTypeAnnotation(schema)).to.deep.eq({
|
|
565
497
|
kind: EntityKind.Object,
|
|
566
|
-
typename: 'example.
|
|
498
|
+
typename: 'com.example.type.project',
|
|
567
499
|
version: '0.1.0',
|
|
568
500
|
});
|
|
569
|
-
expect(getTypeIdentifierAnnotation(schema)).to.deep.eq('
|
|
501
|
+
expect(getTypeIdentifierAnnotation(schema)).to.deep.eq('echo:/01JERV1HQCQZDQ4NVCJ42QB38F');
|
|
570
502
|
});
|
|
571
503
|
|
|
572
504
|
test('symbol annotations get compared', () => {
|
|
573
|
-
const schema1 = Schema.String.pipe(FormatAnnotation.set(
|
|
574
|
-
const schema2 = Schema.String.pipe(FormatAnnotation.set(
|
|
505
|
+
const schema1 = Schema.String.pipe(FormatAnnotation.set(TypeFormat.Email));
|
|
506
|
+
const schema2 = Schema.String.pipe(FormatAnnotation.set(TypeFormat.Currency));
|
|
575
507
|
expect(prepareAstForCompare(schema1.ast)).not.to.deep.eq(prepareAstForCompare(schema2.ast));
|
|
576
508
|
});
|
|
577
509
|
|
|
@@ -586,10 +518,10 @@ describe('json-to-effect', () => {
|
|
|
586
518
|
});
|
|
587
519
|
|
|
588
520
|
test('relation schema roundtrip', () => {
|
|
589
|
-
const schema =
|
|
521
|
+
const schema = TestSchema.HasManager;
|
|
590
522
|
const jsonSchema = toJsonSchema(schema);
|
|
591
523
|
const effectSchema = toEffectSchema(jsonSchema);
|
|
592
|
-
expect(prepareAstForCompare(effectSchema.ast)).to.deep.eq(prepareAstForCompare(schema.ast));
|
|
524
|
+
expect(prepareAstForCompare(effectSchema.ast)).to.deep.eq(prepareAstForCompare(Type.getSchema(schema).ast));
|
|
593
525
|
});
|
|
594
526
|
|
|
595
527
|
test('generator annotation', () => {
|
|
@@ -689,10 +621,8 @@ describe('json-to-effect', () => {
|
|
|
689
621
|
});
|
|
690
622
|
|
|
691
623
|
test('schema with optional referece', () => {
|
|
692
|
-
const
|
|
693
|
-
|
|
694
|
-
});
|
|
695
|
-
const jsonSchema = toJsonSchema(TestSchema);
|
|
624
|
+
const TempSchema = Schema.Struct({ contact: Schema.optional(Ref(TestSchema.Person)) });
|
|
625
|
+
const jsonSchema = toJsonSchema(TempSchema);
|
|
696
626
|
expect(jsonSchema).toMatchInlineSnapshot(`
|
|
697
627
|
{
|
|
698
628
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
@@ -703,7 +633,7 @@ describe('json-to-effect', () => {
|
|
|
703
633
|
"$ref": "/schemas/echo/ref",
|
|
704
634
|
"reference": {
|
|
705
635
|
"schema": {
|
|
706
|
-
"$ref": "dxn:
|
|
636
|
+
"$ref": "dxn:com.example.type.person",
|
|
707
637
|
},
|
|
708
638
|
"schemaVersion": "0.1.0",
|
|
709
639
|
},
|
|
@@ -718,15 +648,15 @@ describe('json-to-effect', () => {
|
|
|
718
648
|
`);
|
|
719
649
|
|
|
720
650
|
const effectSchema = toEffectSchema(jsonSchema);
|
|
721
|
-
expect(prepareAstForCompare(effectSchema.ast)).to.deep.eq(prepareAstForCompare(
|
|
651
|
+
expect(prepareAstForCompare(effectSchema.ast)).to.deep.eq(prepareAstForCompare(TempSchema.ast));
|
|
722
652
|
});
|
|
723
653
|
|
|
724
654
|
test('object nested inside another struct', () => {
|
|
725
655
|
const Contact = Schema.Struct({
|
|
726
656
|
name: Schema.String,
|
|
727
|
-
}).pipe(
|
|
657
|
+
}).pipe(EchoObjectSchema(DXN.make('com.example.type.person', '0.1.0')));
|
|
728
658
|
const input = Schema.Struct({
|
|
729
|
-
contact: Contact,
|
|
659
|
+
contact: Type.getSchema(Contact),
|
|
730
660
|
});
|
|
731
661
|
const jsonSchema = toJsonSchema(input);
|
|
732
662
|
expect(jsonSchema).toMatchInlineSnapshot(`
|
|
@@ -735,7 +665,7 @@ describe('json-to-effect', () => {
|
|
|
735
665
|
"additionalProperties": false,
|
|
736
666
|
"properties": {
|
|
737
667
|
"contact": {
|
|
738
|
-
"$id": "dxn:type:
|
|
668
|
+
"$id": "dxn:com.example.type.person:0.1.0",
|
|
739
669
|
"additionalProperties": false,
|
|
740
670
|
"entityKind": "object",
|
|
741
671
|
"properties": {
|
|
@@ -755,7 +685,7 @@ describe('json-to-effect', () => {
|
|
|
755
685
|
"id",
|
|
756
686
|
],
|
|
757
687
|
"type": "object",
|
|
758
|
-
"typename": "example.
|
|
688
|
+
"typename": "com.example.type.person",
|
|
759
689
|
"version": "0.1.0",
|
|
760
690
|
},
|
|
761
691
|
},
|
|
@@ -776,7 +706,7 @@ describe('json-to-effect', () => {
|
|
|
776
706
|
|
|
777
707
|
describe('reference', () => {
|
|
778
708
|
test('reference annotation', () => {
|
|
779
|
-
const schema = Ref(
|
|
709
|
+
const schema = Ref(TestSchema.Person);
|
|
780
710
|
const jsonSchema = toJsonSchema(schema);
|
|
781
711
|
expect(jsonSchema).toEqual({
|
|
782
712
|
$id: '/schemas/echo/ref',
|
|
@@ -784,7 +714,7 @@ describe('reference', () => {
|
|
|
784
714
|
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
785
715
|
reference: {
|
|
786
716
|
schema: {
|
|
787
|
-
$ref: 'dxn:
|
|
717
|
+
$ref: 'dxn:com.example.type.person',
|
|
788
718
|
},
|
|
789
719
|
schemaVersion: '0.1.0',
|
|
790
720
|
},
|
|
@@ -792,7 +722,7 @@ describe('reference', () => {
|
|
|
792
722
|
});
|
|
793
723
|
|
|
794
724
|
test('title annotation', () => {
|
|
795
|
-
const schema = Ref(
|
|
725
|
+
const schema = Ref(TestSchema.Person).annotations({ title: 'My custom title' });
|
|
796
726
|
const jsonSchema = toJsonSchema(schema);
|
|
797
727
|
expect(jsonSchema).toEqual({
|
|
798
728
|
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
@@ -802,7 +732,7 @@ describe('reference', () => {
|
|
|
802
732
|
$ref: '/schemas/echo/ref',
|
|
803
733
|
reference: {
|
|
804
734
|
schema: {
|
|
805
|
-
$ref: 'dxn:
|
|
735
|
+
$ref: 'dxn:com.example.type.person',
|
|
806
736
|
},
|
|
807
737
|
schemaVersion: '0.1.0',
|
|
808
738
|
},
|
|
@@ -813,7 +743,7 @@ describe('reference', () => {
|
|
|
813
743
|
});
|
|
814
744
|
|
|
815
745
|
test('description annotation', () => {
|
|
816
|
-
const schema = Ref(
|
|
746
|
+
const schema = Ref(TestSchema.Person).annotations({ description: 'My custom description' });
|
|
817
747
|
const jsonSchema = toJsonSchema(schema);
|
|
818
748
|
expect(jsonSchema).toEqual({
|
|
819
749
|
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
@@ -823,7 +753,7 @@ describe('reference', () => {
|
|
|
823
753
|
$ref: '/schemas/echo/ref',
|
|
824
754
|
reference: {
|
|
825
755
|
schema: {
|
|
826
|
-
$ref: 'dxn:
|
|
756
|
+
$ref: 'dxn:com.example.type.person',
|
|
827
757
|
},
|
|
828
758
|
schemaVersion: '0.1.0',
|
|
829
759
|
},
|
|
@@ -837,13 +767,20 @@ describe('reference', () => {
|
|
|
837
767
|
});
|
|
838
768
|
|
|
839
769
|
test('serialize and deserialize', () => {
|
|
840
|
-
const schema = Ref(
|
|
770
|
+
const schema = Ref(TestSchema.Person);
|
|
841
771
|
const jsonSchema = toJsonSchema(schema);
|
|
842
772
|
const deserializedSchema = toEffectSchema(jsonSchema);
|
|
843
773
|
const refAst = getReferenceAst(deserializedSchema.ast);
|
|
844
774
|
expect(refAst).toEqual({
|
|
845
|
-
typename:
|
|
846
|
-
version:
|
|
775
|
+
typename: Type.getTypename(TestSchema.Person),
|
|
776
|
+
version: Type.getVersion(TestSchema.Person),
|
|
847
777
|
});
|
|
848
778
|
});
|
|
779
|
+
|
|
780
|
+
test('empty struct round-trips as TypeLiteral', () => {
|
|
781
|
+
const schema = Schema.Struct({});
|
|
782
|
+
const jsonSchema = toJsonSchema(schema);
|
|
783
|
+
const deserialized = toEffectSchema(jsonSchema);
|
|
784
|
+
expect(deserialized.ast._tag).toBe('TypeLiteral');
|
|
785
|
+
});
|
|
849
786
|
});
|