@blade-hq/agent-client 1.1.1 → 1.1.3
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,438 @@
|
|
|
1
|
+
import { Callable, appendUnique, flatMorph, includes, isArray, isEmptyObject, isKeyOf, liftArray, printable, stringifyPath, throwError, throwInternalError } from "@ark/util";
|
|
2
|
+
import { basisKinds, constraintKinds, precedenceOfKind, refinementKinds, rootKinds, structuralKinds } from "./shared/implement.js";
|
|
3
|
+
import { $ark } from "./shared/registry.js";
|
|
4
|
+
import { Traversal } from "./shared/traversal.js";
|
|
5
|
+
import { isNode } from "./shared/utils.js";
|
|
6
|
+
export class BaseNode extends Callable {
|
|
7
|
+
attachments;
|
|
8
|
+
$;
|
|
9
|
+
onFail;
|
|
10
|
+
includesTransform;
|
|
11
|
+
includesContextualPredicate;
|
|
12
|
+
isCyclic;
|
|
13
|
+
allowsRequiresContext;
|
|
14
|
+
rootApplyStrategy;
|
|
15
|
+
contextFreeMorph;
|
|
16
|
+
rootApply;
|
|
17
|
+
referencesById;
|
|
18
|
+
shallowReferences;
|
|
19
|
+
flatRefs;
|
|
20
|
+
flatMorphs;
|
|
21
|
+
allows;
|
|
22
|
+
get shallowMorphs() {
|
|
23
|
+
return [];
|
|
24
|
+
}
|
|
25
|
+
constructor(attachments, $) {
|
|
26
|
+
super((data, pipedFromCtx, onFail = this.onFail) => {
|
|
27
|
+
if (pipedFromCtx) {
|
|
28
|
+
this.traverseApply(data, pipedFromCtx);
|
|
29
|
+
return pipedFromCtx.hasError() ?
|
|
30
|
+
pipedFromCtx.errors
|
|
31
|
+
: pipedFromCtx.data;
|
|
32
|
+
}
|
|
33
|
+
return this.rootApply(data, onFail);
|
|
34
|
+
}, { attach: attachments });
|
|
35
|
+
this.attachments = attachments;
|
|
36
|
+
this.$ = $;
|
|
37
|
+
this.onFail = this.meta.onFail ?? this.$.resolvedConfig.onFail;
|
|
38
|
+
this.includesTransform =
|
|
39
|
+
this.hasKind("morph") ||
|
|
40
|
+
(this.hasKind("structure") && this.structuralMorph !== undefined) ||
|
|
41
|
+
(this.hasKind("sequence") && this.inner.defaultables !== undefined);
|
|
42
|
+
// if a predicate accepts exactly one arg, we can safely skip passing context
|
|
43
|
+
// technically, a predicate could be written like `(data, ...[ctx]) => ctx.mustBe("malicious")`
|
|
44
|
+
// that would break here, but it feels like a pathological case and is better to let people optimize
|
|
45
|
+
this.includesContextualPredicate =
|
|
46
|
+
this.hasKind("predicate") && this.inner.predicate.length !== 1;
|
|
47
|
+
this.isCyclic = this.kind === "alias";
|
|
48
|
+
this.referencesById = { [this.id]: this };
|
|
49
|
+
this.shallowReferences =
|
|
50
|
+
this.hasKind("structure") ?
|
|
51
|
+
[this, ...this.children]
|
|
52
|
+
: this.children.reduce((acc, child) => appendUniqueNodes(acc, child.shallowReferences), [this]);
|
|
53
|
+
const isStructural = this.isStructural();
|
|
54
|
+
this.flatRefs = [];
|
|
55
|
+
this.flatMorphs = [];
|
|
56
|
+
for (let i = 0; i < this.children.length; i++) {
|
|
57
|
+
this.includesTransform ||= this.children[i].includesTransform;
|
|
58
|
+
this.includesContextualPredicate ||=
|
|
59
|
+
this.children[i].includesContextualPredicate;
|
|
60
|
+
this.isCyclic ||= this.children[i].isCyclic;
|
|
61
|
+
if (!isStructural) {
|
|
62
|
+
const childFlatRefs = this.children[i].flatRefs;
|
|
63
|
+
for (let j = 0; j < childFlatRefs.length; j++) {
|
|
64
|
+
const childRef = childFlatRefs[j];
|
|
65
|
+
if (!this.flatRefs.some(existing => flatRefsAreEqual(existing, childRef))) {
|
|
66
|
+
this.flatRefs.push(childRef);
|
|
67
|
+
for (const branch of childRef.node.branches) {
|
|
68
|
+
if (branch.hasKind("morph") ||
|
|
69
|
+
(branch.hasKind("intersection") &&
|
|
70
|
+
branch.structure?.structuralMorph !== undefined)) {
|
|
71
|
+
this.flatMorphs.push({
|
|
72
|
+
path: childRef.path,
|
|
73
|
+
propString: childRef.propString,
|
|
74
|
+
node: branch
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
Object.assign(this.referencesById, this.children[i].referencesById);
|
|
82
|
+
}
|
|
83
|
+
this.flatRefs.sort((l, r) => l.path.length > r.path.length ? 1
|
|
84
|
+
: l.path.length < r.path.length ? -1
|
|
85
|
+
: l.propString > r.propString ? 1
|
|
86
|
+
: l.propString < r.propString ? -1
|
|
87
|
+
: l.node.expression < r.node.expression ? -1
|
|
88
|
+
: 1);
|
|
89
|
+
this.allowsRequiresContext =
|
|
90
|
+
this.includesContextualPredicate || this.isCyclic;
|
|
91
|
+
this.rootApplyStrategy =
|
|
92
|
+
!this.allowsRequiresContext && this.flatMorphs.length === 0 ?
|
|
93
|
+
this.shallowMorphs.length === 0 ? "allows"
|
|
94
|
+
: (this.shallowMorphs.every(morph => morph.length === 1 || morph.name === "$arkStructuralMorph")) ?
|
|
95
|
+
this.hasKind("union") ?
|
|
96
|
+
// multiple morphs not yet supported for optimistic compilation
|
|
97
|
+
this.branches.some(branch => branch.shallowMorphs.length > 1) ?
|
|
98
|
+
"contextual"
|
|
99
|
+
: "branchedOptimistic"
|
|
100
|
+
: this.shallowMorphs.length > 1 ? "contextual"
|
|
101
|
+
: "optimistic"
|
|
102
|
+
: "contextual"
|
|
103
|
+
: "contextual";
|
|
104
|
+
this.rootApply = this.createRootApply();
|
|
105
|
+
this.allows =
|
|
106
|
+
this.allowsRequiresContext ?
|
|
107
|
+
data => this.traverseAllows(data, new Traversal(data, this.$.resolvedConfig))
|
|
108
|
+
: data => this.traverseAllows(data);
|
|
109
|
+
}
|
|
110
|
+
createRootApply() {
|
|
111
|
+
switch (this.rootApplyStrategy) {
|
|
112
|
+
case "allows":
|
|
113
|
+
return (data, onFail) => {
|
|
114
|
+
if (this.allows(data))
|
|
115
|
+
return data;
|
|
116
|
+
const ctx = new Traversal(data, this.$.resolvedConfig);
|
|
117
|
+
this.traverseApply(data, ctx);
|
|
118
|
+
return ctx.finalize(onFail);
|
|
119
|
+
};
|
|
120
|
+
case "contextual":
|
|
121
|
+
return (data, onFail) => {
|
|
122
|
+
const ctx = new Traversal(data, this.$.resolvedConfig);
|
|
123
|
+
this.traverseApply(data, ctx);
|
|
124
|
+
return ctx.finalize(onFail);
|
|
125
|
+
};
|
|
126
|
+
case "optimistic":
|
|
127
|
+
this.contextFreeMorph = this.shallowMorphs[0];
|
|
128
|
+
const clone = this.$.resolvedConfig.clone;
|
|
129
|
+
return (data, onFail) => {
|
|
130
|
+
if (this.allows(data)) {
|
|
131
|
+
return this.contextFreeMorph((clone &&
|
|
132
|
+
((typeof data === "object" && data !== null) ||
|
|
133
|
+
typeof data === "function")) ?
|
|
134
|
+
clone(data)
|
|
135
|
+
: data);
|
|
136
|
+
}
|
|
137
|
+
const ctx = new Traversal(data, this.$.resolvedConfig);
|
|
138
|
+
this.traverseApply(data, ctx);
|
|
139
|
+
return ctx.finalize(onFail);
|
|
140
|
+
};
|
|
141
|
+
case "branchedOptimistic":
|
|
142
|
+
return this.createBranchedOptimisticRootApply();
|
|
143
|
+
default:
|
|
144
|
+
this.rootApplyStrategy;
|
|
145
|
+
return throwInternalError(`Unexpected rootApplyStrategy ${this.rootApplyStrategy}`);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
compiledMeta = compileMeta(this.metaJson);
|
|
149
|
+
cacheGetter(name, value) {
|
|
150
|
+
Object.defineProperty(this, name, { value });
|
|
151
|
+
return value;
|
|
152
|
+
}
|
|
153
|
+
get description() {
|
|
154
|
+
return this.cacheGetter("description", this.meta?.description ??
|
|
155
|
+
this.$.resolvedConfig[this.kind].description(this));
|
|
156
|
+
}
|
|
157
|
+
// we don't cache this currently since it can be updated once a scope finishes
|
|
158
|
+
// resolving cyclic references, although it may be possible to ensure it is cached safely
|
|
159
|
+
get references() {
|
|
160
|
+
return Object.values(this.referencesById);
|
|
161
|
+
}
|
|
162
|
+
precedence = precedenceOfKind(this.kind);
|
|
163
|
+
precompilation;
|
|
164
|
+
// defined as an arrow function since it is often detached, e.g. when passing to tRPC
|
|
165
|
+
// otherwise, would run into issues with this binding
|
|
166
|
+
assert = (data, pipedFromCtx) => this(data, pipedFromCtx, errors => errors.throw());
|
|
167
|
+
traverse(data, pipedFromCtx) {
|
|
168
|
+
return this(data, pipedFromCtx, null);
|
|
169
|
+
}
|
|
170
|
+
/** rawIn should be used internally instead */
|
|
171
|
+
get in() {
|
|
172
|
+
// ensure the node has been finalized if in is being used externally
|
|
173
|
+
return this.cacheGetter("in", this.rawIn.isRoot() ? this.$.finalize(this.rawIn) : this.rawIn);
|
|
174
|
+
}
|
|
175
|
+
get rawIn() {
|
|
176
|
+
return this.cacheGetter("rawIn", this.getIo("in"));
|
|
177
|
+
}
|
|
178
|
+
/** rawOut should be used internally instead */
|
|
179
|
+
get out() {
|
|
180
|
+
// ensure the node has been finalized if out is being used externally
|
|
181
|
+
return this.cacheGetter("out", this.rawOut.isRoot() ? this.$.finalize(this.rawOut) : this.rawOut);
|
|
182
|
+
}
|
|
183
|
+
get rawOut() {
|
|
184
|
+
return this.cacheGetter("rawOut", this.getIo("out"));
|
|
185
|
+
}
|
|
186
|
+
// Should be refactored to use transform
|
|
187
|
+
// https://github.com/arktypeio/arktype/issues/1020
|
|
188
|
+
getIo(ioKind) {
|
|
189
|
+
if (!this.includesTransform)
|
|
190
|
+
return this;
|
|
191
|
+
const ioInner = {};
|
|
192
|
+
for (const [k, v] of this.innerEntries) {
|
|
193
|
+
const keySchemaImplementation = this.impl.keys[k];
|
|
194
|
+
if (keySchemaImplementation.reduceIo)
|
|
195
|
+
keySchemaImplementation.reduceIo(ioKind, ioInner, v);
|
|
196
|
+
else if (keySchemaImplementation.child) {
|
|
197
|
+
const childValue = v;
|
|
198
|
+
ioInner[k] =
|
|
199
|
+
isArray(childValue) ?
|
|
200
|
+
childValue.map(child => ioKind === "in" ? child.rawIn : child.rawOut)
|
|
201
|
+
: ioKind === "in" ? childValue.rawIn
|
|
202
|
+
: childValue.rawOut;
|
|
203
|
+
}
|
|
204
|
+
else
|
|
205
|
+
ioInner[k] = v;
|
|
206
|
+
}
|
|
207
|
+
return this.$.node(this.kind, ioInner);
|
|
208
|
+
}
|
|
209
|
+
toJSON() {
|
|
210
|
+
return this.json;
|
|
211
|
+
}
|
|
212
|
+
toString() {
|
|
213
|
+
return `Type<${this.expression}>`;
|
|
214
|
+
}
|
|
215
|
+
equals(r) {
|
|
216
|
+
const rNode = isNode(r) ? r : this.$.parseDefinition(r);
|
|
217
|
+
return this.innerHash === rNode.innerHash;
|
|
218
|
+
}
|
|
219
|
+
ifEquals(r) {
|
|
220
|
+
return this.equals(r) ? this : undefined;
|
|
221
|
+
}
|
|
222
|
+
hasKind(kind) {
|
|
223
|
+
return this.kind === kind;
|
|
224
|
+
}
|
|
225
|
+
assertHasKind(kind) {
|
|
226
|
+
if (this.kind !== kind)
|
|
227
|
+
throwError(`${this.kind} node was not of asserted kind ${kind}`);
|
|
228
|
+
return this;
|
|
229
|
+
}
|
|
230
|
+
hasKindIn(...kinds) {
|
|
231
|
+
return kinds.includes(this.kind);
|
|
232
|
+
}
|
|
233
|
+
assertHasKindIn(...kinds) {
|
|
234
|
+
if (!includes(kinds, this.kind))
|
|
235
|
+
throwError(`${this.kind} node was not one of asserted kinds ${kinds}`);
|
|
236
|
+
return this;
|
|
237
|
+
}
|
|
238
|
+
isBasis() {
|
|
239
|
+
return includes(basisKinds, this.kind);
|
|
240
|
+
}
|
|
241
|
+
isConstraint() {
|
|
242
|
+
return includes(constraintKinds, this.kind);
|
|
243
|
+
}
|
|
244
|
+
isStructural() {
|
|
245
|
+
return includes(structuralKinds, this.kind);
|
|
246
|
+
}
|
|
247
|
+
isRefinement() {
|
|
248
|
+
return includes(refinementKinds, this.kind);
|
|
249
|
+
}
|
|
250
|
+
isRoot() {
|
|
251
|
+
return includes(rootKinds, this.kind);
|
|
252
|
+
}
|
|
253
|
+
isUnknown() {
|
|
254
|
+
return this.hasKind("intersection") && this.children.length === 0;
|
|
255
|
+
}
|
|
256
|
+
isNever() {
|
|
257
|
+
return this.hasKind("union") && this.children.length === 0;
|
|
258
|
+
}
|
|
259
|
+
hasUnit(value) {
|
|
260
|
+
return this.hasKind("unit") && this.allows(value);
|
|
261
|
+
}
|
|
262
|
+
hasOpenIntersection() {
|
|
263
|
+
return this.impl.intersectionIsOpen;
|
|
264
|
+
}
|
|
265
|
+
get nestableExpression() {
|
|
266
|
+
return this.expression;
|
|
267
|
+
}
|
|
268
|
+
select(selector) {
|
|
269
|
+
const normalized = NodeSelector.normalize(selector);
|
|
270
|
+
return this._select(normalized);
|
|
271
|
+
}
|
|
272
|
+
_select(selector) {
|
|
273
|
+
let nodes = NodeSelector.applyBoundary[selector.boundary ?? "references"](this);
|
|
274
|
+
if (selector.kind)
|
|
275
|
+
nodes = nodes.filter(n => n.kind === selector.kind);
|
|
276
|
+
if (selector.where)
|
|
277
|
+
nodes = nodes.filter(selector.where);
|
|
278
|
+
return NodeSelector.applyMethod[selector.method ?? "filter"](nodes, this, selector);
|
|
279
|
+
}
|
|
280
|
+
transform(mapper, opts) {
|
|
281
|
+
return this._transform(mapper, this._createTransformContext(opts));
|
|
282
|
+
}
|
|
283
|
+
_createTransformContext(opts) {
|
|
284
|
+
return {
|
|
285
|
+
root: this,
|
|
286
|
+
selected: undefined,
|
|
287
|
+
seen: {},
|
|
288
|
+
path: [],
|
|
289
|
+
parseOptions: {
|
|
290
|
+
prereduced: opts?.prereduced ?? false
|
|
291
|
+
},
|
|
292
|
+
undeclaredKeyHandling: undefined,
|
|
293
|
+
...opts
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
_transform(mapper, ctx) {
|
|
297
|
+
const $ = ctx.bindScope ?? this.$;
|
|
298
|
+
if (ctx.seen[this.id])
|
|
299
|
+
// Cyclic handling needs to be made more robust
|
|
300
|
+
// https://github.com/arktypeio/arktype/issues/944
|
|
301
|
+
return this.$.lazilyResolve(ctx.seen[this.id]);
|
|
302
|
+
if (ctx.shouldTransform?.(this, ctx) === false)
|
|
303
|
+
return this;
|
|
304
|
+
let transformedNode;
|
|
305
|
+
ctx.seen[this.id] = () => transformedNode;
|
|
306
|
+
if (this.hasKind("structure") &&
|
|
307
|
+
this.undeclared !== ctx.undeclaredKeyHandling) {
|
|
308
|
+
ctx = {
|
|
309
|
+
...ctx,
|
|
310
|
+
undeclaredKeyHandling: this.undeclared
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
const innerWithTransformedChildren = flatMorph(this.inner, (k, v) => {
|
|
314
|
+
if (!this.impl.keys[k].child)
|
|
315
|
+
return [k, v];
|
|
316
|
+
const children = v;
|
|
317
|
+
if (!isArray(children)) {
|
|
318
|
+
const transformed = children._transform(mapper, ctx);
|
|
319
|
+
return transformed ? [k, transformed] : [];
|
|
320
|
+
}
|
|
321
|
+
// if the value was previously explicitly set to an empty list,
|
|
322
|
+
// (e.g. branches for `never`), ensure it is not pruned
|
|
323
|
+
if (children.length === 0)
|
|
324
|
+
return [k, v];
|
|
325
|
+
const transformed = children.flatMap(n => {
|
|
326
|
+
const transformedChild = n._transform(mapper, ctx);
|
|
327
|
+
return transformedChild ?? [];
|
|
328
|
+
});
|
|
329
|
+
return transformed.length ? [k, transformed] : [];
|
|
330
|
+
});
|
|
331
|
+
delete ctx.seen[this.id];
|
|
332
|
+
const innerWithMeta = Object.assign(innerWithTransformedChildren, {
|
|
333
|
+
meta: this.meta
|
|
334
|
+
});
|
|
335
|
+
const transformedInner = ctx.selected && !ctx.selected.includes(this) ?
|
|
336
|
+
innerWithMeta
|
|
337
|
+
: mapper(this.kind, innerWithMeta, ctx);
|
|
338
|
+
if (transformedInner === null)
|
|
339
|
+
return null;
|
|
340
|
+
if (isNode(transformedInner))
|
|
341
|
+
return (transformedNode = transformedInner);
|
|
342
|
+
const transformedKeys = Object.keys(transformedInner);
|
|
343
|
+
const hasNoTypedKeys = transformedKeys.length === 0 ||
|
|
344
|
+
(transformedKeys.length === 1 && transformedKeys[0] === "meta");
|
|
345
|
+
if (hasNoTypedKeys &&
|
|
346
|
+
// if inner was previously an empty object (e.g. unknown) ensure it is not pruned
|
|
347
|
+
!isEmptyObject(this.inner))
|
|
348
|
+
return null;
|
|
349
|
+
if ((this.kind === "required" ||
|
|
350
|
+
this.kind === "optional" ||
|
|
351
|
+
this.kind === "index") &&
|
|
352
|
+
!("value" in transformedInner)) {
|
|
353
|
+
return ctx.undeclaredKeyHandling ?
|
|
354
|
+
{ ...transformedInner, value: $ark.intrinsic.unknown }
|
|
355
|
+
: null;
|
|
356
|
+
}
|
|
357
|
+
if (this.kind === "morph") {
|
|
358
|
+
;
|
|
359
|
+
transformedInner.in ??= $ark.intrinsic
|
|
360
|
+
.unknown;
|
|
361
|
+
}
|
|
362
|
+
return (transformedNode = $.node(this.kind, transformedInner, ctx.parseOptions));
|
|
363
|
+
}
|
|
364
|
+
configureReferences(meta, selector = "references") {
|
|
365
|
+
const normalized = NodeSelector.normalize(selector);
|
|
366
|
+
const mapper = (typeof meta === "string" ?
|
|
367
|
+
(kind, inner) => ({
|
|
368
|
+
...inner,
|
|
369
|
+
meta: { ...inner.meta, description: meta }
|
|
370
|
+
})
|
|
371
|
+
: typeof meta === "function" ?
|
|
372
|
+
(kind, inner) => ({ ...inner, meta: meta(inner.meta) })
|
|
373
|
+
: (kind, inner) => ({
|
|
374
|
+
...inner,
|
|
375
|
+
meta: { ...inner.meta, ...meta }
|
|
376
|
+
}));
|
|
377
|
+
if (normalized.boundary === "self") {
|
|
378
|
+
return this.$.node(this.kind, mapper(this.kind, { ...this.inner, meta: this.meta }));
|
|
379
|
+
}
|
|
380
|
+
const rawSelected = this._select(normalized);
|
|
381
|
+
const selected = rawSelected && liftArray(rawSelected);
|
|
382
|
+
const shouldTransform = normalized.boundary === "child" ?
|
|
383
|
+
(node, ctx) => ctx.root.children.includes(node)
|
|
384
|
+
: normalized.boundary === "shallow" ? node => node.kind !== "structure"
|
|
385
|
+
: () => true;
|
|
386
|
+
return this.$.finalize(this.transform(mapper, {
|
|
387
|
+
shouldTransform,
|
|
388
|
+
selected
|
|
389
|
+
}));
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
const NodeSelector = {
|
|
393
|
+
applyBoundary: {
|
|
394
|
+
self: node => [node],
|
|
395
|
+
child: node => [...node.children],
|
|
396
|
+
shallow: node => [...node.shallowReferences],
|
|
397
|
+
references: node => [...node.references]
|
|
398
|
+
},
|
|
399
|
+
applyMethod: {
|
|
400
|
+
filter: nodes => nodes,
|
|
401
|
+
assertFilter: (nodes, from, selector) => {
|
|
402
|
+
if (nodes.length === 0)
|
|
403
|
+
throwError(writeSelectAssertionMessage(from, selector));
|
|
404
|
+
return nodes;
|
|
405
|
+
},
|
|
406
|
+
find: nodes => nodes[0],
|
|
407
|
+
assertFind: (nodes, from, selector) => {
|
|
408
|
+
if (nodes.length === 0)
|
|
409
|
+
throwError(writeSelectAssertionMessage(from, selector));
|
|
410
|
+
return nodes[0];
|
|
411
|
+
}
|
|
412
|
+
},
|
|
413
|
+
normalize: (selector) => typeof selector === "function" ?
|
|
414
|
+
{ boundary: "references", method: "filter", where: selector }
|
|
415
|
+
: typeof selector === "string" ?
|
|
416
|
+
isKeyOf(selector, NodeSelector.applyBoundary) ?
|
|
417
|
+
{ method: "filter", boundary: selector }
|
|
418
|
+
: { boundary: "references", method: "filter", kind: selector }
|
|
419
|
+
: { boundary: "references", method: "filter", ...selector }
|
|
420
|
+
};
|
|
421
|
+
const writeSelectAssertionMessage = (from, selector) => `${from} had no references matching ${printable(selector)}.`;
|
|
422
|
+
export const typePathToPropString = (path) => stringifyPath(path, {
|
|
423
|
+
stringifyNonKey: node => node.expression
|
|
424
|
+
});
|
|
425
|
+
const referenceMatcher = /"(\$ark\.[^"]+)"/g;
|
|
426
|
+
const compileMeta = (metaJson) => JSON.stringify(metaJson).replace(referenceMatcher, "$1");
|
|
427
|
+
export const flatRef = (path, node) => ({
|
|
428
|
+
path,
|
|
429
|
+
node,
|
|
430
|
+
propString: typePathToPropString(path)
|
|
431
|
+
});
|
|
432
|
+
export const flatRefsAreEqual = (l, r) => l.propString === r.propString && l.node.equals(r.node);
|
|
433
|
+
export const appendUniqueFlatRefs = (existing, refs) => appendUnique(existing, refs, {
|
|
434
|
+
isEqual: flatRefsAreEqual
|
|
435
|
+
});
|
|
436
|
+
export const appendUniqueNodes = (existing, refs) => appendUnique(existing, refs, {
|
|
437
|
+
isEqual: (l, r) => l.equals(r)
|
|
438
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type Brand, type dict } from "@ark/util";
|
|
2
|
+
import { type NormalizedSchema } from "./kinds.ts";
|
|
3
|
+
import type { BaseNode } from "./node.ts";
|
|
4
|
+
import type { BaseRoot } from "./roots/root.ts";
|
|
5
|
+
import type { BaseScope } from "./scope.ts";
|
|
6
|
+
import { type NodeKind, type RootKind } from "./shared/implement.ts";
|
|
7
|
+
import { type arkKind } from "./shared/utils.ts";
|
|
8
|
+
export type ContextualArgs = Record<string, BaseRoot | NodeId>;
|
|
9
|
+
export type BaseParseOptions<prereduced extends boolean = boolean> = {
|
|
10
|
+
alias?: string;
|
|
11
|
+
prereduced?: prereduced;
|
|
12
|
+
args?: ContextualArgs;
|
|
13
|
+
id?: NodeId;
|
|
14
|
+
};
|
|
15
|
+
export interface BaseParseContextInput extends BaseParseOptions {
|
|
16
|
+
prefix: string;
|
|
17
|
+
def: unknown;
|
|
18
|
+
}
|
|
19
|
+
export interface AttachedParseContext {
|
|
20
|
+
[arkKind]: "context";
|
|
21
|
+
$: BaseScope;
|
|
22
|
+
id: NodeId;
|
|
23
|
+
phase: "unresolved" | "resolving" | "resolved";
|
|
24
|
+
}
|
|
25
|
+
export interface BaseParseContext extends BaseParseContextInput, AttachedParseContext {
|
|
26
|
+
id: NodeId;
|
|
27
|
+
}
|
|
28
|
+
export interface NodeParseContextInput<kind extends NodeKind = NodeKind> extends BaseParseContextInput {
|
|
29
|
+
kind: kind;
|
|
30
|
+
def: NormalizedSchema<kind>;
|
|
31
|
+
}
|
|
32
|
+
export interface NodeParseContext<kind extends NodeKind = NodeKind> extends NodeParseContextInput<kind>, AttachedParseContext {
|
|
33
|
+
id: NodeId;
|
|
34
|
+
}
|
|
35
|
+
export declare const schemaKindOf: <kind extends RootKind = RootKind>(schema: unknown, allowedKinds?: readonly kind[]) => kind;
|
|
36
|
+
export declare const writeInvalidSchemaMessage: (schema: unknown) => string;
|
|
37
|
+
export type NodeId = Brand<string, "NodeId">;
|
|
38
|
+
export type NodeResolver = (id: NodeId) => BaseNode;
|
|
39
|
+
export declare const nodesByRegisteredId: Record<NodeId, BaseNode | BaseParseContext | undefined>;
|
|
40
|
+
export declare const registerNodeId: (prefix: string) => NodeId;
|
|
41
|
+
export declare const parseNode: (ctx: NodeParseContext) => BaseNode;
|
|
42
|
+
export type CreateNodeInput = {
|
|
43
|
+
id: NodeId;
|
|
44
|
+
kind: NodeKind;
|
|
45
|
+
inner: dict;
|
|
46
|
+
meta: ArkEnv.meta;
|
|
47
|
+
$: BaseScope;
|
|
48
|
+
ignoreCache?: true;
|
|
49
|
+
};
|
|
50
|
+
export declare const createNode: ({ id, kind, inner, meta, $, ignoreCache }: CreateNodeInput) => BaseNode;
|
|
51
|
+
export declare const withId: <node extends BaseNode>(node: node, id: NodeId) => node;
|
|
52
|
+
export declare const withMeta: <node extends BaseNode>(node: node, meta: ArkEnv.meta, id?: NodeId) => node;
|