@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,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ark/schema",
|
|
3
|
+
"version": "0.56.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "David Blass",
|
|
7
|
+
"email": "david@arktype.io",
|
|
8
|
+
"url": "https://arktype.io"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/arktypeio/arktype.git",
|
|
13
|
+
"directory": "ark/schema"
|
|
14
|
+
},
|
|
15
|
+
"type": "module",
|
|
16
|
+
"main": "./out/index.js",
|
|
17
|
+
"types": "./out/index.d.ts",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"ark-ts": "./index.ts",
|
|
21
|
+
"default": "./out/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./config": {
|
|
24
|
+
"ark-ts": "./config.ts",
|
|
25
|
+
"default": "./out/config.js"
|
|
26
|
+
},
|
|
27
|
+
"./internal/*.ts": {
|
|
28
|
+
"ark-ts": "./*.ts",
|
|
29
|
+
"default": "./out/*.js"
|
|
30
|
+
},
|
|
31
|
+
"./internal/*.js": {
|
|
32
|
+
"ark-ts": "./*.ts",
|
|
33
|
+
"default": "./out/*.js"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"out"
|
|
38
|
+
],
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@ark/util": "0.56.0"
|
|
41
|
+
},
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public"
|
|
44
|
+
},
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build": "ts ../repo/build.ts",
|
|
47
|
+
"bench": "ts ./__tests__/comparison.bench.ts",
|
|
48
|
+
"test": "ts ../repo/testPackage.ts",
|
|
49
|
+
"tnt": "ts ../repo/testPackage.ts --skipTypes"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2025 ArkType
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import type { GuardablePredicate } from "./functions.ts";
|
|
2
|
+
import type { anyOrNever, conform } from "./generics.ts";
|
|
3
|
+
import type { isDisjoint } from "./intersections.ts";
|
|
4
|
+
import type { parseNonNegativeInteger } from "./numbers.ts";
|
|
5
|
+
type DuplicateData<val = unknown> = {
|
|
6
|
+
element: val;
|
|
7
|
+
indices: number[];
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Extracts duplicated elements and their indices from an array, returning them.
|
|
11
|
+
*
|
|
12
|
+
* Note that given `a === b && b === c`, then `c === a` must be `true` for this to give accurate results.
|
|
13
|
+
*
|
|
14
|
+
* @param arr The array to extract duplicate elements from.
|
|
15
|
+
*/ export declare const getDuplicatesOf: <const arr extends array>(arr: arr, opts?: ComparisonOptions<arr[number]>) => DuplicateData<arr[number]>[];
|
|
16
|
+
export type pathToString<segments extends string[], delimiter extends string = "/"> = segments extends [] ? "/" : join<segments, delimiter>;
|
|
17
|
+
export declare const join: <segments extends array<string>, delimiter extends string>(segments: segments, delimiter: delimiter) => join<segments, delimiter>;
|
|
18
|
+
export type join<segments extends array<string>, delimiter extends string, result extends string = ""> = segments extends (readonly [infer head extends string, ...infer tail extends string[]]) ? join<tail, delimiter, result extends "" ? head : `${result}${delimiter}${head}`> : result;
|
|
19
|
+
export declare const getPath: (root: unknown, path: string[]) => unknown;
|
|
20
|
+
export declare const intersectUniqueLists: <item>(l: readonly item[], r: readonly item[]) => item[];
|
|
21
|
+
export type filter<t extends array, constraint, result extends unknown[] = []> = t extends readonly [infer head, ...infer tail] ? filter<tail, constraint, head extends constraint ? [...result, head] : result> : result;
|
|
22
|
+
export type array<t = unknown> = readonly t[];
|
|
23
|
+
export declare namespace array {
|
|
24
|
+
type multiply<t extends array, count extends number> = _multiply<t, [
|
|
25
|
+
], count, [
|
|
26
|
+
]>;
|
|
27
|
+
type _multiply<base extends array, result extends array, count extends number, i extends 1[]> = i["length"] extends count ? result : _multiply<base, [...result, ...base], count, [...i, 1]>;
|
|
28
|
+
type repeat<element, count extends number> = buildFromSegments<element, [
|
|
29
|
+
], exponentials.max<count>, count>;
|
|
30
|
+
type buildFromSegments<element, result extends 1[], segments extends 1[][], count extends number, next extends 1[] = [...result, ...segments[0]]> = next["length"] extends count ? {
|
|
31
|
+
[i in keyof next]: element;
|
|
32
|
+
} : `${count}` extends keyof next ? buildFromSegments<element, result, nextSegments<segments>, count> : buildFromSegments<element, next, nextSegments<segments>, count>;
|
|
33
|
+
type nextSegments<segments extends 1[][]> = segments extends [unknown, ...infer nextSegments extends 1[][]] ? nextSegments : never;
|
|
34
|
+
type minLength<element, minLength extends number> = readonly [
|
|
35
|
+
...multiply<[element], minLength>,
|
|
36
|
+
...element[]
|
|
37
|
+
];
|
|
38
|
+
}
|
|
39
|
+
export type listable<t> = t | readonly t[];
|
|
40
|
+
export type flattenListable<t> = t extends array<infer element> ? element : t;
|
|
41
|
+
export type longerThan<t extends array, n extends number> = `${n}` extends keyof t ? true : false;
|
|
42
|
+
export type CollapsingList<t = unknown> = readonly [] | t | readonly [t, t, ...t[]];
|
|
43
|
+
export type headOf<t extends array> = t[0];
|
|
44
|
+
export type tailOf<t extends array> = t extends readonly [unknown, ...infer tail] ? tail : never;
|
|
45
|
+
export type lastIndexOf<t extends array> = tailOf<t>["length"];
|
|
46
|
+
export type lastOf<t extends array> = t[lastIndexOf<t>];
|
|
47
|
+
export type initOf<t extends array> = t extends readonly [...infer init, unknown] ? init : never;
|
|
48
|
+
export type numericStringKeyOf<t extends array> = Extract<keyof t, `${number}`>;
|
|
49
|
+
export type arrayIndexOf<a extends array> = keyof a extends infer k ? parseNonNegativeInteger<k & string> : never;
|
|
50
|
+
export type liftArray<t> = t extends array ? [
|
|
51
|
+
t
|
|
52
|
+
] extends [anyOrNever] ? t[] : t : t[];
|
|
53
|
+
export declare const liftArray: <t>(data: t) => liftArray<t>;
|
|
54
|
+
/**
|
|
55
|
+
* Splits an array into two arrays based on the result of a predicate
|
|
56
|
+
*
|
|
57
|
+
* @param predicate - The guard function used to determine which items to include.
|
|
58
|
+
* @returns A tuple containing two arrays:
|
|
59
|
+
* - the first includes items for which `predicate` returns true
|
|
60
|
+
* - the second includes items for which `predicate` returns false
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* const list = [1, "2", "3", 4, 5];
|
|
64
|
+
* const [numbers, strings] = spliterate(list, (x) => typeof x === "number");
|
|
65
|
+
* // Type: number[]
|
|
66
|
+
* // Output: [1, 4, 5]
|
|
67
|
+
* console.log(evens);
|
|
68
|
+
* // Type: string[]
|
|
69
|
+
* // Output: ["2", "3"]
|
|
70
|
+
* console.log(odds);
|
|
71
|
+
*/
|
|
72
|
+
export declare const spliterate: <item, included extends item>(arr: readonly item[], predicate: GuardablePredicate<item, included>) => [included: included[], excluded: [item] extends [included] ? item[] : Exclude<item, included>[]];
|
|
73
|
+
export declare const ReadonlyArray: new <T>(...args: ConstructorParameters<typeof Array<T>>) => ReadonlyArray<T>;
|
|
74
|
+
export declare const includes: <a extends array>(array: a, element: unknown) => element is a[number];
|
|
75
|
+
export declare const range: (length: number, offset?: number) => number[];
|
|
76
|
+
export type AppendOptions = {
|
|
77
|
+
/** If true, adds the element to the beginning of the array instead of the end */
|
|
78
|
+
prepend?: boolean;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Adds a value or array to an array, returning the concatenated result
|
|
82
|
+
*/
|
|
83
|
+
export declare const append: <to extends unknown[] | undefined, value extends appendableValue<to>>(to: to, value: value, opts?: AppendOptions) => to & {};
|
|
84
|
+
export type appendableValue<to extends array | undefined> = to extends array<infer element> ? element extends array ? array<element> : listable<element> : never;
|
|
85
|
+
/**
|
|
86
|
+
* Concatenates an element or list with a readonly list
|
|
87
|
+
*/
|
|
88
|
+
export declare const conflatenate: <element>(to: readonly element[] | undefined | null, elementOrList: appendableValue<readonly element[]> | undefined | null) => readonly element[];
|
|
89
|
+
/**
|
|
90
|
+
* Concatenates a variadic list of elements or lists with a readonly list
|
|
91
|
+
*/
|
|
92
|
+
export declare const conflatenateAll: <element>(...elementsOrLists: (listable<element> | undefined | null)[]) => readonly element[];
|
|
93
|
+
export interface ComparisonOptions<t = unknown> {
|
|
94
|
+
isEqual?: (l: t, r: t) => boolean;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Appends a value or concatenates an array to an array if it is not already included, returning the array
|
|
98
|
+
*/
|
|
99
|
+
export declare const appendUnique: <to extends unknown[]>(to: to | undefined, value: NoInfer<Readonly<to> | to[number]>, opts?: ComparisonOptions<to[number]>) => to;
|
|
100
|
+
export type groupableKeyOf<o> = keyof o extends infer k ? k extends keyof o ? o[k] extends PropertyKey ? k : never : never : never;
|
|
101
|
+
export type groupBy<element, discriminant extends groupableKeyOf<element>> = {
|
|
102
|
+
[k in element[discriminant] & PropertyKey]?: (element extends unknown ? isDisjoint<element[discriminant], k> extends true ? never : element : never)[];
|
|
103
|
+
} & unknown;
|
|
104
|
+
export declare const groupBy: <element, discriminant extends groupableKeyOf<element>>(array: readonly element[], discriminant: discriminant) => groupBy<element, discriminant>;
|
|
105
|
+
export declare const arrayEquals: <element>(l: array<element>, r: array<element>, opts?: ComparisonOptions<element>) => boolean;
|
|
106
|
+
export type validateExhaustiveKeys<keys extends readonly PropertyKey[], expectedKey extends PropertyKey> = keys extends readonly [infer head, ...infer tail extends PropertyKey[]] ? readonly [
|
|
107
|
+
conform<head, expectedKey>,
|
|
108
|
+
...validateExhaustiveKeys<tail, Exclude<expectedKey, head>>
|
|
109
|
+
] : [expectedKey] extends [never] ? [] : [expectedKey];
|
|
110
|
+
export type applyElementLabels<t extends readonly unknown[], labels extends readonly unknown[]> = labels extends [unknown, ...infer labelsTail] ? t extends readonly [infer head, ...infer tail] ? readonly [
|
|
111
|
+
...labelElement<head, labels>,
|
|
112
|
+
...applyElementLabels<tail, labelsTail>
|
|
113
|
+
] : applyOptionalElementLabels<Required<t>, labels> : t;
|
|
114
|
+
type applyOptionalElementLabels<t extends readonly unknown[], labels extends readonly unknown[]> = labels extends readonly [unknown, ...infer labelsTail] ? t extends readonly [infer head, ...infer tail] ? [
|
|
115
|
+
...labelOptionalElement<head, labels>,
|
|
116
|
+
...applyOptionalElementLabels<tail, labelsTail>
|
|
117
|
+
] : applyRestElementLabels<t, labels> : t;
|
|
118
|
+
type applyRestElementLabels<t extends readonly unknown[], labels extends readonly unknown[]> = t extends readonly [] ? [] : labels extends readonly [unknown, ...infer tail] ? [
|
|
119
|
+
...labelOptionalElement<t[0], labels>,
|
|
120
|
+
...applyRestElementLabels<t, tail>
|
|
121
|
+
] : t;
|
|
122
|
+
type labelElement<element, labels extends readonly unknown[]> = labels extends readonly [unknown] ? {
|
|
123
|
+
[K in keyof labels]: element;
|
|
124
|
+
} : labels extends readonly [...infer head, unknown] ? labelElement<element, head> : [_: element];
|
|
125
|
+
type labelOptionalElement<element, label extends readonly unknown[]> = label extends readonly [unknown] ? {
|
|
126
|
+
[K in keyof label]?: element;
|
|
127
|
+
} : label extends readonly [...infer head, unknown] ? labelOptionalElement<element, head> : [_?: element];
|
|
128
|
+
export type setIndex<arr extends readonly unknown[], i extends number, to extends arr[number]> = arr extends arr[number][] ? _setIndex<arr, i, to, []> : Readonly<_setIndex<arr, i, to, []>>;
|
|
129
|
+
type _setIndex<arr extends readonly unknown[], i extends number, to extends arr[number], result extends arr[number][]> = arr extends readonly [infer head, ...infer tail] ? _setIndex<tail, i, to, [...result, result["length"] extends i ? to : head]> : result;
|
|
130
|
+
type zero = [];
|
|
131
|
+
type one = [1];
|
|
132
|
+
type two = [1, 1];
|
|
133
|
+
type three = [...two, ...two];
|
|
134
|
+
type four = [...three, ...three];
|
|
135
|
+
type five = [...four, ...four];
|
|
136
|
+
type six = [...five, ...five];
|
|
137
|
+
type seven = [...six, ...six];
|
|
138
|
+
type eight = [...seven, ...seven];
|
|
139
|
+
type nine = [...eight, ...eight];
|
|
140
|
+
type ten = [...nine, ...nine];
|
|
141
|
+
type eleven = [...ten, ...ten];
|
|
142
|
+
type twelve = [...eleven, ...eleven];
|
|
143
|
+
type thirteen = [...twelve, ...twelve];
|
|
144
|
+
type fourteen = [...thirteen, ...thirteen];
|
|
145
|
+
type exponentials = [
|
|
146
|
+
fourteen,
|
|
147
|
+
thirteen,
|
|
148
|
+
twelve,
|
|
149
|
+
eleven,
|
|
150
|
+
ten,
|
|
151
|
+
nine,
|
|
152
|
+
eight,
|
|
153
|
+
seven,
|
|
154
|
+
six,
|
|
155
|
+
five,
|
|
156
|
+
four,
|
|
157
|
+
three,
|
|
158
|
+
two,
|
|
159
|
+
one,
|
|
160
|
+
zero
|
|
161
|
+
];
|
|
162
|
+
declare namespace exponentials {
|
|
163
|
+
type max<n extends number> = _max<n, exponentials>;
|
|
164
|
+
type _max<n extends number, filtered extends unknown[]> = `${n}` extends keyof filtered[0] ? _max<n, tailOf<filtered>> : filtered;
|
|
165
|
+
}
|
|
166
|
+
export {};
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extracts duplicated elements and their indices from an array, returning them.
|
|
3
|
+
*
|
|
4
|
+
* Note that given `a === b && b === c`, then `c === a` must be `true` for this to give accurate results.
|
|
5
|
+
*
|
|
6
|
+
* @param arr The array to extract duplicate elements from.
|
|
7
|
+
*/ export const getDuplicatesOf = (arr, opts) => {
|
|
8
|
+
const isEqual = opts?.isEqual ?? ((l, r) => l === r);
|
|
9
|
+
const elementFirstSeenIndx = new Map();
|
|
10
|
+
const duplicates = [];
|
|
11
|
+
for (const [indx, element] of arr.entries()) {
|
|
12
|
+
const duplicatesIndx = duplicates.findIndex(duplicate => isEqual(duplicate.element, element));
|
|
13
|
+
if (duplicatesIndx !== -1) {
|
|
14
|
+
// This is at least the third occurrence of an item equal to `element`,
|
|
15
|
+
// so add this index to the list of indices where the element is duplicated.
|
|
16
|
+
duplicates[duplicatesIndx].indices.push(indx);
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
// At this point, we know this is either the first
|
|
20
|
+
// or second occurrence of an item equal to `element`...
|
|
21
|
+
let found = false;
|
|
22
|
+
for (const [existingElement, firstSeenIndx] of elementFirstSeenIndx) {
|
|
23
|
+
if (isEqual(element, existingElement)) {
|
|
24
|
+
// This is the second occurrence of an item equal to `element`,
|
|
25
|
+
// so store it as a duplicate.
|
|
26
|
+
found = true;
|
|
27
|
+
duplicates.push({
|
|
28
|
+
element: existingElement,
|
|
29
|
+
indices: [firstSeenIndx, indx]
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (!found) {
|
|
34
|
+
// We haven't seen this element before,
|
|
35
|
+
// so just store the index it was first seen
|
|
36
|
+
elementFirstSeenIndx.set(element, indx);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return duplicates;
|
|
40
|
+
};
|
|
41
|
+
export const join = (segments, delimiter) => segments.join(delimiter);
|
|
42
|
+
export const getPath = (root, path) => {
|
|
43
|
+
let result = root;
|
|
44
|
+
for (const segment of path) {
|
|
45
|
+
if (typeof result !== "object" || result === null)
|
|
46
|
+
return undefined;
|
|
47
|
+
result = result[segment];
|
|
48
|
+
}
|
|
49
|
+
return result;
|
|
50
|
+
};
|
|
51
|
+
export const intersectUniqueLists = (l, r) => {
|
|
52
|
+
const intersection = [...l];
|
|
53
|
+
for (const item of r)
|
|
54
|
+
if (!l.includes(item))
|
|
55
|
+
intersection.push(item);
|
|
56
|
+
return intersection;
|
|
57
|
+
};
|
|
58
|
+
export const liftArray = (data) => (Array.isArray(data) ? data : [data]);
|
|
59
|
+
/**
|
|
60
|
+
* Splits an array into two arrays based on the result of a predicate
|
|
61
|
+
*
|
|
62
|
+
* @param predicate - The guard function used to determine which items to include.
|
|
63
|
+
* @returns A tuple containing two arrays:
|
|
64
|
+
* - the first includes items for which `predicate` returns true
|
|
65
|
+
* - the second includes items for which `predicate` returns false
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* const list = [1, "2", "3", 4, 5];
|
|
69
|
+
* const [numbers, strings] = spliterate(list, (x) => typeof x === "number");
|
|
70
|
+
* // Type: number[]
|
|
71
|
+
* // Output: [1, 4, 5]
|
|
72
|
+
* console.log(evens);
|
|
73
|
+
* // Type: string[]
|
|
74
|
+
* // Output: ["2", "3"]
|
|
75
|
+
* console.log(odds);
|
|
76
|
+
*/
|
|
77
|
+
export const spliterate = (arr, predicate) => {
|
|
78
|
+
const result = [[], []];
|
|
79
|
+
for (const item of arr) {
|
|
80
|
+
if (predicate(item))
|
|
81
|
+
result[0].push(item);
|
|
82
|
+
else
|
|
83
|
+
result[1].push(item);
|
|
84
|
+
}
|
|
85
|
+
return result;
|
|
86
|
+
};
|
|
87
|
+
export const ReadonlyArray = Array;
|
|
88
|
+
export const includes = (array, element) => array.includes(element);
|
|
89
|
+
export const range = (length, offset = 0) => [...new Array(length)].map((_, i) => i + offset);
|
|
90
|
+
/**
|
|
91
|
+
* Adds a value or array to an array, returning the concatenated result
|
|
92
|
+
*/
|
|
93
|
+
export const append = (to, value, opts) => {
|
|
94
|
+
if (to === undefined) {
|
|
95
|
+
return (value === undefined ? []
|
|
96
|
+
: Array.isArray(value) ? value
|
|
97
|
+
: [value]);
|
|
98
|
+
}
|
|
99
|
+
if (opts?.prepend) {
|
|
100
|
+
if (Array.isArray(value))
|
|
101
|
+
to.unshift(...value);
|
|
102
|
+
else
|
|
103
|
+
to.unshift(value);
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
if (Array.isArray(value))
|
|
107
|
+
to.push(...value);
|
|
108
|
+
else
|
|
109
|
+
to.push(value);
|
|
110
|
+
}
|
|
111
|
+
return to;
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Concatenates an element or list with a readonly list
|
|
115
|
+
*/
|
|
116
|
+
export const conflatenate = (to, elementOrList) => {
|
|
117
|
+
if (elementOrList === undefined || elementOrList === null)
|
|
118
|
+
return to ?? [];
|
|
119
|
+
if (to === undefined || to === null)
|
|
120
|
+
return liftArray(elementOrList);
|
|
121
|
+
return to.concat(elementOrList);
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Concatenates a variadic list of elements or lists with a readonly list
|
|
125
|
+
*/
|
|
126
|
+
export const conflatenateAll = (...elementsOrLists) => elementsOrLists.reduce(conflatenate, []);
|
|
127
|
+
/**
|
|
128
|
+
* Appends a value or concatenates an array to an array if it is not already included, returning the array
|
|
129
|
+
*/
|
|
130
|
+
export const appendUnique = (to, value, opts) => {
|
|
131
|
+
if (to === undefined)
|
|
132
|
+
return Array.isArray(value) ? value : [value];
|
|
133
|
+
const isEqual = opts?.isEqual ?? ((l, r) => l === r);
|
|
134
|
+
for (const v of liftArray(value))
|
|
135
|
+
if (!to.some(existing => isEqual(existing, v)))
|
|
136
|
+
to.push(v);
|
|
137
|
+
return to;
|
|
138
|
+
};
|
|
139
|
+
export const groupBy = (array, discriminant) => array.reduce((result, item) => {
|
|
140
|
+
const key = item[discriminant];
|
|
141
|
+
result[key] = append(result[key], item);
|
|
142
|
+
return result;
|
|
143
|
+
}, {});
|
|
144
|
+
export const arrayEquals = (l, r, opts) => l.length === r.length &&
|
|
145
|
+
l.every(opts?.isEqual ?
|
|
146
|
+
(lItem, i) => opts.isEqual(lItem, r[i])
|
|
147
|
+
: (lItem, i) => lItem === r[i]);
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Shallowly copy the properties of the object. */
|
|
2
|
+
export declare const shallowClone: <input extends object>(input: input) => input;
|
|
3
|
+
/** Deeply copy the properties of the a non-subclassed Object, Array or Date.*/
|
|
4
|
+
export declare const deepClone: <input extends object>(input: input) => input;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { getBuiltinNameOfConstructor } from "./objectKinds.js";
|
|
2
|
+
/** Shallowly copy the properties of the object. */
|
|
3
|
+
export const shallowClone = input => _clone(input, null);
|
|
4
|
+
/** Deeply copy the properties of the a non-subclassed Object, Array or Date.*/
|
|
5
|
+
export const deepClone = (input) => _clone(input, new Map());
|
|
6
|
+
const _clone = (input, seen) => {
|
|
7
|
+
if (typeof input !== "object" || input === null)
|
|
8
|
+
return input;
|
|
9
|
+
if (seen?.has(input))
|
|
10
|
+
return seen.get(input);
|
|
11
|
+
const builtinConstructorName = getBuiltinNameOfConstructor(input.constructor);
|
|
12
|
+
if (builtinConstructorName === "Date")
|
|
13
|
+
return new Date(input.getTime());
|
|
14
|
+
// we don't try and clone other prototypes here since this we can't guarantee arrow functions attached to the object
|
|
15
|
+
// are rebound in case they reference `this` (see https://x.com/colinhacks/status/1818422039210049985)
|
|
16
|
+
if (builtinConstructorName && builtinConstructorName !== "Array")
|
|
17
|
+
return input;
|
|
18
|
+
const cloned = Array.isArray(input) ?
|
|
19
|
+
input.slice()
|
|
20
|
+
: Object.create(Object.getPrototypeOf(input));
|
|
21
|
+
const propertyDescriptors = Object.getOwnPropertyDescriptors(input);
|
|
22
|
+
if (seen) {
|
|
23
|
+
seen.set(input, cloned);
|
|
24
|
+
for (const k in propertyDescriptors) {
|
|
25
|
+
const desc = propertyDescriptors[k];
|
|
26
|
+
if ("get" in desc || "set" in desc)
|
|
27
|
+
continue;
|
|
28
|
+
desc.value = _clone(desc.value, seen);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
Object.defineProperties(cloned, propertyDescriptors);
|
|
32
|
+
return cloned;
|
|
33
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { array } from "./arrays.ts";
|
|
2
|
+
import type { describeDomainOf, domainOf, inferDomain } from "./domain.ts";
|
|
3
|
+
import type { anyOrNever, satisfy, Stringifiable } from "./generics.ts";
|
|
4
|
+
import type { describeObject } from "./objectKinds.ts";
|
|
5
|
+
import type { stringifyUnion } from "./unionToTuple.ts";
|
|
6
|
+
export type DescribeOptions = {
|
|
7
|
+
includeArticles?: boolean;
|
|
8
|
+
branchDelimiter?: string;
|
|
9
|
+
};
|
|
10
|
+
export type typeToString<t, opts extends DescribeOptions = {}> = stringifyUnion<[
|
|
11
|
+
t
|
|
12
|
+
] extends [anyOrNever] ? unknown extends t ? "any" : "never" : unknown extends t ? "unknown" : boolean extends t ? "boolean" | ([t] extends [boolean] ? never : typeToString<Exclude<t, boolean>, opts>) : t extends array ? arrayTypeToString<t, opts> : t extends object ? describeObject<t, opts> : t extends Stringifiable ? stringifiableToString<t, opts> : describeDomainOf<t, opts>, opts["branchDelimiter"] extends string ? opts["branchDelimiter"] : describeDefaults["branchDelimiter"]>;
|
|
13
|
+
type stringifiableToString<t extends Stringifiable, opts extends DescribeOptions> = inferDomain<domainOf<t>> extends t ? describeDomainOf<t, opts> : `${t}`;
|
|
14
|
+
export type describe<t> = typeToString<t, {
|
|
15
|
+
includeArticles: true;
|
|
16
|
+
branchDelimiter: " or ";
|
|
17
|
+
}>;
|
|
18
|
+
type arrayTypeToString<t extends array, opts extends DescribeOptions> = typeToString<t[number], opts> extends infer element extends string ? opts["includeArticles"] extends true ? describeArrayOf<element> : includesDelimiter<element, opts> extends true ? `(${element})[]` : `${element}[]` : never;
|
|
19
|
+
type describeArrayOf<element extends string> = element extends "unknown" ? "an array" : `an array of ${element}`;
|
|
20
|
+
type includesDelimiter<s extends string, opts extends DescribeOptions> = s extends (`${string}${opts["branchDelimiter"] extends string ? opts["branchDelimiter"] : describeDefaults["branchDelimiter"]}${string}`) ? true : false;
|
|
21
|
+
export type describeDefaults = satisfy<Required<DescribeOptions>, {
|
|
22
|
+
includeArticles: false;
|
|
23
|
+
branchDelimiter: " | ";
|
|
24
|
+
}>;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { describeDefaults, DescribeOptions } from "./describe.ts";
|
|
2
|
+
import type { show } from "./generics.ts";
|
|
3
|
+
import type { stringifyUnion } from "./unionToTuple.ts";
|
|
4
|
+
export type JsTypeOf = "object" | "function" | "number" | "bigint" | "boolean" | "string" | "symbol" | "undefined" | "null";
|
|
5
|
+
export declare const hasDomain: <data, domain extends Domain>(data: data, kind: domain) => data is data & inferDomain<domain>;
|
|
6
|
+
type TypesByDomain = {
|
|
7
|
+
bigint: bigint;
|
|
8
|
+
boolean: boolean;
|
|
9
|
+
number: number;
|
|
10
|
+
object: object;
|
|
11
|
+
string: string;
|
|
12
|
+
symbol: symbol;
|
|
13
|
+
undefined: undefined;
|
|
14
|
+
null: null;
|
|
15
|
+
};
|
|
16
|
+
export type inferDomain<kind extends Domain> = Domain extends kind ? unknown : TypesByDomain[kind];
|
|
17
|
+
export type Domain = show<keyof TypesByDomain>;
|
|
18
|
+
export type NullishDomain = "undefined" | "null";
|
|
19
|
+
export type NonNullishDomain = Exclude<Domain, NullishDomain>;
|
|
20
|
+
export type PrimitiveDomain = Exclude<Domain, "object">;
|
|
21
|
+
export type Primitive = inferDomain<PrimitiveDomain>;
|
|
22
|
+
export type domainOf<data> = unknown extends data ? Domain : data extends object ? "object" : data extends string ? "string" : data extends number ? "number" : data extends boolean ? "boolean" : data extends undefined ? "undefined" : data extends null ? "null" : data extends bigint ? "bigint" : data extends symbol ? "symbol" : never;
|
|
23
|
+
export declare const domainOf: <data>(data: data) => domainOf<data>;
|
|
24
|
+
/** Each domain's completion for the phrase "must be _____" */
|
|
25
|
+
export declare const domainDescriptions: {
|
|
26
|
+
readonly boolean: "boolean";
|
|
27
|
+
readonly null: "null";
|
|
28
|
+
readonly undefined: "undefined";
|
|
29
|
+
readonly bigint: "a bigint";
|
|
30
|
+
readonly number: "a number";
|
|
31
|
+
readonly object: "an object";
|
|
32
|
+
readonly string: "a string";
|
|
33
|
+
readonly symbol: "a symbol";
|
|
34
|
+
};
|
|
35
|
+
export declare const jsTypeOfDescriptions: {
|
|
36
|
+
readonly function: "a function";
|
|
37
|
+
readonly boolean: "boolean";
|
|
38
|
+
readonly null: "null";
|
|
39
|
+
readonly undefined: "undefined";
|
|
40
|
+
readonly bigint: "a bigint";
|
|
41
|
+
readonly number: "a number";
|
|
42
|
+
readonly object: "an object";
|
|
43
|
+
readonly string: "a string";
|
|
44
|
+
readonly symbol: "a symbol";
|
|
45
|
+
};
|
|
46
|
+
export type domainDescriptions = typeof domainDescriptions;
|
|
47
|
+
export type describeDomainOf<t, opts extends DescribeOptions = {}> = stringifyUnion<opts["includeArticles"] extends true ? domainDescriptions[domainOf<t>] : domainOf<t>, opts["branchDelimiter"] extends string ? opts["branchDelimiter"] : describeDefaults["branchDelimiter"]>;
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export const hasDomain = (data, kind) => domainOf(data) === kind;
|
|
2
|
+
export const domainOf = (data) => {
|
|
3
|
+
const builtinType = typeof data;
|
|
4
|
+
return (builtinType === "object" ?
|
|
5
|
+
data === null ?
|
|
6
|
+
"null"
|
|
7
|
+
: "object"
|
|
8
|
+
: builtinType === "function" ? "object"
|
|
9
|
+
: builtinType);
|
|
10
|
+
};
|
|
11
|
+
/** Each domain's completion for the phrase "must be _____" */
|
|
12
|
+
export const domainDescriptions = {
|
|
13
|
+
boolean: "boolean",
|
|
14
|
+
null: "null",
|
|
15
|
+
undefined: "undefined",
|
|
16
|
+
bigint: "a bigint",
|
|
17
|
+
number: "a number",
|
|
18
|
+
object: "an object",
|
|
19
|
+
string: "a string",
|
|
20
|
+
symbol: "a symbol"
|
|
21
|
+
};
|
|
22
|
+
export const jsTypeOfDescriptions = {
|
|
23
|
+
...domainDescriptions,
|
|
24
|
+
function: "a function"
|
|
25
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { brand } from "./generics.ts";
|
|
2
|
+
import type { CastableBase } from "./records.ts";
|
|
3
|
+
export declare class InternalArktypeError extends Error {
|
|
4
|
+
}
|
|
5
|
+
export declare const throwInternalError: (message: string) => never;
|
|
6
|
+
export declare const throwError: (message: string, ctor?: new (message: string) => Error) => never;
|
|
7
|
+
export declare class ParseError extends Error {
|
|
8
|
+
readonly name = "ParseError";
|
|
9
|
+
}
|
|
10
|
+
export declare const throwParseError: (message: string) => never;
|
|
11
|
+
/**
|
|
12
|
+
* TypeScript won't suggest strings beginning with a space as properties.
|
|
13
|
+
* Useful for symbol-like string properties.
|
|
14
|
+
*/
|
|
15
|
+
export declare const noSuggest: <s extends string>(s: s) => noSuggest<s>;
|
|
16
|
+
/**
|
|
17
|
+
* TypeScript won't suggest strings beginning with a space as properties.
|
|
18
|
+
* Useful for symbol-like string properties.
|
|
19
|
+
*/
|
|
20
|
+
export type noSuggest<s extends string = string> = ` ${s}`;
|
|
21
|
+
/** Unrendered character (U+200B) used to mark a string type */
|
|
22
|
+
export declare const ZeroWidthSpace = "\u200B";
|
|
23
|
+
/** Unrendered character (U+200B) used to mark a string type */
|
|
24
|
+
export type ZeroWidthSpace = typeof ZeroWidthSpace;
|
|
25
|
+
export type ErrorMessage<message extends string = string> = `${message}${ZeroWidthSpace}`;
|
|
26
|
+
export interface ErrorType<ctx extends {} = {}> extends CastableBase<ctx> {
|
|
27
|
+
[brand]: "ErrorType";
|
|
28
|
+
}
|
|
29
|
+
export type Completion<text extends string = string> = `${text}${ZeroWidthSpace}${ZeroWidthSpace}`;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export class InternalArktypeError extends Error {
|
|
2
|
+
}
|
|
3
|
+
export const throwInternalError = message => throwError(message, InternalArktypeError);
|
|
4
|
+
export const throwError = (message, ctor = Error) => {
|
|
5
|
+
throw new ctor(message);
|
|
6
|
+
};
|
|
7
|
+
export class ParseError extends Error {
|
|
8
|
+
name = "ParseError";
|
|
9
|
+
}
|
|
10
|
+
export const throwParseError = message => throwError(message, ParseError);
|
|
11
|
+
/**
|
|
12
|
+
* TypeScript won't suggest strings beginning with a space as properties.
|
|
13
|
+
* Useful for symbol-like string properties.
|
|
14
|
+
*/
|
|
15
|
+
export const noSuggest = (s) => ` ${s}`;
|
|
16
|
+
/** Unrendered character (U+200B) used to mark a string type */
|
|
17
|
+
export const ZeroWidthSpace = "\u{200B}";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type array, type listable } from "./arrays.ts";
|
|
2
|
+
import type { conform, show } from "./generics.ts";
|
|
3
|
+
import type { Key } from "./keys.ts";
|
|
4
|
+
import type { Entry, entryOf } from "./records.ts";
|
|
5
|
+
import type { intersectUnion } from "./unionToTuple.ts";
|
|
6
|
+
type objectFromListableEntries<transformed extends readonly GroupableEntry[]> = show<intersectUnion<fromGroupableEntries<transformed>>>;
|
|
7
|
+
type fromGroupableEntries<entries extends readonly GroupableEntry[]> = {
|
|
8
|
+
[entry in entries[number] as entry extends GroupedEntry ? entry[0]["group"] : conform<entry[0], PropertyKey>]: entry extends GroupedEntry ? entry[1][] : entry[1];
|
|
9
|
+
};
|
|
10
|
+
type arrayFromListableEntries<transformed extends Entry> = Entry<number, never> extends transformed ? transformed[1][] : _arrayFromListableEntries<transformed, []>;
|
|
11
|
+
type _arrayFromListableEntries<transformed extends Entry, result extends unknown[]> = [
|
|
12
|
+
transformed
|
|
13
|
+
] extends [never] ? result : Extract<transformed, Entry<result["length"]>> extends (infer next extends Entry) ? Exclude<transformed, next> extends infer remaining extends Entry ? [
|
|
14
|
+
transformed
|
|
15
|
+
] extends [remaining] ? [
|
|
16
|
+
...result,
|
|
17
|
+
...transformed[1][]
|
|
18
|
+
] : _arrayFromListableEntries<remaining, [...result, next[1]]> : never : [...result, ...transformed[1][]];
|
|
19
|
+
type extractEntrySets<e extends listable<GroupableEntry>> = e extends readonly GroupableEntry[] ? e : [e];
|
|
20
|
+
type extractEntries<e extends listable<Entry>> = e extends readonly Entry[] ? e[number] : e;
|
|
21
|
+
type entryArgsWithIndex<o> = {
|
|
22
|
+
[k in keyof o]-?: [k: k, v: Exclude<o[k], undefined>, i: number];
|
|
23
|
+
}[keyof o];
|
|
24
|
+
type numericArrayEntry<a extends array> = number extends a["length"] ? [number, a[number]] : {
|
|
25
|
+
[i in keyof a]: i extends `${infer n extends number}` ? [n, a[i]] : never;
|
|
26
|
+
}[number];
|
|
27
|
+
export type GroupedEntry = readonly [key: {
|
|
28
|
+
group: Key;
|
|
29
|
+
}, value: unknown];
|
|
30
|
+
export type GroupableEntry = Entry<Key> | Entry<number> | GroupedEntry;
|
|
31
|
+
export type ListableEntry = listable<GroupableEntry>;
|
|
32
|
+
export type fromMappedEntries<transformed extends ListableEntry> = [
|
|
33
|
+
transformed
|
|
34
|
+
] extends [listable<Entry<number>>] ? arrayFromListableEntries<extractEntries<transformed>> : objectFromListableEntries<extractEntrySets<transformed>>;
|
|
35
|
+
export type FlatMorph = {
|
|
36
|
+
<const o extends array, transformed extends ListableEntry>(o: o, flatMapEntry: (...args: numericArrayEntry<o>) => transformed): fromMappedEntries<transformed>;
|
|
37
|
+
<const o extends object, transformed extends ListableEntry>(o: o, flatMapEntry: (...args: entryOf<o>) => transformed): fromMappedEntries<transformed>;
|
|
38
|
+
<const o extends object, transformed extends ListableEntry>(o: o, flatMapEntry: (...args: entryArgsWithIndex<o>) => transformed): fromMappedEntries<transformed>;
|
|
39
|
+
};
|
|
40
|
+
export declare const flatMorph: FlatMorph;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { append } from "./arrays.js";
|
|
2
|
+
export const flatMorph = (o, flatMapEntry) => {
|
|
3
|
+
const result = {};
|
|
4
|
+
const inputIsArray = Array.isArray(o);
|
|
5
|
+
let outputShouldBeArray = false;
|
|
6
|
+
for (const [i, entry] of Object.entries(o).entries()) {
|
|
7
|
+
const mapped = inputIsArray ? flatMapEntry(i, entry[1]) : flatMapEntry(...entry, i);
|
|
8
|
+
outputShouldBeArray ||= typeof mapped[0] === "number";
|
|
9
|
+
const flattenedEntries = Array.isArray(mapped[0]) || mapped.length === 0 ?
|
|
10
|
+
// if we have an empty array (for filtering) or an array with
|
|
11
|
+
// another array as its first element, treat it as a list
|
|
12
|
+
mapped
|
|
13
|
+
// otherwise, it should be a single entry, so nest it in a tuple
|
|
14
|
+
// so it doesn't get spread when the result is flattened
|
|
15
|
+
: [mapped];
|
|
16
|
+
for (const [k, v] of flattenedEntries) {
|
|
17
|
+
if (typeof k === "object")
|
|
18
|
+
result[k.group] = append(result[k.group], v);
|
|
19
|
+
else
|
|
20
|
+
result[k] = v;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return outputShouldBeArray ? Object.values(result) : result;
|
|
24
|
+
};
|