@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,24 @@
|
|
|
1
|
+
import { type BaseRoot, type BoundKind } from "@ark/schema";
|
|
2
|
+
import { type KeySet, type Scanner } from "@ark/util";
|
|
3
|
+
import type { DateLiteral } from "../../../attributes.ts";
|
|
4
|
+
import type { InferredAst } from "../../ast/infer.ts";
|
|
5
|
+
import type { astToString } from "../../ast/utils.ts";
|
|
6
|
+
import type { RootedRuntimeState, RuntimeState } from "../../reduce/dynamic.ts";
|
|
7
|
+
import { writeUnpairableComparatorMessage, type Comparator, type InvertedComparators, type MaxComparator } from "../../reduce/shared.ts";
|
|
8
|
+
import type { s, StaticState } from "../../reduce/static.ts";
|
|
9
|
+
import type { parseOperand } from "../operand/operand.ts";
|
|
10
|
+
export declare const parseBound: (s: RootedRuntimeState, start: ComparatorStartChar) => void;
|
|
11
|
+
export type parseBound<s extends StaticState, start extends ComparatorStartChar, unscanned extends string, $, args> = shiftComparator<start, unscanned> extends infer shiftResultOrError ? shiftResultOrError extends (Scanner.shiftResult<infer comparator extends Comparator, infer nextUnscanned>) ? s["root"] extends (InferredAst<Date | number, `${infer limit extends number | DateLiteral}`>) ? s.reduceLeftBound<s, limit, comparator, nextUnscanned> : parseRightBound<s.scanTo<s, nextUnscanned>, comparator, $, args> : shiftResultOrError : never;
|
|
12
|
+
type OneCharComparator = ">" | "<";
|
|
13
|
+
export type ComparatorStartChar = Comparator extends `${infer char}${string}` ? char : never;
|
|
14
|
+
export declare const comparatorStartChars: KeySet<ComparatorStartChar>;
|
|
15
|
+
declare const shiftComparator: (s: RuntimeState, start: ComparatorStartChar) => Comparator;
|
|
16
|
+
type shiftComparator<start extends ComparatorStartChar, unscanned extends string> = unscanned extends `=${infer nextUnscanned}` ? [`${start}=`, nextUnscanned] : [start & OneCharComparator, unscanned];
|
|
17
|
+
export declare const writeIncompatibleRangeMessage: (l: BoundKind, r: BoundKind) => string;
|
|
18
|
+
export declare const getBoundKinds: (comparator: Comparator, limit: number | DateLiteral, root: BaseRoot, boundKind: BoundExpressionKind) => BoundKind[];
|
|
19
|
+
export declare const parseRightBound: (s: RootedRuntimeState, comparator: Comparator) => void;
|
|
20
|
+
export type parseRightBound<s extends StaticState, comparator extends Comparator, $, args> = parseOperand<s, $, args> extends infer nextState extends StaticState ? nextState["root"] extends (InferredAst<unknown, `${infer limit extends number | DateLiteral}`>) ? s["branches"]["leftBound"] extends {} ? comparator extends MaxComparator ? s.reduceRange<s, s["branches"]["leftBound"]["limit"], s["branches"]["leftBound"]["comparator"], comparator, limit, nextState["unscanned"]> : s.error<writeUnpairableComparatorMessage<comparator>> : s.reduceSingleBound<s, comparator, limit, nextState["unscanned"]> : s.error<writeInvalidLimitMessage<comparator, astToString<nextState["root"]>, "right">> : never;
|
|
21
|
+
export declare const writeInvalidLimitMessage: <comparator extends Comparator, limit extends string | number, boundKind extends BoundExpressionKind>(comparator: comparator, limit: limit, boundKind: boundKind) => writeInvalidLimitMessage<comparator, limit, boundKind>;
|
|
22
|
+
export type writeInvalidLimitMessage<comparator extends Comparator, limit extends string | number, boundKind extends BoundExpressionKind> = `Comparator ${boundKind extends "left" ? InvertedComparators[comparator] : comparator} must be ${boundKind extends "left" ? "preceded" : "followed"} by a corresponding literal (was ${limit})`;
|
|
23
|
+
export type BoundExpressionKind = "left" | "right";
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { $ark, writeUnboundableMessage } from "@ark/schema";
|
|
2
|
+
import { isKeyOf, throwParseError } from "@ark/util";
|
|
3
|
+
import { invertedComparators, maxComparators, writeUnpairableComparatorMessage } from "../../reduce/shared.js";
|
|
4
|
+
import { extractDateLiteralSource, isDateLiteral } from "../operand/date.js";
|
|
5
|
+
export const parseBound = (s, start) => {
|
|
6
|
+
const comparator = shiftComparator(s, start);
|
|
7
|
+
if (s.root.hasKind("unit")) {
|
|
8
|
+
if (typeof s.root.unit === "number") {
|
|
9
|
+
s.reduceLeftBound(s.root.unit, comparator);
|
|
10
|
+
s.unsetRoot();
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
if (s.root.unit instanceof Date) {
|
|
14
|
+
const literal = `d'${s.root.description ?? s.root.unit.toISOString()}'`;
|
|
15
|
+
s.unsetRoot();
|
|
16
|
+
s.reduceLeftBound(literal, comparator);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return parseRightBound(s, comparator);
|
|
21
|
+
};
|
|
22
|
+
export const comparatorStartChars = {
|
|
23
|
+
"<": 1,
|
|
24
|
+
">": 1,
|
|
25
|
+
"=": 1
|
|
26
|
+
};
|
|
27
|
+
const shiftComparator = (s, start) => s.scanner.lookaheadIs("=") ?
|
|
28
|
+
`${start}${s.scanner.shift()}`
|
|
29
|
+
: start;
|
|
30
|
+
export const writeIncompatibleRangeMessage = (l, r) => `Bound kinds ${l} and ${r} are incompatible`;
|
|
31
|
+
export const getBoundKinds = (comparator, limit, root, boundKind) => {
|
|
32
|
+
if (root.extends($ark.intrinsic.number)) {
|
|
33
|
+
if (typeof limit !== "number") {
|
|
34
|
+
return throwParseError(writeInvalidLimitMessage(comparator, limit, boundKind));
|
|
35
|
+
}
|
|
36
|
+
return (comparator === "==" ? ["min", "max"]
|
|
37
|
+
: comparator[0] === ">" ? ["min"]
|
|
38
|
+
: ["max"]);
|
|
39
|
+
}
|
|
40
|
+
if (root.extends($ark.intrinsic.lengthBoundable)) {
|
|
41
|
+
if (typeof limit !== "number") {
|
|
42
|
+
return throwParseError(writeInvalidLimitMessage(comparator, limit, boundKind));
|
|
43
|
+
}
|
|
44
|
+
return (comparator === "==" ? ["exactLength"]
|
|
45
|
+
: comparator[0] === ">" ? ["minLength"]
|
|
46
|
+
: ["maxLength"]);
|
|
47
|
+
}
|
|
48
|
+
if (root.extends($ark.intrinsic.Date)) {
|
|
49
|
+
// allow either numeric or date limits
|
|
50
|
+
return (comparator === "==" ? ["after", "before"]
|
|
51
|
+
: comparator[0] === ">" ? ["after"]
|
|
52
|
+
: ["before"]);
|
|
53
|
+
}
|
|
54
|
+
return throwParseError(writeUnboundableMessage(root.expression));
|
|
55
|
+
};
|
|
56
|
+
const openLeftBoundToRoot = (leftBound) => ({
|
|
57
|
+
rule: isDateLiteral(leftBound.limit) ?
|
|
58
|
+
extractDateLiteralSource(leftBound.limit)
|
|
59
|
+
: leftBound.limit,
|
|
60
|
+
exclusive: leftBound.comparator.length === 1
|
|
61
|
+
});
|
|
62
|
+
export const parseRightBound = (s, comparator) => {
|
|
63
|
+
// store the node that will be bounded
|
|
64
|
+
const previousRoot = s.unsetRoot();
|
|
65
|
+
const previousScannerIndex = s.scanner.location;
|
|
66
|
+
s.parseOperand();
|
|
67
|
+
const limitNode = s.unsetRoot();
|
|
68
|
+
// after parsing the next operand, use the locations to get the
|
|
69
|
+
// token from which it was parsed
|
|
70
|
+
const limitToken = s.scanner.sliceChars(previousScannerIndex, s.scanner.location);
|
|
71
|
+
s.root = previousRoot;
|
|
72
|
+
if (!limitNode.hasKind("unit") ||
|
|
73
|
+
(typeof limitNode.unit !== "number" && !(limitNode.unit instanceof Date)))
|
|
74
|
+
return s.error(writeInvalidLimitMessage(comparator, limitToken, "right"));
|
|
75
|
+
const limit = limitNode.unit;
|
|
76
|
+
// apply the newly-parsed right bound
|
|
77
|
+
const exclusive = comparator.length === 1;
|
|
78
|
+
const boundKinds = getBoundKinds(comparator, typeof limit === "number" ? limit : limitToken, previousRoot, "right");
|
|
79
|
+
for (const kind of boundKinds) {
|
|
80
|
+
s.constrainRoot(kind, comparator === "==" ? { rule: limit } : { rule: limit, exclusive });
|
|
81
|
+
}
|
|
82
|
+
if (!s.branches.leftBound)
|
|
83
|
+
return;
|
|
84
|
+
// if there's an open left bound, perform additional validation and apply it
|
|
85
|
+
if (!isKeyOf(comparator, maxComparators))
|
|
86
|
+
return s.error(writeUnpairableComparatorMessage(comparator));
|
|
87
|
+
const lowerBoundKind = getBoundKinds(s.branches.leftBound.comparator, s.branches.leftBound.limit, previousRoot, "left");
|
|
88
|
+
s.constrainRoot(lowerBoundKind[0], openLeftBoundToRoot(s.branches.leftBound));
|
|
89
|
+
s.branches.leftBound = null;
|
|
90
|
+
};
|
|
91
|
+
export const writeInvalidLimitMessage = (comparator, limit, boundKind) => `Comparator ${boundKind === "left" ? invertedComparators[comparator] : comparator} must be ${boundKind === "left" ? "preceded" : "followed"} by a corresponding literal (was ${limit})`;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { emptyBrandNameMessage } from "@ark/schema";
|
|
2
|
+
import type { Scanner } from "@ark/util";
|
|
3
|
+
import type { RootedRuntimeState } from "../../reduce/dynamic.ts";
|
|
4
|
+
import type { StaticState, s } from "../../reduce/static.ts";
|
|
5
|
+
import { type TerminatingChar } from "../tokens.ts";
|
|
6
|
+
export declare const parseBrand: (s: RootedRuntimeState) => void;
|
|
7
|
+
export type parseBrand<s extends StaticState, unscanned extends string> = Scanner.shiftUntil<Scanner.skipWhitespace<unscanned>, TerminatingChar> extends Scanner.shiftResult<`${infer brandName}`, infer nextUnscanned> ? brandName extends "" ? s.error<emptyBrandNameMessage> : s.setRoot<s, [s["root"], "#", brandName], nextUnscanned> : never;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { BaseRoot } from "@ark/schema";
|
|
2
|
+
import type { BigintLiteral, ErrorMessage, NumberLiteral, Scanner, trim } from "@ark/util";
|
|
3
|
+
import type { DateLiteral } from "../../../attributes.ts";
|
|
4
|
+
import type { RootedRuntimeState } from "../../reduce/dynamic.ts";
|
|
5
|
+
import type { EnclosingLiteralStartToken, EnclosingLiteralTokens, StringLiteral } from "../operand/enclosed.ts";
|
|
6
|
+
type UnitLiteralKeyword = "null" | "undefined" | "true" | "false";
|
|
7
|
+
export type UnitLiteral = UnenclosedUnitLiteral | EnclosedUnitLiteral;
|
|
8
|
+
export type UnenclosedUnitLiteral = BigintLiteral | NumberLiteral | UnitLiteralKeyword;
|
|
9
|
+
export type EnclosedUnitLiteral = StringLiteral | DateLiteral;
|
|
10
|
+
export type ParsedDefaultableProperty = readonly [BaseRoot, "=", unknown];
|
|
11
|
+
export declare const parseDefault: (s: RootedRuntimeState) => ParsedDefaultableProperty;
|
|
12
|
+
export type parseDefault<root, unscanned extends string> = trim<unscanned> extends infer defaultExpression extends string ? defaultExpression extends UnenclosedUnitLiteral ? [
|
|
13
|
+
root,
|
|
14
|
+
"=",
|
|
15
|
+
defaultExpression
|
|
16
|
+
] : defaultExpression extends (`${infer start extends EnclosingLiteralStartToken}${string}`) ? defaultExpression extends `${start}${infer nextUnscanned}` ? isValidEnclosedLiteral<start, nextUnscanned> extends true ? [
|
|
17
|
+
root,
|
|
18
|
+
"=",
|
|
19
|
+
defaultExpression
|
|
20
|
+
] : ErrorMessage<writeNonLiteralDefaultMessage<defaultExpression>> : never : ErrorMessage<writeNonLiteralDefaultMessage<defaultExpression>> : never;
|
|
21
|
+
export type isValidEnclosedLiteral<start extends EnclosingLiteralStartToken, unscanned extends string> = Scanner.shiftUntilEscapable<unscanned, EnclosingLiteralTokens[start], ""> extends Scanner.shiftResult<string, infer nextUnscanned> ? nextUnscanned extends EnclosingLiteralTokens[start] ? true : false : false;
|
|
22
|
+
export declare const writeNonLiteralDefaultMessage: <defaultDef extends string>(defaultDef: defaultDef) => writeNonLiteralDefaultMessage<defaultDef>;
|
|
23
|
+
export type writeNonLiteralDefaultMessage<defaultDef extends string> = `Default value '${defaultDef}' must be a literal value`;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const parseDefault = (s) => {
|
|
2
|
+
// store the node that will be bounded
|
|
3
|
+
const baseNode = s.unsetRoot();
|
|
4
|
+
s.parseOperand();
|
|
5
|
+
const defaultNode = s.unsetRoot();
|
|
6
|
+
// after parsing the next operand, use the locations to get the
|
|
7
|
+
// token from which it was parsed
|
|
8
|
+
if (!defaultNode.hasKind("unit"))
|
|
9
|
+
return s.error(writeNonLiteralDefaultMessage(defaultNode.expression));
|
|
10
|
+
const defaultValue = defaultNode.unit instanceof Date ?
|
|
11
|
+
() => new Date(defaultNode.unit)
|
|
12
|
+
: defaultNode.unit;
|
|
13
|
+
return [baseNode, "=", defaultValue];
|
|
14
|
+
};
|
|
15
|
+
export const writeNonLiteralDefaultMessage = (defaultDef) => `Default value '${defaultDef}' must be a literal value`;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Scanner } from "@ark/util";
|
|
2
|
+
import type { RootedRuntimeState } from "../../reduce/dynamic.ts";
|
|
3
|
+
import type { StaticState, s } from "../../reduce/static.ts";
|
|
4
|
+
import { type TerminatingChar } from "../tokens.ts";
|
|
5
|
+
export declare const parseDivisor: (s: RootedRuntimeState) => void;
|
|
6
|
+
export type parseDivisor<s extends StaticState, unscanned extends string> = Scanner.shiftUntil<Scanner.skipWhitespace<unscanned>, TerminatingChar> extends Scanner.shiftResult<infer scanned, infer nextUnscanned> ? scanned extends `${infer divisor extends number}` ? divisor extends 0 ? s.error<writeInvalidDivisorMessage<0>> : s.setRoot<s, [s["root"], "%", divisor], nextUnscanned> : s.error<writeInvalidDivisorMessage<scanned>> : never;
|
|
7
|
+
export declare const writeInvalidDivisorMessage: <divisor extends string | number>(divisor: divisor) => writeInvalidDivisorMessage<divisor>;
|
|
8
|
+
export type writeInvalidDivisorMessage<divisor extends string | number> = `% operator must be followed by a non-zero integer literal (was ${divisor})`;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { tryParseInteger } from "@ark/util";
|
|
2
|
+
import { terminatingChars } from "../tokens.js";
|
|
3
|
+
export const parseDivisor = (s) => {
|
|
4
|
+
s.scanner.shiftUntilNonWhitespace();
|
|
5
|
+
const divisorToken = s.scanner.shiftUntilLookahead(terminatingChars);
|
|
6
|
+
const divisor = tryParseInteger(divisorToken, {
|
|
7
|
+
errorOnFail: writeInvalidDivisorMessage(divisorToken)
|
|
8
|
+
});
|
|
9
|
+
if (divisor === 0)
|
|
10
|
+
s.error(writeInvalidDivisorMessage(0));
|
|
11
|
+
s.root = s.root.constrain("divisor", divisor);
|
|
12
|
+
};
|
|
13
|
+
export const writeInvalidDivisorMessage = (divisor) => `% operator must be followed by a non-zero integer literal (was ${divisor})`;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type Scanner, type WhitespaceChar } from "@ark/util";
|
|
2
|
+
import type { RootedRuntimeState } from "../../reduce/dynamic.ts";
|
|
3
|
+
import type { StaticState, s } from "../../reduce/static.ts";
|
|
4
|
+
import { lookaheadIsFinalizing, type FinalizingLookahead } from "../tokens.ts";
|
|
5
|
+
import { parseBound, type ComparatorStartChar } from "./bounds.ts";
|
|
6
|
+
import { parseBrand } from "./brand.ts";
|
|
7
|
+
import { parseDivisor } from "./divisor.ts";
|
|
8
|
+
export declare const parseOperator: (s: RootedRuntimeState) => void;
|
|
9
|
+
export type parseOperator<s extends StaticState, $, args> = s["unscanned"] extends Scanner.shift<infer lookahead, infer unscanned> ? lookahead extends "[" ? unscanned extends Scanner.shift<"]", infer nextUnscanned> ? s.setRoot<s, [s["root"], "[]"], nextUnscanned> : s.error<incompleteArrayTokenMessage> : lookahead extends "|" ? unscanned extends Scanner.shift<">", infer nextUnscanned> ? s.reduceBranch<s, "|>", nextUnscanned> : s.reduceBranch<s, lookahead, unscanned> : lookahead extends "&" ? s.reduceBranch<s, lookahead, unscanned> : lookahead extends ")" ? s.finalizeGroup<s, unscanned> : lookaheadIsFinalizing<lookahead, unscanned> extends true ? s.finalize<s.scanTo<s, unscanned>, lookahead & FinalizingLookahead> : lookahead extends ComparatorStartChar ? parseBound<s, lookahead, unscanned, $, args> : lookahead extends "%" ? parseDivisor<s, unscanned> : lookahead extends "#" ? parseBrand<s, unscanned> : lookahead extends WhitespaceChar ? parseOperator<s.scanTo<s, unscanned>, $, args> : s.error<writeUnexpectedCharacterMessage<lookahead>> : s.finalize<s, "">;
|
|
10
|
+
export declare const writeUnexpectedCharacterMessage: <char extends string, shouldBe extends string>(char: char, shouldBe?: shouldBe) => writeUnexpectedCharacterMessage<char, shouldBe>;
|
|
11
|
+
export type writeUnexpectedCharacterMessage<char extends string, shouldBe extends string = ""> = `'${char}' is not allowed here${shouldBe extends "" ? "" : ` (should be ${shouldBe})`}`;
|
|
12
|
+
export declare const incompleteArrayTokenMessage = "Missing expected ']'";
|
|
13
|
+
type incompleteArrayTokenMessage = typeof incompleteArrayTokenMessage;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { isKeyOf, whitespaceChars } from "@ark/util";
|
|
2
|
+
import { lookaheadIsFinalizing } from "../tokens.js";
|
|
3
|
+
import { comparatorStartChars, parseBound } from "./bounds.js";
|
|
4
|
+
import { parseBrand } from "./brand.js";
|
|
5
|
+
import { parseDivisor } from "./divisor.js";
|
|
6
|
+
export const parseOperator = (s) => {
|
|
7
|
+
const lookahead = s.scanner.shift();
|
|
8
|
+
return (lookahead === "" ? s.finalize("")
|
|
9
|
+
: lookahead === "[" ?
|
|
10
|
+
s.scanner.shift() === "]" ?
|
|
11
|
+
s.setRoot(s.root.array())
|
|
12
|
+
: s.error(incompleteArrayTokenMessage)
|
|
13
|
+
: lookahead === "|" ?
|
|
14
|
+
s.scanner.lookahead === ">" ?
|
|
15
|
+
s.shiftedBy(1).pushRootToBranch("|>")
|
|
16
|
+
: s.pushRootToBranch(lookahead)
|
|
17
|
+
: lookahead === "&" ? s.pushRootToBranch(lookahead)
|
|
18
|
+
: lookahead === ")" ? s.finalizeGroup()
|
|
19
|
+
: lookaheadIsFinalizing(lookahead, s.scanner.unscanned) ?
|
|
20
|
+
s.finalize(lookahead)
|
|
21
|
+
: isKeyOf(lookahead, comparatorStartChars) ? parseBound(s, lookahead)
|
|
22
|
+
: lookahead === "%" ? parseDivisor(s)
|
|
23
|
+
: lookahead === "#" ? parseBrand(s)
|
|
24
|
+
: lookahead in whitespaceChars ? parseOperator(s)
|
|
25
|
+
: s.error(writeUnexpectedCharacterMessage(lookahead)));
|
|
26
|
+
};
|
|
27
|
+
export const writeUnexpectedCharacterMessage = (char, shouldBe = "") => `'${char}' is not allowed here${shouldBe && ` (should be ${shouldBe})`}`;
|
|
28
|
+
export const incompleteArrayTokenMessage = `Missing expected ']'`;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type Scanner } from "@ark/util";
|
|
2
|
+
import type { Comparator } from "../reduce/shared.ts";
|
|
3
|
+
export declare const terminatingChars: {
|
|
4
|
+
readonly " ": 1;
|
|
5
|
+
readonly "\n": 1;
|
|
6
|
+
readonly "\t": 1;
|
|
7
|
+
readonly "<": 1;
|
|
8
|
+
readonly ">": 1;
|
|
9
|
+
readonly "=": 1;
|
|
10
|
+
readonly "|": 1;
|
|
11
|
+
readonly "&": 1;
|
|
12
|
+
readonly ")": 1;
|
|
13
|
+
readonly "[": 1;
|
|
14
|
+
readonly "%": 1;
|
|
15
|
+
readonly ",": 1;
|
|
16
|
+
readonly ":": 1;
|
|
17
|
+
readonly "?": 1;
|
|
18
|
+
readonly "#": 1;
|
|
19
|
+
};
|
|
20
|
+
export type TerminatingChar = keyof typeof terminatingChars;
|
|
21
|
+
export declare const finalizingLookaheads: {
|
|
22
|
+
readonly ">": 1;
|
|
23
|
+
readonly ",": 1;
|
|
24
|
+
readonly "": 1;
|
|
25
|
+
readonly "=": 1;
|
|
26
|
+
readonly "?": 1;
|
|
27
|
+
};
|
|
28
|
+
export type FinalizingLookahead = keyof typeof finalizingLookaheads;
|
|
29
|
+
export declare const lookaheadIsFinalizing: (lookahead: string, unscanned: string) => lookahead is ">" | "," | "=" | "?";
|
|
30
|
+
export type lookaheadIsFinalizing<lookahead extends string, unscanned extends string> = lookahead extends ">" ? unscanned extends `=${infer nextUnscanned}` ? nextUnscanned extends `=${string}` ? true : false : Scanner.skipWhitespace<unscanned> extends ("" | `${TerminatingChar}${string}`) ? true : false : lookahead extends "=" ? unscanned extends `=${string}` ? false : true : lookahead extends "," | "?" ? true : false;
|
|
31
|
+
export type InfixToken = Comparator | "|" | "&" | "%" | ":" | "=>" | "|>" | "#" | "@" | "=";
|
|
32
|
+
export type PostfixToken = "[]" | "?";
|
|
33
|
+
export type OperatorToken = InfixToken | PostfixToken;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { isKeyOf, whitespaceChars } from "@ark/util";
|
|
2
|
+
export const terminatingChars = {
|
|
3
|
+
"<": 1,
|
|
4
|
+
">": 1,
|
|
5
|
+
"=": 1,
|
|
6
|
+
"|": 1,
|
|
7
|
+
"&": 1,
|
|
8
|
+
")": 1,
|
|
9
|
+
"[": 1,
|
|
10
|
+
"%": 1,
|
|
11
|
+
",": 1,
|
|
12
|
+
":": 1,
|
|
13
|
+
"?": 1,
|
|
14
|
+
"#": 1,
|
|
15
|
+
...whitespaceChars
|
|
16
|
+
};
|
|
17
|
+
export const finalizingLookaheads = {
|
|
18
|
+
">": 1,
|
|
19
|
+
",": 1,
|
|
20
|
+
"": 1,
|
|
21
|
+
"=": 1,
|
|
22
|
+
"?": 1
|
|
23
|
+
};
|
|
24
|
+
export const lookaheadIsFinalizing = (lookahead, unscanned) => lookahead === ">" ?
|
|
25
|
+
unscanned[0] === "=" ?
|
|
26
|
+
// >== would only occur in an expression like Array<number>==5
|
|
27
|
+
// otherwise, >= would only occur as part of a bound like number>=5
|
|
28
|
+
unscanned[1] === "="
|
|
29
|
+
// if > is the end of a generic instantiation, the next token will be
|
|
30
|
+
// an operator or the end of the string
|
|
31
|
+
: unscanned.trimStart() === "" ||
|
|
32
|
+
isKeyOf(unscanned.trimStart()[0], terminatingChars)
|
|
33
|
+
// "=" is a finalizer on its own (representing a default value),
|
|
34
|
+
// but not with a second "=" (an equality comparator)
|
|
35
|
+
: lookahead === "=" ? unscanned[0] !== "="
|
|
36
|
+
// "," and "?" are unambiguously finalizers
|
|
37
|
+
: lookahead === "," || lookahead === "?";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { BaseParseContext, resolvableReferenceIn } from "@ark/schema";
|
|
2
|
+
import { type ErrorMessage } from "@ark/util";
|
|
3
|
+
import type { ArkAmbient } from "../config.ts";
|
|
4
|
+
import type { InnerParseResult, resolutionToAst } from "../scope.ts";
|
|
5
|
+
import type { inferAstRoot } from "./ast/infer.ts";
|
|
6
|
+
import { RuntimeState, type RootedRuntimeState } from "./reduce/dynamic.ts";
|
|
7
|
+
import type { StringifiablePrefixOperator } from "./reduce/shared.ts";
|
|
8
|
+
import type { s, StaticState } from "./reduce/static.ts";
|
|
9
|
+
import type { parseOperand } from "./shift/operand/operand.ts";
|
|
10
|
+
import { parseDefault } from "./shift/operator/default.ts";
|
|
11
|
+
import { writeUnexpectedCharacterMessage, type parseOperator } from "./shift/operator/operator.ts";
|
|
12
|
+
export declare const parseString: (def: string, ctx: BaseParseContext) => InnerParseResult;
|
|
13
|
+
/**
|
|
14
|
+
* Try to parse the definition from right to left using the most common syntax.
|
|
15
|
+
* This can be much more efficient for simple definitions.
|
|
16
|
+
*/
|
|
17
|
+
export type parseString<def extends string, $, args> = def extends keyof $ ? resolutionToAst<def, $[def]> : def extends `${infer child}[]` ? child extends keyof $ ? [
|
|
18
|
+
resolutionToAst<child, $[child]>,
|
|
19
|
+
"[]"
|
|
20
|
+
] : fullStringParse<s.initialize<def>, $, args> : fullStringParse<s.initialize<def>, $, args>;
|
|
21
|
+
export type inferString<def extends string, $, args> = inferAstRoot<parseString<def, $, args>, $, args>;
|
|
22
|
+
export type BaseCompletions<$, args, otherSuggestions extends string = never> = resolvableReferenceIn<$> | resolvableReferenceIn<ArkAmbient.$> | (keyof args & string) | StringifiablePrefixOperator | otherSuggestions;
|
|
23
|
+
export declare const fullStringParse: (s: RuntimeState) => InnerParseResult;
|
|
24
|
+
type fullStringParse<s extends StaticState, $, args> = extractFinalizedResult<parseUntilFinalizer<s, $, args>>;
|
|
25
|
+
export declare const parseUntilFinalizer: (s: RuntimeState) => RootedRuntimeState;
|
|
26
|
+
export type parseUntilFinalizer<s extends StaticState, $, args> = s["finalizer"] extends undefined ? parseUntilFinalizer<next<s, $, args>, $, args> : s;
|
|
27
|
+
declare const next: (s: RuntimeState) => void;
|
|
28
|
+
type next<s extends StaticState, $, args> = s["root"] extends undefined ? parseOperand<s, $, args> : parseOperator<s, $, args>;
|
|
29
|
+
export type extractFinalizedResult<s extends StaticState> = s["finalizer"] extends "" ? s["root"] : s["finalizer"] extends ErrorMessage ? s["finalizer"] : s["finalizer"] extends "?" ? [s["root"], "?"] : s["finalizer"] extends "=" ? parseDefault<s["root"], s["unscanned"]> : ErrorMessage<writeUnexpectedCharacterMessage<s["finalizer"] & string>>;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Scanner, throwInternalError, throwParseError } from "@ark/util";
|
|
2
|
+
import { RuntimeState } from "./reduce/dynamic.js";
|
|
3
|
+
import { parseDefault } from "./shift/operator/default.js";
|
|
4
|
+
import { writeUnexpectedCharacterMessage } from "./shift/operator/operator.js";
|
|
5
|
+
export const parseString = (def, ctx) => {
|
|
6
|
+
const aliasResolution = ctx.$.maybeResolveRoot(def);
|
|
7
|
+
if (aliasResolution)
|
|
8
|
+
return aliasResolution;
|
|
9
|
+
if (def.endsWith("[]")) {
|
|
10
|
+
const possibleElementResolution = ctx.$.maybeResolveRoot(def.slice(0, -2));
|
|
11
|
+
if (possibleElementResolution)
|
|
12
|
+
return possibleElementResolution.array();
|
|
13
|
+
}
|
|
14
|
+
const s = new RuntimeState(new Scanner(def), ctx);
|
|
15
|
+
const node = fullStringParse(s);
|
|
16
|
+
if (s.finalizer === ">")
|
|
17
|
+
throwParseError(writeUnexpectedCharacterMessage(">"));
|
|
18
|
+
return node;
|
|
19
|
+
};
|
|
20
|
+
export const fullStringParse = (s) => {
|
|
21
|
+
s.parseOperand();
|
|
22
|
+
let result = parseUntilFinalizer(s).root;
|
|
23
|
+
if (!result) {
|
|
24
|
+
return throwInternalError(`Root was unexpectedly unset after parsing string '${s.scanner.scanned}'`);
|
|
25
|
+
}
|
|
26
|
+
if (s.finalizer === "=")
|
|
27
|
+
result = parseDefault(s);
|
|
28
|
+
else if (s.finalizer === "?")
|
|
29
|
+
result = [result, "?"];
|
|
30
|
+
s.scanner.shiftUntilNonWhitespace();
|
|
31
|
+
if (s.scanner.lookahead) {
|
|
32
|
+
// throw a parse error if non-whitespace characters made it here without being parsed
|
|
33
|
+
throwParseError(writeUnexpectedCharacterMessage(s.scanner.lookahead));
|
|
34
|
+
}
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
export const parseUntilFinalizer = (s) => {
|
|
38
|
+
while (s.finalizer === undefined)
|
|
39
|
+
next(s);
|
|
40
|
+
return s;
|
|
41
|
+
};
|
|
42
|
+
const next = (s) => s.hasRoot() ? s.parseOperator() : s.parseOperand();
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { type BaseParseContext, type BaseRoot, type Morph, type NodeSelector, type Predicate, type TypeMeta, type unwrapDefault } from "@ark/schema";
|
|
2
|
+
import { type array, type BuiltinObjectKind, type Constructor, type Domain, type show } from "@ark/util";
|
|
3
|
+
import type { defaultFor, distill, inferIntersection, inferMorphOut, inferPipe, inferPredicate, Out, withDefault } from "../attributes.ts";
|
|
4
|
+
import type { type } from "../keywords/keywords.ts";
|
|
5
|
+
import type { inferDefinition, validateDefinition } from "./definition.ts";
|
|
6
|
+
import { writeMissingRightOperandMessage } from "./shift/operand/unenclosed.ts";
|
|
7
|
+
import type { InfixToken } from "./shift/tokens.ts";
|
|
8
|
+
import type { BaseCompletions } from "./string.ts";
|
|
9
|
+
export declare const maybeParseTupleExpression: (def: array, ctx: BaseParseContext) => BaseRoot | null;
|
|
10
|
+
export type maybeValidateTupleExpression<def extends array, $, args> = def extends IndexZeroExpression ? validatePrefixExpression<def, $, args> : def extends IndexOneExpression ? validateIndexOneExpression<def, $, args> : def extends (readonly ["", ...unknown[]] | readonly [unknown, "", ...unknown[]]) ? readonly [
|
|
11
|
+
def[0] extends "" ? BaseCompletions<$, args, IndexZeroOperator | "..."> : def[0],
|
|
12
|
+
def[1] extends "" ? BaseCompletions<$, args, IndexOneOperator | "..."> : def[1]
|
|
13
|
+
] : null;
|
|
14
|
+
export type inferTupleExpression<def extends TupleExpression, $, args> = def[1] extends "[]" ? inferDefinition<def[0], $, args>[] : def[1] extends "?" ? inferDefinition<def[0], $, args> : def[1] extends "&" ? inferIntersection<inferDefinition<def[0], $, args>, inferDefinition<def[2], $, args>> : def[1] extends "|" ? inferDefinition<def[0], $, args> | inferDefinition<def[2], $, args> : def[1] extends ":" ? inferPredicate<inferDefinition<def[0], $, args>, def[2]> : def[1] extends "=>" ? parseMorph<def[0], def[2], $, args> : def[1] extends "|>" ? parseTo<def[0], def[2], $, args> : def[1] extends "=" ? withDefault<inferDefinition<def[0], $, args>, unwrapDefault<def[2]>> : def[1] extends "@" ? inferDefinition<def[0], $, args> : def extends readonly ["===", ...infer values] ? values[number] : def extends (readonly ["instanceof", ...infer constructors extends Constructor[]]) ? InstanceType<constructors[number]> : def[0] extends "keyof" ? inferKeyOfExpression<def[1], $, args> : never;
|
|
15
|
+
export type validatePrefixExpression<def extends IndexZeroExpression, $, args> = def["length"] extends 1 ? readonly [writeMissingRightOperandMessage<def[0]>] : def[0] extends "keyof" ? readonly [def[0], validateDefinition<def[1], $, args>] : def[0] extends "===" ? readonly [def[0], ...unknown[]] : def[0] extends "instanceof" ? readonly [def[0], ...Constructor[]] : never;
|
|
16
|
+
export type validateIndexOneExpression<def extends IndexOneExpression, $, args> = def[1] extends TuplePostfixOperator ? readonly [validateDefinition<def[0], $, args>, def[1]] : readonly [
|
|
17
|
+
validateDefinition<def[0], $, args>,
|
|
18
|
+
def["length"] extends 2 ? writeMissingRightOperandMessage<def[1]> : def[1],
|
|
19
|
+
def[1] extends "|" ? validateDefinition<def[2], $, args> : def[1] extends "&" ? validateDefinition<def[2], $, args> : def[1] extends ":" ? Predicate<type.infer.Out<def[0], $, args>> : def[1] extends "=>" ? Morph<type.infer.Out<def[0], $, args>> : def[1] extends "|>" ? validateDefinition<def[2], $, args> : def[1] extends "=" ? defaultFor<type.infer.In<def[0], $, args>> : def[1] extends "@" ? TypeMeta.MappableInput : validateDefinition<def[2], $, args>,
|
|
20
|
+
...(def[1] extends "@" ? [NodeSelector?] : [])
|
|
21
|
+
];
|
|
22
|
+
export type UnparsedTupleExpressionInput = {
|
|
23
|
+
instanceof: Constructor;
|
|
24
|
+
"===": unknown;
|
|
25
|
+
};
|
|
26
|
+
export type UnparsedTupleOperator = show<keyof UnparsedTupleExpressionInput>;
|
|
27
|
+
export declare const parseKeyOfTuple: IndexZeroParser<"keyof">;
|
|
28
|
+
export type inferKeyOfExpression<operandDef, $, args> = show<keyof inferDefinition<operandDef, $, args>>;
|
|
29
|
+
export type TupleExpression = IndexZeroExpression | IndexOneExpression;
|
|
30
|
+
export type TupleExpressionOperator = IndexZeroOperator | IndexOneOperator;
|
|
31
|
+
export type ArgTwoOperator = Exclude<IndexOneOperator, "?" | "=">;
|
|
32
|
+
export declare const parseMorphTuple: IndexOneParser<"=>">;
|
|
33
|
+
export declare const writeMalformedFunctionalExpressionMessage: (operator: ":" | "=>", value: unknown) => string;
|
|
34
|
+
export type parseTo<inDef, outDef, $, args> = inferPipe<inferDefinition<inDef, $, args>, inferDefinition<outDef, $, args>>;
|
|
35
|
+
export type parseMorph<inDef, morph, $, args> = morph extends Morph ? inferMorphOut<morph> extends infer out ? (In: distill.In<inferDefinition<inDef, $, args>>) => Out<out> : never : never;
|
|
36
|
+
export declare const parseNarrowTuple: IndexOneParser<":">;
|
|
37
|
+
export type IndexOneExpression<token extends string = IndexOneOperator> = readonly [unknown, token, ...unknown[]];
|
|
38
|
+
type IndexOneParser<token extends string> = (def: IndexOneExpression<token>, ctx: BaseParseContext) => BaseRoot;
|
|
39
|
+
declare const postfixParsers: {
|
|
40
|
+
"?": IndexOneParser<"?">;
|
|
41
|
+
"[]": IndexOneParser<"[]">;
|
|
42
|
+
};
|
|
43
|
+
export type TuplePostfixOperator = keyof typeof postfixParsers;
|
|
44
|
+
declare const infixParsers: {
|
|
45
|
+
"&": IndexOneParser<"&">;
|
|
46
|
+
"|": IndexOneParser<"|">;
|
|
47
|
+
"|>": IndexOneParser<"|>">;
|
|
48
|
+
"=": IndexOneParser<"=">;
|
|
49
|
+
":": IndexOneParser<":">;
|
|
50
|
+
"=>": IndexOneParser<"=>">;
|
|
51
|
+
"@": IndexOneParser<"@">;
|
|
52
|
+
};
|
|
53
|
+
export type TupleInfixOperator = keyof typeof infixParsers;
|
|
54
|
+
declare const indexOneParsers: {
|
|
55
|
+
"&": IndexOneParser<"&">;
|
|
56
|
+
"|": IndexOneParser<"|">;
|
|
57
|
+
"|>": IndexOneParser<"|>">;
|
|
58
|
+
"=": IndexOneParser<"=">;
|
|
59
|
+
":": IndexOneParser<":">;
|
|
60
|
+
"=>": IndexOneParser<"=>">;
|
|
61
|
+
"@": IndexOneParser<"@">;
|
|
62
|
+
"?": IndexOneParser<"?">;
|
|
63
|
+
"[]": IndexOneParser<"[]">;
|
|
64
|
+
};
|
|
65
|
+
export type IndexOneOperator = keyof typeof indexOneParsers;
|
|
66
|
+
export type InfixExpression = readonly [unknown, InfixToken, ...unknown[]];
|
|
67
|
+
type IndexZeroParser<token extends string> = (def: IndexZeroExpression<token>, ctx: BaseParseContext) => BaseRoot;
|
|
68
|
+
type IndexZeroExpression<token extends string = IndexZeroOperator> = readonly [
|
|
69
|
+
token,
|
|
70
|
+
...unknown[]
|
|
71
|
+
];
|
|
72
|
+
declare const indexZeroParsers: {
|
|
73
|
+
keyof: IndexZeroParser<"keyof">;
|
|
74
|
+
instanceof: IndexZeroParser<"instanceof">;
|
|
75
|
+
"===": IndexZeroParser<"===">;
|
|
76
|
+
};
|
|
77
|
+
export type IndexZeroOperator = keyof typeof indexZeroParsers;
|
|
78
|
+
export declare const writeInvalidConstructorMessage: <actual extends Domain | BuiltinObjectKind>(actual: actual) => string;
|
|
79
|
+
export {};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Disjoint, intersectNodesRoot, pipeNodesRoot } from "@ark/schema";
|
|
2
|
+
import { objectKindOrDomainOf, throwParseError } from "@ark/util";
|
|
3
|
+
import { shallowDefaultableMessage, shallowOptionalMessage } from "./ast/validate.js";
|
|
4
|
+
import { writeMissingRightOperandMessage } from "./shift/operand/unenclosed.js";
|
|
5
|
+
export const maybeParseTupleExpression = (def, ctx) => isIndexZeroExpression(def) ? indexZeroParsers[def[0]](def, ctx)
|
|
6
|
+
: isIndexOneExpression(def) ? indexOneParsers[def[1]](def, ctx)
|
|
7
|
+
: null;
|
|
8
|
+
export const parseKeyOfTuple = (def, ctx) => ctx.$.parseOwnDefinitionFormat(def[1], ctx).keyof();
|
|
9
|
+
const parseBranchTuple = (def, ctx) => {
|
|
10
|
+
if (def[2] === undefined)
|
|
11
|
+
return throwParseError(writeMissingRightOperandMessage(def[1], ""));
|
|
12
|
+
const l = ctx.$.parseOwnDefinitionFormat(def[0], ctx);
|
|
13
|
+
const r = ctx.$.parseOwnDefinitionFormat(def[2], ctx);
|
|
14
|
+
if (def[1] === "|")
|
|
15
|
+
return ctx.$.node("union", { branches: [l, r] });
|
|
16
|
+
const result = def[1] === "&" ?
|
|
17
|
+
intersectNodesRoot(l, r, ctx.$)
|
|
18
|
+
: pipeNodesRoot(l, r, ctx.$);
|
|
19
|
+
if (result instanceof Disjoint)
|
|
20
|
+
return result.throw();
|
|
21
|
+
return result;
|
|
22
|
+
};
|
|
23
|
+
const parseArrayTuple = (def, ctx) => ctx.$.parseOwnDefinitionFormat(def[0], ctx).array();
|
|
24
|
+
export const parseMorphTuple = (def, ctx) => {
|
|
25
|
+
if (typeof def[2] !== "function") {
|
|
26
|
+
return throwParseError(writeMalformedFunctionalExpressionMessage("=>", def[2]));
|
|
27
|
+
}
|
|
28
|
+
return ctx.$.parseOwnDefinitionFormat(def[0], ctx).pipe(def[2]);
|
|
29
|
+
};
|
|
30
|
+
export const writeMalformedFunctionalExpressionMessage = (operator, value) => `${operator === ":" ? "Narrow" : "Morph"} expression requires a function following '${operator}' (was ${typeof value})`;
|
|
31
|
+
export const parseNarrowTuple = (def, ctx) => {
|
|
32
|
+
if (typeof def[2] !== "function") {
|
|
33
|
+
return throwParseError(writeMalformedFunctionalExpressionMessage(":", def[2]));
|
|
34
|
+
}
|
|
35
|
+
return ctx.$.parseOwnDefinitionFormat(def[0], ctx).constrain("predicate", def[2]);
|
|
36
|
+
};
|
|
37
|
+
const parseMetaTuple = (def, ctx) => ctx.$.parseOwnDefinitionFormat(def[0], ctx).configure(def[2], def[3]);
|
|
38
|
+
const defineIndexOneParsers = (parsers) => parsers;
|
|
39
|
+
const postfixParsers = defineIndexOneParsers({
|
|
40
|
+
"[]": parseArrayTuple,
|
|
41
|
+
"?": () => throwParseError(shallowOptionalMessage)
|
|
42
|
+
});
|
|
43
|
+
const infixParsers = defineIndexOneParsers({
|
|
44
|
+
"|": parseBranchTuple,
|
|
45
|
+
"&": parseBranchTuple,
|
|
46
|
+
":": parseNarrowTuple,
|
|
47
|
+
"=>": parseMorphTuple,
|
|
48
|
+
"|>": parseBranchTuple,
|
|
49
|
+
"@": parseMetaTuple,
|
|
50
|
+
// since object and tuple literals parse there via `parseProperty`,
|
|
51
|
+
// they must be shallow if parsed directly as a tuple expression
|
|
52
|
+
"=": () => throwParseError(shallowDefaultableMessage)
|
|
53
|
+
});
|
|
54
|
+
const indexOneParsers = { ...postfixParsers, ...infixParsers };
|
|
55
|
+
const isIndexOneExpression = (def) => indexOneParsers[def[1]] !== undefined;
|
|
56
|
+
const defineIndexZeroParsers = (parsers) => parsers;
|
|
57
|
+
const indexZeroParsers = defineIndexZeroParsers({
|
|
58
|
+
keyof: parseKeyOfTuple,
|
|
59
|
+
instanceof: (def, ctx) => {
|
|
60
|
+
if (typeof def[1] !== "function") {
|
|
61
|
+
return throwParseError(writeInvalidConstructorMessage(objectKindOrDomainOf(def[1])));
|
|
62
|
+
}
|
|
63
|
+
const branches = def
|
|
64
|
+
.slice(1)
|
|
65
|
+
.map(ctor => typeof ctor === "function" ?
|
|
66
|
+
ctx.$.node("proto", { proto: ctor })
|
|
67
|
+
: throwParseError(writeInvalidConstructorMessage(objectKindOrDomainOf(ctor))));
|
|
68
|
+
return branches.length === 1 ?
|
|
69
|
+
branches[0]
|
|
70
|
+
: ctx.$.node("union", { branches });
|
|
71
|
+
},
|
|
72
|
+
"===": (def, ctx) => ctx.$.units(def.slice(1))
|
|
73
|
+
});
|
|
74
|
+
const isIndexZeroExpression = (def) => indexZeroParsers[def[0]] !== undefined;
|
|
75
|
+
export const writeInvalidConstructorMessage = (actual) => `Expected a constructor following 'instanceof' operator (was ${actual})`;
|