@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,359 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Decoder = exports.Encoder = exports.PacketType = exports.protocol = void 0;
|
|
4
|
+
exports.isPacketValid = isPacketValid;
|
|
5
|
+
const component_emitter_1 = require("@socket.io/component-emitter");
|
|
6
|
+
const binary_js_1 = require("./binary.js");
|
|
7
|
+
const is_binary_js_1 = require("./is-binary.js");
|
|
8
|
+
const debug_1 = require("debug"); // debug()
|
|
9
|
+
const debug = (0, debug_1.default)("socket.io-parser"); // debug()
|
|
10
|
+
/**
|
|
11
|
+
* These strings must not be used as event names, as they have a special meaning.
|
|
12
|
+
*/
|
|
13
|
+
const RESERVED_EVENTS = [
|
|
14
|
+
"connect", // used on the client side
|
|
15
|
+
"connect_error", // used on the client side
|
|
16
|
+
"disconnect", // used on both sides
|
|
17
|
+
"disconnecting", // used on the server side
|
|
18
|
+
"newListener", // used by the Node.js EventEmitter
|
|
19
|
+
"removeListener", // used by the Node.js EventEmitter
|
|
20
|
+
];
|
|
21
|
+
/**
|
|
22
|
+
* Protocol version.
|
|
23
|
+
*
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
exports.protocol = 5;
|
|
27
|
+
var PacketType;
|
|
28
|
+
(function (PacketType) {
|
|
29
|
+
PacketType[PacketType["CONNECT"] = 0] = "CONNECT";
|
|
30
|
+
PacketType[PacketType["DISCONNECT"] = 1] = "DISCONNECT";
|
|
31
|
+
PacketType[PacketType["EVENT"] = 2] = "EVENT";
|
|
32
|
+
PacketType[PacketType["ACK"] = 3] = "ACK";
|
|
33
|
+
PacketType[PacketType["CONNECT_ERROR"] = 4] = "CONNECT_ERROR";
|
|
34
|
+
PacketType[PacketType["BINARY_EVENT"] = 5] = "BINARY_EVENT";
|
|
35
|
+
PacketType[PacketType["BINARY_ACK"] = 6] = "BINARY_ACK";
|
|
36
|
+
})(PacketType || (exports.PacketType = PacketType = {}));
|
|
37
|
+
/**
|
|
38
|
+
* A socket.io Encoder instance
|
|
39
|
+
*/
|
|
40
|
+
class Encoder {
|
|
41
|
+
/**
|
|
42
|
+
* Encoder constructor
|
|
43
|
+
*
|
|
44
|
+
* @param {function} replacer - custom replacer to pass down to JSON.parse
|
|
45
|
+
*/
|
|
46
|
+
constructor(replacer) {
|
|
47
|
+
this.replacer = replacer;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Encode a packet as a single string if non-binary, or as a
|
|
51
|
+
* buffer sequence, depending on packet type.
|
|
52
|
+
*
|
|
53
|
+
* @param {Object} obj - packet object
|
|
54
|
+
*/
|
|
55
|
+
encode(obj) {
|
|
56
|
+
debug("encoding packet %j", obj);
|
|
57
|
+
if (obj.type === PacketType.EVENT || obj.type === PacketType.ACK) {
|
|
58
|
+
if ((0, is_binary_js_1.hasBinary)(obj)) {
|
|
59
|
+
return this.encodeAsBinary({
|
|
60
|
+
type: obj.type === PacketType.EVENT
|
|
61
|
+
? PacketType.BINARY_EVENT
|
|
62
|
+
: PacketType.BINARY_ACK,
|
|
63
|
+
nsp: obj.nsp,
|
|
64
|
+
data: obj.data,
|
|
65
|
+
id: obj.id,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return [this.encodeAsString(obj)];
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Encode packet as string.
|
|
73
|
+
*/
|
|
74
|
+
encodeAsString(obj) {
|
|
75
|
+
// first is type
|
|
76
|
+
let str = "" + obj.type;
|
|
77
|
+
// attachments if we have them
|
|
78
|
+
if (obj.type === PacketType.BINARY_EVENT ||
|
|
79
|
+
obj.type === PacketType.BINARY_ACK) {
|
|
80
|
+
str += obj.attachments + "-";
|
|
81
|
+
}
|
|
82
|
+
// if we have a namespace other than `/`
|
|
83
|
+
// we append it followed by a comma `,`
|
|
84
|
+
if (obj.nsp && "/" !== obj.nsp) {
|
|
85
|
+
str += obj.nsp + ",";
|
|
86
|
+
}
|
|
87
|
+
// immediately followed by the id
|
|
88
|
+
if (null != obj.id) {
|
|
89
|
+
str += obj.id;
|
|
90
|
+
}
|
|
91
|
+
// json data
|
|
92
|
+
if (null != obj.data) {
|
|
93
|
+
str += JSON.stringify(obj.data, this.replacer);
|
|
94
|
+
}
|
|
95
|
+
debug("encoded %j as %s", obj, str);
|
|
96
|
+
return str;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Encode packet as 'buffer sequence' by removing blobs, and
|
|
100
|
+
* deconstructing packet into object with placeholders and
|
|
101
|
+
* a list of buffers.
|
|
102
|
+
*/
|
|
103
|
+
encodeAsBinary(obj) {
|
|
104
|
+
const deconstruction = (0, binary_js_1.deconstructPacket)(obj);
|
|
105
|
+
const pack = this.encodeAsString(deconstruction.packet);
|
|
106
|
+
const buffers = deconstruction.buffers;
|
|
107
|
+
buffers.unshift(pack); // add packet info to beginning of data list
|
|
108
|
+
return buffers; // write all the buffers
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
exports.Encoder = Encoder;
|
|
112
|
+
/**
|
|
113
|
+
* A socket.io Decoder instance
|
|
114
|
+
*
|
|
115
|
+
* @return {Object} decoder
|
|
116
|
+
*/
|
|
117
|
+
class Decoder extends component_emitter_1.Emitter {
|
|
118
|
+
/**
|
|
119
|
+
* Decoder constructor
|
|
120
|
+
*
|
|
121
|
+
* @param {function} reviver - custom reviver to pass down to JSON.stringify
|
|
122
|
+
*/
|
|
123
|
+
constructor(reviver) {
|
|
124
|
+
super();
|
|
125
|
+
this.reviver = reviver;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Decodes an encoded packet string into packet JSON.
|
|
129
|
+
*
|
|
130
|
+
* @param {String} obj - encoded packet
|
|
131
|
+
*/
|
|
132
|
+
add(obj) {
|
|
133
|
+
let packet;
|
|
134
|
+
if (typeof obj === "string") {
|
|
135
|
+
if (this.reconstructor) {
|
|
136
|
+
throw new Error("got plaintext data when reconstructing a packet");
|
|
137
|
+
}
|
|
138
|
+
packet = this.decodeString(obj);
|
|
139
|
+
const isBinaryEvent = packet.type === PacketType.BINARY_EVENT;
|
|
140
|
+
if (isBinaryEvent || packet.type === PacketType.BINARY_ACK) {
|
|
141
|
+
packet.type = isBinaryEvent ? PacketType.EVENT : PacketType.ACK;
|
|
142
|
+
// binary packet's json
|
|
143
|
+
this.reconstructor = new BinaryReconstructor(packet);
|
|
144
|
+
// no attachments, labeled binary but no binary data to follow
|
|
145
|
+
if (packet.attachments === 0) {
|
|
146
|
+
super.emitReserved("decoded", packet);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
// non-binary full packet
|
|
151
|
+
super.emitReserved("decoded", packet);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
else if ((0, is_binary_js_1.isBinary)(obj) || obj.base64) {
|
|
155
|
+
// raw binary data
|
|
156
|
+
if (!this.reconstructor) {
|
|
157
|
+
throw new Error("got binary data when not reconstructing a packet");
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
packet = this.reconstructor.takeBinaryData(obj);
|
|
161
|
+
if (packet) {
|
|
162
|
+
// received final buffer
|
|
163
|
+
this.reconstructor = null;
|
|
164
|
+
super.emitReserved("decoded", packet);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
throw new Error("Unknown type: " + obj);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Decode a packet String (JSON data)
|
|
174
|
+
*
|
|
175
|
+
* @param {String} str
|
|
176
|
+
* @return {Object} packet
|
|
177
|
+
*/
|
|
178
|
+
decodeString(str) {
|
|
179
|
+
let i = 0;
|
|
180
|
+
// look up type
|
|
181
|
+
const p = {
|
|
182
|
+
type: Number(str.charAt(0)),
|
|
183
|
+
};
|
|
184
|
+
if (PacketType[p.type] === undefined) {
|
|
185
|
+
throw new Error("unknown packet type " + p.type);
|
|
186
|
+
}
|
|
187
|
+
// look up attachments if type binary
|
|
188
|
+
if (p.type === PacketType.BINARY_EVENT ||
|
|
189
|
+
p.type === PacketType.BINARY_ACK) {
|
|
190
|
+
const start = i + 1;
|
|
191
|
+
while (str.charAt(++i) !== "-" && i != str.length) { }
|
|
192
|
+
const buf = str.substring(start, i);
|
|
193
|
+
if (buf != Number(buf) || str.charAt(i) !== "-") {
|
|
194
|
+
throw new Error("Illegal attachments");
|
|
195
|
+
}
|
|
196
|
+
p.attachments = Number(buf);
|
|
197
|
+
}
|
|
198
|
+
// look up namespace (if any)
|
|
199
|
+
if ("/" === str.charAt(i + 1)) {
|
|
200
|
+
const start = i + 1;
|
|
201
|
+
while (++i) {
|
|
202
|
+
const c = str.charAt(i);
|
|
203
|
+
if ("," === c)
|
|
204
|
+
break;
|
|
205
|
+
if (i === str.length)
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
p.nsp = str.substring(start, i);
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
p.nsp = "/";
|
|
212
|
+
}
|
|
213
|
+
// look up id
|
|
214
|
+
const next = str.charAt(i + 1);
|
|
215
|
+
if ("" !== next && Number(next) == next) {
|
|
216
|
+
const start = i + 1;
|
|
217
|
+
while (++i) {
|
|
218
|
+
const c = str.charAt(i);
|
|
219
|
+
if (null == c || Number(c) != c) {
|
|
220
|
+
--i;
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
if (i === str.length)
|
|
224
|
+
break;
|
|
225
|
+
}
|
|
226
|
+
p.id = Number(str.substring(start, i + 1));
|
|
227
|
+
}
|
|
228
|
+
// look up json data
|
|
229
|
+
if (str.charAt(++i)) {
|
|
230
|
+
const payload = this.tryParse(str.substr(i));
|
|
231
|
+
if (Decoder.isPayloadValid(p.type, payload)) {
|
|
232
|
+
p.data = payload;
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
throw new Error("invalid payload");
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
debug("decoded %s as %j", str, p);
|
|
239
|
+
return p;
|
|
240
|
+
}
|
|
241
|
+
tryParse(str) {
|
|
242
|
+
try {
|
|
243
|
+
return JSON.parse(str, this.reviver);
|
|
244
|
+
}
|
|
245
|
+
catch (e) {
|
|
246
|
+
return false;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
static isPayloadValid(type, payload) {
|
|
250
|
+
switch (type) {
|
|
251
|
+
case PacketType.CONNECT:
|
|
252
|
+
return isObject(payload);
|
|
253
|
+
case PacketType.DISCONNECT:
|
|
254
|
+
return payload === undefined;
|
|
255
|
+
case PacketType.CONNECT_ERROR:
|
|
256
|
+
return typeof payload === "string" || isObject(payload);
|
|
257
|
+
case PacketType.EVENT:
|
|
258
|
+
case PacketType.BINARY_EVENT:
|
|
259
|
+
return (Array.isArray(payload) &&
|
|
260
|
+
(typeof payload[0] === "number" ||
|
|
261
|
+
(typeof payload[0] === "string" &&
|
|
262
|
+
RESERVED_EVENTS.indexOf(payload[0]) === -1)));
|
|
263
|
+
case PacketType.ACK:
|
|
264
|
+
case PacketType.BINARY_ACK:
|
|
265
|
+
return Array.isArray(payload);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Deallocates a parser's resources
|
|
270
|
+
*/
|
|
271
|
+
destroy() {
|
|
272
|
+
if (this.reconstructor) {
|
|
273
|
+
this.reconstructor.finishedReconstruction();
|
|
274
|
+
this.reconstructor = null;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
exports.Decoder = Decoder;
|
|
279
|
+
/**
|
|
280
|
+
* A manager of a binary event's 'buffer sequence'. Should
|
|
281
|
+
* be constructed whenever a packet of type BINARY_EVENT is
|
|
282
|
+
* decoded.
|
|
283
|
+
*
|
|
284
|
+
* @param {Object} packet
|
|
285
|
+
* @return {BinaryReconstructor} initialized reconstructor
|
|
286
|
+
*/
|
|
287
|
+
class BinaryReconstructor {
|
|
288
|
+
constructor(packet) {
|
|
289
|
+
this.packet = packet;
|
|
290
|
+
this.buffers = [];
|
|
291
|
+
this.reconPack = packet;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Method to be called when binary data received from connection
|
|
295
|
+
* after a BINARY_EVENT packet.
|
|
296
|
+
*
|
|
297
|
+
* @param {Buffer | ArrayBuffer} binData - the raw binary data received
|
|
298
|
+
* @return {null | Object} returns null if more binary data is expected or
|
|
299
|
+
* a reconstructed packet object if all buffers have been received.
|
|
300
|
+
*/
|
|
301
|
+
takeBinaryData(binData) {
|
|
302
|
+
this.buffers.push(binData);
|
|
303
|
+
if (this.buffers.length === this.reconPack.attachments) {
|
|
304
|
+
// done with buffer list
|
|
305
|
+
const packet = (0, binary_js_1.reconstructPacket)(this.reconPack, this.buffers);
|
|
306
|
+
this.finishedReconstruction();
|
|
307
|
+
return packet;
|
|
308
|
+
}
|
|
309
|
+
return null;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Cleans up binary packet reconstruction variables.
|
|
313
|
+
*/
|
|
314
|
+
finishedReconstruction() {
|
|
315
|
+
this.reconPack = null;
|
|
316
|
+
this.buffers = [];
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
function isNamespaceValid(nsp) {
|
|
320
|
+
return typeof nsp === "string";
|
|
321
|
+
}
|
|
322
|
+
// see https://caniuse.com/mdn-javascript_builtins_number_isinteger
|
|
323
|
+
const isInteger = Number.isInteger ||
|
|
324
|
+
function (value) {
|
|
325
|
+
return (typeof value === "number" &&
|
|
326
|
+
isFinite(value) &&
|
|
327
|
+
Math.floor(value) === value);
|
|
328
|
+
};
|
|
329
|
+
function isAckIdValid(id) {
|
|
330
|
+
return id === undefined || isInteger(id);
|
|
331
|
+
}
|
|
332
|
+
// see https://stackoverflow.com/questions/8511281/check-if-a-value-is-an-object-in-javascript
|
|
333
|
+
function isObject(value) {
|
|
334
|
+
return Object.prototype.toString.call(value) === "[object Object]";
|
|
335
|
+
}
|
|
336
|
+
function isDataValid(type, payload) {
|
|
337
|
+
switch (type) {
|
|
338
|
+
case PacketType.CONNECT:
|
|
339
|
+
return payload === undefined || isObject(payload);
|
|
340
|
+
case PacketType.DISCONNECT:
|
|
341
|
+
return payload === undefined;
|
|
342
|
+
case PacketType.EVENT:
|
|
343
|
+
return (Array.isArray(payload) &&
|
|
344
|
+
(typeof payload[0] === "number" ||
|
|
345
|
+
(typeof payload[0] === "string" &&
|
|
346
|
+
RESERVED_EVENTS.indexOf(payload[0]) === -1)));
|
|
347
|
+
case PacketType.ACK:
|
|
348
|
+
return Array.isArray(payload);
|
|
349
|
+
case PacketType.CONNECT_ERROR:
|
|
350
|
+
return typeof payload === "string" || isObject(payload);
|
|
351
|
+
default:
|
|
352
|
+
return false;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
function isPacketValid(packet) {
|
|
356
|
+
return (isNamespaceValid(packet.nsp) &&
|
|
357
|
+
isAckIdValid(packet.id) &&
|
|
358
|
+
isDataValid(packet.type, packet.data));
|
|
359
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isBinary = isBinary;
|
|
4
|
+
exports.hasBinary = hasBinary;
|
|
5
|
+
const withNativeArrayBuffer = typeof ArrayBuffer === "function";
|
|
6
|
+
const isView = (obj) => {
|
|
7
|
+
return typeof ArrayBuffer.isView === "function"
|
|
8
|
+
? ArrayBuffer.isView(obj)
|
|
9
|
+
: obj.buffer instanceof ArrayBuffer;
|
|
10
|
+
};
|
|
11
|
+
const toString = Object.prototype.toString;
|
|
12
|
+
const withNativeBlob = typeof Blob === "function" ||
|
|
13
|
+
(typeof Blob !== "undefined" &&
|
|
14
|
+
toString.call(Blob) === "[object BlobConstructor]");
|
|
15
|
+
const withNativeFile = typeof File === "function" ||
|
|
16
|
+
(typeof File !== "undefined" &&
|
|
17
|
+
toString.call(File) === "[object FileConstructor]");
|
|
18
|
+
/**
|
|
19
|
+
* Returns true if obj is a Buffer, an ArrayBuffer, a Blob or a File.
|
|
20
|
+
*
|
|
21
|
+
* @private
|
|
22
|
+
*/
|
|
23
|
+
function isBinary(obj) {
|
|
24
|
+
return ((withNativeArrayBuffer && (obj instanceof ArrayBuffer || isView(obj))) ||
|
|
25
|
+
(withNativeBlob && obj instanceof Blob) ||
|
|
26
|
+
(withNativeFile && obj instanceof File));
|
|
27
|
+
}
|
|
28
|
+
function hasBinary(obj, toJSON) {
|
|
29
|
+
if (!obj || typeof obj !== "object") {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
if (Array.isArray(obj)) {
|
|
33
|
+
for (let i = 0, l = obj.length; i < l; i++) {
|
|
34
|
+
if (hasBinary(obj[i])) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
if (isBinary(obj)) {
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
if (obj.toJSON &&
|
|
44
|
+
typeof obj.toJSON === "function" &&
|
|
45
|
+
arguments.length === 1) {
|
|
46
|
+
return hasBinary(obj.toJSON(), true);
|
|
47
|
+
}
|
|
48
|
+
for (const key in obj) {
|
|
49
|
+
if (Object.prototype.hasOwnProperty.call(obj, key) && hasBinary(obj[key])) {
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Replaces every Buffer | ArrayBuffer | Blob | File in packet with a numbered placeholder.
|
|
3
|
+
*
|
|
4
|
+
* @param {Object} packet - socket.io event packet
|
|
5
|
+
* @return {Object} with deconstructed packet and list of buffers
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export declare function deconstructPacket(packet: any): {
|
|
9
|
+
packet: any;
|
|
10
|
+
buffers: any[];
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Reconstructs a binary packet from its placeholder packet and buffers
|
|
14
|
+
*
|
|
15
|
+
* @param {Object} packet - event packet with placeholders
|
|
16
|
+
* @param {Array} buffers - binary buffers to put in placeholder positions
|
|
17
|
+
* @return {Object} reconstructed packet
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
export declare function reconstructPacket(packet: any, buffers: any): any;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { isBinary } from "./is-binary.js";
|
|
2
|
+
/**
|
|
3
|
+
* Replaces every Buffer | ArrayBuffer | Blob | File in packet with a numbered placeholder.
|
|
4
|
+
*
|
|
5
|
+
* @param {Object} packet - socket.io event packet
|
|
6
|
+
* @return {Object} with deconstructed packet and list of buffers
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export function deconstructPacket(packet) {
|
|
10
|
+
const buffers = [];
|
|
11
|
+
const packetData = packet.data;
|
|
12
|
+
const pack = packet;
|
|
13
|
+
pack.data = _deconstructPacket(packetData, buffers);
|
|
14
|
+
pack.attachments = buffers.length; // number of binary 'attachments'
|
|
15
|
+
return { packet: pack, buffers: buffers };
|
|
16
|
+
}
|
|
17
|
+
function _deconstructPacket(data, buffers) {
|
|
18
|
+
if (!data)
|
|
19
|
+
return data;
|
|
20
|
+
if (isBinary(data)) {
|
|
21
|
+
const placeholder = { _placeholder: true, num: buffers.length };
|
|
22
|
+
buffers.push(data);
|
|
23
|
+
return placeholder;
|
|
24
|
+
}
|
|
25
|
+
else if (Array.isArray(data)) {
|
|
26
|
+
const newData = new Array(data.length);
|
|
27
|
+
for (let i = 0; i < data.length; i++) {
|
|
28
|
+
newData[i] = _deconstructPacket(data[i], buffers);
|
|
29
|
+
}
|
|
30
|
+
return newData;
|
|
31
|
+
}
|
|
32
|
+
else if (typeof data === "object" && !(data instanceof Date)) {
|
|
33
|
+
const newData = {};
|
|
34
|
+
for (const key in data) {
|
|
35
|
+
if (Object.prototype.hasOwnProperty.call(data, key)) {
|
|
36
|
+
newData[key] = _deconstructPacket(data[key], buffers);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return newData;
|
|
40
|
+
}
|
|
41
|
+
return data;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Reconstructs a binary packet from its placeholder packet and buffers
|
|
45
|
+
*
|
|
46
|
+
* @param {Object} packet - event packet with placeholders
|
|
47
|
+
* @param {Array} buffers - binary buffers to put in placeholder positions
|
|
48
|
+
* @return {Object} reconstructed packet
|
|
49
|
+
* @public
|
|
50
|
+
*/
|
|
51
|
+
export function reconstructPacket(packet, buffers) {
|
|
52
|
+
packet.data = _reconstructPacket(packet.data, buffers);
|
|
53
|
+
delete packet.attachments; // no longer useful
|
|
54
|
+
return packet;
|
|
55
|
+
}
|
|
56
|
+
function _reconstructPacket(data, buffers) {
|
|
57
|
+
if (!data)
|
|
58
|
+
return data;
|
|
59
|
+
if (data && data._placeholder === true) {
|
|
60
|
+
const isIndexValid = typeof data.num === "number" &&
|
|
61
|
+
data.num >= 0 &&
|
|
62
|
+
data.num < buffers.length;
|
|
63
|
+
if (isIndexValid) {
|
|
64
|
+
return buffers[data.num]; // appropriate buffer (should be natural order anyway)
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
throw new Error("illegal attachments");
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
else if (Array.isArray(data)) {
|
|
71
|
+
for (let i = 0; i < data.length; i++) {
|
|
72
|
+
data[i] = _reconstructPacket(data[i], buffers);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
else if (typeof data === "object") {
|
|
76
|
+
for (const key in data) {
|
|
77
|
+
if (Object.prototype.hasOwnProperty.call(data, key)) {
|
|
78
|
+
data[key] = _reconstructPacket(data[key], buffers);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return data;
|
|
83
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Emitter } from "@socket.io/component-emitter";
|
|
2
|
+
/**
|
|
3
|
+
* Protocol version.
|
|
4
|
+
*
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export declare const protocol: number;
|
|
8
|
+
export declare enum PacketType {
|
|
9
|
+
CONNECT = 0,
|
|
10
|
+
DISCONNECT = 1,
|
|
11
|
+
EVENT = 2,
|
|
12
|
+
ACK = 3,
|
|
13
|
+
CONNECT_ERROR = 4,
|
|
14
|
+
BINARY_EVENT = 5,
|
|
15
|
+
BINARY_ACK = 6
|
|
16
|
+
}
|
|
17
|
+
export interface Packet {
|
|
18
|
+
type: PacketType;
|
|
19
|
+
nsp: string;
|
|
20
|
+
data?: any;
|
|
21
|
+
id?: number;
|
|
22
|
+
attachments?: number;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A socket.io Encoder instance
|
|
26
|
+
*/
|
|
27
|
+
export declare class Encoder {
|
|
28
|
+
private replacer?;
|
|
29
|
+
/**
|
|
30
|
+
* Encoder constructor
|
|
31
|
+
*
|
|
32
|
+
* @param {function} replacer - custom replacer to pass down to JSON.parse
|
|
33
|
+
*/
|
|
34
|
+
constructor(replacer?: (this: any, key: string, value: any) => any);
|
|
35
|
+
/**
|
|
36
|
+
* Encode a packet as a single string if non-binary, or as a
|
|
37
|
+
* buffer sequence, depending on packet type.
|
|
38
|
+
*
|
|
39
|
+
* @param {Object} obj - packet object
|
|
40
|
+
*/
|
|
41
|
+
encode(obj: Packet): any[];
|
|
42
|
+
/**
|
|
43
|
+
* Encode packet as string.
|
|
44
|
+
*/
|
|
45
|
+
private encodeAsString;
|
|
46
|
+
/**
|
|
47
|
+
* Encode packet as 'buffer sequence' by removing blobs, and
|
|
48
|
+
* deconstructing packet into object with placeholders and
|
|
49
|
+
* a list of buffers.
|
|
50
|
+
*/
|
|
51
|
+
private encodeAsBinary;
|
|
52
|
+
}
|
|
53
|
+
interface DecoderReservedEvents {
|
|
54
|
+
decoded: (packet: Packet) => void;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* A socket.io Decoder instance
|
|
58
|
+
*
|
|
59
|
+
* @return {Object} decoder
|
|
60
|
+
*/
|
|
61
|
+
export declare class Decoder extends Emitter<{}, {}, DecoderReservedEvents> {
|
|
62
|
+
private reviver?;
|
|
63
|
+
private reconstructor;
|
|
64
|
+
/**
|
|
65
|
+
* Decoder constructor
|
|
66
|
+
*
|
|
67
|
+
* @param {function} reviver - custom reviver to pass down to JSON.stringify
|
|
68
|
+
*/
|
|
69
|
+
constructor(reviver?: (this: any, key: string, value: any) => any);
|
|
70
|
+
/**
|
|
71
|
+
* Decodes an encoded packet string into packet JSON.
|
|
72
|
+
*
|
|
73
|
+
* @param {String} obj - encoded packet
|
|
74
|
+
*/
|
|
75
|
+
add(obj: any): void;
|
|
76
|
+
/**
|
|
77
|
+
* Decode a packet String (JSON data)
|
|
78
|
+
*
|
|
79
|
+
* @param {String} str
|
|
80
|
+
* @return {Object} packet
|
|
81
|
+
*/
|
|
82
|
+
private decodeString;
|
|
83
|
+
private tryParse;
|
|
84
|
+
private static isPayloadValid;
|
|
85
|
+
/**
|
|
86
|
+
* Deallocates a parser's resources
|
|
87
|
+
*/
|
|
88
|
+
destroy(): void;
|
|
89
|
+
}
|
|
90
|
+
export declare function isPacketValid(packet: Packet): boolean;
|
|
91
|
+
export {};
|