@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,89 @@
|
|
|
1
|
+
import { append, printable, stringAndSymbolicEntriesOf, throwParseError } from "@ark/util";
|
|
2
|
+
import { BaseConstraint } from "../constraint.js";
|
|
3
|
+
import { flatRef } from "../node.js";
|
|
4
|
+
import { Disjoint } from "../shared/disjoint.js";
|
|
5
|
+
import { implementNode } from "../shared/implement.js";
|
|
6
|
+
import { intersectOrPipeNodes } from "../shared/intersections.js";
|
|
7
|
+
import { $ark } from "../shared/registry.js";
|
|
8
|
+
import { traverseKey } from "../shared/traversal.js";
|
|
9
|
+
const implementation = implementNode({
|
|
10
|
+
kind: "index",
|
|
11
|
+
hasAssociatedError: false,
|
|
12
|
+
intersectionIsOpen: true,
|
|
13
|
+
keys: {
|
|
14
|
+
signature: {
|
|
15
|
+
child: true,
|
|
16
|
+
parse: (schema, ctx) => {
|
|
17
|
+
const key = ctx.$.parseSchema(schema);
|
|
18
|
+
if (!key.extends($ark.intrinsic.key)) {
|
|
19
|
+
return throwParseError(writeInvalidPropertyKeyMessage(key.expression));
|
|
20
|
+
}
|
|
21
|
+
const enumerableBranches = key.branches.filter(b => b.hasKind("unit"));
|
|
22
|
+
if (enumerableBranches.length) {
|
|
23
|
+
return throwParseError(writeEnumerableIndexBranches(enumerableBranches.map(b => printable(b.unit))));
|
|
24
|
+
}
|
|
25
|
+
return key;
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
value: {
|
|
29
|
+
child: true,
|
|
30
|
+
parse: (schema, ctx) => ctx.$.parseSchema(schema)
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
normalize: schema => schema,
|
|
34
|
+
defaults: {
|
|
35
|
+
description: node => `[${node.signature.expression}]: ${node.value.description}`
|
|
36
|
+
},
|
|
37
|
+
intersections: {
|
|
38
|
+
index: (l, r, ctx) => {
|
|
39
|
+
if (l.signature.equals(r.signature)) {
|
|
40
|
+
const valueIntersection = intersectOrPipeNodes(l.value, r.value, ctx);
|
|
41
|
+
const value = valueIntersection instanceof Disjoint ?
|
|
42
|
+
$ark.intrinsic.never.internal
|
|
43
|
+
: valueIntersection;
|
|
44
|
+
return ctx.$.node("index", { signature: l.signature, value });
|
|
45
|
+
}
|
|
46
|
+
// if r constrains all of l's keys to a subtype of l's value, r is a subtype of l
|
|
47
|
+
if (l.signature.extends(r.signature) && l.value.subsumes(r.value))
|
|
48
|
+
return r;
|
|
49
|
+
// if l constrains all of r's keys to a subtype of r's value, l is a subtype of r
|
|
50
|
+
if (r.signature.extends(l.signature) && r.value.subsumes(l.value))
|
|
51
|
+
return l;
|
|
52
|
+
// other relationships between index signatures can't be generally reduced
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
export class IndexNode extends BaseConstraint {
|
|
58
|
+
impliedBasis = $ark.intrinsic.object.internal;
|
|
59
|
+
expression = `[${this.signature.expression}]: ${this.value.expression}`;
|
|
60
|
+
flatRefs = append(this.value.flatRefs.map(ref => flatRef([this.signature, ...ref.path], ref.node)), flatRef([this.signature], this.value));
|
|
61
|
+
traverseAllows = (data, ctx) => stringAndSymbolicEntriesOf(data).every(entry => {
|
|
62
|
+
if (this.signature.traverseAllows(entry[0], ctx)) {
|
|
63
|
+
return traverseKey(entry[0], () => this.value.traverseAllows(entry[1], ctx), ctx);
|
|
64
|
+
}
|
|
65
|
+
return true;
|
|
66
|
+
});
|
|
67
|
+
traverseApply = (data, ctx) => {
|
|
68
|
+
for (const entry of stringAndSymbolicEntriesOf(data)) {
|
|
69
|
+
if (this.signature.traverseAllows(entry[0], ctx)) {
|
|
70
|
+
traverseKey(entry[0], () => this.value.traverseApply(entry[1], ctx), ctx);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
_transform(mapper, ctx) {
|
|
75
|
+
ctx.path.push(this.signature);
|
|
76
|
+
const result = super._transform(mapper, ctx);
|
|
77
|
+
ctx.path.pop();
|
|
78
|
+
return result;
|
|
79
|
+
}
|
|
80
|
+
compile() {
|
|
81
|
+
// this is currently handled by StructureNode
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
export const Index = {
|
|
85
|
+
implementation,
|
|
86
|
+
Node: IndexNode
|
|
87
|
+
};
|
|
88
|
+
export const writeEnumerableIndexBranches = (keys) => `Index keys ${keys.join(", ")} should be specified as named props.`;
|
|
89
|
+
export const writeInvalidPropertyKeyMessage = (indexSchema) => `Indexed key definition '${indexSchema}' must be a string or symbol`;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type requireKeys } from "@ark/util";
|
|
2
|
+
import type { Morph } from "../roots/morph.ts";
|
|
3
|
+
import type { BaseRoot } from "../roots/root.ts";
|
|
4
|
+
import type { declareNode } from "../shared/declare.ts";
|
|
5
|
+
import { type nodeImplementationOf } from "../shared/implement.ts";
|
|
6
|
+
import { BaseProp, type Prop } from "./prop.ts";
|
|
7
|
+
export declare namespace Optional {
|
|
8
|
+
interface Schema extends Prop.Schema {
|
|
9
|
+
default?: unknown;
|
|
10
|
+
}
|
|
11
|
+
interface Inner extends Prop.Inner {
|
|
12
|
+
default?: unknown;
|
|
13
|
+
}
|
|
14
|
+
type Declaration = declareNode<Prop.Declaration<"optional"> & {
|
|
15
|
+
schema: Schema;
|
|
16
|
+
normalizedSchema: Schema;
|
|
17
|
+
inner: Inner;
|
|
18
|
+
}>;
|
|
19
|
+
type Node = OptionalNode;
|
|
20
|
+
namespace Node {
|
|
21
|
+
type withDefault = requireKeys<Node, "default" | "defaultValueMorph" | "defaultValueMorphRef">;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export declare class OptionalNode extends BaseProp<"optional"> {
|
|
25
|
+
constructor(...args: ConstructorParameters<typeof BaseProp>);
|
|
26
|
+
get rawIn(): OptionalNode;
|
|
27
|
+
get outProp(): Prop.Node;
|
|
28
|
+
expression: string;
|
|
29
|
+
defaultValueMorph: Morph | undefined;
|
|
30
|
+
defaultValueMorphRef: string | undefined;
|
|
31
|
+
}
|
|
32
|
+
export declare const Optional: {
|
|
33
|
+
implementation: nodeImplementationOf<{
|
|
34
|
+
reducibleTo: "optional";
|
|
35
|
+
errorContext: null;
|
|
36
|
+
kind: "optional";
|
|
37
|
+
prerequisite: object;
|
|
38
|
+
intersectionIsOpen: true;
|
|
39
|
+
childKind: import("../shared/implement.ts").RootKind;
|
|
40
|
+
schema: Optional.Schema;
|
|
41
|
+
normalizedSchema: Optional.Schema;
|
|
42
|
+
inner: Optional.Inner;
|
|
43
|
+
}>;
|
|
44
|
+
Node: typeof OptionalNode;
|
|
45
|
+
};
|
|
46
|
+
export declare const computeDefaultValueMorph: (key: PropertyKey, value: BaseRoot, defaultInput: unknown) => Morph<any>;
|
|
47
|
+
export declare const assertDefaultValueAssignability: (node: BaseRoot, value: unknown, key: PropertyKey | null) => unknown;
|
|
48
|
+
export type writeUnassignableDefaultValueMessage<baseDef extends string, defaultValue extends string> = `Default value ${defaultValue} must be assignable to ${baseDef}`;
|
|
49
|
+
export declare const writeNonPrimitiveNonFunctionDefaultValueMessage: (key: PropertyKey | null) => string;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { hasDomain, isThunk, omit, printable, throwParseError } from "@ark/util";
|
|
2
|
+
import { intrinsic } from "../intrinsic.js";
|
|
3
|
+
import { compileSerializedValue } from "../shared/compile.js";
|
|
4
|
+
import { ArkErrors } from "../shared/errors.js";
|
|
5
|
+
import { defaultValueSerializer, implementNode } from "../shared/implement.js";
|
|
6
|
+
import { registeredReference } from "../shared/registry.js";
|
|
7
|
+
import { traverseKey } from "../shared/traversal.js";
|
|
8
|
+
import { BaseProp, intersectProps } from "./prop.js";
|
|
9
|
+
const implementation = implementNode({
|
|
10
|
+
kind: "optional",
|
|
11
|
+
hasAssociatedError: false,
|
|
12
|
+
intersectionIsOpen: true,
|
|
13
|
+
keys: {
|
|
14
|
+
key: {},
|
|
15
|
+
value: {
|
|
16
|
+
child: true,
|
|
17
|
+
parse: (schema, ctx) => ctx.$.parseSchema(schema)
|
|
18
|
+
},
|
|
19
|
+
default: {
|
|
20
|
+
preserveUndefined: true
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
normalize: schema => schema,
|
|
24
|
+
reduce: (inner, $) => {
|
|
25
|
+
if ($.resolvedConfig.exactOptionalPropertyTypes === false) {
|
|
26
|
+
if (!inner.value.allows(undefined)) {
|
|
27
|
+
return $.node("optional", { ...inner, value: inner.value.or(intrinsic.undefined) }, { prereduced: true });
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
defaults: {
|
|
32
|
+
description: node => `${node.compiledKey}?: ${node.value.description}`
|
|
33
|
+
},
|
|
34
|
+
intersections: {
|
|
35
|
+
optional: intersectProps
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
export class OptionalNode extends BaseProp {
|
|
39
|
+
constructor(...args) {
|
|
40
|
+
super(...args);
|
|
41
|
+
if ("default" in this.inner)
|
|
42
|
+
assertDefaultValueAssignability(this.value, this.inner.default, this.key);
|
|
43
|
+
}
|
|
44
|
+
get rawIn() {
|
|
45
|
+
const baseIn = super.rawIn;
|
|
46
|
+
if (!this.hasDefault())
|
|
47
|
+
return baseIn;
|
|
48
|
+
return this.$.node("optional", omit(baseIn.inner, { default: true }), {
|
|
49
|
+
prereduced: true
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
get outProp() {
|
|
53
|
+
if (!this.hasDefault())
|
|
54
|
+
return this;
|
|
55
|
+
const { default: defaultValue, ...requiredInner } = this.inner;
|
|
56
|
+
return this.cacheGetter("outProp", this.$.node("required", requiredInner, { prereduced: true }));
|
|
57
|
+
}
|
|
58
|
+
expression = this.hasDefault() ?
|
|
59
|
+
`${this.compiledKey}: ${this.value.expression} = ${printable(this.inner.default)}`
|
|
60
|
+
: `${this.compiledKey}?: ${this.value.expression}`;
|
|
61
|
+
defaultValueMorph = getDefaultableMorph(this);
|
|
62
|
+
defaultValueMorphRef = this.defaultValueMorph && registeredReference(this.defaultValueMorph);
|
|
63
|
+
}
|
|
64
|
+
export const Optional = {
|
|
65
|
+
implementation,
|
|
66
|
+
Node: OptionalNode
|
|
67
|
+
};
|
|
68
|
+
const defaultableMorphCache = {};
|
|
69
|
+
const getDefaultableMorph = (node) => {
|
|
70
|
+
if (!node.hasDefault())
|
|
71
|
+
return;
|
|
72
|
+
const cacheKey = `{${node.compiledKey}: ${node.value.id} = ${defaultValueSerializer(node.default)}}`;
|
|
73
|
+
return (defaultableMorphCache[cacheKey] ??= computeDefaultValueMorph(node.key, node.value, node.default));
|
|
74
|
+
};
|
|
75
|
+
export const computeDefaultValueMorph = (key, value, defaultInput) => {
|
|
76
|
+
if (typeof defaultInput === "function") {
|
|
77
|
+
// if the value has a morph, pipe context through it
|
|
78
|
+
return value.includesTransform ?
|
|
79
|
+
(data, ctx) => {
|
|
80
|
+
traverseKey(key, () => value((data[key] = defaultInput()), ctx), ctx);
|
|
81
|
+
return data;
|
|
82
|
+
}
|
|
83
|
+
: data => {
|
|
84
|
+
data[key] = defaultInput();
|
|
85
|
+
return data;
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
// non-functional defaults can be safely cached as long as the morph is
|
|
89
|
+
// guaranteed to be pure and the output is primitive
|
|
90
|
+
const precomputedMorphedDefault = value.includesTransform ? value.assert(defaultInput) : defaultInput;
|
|
91
|
+
return hasDomain(precomputedMorphedDefault, "object") ?
|
|
92
|
+
// the type signature only allows this if the value was morphed
|
|
93
|
+
(data, ctx) => {
|
|
94
|
+
traverseKey(key, () => value((data[key] = defaultInput), ctx), ctx);
|
|
95
|
+
return data;
|
|
96
|
+
}
|
|
97
|
+
: data => {
|
|
98
|
+
data[key] = precomputedMorphedDefault;
|
|
99
|
+
return data;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
export const assertDefaultValueAssignability = (node, value, key) => {
|
|
103
|
+
const wrapped = isThunk(value);
|
|
104
|
+
if (hasDomain(value, "object") && !wrapped)
|
|
105
|
+
throwParseError(writeNonPrimitiveNonFunctionDefaultValueMessage(key));
|
|
106
|
+
// if the node has a default value, finalize it and apply JIT optimizations
|
|
107
|
+
// if applicable to ensure behavior + error logging is externally consistent
|
|
108
|
+
// (using .in here insead of .rawIn triggers finalization)
|
|
109
|
+
const out = node.in(wrapped ? value() : value);
|
|
110
|
+
if (out instanceof ArkErrors) {
|
|
111
|
+
if (key === null) {
|
|
112
|
+
// e.g. "Default must be assignable to number (was string)"
|
|
113
|
+
throwParseError(`Default ${out.summary}`);
|
|
114
|
+
}
|
|
115
|
+
const atPath = out.transform(e => e.transform(input => ({ ...input, prefixPath: [key] })));
|
|
116
|
+
// e.g. "Default for bar must be assignable to number (was string)"
|
|
117
|
+
// e.g. "Default for value at [0] must be assignable to number (was string)"
|
|
118
|
+
throwParseError(`Default for ${atPath.summary}`);
|
|
119
|
+
}
|
|
120
|
+
return value;
|
|
121
|
+
};
|
|
122
|
+
export const writeNonPrimitiveNonFunctionDefaultValueMessage = (key) => {
|
|
123
|
+
const keyDescription = key === null ? ""
|
|
124
|
+
: typeof key === "number" ? `for value at [${key}] `
|
|
125
|
+
: `for ${compileSerializedValue(key)} `;
|
|
126
|
+
return `Non-primitive default ${keyDescription}must be specified as a function like () => ({my: 'object'})`;
|
|
127
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type Key } from "@ark/util";
|
|
2
|
+
import { BaseConstraint } from "../constraint.ts";
|
|
3
|
+
import type { nodeOfKind, RootSchema } from "../kinds.ts";
|
|
4
|
+
import { type BaseNode, type DeepNodeTransformation, type DeepNodeTransformContext, type FlatRef } from "../node.ts";
|
|
5
|
+
import type { BaseRoot } from "../roots/root.ts";
|
|
6
|
+
import { type NodeCompiler } from "../shared/compile.ts";
|
|
7
|
+
import type { BaseNormalizedSchema } from "../shared/declare.ts";
|
|
8
|
+
import { Disjoint } from "../shared/disjoint.ts";
|
|
9
|
+
import type { IntersectionContext, RootKind } from "../shared/implement.ts";
|
|
10
|
+
import { type TraverseAllows, type TraverseApply } from "../shared/traversal.ts";
|
|
11
|
+
import type { Optional } from "./optional.ts";
|
|
12
|
+
import type { Required } from "./required.ts";
|
|
13
|
+
export declare namespace Prop {
|
|
14
|
+
type Kind = "required" | "optional";
|
|
15
|
+
type Node = nodeOfKind<Kind>;
|
|
16
|
+
interface Schema extends BaseNormalizedSchema {
|
|
17
|
+
readonly key: Key;
|
|
18
|
+
readonly value: RootSchema;
|
|
19
|
+
}
|
|
20
|
+
interface Inner {
|
|
21
|
+
readonly key: Key;
|
|
22
|
+
readonly value: BaseRoot;
|
|
23
|
+
}
|
|
24
|
+
interface Declaration<kind extends Kind = Kind> {
|
|
25
|
+
kind: kind;
|
|
26
|
+
prerequisite: object;
|
|
27
|
+
intersectionIsOpen: true;
|
|
28
|
+
childKind: RootKind;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export declare const intersectProps: (l: nodeOfKind<Prop.Kind>, r: nodeOfKind<Prop.Kind>, ctx: IntersectionContext) => nodeOfKind<Prop.Kind> | Disjoint | null;
|
|
32
|
+
export declare abstract class BaseProp<kind extends Prop.Kind = Prop.Kind> extends BaseConstraint<kind extends "required" ? Required.Declaration : Optional.Declaration> {
|
|
33
|
+
required: boolean;
|
|
34
|
+
optional: boolean;
|
|
35
|
+
impliedBasis: BaseRoot;
|
|
36
|
+
serializedKey: string;
|
|
37
|
+
compiledKey: string;
|
|
38
|
+
flatRefs: FlatRef[];
|
|
39
|
+
protected _transform(mapper: DeepNodeTransformation, ctx: DeepNodeTransformContext): BaseNode | null;
|
|
40
|
+
hasDefault(): this is Optional.Node.withDefault;
|
|
41
|
+
traverseAllows: TraverseAllows<object>;
|
|
42
|
+
traverseApply: TraverseApply<object>;
|
|
43
|
+
compile(js: NodeCompiler): void;
|
|
44
|
+
}
|
|
45
|
+
export declare const writeDefaultIntersectionMessage: (lValue: unknown, rValue: unknown) => string;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { append, printable, throwParseError, unset } from "@ark/util";
|
|
2
|
+
import { BaseConstraint } from "../constraint.js";
|
|
3
|
+
import { flatRef } from "../node.js";
|
|
4
|
+
import { compileSerializedValue } from "../shared/compile.js";
|
|
5
|
+
import { Disjoint } from "../shared/disjoint.js";
|
|
6
|
+
import { intersectOrPipeNodes } from "../shared/intersections.js";
|
|
7
|
+
import { $ark } from "../shared/registry.js";
|
|
8
|
+
import { traverseKey } from "../shared/traversal.js";
|
|
9
|
+
export const intersectProps = (l, r, ctx) => {
|
|
10
|
+
if (l.key !== r.key)
|
|
11
|
+
return null;
|
|
12
|
+
const key = l.key;
|
|
13
|
+
let value = intersectOrPipeNodes(l.value, r.value, ctx);
|
|
14
|
+
const kind = l.required || r.required ? "required" : "optional";
|
|
15
|
+
if (value instanceof Disjoint) {
|
|
16
|
+
if (kind === "optional")
|
|
17
|
+
value = $ark.intrinsic.never.internal;
|
|
18
|
+
else {
|
|
19
|
+
// if either operand was optional, the Disjoint has to be treated as optional
|
|
20
|
+
return value.withPrefixKey(l.key, l.required && r.required ? "required" : "optional");
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
if (kind === "required") {
|
|
24
|
+
return ctx.$.node("required", {
|
|
25
|
+
key,
|
|
26
|
+
value
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
const defaultIntersection = l.hasDefault() ?
|
|
30
|
+
r.hasDefault() ?
|
|
31
|
+
l.default === r.default ?
|
|
32
|
+
l.default
|
|
33
|
+
: throwParseError(writeDefaultIntersectionMessage(l.default, r.default))
|
|
34
|
+
: l.default
|
|
35
|
+
: r.hasDefault() ? r.default
|
|
36
|
+
: unset;
|
|
37
|
+
return ctx.$.node("optional", {
|
|
38
|
+
key,
|
|
39
|
+
value,
|
|
40
|
+
// unset is stripped during parsing
|
|
41
|
+
default: defaultIntersection
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
export class BaseProp extends BaseConstraint {
|
|
45
|
+
required = this.kind === "required";
|
|
46
|
+
optional = this.kind === "optional";
|
|
47
|
+
impliedBasis = $ark.intrinsic.object.internal;
|
|
48
|
+
serializedKey = compileSerializedValue(this.key);
|
|
49
|
+
compiledKey = typeof this.key === "string" ? this.key : this.serializedKey;
|
|
50
|
+
flatRefs = append(this.value.flatRefs.map(ref => flatRef([this.key, ...ref.path], ref.node)), flatRef([this.key], this.value));
|
|
51
|
+
_transform(mapper, ctx) {
|
|
52
|
+
ctx.path.push(this.key);
|
|
53
|
+
const result = super._transform(mapper, ctx);
|
|
54
|
+
ctx.path.pop();
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
57
|
+
hasDefault() {
|
|
58
|
+
return "default" in this.inner;
|
|
59
|
+
}
|
|
60
|
+
traverseAllows = (data, ctx) => {
|
|
61
|
+
if (this.key in data) {
|
|
62
|
+
// ctx will be undefined if this node isn't context-dependent
|
|
63
|
+
return traverseKey(this.key, () => this.value.traverseAllows(data[this.key], ctx), ctx);
|
|
64
|
+
}
|
|
65
|
+
return this.optional;
|
|
66
|
+
};
|
|
67
|
+
traverseApply = (data, ctx) => {
|
|
68
|
+
if (this.key in data) {
|
|
69
|
+
traverseKey(this.key, () => this.value.traverseApply(data[this.key], ctx), ctx);
|
|
70
|
+
}
|
|
71
|
+
else if (this.hasKind("required"))
|
|
72
|
+
ctx.errorFromNodeContext(this.errorContext);
|
|
73
|
+
};
|
|
74
|
+
compile(js) {
|
|
75
|
+
js.if(`${this.serializedKey} in data`, () => js.traverseKey(this.serializedKey, `data${js.prop(this.key)}`, this.value));
|
|
76
|
+
if (this.hasKind("required")) {
|
|
77
|
+
js.else(() => js.traversalKind === "Apply" ?
|
|
78
|
+
js.line(`ctx.errorFromNodeContext(${this.compiledErrorContext})`)
|
|
79
|
+
: js.return(false));
|
|
80
|
+
}
|
|
81
|
+
if (js.traversalKind === "Allows")
|
|
82
|
+
js.return(true);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
export const writeDefaultIntersectionMessage = (lValue, rValue) => `Invalid intersection of default values ${printable(lValue)} & ${printable(rValue)}`;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { BaseErrorContext, declareNode } from "../shared/declare.ts";
|
|
2
|
+
import type { NodeErrorContextInput } from "../shared/errors.ts";
|
|
3
|
+
import { type nodeImplementationOf } from "../shared/implement.ts";
|
|
4
|
+
import { BaseProp, type Prop } from "./prop.ts";
|
|
5
|
+
export declare namespace Required {
|
|
6
|
+
interface ErrorContext extends BaseErrorContext<"required"> {
|
|
7
|
+
missingValueDescription: string;
|
|
8
|
+
}
|
|
9
|
+
interface Schema extends Prop.Schema {
|
|
10
|
+
}
|
|
11
|
+
interface Inner extends Prop.Inner {
|
|
12
|
+
}
|
|
13
|
+
type Declaration = declareNode<Prop.Declaration<"required"> & {
|
|
14
|
+
schema: Schema;
|
|
15
|
+
normalizedSchema: Schema;
|
|
16
|
+
inner: Inner;
|
|
17
|
+
errorContext: ErrorContext;
|
|
18
|
+
}>;
|
|
19
|
+
type Node = RequiredNode;
|
|
20
|
+
}
|
|
21
|
+
export declare class RequiredNode extends BaseProp<"required"> {
|
|
22
|
+
expression: string;
|
|
23
|
+
errorContext: NodeErrorContextInput<"required">;
|
|
24
|
+
compiledErrorContext: string;
|
|
25
|
+
}
|
|
26
|
+
export declare const Required: {
|
|
27
|
+
implementation: nodeImplementationOf<{
|
|
28
|
+
reducibleTo: "required";
|
|
29
|
+
kind: "required";
|
|
30
|
+
prerequisite: object;
|
|
31
|
+
intersectionIsOpen: true;
|
|
32
|
+
childKind: import("../shared/implement.ts").RootKind;
|
|
33
|
+
schema: Required.Schema;
|
|
34
|
+
normalizedSchema: Required.Schema;
|
|
35
|
+
inner: Required.Inner;
|
|
36
|
+
errorContext: Required.ErrorContext;
|
|
37
|
+
}>;
|
|
38
|
+
Node: typeof RequiredNode;
|
|
39
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { compileObjectLiteral, implementNode } from "../shared/implement.js";
|
|
2
|
+
import { BaseProp, intersectProps } from "./prop.js";
|
|
3
|
+
const implementation = implementNode({
|
|
4
|
+
kind: "required",
|
|
5
|
+
hasAssociatedError: true,
|
|
6
|
+
intersectionIsOpen: true,
|
|
7
|
+
keys: {
|
|
8
|
+
key: {},
|
|
9
|
+
value: {
|
|
10
|
+
child: true,
|
|
11
|
+
parse: (schema, ctx) => ctx.$.parseSchema(schema)
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
normalize: schema => schema,
|
|
15
|
+
defaults: {
|
|
16
|
+
description: node => `${node.compiledKey}: ${node.value.description}`,
|
|
17
|
+
expected: ctx => ctx.missingValueDescription,
|
|
18
|
+
actual: () => "missing"
|
|
19
|
+
},
|
|
20
|
+
intersections: {
|
|
21
|
+
required: intersectProps,
|
|
22
|
+
optional: intersectProps
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
export class RequiredNode extends BaseProp {
|
|
26
|
+
expression = `${this.compiledKey}: ${this.value.expression}`;
|
|
27
|
+
errorContext = Object.freeze({
|
|
28
|
+
code: "required",
|
|
29
|
+
missingValueDescription: this.value.defaultShortDescription,
|
|
30
|
+
relativePath: [this.key],
|
|
31
|
+
meta: this.meta
|
|
32
|
+
});
|
|
33
|
+
compiledErrorContext = compileObjectLiteral(this.errorContext);
|
|
34
|
+
}
|
|
35
|
+
export const Required = {
|
|
36
|
+
implementation,
|
|
37
|
+
Node: RequiredNode
|
|
38
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { type array, type satisfy } from "@ark/util";
|
|
2
|
+
import { BaseConstraint } from "../constraint.ts";
|
|
3
|
+
import type { RootSchema } from "../kinds.ts";
|
|
4
|
+
import { type BaseNode, type DeepNodeTransformContext, type DeepNodeTransformation, type FlatRef } from "../node.ts";
|
|
5
|
+
import type { ExactLengthNode } from "../refinements/exactLength.ts";
|
|
6
|
+
import type { MaxLengthNode } from "../refinements/maxLength.ts";
|
|
7
|
+
import type { MinLengthNode } from "../refinements/minLength.ts";
|
|
8
|
+
import type { Morph } from "../roots/morph.ts";
|
|
9
|
+
import type { BaseRoot } from "../roots/root.ts";
|
|
10
|
+
import type { NodeCompiler } from "../shared/compile.ts";
|
|
11
|
+
import type { BaseNormalizedSchema, declareNode } from "../shared/declare.ts";
|
|
12
|
+
import { type RootKind, type nodeImplementationOf } from "../shared/implement.ts";
|
|
13
|
+
import type { JsonSchema } from "../shared/jsonSchema.ts";
|
|
14
|
+
import type { ToJsonSchema } from "../shared/toJsonSchema.ts";
|
|
15
|
+
import { type TraverseAllows, type TraverseApply } from "../shared/traversal.ts";
|
|
16
|
+
export declare namespace Sequence {
|
|
17
|
+
interface NormalizedSchema extends BaseNormalizedSchema {
|
|
18
|
+
readonly prefix?: array<RootSchema>;
|
|
19
|
+
readonly defaultables?: array<DefaultableSchema>;
|
|
20
|
+
readonly optionals?: array<RootSchema>;
|
|
21
|
+
readonly variadic?: RootSchema;
|
|
22
|
+
readonly minVariadicLength?: number;
|
|
23
|
+
readonly postfix?: array<RootSchema>;
|
|
24
|
+
}
|
|
25
|
+
type Schema = NormalizedSchema | RootSchema;
|
|
26
|
+
type DefaultableSchema = [schema: RootSchema, defaultValue: unknown];
|
|
27
|
+
type DefaultableElement = [node: BaseRoot, defaultValue: unknown];
|
|
28
|
+
interface Inner {
|
|
29
|
+
readonly prefix?: array<BaseRoot>;
|
|
30
|
+
readonly defaultables?: array<DefaultableElement>;
|
|
31
|
+
readonly optionals?: array<BaseRoot>;
|
|
32
|
+
readonly variadic?: BaseRoot;
|
|
33
|
+
readonly minVariadicLength?: number;
|
|
34
|
+
readonly postfix?: array<BaseRoot>;
|
|
35
|
+
}
|
|
36
|
+
interface Declaration extends declareNode<{
|
|
37
|
+
kind: "sequence";
|
|
38
|
+
schema: Schema;
|
|
39
|
+
normalizedSchema: NormalizedSchema;
|
|
40
|
+
inner: Inner;
|
|
41
|
+
prerequisite: array;
|
|
42
|
+
reducibleTo: "sequence";
|
|
43
|
+
childKind: RootKind;
|
|
44
|
+
}> {
|
|
45
|
+
}
|
|
46
|
+
type Node = SequenceNode;
|
|
47
|
+
}
|
|
48
|
+
export declare class SequenceNode extends BaseConstraint<Sequence.Declaration> {
|
|
49
|
+
impliedBasis: BaseRoot;
|
|
50
|
+
tuple: SequenceTuple;
|
|
51
|
+
prefixLength: number;
|
|
52
|
+
defaultablesLength: number;
|
|
53
|
+
optionalsLength: number;
|
|
54
|
+
postfixLength: number;
|
|
55
|
+
defaultablesAndOptionals: BaseRoot[];
|
|
56
|
+
prevariadic: array<PrevariadicSequenceElement>;
|
|
57
|
+
variadicOrPostfix: array<BaseRoot>;
|
|
58
|
+
flatRefs: FlatRef[];
|
|
59
|
+
protected addFlatRefs(): FlatRef[];
|
|
60
|
+
isVariadicOnly: boolean;
|
|
61
|
+
minVariadicLength: number;
|
|
62
|
+
minLength: number;
|
|
63
|
+
minLengthNode: MinLengthNode | null;
|
|
64
|
+
maxLength: number | null;
|
|
65
|
+
maxLengthNode: MaxLengthNode | ExactLengthNode | null;
|
|
66
|
+
impliedSiblings: array<MaxLengthNode | MinLengthNode | ExactLengthNode>;
|
|
67
|
+
defaultValueMorphs: Morph[];
|
|
68
|
+
defaultValueMorphsReference: `$ark.${string}` | `$ark0.${string}` | `$ark${`2${string}` & `${bigint}`}.${string}` | `$ark${`1${string}` & `${bigint}`}.${string}` | `$ark${`3${string}` & `${bigint}`}.${string}` | `$ark${`4${string}` & `${bigint}`}.${string}` | `$ark${`5${string}` & `${bigint}`}.${string}` | `$ark${`6${string}` & `${bigint}`}.${string}` | `$ark${`7${string}` & `${bigint}`}.${string}` | `$ark${`8${string}` & `${bigint}`}.${string}` | `$ark${`9${string}` & `${bigint}`}.${string}` | undefined;
|
|
69
|
+
protected elementAtIndex(data: array, index: number): SequenceElement;
|
|
70
|
+
traverseAllows: TraverseAllows<array>;
|
|
71
|
+
traverseApply: TraverseApply<array>;
|
|
72
|
+
get element(): BaseRoot;
|
|
73
|
+
compile(js: NodeCompiler): void;
|
|
74
|
+
protected _transform(mapper: DeepNodeTransformation, ctx: DeepNodeTransformContext): BaseNode | null;
|
|
75
|
+
expression: string;
|
|
76
|
+
reduceJsonSchema(schema: JsonSchema.Array, ctx: ToJsonSchema.Context): JsonSchema.Array;
|
|
77
|
+
}
|
|
78
|
+
export declare const Sequence: {
|
|
79
|
+
implementation: nodeImplementationOf<Sequence.Declaration>;
|
|
80
|
+
Node: typeof SequenceNode;
|
|
81
|
+
};
|
|
82
|
+
export declare const postfixAfterOptionalOrDefaultableMessage = "A postfix required element cannot follow an optional or defaultable element";
|
|
83
|
+
export type postfixAfterOptionalOrDefaultableMessage = typeof postfixAfterOptionalOrDefaultableMessage;
|
|
84
|
+
export declare const postfixWithoutVariadicMessage = "A postfix element requires a variadic element";
|
|
85
|
+
export type postfixWithoutVariadicMessage = typeof postfixWithoutVariadicMessage;
|
|
86
|
+
export type SequenceElement = PrevariadicSequenceElement | VariadicSequenceElement | PostfixSequenceElement;
|
|
87
|
+
export type SequenceElementKind = satisfy<keyof Sequence.Inner, SequenceElement["kind"]>;
|
|
88
|
+
export type PrevariadicSequenceElement = PrefixSequenceElement | DefaultableSequenceElement | OptionalSequenceElement;
|
|
89
|
+
export type PrefixSequenceElement = {
|
|
90
|
+
kind: "prefix";
|
|
91
|
+
node: BaseRoot;
|
|
92
|
+
};
|
|
93
|
+
export type OptionalSequenceElement = {
|
|
94
|
+
kind: "optionals";
|
|
95
|
+
node: BaseRoot;
|
|
96
|
+
};
|
|
97
|
+
export type PostfixSequenceElement = {
|
|
98
|
+
kind: "postfix";
|
|
99
|
+
node: BaseRoot;
|
|
100
|
+
};
|
|
101
|
+
export type VariadicSequenceElement = {
|
|
102
|
+
kind: "variadic";
|
|
103
|
+
node: BaseRoot;
|
|
104
|
+
};
|
|
105
|
+
export type DefaultableSequenceElement = {
|
|
106
|
+
kind: "defaultables";
|
|
107
|
+
node: BaseRoot;
|
|
108
|
+
default: unknown;
|
|
109
|
+
};
|
|
110
|
+
export type SequenceTuple = array<SequenceElement>;
|