@dxos/echo 0.8.4-main.406dc2a → 0.8.4-main.40e3dcdf1b
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/README.md +3 -4
- package/dist/lib/neutral/Annotation.mjs +37 -0
- package/dist/lib/neutral/Database.mjs +45 -0
- package/dist/lib/neutral/Entity.mjs +59 -0
- package/dist/lib/neutral/Err.mjs +12 -0
- package/dist/lib/neutral/Feed.mjs +46 -0
- package/dist/lib/neutral/Filter.mjs +64 -0
- package/dist/lib/neutral/Format.mjs +66 -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 +12 -0
- package/dist/lib/neutral/Key.mjs.map +7 -0
- package/dist/lib/neutral/Obj.mjs +110 -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 +35 -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 +24 -0
- package/dist/lib/neutral/Ref.mjs.map +7 -0
- package/dist/lib/neutral/Relation.mjs +93 -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 +28 -0
- package/dist/lib/neutral/Tag.mjs.map +7 -0
- package/dist/lib/neutral/Type.mjs +37 -0
- package/dist/lib/neutral/Type.mjs.map +7 -0
- package/dist/lib/neutral/chunk-43Y5DOS6.mjs +396 -0
- package/dist/lib/neutral/chunk-43Y5DOS6.mjs.map +7 -0
- package/dist/lib/neutral/chunk-724GQYEN.mjs +56 -0
- package/dist/lib/neutral/chunk-724GQYEN.mjs.map +7 -0
- package/dist/lib/neutral/chunk-ANHVGJI4.mjs +21 -0
- package/dist/lib/neutral/chunk-ANHVGJI4.mjs.map +7 -0
- package/dist/lib/neutral/chunk-B5OXLWZL.mjs +402 -0
- package/dist/lib/neutral/chunk-B5OXLWZL.mjs.map +7 -0
- package/dist/lib/neutral/chunk-BNCCGLJN.mjs +7 -0
- package/dist/lib/neutral/chunk-BNCCGLJN.mjs.map +7 -0
- package/dist/lib/neutral/chunk-BOZZPUXE.mjs +787 -0
- package/dist/lib/neutral/chunk-BOZZPUXE.mjs.map +7 -0
- package/dist/lib/neutral/chunk-CIRHIEMW.mjs +298 -0
- package/dist/lib/neutral/chunk-CIRHIEMW.mjs.map +7 -0
- package/dist/lib/neutral/chunk-DYDJBZEG.mjs +102 -0
- package/dist/lib/neutral/chunk-DYDJBZEG.mjs.map +7 -0
- package/dist/lib/neutral/chunk-FXEG7EOK.mjs +45 -0
- package/dist/lib/neutral/chunk-FXEG7EOK.mjs.map +7 -0
- package/dist/lib/neutral/chunk-FZO7LQO7.mjs +73 -0
- package/dist/lib/neutral/chunk-FZO7LQO7.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-KTAWP7GI.mjs +283 -0
- package/dist/lib/neutral/chunk-KTAWP7GI.mjs.map +7 -0
- package/dist/lib/neutral/chunk-NEGC54NE.mjs +130 -0
- package/dist/lib/neutral/chunk-NEGC54NE.mjs.map +7 -0
- package/dist/lib/neutral/chunk-NQRLRYJM.mjs +313 -0
- package/dist/lib/neutral/chunk-NQRLRYJM.mjs.map +7 -0
- package/dist/lib/neutral/chunk-NXMFBIT5.mjs +299 -0
- package/dist/lib/neutral/chunk-NXMFBIT5.mjs.map +7 -0
- package/dist/lib/neutral/chunk-OENWMTE6.mjs +45 -0
- package/dist/lib/neutral/chunk-OENWMTE6.mjs.map +7 -0
- package/dist/lib/neutral/chunk-OMUPQMLR.mjs +7 -0
- package/dist/lib/neutral/chunk-OMUPQMLR.mjs.map +7 -0
- package/dist/lib/neutral/chunk-RMLF7JOZ.mjs +97 -0
- package/dist/lib/neutral/chunk-RMLF7JOZ.mjs.map +7 -0
- package/dist/lib/neutral/chunk-SEMVAGBM.mjs +355 -0
- package/dist/lib/neutral/chunk-SEMVAGBM.mjs.map +7 -0
- package/dist/lib/neutral/chunk-TQQZLKB7.mjs +2712 -0
- package/dist/lib/neutral/chunk-TQQZLKB7.mjs.map +7 -0
- package/dist/lib/neutral/chunk-UBEZSGXY.mjs +51 -0
- package/dist/lib/neutral/chunk-UBEZSGXY.mjs.map +7 -0
- package/dist/lib/neutral/chunk-UFDK26FO.mjs +121 -0
- package/dist/lib/neutral/chunk-UFDK26FO.mjs.map +7 -0
- package/dist/lib/neutral/chunk-UI6MWK5W.mjs +42 -0
- package/dist/lib/neutral/chunk-UI6MWK5W.mjs.map +7 -0
- package/dist/lib/neutral/chunk-UTBRYVQC.mjs +27 -0
- package/dist/lib/neutral/chunk-UTBRYVQC.mjs.map +7 -0
- package/dist/lib/neutral/chunk-VA2F47ZC.mjs +152 -0
- package/dist/lib/neutral/chunk-VA2F47ZC.mjs.map +7 -0
- package/dist/lib/neutral/chunk-WYOKA6AE.mjs +67 -0
- package/dist/lib/neutral/chunk-WYOKA6AE.mjs.map +7 -0
- package/dist/lib/neutral/chunk-YWXWXIE5.mjs +34 -0
- package/dist/lib/neutral/chunk-YWXWXIE5.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +97 -0
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/{node-esm → neutral}/internal/index.mjs +286 -148
- 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 +373 -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 +16 -0
- package/dist/types/src/Collection.d.ts.map +1 -0
- package/dist/types/src/Database.d.ts +189 -0
- package/dist/types/src/Database.d.ts.map +1 -0
- package/dist/types/src/Dataset.d.ts +18 -0
- package/dist/types/src/Dataset.d.ts.map +1 -0
- package/dist/types/src/Entity.d.ts +168 -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 +165 -0
- package/dist/types/src/Feed.d.ts.map +1 -0
- package/dist/types/src/Filter.d.ts +120 -0
- package/dist/types/src/Filter.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/JsonSchema.d.ts +16 -0
- package/dist/types/src/JsonSchema.d.ts.map +1 -0
- package/dist/types/src/Key.d.ts +1 -0
- package/dist/types/src/Key.d.ts.map +1 -1
- package/dist/types/src/Obj.d.ts +419 -101
- 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 +202 -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 +61 -11
- package/dist/types/src/Ref.d.ts.map +1 -1
- package/dist/types/src/Relation.d.ts +288 -21
- 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 +84 -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 +123 -99
- 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 +68 -0
- package/dist/types/src/View.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 +19 -5
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/internal/Annotation/annotations.d.ts +230 -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 +39 -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 +20 -0
- package/dist/types/src/internal/Entity/entity.d.ts.map +1 -0
- package/dist/types/src/internal/Entity/index.d.ts +8 -0
- package/dist/types/src/internal/Entity/index.d.ts.map +1 -0
- package/dist/types/src/internal/Entity/model.d.ts +55 -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 +35 -0
- package/dist/types/src/internal/Entity/relation.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 +4 -2
- 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/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 +4 -2
- 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} +10 -11
- 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/ids.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 +44 -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/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 +44 -19
- 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/{schema → Type}/echo-schema.d.ts +27 -14
- package/dist/types/src/internal/Type/echo-schema.d.ts.map +1 -0
- package/dist/types/src/internal/Type/index.d.ts +4 -0
- package/dist/types/src/internal/Type/index.d.ts.map +1 -0
- package/dist/types/src/internal/Type/manipulation.d.ts.map +1 -0
- package/dist/types/src/internal/Type/persistent-schema.d.ts +20 -0
- package/dist/types/src/internal/Type/persistent-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 +14 -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/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/{proxy → common/proxy}/typed-handler.d.ts +16 -12
- 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 +37 -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/{object → common/types}/meta.d.ts +18 -16
- package/dist/types/src/internal/common/types/meta.d.ts.map +1 -0
- package/dist/types/src/internal/common/types/model-symbols.d.ts +54 -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 +21 -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 +9 -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 +304 -0
- package/dist/types/src/testing/test-schema.d.ts.map +1 -0
- package/dist/types/src/testing/util.d.ts +21 -0
- package/dist/types/src/testing/util.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +106 -65
- package/src/Annotation.ts +48 -0
- package/src/Collection.ts +32 -0
- package/src/Database.ts +317 -0
- package/src/Dataset.ts +26 -0
- package/src/Entity.test.ts +22 -0
- package/src/Entity.ts +237 -0
- package/src/Err.ts +40 -0
- package/src/Feed.ts +257 -0
- package/src/Filter.ts +391 -0
- package/src/Format.ts +9 -0
- package/src/Hypergraph.ts +79 -0
- package/src/JsonSchema.ts +26 -0
- package/src/Key.ts +3 -0
- package/src/Obj.test.ts +447 -0
- package/src/Obj.ts +587 -268
- package/src/Order.ts +46 -0
- package/src/Query.test.ts +632 -0
- package/src/Query.ts +522 -0
- package/src/QueryResult.ts +106 -0
- package/src/Ref.ts +79 -9
- package/src/Relation.test.ts +88 -0
- package/src/Relation.ts +443 -58
- package/src/SchemaRegistry.ts +106 -0
- package/src/{query/tag.ts → Tag.ts} +13 -9
- package/src/Type.test.ts +52 -0
- package/src/Type.ts +167 -153
- package/src/View.ts +102 -0
- package/src/hierarchy.test.ts +33 -0
- package/src/index.ts +20 -6
- package/src/internal/{ast → Annotation}/annotations.test.ts +20 -22
- package/src/internal/Annotation/annotations.ts +571 -0
- package/src/internal/Annotation/index.ts +7 -0
- package/src/internal/Annotation/sorting.ts +52 -0
- package/src/internal/Annotation/util.ts +85 -0
- package/src/internal/Entity/api.ts +31 -0
- package/src/internal/Entity/entity.ts +128 -0
- package/src/internal/Entity/index.ts +11 -0
- package/src/internal/Entity/model.ts +109 -0
- package/src/internal/Entity/object.ts +58 -0
- package/src/internal/Entity/relation.ts +154 -0
- package/src/internal/Entity/util.ts +33 -0
- package/src/internal/Entity/version.ts +97 -0
- package/src/internal/{formats → Format}/date.test.ts +1 -1
- package/src/internal/{formats → Format}/date.ts +5 -5
- package/src/internal/{formats → Format}/format.test.ts +6 -6
- package/src/internal/{formats → Format}/format.ts +8 -6
- 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 +98 -94
- package/src/internal/{json → JsonSchema}/json-schema.ts +30 -15
- package/src/internal/Obj/clone.ts +48 -0
- package/src/internal/{object → Obj}/common.ts +3 -4
- package/src/internal/{object/create.test.ts → Obj/create-object.test.ts} +31 -33
- package/src/internal/{object/create.ts → Obj/create-object.ts} +36 -37
- package/src/internal/Obj/deleted.ts +19 -0
- package/src/internal/{object → Obj}/ids.ts +1 -1
- package/src/internal/Obj/index.ts +14 -0
- package/src/internal/{object → Obj}/inspect.ts +5 -7
- package/src/internal/Obj/json-serializer.test.ts +121 -0
- package/src/internal/{object → Obj}/json-serializer.ts +99 -109
- 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 +281 -0
- package/src/internal/Obj/set-value.ts +165 -0
- package/src/internal/Obj/snapshot.ts +105 -0
- package/src/internal/{object → Obj}/typed-object.test.ts +12 -12
- package/src/internal/Obj/typed-object.ts +30 -0
- package/src/internal/{ref → Ref}/ref-array.ts +4 -4
- package/src/internal/{ref → Ref}/ref.test.ts +11 -10
- package/src/internal/{ref → Ref}/ref.ts +108 -57
- package/src/internal/{projection → Type}/compose.test.ts +8 -9
- package/src/internal/{projection → Type}/compose.ts +14 -9
- package/src/internal/{schema → Type}/echo-schema.ts +74 -33
- package/src/internal/Type/index.ts +7 -0
- package/src/internal/{schema → Type}/manipulation.ts +1 -1
- package/src/internal/Type/persistent-schema.ts +33 -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 +123 -0
- package/src/internal/common/proxy/index.ts +17 -0
- package/src/internal/common/proxy/json-serializer.ts +90 -0
- package/src/internal/common/proxy/make-object.ts +106 -0
- package/src/internal/common/proxy/ownership.ts +253 -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.ts +69 -0
- package/src/internal/{object → common/proxy}/schema-validator.ts +6 -3
- package/src/internal/{proxy → common/proxy}/schema.test.ts +31 -22
- 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 +449 -0
- package/src/internal/common/proxy/typed-object.test.ts +116 -0
- package/src/internal/common/types/base.ts +43 -0
- package/src/internal/common/types/entity.ts +54 -0
- package/src/internal/common/types/index.ts +10 -0
- package/src/internal/common/types/meta.ts +68 -0
- package/src/internal/common/types/model-symbols.ts +69 -0
- package/src/internal/common/types/typename.ts +55 -0
- package/src/internal/common/types/version.ts +19 -0
- package/src/internal/index.ts +11 -17
- package/src/testing/api.test.ts +126 -0
- package/src/testing/index.ts +3 -3
- package/src/testing/test-data.ts +130 -0
- package/src/testing/test-schema.ts +240 -0
- package/src/testing/util.ts +85 -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/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.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.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.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.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.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/deleted.ts +0 -19
- package/src/internal/object/entity.ts +0 -248
- package/src/internal/object/expando.ts +0 -21
- package/src/internal/object/index.ts +0 -19
- package/src/internal/object/json-serializer.test.ts +0 -99
- 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.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/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/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/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}/index.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}/ids.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/{schema → Type}/manipulation.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/{formats → Format}/index.ts +0 -0
- /package/src/internal/{json → JsonSchema}/effect-schema.test.ts +0 -0
- /package/src/internal/{ref → Ref}/index.ts +0 -0
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
import { describe, test } from 'vitest';
|
|
7
7
|
|
|
8
|
-
import { toJsonSchema } from '../
|
|
8
|
+
import { toJsonSchema } from '../JsonSchema';
|
|
9
9
|
|
|
10
10
|
import { Format } from './format';
|
|
11
|
-
import {
|
|
11
|
+
import { TypeEnum, TypeFormat, getTypeEnum } from './types';
|
|
12
12
|
|
|
13
13
|
describe('formats', () => {
|
|
14
14
|
test('annotations', ({ expect }) => {
|
|
@@ -20,7 +20,7 @@ describe('formats', () => {
|
|
|
20
20
|
birthday: Schema.optional(Format.Date),
|
|
21
21
|
started: Schema.optional(Format.DateTime),
|
|
22
22
|
active: Schema.optional(Schema.Boolean),
|
|
23
|
-
})
|
|
23
|
+
});
|
|
24
24
|
|
|
25
25
|
type TestType = Schema.Schema.Type<typeof TestSchema>;
|
|
26
26
|
|
|
@@ -48,7 +48,7 @@ describe('formats', () => {
|
|
|
48
48
|
expect(getTypeEnum(prop)).to.eq(TypeEnum.String);
|
|
49
49
|
expect(prop).includes({
|
|
50
50
|
type: TypeEnum.String,
|
|
51
|
-
format:
|
|
51
|
+
format: TypeFormat.Email,
|
|
52
52
|
title: 'Email',
|
|
53
53
|
});
|
|
54
54
|
}
|
|
@@ -58,7 +58,7 @@ describe('formats', () => {
|
|
|
58
58
|
expect(getTypeEnum(prop)).to.eq(TypeEnum.Number);
|
|
59
59
|
expect(prop).includes({
|
|
60
60
|
type: TypeEnum.Number,
|
|
61
|
-
format:
|
|
61
|
+
format: TypeFormat.Currency,
|
|
62
62
|
title: 'Currency',
|
|
63
63
|
multipleOf: 0.01,
|
|
64
64
|
currency: 'USD',
|
|
@@ -70,7 +70,7 @@ describe('formats', () => {
|
|
|
70
70
|
expect(getTypeEnum(prop)).to.eq(TypeEnum.String);
|
|
71
71
|
expect(prop).includes({
|
|
72
72
|
type: TypeEnum.String,
|
|
73
|
-
format:
|
|
73
|
+
format: TypeFormat.Date,
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
76
|
});
|
|
@@ -10,10 +10,10 @@ import * as DateUtil from './date';
|
|
|
10
10
|
import * as NumberUtil from './number';
|
|
11
11
|
import * as ObjectUtil from './object';
|
|
12
12
|
import * as StringUtil from './string';
|
|
13
|
+
import { TypeFormat as TypeFormat$ } from './types';
|
|
13
14
|
|
|
14
|
-
// TODO(burdon): Consider factoring out to separate `@dxos/json-schema`
|
|
15
15
|
// TODO(burdon): Media encoding.
|
|
16
|
-
//
|
|
16
|
+
// - https://json-schema.org/understanding-json-schema/reference/non_json_data
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Formats.
|
|
@@ -22,7 +22,9 @@ import * as StringUtil from './string';
|
|
|
22
22
|
*/
|
|
23
23
|
// TODO(burdon): Add fields for `examples`, `message`, etc.
|
|
24
24
|
export namespace Format {
|
|
25
|
-
|
|
25
|
+
export import TypeFormat = TypeFormat$;
|
|
26
|
+
|
|
27
|
+
// String
|
|
26
28
|
export const DXN = Keys.DXN.Schema;
|
|
27
29
|
export const Email = StringUtil.Email;
|
|
28
30
|
export const Formula = StringUtil.Formula;
|
|
@@ -41,12 +43,12 @@ export namespace Format {
|
|
|
41
43
|
export const Timestamp = NumberUtil.Timestamp;
|
|
42
44
|
|
|
43
45
|
// Dates and times
|
|
44
|
-
export const DateTime = DateUtil.DateTime;
|
|
45
46
|
export const Date = DateUtil.DateOnly;
|
|
46
|
-
export const
|
|
47
|
+
export const DateTime = DateUtil.DateTime;
|
|
47
48
|
export const Duration = DateUtil.Duration;
|
|
49
|
+
export const Time = DateUtil.TimeOnly;
|
|
48
50
|
|
|
49
51
|
// Objects
|
|
50
52
|
export const GeoPoint = ObjectUtil.GeoPoint;
|
|
51
|
-
export type GeoPoint = ObjectUtil.GeoPoint;
|
|
53
|
+
export type GeoPoint = ObjectUtil.GeoPoint; // TODO(burdon): Export types.
|
|
52
54
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import { FormatAnnotation,
|
|
7
|
+
import { FormatAnnotation, TypeFormat } from './types';
|
|
8
8
|
|
|
9
9
|
const encodeMultipleOf = (divisor: number) => 1 / Math.pow(10, divisor);
|
|
10
10
|
|
|
@@ -37,7 +37,7 @@ export type CurrencyAnnotation = {
|
|
|
37
37
|
export const Currency = ({ decimals, code }: CurrencyAnnotation = { decimals: 2 }) =>
|
|
38
38
|
Schema.Number.pipe(
|
|
39
39
|
encodeMultiple(decimals),
|
|
40
|
-
FormatAnnotation.set(
|
|
40
|
+
FormatAnnotation.set(TypeFormat.Currency),
|
|
41
41
|
Schema.annotations({
|
|
42
42
|
title: 'Currency',
|
|
43
43
|
description: 'Currency value',
|
|
@@ -55,7 +55,7 @@ export type PercentAnnotation = {
|
|
|
55
55
|
export const Integer = () =>
|
|
56
56
|
Schema.Number.pipe(
|
|
57
57
|
Schema.int(),
|
|
58
|
-
FormatAnnotation.set(
|
|
58
|
+
FormatAnnotation.set(TypeFormat.Integer),
|
|
59
59
|
Schema.annotations({
|
|
60
60
|
title: 'Integer',
|
|
61
61
|
description: 'Integer value',
|
|
@@ -69,7 +69,7 @@ export const Integer = () =>
|
|
|
69
69
|
export const Percent = ({ decimals }: PercentAnnotation = { decimals: 2 }) =>
|
|
70
70
|
Schema.Number.pipe(
|
|
71
71
|
encodeMultiple(decimals),
|
|
72
|
-
FormatAnnotation.set(
|
|
72
|
+
FormatAnnotation.set(TypeFormat.Percent),
|
|
73
73
|
Schema.annotations({
|
|
74
74
|
title: 'Percent',
|
|
75
75
|
description: 'Percentage value',
|
|
@@ -81,7 +81,7 @@ export const Percent = ({ decimals }: PercentAnnotation = { decimals: 2 }) =>
|
|
|
81
81
|
* https://en.wikipedia.org/wiki/Unix_time
|
|
82
82
|
*/
|
|
83
83
|
export const Timestamp = Schema.Number.pipe(
|
|
84
|
-
FormatAnnotation.set(
|
|
84
|
+
FormatAnnotation.set(TypeFormat.Timestamp),
|
|
85
85
|
Schema.annotations({
|
|
86
86
|
title: 'Timestamp',
|
|
87
87
|
description: 'Unix timestamp',
|
|
@@ -6,7 +6,7 @@ import * as Schema from 'effect/Schema';
|
|
|
6
6
|
|
|
7
7
|
import { clamp } from '@dxos/util';
|
|
8
8
|
|
|
9
|
-
import { FormatAnnotation,
|
|
9
|
+
import { FormatAnnotation, TypeFormat } from './types';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* GeoJSON Format
|
|
@@ -21,13 +21,13 @@ import { FormatAnnotation, FormatEnum } from './types';
|
|
|
21
21
|
* Note: optional third element for altitude.
|
|
22
22
|
*/
|
|
23
23
|
export const GeoPoint = Schema.Tuple(
|
|
24
|
-
Schema.Number.pipe(Schema.annotations({ title: 'Longitude' }), Schema.clamp(-180, 180), Schema.multipleOf(0.
|
|
25
|
-
Schema.Number.pipe(Schema.annotations({ title: 'Latitude' }), Schema.clamp(-90, 90), Schema.multipleOf(0.
|
|
24
|
+
Schema.Number.pipe(Schema.annotations({ title: 'Longitude' }), Schema.clamp(-180, 180), Schema.multipleOf(0.000001)),
|
|
25
|
+
Schema.Number.pipe(Schema.annotations({ title: 'Latitude' }), Schema.clamp(-90, 90), Schema.multipleOf(0.000001)),
|
|
26
26
|
Schema.optionalElement(Schema.Number).annotations({
|
|
27
27
|
title: 'Height ASL (m)',
|
|
28
28
|
}),
|
|
29
29
|
).pipe(
|
|
30
|
-
FormatAnnotation.set(
|
|
30
|
+
FormatAnnotation.set(TypeFormat.GeoPoint),
|
|
31
31
|
Schema.annotations({
|
|
32
32
|
title: 'GeoPoint',
|
|
33
33
|
description: 'GeoJSON Position',
|
|
@@ -4,13 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Schema for a single select option. Used to define choices in a {single|multi}-select field.
|
|
9
|
+
*/
|
|
10
|
+
export const SelectOption = Schema.Struct({
|
|
9
11
|
/** Stable identifier for the option. */
|
|
10
12
|
id: Schema.NonEmptyString,
|
|
11
13
|
title: Schema.String,
|
|
12
14
|
/** Color palette used for visual styling. */
|
|
13
15
|
color: Schema.String,
|
|
14
|
-
})
|
|
16
|
+
});
|
|
15
17
|
|
|
16
|
-
export type SelectOption = Schema.Schema.Type<typeof
|
|
18
|
+
export type SelectOption = Schema.Schema.Type<typeof SelectOption>;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
import * as SchemaAST from 'effect/SchemaAST';
|
|
7
7
|
|
|
8
|
-
import { FormatAnnotation,
|
|
8
|
+
import { FormatAnnotation, TypeFormat } from './types';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Email address (RFC 5321)
|
|
@@ -13,7 +13,7 @@ import { FormatAnnotation, FormatEnum } from './types';
|
|
|
13
13
|
*/
|
|
14
14
|
export const Email = Schema.String.pipe(
|
|
15
15
|
Schema.pattern(/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/),
|
|
16
|
-
FormatAnnotation.set(
|
|
16
|
+
FormatAnnotation.set(TypeFormat.Email),
|
|
17
17
|
Schema.annotations({
|
|
18
18
|
title: 'Email',
|
|
19
19
|
description: 'Email address',
|
|
@@ -24,25 +24,25 @@ export const Email = Schema.String.pipe(
|
|
|
24
24
|
*
|
|
25
25
|
*/
|
|
26
26
|
// TODO(burdon): Implement.
|
|
27
|
-
export const Formula = Schema.String.pipe(FormatAnnotation.set(
|
|
27
|
+
export const Formula = Schema.String.pipe(FormatAnnotation.set(TypeFormat.Formula));
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
*
|
|
31
31
|
*/
|
|
32
32
|
// TODO(burdon): Implement.
|
|
33
|
-
export const Hostname = Schema.String.pipe(FormatAnnotation.set(
|
|
33
|
+
export const Hostname = Schema.String.pipe(FormatAnnotation.set(TypeFormat.Hostname));
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
*
|
|
37
37
|
*/
|
|
38
38
|
// TODO(burdon): Implement.
|
|
39
|
-
export const JSON = Schema.String.pipe(FormatAnnotation.set(
|
|
39
|
+
export const JSON = Schema.String.pipe(FormatAnnotation.set(TypeFormat.JSON));
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
*
|
|
43
43
|
*/
|
|
44
44
|
// TODO(burdon): Implement.
|
|
45
|
-
export const Markdown = Schema.String.pipe(FormatAnnotation.set(
|
|
45
|
+
export const Markdown = Schema.String.pipe(FormatAnnotation.set(TypeFormat.Markdown));
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
48
|
* Regex
|
|
@@ -50,14 +50,19 @@ export const Markdown = Schema.String.pipe(FormatAnnotation.set(FormatEnum.Markd
|
|
|
50
50
|
* https://ecma-international.org/publications-and-standards/standards/ecma-262
|
|
51
51
|
*/
|
|
52
52
|
// TODO(burdon): Implement.
|
|
53
|
-
export const Regex = Schema.String.pipe(FormatAnnotation.set(
|
|
53
|
+
export const Regex = Schema.String.pipe(FormatAnnotation.set(TypeFormat.Regex));
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Multi-line text.
|
|
57
|
+
*/
|
|
58
|
+
export const Text = Schema.String.pipe(FormatAnnotation.set(TypeFormat.Text));
|
|
54
59
|
|
|
55
60
|
/**
|
|
56
61
|
* https://datatracker.ietf.org/doc/html/rfc3986#section-1.1.3
|
|
57
62
|
*/
|
|
58
63
|
export const URL = Schema.String.pipe(
|
|
59
64
|
Schema.pattern(/^(\w+?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)*\/?$/i),
|
|
60
|
-
FormatAnnotation.set(
|
|
65
|
+
FormatAnnotation.set(TypeFormat.URL),
|
|
61
66
|
Schema.annotations({
|
|
62
67
|
title: 'URL',
|
|
63
68
|
description: 'URL',
|
|
@@ -69,7 +74,7 @@ export const URL = Schema.String.pipe(
|
|
|
69
74
|
* https://datatracker.ietf.org/doc/html/rfc4122
|
|
70
75
|
*/
|
|
71
76
|
export const UUID = Schema.UUID.pipe(
|
|
72
|
-
FormatAnnotation.set(
|
|
77
|
+
FormatAnnotation.set(TypeFormat.UUID),
|
|
73
78
|
Schema.annotations({
|
|
74
79
|
[SchemaAST.ExamplesAnnotationId]: ['3e4666bf-d5e5-4aa7-b8ce-cefe41c7568a'],
|
|
75
80
|
}),
|
|
@@ -7,8 +7,8 @@ import type * as JSONSchema from 'effect/JSONSchema';
|
|
|
7
7
|
import * as Option from 'effect/Option';
|
|
8
8
|
import * as SchemaAST from 'effect/SchemaAST';
|
|
9
9
|
|
|
10
|
-
import { createAnnotationHelper } from '../
|
|
11
|
-
import { type JsonSchemaType } from '../
|
|
10
|
+
import { createAnnotationHelper } from '../Annotation';
|
|
11
|
+
import { type JsonSchemaType } from '../JsonSchema';
|
|
12
12
|
|
|
13
13
|
// TODO(burdon): Rename PropertyType.
|
|
14
14
|
export type ScalarType =
|
|
@@ -53,14 +53,20 @@ export const getTypeEnum = (property: JsonSchemaType): TypeEnum | undefined => {
|
|
|
53
53
|
*/
|
|
54
54
|
export const FormatAnnotationId = Symbol.for('@dxos/schema/annotation/Format');
|
|
55
55
|
|
|
56
|
-
export const FormatAnnotation = createAnnotationHelper<
|
|
56
|
+
export const FormatAnnotation = createAnnotationHelper<TypeFormat>(FormatAnnotationId);
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
/** @deprecated */
|
|
59
|
+
export const getFormatAnnotation = (node: SchemaAST.AST): TypeFormat | undefined =>
|
|
60
|
+
Function.pipe(SchemaAST.getAnnotation<TypeFormat>(FormatAnnotationId)(node), Option.getOrUndefined);
|
|
60
61
|
|
|
61
|
-
// TODO(burdon): Rename
|
|
62
|
-
export enum
|
|
62
|
+
// TODO(burdon): Rename Format; Change to discriminated union?
|
|
63
|
+
export enum TypeFormat {
|
|
63
64
|
None = 'none',
|
|
65
|
+
|
|
66
|
+
//
|
|
67
|
+
// Scalar
|
|
68
|
+
//
|
|
69
|
+
|
|
64
70
|
String = 'string',
|
|
65
71
|
Number = 'number',
|
|
66
72
|
Boolean = 'boolean',
|
|
@@ -79,6 +85,7 @@ export enum FormatEnum {
|
|
|
79
85
|
Markdown = 'markdown',
|
|
80
86
|
Regex = 'regex',
|
|
81
87
|
SingleSelect = 'single-select',
|
|
88
|
+
Text = 'text',
|
|
82
89
|
MultiSelect = 'multi-select',
|
|
83
90
|
URL = 'url',
|
|
84
91
|
UUID = 'uuid',
|
|
@@ -108,60 +115,61 @@ export enum FormatEnum {
|
|
|
108
115
|
GeoPoint = 'lnglat',
|
|
109
116
|
}
|
|
110
117
|
|
|
111
|
-
export const FormatEnums = Object.values(
|
|
118
|
+
export const FormatEnums = Object.values(TypeFormat).sort();
|
|
112
119
|
|
|
113
120
|
export const PropertyKind = {
|
|
114
121
|
type: TypeEnum,
|
|
115
|
-
format:
|
|
122
|
+
format: TypeFormat,
|
|
116
123
|
};
|
|
117
124
|
|
|
118
125
|
/**
|
|
119
126
|
* Default formats
|
|
120
127
|
*/
|
|
121
|
-
export const typeToFormat: Partial<Record<TypeEnum,
|
|
122
|
-
[TypeEnum.String]:
|
|
123
|
-
[TypeEnum.Number]:
|
|
124
|
-
[TypeEnum.Boolean]:
|
|
128
|
+
export const typeToFormat: Partial<Record<TypeEnum, TypeFormat>> = {
|
|
129
|
+
[TypeEnum.String]: TypeFormat.String,
|
|
130
|
+
[TypeEnum.Number]: TypeFormat.Number,
|
|
131
|
+
[TypeEnum.Boolean]: TypeFormat.Boolean,
|
|
125
132
|
};
|
|
126
133
|
|
|
127
134
|
/**
|
|
128
135
|
* Map of format to type.
|
|
129
136
|
*/
|
|
130
|
-
export const formatToType: Record<
|
|
131
|
-
[
|
|
132
|
-
[
|
|
133
|
-
[
|
|
134
|
-
[
|
|
135
|
-
[
|
|
137
|
+
export const formatToType: Record<TypeFormat, TypeEnum> = {
|
|
138
|
+
[TypeFormat.None]: TypeEnum.String,
|
|
139
|
+
[TypeFormat.String]: TypeEnum.String,
|
|
140
|
+
[TypeFormat.Number]: TypeEnum.Number,
|
|
141
|
+
[TypeFormat.Boolean]: TypeEnum.Boolean,
|
|
142
|
+
[TypeFormat.Ref]: TypeEnum.Ref,
|
|
136
143
|
|
|
137
144
|
// Strings
|
|
138
|
-
[
|
|
139
|
-
[
|
|
140
|
-
[
|
|
141
|
-
[
|
|
142
|
-
[
|
|
143
|
-
[
|
|
144
|
-
[
|
|
145
|
-
[
|
|
146
|
-
[
|
|
147
|
-
[
|
|
148
|
-
[
|
|
149
|
-
[
|
|
145
|
+
[TypeFormat.DID]: TypeEnum.String,
|
|
146
|
+
[TypeFormat.DXN]: TypeEnum.String,
|
|
147
|
+
[TypeFormat.Email]: TypeEnum.String,
|
|
148
|
+
[TypeFormat.Formula]: TypeEnum.String,
|
|
149
|
+
[TypeFormat.Hostname]: TypeEnum.String,
|
|
150
|
+
[TypeFormat.JSON]: TypeEnum.String,
|
|
151
|
+
[TypeFormat.Markdown]: TypeEnum.String,
|
|
152
|
+
[TypeFormat.Regex]: TypeEnum.String,
|
|
153
|
+
[TypeFormat.URL]: TypeEnum.String,
|
|
154
|
+
[TypeFormat.UUID]: TypeEnum.String,
|
|
155
|
+
[TypeFormat.SingleSelect]: TypeEnum.String,
|
|
156
|
+
[TypeFormat.Text]: TypeEnum.String,
|
|
157
|
+
[TypeFormat.MultiSelect]: TypeEnum.Object,
|
|
150
158
|
|
|
151
159
|
// Dates
|
|
152
|
-
[
|
|
153
|
-
[
|
|
154
|
-
[
|
|
155
|
-
[
|
|
160
|
+
[TypeFormat.Date]: TypeEnum.String,
|
|
161
|
+
[TypeFormat.DateTime]: TypeEnum.String,
|
|
162
|
+
[TypeFormat.Duration]: TypeEnum.String,
|
|
163
|
+
[TypeFormat.Time]: TypeEnum.String,
|
|
156
164
|
|
|
157
165
|
// Numbers
|
|
158
|
-
[
|
|
159
|
-
[
|
|
160
|
-
[
|
|
161
|
-
[
|
|
166
|
+
[TypeFormat.Currency]: TypeEnum.Number,
|
|
167
|
+
[TypeFormat.Integer]: TypeEnum.Number,
|
|
168
|
+
[TypeFormat.Percent]: TypeEnum.Number,
|
|
169
|
+
[TypeFormat.Timestamp]: TypeEnum.Number,
|
|
162
170
|
|
|
163
171
|
// Objects
|
|
164
|
-
[
|
|
172
|
+
[TypeFormat.GeoPoint]: TypeEnum.Array,
|
|
165
173
|
};
|
|
166
174
|
|
|
167
175
|
/**
|
|
@@ -169,7 +177,10 @@ export const formatToType: Record<FormatEnum, TypeEnum> = {
|
|
|
169
177
|
*/
|
|
170
178
|
export const OptionsAnnotationId = Symbol.for('@dxos/schema/annotation/Options');
|
|
171
179
|
|
|
172
|
-
|
|
173
|
-
|
|
180
|
+
// TODO(wittjosiah): Reconcile with `SelectOption`.
|
|
181
|
+
export type Options = string | number;
|
|
182
|
+
export const OptionsAnnotation = createAnnotationHelper<Options[]>(OptionsAnnotationId);
|
|
174
183
|
|
|
175
|
-
|
|
184
|
+
/** @deprecated */
|
|
185
|
+
export const getOptionsAnnotation = (node: SchemaAST.AST): Options[] | undefined =>
|
|
186
|
+
Function.pipe(SchemaAST.getAnnotation<Options[]>(OptionsAnnotationId)(node), Option.getOrUndefined);
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import * as SchemaAST from 'effect/SchemaAST';
|
|
6
6
|
|
|
7
|
-
import { GeneratorAnnotationId, LabelAnnotationId, PropertyMetaAnnotationId } from '../
|
|
8
|
-
import { CurrencyAnnotationId, FormatAnnotationId } from '../
|
|
9
|
-
import { type JsonSchemaEchoAnnotations, type JsonSchemaType } from '../
|
|
7
|
+
import { GeneratorAnnotationId, LabelAnnotationId, PropertyMetaAnnotationId } from '../Annotation';
|
|
8
|
+
import { CurrencyAnnotationId, FormatAnnotationId } from '../Format';
|
|
9
|
+
import { type JsonSchemaEchoAnnotations, type JsonSchemaType } from '../JsonSchema';
|
|
10
10
|
|
|
11
11
|
//
|
|
12
12
|
// This file configures annotations for JSON encoding/decoding.
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import type * as Types from 'effect/Types';
|
|
6
|
+
|
|
5
7
|
import { JsonSchemaFields, type JsonSchemaType } from './json-schema-type';
|
|
6
8
|
|
|
7
9
|
/**
|
|
@@ -9,12 +11,12 @@ import { JsonSchemaFields, type JsonSchemaType } from './json-schema-type';
|
|
|
9
11
|
* Note: the input type does not necessarily match the {@link JsonSchemaType} type.
|
|
10
12
|
*/
|
|
11
13
|
export const normalizeSchema = (schema: JsonSchemaType): JsonSchemaType => {
|
|
12
|
-
const copy = structuredClone(schema)
|
|
14
|
+
const copy = structuredClone(schema) as Types.DeepMutable<JsonSchemaType>;
|
|
13
15
|
go(copy);
|
|
14
16
|
return copy;
|
|
15
17
|
};
|
|
16
18
|
|
|
17
|
-
const go = (schema: JsonSchemaType) => {
|
|
19
|
+
const go = (schema: Types.DeepMutable<JsonSchemaType>) => {
|
|
18
20
|
if (typeof schema !== 'object' || schema === null) {
|
|
19
21
|
return;
|
|
20
22
|
}
|
|
@@ -6,8 +6,9 @@ import * as Schema from 'effect/Schema';
|
|
|
6
6
|
|
|
7
7
|
import { JsonPath, type JsonProp } from '@dxos/effect';
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { FormatAnnotation, TypeFormat } from '../Format';
|
|
10
|
+
import { type Mutable } from '../common/proxy';
|
|
11
|
+
import { EntityKindSchema } from '../common/types';
|
|
11
12
|
|
|
12
13
|
//
|
|
13
14
|
// JSON Schema
|
|
@@ -18,7 +19,7 @@ const SimpleTypes = Schema.Literal('array', 'boolean', 'integer', 'null', 'numbe
|
|
|
18
19
|
|
|
19
20
|
const NonNegativeInteger = Schema.Number.pipe(Schema.greaterThanOrEqualTo(0));
|
|
20
21
|
|
|
21
|
-
const StringArray = Schema.Array(Schema.String)
|
|
22
|
+
const StringArray = Schema.Array(Schema.String);
|
|
22
23
|
|
|
23
24
|
const JsonSchemaOrBoolean = Schema.Union(
|
|
24
25
|
Schema.suspend(() => JsonSchemaType),
|
|
@@ -48,13 +49,13 @@ export const JsonSchemaEchoAnnotations = Schema.Struct({
|
|
|
48
49
|
Schema.Record({
|
|
49
50
|
key: Schema.String,
|
|
50
51
|
value: Schema.Any,
|
|
51
|
-
})
|
|
52
|
+
}),
|
|
52
53
|
),
|
|
53
54
|
|
|
54
55
|
/**
|
|
55
56
|
* @deprecated
|
|
56
57
|
*/
|
|
57
|
-
// TODO(dmaretskyi): We risk old schema not passing validation due to the extra fields. Remove when we are sure this is safe
|
|
58
|
+
// TODO(dmaretskyi): We risk old schema not passing validation due to the extra fields. Remove when we are sure this is safe.
|
|
58
59
|
type: Schema.optional(
|
|
59
60
|
Schema.Struct({
|
|
60
61
|
typename: Schema.String,
|
|
@@ -62,7 +63,7 @@ export const JsonSchemaEchoAnnotations = Schema.Struct({
|
|
|
62
63
|
|
|
63
64
|
// Not used.
|
|
64
65
|
schemaId: Schema.optional(Schema.String),
|
|
65
|
-
})
|
|
66
|
+
}),
|
|
66
67
|
),
|
|
67
68
|
|
|
68
69
|
/**
|
|
@@ -72,9 +73,9 @@ export const JsonSchemaEchoAnnotations = Schema.Struct({
|
|
|
72
73
|
Schema.Record({
|
|
73
74
|
key: Schema.String,
|
|
74
75
|
value: Schema.Any,
|
|
75
|
-
})
|
|
76
|
+
}),
|
|
76
77
|
),
|
|
77
|
-
})
|
|
78
|
+
});
|
|
78
79
|
export type JsonSchemaEchoAnnotations = Schema.Schema.Type<typeof JsonSchemaEchoAnnotations>;
|
|
79
80
|
|
|
80
81
|
/**
|
|
@@ -118,7 +119,7 @@ const _JsonSchemaType = Schema.Struct({
|
|
|
118
119
|
* Typename of this schema.
|
|
119
120
|
* Only on schema representing an ECHO object.
|
|
120
121
|
*
|
|
121
|
-
* @example 'example.
|
|
122
|
+
* @example 'com.example.type.my-type'
|
|
122
123
|
*/
|
|
123
124
|
typename: Schema.optional(Schema.String),
|
|
124
125
|
|
|
@@ -206,7 +207,7 @@ const _JsonSchemaType = Schema.Struct({
|
|
|
206
207
|
/**
|
|
207
208
|
* Regex pattern for strings.
|
|
208
209
|
*/
|
|
209
|
-
pattern: Schema.optional(Schema.String.pipe(FormatAnnotation.set(
|
|
210
|
+
pattern: Schema.optional(Schema.String.pipe(FormatAnnotation.set(TypeFormat.Regex))),
|
|
210
211
|
|
|
211
212
|
/**
|
|
212
213
|
* Serialized from {@link FormatAnnotationId}.
|
|
@@ -257,23 +258,21 @@ const _JsonSchemaType = Schema.Struct({
|
|
|
257
258
|
Schema.Record({
|
|
258
259
|
key: Schema.String,
|
|
259
260
|
value: Schema.suspend(() => JsonSchemaType),
|
|
260
|
-
})
|
|
261
|
+
}),
|
|
261
262
|
),
|
|
262
263
|
patternProperties: Schema.optional(
|
|
263
264
|
Schema.Record({
|
|
264
265
|
key: Schema.String,
|
|
265
266
|
value: Schema.suspend(() => JsonSchemaType),
|
|
266
|
-
})
|
|
267
|
+
}),
|
|
267
268
|
),
|
|
268
269
|
propertyNames: Schema.optional(Schema.suspend(() => JsonSchemaType)),
|
|
269
270
|
|
|
270
271
|
definitions: Schema.optional(
|
|
271
|
-
Schema.
|
|
272
|
-
Schema.
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
}),
|
|
276
|
-
),
|
|
272
|
+
Schema.Record({
|
|
273
|
+
key: Schema.String,
|
|
274
|
+
value: Schema.suspend(() => JsonSchemaType),
|
|
275
|
+
}),
|
|
277
276
|
),
|
|
278
277
|
dependencies: Schema.optional(
|
|
279
278
|
Schema.Record({
|
|
@@ -296,12 +295,10 @@ const _JsonSchemaType = Schema.Struct({
|
|
|
296
295
|
oneOf: Schema.optional(Schema.Array(Schema.suspend(() => JsonSchemaType))),
|
|
297
296
|
not: Schema.optional(Schema.suspend(() => JsonSchemaType)),
|
|
298
297
|
$defs: Schema.optional(
|
|
299
|
-
Schema.
|
|
300
|
-
Schema.
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
}),
|
|
304
|
-
),
|
|
298
|
+
Schema.Record({
|
|
299
|
+
key: Schema.String,
|
|
300
|
+
value: Schema.suspend(() => JsonSchemaType),
|
|
301
|
+
}),
|
|
305
302
|
),
|
|
306
303
|
|
|
307
304
|
//
|
|
@@ -311,25 +308,23 @@ const _JsonSchemaType = Schema.Struct({
|
|
|
311
308
|
currency: Schema.optional(Schema.String),
|
|
312
309
|
|
|
313
310
|
reference: Schema.optional(
|
|
314
|
-
Schema.
|
|
315
|
-
Schema.
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
}),
|
|
320
|
-
),
|
|
311
|
+
Schema.Struct({
|
|
312
|
+
schema: Schema.suspend(() => JsonSchemaType),
|
|
313
|
+
schemaVersion: Schema.optional(Schema.String),
|
|
314
|
+
schemaObject: Schema.optional(Schema.String),
|
|
315
|
+
}),
|
|
321
316
|
),
|
|
322
317
|
|
|
323
318
|
/**
|
|
324
319
|
* ECHO-specific annotations.
|
|
325
320
|
*/
|
|
326
321
|
// TODO(dmaretskyi): Since we are adding a lot of new extensions to the JSON Schema, it is safer to namespace them here.
|
|
327
|
-
annotations: Schema.optional(
|
|
322
|
+
annotations: Schema.optional(JsonSchemaEchoAnnotations),
|
|
328
323
|
|
|
329
324
|
/**
|
|
330
325
|
* @deprecated Use `annotations` instead.
|
|
331
326
|
*/
|
|
332
|
-
echo: Schema.optional(
|
|
327
|
+
echo: Schema.optional(JsonSchemaEchoAnnotations),
|
|
333
328
|
}).annotations({ identifier: 'jsonSchema', description: 'JSON Schema' });
|
|
334
329
|
|
|
335
330
|
export const JsonSchemaFields = Object.keys(_JsonSchemaType.fields);
|
|
@@ -337,9 +332,10 @@ export const JsonSchemaFields = Object.keys(_JsonSchemaType.fields);
|
|
|
337
332
|
/**
|
|
338
333
|
* https://json-schema.org/draft-07/schema
|
|
339
334
|
*/
|
|
340
|
-
|
|
335
|
+
// TODO(burdon): Reconcile with @effect/Schema/JSONSchema
|
|
336
|
+
export interface JsonSchemaType extends Schema.Schema.Type<typeof _JsonSchemaType> {}
|
|
341
337
|
|
|
342
|
-
export const JsonSchemaType: Schema.Schema<JsonSchemaType> = _JsonSchemaType
|
|
338
|
+
export const JsonSchemaType: Schema.Schema<JsonSchemaType> = _JsonSchemaType;
|
|
343
339
|
|
|
344
340
|
// TODO(burdon): Factor out JSON schema utils.
|
|
345
341
|
|
|
@@ -348,7 +344,11 @@ export const getSchemaProperty = (schema: JsonSchemaType, property: JsonProp): J
|
|
|
348
344
|
};
|
|
349
345
|
|
|
350
346
|
// TODO(burdon): Properties should be ordered.
|
|
351
|
-
export const setSchemaProperty = (
|
|
347
|
+
export const setSchemaProperty = (
|
|
348
|
+
schema: Mutable<JsonSchemaType>,
|
|
349
|
+
property: JsonProp,
|
|
350
|
+
value: Mutable<JsonSchemaType>,
|
|
351
|
+
) => {
|
|
352
352
|
schema.properties ??= {};
|
|
353
353
|
schema.properties[property] = value;
|
|
354
354
|
return schema;
|