@blade-hq/agent-client 1.1.1 → 1.1.2
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 +48 -25
- package/dist/blade-client.d.ts +2 -14
- package/dist/index.d.ts +5 -2
- package/dist/index.js +212 -106
- package/dist/index.js.map +1 -1
- package/dist/resources/models.d.ts +15 -0
- package/dist/resources/sessions.d.ts +8 -1
- package/dist/session/agent-session.d.ts +10 -0
- package/dist/session/definition.d.ts +49 -0
- package/dist/shared/projection/helpers.d.ts +1 -1
- package/dist/types/rest.d.ts +378 -10
- package/dist/version.d.ts +4 -42
- package/node_modules/@ark/schema/LICENSE +7 -0
- package/node_modules/@ark/schema/README.md +18 -0
- package/node_modules/@ark/schema/out/config.d.ts +58 -0
- package/node_modules/@ark/schema/out/config.js +95 -0
- package/node_modules/@ark/schema/out/constraint.d.ts +67 -0
- package/node_modules/@ark/schema/out/constraint.js +136 -0
- package/node_modules/@ark/schema/out/generic.d.ts +73 -0
- package/node_modules/@ark/schema/out/generic.js +76 -0
- package/node_modules/@ark/schema/out/index.d.ts +47 -0
- package/node_modules/@ark/schema/out/index.js +47 -0
- package/node_modules/@ark/schema/out/intrinsic.d.ts +24 -0
- package/node_modules/@ark/schema/out/intrinsic.js +56 -0
- package/node_modules/@ark/schema/out/kinds.d.ts +73 -0
- package/node_modules/@ark/schema/out/kinds.js +71 -0
- package/node_modules/@ark/schema/out/module.d.ts +24 -0
- package/node_modules/@ark/schema/out/module.js +15 -0
- package/node_modules/@ark/schema/out/node.d.ts +154 -0
- package/node_modules/@ark/schema/out/node.js +438 -0
- package/node_modules/@ark/schema/out/parse.d.ts +52 -0
- package/node_modules/@ark/schema/out/parse.js +215 -0
- package/node_modules/@ark/schema/out/predicate.d.ts +52 -0
- package/node_modules/@ark/schema/out/predicate.js +63 -0
- package/node_modules/@ark/schema/out/refinements/after.d.ts +41 -0
- package/node_modules/@ark/schema/out/refinements/after.js +35 -0
- package/node_modules/@ark/schema/out/refinements/before.d.ts +41 -0
- package/node_modules/@ark/schema/out/refinements/before.js +41 -0
- package/node_modules/@ark/schema/out/refinements/divisor.d.ts +43 -0
- package/node_modules/@ark/schema/out/refinements/divisor.js +58 -0
- package/node_modules/@ark/schema/out/refinements/exactLength.d.ts +49 -0
- package/node_modules/@ark/schema/out/refinements/exactLength.js +55 -0
- package/node_modules/@ark/schema/out/refinements/kinds.d.ts +34 -0
- package/node_modules/@ark/schema/out/refinements/kinds.js +25 -0
- package/node_modules/@ark/schema/out/refinements/max.d.ts +37 -0
- package/node_modules/@ark/schema/out/refinements/max.js +45 -0
- package/node_modules/@ark/schema/out/refinements/maxLength.d.ts +40 -0
- package/node_modules/@ark/schema/out/refinements/maxLength.js +49 -0
- package/node_modules/@ark/schema/out/refinements/min.d.ts +37 -0
- package/node_modules/@ark/schema/out/refinements/min.js +39 -0
- package/node_modules/@ark/schema/out/refinements/minLength.d.ts +40 -0
- package/node_modules/@ark/schema/out/refinements/minLength.js +47 -0
- package/node_modules/@ark/schema/out/refinements/pattern.d.ts +43 -0
- package/node_modules/@ark/schema/out/refinements/pattern.js +52 -0
- package/node_modules/@ark/schema/out/refinements/range.d.ts +106 -0
- package/node_modules/@ark/schema/out/refinements/range.js +103 -0
- package/node_modules/@ark/schema/out/roots/alias.d.ts +45 -0
- package/node_modules/@ark/schema/out/roots/alias.js +115 -0
- package/node_modules/@ark/schema/out/roots/basis.d.ts +12 -0
- package/node_modules/@ark/schema/out/roots/basis.js +26 -0
- package/node_modules/@ark/schema/out/roots/domain.d.ts +45 -0
- package/node_modules/@ark/schema/out/roots/domain.js +72 -0
- package/node_modules/@ark/schema/out/roots/intersection.d.ts +98 -0
- package/node_modules/@ark/schema/out/roots/intersection.js +292 -0
- package/node_modules/@ark/schema/out/roots/morph.d.ts +62 -0
- package/node_modules/@ark/schema/out/roots/morph.js +159 -0
- package/node_modules/@ark/schema/out/roots/proto.d.ts +53 -0
- package/node_modules/@ark/schema/out/roots/proto.js +101 -0
- package/node_modules/@ark/schema/out/roots/root.d.ts +145 -0
- package/node_modules/@ark/schema/out/roots/root.js +455 -0
- package/node_modules/@ark/schema/out/roots/union.d.ts +99 -0
- package/node_modules/@ark/schema/out/roots/union.js +718 -0
- package/node_modules/@ark/schema/out/roots/unit.d.ts +41 -0
- package/node_modules/@ark/schema/out/roots/unit.js +86 -0
- package/node_modules/@ark/schema/out/roots/utils.d.ts +3 -0
- package/node_modules/@ark/schema/out/roots/utils.js +6 -0
- package/node_modules/@ark/schema/out/scope.d.ts +158 -0
- package/node_modules/@ark/schema/out/scope.js +481 -0
- package/node_modules/@ark/schema/out/shared/compile.d.ts +62 -0
- package/node_modules/@ark/schema/out/shared/compile.js +145 -0
- package/node_modules/@ark/schema/out/shared/declare.d.ts +80 -0
- package/node_modules/@ark/schema/out/shared/declare.js +1 -0
- package/node_modules/@ark/schema/out/shared/disjoint.d.ts +41 -0
- package/node_modules/@ark/schema/out/shared/disjoint.js +65 -0
- package/node_modules/@ark/schema/out/shared/errors.d.ts +145 -0
- package/node_modules/@ark/schema/out/shared/errors.js +252 -0
- package/node_modules/@ark/schema/out/shared/implement.d.ts +151 -0
- package/node_modules/@ark/schema/out/shared/implement.js +98 -0
- package/node_modules/@ark/schema/out/shared/intersections.d.ts +10 -0
- package/node_modules/@ark/schema/out/shared/intersections.js +132 -0
- package/node_modules/@ark/schema/out/shared/jsonSchema.d.ts +93 -0
- package/node_modules/@ark/schema/out/shared/jsonSchema.js +1 -0
- package/node_modules/@ark/schema/out/shared/registry.d.ts +7 -0
- package/node_modules/@ark/schema/out/shared/registry.js +10 -0
- package/node_modules/@ark/schema/out/shared/standardSchema.d.ts +122 -0
- package/node_modules/@ark/schema/out/shared/standardSchema.js +2 -0
- package/node_modules/@ark/schema/out/shared/toJsonSchema.d.ts +139 -0
- package/node_modules/@ark/schema/out/shared/toJsonSchema.js +40 -0
- package/node_modules/@ark/schema/out/shared/traversal.d.ts +117 -0
- package/node_modules/@ark/schema/out/shared/traversal.js +226 -0
- package/node_modules/@ark/schema/out/shared/utils.d.ts +34 -0
- package/node_modules/@ark/schema/out/shared/utils.js +8 -0
- package/node_modules/@ark/schema/out/structure/index.d.ts +46 -0
- package/node_modules/@ark/schema/out/structure/index.js +89 -0
- package/node_modules/@ark/schema/out/structure/optional.d.ts +49 -0
- package/node_modules/@ark/schema/out/structure/optional.js +127 -0
- package/node_modules/@ark/schema/out/structure/prop.d.ts +45 -0
- package/node_modules/@ark/schema/out/structure/prop.js +85 -0
- package/node_modules/@ark/schema/out/structure/required.d.ts +39 -0
- package/node_modules/@ark/schema/out/structure/required.js +38 -0
- package/node_modules/@ark/schema/out/structure/sequence.d.ts +110 -0
- package/node_modules/@ark/schema/out/structure/sequence.js +521 -0
- package/node_modules/@ark/schema/out/structure/shared.d.ts +4 -0
- package/node_modules/@ark/schema/out/structure/shared.js +4 -0
- package/node_modules/@ark/schema/out/structure/structure.d.ts +113 -0
- package/node_modules/@ark/schema/out/structure/structure.js +747 -0
- package/node_modules/@ark/schema/package.json +51 -0
- package/node_modules/@ark/util/LICENSE +7 -0
- package/node_modules/@ark/util/out/arrays.d.ts +166 -0
- package/node_modules/@ark/util/out/arrays.js +147 -0
- package/node_modules/@ark/util/out/clone.d.ts +4 -0
- package/node_modules/@ark/util/out/clone.js +33 -0
- package/node_modules/@ark/util/out/describe.d.ts +25 -0
- package/node_modules/@ark/util/out/describe.js +1 -0
- package/node_modules/@ark/util/out/domain.d.ts +48 -0
- package/node_modules/@ark/util/out/domain.js +25 -0
- package/node_modules/@ark/util/out/errors.d.ts +29 -0
- package/node_modules/@ark/util/out/errors.js +17 -0
- package/node_modules/@ark/util/out/flatMorph.d.ts +41 -0
- package/node_modules/@ark/util/out/flatMorph.js +24 -0
- package/node_modules/@ark/util/out/functions.d.ts +33 -0
- package/node_modules/@ark/util/out/functions.js +53 -0
- package/node_modules/@ark/util/out/generics.d.ts +59 -0
- package/node_modules/@ark/util/out/generics.js +5 -0
- package/node_modules/@ark/util/out/get.d.ts +9 -0
- package/node_modules/@ark/util/out/get.js +7 -0
- package/node_modules/@ark/util/out/hkt.d.ts +27 -0
- package/node_modules/@ark/util/out/hkt.js +5 -0
- package/node_modules/@ark/util/out/index.d.ts +24 -0
- package/node_modules/@ark/util/out/index.js +24 -0
- package/node_modules/@ark/util/out/intersections.d.ts +50 -0
- package/node_modules/@ark/util/out/intersections.js +1 -0
- package/node_modules/@ark/util/out/isomorphic.d.ts +5 -0
- package/node_modules/@ark/util/out/isomorphic.js +19 -0
- package/node_modules/@ark/util/out/keys.d.ts +18 -0
- package/node_modules/@ark/util/out/keys.js +1 -0
- package/node_modules/@ark/util/out/lazily.d.ts +1 -0
- package/node_modules/@ark/util/out/lazily.js +16 -0
- package/node_modules/@ark/util/out/numbers.d.ts +72 -0
- package/node_modules/@ark/util/out/numbers.js +138 -0
- package/node_modules/@ark/util/out/objectKinds.d.ts +205 -0
- package/node_modules/@ark/util/out/objectKinds.js +150 -0
- package/node_modules/@ark/util/out/path.d.ts +22 -0
- package/node_modules/@ark/util/out/path.js +65 -0
- package/node_modules/@ark/util/out/primitive.d.ts +16 -0
- package/node_modules/@ark/util/out/primitive.js +3 -0
- package/node_modules/@ark/util/out/records.d.ts +183 -0
- package/node_modules/@ark/util/out/records.js +63 -0
- package/node_modules/@ark/util/out/registry.d.ts +21 -0
- package/node_modules/@ark/util/out/registry.js +49 -0
- package/node_modules/@ark/util/out/scanner.d.ts +44 -0
- package/node_modules/@ark/util/out/scanner.js +87 -0
- package/node_modules/@ark/util/out/serialize.d.ts +34 -0
- package/node_modules/@ark/util/out/serialize.js +150 -0
- package/node_modules/@ark/util/out/strings.d.ts +33 -0
- package/node_modules/@ark/util/out/strings.js +59 -0
- package/node_modules/@ark/util/out/traits.d.ts +89 -0
- package/node_modules/@ark/util/out/traits.js +75 -0
- package/node_modules/@ark/util/out/unionToTuple.d.ts +14 -0
- package/node_modules/@ark/util/out/unionToTuple.js +1 -0
- package/node_modules/@ark/util/package.json +39 -0
- package/node_modules/@ark/util/tsconfig.base.json +18 -0
- package/node_modules/@socket.io/component-emitter/LICENSE +24 -0
- package/node_modules/@socket.io/component-emitter/Readme.md +79 -0
- package/node_modules/@socket.io/component-emitter/lib/cjs/index.d.ts +179 -0
- package/node_modules/@socket.io/component-emitter/lib/cjs/index.js +176 -0
- package/node_modules/@socket.io/component-emitter/lib/cjs/package.json +4 -0
- package/node_modules/@socket.io/component-emitter/lib/esm/index.d.ts +179 -0
- package/node_modules/@socket.io/component-emitter/lib/esm/index.js +169 -0
- package/node_modules/@socket.io/component-emitter/lib/esm/package.json +4 -0
- package/node_modules/@socket.io/component-emitter/package.json +28 -0
- package/node_modules/arkregex/LICENSE +7 -0
- package/node_modules/arkregex/README.md +61 -0
- package/node_modules/arkregex/out/charset.d.ts +15 -0
- package/node_modules/arkregex/out/charset.js +1 -0
- package/node_modules/arkregex/out/escape.d.ts +29 -0
- package/node_modules/arkregex/out/escape.js +10 -0
- package/node_modules/arkregex/out/execArray.d.ts +23 -0
- package/node_modules/arkregex/out/execArray.js +1 -0
- package/node_modules/arkregex/out/group.d.ts +33 -0
- package/node_modules/arkregex/out/group.js +6 -0
- package/node_modules/arkregex/out/index.d.ts +1 -0
- package/node_modules/arkregex/out/index.js +1 -0
- package/node_modules/arkregex/out/parse.d.ts +10 -0
- package/node_modules/arkregex/out/parse.js +1 -0
- package/node_modules/arkregex/out/quantify.d.ts +43 -0
- package/node_modules/arkregex/out/quantify.js +2 -0
- package/node_modules/arkregex/out/regex.d.ts +38 -0
- package/node_modules/arkregex/out/regex.js +2 -0
- package/node_modules/arkregex/out/state.d.ts +359 -0
- package/node_modules/arkregex/out/state.js +2 -0
- package/node_modules/arkregex/package.json +42 -0
- package/node_modules/arktype/LICENSE +7 -0
- package/node_modules/arktype/README.md +157 -0
- package/node_modules/arktype/out/attributes.d.ts +104 -0
- package/node_modules/arktype/out/attributes.js +3 -0
- package/node_modules/arktype/out/config.d.ts +35 -0
- package/node_modules/arktype/out/config.js +3 -0
- package/node_modules/arktype/out/declare.d.ts +35 -0
- package/node_modules/arktype/out/declare.js +1 -0
- package/node_modules/arktype/out/fn.d.ts +61 -0
- package/node_modules/arktype/out/fn.js +54 -0
- package/node_modules/arktype/out/generic.d.ts +118 -0
- package/node_modules/arktype/out/generic.js +37 -0
- package/node_modules/arktype/out/index.d.ts +12 -0
- package/node_modules/arktype/out/index.js +9 -0
- package/node_modules/arktype/out/keywords/Array.d.ts +20 -0
- package/node_modules/arktype/out/keywords/Array.js +21 -0
- package/node_modules/arktype/out/keywords/FormData.d.ts +15 -0
- package/node_modules/arktype/out/keywords/FormData.js +40 -0
- package/node_modules/arktype/out/keywords/TypedArray.d.ts +19 -0
- package/node_modules/arktype/out/keywords/TypedArray.js +16 -0
- package/node_modules/arktype/out/keywords/builtins.d.ts +18 -0
- package/node_modules/arktype/out/keywords/builtins.js +11 -0
- package/node_modules/arktype/out/keywords/constructors.d.ts +31 -0
- package/node_modules/arktype/out/keywords/constructors.js +16 -0
- package/node_modules/arktype/out/keywords/keywords.d.ts +70 -0
- package/node_modules/arktype/out/keywords/keywords.js +48 -0
- package/node_modules/arktype/out/keywords/number.d.ts +23 -0
- package/node_modules/arktype/out/keywords/number.js +49 -0
- package/node_modules/arktype/out/keywords/string.d.ts +334 -0
- package/node_modules/arktype/out/keywords/string.js +463 -0
- package/node_modules/arktype/out/keywords/ts.d.ts +108 -0
- package/node_modules/arktype/out/keywords/ts.js +82 -0
- package/node_modules/arktype/out/match.d.ts +152 -0
- package/node_modules/arktype/out/match.js +95 -0
- package/node_modules/arktype/out/module.d.ts +22 -0
- package/node_modules/arktype/out/module.js +3 -0
- package/node_modules/arktype/out/nary.d.ts +473 -0
- package/node_modules/arktype/out/nary.js +1 -0
- package/node_modules/arktype/out/parser/ast/bounds.d.ts +18 -0
- package/node_modules/arktype/out/parser/ast/bounds.js +1 -0
- package/node_modules/arktype/out/parser/ast/default.d.ts +8 -0
- package/node_modules/arktype/out/parser/ast/default.js +1 -0
- package/node_modules/arktype/out/parser/ast/divisor.d.ts +9 -0
- package/node_modules/arktype/out/parser/ast/divisor.js +1 -0
- package/node_modules/arktype/out/parser/ast/generic.d.ts +17 -0
- package/node_modules/arktype/out/parser/ast/generic.js +1 -0
- package/node_modules/arktype/out/parser/ast/infer.d.ts +25 -0
- package/node_modules/arktype/out/parser/ast/infer.js +1 -0
- package/node_modules/arktype/out/parser/ast/keyof.d.ts +7 -0
- package/node_modules/arktype/out/parser/ast/keyof.js +1 -0
- package/node_modules/arktype/out/parser/ast/utils.d.ts +8 -0
- package/node_modules/arktype/out/parser/ast/utils.js +1 -0
- package/node_modules/arktype/out/parser/ast/validate.d.ts +30 -0
- package/node_modules/arktype/out/parser/ast/validate.js +3 -0
- package/node_modules/arktype/out/parser/definition.d.ts +30 -0
- package/node_modules/arktype/out/parser/definition.js +74 -0
- package/node_modules/arktype/out/parser/objectLiteral.d.ts +70 -0
- package/node_modules/arktype/out/parser/objectLiteral.js +113 -0
- package/node_modules/arktype/out/parser/property.d.ts +34 -0
- package/node_modules/arktype/out/parser/property.js +16 -0
- package/node_modules/arktype/out/parser/reduce/dynamic.d.ts +42 -0
- package/node_modules/arktype/out/parser/reduce/dynamic.js +153 -0
- package/node_modules/arktype/out/parser/reduce/shared.d.ts +39 -0
- package/node_modules/arktype/out/parser/reduce/shared.js +25 -0
- package/node_modules/arktype/out/parser/reduce/static.d.ts +186 -0
- package/node_modules/arktype/out/parser/reduce/static.js +1 -0
- package/node_modules/arktype/out/parser/shift/operand/date.d.ts +11 -0
- package/node_modules/arktype/out/parser/shift/operand/date.js +23 -0
- package/node_modules/arktype/out/parser/shift/operand/enclosed.d.ts +57 -0
- package/node_modules/arktype/out/parser/shift/operand/enclosed.js +78 -0
- package/node_modules/arktype/out/parser/shift/operand/genericArgs.d.ts +27 -0
- package/node_modules/arktype/out/parser/shift/operand/genericArgs.js +16 -0
- package/node_modules/arktype/out/parser/shift/operand/operand.d.ts +8 -0
- package/node_modules/arktype/out/parser/shift/operand/operand.js +16 -0
- package/node_modules/arktype/out/parser/shift/operand/unenclosed.d.ts +43 -0
- package/node_modules/arktype/out/parser/shift/operand/unenclosed.js +59 -0
- package/node_modules/arktype/out/parser/shift/operator/bounds.d.ts +24 -0
- package/node_modules/arktype/out/parser/shift/operator/bounds.js +91 -0
- package/node_modules/arktype/out/parser/shift/operator/brand.d.ts +7 -0
- package/node_modules/arktype/out/parser/shift/operator/brand.js +6 -0
- package/node_modules/arktype/out/parser/shift/operator/default.d.ts +24 -0
- package/node_modules/arktype/out/parser/shift/operator/default.js +15 -0
- package/node_modules/arktype/out/parser/shift/operator/divisor.d.ts +8 -0
- package/node_modules/arktype/out/parser/shift/operator/divisor.js +13 -0
- package/node_modules/arktype/out/parser/shift/operator/operator.d.ts +14 -0
- package/node_modules/arktype/out/parser/shift/operator/operator.js +28 -0
- package/node_modules/arktype/out/parser/shift/tokens.d.ts +33 -0
- package/node_modules/arktype/out/parser/shift/tokens.js +37 -0
- package/node_modules/arktype/out/parser/string.d.ts +30 -0
- package/node_modules/arktype/out/parser/string.js +42 -0
- package/node_modules/arktype/out/parser/tupleExpressions.d.ts +79 -0
- package/node_modules/arktype/out/parser/tupleExpressions.js +75 -0
- package/node_modules/arktype/out/parser/tupleLiteral.d.ts +95 -0
- package/node_modules/arktype/out/parser/tupleLiteral.js +128 -0
- package/node_modules/arktype/out/scope.d.ts +158 -0
- package/node_modules/arktype/out/scope.js +106 -0
- package/node_modules/arktype/out/type.d.ts +144 -0
- package/node_modules/arktype/out/type.js +55 -0
- package/node_modules/arktype/out/variants/array.d.ts +12 -0
- package/node_modules/arktype/out/variants/array.js +1 -0
- package/node_modules/arktype/out/variants/base.d.ts +542 -0
- package/node_modules/arktype/out/variants/base.js +1 -0
- package/node_modules/arktype/out/variants/date.d.ts +10 -0
- package/node_modules/arktype/out/variants/date.js +1 -0
- package/node_modules/arktype/out/variants/instantiate.d.ts +12 -0
- package/node_modules/arktype/out/variants/instantiate.js +1 -0
- package/node_modules/arktype/out/variants/number.d.ts +11 -0
- package/node_modules/arktype/out/variants/number.js +1 -0
- package/node_modules/arktype/out/variants/object.d.ts +107 -0
- package/node_modules/arktype/out/variants/object.js +1 -0
- package/node_modules/arktype/out/variants/string.d.ts +15 -0
- package/node_modules/arktype/out/variants/string.js +1 -0
- package/node_modules/arktype/package.json +57 -0
- package/node_modules/debug/LICENSE +20 -0
- package/node_modules/debug/README.md +481 -0
- package/node_modules/debug/package.json +64 -0
- package/node_modules/debug/src/browser.js +272 -0
- package/node_modules/debug/src/common.js +292 -0
- package/node_modules/debug/src/index.js +10 -0
- package/node_modules/debug/src/node.js +263 -0
- package/node_modules/engine.io-client/LICENSE +22 -0
- package/node_modules/engine.io-client/README.md +331 -0
- package/node_modules/engine.io-client/build/cjs/browser-entrypoint.d.ts +3 -0
- package/node_modules/engine.io-client/build/cjs/browser-entrypoint.js +4 -0
- package/node_modules/engine.io-client/build/cjs/contrib/has-cors.d.ts +1 -0
- package/node_modules/engine.io-client/build/cjs/contrib/has-cors.js +14 -0
- package/node_modules/engine.io-client/build/cjs/contrib/parseqs.d.ts +15 -0
- package/node_modules/engine.io-client/build/cjs/contrib/parseqs.js +38 -0
- package/node_modules/engine.io-client/build/cjs/contrib/parseuri.d.ts +1 -0
- package/node_modules/engine.io-client/build/cjs/contrib/parseuri.js +67 -0
- package/node_modules/engine.io-client/build/cjs/globals.d.ts +4 -0
- package/node_modules/engine.io-client/build/cjs/globals.js +26 -0
- package/node_modules/engine.io-client/build/cjs/globals.node.d.ts +21 -0
- package/node_modules/engine.io-client/build/cjs/globals.node.js +97 -0
- package/node_modules/engine.io-client/build/cjs/index.d.ts +15 -0
- package/node_modules/engine.io-client/build/cjs/index.js +32 -0
- package/node_modules/engine.io-client/build/cjs/package.json +10 -0
- package/node_modules/engine.io-client/build/cjs/socket.d.ts +482 -0
- package/node_modules/engine.io-client/build/cjs/socket.js +765 -0
- package/node_modules/engine.io-client/build/cjs/transport.d.ts +106 -0
- package/node_modules/engine.io-client/build/cjs/transport.js +153 -0
- package/node_modules/engine.io-client/build/cjs/transports/index.d.ts +8 -0
- package/node_modules/engine.io-client/build/cjs/transports/index.js +11 -0
- package/node_modules/engine.io-client/build/cjs/transports/polling-fetch.d.ts +15 -0
- package/node_modules/engine.io-client/build/cjs/transports/polling-fetch.js +60 -0
- package/node_modules/engine.io-client/build/cjs/transports/polling-xhr.d.ts +108 -0
- package/node_modules/engine.io-client/build/cjs/transports/polling-xhr.js +285 -0
- package/node_modules/engine.io-client/build/cjs/transports/polling-xhr.node.d.ts +11 -0
- package/node_modules/engine.io-client/build/cjs/transports/polling-xhr.node.js +44 -0
- package/node_modules/engine.io-client/build/cjs/transports/polling.d.ts +52 -0
- package/node_modules/engine.io-client/build/cjs/transports/polling.js +165 -0
- package/node_modules/engine.io-client/build/cjs/transports/websocket.d.ts +36 -0
- package/node_modules/engine.io-client/build/cjs/transports/websocket.js +136 -0
- package/node_modules/engine.io-client/build/cjs/transports/websocket.node.d.ts +14 -0
- package/node_modules/engine.io-client/build/cjs/transports/websocket.node.js +68 -0
- package/node_modules/engine.io-client/build/cjs/transports/webtransport.d.ts +18 -0
- package/node_modules/engine.io-client/build/cjs/transports/webtransport.js +94 -0
- package/node_modules/engine.io-client/build/cjs/util.d.ts +7 -0
- package/node_modules/engine.io-client/build/cjs/util.js +65 -0
- package/node_modules/engine.io-client/build/esm/browser-entrypoint.d.ts +3 -0
- package/node_modules/engine.io-client/build/esm/browser-entrypoint.js +2 -0
- package/node_modules/engine.io-client/build/esm/contrib/has-cors.d.ts +1 -0
- package/node_modules/engine.io-client/build/esm/contrib/has-cors.js +11 -0
- package/node_modules/engine.io-client/build/esm/contrib/parseqs.d.ts +15 -0
- package/node_modules/engine.io-client/build/esm/contrib/parseqs.js +34 -0
- package/node_modules/engine.io-client/build/esm/contrib/parseuri.d.ts +1 -0
- package/node_modules/engine.io-client/build/esm/contrib/parseuri.js +64 -0
- package/node_modules/engine.io-client/build/esm/globals.d.ts +4 -0
- package/node_modules/engine.io-client/build/esm/globals.js +22 -0
- package/node_modules/engine.io-client/build/esm/globals.node.d.ts +21 -0
- package/node_modules/engine.io-client/build/esm/globals.node.js +91 -0
- package/node_modules/engine.io-client/build/esm/index.d.ts +15 -0
- package/node_modules/engine.io-client/build/esm/index.js +15 -0
- package/node_modules/engine.io-client/build/esm/package.json +10 -0
- package/node_modules/engine.io-client/build/esm/socket.d.ts +482 -0
- package/node_modules/engine.io-client/build/esm/socket.js +727 -0
- package/node_modules/engine.io-client/build/esm/transport.d.ts +106 -0
- package/node_modules/engine.io-client/build/esm/transport.js +142 -0
- package/node_modules/engine.io-client/build/esm/transports/index.d.ts +8 -0
- package/node_modules/engine.io-client/build/esm/transports/index.js +8 -0
- package/node_modules/engine.io-client/build/esm/transports/polling-fetch.d.ts +15 -0
- package/node_modules/engine.io-client/build/esm/transports/polling-fetch.js +56 -0
- package/node_modules/engine.io-client/build/esm/transports/polling-xhr.d.ts +108 -0
- package/node_modules/engine.io-client/build/esm/transports/polling-xhr.js +271 -0
- package/node_modules/engine.io-client/build/esm/transports/polling-xhr.node.d.ts +11 -0
- package/node_modules/engine.io-client/build/esm/transports/polling-xhr.node.js +17 -0
- package/node_modules/engine.io-client/build/esm/transports/polling.d.ts +52 -0
- package/node_modules/engine.io-client/build/esm/transports/polling.js +145 -0
- package/node_modules/engine.io-client/build/esm/transports/websocket.d.ts +36 -0
- package/node_modules/engine.io-client/build/esm/transports/websocket.js +125 -0
- package/node_modules/engine.io-client/build/esm/transports/websocket.node.d.ts +14 -0
- package/node_modules/engine.io-client/build/esm/transports/websocket.node.js +41 -0
- package/node_modules/engine.io-client/build/esm/transports/webtransport.d.ts +18 -0
- package/node_modules/engine.io-client/build/esm/transports/webtransport.js +80 -0
- package/node_modules/engine.io-client/build/esm/util.d.ts +7 -0
- package/node_modules/engine.io-client/build/esm/util.js +59 -0
- package/node_modules/engine.io-client/build/esm-debug/browser-entrypoint.d.ts +3 -0
- package/node_modules/engine.io-client/build/esm-debug/browser-entrypoint.js +2 -0
- package/node_modules/engine.io-client/build/esm-debug/contrib/has-cors.d.ts +1 -0
- package/node_modules/engine.io-client/build/esm-debug/contrib/has-cors.js +11 -0
- package/node_modules/engine.io-client/build/esm-debug/contrib/parseqs.d.ts +15 -0
- package/node_modules/engine.io-client/build/esm-debug/contrib/parseqs.js +34 -0
- package/node_modules/engine.io-client/build/esm-debug/contrib/parseuri.d.ts +1 -0
- package/node_modules/engine.io-client/build/esm-debug/contrib/parseuri.js +64 -0
- package/node_modules/engine.io-client/build/esm-debug/globals.d.ts +4 -0
- package/node_modules/engine.io-client/build/esm-debug/globals.js +22 -0
- package/node_modules/engine.io-client/build/esm-debug/globals.node.d.ts +21 -0
- package/node_modules/engine.io-client/build/esm-debug/globals.node.js +91 -0
- package/node_modules/engine.io-client/build/esm-debug/index.d.ts +15 -0
- package/node_modules/engine.io-client/build/esm-debug/index.js +15 -0
- package/node_modules/engine.io-client/build/esm-debug/package.json +10 -0
- package/node_modules/engine.io-client/build/esm-debug/socket.d.ts +482 -0
- package/node_modules/engine.io-client/build/esm-debug/socket.js +756 -0
- package/node_modules/engine.io-client/build/esm-debug/transport.d.ts +106 -0
- package/node_modules/engine.io-client/build/esm-debug/transport.js +145 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/index.d.ts +8 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/index.js +8 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/polling-fetch.d.ts +15 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/polling-fetch.js +56 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.d.ts +108 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.js +276 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.node.d.ts +11 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.node.js +17 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/polling.d.ts +52 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/polling.js +158 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/websocket.d.ts +36 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/websocket.js +128 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/websocket.node.d.ts +14 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/websocket.node.js +41 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/webtransport.d.ts +18 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/webtransport.js +87 -0
- package/node_modules/engine.io-client/build/esm-debug/util.d.ts +7 -0
- package/node_modules/engine.io-client/build/esm-debug/util.js +59 -0
- package/node_modules/engine.io-client/dist/engine.io.esm.min.js +7 -0
- package/node_modules/engine.io-client/dist/engine.io.esm.min.js.map +1 -0
- package/node_modules/engine.io-client/dist/engine.io.js +3064 -0
- package/node_modules/engine.io-client/dist/engine.io.js.map +1 -0
- package/node_modules/engine.io-client/dist/engine.io.min.js +7 -0
- package/node_modules/engine.io-client/dist/engine.io.min.js.map +1 -0
- package/node_modules/engine.io-client/package.json +95 -0
- package/node_modules/engine.io-parser/LICENSE +22 -0
- package/node_modules/engine.io-parser/Readme.md +158 -0
- package/node_modules/engine.io-parser/build/cjs/commons.d.ts +14 -0
- package/node_modules/engine.io-parser/build/cjs/commons.js +19 -0
- package/node_modules/engine.io-parser/build/cjs/contrib/base64-arraybuffer.d.ts +2 -0
- package/node_modules/engine.io-parser/build/cjs/contrib/base64-arraybuffer.js +48 -0
- package/node_modules/engine.io-parser/build/cjs/decodePacket.browser.d.ts +2 -0
- package/node_modules/engine.io-parser/build/cjs/decodePacket.browser.js +66 -0
- package/node_modules/engine.io-parser/build/cjs/decodePacket.d.ts +2 -0
- package/node_modules/engine.io-parser/build/cjs/decodePacket.js +59 -0
- package/node_modules/engine.io-parser/build/cjs/encodePacket.browser.d.ts +4 -0
- package/node_modules/engine.io-parser/build/cjs/encodePacket.browser.js +72 -0
- package/node_modules/engine.io-parser/build/cjs/encodePacket.d.ts +3 -0
- package/node_modules/engine.io-parser/build/cjs/encodePacket.js +38 -0
- package/node_modules/engine.io-parser/build/cjs/index.d.ts +9 -0
- package/node_modules/engine.io-parser/build/cjs/index.js +164 -0
- package/node_modules/engine.io-parser/build/cjs/package.json +8 -0
- package/node_modules/engine.io-parser/build/esm/commons.d.ts +14 -0
- package/node_modules/engine.io-parser/build/esm/commons.js +14 -0
- package/node_modules/engine.io-parser/build/esm/contrib/base64-arraybuffer.d.ts +2 -0
- package/node_modules/engine.io-parser/build/esm/contrib/base64-arraybuffer.js +43 -0
- package/node_modules/engine.io-parser/build/esm/decodePacket.browser.d.ts +2 -0
- package/node_modules/engine.io-parser/build/esm/decodePacket.browser.js +62 -0
- package/node_modules/engine.io-parser/build/esm/decodePacket.d.ts +2 -0
- package/node_modules/engine.io-parser/build/esm/decodePacket.js +55 -0
- package/node_modules/engine.io-parser/build/esm/encodePacket.browser.d.ts +4 -0
- package/node_modules/engine.io-parser/build/esm/encodePacket.browser.js +68 -0
- package/node_modules/engine.io-parser/build/esm/encodePacket.d.ts +3 -0
- package/node_modules/engine.io-parser/build/esm/encodePacket.js +33 -0
- package/node_modules/engine.io-parser/build/esm/index.d.ts +9 -0
- package/node_modules/engine.io-parser/build/esm/index.js +156 -0
- package/node_modules/engine.io-parser/build/esm/package.json +8 -0
- package/node_modules/engine.io-parser/package.json +46 -0
- package/node_modules/ms/index.js +162 -0
- package/node_modules/ms/license.md +21 -0
- package/node_modules/ms/package.json +38 -0
- package/node_modules/ms/readme.md +59 -0
- package/node_modules/socket.io-client/LICENSE +21 -0
- package/node_modules/socket.io-client/README.md +29 -0
- package/node_modules/socket.io-client/build/cjs/browser-entrypoint.d.ts +2 -0
- package/node_modules/socket.io-client/build/cjs/browser-entrypoint.js +4 -0
- package/node_modules/socket.io-client/build/cjs/contrib/backo2.d.ts +12 -0
- package/node_modules/socket.io-client/build/cjs/contrib/backo2.js +69 -0
- package/node_modules/socket.io-client/build/cjs/index.d.ts +29 -0
- package/node_modules/socket.io-client/build/cjs/index.js +76 -0
- package/node_modules/socket.io-client/build/cjs/manager.d.ts +295 -0
- package/node_modules/socket.io-client/build/cjs/manager.js +416 -0
- package/node_modules/socket.io-client/build/cjs/on.d.ts +2 -0
- package/node_modules/socket.io-client/build/cjs/on.js +9 -0
- package/node_modules/socket.io-client/build/cjs/socket.d.ts +593 -0
- package/node_modules/socket.io-client/build/cjs/socket.js +909 -0
- package/node_modules/socket.io-client/build/cjs/url.d.ts +33 -0
- package/node_modules/socket.io-client/build/cjs/url.js +69 -0
- package/node_modules/socket.io-client/build/esm/browser-entrypoint.d.ts +2 -0
- package/node_modules/socket.io-client/build/esm/browser-entrypoint.js +2 -0
- package/node_modules/socket.io-client/build/esm/contrib/backo2.d.ts +12 -0
- package/node_modules/socket.io-client/build/esm/contrib/backo2.js +66 -0
- package/node_modules/socket.io-client/build/esm/index.d.ts +29 -0
- package/node_modules/socket.io-client/build/esm/index.js +58 -0
- package/node_modules/socket.io-client/build/esm/manager.d.ts +295 -0
- package/node_modules/socket.io-client/build/esm/manager.js +367 -0
- package/node_modules/socket.io-client/build/esm/on.d.ts +2 -0
- package/node_modules/socket.io-client/build/esm/on.js +6 -0
- package/node_modules/socket.io-client/build/esm/package.json +5 -0
- package/node_modules/socket.io-client/build/esm/socket.d.ts +593 -0
- package/node_modules/socket.io-client/build/esm/socket.js +880 -0
- package/node_modules/socket.io-client/build/esm/url.d.ts +33 -0
- package/node_modules/socket.io-client/build/esm/url.js +59 -0
- package/node_modules/socket.io-client/build/esm-debug/browser-entrypoint.d.ts +2 -0
- package/node_modules/socket.io-client/build/esm-debug/browser-entrypoint.js +2 -0
- package/node_modules/socket.io-client/build/esm-debug/contrib/backo2.d.ts +12 -0
- package/node_modules/socket.io-client/build/esm-debug/contrib/backo2.js +66 -0
- package/node_modules/socket.io-client/build/esm-debug/index.d.ts +29 -0
- package/node_modules/socket.io-client/build/esm-debug/index.js +62 -0
- package/node_modules/socket.io-client/build/esm-debug/manager.d.ts +295 -0
- package/node_modules/socket.io-client/build/esm-debug/manager.js +386 -0
- package/node_modules/socket.io-client/build/esm-debug/on.d.ts +2 -0
- package/node_modules/socket.io-client/build/esm-debug/on.js +6 -0
- package/node_modules/socket.io-client/build/esm-debug/package.json +5 -0
- package/node_modules/socket.io-client/build/esm-debug/socket.d.ts +593 -0
- package/node_modules/socket.io-client/build/esm-debug/socket.js +902 -0
- package/node_modules/socket.io-client/build/esm-debug/url.d.ts +33 -0
- package/node_modules/socket.io-client/build/esm-debug/url.js +63 -0
- package/node_modules/socket.io-client/dist/socket.io.esm.min.js +7 -0
- package/node_modules/socket.io-client/dist/socket.io.esm.min.js.map +1 -0
- package/node_modules/socket.io-client/dist/socket.io.js +4955 -0
- package/node_modules/socket.io-client/dist/socket.io.js.map +1 -0
- package/node_modules/socket.io-client/dist/socket.io.min.js +7 -0
- package/node_modules/socket.io-client/dist/socket.io.min.js.map +1 -0
- package/node_modules/socket.io-client/dist/socket.io.msgpack.min.js +7 -0
- package/node_modules/socket.io-client/dist/socket.io.msgpack.min.js.map +1 -0
- package/node_modules/socket.io-client/package.json +101 -0
- package/node_modules/socket.io-parser/LICENSE +20 -0
- package/node_modules/socket.io-parser/Readme.md +81 -0
- package/node_modules/socket.io-parser/build/cjs/binary.d.ts +20 -0
- package/node_modules/socket.io-parser/build/cjs/binary.js +87 -0
- package/node_modules/socket.io-parser/build/cjs/index.d.ts +91 -0
- package/node_modules/socket.io-parser/build/cjs/index.js +359 -0
- package/node_modules/socket.io-parser/build/cjs/is-binary.d.ts +7 -0
- package/node_modules/socket.io-parser/build/cjs/is-binary.js +54 -0
- package/node_modules/socket.io-parser/build/cjs/package.json +3 -0
- package/node_modules/socket.io-parser/build/esm/binary.d.ts +20 -0
- package/node_modules/socket.io-parser/build/esm/binary.js +83 -0
- package/node_modules/socket.io-parser/build/esm/index.d.ts +91 -0
- package/node_modules/socket.io-parser/build/esm/index.js +348 -0
- package/node_modules/socket.io-parser/build/esm/is-binary.d.ts +7 -0
- package/node_modules/socket.io-parser/build/esm/is-binary.js +50 -0
- package/node_modules/socket.io-parser/build/esm/package.json +3 -0
- package/node_modules/socket.io-parser/build/esm-debug/binary.d.ts +20 -0
- package/node_modules/socket.io-parser/build/esm-debug/binary.js +83 -0
- package/node_modules/socket.io-parser/build/esm-debug/index.d.ts +91 -0
- package/node_modules/socket.io-parser/build/esm-debug/index.js +353 -0
- package/node_modules/socket.io-parser/build/esm-debug/is-binary.d.ts +7 -0
- package/node_modules/socket.io-parser/build/esm-debug/is-binary.js +50 -0
- package/node_modules/socket.io-parser/build/esm-debug/package.json +3 -0
- package/node_modules/socket.io-parser/package.json +44 -0
- package/node_modules/ws/LICENSE +20 -0
- package/node_modules/ws/README.md +548 -0
- package/node_modules/ws/browser.js +8 -0
- package/node_modules/ws/index.js +13 -0
- package/node_modules/ws/lib/buffer-util.js +131 -0
- package/node_modules/ws/lib/constants.js +18 -0
- package/node_modules/ws/lib/event-target.js +292 -0
- package/node_modules/ws/lib/extension.js +203 -0
- package/node_modules/ws/lib/limiter.js +55 -0
- package/node_modules/ws/lib/permessage-deflate.js +528 -0
- package/node_modules/ws/lib/receiver.js +706 -0
- package/node_modules/ws/lib/sender.js +602 -0
- package/node_modules/ws/lib/stream.js +161 -0
- package/node_modules/ws/lib/subprotocol.js +62 -0
- package/node_modules/ws/lib/validation.js +152 -0
- package/node_modules/ws/lib/websocket-server.js +550 -0
- package/node_modules/ws/lib/websocket.js +1388 -0
- package/node_modules/ws/package.json +69 -0
- package/node_modules/ws/wrapper.mjs +8 -0
- package/node_modules/xmlhttprequest-ssl/LICENSE +22 -0
- package/node_modules/xmlhttprequest-ssl/README.md +67 -0
- package/node_modules/xmlhttprequest-ssl/lib/XMLHttpRequest.js +689 -0
- package/node_modules/xmlhttprequest-ssl/package.json +40 -0
- package/package.json +34 -4
- package/public-api.md +85 -23
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { type Entry, type Json, type JsonStructure, type KeySet, type arrayIndexOf, type keySetOf, type listable, type requireKeys, type show } from "@ark/util";
|
|
2
|
+
import type { NodeConfig, ResolvedUnknownNodeConfig } from "../config.ts";
|
|
3
|
+
import type { Declaration, Inner, errorContext, nodeOfKind } from "../kinds.ts";
|
|
4
|
+
import type { BaseNode } from "../node.ts";
|
|
5
|
+
import type { NodeId, NodeParseContext } from "../parse.ts";
|
|
6
|
+
import type { BaseRoot, schemaKindOrRightOf, schemaKindRightOf } from "../roots/root.ts";
|
|
7
|
+
import type { BaseScope, ResolvedScopeConfig } from "../scope.ts";
|
|
8
|
+
import type { Structure } from "../structure/structure.ts";
|
|
9
|
+
import type { BaseErrorContext, BaseNodeDeclaration, BaseNormalizedSchema } from "./declare.ts";
|
|
10
|
+
import type { Disjoint } from "./disjoint.ts";
|
|
11
|
+
import { type makeRootAndArrayPropertiesMutable } from "./utils.ts";
|
|
12
|
+
export declare const basisKinds: readonly ["unit", "proto", "domain"];
|
|
13
|
+
export type BasisKind = (typeof basisKinds)[number];
|
|
14
|
+
export declare const structuralKinds: readonly ["required", "optional", "index", "sequence"];
|
|
15
|
+
export type StructuralKind = (typeof structuralKinds)[number];
|
|
16
|
+
export declare const prestructuralKinds: readonly ["pattern", "divisor", "exactLength", "max", "min", "maxLength", "minLength", "before", "after"];
|
|
17
|
+
export type PrestructuralKind = (typeof prestructuralKinds)[number];
|
|
18
|
+
export declare const refinementKinds: readonly ["pattern", "divisor", "exactLength", "max", "min", "maxLength", "minLength", "before", "after", "structure", "predicate"];
|
|
19
|
+
export type RefinementKind = (typeof refinementKinds)[number];
|
|
20
|
+
export declare const constraintKinds: readonly ["pattern", "divisor", "exactLength", "max", "min", "maxLength", "minLength", "before", "after", "structure", "predicate", "required", "optional", "index", "sequence"];
|
|
21
|
+
export type ConstraintKind = (typeof constraintKinds)[number];
|
|
22
|
+
export declare const rootKinds: readonly ["alias", "union", "morph", "unit", "intersection", "proto", "domain"];
|
|
23
|
+
export type RootKind = (typeof rootKinds)[number];
|
|
24
|
+
export type NodeKind = RootKind | ConstraintKind;
|
|
25
|
+
type orderedNodeKinds = [...typeof rootKinds, ...typeof constraintKinds];
|
|
26
|
+
export declare const nodeKinds: orderedNodeKinds;
|
|
27
|
+
export type OpenNodeKind = {
|
|
28
|
+
[k in NodeKind]: Declaration<k>["intersectionIsOpen"] extends true ? k : never;
|
|
29
|
+
}[NodeKind];
|
|
30
|
+
export type ClosedNodeKind = Exclude<NodeKind, OpenNodeKind>;
|
|
31
|
+
export type PrimitiveKind = Exclude<RefinementKind | BasisKind, "structure">;
|
|
32
|
+
export type CompositeKind = Exclude<NodeKind, PrimitiveKind>;
|
|
33
|
+
export type OrderedNodeKinds = typeof nodeKinds;
|
|
34
|
+
export declare const constraintKeys: KeySet<ConstraintKind>;
|
|
35
|
+
export declare const structureKeys: keySetOf<Structure.Inner>;
|
|
36
|
+
type RightsByKind = accumulateRightKinds<OrderedNodeKinds, {}>;
|
|
37
|
+
export type kindOrRightOf<kind extends NodeKind> = kind | kindRightOf<kind>;
|
|
38
|
+
export type kindLeftOf<kind extends NodeKind> = Exclude<NodeKind, kindOrRightOf<kind>>;
|
|
39
|
+
export type kindOrLeftOf<kind extends NodeKind> = kind | kindLeftOf<kind>;
|
|
40
|
+
type accumulateRightKinds<remaining extends readonly NodeKind[], result> = remaining extends (readonly [infer head extends NodeKind, ...infer tail extends NodeKind[]]) ? accumulateRightKinds<tail, result & {
|
|
41
|
+
[k in head]: tail[number];
|
|
42
|
+
}> : result;
|
|
43
|
+
export interface InternalIntersectionOptions {
|
|
44
|
+
pipe: boolean;
|
|
45
|
+
}
|
|
46
|
+
export interface IntersectionContext extends InternalIntersectionOptions {
|
|
47
|
+
$: BaseScope;
|
|
48
|
+
invert: boolean;
|
|
49
|
+
}
|
|
50
|
+
export type ConstraintIntersection<lKind extends ConstraintKind, rKind extends kindOrRightOf<lKind>> = (l: nodeOfKind<lKind>, r: nodeOfKind<rKind>, ctx: IntersectionContext) => BaseNode | Disjoint | null;
|
|
51
|
+
export type ConstraintIntersectionMap<kind extends ConstraintKind> = show<{
|
|
52
|
+
[_ in kind]: ConstraintIntersection<kind, kind>;
|
|
53
|
+
} & {
|
|
54
|
+
[rKind in kindRightOf<kind>]?: ConstraintIntersection<kind, rKind>;
|
|
55
|
+
}>;
|
|
56
|
+
export type RootIntersection<lKind extends RootKind, rKind extends schemaKindOrRightOf<lKind>> = (l: nodeOfKind<lKind>, r: nodeOfKind<rKind>, ctx: IntersectionContext) => BaseRoot | Disjoint;
|
|
57
|
+
export type TypeIntersectionMap<kind extends RootKind> = {
|
|
58
|
+
[rKind in schemaKindOrRightOf<kind>]: RootIntersection<kind, rKind>;
|
|
59
|
+
};
|
|
60
|
+
export type IntersectionMap<kind extends NodeKind> = kind extends RootKind ? TypeIntersectionMap<kind> : ConstraintIntersectionMap<kind & ConstraintKind>;
|
|
61
|
+
export type UnknownIntersectionMap = {
|
|
62
|
+
[k in NodeKind]?: (l: BaseNode, r: BaseNode, ctx: IntersectionContext) => UnknownIntersectionResult;
|
|
63
|
+
};
|
|
64
|
+
export type UnknownIntersectionResult = BaseNode | Disjoint | null;
|
|
65
|
+
type PrecedenceByKind = {
|
|
66
|
+
[i in arrayIndexOf<OrderedNodeKinds> as OrderedNodeKinds[i]]: i;
|
|
67
|
+
};
|
|
68
|
+
export declare const precedenceByKind: PrecedenceByKind;
|
|
69
|
+
export declare const isNodeKind: (value: unknown) => value is NodeKind;
|
|
70
|
+
export declare function assertNodeKind<kind extends NodeKind>(value: BaseNode, kind: kind): asserts value is nodeOfKind<kind>;
|
|
71
|
+
export type precedenceOfKind<kind extends NodeKind> = PrecedenceByKind[kind];
|
|
72
|
+
export declare const precedenceOfKind: <kind extends NodeKind>(kind: kind) => precedenceOfKind<kind>;
|
|
73
|
+
export type kindRightOf<kind extends NodeKind> = RightsByKind[kind];
|
|
74
|
+
export declare const schemaKindsRightOf: <kind extends RootKind>(kind: kind) => schemaKindRightOf<kind>[];
|
|
75
|
+
export declare const unionChildKinds: readonly [...("intersection" | "morph" | "unit" | "proto" | "domain")[], "alias"];
|
|
76
|
+
export type UnionChildKind = (typeof unionChildKinds)[number];
|
|
77
|
+
export declare const morphChildKinds: readonly [...("intersection" | "unit" | "proto" | "domain")[], "alias"];
|
|
78
|
+
export type MorphChildKind = (typeof morphChildKinds)[number];
|
|
79
|
+
export type keySchemaDefinitions<d extends BaseNodeDeclaration> = {
|
|
80
|
+
[k in keyRequiringSchemaDefinition<d>]: NodeKeyImplementation<d, k>;
|
|
81
|
+
};
|
|
82
|
+
type keyRequiringSchemaDefinition<d extends BaseNodeDeclaration> = Exclude<keyof d["normalizedSchema"], keyof BaseNormalizedSchema>;
|
|
83
|
+
export declare const defaultValueSerializer: (v: unknown) => Json;
|
|
84
|
+
export type NodeKeyImplementation<d extends BaseNodeDeclaration, k extends keyof d["normalizedSchema"], instantiated = k extends keyof d["inner"] ? Exclude<d["inner"][k], undefined> : never> = requireKeys<{
|
|
85
|
+
preserveUndefined?: true;
|
|
86
|
+
child?: boolean | ((value: instantiated) => BaseNode[]);
|
|
87
|
+
serialize?: (schema: instantiated) => Json;
|
|
88
|
+
reduceIo?: (ioKind: "in" | "out", inner: makeRootAndArrayPropertiesMutable<d["inner"]>, value: d["inner"][k]) => void;
|
|
89
|
+
parse?: (schema: Exclude<d["normalizedSchema"][k], undefined>, ctx: NodeParseContext<d["kind"]>) => instantiated | undefined;
|
|
90
|
+
}, (d["normalizedSchema"][k] extends instantiated | undefined ? never : "parse") | ([instantiated] extends [listable<BaseNode>] ? "child" : never)>;
|
|
91
|
+
interface CommonNodeImplementationInput<d extends BaseNodeDeclaration> {
|
|
92
|
+
kind: d["kind"];
|
|
93
|
+
keys: keySchemaDefinitions<d>;
|
|
94
|
+
normalize: (schema: d["schema"], $: BaseScope) => d["normalizedSchema"];
|
|
95
|
+
applyConfig?: (schema: d["normalizedSchema"], config: ResolvedScopeConfig) => d["normalizedSchema"];
|
|
96
|
+
hasAssociatedError: d["errorContext"] extends null ? false : true;
|
|
97
|
+
finalizeInnerJson?: (json: {
|
|
98
|
+
[k in keyof d["inner"]]: Json;
|
|
99
|
+
}) => JsonStructure;
|
|
100
|
+
collapsibleKey?: keyof d["inner"];
|
|
101
|
+
reduce?: (inner: d["inner"], $: BaseScope) => nodeOfKind<d["reducibleTo"]> | Disjoint | undefined;
|
|
102
|
+
obviatesBasisDescription?: d["kind"] extends RefinementKind ? true : never;
|
|
103
|
+
obviatesBasisExpression?: d["kind"] extends RefinementKind ? true : never;
|
|
104
|
+
}
|
|
105
|
+
export interface UnknownNodeImplementation extends CommonNodeImplementationInput<BaseNodeDeclaration> {
|
|
106
|
+
defaults: ResolvedUnknownNodeConfig;
|
|
107
|
+
intersectionIsOpen: boolean;
|
|
108
|
+
intersections: UnknownIntersectionMap;
|
|
109
|
+
keys: Record<string, NodeKeyImplementation<any, any>>;
|
|
110
|
+
}
|
|
111
|
+
export declare const compileObjectLiteral: (ctx: object) => string;
|
|
112
|
+
export type nodeImplementationOf<d extends BaseNodeDeclaration> = nodeImplementationInputOf<d> & {
|
|
113
|
+
intersections: IntersectionMap<d["kind"]>;
|
|
114
|
+
intersectionIsOpen: d["intersectionIsOpen"];
|
|
115
|
+
defaults: Required<NodeConfig<d["kind"]>>;
|
|
116
|
+
};
|
|
117
|
+
export type nodeImplementationInputOf<d extends BaseNodeDeclaration> = CommonNodeImplementationInput<d> & {
|
|
118
|
+
intersections: IntersectionMap<d["kind"]>;
|
|
119
|
+
defaults: nodeSchemaaultsImplementationInputFor<d["kind"]>;
|
|
120
|
+
} & (d["intersectionIsOpen"] extends true ? {
|
|
121
|
+
intersectionIsOpen: true;
|
|
122
|
+
} : {}) & (d["reducibleTo"] extends d["kind"] ? {} : {
|
|
123
|
+
reduce: {};
|
|
124
|
+
});
|
|
125
|
+
type nodeSchemaaultsImplementationInputFor<kind extends NodeKind> = requireKeys<NodeConfig<kind>, "description" | (Inner<kind> extends (Omit<errorContext<kind>, keyof BaseErrorContext | "description">) ? never : "expected" & keyof NodeConfig<kind>)>;
|
|
126
|
+
export type DescriptionWriter<kind extends NodeKind = NodeKind> = (node: nodeOfKind<kind>) => string;
|
|
127
|
+
export interface UnknownAttachments {
|
|
128
|
+
readonly kind: NodeKind;
|
|
129
|
+
readonly impl: UnknownNodeImplementation;
|
|
130
|
+
readonly id: NodeId;
|
|
131
|
+
readonly inner: Record<string, any>;
|
|
132
|
+
readonly innerEntries: readonly Entry<string>[];
|
|
133
|
+
readonly innerJson: object;
|
|
134
|
+
readonly innerHash: string;
|
|
135
|
+
readonly meta: ArkEnv.meta;
|
|
136
|
+
readonly metaJson: object;
|
|
137
|
+
readonly json: object;
|
|
138
|
+
readonly hash: string;
|
|
139
|
+
readonly collapsibleJson: Json;
|
|
140
|
+
readonly children: BaseNode[];
|
|
141
|
+
}
|
|
142
|
+
export interface NarrowedAttachments<d extends BaseNodeDeclaration> extends UnknownAttachments {
|
|
143
|
+
kind: d["kind"];
|
|
144
|
+
inner: d["inner"];
|
|
145
|
+
json: JsonStructure;
|
|
146
|
+
innerJson: JsonStructure;
|
|
147
|
+
collapsibleJson: Json;
|
|
148
|
+
children: nodeOfKind<d["childKind"]>[];
|
|
149
|
+
}
|
|
150
|
+
export declare const implementNode: <d extends BaseNodeDeclaration = never>(_: nodeImplementationInputOf<d>) => nodeImplementationOf<d>;
|
|
151
|
+
export {};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { flatMorph, printable, throwParseError } from "@ark/util";
|
|
2
|
+
import { compileSerializedValue } from "./compile.js";
|
|
3
|
+
import { isNode } from "./utils.js";
|
|
4
|
+
export const basisKinds = ["unit", "proto", "domain"];
|
|
5
|
+
export const structuralKinds = [
|
|
6
|
+
"required",
|
|
7
|
+
"optional",
|
|
8
|
+
"index",
|
|
9
|
+
"sequence"
|
|
10
|
+
];
|
|
11
|
+
export const prestructuralKinds = [
|
|
12
|
+
"pattern",
|
|
13
|
+
"divisor",
|
|
14
|
+
"exactLength",
|
|
15
|
+
"max",
|
|
16
|
+
"min",
|
|
17
|
+
"maxLength",
|
|
18
|
+
"minLength",
|
|
19
|
+
"before",
|
|
20
|
+
"after"
|
|
21
|
+
];
|
|
22
|
+
export const refinementKinds = [
|
|
23
|
+
...prestructuralKinds,
|
|
24
|
+
"structure",
|
|
25
|
+
"predicate"
|
|
26
|
+
];
|
|
27
|
+
export const constraintKinds = [...refinementKinds, ...structuralKinds];
|
|
28
|
+
export const rootKinds = [
|
|
29
|
+
"alias",
|
|
30
|
+
"union",
|
|
31
|
+
"morph",
|
|
32
|
+
"unit",
|
|
33
|
+
"intersection",
|
|
34
|
+
"proto",
|
|
35
|
+
"domain"
|
|
36
|
+
];
|
|
37
|
+
export const nodeKinds = [...rootKinds, ...constraintKinds];
|
|
38
|
+
export const constraintKeys = flatMorph(constraintKinds, (i, kind) => [kind, 1]);
|
|
39
|
+
export const structureKeys = flatMorph([...structuralKinds, "undeclared"], (i, k) => [k, 1]);
|
|
40
|
+
export const precedenceByKind = flatMorph(nodeKinds, (i, kind) => [kind, i]);
|
|
41
|
+
export const isNodeKind = (value) => typeof value === "string" && value in precedenceByKind;
|
|
42
|
+
export function assertNodeKind(value, kind) {
|
|
43
|
+
const valueIsNode = isNode(value);
|
|
44
|
+
if (!valueIsNode || value.kind !== kind) {
|
|
45
|
+
throwParseError(`Expected node of kind ${kind} (was ${valueIsNode ? `${value.kind} node` : printable(value)})`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export const precedenceOfKind = (kind) => precedenceByKind[kind];
|
|
49
|
+
export const schemaKindsRightOf = (kind) => rootKinds.slice(precedenceOfKind(kind) + 1);
|
|
50
|
+
export const unionChildKinds = [
|
|
51
|
+
...schemaKindsRightOf("union"),
|
|
52
|
+
"alias"
|
|
53
|
+
];
|
|
54
|
+
export const morphChildKinds = [
|
|
55
|
+
...schemaKindsRightOf("morph"),
|
|
56
|
+
"alias"
|
|
57
|
+
];
|
|
58
|
+
export const defaultValueSerializer = (v) => {
|
|
59
|
+
if (typeof v === "string" || typeof v === "boolean" || v === null)
|
|
60
|
+
return v;
|
|
61
|
+
if (typeof v === "number") {
|
|
62
|
+
if (Number.isNaN(v))
|
|
63
|
+
return "NaN";
|
|
64
|
+
if (v === Number.POSITIVE_INFINITY)
|
|
65
|
+
return "Infinity";
|
|
66
|
+
if (v === Number.NEGATIVE_INFINITY)
|
|
67
|
+
return "-Infinity";
|
|
68
|
+
return v;
|
|
69
|
+
}
|
|
70
|
+
return compileSerializedValue(v);
|
|
71
|
+
};
|
|
72
|
+
export const compileObjectLiteral = (ctx) => {
|
|
73
|
+
let result = "{ ";
|
|
74
|
+
for (const [k, v] of Object.entries(ctx))
|
|
75
|
+
result += `${k}: ${compileSerializedValue(v)}, `;
|
|
76
|
+
return result + " }";
|
|
77
|
+
};
|
|
78
|
+
export const implementNode = (_) => {
|
|
79
|
+
const implementation = _;
|
|
80
|
+
if (implementation.hasAssociatedError) {
|
|
81
|
+
implementation.defaults.expected ??= ctx => "description" in ctx ?
|
|
82
|
+
ctx.description
|
|
83
|
+
: implementation.defaults.description(ctx);
|
|
84
|
+
implementation.defaults.actual ??= data => printable(data);
|
|
85
|
+
implementation.defaults.problem ??= ctx => `must be ${ctx.expected}${ctx.actual ? ` (was ${ctx.actual})` : ""}`;
|
|
86
|
+
implementation.defaults.message ??= ctx => {
|
|
87
|
+
if (ctx.path.length === 0)
|
|
88
|
+
return ctx.problem;
|
|
89
|
+
const problemWithLocation = `${ctx.propString} ${ctx.problem}`;
|
|
90
|
+
if (problemWithLocation[0] === "[") {
|
|
91
|
+
// clarify paths like [1], [0][1], and ["key!"] that could be confusing
|
|
92
|
+
return `value at ${problemWithLocation}`;
|
|
93
|
+
}
|
|
94
|
+
return problemWithLocation;
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
return implementation;
|
|
98
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BaseNode } from "../node.ts";
|
|
2
|
+
import type { BaseRoot } from "../roots/root.ts";
|
|
3
|
+
import type { BaseScope } from "../scope.ts";
|
|
4
|
+
import { Disjoint } from "./disjoint.ts";
|
|
5
|
+
import { type IntersectionContext, type RootKind } from "./implement.ts";
|
|
6
|
+
type InternalNodeIntersection<ctx> = <l extends BaseNode, r extends BaseNode>(l: l, r: r, ctx: ctx) => l["kind"] | r["kind"] extends RootKind ? BaseRoot | Disjoint : BaseNode | Disjoint | null;
|
|
7
|
+
export declare const intersectNodesRoot: InternalNodeIntersection<BaseScope>;
|
|
8
|
+
export declare const pipeNodesRoot: InternalNodeIntersection<BaseScope>;
|
|
9
|
+
export declare const intersectOrPipeNodes: InternalNodeIntersection<IntersectionContext>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { Disjoint } from "./disjoint.js";
|
|
2
|
+
import { rootKinds } from "./implement.js";
|
|
3
|
+
import { isNode } from "./utils.js";
|
|
4
|
+
const intersectionCache = {};
|
|
5
|
+
export const intersectNodesRoot = (l, r, $) => intersectOrPipeNodes(l, r, {
|
|
6
|
+
$,
|
|
7
|
+
invert: false,
|
|
8
|
+
pipe: false
|
|
9
|
+
});
|
|
10
|
+
export const pipeNodesRoot = (l, r, $) => intersectOrPipeNodes(l, r, {
|
|
11
|
+
$,
|
|
12
|
+
invert: false,
|
|
13
|
+
pipe: true
|
|
14
|
+
});
|
|
15
|
+
export const intersectOrPipeNodes = ((l, r, ctx) => {
|
|
16
|
+
const operator = ctx.pipe ? "|>" : "&";
|
|
17
|
+
const lrCacheKey = `${l.hash}${operator}${r.hash}`;
|
|
18
|
+
if (intersectionCache[lrCacheKey] !== undefined)
|
|
19
|
+
return intersectionCache[lrCacheKey];
|
|
20
|
+
if (!ctx.pipe) {
|
|
21
|
+
// we can only use this for the commutative & operator
|
|
22
|
+
const rlCacheKey = `${r.hash}${operator}${l.hash}`;
|
|
23
|
+
if (intersectionCache[rlCacheKey] !== undefined) {
|
|
24
|
+
// if the cached result was a Disjoint and the operands originally
|
|
25
|
+
// appeared in the opposite order, we need to invert it to match
|
|
26
|
+
const rlResult = intersectionCache[rlCacheKey];
|
|
27
|
+
const lrResult = rlResult instanceof Disjoint ? rlResult.invert() : rlResult;
|
|
28
|
+
// add the lr result to the cache directly to bypass this check in the future
|
|
29
|
+
intersectionCache[lrCacheKey] = lrResult;
|
|
30
|
+
return lrResult;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const isPureIntersection = !ctx.pipe || (!l.includesTransform && !r.includesTransform);
|
|
34
|
+
if (isPureIntersection && l.equals(r))
|
|
35
|
+
return l;
|
|
36
|
+
let result = isPureIntersection ? _intersectNodes(l, r, ctx)
|
|
37
|
+
: l.hasKindIn(...rootKinds) ?
|
|
38
|
+
// if l is a RootNode, r will be as well
|
|
39
|
+
_pipeNodes(l, r, ctx)
|
|
40
|
+
: _intersectNodes(l, r, ctx);
|
|
41
|
+
if (isNode(result)) {
|
|
42
|
+
// if the result equals one of the operands, preserve its metadata by
|
|
43
|
+
// returning the original reference
|
|
44
|
+
if (l.equals(result))
|
|
45
|
+
result = l;
|
|
46
|
+
else if (r.equals(result))
|
|
47
|
+
result = r;
|
|
48
|
+
}
|
|
49
|
+
intersectionCache[lrCacheKey] = result;
|
|
50
|
+
return result;
|
|
51
|
+
});
|
|
52
|
+
const _intersectNodes = (l, r, ctx) => {
|
|
53
|
+
const leftmostKind = l.precedence < r.precedence ? l.kind : r.kind;
|
|
54
|
+
const implementation = l.impl.intersections[r.kind] ?? r.impl.intersections[l.kind];
|
|
55
|
+
if (implementation === undefined) {
|
|
56
|
+
// should be two ConstraintNodes that have no relation
|
|
57
|
+
// this could also happen if a user directly intersects a Type and a ConstraintNode,
|
|
58
|
+
// but that is not allowed by the external function signature
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
else if (leftmostKind === l.kind)
|
|
62
|
+
return implementation(l, r, ctx);
|
|
63
|
+
else {
|
|
64
|
+
let result = implementation(r, l, { ...ctx, invert: !ctx.invert });
|
|
65
|
+
if (result instanceof Disjoint)
|
|
66
|
+
result = result.invert();
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
const _pipeNodes = (l, r, ctx) => l.includesTransform || r.includesTransform ?
|
|
71
|
+
ctx.invert ?
|
|
72
|
+
pipeMorphed(r, l, ctx)
|
|
73
|
+
: pipeMorphed(l, r, ctx)
|
|
74
|
+
: _intersectNodes(l, r, ctx);
|
|
75
|
+
const pipeMorphed = (from, to, ctx) => from.distribute(fromBranch => _pipeMorphed(fromBranch, to, ctx), results => {
|
|
76
|
+
const viableBranches = results.filter(isNode);
|
|
77
|
+
if (viableBranches.length === 0)
|
|
78
|
+
return Disjoint.init("union", from.branches, to.branches);
|
|
79
|
+
// if the input type has changed, create a new node without preserving metadata
|
|
80
|
+
if (viableBranches.length < from.branches.length ||
|
|
81
|
+
!from.branches.every((branch, i) => branch.rawIn.equals(viableBranches[i].rawIn)))
|
|
82
|
+
return ctx.$.parseSchema(viableBranches);
|
|
83
|
+
// otherwise, the input has not changed so preserve metadata
|
|
84
|
+
let meta;
|
|
85
|
+
if (viableBranches.length === 1) {
|
|
86
|
+
const onlyBranch = viableBranches[0];
|
|
87
|
+
if (!meta)
|
|
88
|
+
return onlyBranch;
|
|
89
|
+
return ctx.$.node("morph", {
|
|
90
|
+
...onlyBranch.inner,
|
|
91
|
+
in: onlyBranch.rawIn.configure(meta, "self")
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
const schema = {
|
|
95
|
+
branches: viableBranches
|
|
96
|
+
};
|
|
97
|
+
if (meta)
|
|
98
|
+
schema.meta = meta;
|
|
99
|
+
return ctx.$.parseSchema(schema);
|
|
100
|
+
});
|
|
101
|
+
const _pipeMorphed = (from, to, ctx) => {
|
|
102
|
+
const fromIsMorph = from.hasKind("morph");
|
|
103
|
+
if (fromIsMorph) {
|
|
104
|
+
const morphs = [...from.morphs];
|
|
105
|
+
if (from.lastMorphIfNode) {
|
|
106
|
+
// still piped from context, so allows appending additional morphs
|
|
107
|
+
const outIntersection = intersectOrPipeNodes(from.lastMorphIfNode, to, ctx);
|
|
108
|
+
if (outIntersection instanceof Disjoint)
|
|
109
|
+
return outIntersection;
|
|
110
|
+
morphs[morphs.length - 1] = outIntersection;
|
|
111
|
+
}
|
|
112
|
+
else
|
|
113
|
+
morphs.push(to);
|
|
114
|
+
return ctx.$.node("morph", {
|
|
115
|
+
morphs,
|
|
116
|
+
in: from.inner.in
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
if (to.hasKind("morph")) {
|
|
120
|
+
const inTersection = intersectOrPipeNodes(from, to.rawIn, ctx);
|
|
121
|
+
if (inTersection instanceof Disjoint)
|
|
122
|
+
return inTersection;
|
|
123
|
+
return ctx.$.node("morph", {
|
|
124
|
+
morphs: [to],
|
|
125
|
+
in: inTersection
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
return ctx.$.node("morph", {
|
|
129
|
+
morphs: [to],
|
|
130
|
+
in: from
|
|
131
|
+
});
|
|
132
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { array, autocomplete, JsonArray, JsonObject, listable } from "@ark/util";
|
|
2
|
+
export type JsonSchema = JsonSchema.NonBooleanBranch;
|
|
3
|
+
export type ListableJsonSchema = listable<JsonSchema>;
|
|
4
|
+
export type JsonSchemaOrBoolean = listable<JsonSchema.Branch>;
|
|
5
|
+
export declare namespace JsonSchema {
|
|
6
|
+
type TypeName = "string" | "integer" | "number" | "object" | "array" | "boolean" | "null";
|
|
7
|
+
/**
|
|
8
|
+
* a subset of JSON Schema's annotations, see:
|
|
9
|
+
* https://json-schema.org/understanding-json-schema/reference/annotations
|
|
10
|
+
**/
|
|
11
|
+
interface Meta<t = unknown> extends UniversalMeta<t> {
|
|
12
|
+
$schema?: string;
|
|
13
|
+
$defs?: Record<string, JsonSchema>;
|
|
14
|
+
}
|
|
15
|
+
type Format = autocomplete<"date-time" | "date" | "time" | "email" | "ipv4" | "ipv6" | "uri" | "uuid" | "regex">;
|
|
16
|
+
/**
|
|
17
|
+
* doesn't include root-only keys like $schema
|
|
18
|
+
*/
|
|
19
|
+
interface UniversalMeta<t = unknown> {
|
|
20
|
+
title?: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
format?: Format;
|
|
23
|
+
deprecated?: true;
|
|
24
|
+
default?: t;
|
|
25
|
+
examples?: readonly t[];
|
|
26
|
+
}
|
|
27
|
+
type Composition = Union | OneOf | Intersection | Not;
|
|
28
|
+
type NonBooleanBranch = Constrainable | Const | Composition | Enum | String | Numeric | Object | Array | Ref;
|
|
29
|
+
type Branch = boolean | JsonSchema;
|
|
30
|
+
type RefString = `#/$defs/${string}`;
|
|
31
|
+
interface Ref extends Meta {
|
|
32
|
+
$ref: RefString;
|
|
33
|
+
type?: never;
|
|
34
|
+
}
|
|
35
|
+
interface Constrainable extends Meta {
|
|
36
|
+
type?: listable<TypeName>;
|
|
37
|
+
}
|
|
38
|
+
interface Intersection extends Meta {
|
|
39
|
+
allOf: readonly JsonSchema[];
|
|
40
|
+
}
|
|
41
|
+
interface Not extends Meta {
|
|
42
|
+
not: JsonSchema;
|
|
43
|
+
}
|
|
44
|
+
interface OneOf extends Meta {
|
|
45
|
+
oneOf: readonly JsonSchema[];
|
|
46
|
+
}
|
|
47
|
+
interface Union extends Meta {
|
|
48
|
+
anyOf: readonly JsonSchema[];
|
|
49
|
+
}
|
|
50
|
+
interface Const extends Meta {
|
|
51
|
+
const: unknown;
|
|
52
|
+
}
|
|
53
|
+
interface Enum extends Meta {
|
|
54
|
+
enum: array;
|
|
55
|
+
}
|
|
56
|
+
interface String extends Meta<string> {
|
|
57
|
+
type: "string";
|
|
58
|
+
minLength?: number;
|
|
59
|
+
maxLength?: number;
|
|
60
|
+
pattern?: string;
|
|
61
|
+
format?: string;
|
|
62
|
+
}
|
|
63
|
+
interface Numeric extends Meta<number> {
|
|
64
|
+
type: "number" | "integer";
|
|
65
|
+
multipleOf?: number;
|
|
66
|
+
minimum?: number;
|
|
67
|
+
exclusiveMinimum?: number;
|
|
68
|
+
maximum?: number;
|
|
69
|
+
exclusiveMaximum?: number;
|
|
70
|
+
}
|
|
71
|
+
interface Object extends Meta<JsonObject> {
|
|
72
|
+
type: "object";
|
|
73
|
+
properties?: Record<string, JsonSchema>;
|
|
74
|
+
required?: string[];
|
|
75
|
+
patternProperties?: Record<string, JsonSchema>;
|
|
76
|
+
additionalProperties?: JsonSchemaOrBoolean;
|
|
77
|
+
maxProperties?: number;
|
|
78
|
+
minProperties?: number;
|
|
79
|
+
propertyNames?: String;
|
|
80
|
+
}
|
|
81
|
+
interface Array extends Meta<JsonArray> {
|
|
82
|
+
type: "array";
|
|
83
|
+
additionalItems?: JsonSchemaOrBoolean;
|
|
84
|
+
contains?: JsonSchemaOrBoolean;
|
|
85
|
+
uniqueItems?: boolean;
|
|
86
|
+
minItems?: number;
|
|
87
|
+
maxItems?: number;
|
|
88
|
+
items?: JsonSchemaOrBoolean;
|
|
89
|
+
prefixItems?: readonly Branch[];
|
|
90
|
+
}
|
|
91
|
+
type LengthBoundable = String | Array;
|
|
92
|
+
type Structure = Object | Array;
|
|
93
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type NonNegativeIntegerLiteral } from "@ark/util";
|
|
2
|
+
import type { ArkSchemaRegistry } from "../config.ts";
|
|
3
|
+
export declare const registryName: string;
|
|
4
|
+
export declare const $ark: ArkSchemaRegistry;
|
|
5
|
+
export declare const reference: (name: string) => RegisteredReference;
|
|
6
|
+
export declare const registeredReference: (value: object | symbol) => RegisteredReference;
|
|
7
|
+
export type RegisteredReference<to extends string = string> = `$ark${"" | NonNegativeIntegerLiteral}.${to}`;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { register, registry } from "@ark/util";
|
|
2
|
+
let _registryName = "$ark";
|
|
3
|
+
let suffix = 2;
|
|
4
|
+
while (_registryName in globalThis)
|
|
5
|
+
_registryName = `$ark${suffix++}`;
|
|
6
|
+
export const registryName = _registryName;
|
|
7
|
+
globalThis[registryName] = registry;
|
|
8
|
+
export const $ark = registry;
|
|
9
|
+
export const reference = (name) => `${registryName}.${name}`;
|
|
10
|
+
export const registeredReference = (value) => reference(register(value));
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/** From https://github.com/standard-schema/standard-schema */
|
|
2
|
+
/** The Standard Typed interface. This is a base type extended by other specs. */
|
|
3
|
+
export interface StandardTypedV1<Input = unknown, Output = Input> {
|
|
4
|
+
/** The Standard properties. */
|
|
5
|
+
readonly "~standard": StandardTypedV1.Props<Input, Output>;
|
|
6
|
+
}
|
|
7
|
+
export declare namespace StandardTypedV1 {
|
|
8
|
+
/** The Standard Typed properties interface. */
|
|
9
|
+
interface Props<Input = unknown, Output = Input> {
|
|
10
|
+
/** The version number of the standard. */
|
|
11
|
+
readonly version: 1;
|
|
12
|
+
/** The vendor name of the schema library. */
|
|
13
|
+
readonly vendor: string;
|
|
14
|
+
/** Inferred types associated with the schema. */
|
|
15
|
+
readonly types?: Types<Input, Output> | undefined;
|
|
16
|
+
}
|
|
17
|
+
/** The Standard Typed types interface. */
|
|
18
|
+
interface Types<Input = unknown, Output = Input> {
|
|
19
|
+
/** The input type of the schema. */
|
|
20
|
+
readonly input: Input;
|
|
21
|
+
/** The output type of the schema. */
|
|
22
|
+
readonly output: Output;
|
|
23
|
+
}
|
|
24
|
+
/** Infers the input type of a Standard Typed. */
|
|
25
|
+
type InferInput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
26
|
+
/** Infers the output type of a Standard Typed. */
|
|
27
|
+
type InferOutput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
28
|
+
}
|
|
29
|
+
/** The Standard Schema interface. */
|
|
30
|
+
export interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
31
|
+
/** The Standard Schema properties. */
|
|
32
|
+
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
|
33
|
+
}
|
|
34
|
+
export declare namespace StandardSchemaV1 {
|
|
35
|
+
/** The Standard Schema properties interface. */
|
|
36
|
+
interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {
|
|
37
|
+
/** Validates unknown input values. */
|
|
38
|
+
readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result<Output> | Promise<Result<Output>>;
|
|
39
|
+
}
|
|
40
|
+
/** The result interface of the validate function. */
|
|
41
|
+
type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
42
|
+
/** The result interface if validation succeeds. */
|
|
43
|
+
interface SuccessResult<Output> {
|
|
44
|
+
/** The typed output value. */
|
|
45
|
+
readonly value: Output;
|
|
46
|
+
/** A falsy value for `issues` indicates success. */
|
|
47
|
+
readonly issues?: undefined;
|
|
48
|
+
}
|
|
49
|
+
interface Options {
|
|
50
|
+
/** Explicit support for additional vendor-specific parameters, if needed. */
|
|
51
|
+
readonly libraryOptions?: Record<string, unknown> | undefined;
|
|
52
|
+
}
|
|
53
|
+
/** The result interface if validation fails. */
|
|
54
|
+
interface FailureResult {
|
|
55
|
+
/** The issues of failed validation. */
|
|
56
|
+
readonly issues: ReadonlyArray<Issue>;
|
|
57
|
+
}
|
|
58
|
+
/** The issue interface of the failure output. */
|
|
59
|
+
interface Issue {
|
|
60
|
+
/** The error message of the issue. */
|
|
61
|
+
readonly message: string;
|
|
62
|
+
/** The path of the issue, if any. */
|
|
63
|
+
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
64
|
+
}
|
|
65
|
+
/** The path segment interface of the issue. */
|
|
66
|
+
interface PathSegment {
|
|
67
|
+
/** The key representing a path segment. */
|
|
68
|
+
readonly key: PropertyKey;
|
|
69
|
+
}
|
|
70
|
+
/** The Standard types interface. */
|
|
71
|
+
interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {
|
|
72
|
+
}
|
|
73
|
+
/** Infers the input type of a Standard. */
|
|
74
|
+
type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
|
|
75
|
+
/** Infers the output type of a Standard. */
|
|
76
|
+
type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
|
|
77
|
+
/** ArkType-specific properties that extend the standard schema with JSON Schema support. */
|
|
78
|
+
interface ArkTypeProps<Input = unknown, Output = Input> extends Props<Input, Output>, StandardJSONSchemaV1.Props<Input, Output> {
|
|
79
|
+
vendor: "arktype";
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/** The Standard JSON Schema interface. */
|
|
83
|
+
export interface StandardJSONSchemaV1<Input = unknown, Output = Input> {
|
|
84
|
+
/** The Standard JSON Schema properties. */
|
|
85
|
+
readonly "~standard": StandardJSONSchemaV1.Props<Input, Output>;
|
|
86
|
+
}
|
|
87
|
+
export declare namespace StandardJSONSchemaV1 {
|
|
88
|
+
/** The Standard JSON Schema properties interface. */
|
|
89
|
+
interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {
|
|
90
|
+
/** Methods for generating the input/output JSON Schema. */
|
|
91
|
+
readonly jsonSchema: StandardJSONSchemaV1.Converter;
|
|
92
|
+
}
|
|
93
|
+
/** The Standard JSON Schema converter interface. */
|
|
94
|
+
interface Converter {
|
|
95
|
+
/** Converts the input type to JSON Schema. May throw if conversion is not supported. */
|
|
96
|
+
readonly input: (options: StandardJSONSchemaV1.Options) => Record<string, unknown>;
|
|
97
|
+
/** Converts the output type to JSON Schema. May throw if conversion is not supported. */
|
|
98
|
+
readonly output: (options: StandardJSONSchemaV1.Options) => Record<string, unknown>;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* The target version of the generated JSON Schema.
|
|
102
|
+
*
|
|
103
|
+
* It is *strongly recommended* that implementers support `"draft-2020-12"` and `"draft-07"`, as they are both in wide use. All other targets can be implemented on a best-effort basis. Libraries should throw if they don't support a specified target.
|
|
104
|
+
*
|
|
105
|
+
* The `"openapi-3.0"` target is intended as a standardized specifier for OpenAPI 3.0 which is a superset of JSON Schema `"draft-04"`.
|
|
106
|
+
*/
|
|
107
|
+
type Target = "draft-2020-12" | "draft-07" | "openapi-3.0" | ({} & string);
|
|
108
|
+
/** The options for the input/output methods. */
|
|
109
|
+
interface Options {
|
|
110
|
+
/** Specifies the target version of the generated JSON Schema. Support for all versions is on a best-effort basis. If a given version is not supported, the library should throw. */
|
|
111
|
+
readonly target: Target;
|
|
112
|
+
/** Explicit support for additional vendor-specific parameters, if needed. */
|
|
113
|
+
readonly libraryOptions?: Record<string, unknown> | undefined;
|
|
114
|
+
}
|
|
115
|
+
/** The Standard types interface. */
|
|
116
|
+
interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {
|
|
117
|
+
}
|
|
118
|
+
/** Infers the input type of a Standard. */
|
|
119
|
+
type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
|
|
120
|
+
/** Infers the output type of a Standard. */
|
|
121
|
+
type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
|
|
122
|
+
}
|