@jsonjoy.com/json-pack 0.0.1 → 1.0.0
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 +432 -0
- package/lib/JsonPackExtension.d.ts +5 -0
- package/lib/JsonPackExtension.js +11 -0
- package/lib/JsonPackExtension.js.map +1 -0
- package/lib/JsonPackValue.d.ts +4 -0
- package/lib/JsonPackValue.js +10 -0
- package/lib/JsonPackValue.js.map +1 -0
- package/lib/__demos__/cbor.d.ts +1 -0
- package/lib/__demos__/cbor.js +50 -0
- package/lib/__demos__/cbor.js.map +1 -0
- package/lib/__demos__/json.d.ts +1 -0
- package/lib/__demos__/json.js +27 -0
- package/lib/__demos__/json.js.map +1 -0
- package/lib/__demos__/msgpack.d.ts +1 -0
- package/lib/__demos__/msgpack.js +35 -0
- package/lib/__demos__/msgpack.js.map +1 -0
- package/lib/__demos__/ubjson.d.ts +1 -0
- package/lib/__demos__/ubjson.js +27 -0
- package/lib/__demos__/ubjson.js.map +1 -0
- package/lib/bencode/BencodeDecoder.d.ts +18 -0
- package/lib/bencode/BencodeDecoder.js +156 -0
- package/lib/bencode/BencodeDecoder.js.map +1 -0
- package/lib/bencode/BencodeEncoder.d.ts +24 -0
- package/lib/bencode/BencodeEncoder.js +147 -0
- package/lib/bencode/BencodeEncoder.js.map +1 -0
- package/lib/bencode/index.d.ts +3 -0
- package/lib/bencode/index.js +7 -0
- package/lib/bencode/index.js.map +1 -0
- package/lib/bencode/types.d.ts +4 -0
- package/lib/bencode/types.js +3 -0
- package/lib/bencode/types.js.map +1 -0
- package/lib/bson/BsonEncoder.d.ts +27 -0
- package/lib/bson/BsonEncoder.js +364 -0
- package/lib/bson/BsonEncoder.js.map +1 -0
- package/lib/bson/index.d.ts +2 -0
- package/lib/bson/index.js +6 -0
- package/lib/bson/index.js.map +1 -0
- package/lib/bson/values.d.ts +54 -0
- package/lib/bson/values.js +82 -0
- package/lib/bson/values.js.map +1 -0
- package/lib/cbor/CborDecoder.d.ts +41 -0
- package/lib/cbor/CborDecoder.js +356 -0
- package/lib/cbor/CborDecoder.js.map +1 -0
- package/lib/cbor/CborDecoderBase.d.ts +34 -0
- package/lib/cbor/CborDecoderBase.js +340 -0
- package/lib/cbor/CborDecoderBase.js.map +1 -0
- package/lib/cbor/CborDecoderDag.d.ts +5 -0
- package/lib/cbor/CborDecoderDag.js +13 -0
- package/lib/cbor/CborDecoderDag.js.map +1 -0
- package/lib/cbor/CborEncoder.d.ts +9 -0
- package/lib/cbor/CborEncoder.js +68 -0
- package/lib/cbor/CborEncoder.js.map +1 -0
- package/lib/cbor/CborEncoderDag.d.ts +6 -0
- package/lib/cbor/CborEncoderDag.js +23 -0
- package/lib/cbor/CborEncoderDag.js.map +1 -0
- package/lib/cbor/CborEncoderFast.d.ts +51 -0
- package/lib/cbor/CborEncoderFast.js +333 -0
- package/lib/cbor/CborEncoderFast.js.map +1 -0
- package/lib/cbor/CborEncoderStable.d.ts +6 -0
- package/lib/cbor/CborEncoderStable.js +71 -0
- package/lib/cbor/CborEncoderStable.js.map +1 -0
- package/lib/cbor/constants.d.ts +39 -0
- package/lib/cbor/constants.js +3 -0
- package/lib/cbor/constants.js.map +1 -0
- package/lib/cbor/index.d.ts +8 -0
- package/lib/cbor/index.js +12 -0
- package/lib/cbor/index.js.map +1 -0
- package/lib/cbor/shared.d.ts +8 -0
- package/lib/cbor/shared.js +12 -0
- package/lib/cbor/shared.js.map +1 -0
- package/lib/cbor/types.d.ts +4 -0
- package/lib/cbor/types.js +3 -0
- package/lib/cbor/types.js.map +1 -0
- package/lib/codecs/Codecs.d.ts +11 -0
- package/lib/codecs/Codecs.js +16 -0
- package/lib/codecs/Codecs.js.map +1 -0
- package/lib/codecs/cbor.d.ts +12 -0
- package/lib/codecs/cbor.js +15 -0
- package/lib/codecs/cbor.js.map +1 -0
- package/lib/codecs/json.d.ts +12 -0
- package/lib/codecs/json.js +15 -0
- package/lib/codecs/json.js.map +1 -0
- package/lib/codecs/msgpack.d.ts +12 -0
- package/lib/codecs/msgpack.js +15 -0
- package/lib/codecs/msgpack.js.map +1 -0
- package/lib/codecs/types.d.ts +8 -0
- package/lib/codecs/types.js +3 -0
- package/lib/codecs/types.js.map +1 -0
- package/lib/constants.d.ts +5 -0
- package/lib/constants.js +3 -0
- package/lib/constants.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -0
- package/lib/index.js.map +1 -0
- package/lib/ion/Import.d.ts +14 -0
- package/lib/ion/Import.js +48 -0
- package/lib/ion/Import.js.map +1 -0
- package/lib/ion/IonEncoderFast.d.ts +22 -0
- package/lib/ion/IonEncoderFast.js +247 -0
- package/lib/ion/IonEncoderFast.js.map +1 -0
- package/lib/ion/ast.d.ts +68 -0
- package/lib/ion/ast.js +213 -0
- package/lib/ion/ast.js.map +1 -0
- package/lib/ion/constants.d.ts +24 -0
- package/lib/ion/constants.js +3 -0
- package/lib/ion/constants.js.map +1 -0
- package/lib/ion/index.d.ts +5 -0
- package/lib/ion/index.js +9 -0
- package/lib/ion/index.js.map +1 -0
- package/lib/ion/symbols.d.ts +4 -0
- package/lib/ion/symbols.js +17 -0
- package/lib/ion/symbols.js.map +1 -0
- package/lib/ion/types.d.ts +1 -0
- package/lib/ion/types.js +3 -0
- package/lib/ion/types.js.map +1 -0
- package/lib/json/JsonDecoder.d.ts +19 -0
- package/lib/json/JsonDecoder.js +594 -0
- package/lib/json/JsonDecoder.js.map +1 -0
- package/lib/json/JsonDecoderDag.d.ts +9 -0
- package/lib/json/JsonDecoderDag.js +118 -0
- package/lib/json/JsonDecoderDag.js.map +1 -0
- package/lib/json/JsonEncoder.d.ts +36 -0
- package/lib/json/JsonEncoder.js +253 -0
- package/lib/json/JsonEncoder.js.map +1 -0
- package/lib/json/JsonEncoderDag.d.ts +5 -0
- package/lib/json/JsonEncoderDag.js +44 -0
- package/lib/json/JsonEncoderDag.js.map +1 -0
- package/lib/json/JsonEncoderStable.d.ts +4 -0
- package/lib/json/JsonEncoderStable.js +28 -0
- package/lib/json/JsonEncoderStable.js.map +1 -0
- package/lib/json/index.d.ts +6 -0
- package/lib/json/index.js +10 -0
- package/lib/json/index.js.map +1 -0
- package/lib/json/types.d.ts +4 -0
- package/lib/json/types.js +3 -0
- package/lib/json/types.js.map +1 -0
- package/lib/json/util.d.ts +1 -0
- package/lib/json/util.js +22 -0
- package/lib/json/util.js.map +1 -0
- package/lib/json-binary/codec.d.ts +8 -0
- package/lib/json-binary/codec.js +128 -0
- package/lib/json-binary/codec.js.map +1 -0
- package/lib/json-binary/constants.d.ts +3 -0
- package/lib/json-binary/constants.js +8 -0
- package/lib/json-binary/constants.js.map +1 -0
- package/lib/json-binary/index.d.ts +3 -0
- package/lib/json-binary/index.js +7 -0
- package/lib/json-binary/index.js.map +1 -0
- package/lib/json-binary/types.d.ts +7 -0
- package/lib/json-binary/types.js +3 -0
- package/lib/json-binary/types.js.map +1 -0
- package/lib/json-brand/index.d.ts +3 -0
- package/lib/json-brand/index.js +5 -0
- package/lib/json-brand/index.js.map +1 -0
- package/lib/json-brand/types.d.ts +10 -0
- package/lib/json-brand/types.js +3 -0
- package/lib/json-brand/types.js.map +1 -0
- package/lib/json-equal/$$deepEqual/index.d.ts +1 -0
- package/lib/json-equal/$$deepEqual/index.js +5 -0
- package/lib/json-equal/$$deepEqual/index.js.map +1 -0
- package/lib/json-equal/$$deepEqual/v1.d.ts +2 -0
- package/lib/json-equal/$$deepEqual/v1.js +52 -0
- package/lib/json-equal/$$deepEqual/v1.js.map +1 -0
- package/lib/json-equal/deepEqual/index.d.ts +1 -0
- package/lib/json-equal/deepEqual/index.js +5 -0
- package/lib/json-equal/deepEqual/index.js.map +1 -0
- package/lib/json-equal/deepEqual/v1.d.ts +1 -0
- package/lib/json-equal/deepEqual/v1.js +34 -0
- package/lib/json-equal/deepEqual/v1.js.map +1 -0
- package/lib/json-equal/deepEqual/v2.d.ts +1 -0
- package/lib/json-equal/deepEqual/v2.js +37 -0
- package/lib/json-equal/deepEqual/v2.js.map +1 -0
- package/lib/json-equal/deepEqual/v3.d.ts +1 -0
- package/lib/json-equal/deepEqual/v3.js +37 -0
- package/lib/json-equal/deepEqual/v3.js.map +1 -0
- package/lib/json-equal/deepEqual/v4.d.ts +1 -0
- package/lib/json-equal/deepEqual/v4.js +34 -0
- package/lib/json-equal/deepEqual/v4.js.map +1 -0
- package/lib/json-pointer/index.d.ts +1 -0
- package/lib/json-pointer/index.js +5 -0
- package/lib/json-pointer/index.js.map +1 -0
- package/lib/json-pointer/types.d.ts +2 -0
- package/lib/json-pointer/types.js +3 -0
- package/lib/json-pointer/types.js.map +1 -0
- package/lib/json-random/RandomJson.d.ts +39 -0
- package/lib/json-random/RandomJson.js +267 -0
- package/lib/json-random/RandomJson.js.map +1 -0
- package/lib/json-random/__demos__/json-random.d.ts +1 -0
- package/lib/json-random/__demos__/json-random.js +35 -0
- package/lib/json-random/__demos__/json-random.js.map +1 -0
- package/lib/json-random/index.d.ts +1 -0
- package/lib/json-random/index.js +5 -0
- package/lib/json-random/index.js.map +1 -0
- package/lib/msgpack/MsgPackDecoder.d.ts +19 -0
- package/lib/msgpack/MsgPackDecoder.js +233 -0
- package/lib/msgpack/MsgPackDecoder.js.map +1 -0
- package/lib/msgpack/MsgPackDecoderFast.d.ts +18 -0
- package/lib/msgpack/MsgPackDecoderFast.js +182 -0
- package/lib/msgpack/MsgPackDecoderFast.js.map +1 -0
- package/lib/msgpack/MsgPackEncoder.d.ts +5 -0
- package/lib/msgpack/MsgPackEncoder.js +40 -0
- package/lib/msgpack/MsgPackEncoder.js.map +1 -0
- package/lib/msgpack/MsgPackEncoderFast.d.ts +45 -0
- package/lib/msgpack/MsgPackEncoderFast.js +296 -0
- package/lib/msgpack/MsgPackEncoderFast.js.map +1 -0
- package/lib/msgpack/MsgPackEncoderStable.d.ts +4 -0
- package/lib/msgpack/MsgPackEncoderStable.js +19 -0
- package/lib/msgpack/MsgPackEncoderStable.js.map +1 -0
- package/lib/msgpack/MsgPackToJsonConverter.d.ts +24 -0
- package/lib/msgpack/MsgPackToJsonConverter.js +218 -0
- package/lib/msgpack/MsgPackToJsonConverter.js.map +1 -0
- package/lib/msgpack/constants.d.ts +6 -0
- package/lib/msgpack/constants.js +3 -0
- package/lib/msgpack/constants.js.map +1 -0
- package/lib/msgpack/index.d.ts +8 -0
- package/lib/msgpack/index.js +20 -0
- package/lib/msgpack/index.js.map +1 -0
- package/lib/msgpack/shallow-read.d.ts +6 -0
- package/lib/msgpack/shallow-read.js +102 -0
- package/lib/msgpack/shallow-read.js.map +1 -0
- package/lib/msgpack/types.d.ts +15 -0
- package/lib/msgpack/types.js +3 -0
- package/lib/msgpack/types.js.map +1 -0
- package/lib/msgpack/util.d.ts +11 -0
- package/lib/msgpack/util.js +16 -0
- package/lib/msgpack/util.js.map +1 -0
- package/lib/resp/RespDecoder.d.ts +39 -0
- package/lib/resp/RespDecoder.js +388 -0
- package/lib/resp/RespDecoder.js.map +1 -0
- package/lib/resp/RespEncoder.d.ts +60 -0
- package/lib/resp/RespEncoder.js +424 -0
- package/lib/resp/RespEncoder.js.map +1 -0
- package/lib/resp/RespEncoderLegacy.d.ts +12 -0
- package/lib/resp/RespEncoderLegacy.js +105 -0
- package/lib/resp/RespEncoderLegacy.js.map +1 -0
- package/lib/resp/RespStreamingDecoder.d.ts +12 -0
- package/lib/resp/RespStreamingDecoder.js +79 -0
- package/lib/resp/RespStreamingDecoder.js.map +1 -0
- package/lib/resp/constants.d.ts +22 -0
- package/lib/resp/constants.js +3 -0
- package/lib/resp/constants.js.map +1 -0
- package/lib/resp/extensions.d.ts +13 -0
- package/lib/resp/extensions.js +26 -0
- package/lib/resp/extensions.js.map +1 -0
- package/lib/resp/index.d.ts +6 -0
- package/lib/resp/index.js +10 -0
- package/lib/resp/index.js.map +1 -0
- package/lib/types.d.ts +61 -0
- package/lib/types.js +3 -0
- package/lib/types.js.map +1 -0
- package/lib/ubjson/UbjsonDecoder.d.ts +8 -0
- package/lib/ubjson/UbjsonDecoder.js +128 -0
- package/lib/ubjson/UbjsonDecoder.js.map +1 -0
- package/lib/ubjson/UbjsonEncoder.d.ts +34 -0
- package/lib/ubjson/UbjsonEncoder.js +218 -0
- package/lib/ubjson/UbjsonEncoder.js.map +1 -0
- package/lib/ubjson/index.d.ts +2 -0
- package/lib/ubjson/index.js +6 -0
- package/lib/ubjson/index.js.map +1 -0
- package/lib/util/CompressionTable.d.ts +14 -0
- package/lib/util/CompressionTable.js +169 -0
- package/lib/util/CompressionTable.js.map +1 -0
- package/lib/util/DecompressionTable.d.ts +6 -0
- package/lib/util/DecompressionTable.js +96 -0
- package/lib/util/DecompressionTable.js.map +1 -0
- package/lib/util/Fuzzer.d.ts +13 -0
- package/lib/util/Fuzzer.js +59 -0
- package/lib/util/Fuzzer.js.map +1 -0
- package/lib/util/NullObject.d.ts +1 -0
- package/lib/util/NullObject.js +6 -0
- package/lib/util/NullObject.js.map +1 -0
- package/lib/util/base64/constants.d.ts +2 -0
- package/lib/util/base64/constants.js +6 -0
- package/lib/util/base64/constants.js.map +1 -0
- package/lib/util/base64/createFromBase64.d.ts +1 -0
- package/lib/util/base64/createFromBase64.js +80 -0
- package/lib/util/base64/createFromBase64.js.map +1 -0
- package/lib/util/base64/createFromBase64Bin.d.ts +1 -0
- package/lib/util/base64/createFromBase64Bin.js +87 -0
- package/lib/util/base64/createFromBase64Bin.js.map +1 -0
- package/lib/util/base64/createToBase64.d.ts +1 -0
- package/lib/util/base64/createToBase64.js +48 -0
- package/lib/util/base64/createToBase64.js.map +1 -0
- package/lib/util/base64/createToBase64Bin.d.ts +1 -0
- package/lib/util/base64/createToBase64Bin.js +62 -0
- package/lib/util/base64/createToBase64Bin.js.map +1 -0
- package/lib/util/base64/createToBase64BinUint8.d.ts +1 -0
- package/lib/util/base64/createToBase64BinUint8.js +59 -0
- package/lib/util/base64/createToBase64BinUint8.js.map +1 -0
- package/lib/util/base64/fromBase64.d.ts +1 -0
- package/lib/util/base64/fromBase64.js +12 -0
- package/lib/util/base64/fromBase64.js.map +1 -0
- package/lib/util/base64/fromBase64Bin.d.ts +1 -0
- package/lib/util/base64/fromBase64Bin.js +6 -0
- package/lib/util/base64/fromBase64Bin.js.map +1 -0
- package/lib/util/base64/fromBase64Url.d.ts +1 -0
- package/lib/util/base64/fromBase64Url.js +6 -0
- package/lib/util/base64/fromBase64Url.js.map +1 -0
- package/lib/util/base64/index.d.ts +7 -0
- package/lib/util/base64/index.js +11 -0
- package/lib/util/base64/index.js.map +1 -0
- package/lib/util/base64/toBase64.d.ts +1 -0
- package/lib/util/base64/toBase64.js +15 -0
- package/lib/util/base64/toBase64.js.map +1 -0
- package/lib/util/base64/toBase64Bin.d.ts +1 -0
- package/lib/util/base64/toBase64Bin.js +6 -0
- package/lib/util/base64/toBase64Bin.js.map +1 -0
- package/lib/util/base64/toBase64Url.d.ts +1 -0
- package/lib/util/base64/toBase64Url.js +6 -0
- package/lib/util/base64/toBase64Url.js.map +1 -0
- package/lib/util/buffers/Reader.d.ts +22 -0
- package/lib/util/buffers/Reader.js +91 -0
- package/lib/util/buffers/Reader.js.map +1 -0
- package/lib/util/buffers/Slice.d.ts +8 -0
- package/lib/util/buffers/Slice.js +16 -0
- package/lib/util/buffers/Slice.js.map +1 -0
- package/lib/util/buffers/StreamingOctetReader.d.ts +18 -0
- package/lib/util/buffers/StreamingOctetReader.js +168 -0
- package/lib/util/buffers/StreamingOctetReader.js.map +1 -0
- package/lib/util/buffers/StreamingReader.d.ts +31 -0
- package/lib/util/buffers/StreamingReader.js +131 -0
- package/lib/util/buffers/StreamingReader.js.map +1 -0
- package/lib/util/buffers/Uint8ArrayCut.d.ts +6 -0
- package/lib/util/buffers/Uint8ArrayCut.js +12 -0
- package/lib/util/buffers/Uint8ArrayCut.js.map +1 -0
- package/lib/util/buffers/Writer.d.ts +33 -0
- package/lib/util/buffers/Writer.js +217 -0
- package/lib/util/buffers/Writer.js.map +1 -0
- package/lib/util/buffers/b.d.ts +1 -0
- package/lib/util/buffers/b.js +6 -0
- package/lib/util/buffers/b.js.map +1 -0
- package/lib/util/buffers/bufferToUint8Array.d.ts +2 -0
- package/lib/util/buffers/bufferToUint8Array.js +6 -0
- package/lib/util/buffers/bufferToUint8Array.js.map +1 -0
- package/lib/util/buffers/cmpUint8Array.d.ts +1 -0
- package/lib/util/buffers/cmpUint8Array.js +14 -0
- package/lib/util/buffers/cmpUint8Array.js.map +1 -0
- package/lib/util/buffers/cmpUint8Array2.d.ts +1 -0
- package/lib/util/buffers/cmpUint8Array2.js +16 -0
- package/lib/util/buffers/cmpUint8Array2.js.map +1 -0
- package/lib/util/buffers/cmpUint8Array3.d.ts +1 -0
- package/lib/util/buffers/cmpUint8Array3.js +18 -0
- package/lib/util/buffers/cmpUint8Array3.js.map +1 -0
- package/lib/util/buffers/concat.d.ts +3 -0
- package/lib/util/buffers/concat.js +36 -0
- package/lib/util/buffers/concat.js.map +1 -0
- package/lib/util/buffers/copy.d.ts +1 -0
- package/lib/util/buffers/copy.js +10 -0
- package/lib/util/buffers/copy.js.map +1 -0
- package/lib/util/buffers/f16.d.ts +1 -0
- package/lib/util/buffers/f16.js +18 -0
- package/lib/util/buffers/f16.js.map +1 -0
- package/lib/util/buffers/index.d.ts +1 -0
- package/lib/util/buffers/index.js +5 -0
- package/lib/util/buffers/index.js.map +1 -0
- package/lib/util/buffers/isArrayBuffer.d.ts +1 -0
- package/lib/util/buffers/isArrayBuffer.js +8 -0
- package/lib/util/buffers/isArrayBuffer.js.map +1 -0
- package/lib/util/buffers/isFloat32.d.ts +1 -0
- package/lib/util/buffers/isFloat32.js +10 -0
- package/lib/util/buffers/isFloat32.js.map +1 -0
- package/lib/util/buffers/isUint8Array.d.ts +1 -0
- package/lib/util/buffers/isUint8Array.js +7 -0
- package/lib/util/buffers/isUint8Array.js.map +1 -0
- package/lib/util/buffers/printOctets.d.ts +1 -0
- package/lib/util/buffers/printOctets.js +23 -0
- package/lib/util/buffers/printOctets.js.map +1 -0
- package/lib/util/buffers/strings.d.ts +6 -0
- package/lib/util/buffers/strings.js +23 -0
- package/lib/util/buffers/strings.js.map +1 -0
- package/lib/util/buffers/toBuf.d.ts +1 -0
- package/lib/util/buffers/toBuf.js +12 -0
- package/lib/util/buffers/toBuf.js.map +1 -0
- package/lib/util/buffers/toDataUri.d.ts +1 -0
- package/lib/util/buffers/toDataUri.js +12 -0
- package/lib/util/buffers/toDataUri.js.map +1 -0
- package/lib/util/buffers/toUint8Array.d.ts +1 -0
- package/lib/util/buffers/toUint8Array.js +19 -0
- package/lib/util/buffers/toUint8Array.js.map +1 -0
- package/lib/util/buffers/types.d.ts +54 -0
- package/lib/util/buffers/types.js +3 -0
- package/lib/util/buffers/types.js.map +1 -0
- package/lib/util/buffers/utf8/CachedUtf8Decoder.d.ts +7 -0
- package/lib/util/buffers/utf8/CachedUtf8Decoder.js +54 -0
- package/lib/util/buffers/utf8/CachedUtf8Decoder.js.map +1 -0
- package/lib/util/buffers/utf8/decodeAscii.d.ts +2 -0
- package/lib/util/buffers/utf8/decodeAscii.js +163 -0
- package/lib/util/buffers/utf8/decodeAscii.js.map +1 -0
- package/lib/util/buffers/utf8/decodeUtf8/index.d.ts +2 -0
- package/lib/util/buffers/utf8/decodeUtf8/index.js +7 -0
- package/lib/util/buffers/utf8/decodeUtf8/index.js.map +1 -0
- package/lib/util/buffers/utf8/decodeUtf8/v1.d.ts +2 -0
- package/lib/util/buffers/utf8/decodeUtf8/v1.js +46 -0
- package/lib/util/buffers/utf8/decodeUtf8/v1.js.map +1 -0
- package/lib/util/buffers/utf8/decodeUtf8/v10.d.ts +2 -0
- package/lib/util/buffers/utf8/decodeUtf8/v10.js +43 -0
- package/lib/util/buffers/utf8/decodeUtf8/v10.js.map +1 -0
- package/lib/util/buffers/utf8/decodeUtf8/v11.d.ts +2 -0
- package/lib/util/buffers/utf8/decodeUtf8/v11.js +5 -0
- package/lib/util/buffers/utf8/decodeUtf8/v11.js.map +1 -0
- package/lib/util/buffers/utf8/decodeUtf8/v12.d.ts +2 -0
- package/lib/util/buffers/utf8/decodeUtf8/v12.js +7 -0
- package/lib/util/buffers/utf8/decodeUtf8/v12.js.map +1 -0
- package/lib/util/buffers/utf8/decodeUtf8/v13.d.ts +2 -0
- package/lib/util/buffers/utf8/decodeUtf8/v13.js +26 -0
- package/lib/util/buffers/utf8/decodeUtf8/v13.js.map +1 -0
- package/lib/util/buffers/utf8/decodeUtf8/v14.d.ts +2 -0
- package/lib/util/buffers/utf8/decodeUtf8/v14.js +10 -0
- package/lib/util/buffers/utf8/decodeUtf8/v14.js.map +1 -0
- package/lib/util/buffers/utf8/decodeUtf8/v15.d.ts +2 -0
- package/lib/util/buffers/utf8/decodeUtf8/v15.js +18 -0
- package/lib/util/buffers/utf8/decodeUtf8/v15.js.map +1 -0
- package/lib/util/buffers/utf8/decodeUtf8/v16.d.ts +3 -0
- package/lib/util/buffers/utf8/decodeUtf8/v16.js +26 -0
- package/lib/util/buffers/utf8/decodeUtf8/v16.js.map +1 -0
- package/lib/util/buffers/utf8/decodeUtf8/v17.d.ts +2 -0
- package/lib/util/buffers/utf8/decodeUtf8/v17.js +42 -0
- package/lib/util/buffers/utf8/decodeUtf8/v17.js.map +1 -0
- package/lib/util/buffers/utf8/decodeUtf8/v18.d.ts +2 -0
- package/lib/util/buffers/utf8/decodeUtf8/v18.js +41 -0
- package/lib/util/buffers/utf8/decodeUtf8/v18.js.map +1 -0
- package/lib/util/buffers/utf8/decodeUtf8/v19.d.ts +2 -0
- package/lib/util/buffers/utf8/decodeUtf8/v19.js +5 -0
- package/lib/util/buffers/utf8/decodeUtf8/v19.js.map +1 -0
- package/lib/util/buffers/utf8/decodeUtf8/v2.d.ts +2 -0
- package/lib/util/buffers/utf8/decodeUtf8/v2.js +4 -0
- package/lib/util/buffers/utf8/decodeUtf8/v2.js.map +1 -0
- package/lib/util/buffers/utf8/decodeUtf8/v3.d.ts +2 -0
- package/lib/util/buffers/utf8/decodeUtf8/v3.js +6 -0
- package/lib/util/buffers/utf8/decodeUtf8/v3.js.map +1 -0
- package/lib/util/buffers/utf8/decodeUtf8/v4.d.ts +2 -0
- package/lib/util/buffers/utf8/decodeUtf8/v4.js +6 -0
- package/lib/util/buffers/utf8/decodeUtf8/v4.js.map +1 -0
- package/lib/util/buffers/utf8/decodeUtf8/v5.d.ts +2 -0
- package/lib/util/buffers/utf8/decodeUtf8/v5.js +37 -0
- package/lib/util/buffers/utf8/decodeUtf8/v5.js.map +1 -0
- package/lib/util/buffers/utf8/decodeUtf8/v6.d.ts +2 -0
- package/lib/util/buffers/utf8/decodeUtf8/v6.js +8 -0
- package/lib/util/buffers/utf8/decodeUtf8/v6.js.map +1 -0
- package/lib/util/buffers/utf8/decodeUtf8/v7.d.ts +2 -0
- package/lib/util/buffers/utf8/decodeUtf8/v7.js +39 -0
- package/lib/util/buffers/utf8/decodeUtf8/v7.js.map +1 -0
- package/lib/util/buffers/utf8/decodeUtf8/v8.d.ts +2 -0
- package/lib/util/buffers/utf8/decodeUtf8/v8.js +46 -0
- package/lib/util/buffers/utf8/decodeUtf8/v8.js.map +1 -0
- package/lib/util/buffers/utf8/decodeUtf8/v9.d.ts +2 -0
- package/lib/util/buffers/utf8/decodeUtf8/v9.js +39 -0
- package/lib/util/buffers/utf8/decodeUtf8/v9.js.map +1 -0
- package/lib/util/buffers/utf8/encode.d.ts +6 -0
- package/lib/util/buffers/utf8/encode.js +59 -0
- package/lib/util/buffers/utf8/encode.js.map +1 -0
- package/lib/util/buffers/utf8/isUtf8.d.ts +1 -0
- package/lib/util/buffers/utf8/isUtf8.js +43 -0
- package/lib/util/buffers/utf8/isUtf8.js.map +1 -0
- package/lib/util/buffers/utf8/sharedCachedUtf8Decoder.d.ts +3 -0
- package/lib/util/buffers/utf8/sharedCachedUtf8Decoder.js +5 -0
- package/lib/util/buffers/utf8/sharedCachedUtf8Decoder.js.map +1 -0
- package/lib/util/codegen/Codegen.d.ts +44 -0
- package/lib/util/codegen/Codegen.js +121 -0
- package/lib/util/codegen/Codegen.js.map +1 -0
- package/lib/util/codegen/compile.d.ts +4 -0
- package/lib/util/codegen/compile.js +8 -0
- package/lib/util/codegen/compile.js.map +1 -0
- package/lib/util/codegen/dynamicFunction.d.ts +1 -0
- package/lib/util/codegen/dynamicFunction.js +12 -0
- package/lib/util/codegen/dynamicFunction.js.map +1 -0
- package/lib/util/codegen/index.d.ts +3 -0
- package/lib/util/codegen/index.js +7 -0
- package/lib/util/codegen/index.js.map +1 -0
- package/lib/util/codegen/switch.d.ts +1 -0
- package/lib/util/codegen/switch.js +16 -0
- package/lib/util/codegen/switch.js.map +1 -0
- package/lib/util/codegen/types.d.ts +7 -0
- package/lib/util/codegen/types.js +3 -0
- package/lib/util/codegen/types.js.map +1 -0
- package/lib/util/codegen/util/JsExpression.d.ts +11 -0
- package/lib/util/codegen/util/JsExpression.js +30 -0
- package/lib/util/codegen/util/JsExpression.js.map +1 -0
- package/lib/util/codegen/util/helpers.d.ts +1 -0
- package/lib/util/codegen/util/helpers.js +11 -0
- package/lib/util/codegen/util/helpers.js.map +1 -0
- package/lib/util/codegen/util/normalizeAccessor.d.ts +1 -0
- package/lib/util/codegen/util/normalizeAccessor.js +13 -0
- package/lib/util/codegen/util/normalizeAccessor.js.map +1 -0
- package/lib/util/hasOwnProperty.d.ts +1 -0
- package/lib/util/hasOwnProperty.js +9 -0
- package/lib/util/hasOwnProperty.js.map +1 -0
- package/lib/util/isEmpty.d.ts +1 -0
- package/lib/util/isEmpty.js +11 -0
- package/lib/util/isEmpty.js.map +1 -0
- package/lib/util/lazyFunction.d.ts +1 -0
- package/lib/util/lazyFunction.js +14 -0
- package/lib/util/lazyFunction.js.map +1 -0
- package/lib/util/objKeyCmp.d.ts +1 -0
- package/lib/util/objKeyCmp.js +10 -0
- package/lib/util/objKeyCmp.js.map +1 -0
- package/lib/util/sort/insertion.d.ts +1 -0
- package/lib/util/sort/insertion.js +18 -0
- package/lib/util/sort/insertion.js.map +1 -0
- package/lib/util/sort/insertion2.d.ts +1 -0
- package/lib/util/sort/insertion2.js +18 -0
- package/lib/util/sort/insertion2.js.map +1 -0
- package/lib/util/strings/asString.d.ts +1 -0
- package/lib/util/strings/asString.js +28 -0
- package/lib/util/strings/asString.js.map +1 -0
- package/lib/util/strings/escape.d.ts +1 -0
- package/lib/util/strings/escape.js +135 -0
- package/lib/util/strings/escape.js.map +1 -0
- package/lib/util/strings/flatstr.d.ts +1 -0
- package/lib/util/strings/flatstr.js +10 -0
- package/lib/util/strings/flatstr.js.map +1 -0
- package/lib/util/strings/utf8.d.ts +1 -0
- package/lib/util/strings/utf8.js +28 -0
- package/lib/util/strings/utf8.js.map +1 -0
- package/lib/util/strings/util.d.ts +4 -0
- package/lib/util/strings/util.js +12 -0
- package/lib/util/strings/util.js.map +1 -0
- package/lib/util/strings/wordWrap.d.ts +4 -0
- package/lib/util/strings/wordWrap.js +19 -0
- package/lib/util/strings/wordWrap.js.map +1 -0
- package/lib/util/types.d.ts +9 -0
- package/lib/util/types.js +3 -0
- package/lib/util/types.js.map +1 -0
- package/package.json +137 -6
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const enum RESP {
|
|
2
|
+
R = 13,
|
|
3
|
+
N = 10,
|
|
4
|
+
RN = 3338,
|
|
5
|
+
NULL = 95,
|
|
6
|
+
BOOL = 35,
|
|
7
|
+
INT = 58,
|
|
8
|
+
BIG = 40,
|
|
9
|
+
FLOAT = 44,
|
|
10
|
+
STR_SIMPLE = 43,
|
|
11
|
+
STR_BULK = 36,
|
|
12
|
+
STR_VERBATIM = 61,
|
|
13
|
+
ERR_SIMPLE = 45,
|
|
14
|
+
ERR_BULK = 33,
|
|
15
|
+
ARR = 42,
|
|
16
|
+
SET = 126,
|
|
17
|
+
OBJ = 37,
|
|
18
|
+
PUSH = 62,
|
|
19
|
+
ATTR = 124,
|
|
20
|
+
PLUS = 43,
|
|
21
|
+
MINUS = 45
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/resp/constants.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { JsonPackExtension } from '../JsonPackExtension';
|
|
2
|
+
export declare class RespPush extends JsonPackExtension<unknown[]> {
|
|
3
|
+
readonly val: unknown[];
|
|
4
|
+
constructor(val: unknown[]);
|
|
5
|
+
}
|
|
6
|
+
export declare class RespAttributes extends JsonPackExtension<Record<string, unknown>> {
|
|
7
|
+
readonly val: Record<string, unknown>;
|
|
8
|
+
constructor(val: Record<string, unknown>);
|
|
9
|
+
}
|
|
10
|
+
export declare class RespVerbatimString extends JsonPackExtension<string> {
|
|
11
|
+
readonly val: string;
|
|
12
|
+
constructor(val: string);
|
|
13
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RespVerbatimString = exports.RespAttributes = exports.RespPush = void 0;
|
|
4
|
+
const JsonPackExtension_1 = require("../JsonPackExtension");
|
|
5
|
+
class RespPush extends JsonPackExtension_1.JsonPackExtension {
|
|
6
|
+
constructor(val) {
|
|
7
|
+
super(1, val);
|
|
8
|
+
this.val = val;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.RespPush = RespPush;
|
|
12
|
+
class RespAttributes extends JsonPackExtension_1.JsonPackExtension {
|
|
13
|
+
constructor(val) {
|
|
14
|
+
super(2, val);
|
|
15
|
+
this.val = val;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.RespAttributes = RespAttributes;
|
|
19
|
+
class RespVerbatimString extends JsonPackExtension_1.JsonPackExtension {
|
|
20
|
+
constructor(val) {
|
|
21
|
+
super(3, val);
|
|
22
|
+
this.val = val;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.RespVerbatimString = RespVerbatimString;
|
|
26
|
+
//# sourceMappingURL=extensions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extensions.js","sourceRoot":"","sources":["../../src/resp/extensions.ts"],"names":[],"mappings":";;;AAAA,4DAAuD;AAEvD,MAAa,QAAS,SAAQ,qCAA4B;IACxD,YAA4B,GAAc;QACxC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QADY,QAAG,GAAH,GAAG,CAAW;IAE1C,CAAC;CACF;AAJD,4BAIC;AAED,MAAa,cAAe,SAAQ,qCAA0C;IAC5E,YAA4B,GAA4B;QACtD,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QADY,QAAG,GAAH,GAAG,CAAyB;IAExD,CAAC;CACF;AAJD,wCAIC;AAED,MAAa,kBAAmB,SAAQ,qCAAyB;IAC/D,YAA4B,GAAW;QACrC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QADY,QAAG,GAAH,GAAG,CAAQ;IAEvC,CAAC;CACF;AAJD,gDAIC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./constants"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./extensions"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./RespEncoder"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./RespEncoderLegacy"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./RespDecoder"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./RespStreamingDecoder"), exports);
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resp/index.ts"],"names":[],"mappings":";;;AAAA,sDAA4B;AAC5B,uDAA6B;AAC7B,wDAA8B;AAC9B,8DAAoC;AACpC,wDAA8B;AAC9B,iEAAuC"}
|
package/lib/types.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { IReader, IReaderResettable, IWriter, IWriterGrowable } from './util/buffers';
|
|
2
|
+
import type { JsonPackExtension } from './JsonPackExtension';
|
|
3
|
+
import type { JsonPackValue } from './JsonPackValue';
|
|
4
|
+
export type JsonPrimitive = string | number | bigint | boolean | null;
|
|
5
|
+
export type JsonValue = JsonPrimitive | JsonArray | JsonObject;
|
|
6
|
+
type JsonArray = JsonValue[] | readonly JsonValue[];
|
|
7
|
+
type JsonObject = {
|
|
8
|
+
[key: string]: JsonValue;
|
|
9
|
+
} | Readonly<{
|
|
10
|
+
[key: string]: JsonValue;
|
|
11
|
+
}>;
|
|
12
|
+
export type TypedJsonValue<T> = T & JsonValue;
|
|
13
|
+
export type PackPrimitive = JsonPrimitive | undefined | Uint8Array | JsonPackValue | JsonPackExtension | bigint;
|
|
14
|
+
export type PackValue = PackPrimitive | PackArray | PackObject;
|
|
15
|
+
type PackArray = PackValue[] | readonly PackValue[];
|
|
16
|
+
type PackObject = {
|
|
17
|
+
[key: string]: PackValue;
|
|
18
|
+
} | Readonly<{
|
|
19
|
+
[key: string]: PackValue;
|
|
20
|
+
}>;
|
|
21
|
+
export interface BinaryJsonEncoder {
|
|
22
|
+
encode(value: unknown): Uint8Array;
|
|
23
|
+
writer: IWriter & IWriterGrowable;
|
|
24
|
+
writeAny(value: unknown): void;
|
|
25
|
+
writeNull(): void;
|
|
26
|
+
writeBoolean(bool: boolean): void;
|
|
27
|
+
writeNumber(num: number): void;
|
|
28
|
+
writeInteger(int: number): void;
|
|
29
|
+
writeUInteger(uint: number): void;
|
|
30
|
+
writeFloat(float: number): void;
|
|
31
|
+
writeBin(buf: Uint8Array): void;
|
|
32
|
+
writeAsciiStr(str: string): void;
|
|
33
|
+
writeStr(str: string): void;
|
|
34
|
+
writeArr(arr: unknown[]): void;
|
|
35
|
+
writeObj(obj: Record<string, unknown>): void;
|
|
36
|
+
}
|
|
37
|
+
export interface StreamingBinaryJsonEncoder {
|
|
38
|
+
writeStartStr(): void;
|
|
39
|
+
writeStrChunk(str: string): void;
|
|
40
|
+
writeEndStr(): void;
|
|
41
|
+
writeStartBin(): void;
|
|
42
|
+
writeBinChunk(buf: Uint8Array): void;
|
|
43
|
+
writeEndBin(): void;
|
|
44
|
+
writeStartArr(): void;
|
|
45
|
+
writeArrChunk(item: unknown): void;
|
|
46
|
+
writeEndArr(): void;
|
|
47
|
+
writeStartObj(): void;
|
|
48
|
+
writeObjChunk(key: string, value: unknown): void;
|
|
49
|
+
writeEndObj(): void;
|
|
50
|
+
}
|
|
51
|
+
export interface TlvBinaryJsonEncoder {
|
|
52
|
+
writeBinHdr(length: number): void;
|
|
53
|
+
writeArrHdr(length: number): void;
|
|
54
|
+
writeObjHdr(length: number): void;
|
|
55
|
+
}
|
|
56
|
+
export interface BinaryJsonDecoder {
|
|
57
|
+
decode(uint8: Uint8Array): unknown;
|
|
58
|
+
reader: IReader & IReaderResettable;
|
|
59
|
+
read(uint8: Uint8Array): unknown;
|
|
60
|
+
}
|
|
61
|
+
export {};
|
package/lib/types.js
ADDED
package/lib/types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Reader } from '../util/buffers/Reader';
|
|
2
|
+
import type { BinaryJsonDecoder, PackValue } from '../types';
|
|
3
|
+
export declare class UbjsonDecoder implements BinaryJsonDecoder {
|
|
4
|
+
reader: Reader;
|
|
5
|
+
read(uint8: Uint8Array): PackValue;
|
|
6
|
+
decode(uint8: Uint8Array): unknown;
|
|
7
|
+
readAny(): PackValue;
|
|
8
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UbjsonDecoder = void 0;
|
|
4
|
+
const Reader_1 = require("../util/buffers/Reader");
|
|
5
|
+
const JsonPackExtension_1 = require("../JsonPackExtension");
|
|
6
|
+
class UbjsonDecoder {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.reader = new Reader_1.Reader();
|
|
9
|
+
}
|
|
10
|
+
read(uint8) {
|
|
11
|
+
this.reader.reset(uint8);
|
|
12
|
+
return this.readAny();
|
|
13
|
+
}
|
|
14
|
+
decode(uint8) {
|
|
15
|
+
this.reader.reset(uint8);
|
|
16
|
+
return this.readAny();
|
|
17
|
+
}
|
|
18
|
+
readAny() {
|
|
19
|
+
const reader = this.reader;
|
|
20
|
+
const octet = reader.u8();
|
|
21
|
+
switch (octet) {
|
|
22
|
+
case 0x5a:
|
|
23
|
+
return null;
|
|
24
|
+
case 0x54:
|
|
25
|
+
return true;
|
|
26
|
+
case 0x46:
|
|
27
|
+
return false;
|
|
28
|
+
case 0x55:
|
|
29
|
+
return reader.u8();
|
|
30
|
+
case 0x69:
|
|
31
|
+
return reader.i8();
|
|
32
|
+
case 0x49: {
|
|
33
|
+
const int = reader.view.getInt16(reader.x, false);
|
|
34
|
+
reader.x += 2;
|
|
35
|
+
return int;
|
|
36
|
+
}
|
|
37
|
+
case 0x6c: {
|
|
38
|
+
const int = reader.view.getInt32(reader.x, false);
|
|
39
|
+
reader.x += 4;
|
|
40
|
+
return int;
|
|
41
|
+
}
|
|
42
|
+
case 0x64: {
|
|
43
|
+
const num = reader.view.getFloat32(reader.x, false);
|
|
44
|
+
reader.x += 4;
|
|
45
|
+
return num;
|
|
46
|
+
}
|
|
47
|
+
case 0x44: {
|
|
48
|
+
const num = reader.view.getFloat64(reader.x, false);
|
|
49
|
+
reader.x += 8;
|
|
50
|
+
return num;
|
|
51
|
+
}
|
|
52
|
+
case 0x4c: {
|
|
53
|
+
const num = reader.view.getBigInt64(reader.x, false);
|
|
54
|
+
reader.x += 8;
|
|
55
|
+
return num;
|
|
56
|
+
}
|
|
57
|
+
case 0x53:
|
|
58
|
+
return reader.utf8(+this.readAny());
|
|
59
|
+
case 0x43:
|
|
60
|
+
return String.fromCharCode(reader.u8());
|
|
61
|
+
case 0x5b: {
|
|
62
|
+
const uint8 = reader.uint8;
|
|
63
|
+
const x = reader.x;
|
|
64
|
+
if (uint8[x] === 0x24 && uint8[x + 1] === 0x55 && uint8[x + 2] === 0x23) {
|
|
65
|
+
reader.x += 3;
|
|
66
|
+
const size = +this.readAny();
|
|
67
|
+
return reader.buf(size);
|
|
68
|
+
}
|
|
69
|
+
let type = -1;
|
|
70
|
+
if (uint8[x] === 0x24) {
|
|
71
|
+
reader.x++;
|
|
72
|
+
type = reader.u8();
|
|
73
|
+
}
|
|
74
|
+
let count = -1;
|
|
75
|
+
if (uint8[x] === 0x23) {
|
|
76
|
+
reader.x++;
|
|
77
|
+
count = reader.u8();
|
|
78
|
+
}
|
|
79
|
+
if (uint8[x] === 0x24) {
|
|
80
|
+
reader.x++;
|
|
81
|
+
type = reader.u8();
|
|
82
|
+
}
|
|
83
|
+
if (count >= 0) {
|
|
84
|
+
let wordSize = 1;
|
|
85
|
+
switch (type) {
|
|
86
|
+
case 0x49:
|
|
87
|
+
wordSize = 2;
|
|
88
|
+
break;
|
|
89
|
+
case 0x6c:
|
|
90
|
+
case 0x64:
|
|
91
|
+
wordSize = 4;
|
|
92
|
+
break;
|
|
93
|
+
case 0x44:
|
|
94
|
+
case 0x4c:
|
|
95
|
+
wordSize = 8;
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
return new JsonPackExtension_1.JsonPackExtension(type, reader.buf(count * wordSize));
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
const arr = [];
|
|
102
|
+
while (uint8[reader.x] !== 0x5d)
|
|
103
|
+
arr.push(this.readAny());
|
|
104
|
+
reader.x++;
|
|
105
|
+
return arr;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
case 0x7b: {
|
|
109
|
+
const uint8 = reader.uint8;
|
|
110
|
+
const obj = {};
|
|
111
|
+
while (uint8[reader.x] !== 0x7d) {
|
|
112
|
+
const keySize = +this.readAny();
|
|
113
|
+
const key = reader.utf8(keySize);
|
|
114
|
+
if (key === '__proto__')
|
|
115
|
+
throw 6;
|
|
116
|
+
obj[key] = this.readAny();
|
|
117
|
+
}
|
|
118
|
+
reader.x++;
|
|
119
|
+
return obj;
|
|
120
|
+
}
|
|
121
|
+
case 0x4e:
|
|
122
|
+
return undefined;
|
|
123
|
+
}
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
exports.UbjsonDecoder = UbjsonDecoder;
|
|
128
|
+
//# sourceMappingURL=UbjsonDecoder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UbjsonDecoder.js","sourceRoot":"","sources":["../../src/ubjson/UbjsonDecoder.ts"],"names":[],"mappings":";;;AAAA,mDAA8C;AAC9C,4DAAuD;AAIvD,MAAa,aAAa;IAA1B;QACS,WAAM,GAAG,IAAI,eAAM,EAAE,CAAC;IAqH/B,CAAC;IAnHQ,IAAI,CAAC,KAAiB;QAC3B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACzB,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;IAEM,MAAM,CAAC,KAAiB;QAC7B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACzB,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;IAEM,OAAO;QACZ,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,MAAM,KAAK,GAAG,MAAM,CAAC,EAAE,EAAE,CAAC;QAC1B,QAAQ,KAAK,EAAE,CAAC;YACd,KAAK,IAAI;gBACP,OAAO,IAAI,CAAC;YACd,KAAK,IAAI;gBACP,OAAO,IAAI,CAAC;YACd,KAAK,IAAI;gBACP,OAAO,KAAK,CAAC;YACf,KAAK,IAAI;gBACP,OAAO,MAAM,CAAC,EAAE,EAAE,CAAC;YACrB,KAAK,IAAI;gBACP,OAAO,MAAM,CAAC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@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { IWriter, IWriterGrowable } from '../util/buffers';
|
|
2
|
+
import type { BinaryJsonEncoder, StreamingBinaryJsonEncoder } from '../types';
|
|
3
|
+
export declare class UbjsonEncoder implements BinaryJsonEncoder, StreamingBinaryJsonEncoder {
|
|
4
|
+
readonly writer: IWriter & IWriterGrowable;
|
|
5
|
+
constructor(writer: IWriter & IWriterGrowable);
|
|
6
|
+
encode(value: unknown): Uint8Array;
|
|
7
|
+
writeAny(value: unknown): void;
|
|
8
|
+
writeNull(): void;
|
|
9
|
+
writeUndef(): void;
|
|
10
|
+
writeBoolean(bool: boolean): void;
|
|
11
|
+
writeNumber(num: number): void;
|
|
12
|
+
writeInteger(int: number): void;
|
|
13
|
+
writeUInteger(uint: number): void;
|
|
14
|
+
writeFloat(float: number): void;
|
|
15
|
+
writeBigInt(int: bigint): void;
|
|
16
|
+
writeBin(buf: Uint8Array): void;
|
|
17
|
+
writeStr(str: string): void;
|
|
18
|
+
writeAsciiStr(str: string): void;
|
|
19
|
+
writeArr(arr: unknown[]): void;
|
|
20
|
+
writeObj(obj: Record<string, unknown>): void;
|
|
21
|
+
writeKey(str: string): void;
|
|
22
|
+
writeStartStr(): void;
|
|
23
|
+
writeStrChunk(str: string): void;
|
|
24
|
+
writeEndStr(): void;
|
|
25
|
+
writeStartBin(): void;
|
|
26
|
+
writeBinChunk(buf: Uint8Array): void;
|
|
27
|
+
writeEndBin(): void;
|
|
28
|
+
writeStartArr(): void;
|
|
29
|
+
writeArrChunk(item: unknown): void;
|
|
30
|
+
writeEndArr(): void;
|
|
31
|
+
writeStartObj(): void;
|
|
32
|
+
writeObjChunk(key: string, value: unknown): void;
|
|
33
|
+
writeEndObj(): void;
|
|
34
|
+
}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UbjsonEncoder = void 0;
|
|
4
|
+
class UbjsonEncoder {
|
|
5
|
+
constructor(writer) {
|
|
6
|
+
this.writer = writer;
|
|
7
|
+
}
|
|
8
|
+
encode(value) {
|
|
9
|
+
const writer = this.writer;
|
|
10
|
+
writer.reset();
|
|
11
|
+
this.writeAny(value);
|
|
12
|
+
return writer.flush();
|
|
13
|
+
}
|
|
14
|
+
writeAny(value) {
|
|
15
|
+
switch (typeof value) {
|
|
16
|
+
case 'boolean':
|
|
17
|
+
return this.writeBoolean(value);
|
|
18
|
+
case 'number':
|
|
19
|
+
return this.writeNumber(value);
|
|
20
|
+
case 'string':
|
|
21
|
+
return this.writeStr(value);
|
|
22
|
+
case 'object': {
|
|
23
|
+
if (value === null)
|
|
24
|
+
return this.writeNull();
|
|
25
|
+
const constructor = value.constructor;
|
|
26
|
+
switch (constructor) {
|
|
27
|
+
case Array:
|
|
28
|
+
return this.writeArr(value);
|
|
29
|
+
case Uint8Array:
|
|
30
|
+
return this.writeBin(value);
|
|
31
|
+
default:
|
|
32
|
+
return this.writeObj(value);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
case 'bigint':
|
|
36
|
+
return this.writeBigInt(value);
|
|
37
|
+
case 'undefined':
|
|
38
|
+
return this.writeUndef();
|
|
39
|
+
default:
|
|
40
|
+
return this.writeNull();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
writeNull() {
|
|
44
|
+
this.writer.u8(0x5a);
|
|
45
|
+
}
|
|
46
|
+
writeUndef() {
|
|
47
|
+
this.writer.u8(0x4e);
|
|
48
|
+
}
|
|
49
|
+
writeBoolean(bool) {
|
|
50
|
+
this.writer.u8(bool ? 0x54 : 0x46);
|
|
51
|
+
}
|
|
52
|
+
writeNumber(num) {
|
|
53
|
+
if (num >> 0 === num)
|
|
54
|
+
return this.writeInteger(num);
|
|
55
|
+
this.writeFloat(num);
|
|
56
|
+
}
|
|
57
|
+
writeInteger(int) {
|
|
58
|
+
const writer = this.writer;
|
|
59
|
+
if (int <= 0xff && 0 <= int)
|
|
60
|
+
writer.u16(0x5500 | int);
|
|
61
|
+
else if (int <= 127 && -128 <= int) {
|
|
62
|
+
writer.u16(0x6900);
|
|
63
|
+
writer.view.setInt8(writer.x - 1, int);
|
|
64
|
+
}
|
|
65
|
+
else if (int <= 32767 && -32768 <= int) {
|
|
66
|
+
writer.ensureCapacity(3);
|
|
67
|
+
writer.u8(0x49);
|
|
68
|
+
writer.view.setInt16(writer.x, int, false);
|
|
69
|
+
writer.x += 2;
|
|
70
|
+
}
|
|
71
|
+
else if (int <= 2147483647 && -2147483648 <= int) {
|
|
72
|
+
writer.ensureCapacity(5);
|
|
73
|
+
writer.u8(0x6c);
|
|
74
|
+
writer.view.setInt32(writer.x, int, false);
|
|
75
|
+
writer.x += 4;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
writeUInteger(uint) {
|
|
79
|
+
const writer = this.writer;
|
|
80
|
+
if (uint < 0xff)
|
|
81
|
+
writer.u16(0x5500 + uint);
|
|
82
|
+
}
|
|
83
|
+
writeFloat(float) {
|
|
84
|
+
const writer = this.writer;
|
|
85
|
+
writer.ensureCapacity(9);
|
|
86
|
+
const view = writer.view;
|
|
87
|
+
const x = writer.x;
|
|
88
|
+
view.setUint8(x, 0x44);
|
|
89
|
+
view.setFloat64(x + 1, float, false);
|
|
90
|
+
writer.x = x + 9;
|
|
91
|
+
}
|
|
92
|
+
writeBigInt(int) {
|
|
93
|
+
const writer = this.writer;
|
|
94
|
+
writer.ensureCapacity(9);
|
|
95
|
+
const view = writer.view;
|
|
96
|
+
const x = writer.x;
|
|
97
|
+
view.setUint8(x, 0x4c);
|
|
98
|
+
view.setBigInt64(x + 1, int, false);
|
|
99
|
+
writer.x = x + 9;
|
|
100
|
+
}
|
|
101
|
+
writeBin(buf) {
|
|
102
|
+
const writer = this.writer;
|
|
103
|
+
const length = buf.length;
|
|
104
|
+
writer.u32(1529107747);
|
|
105
|
+
this.writeInteger(length);
|
|
106
|
+
writer.buf(buf, length);
|
|
107
|
+
}
|
|
108
|
+
writeStr(str) {
|
|
109
|
+
const length = str.length;
|
|
110
|
+
const maxLength = length * 4;
|
|
111
|
+
const capacity = maxLength + 1 + 5;
|
|
112
|
+
const writer = this.writer;
|
|
113
|
+
writer.ensureCapacity(capacity);
|
|
114
|
+
const uint8 = writer.uint8;
|
|
115
|
+
uint8[writer.x++] = 0x53;
|
|
116
|
+
const x = writer.x;
|
|
117
|
+
const oneByteLength = maxLength < 0xff;
|
|
118
|
+
if (oneByteLength) {
|
|
119
|
+
uint8[writer.x++] = 0x55;
|
|
120
|
+
writer.x++;
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
uint8[writer.x++] = 0x6c;
|
|
124
|
+
writer.x += 4;
|
|
125
|
+
}
|
|
126
|
+
const size = writer.utf8(str);
|
|
127
|
+
if (oneByteLength)
|
|
128
|
+
uint8[x + 1] = size;
|
|
129
|
+
else
|
|
130
|
+
writer.view.setUint32(x + 1, size);
|
|
131
|
+
}
|
|
132
|
+
writeAsciiStr(str) {
|
|
133
|
+
this.writeStr(str);
|
|
134
|
+
}
|
|
135
|
+
writeArr(arr) {
|
|
136
|
+
const writer = this.writer;
|
|
137
|
+
writer.u8(0x5b);
|
|
138
|
+
const length = arr.length;
|
|
139
|
+
for (let i = 0; i < length; i++)
|
|
140
|
+
this.writeAny(arr[i]);
|
|
141
|
+
writer.u8(0x5d);
|
|
142
|
+
}
|
|
143
|
+
writeObj(obj) {
|
|
144
|
+
const writer = this.writer;
|
|
145
|
+
const keys = Object.keys(obj);
|
|
146
|
+
const length = keys.length;
|
|
147
|
+
writer.u8(0x7b);
|
|
148
|
+
for (let i = 0; i < length; i++) {
|
|
149
|
+
const key = keys[i];
|
|
150
|
+
const value = obj[key];
|
|
151
|
+
this.writeKey(key);
|
|
152
|
+
this.writeAny(value);
|
|
153
|
+
}
|
|
154
|
+
writer.u8(0x7d);
|
|
155
|
+
}
|
|
156
|
+
writeKey(str) {
|
|
157
|
+
const length = str.length;
|
|
158
|
+
const maxLength = length * 4;
|
|
159
|
+
const capacity = maxLength + 5;
|
|
160
|
+
const writer = this.writer;
|
|
161
|
+
writer.ensureCapacity(capacity);
|
|
162
|
+
const uint8 = writer.uint8;
|
|
163
|
+
const x = writer.x;
|
|
164
|
+
const oneByteLength = maxLength < 0xff;
|
|
165
|
+
if (oneByteLength) {
|
|
166
|
+
uint8[writer.x++] = 0x55;
|
|
167
|
+
writer.x++;
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
uint8[writer.x++] = 0x6c;
|
|
171
|
+
writer.x += 4;
|
|
172
|
+
}
|
|
173
|
+
const size = writer.utf8(str);
|
|
174
|
+
if (oneByteLength)
|
|
175
|
+
uint8[x + 1] = size;
|
|
176
|
+
else
|
|
177
|
+
writer.view.setUint32(x + 1, size);
|
|
178
|
+
}
|
|
179
|
+
writeStartStr() {
|
|
180
|
+
throw new Error('Method not implemented.');
|
|
181
|
+
}
|
|
182
|
+
writeStrChunk(str) {
|
|
183
|
+
throw new Error('Method not implemented.');
|
|
184
|
+
}
|
|
185
|
+
writeEndStr() {
|
|
186
|
+
throw new Error('Method not implemented.');
|
|
187
|
+
}
|
|
188
|
+
writeStartBin() {
|
|
189
|
+
throw new Error('Method not implemented.');
|
|
190
|
+
}
|
|
191
|
+
writeBinChunk(buf) {
|
|
192
|
+
throw new Error('Method not implemented.');
|
|
193
|
+
}
|
|
194
|
+
writeEndBin() {
|
|
195
|
+
throw new Error('Method not implemented.');
|
|
196
|
+
}
|
|
197
|
+
writeStartArr() {
|
|
198
|
+
this.writer.u8(0x5b);
|
|
199
|
+
}
|
|
200
|
+
writeArrChunk(item) {
|
|
201
|
+
this.writeAny(item);
|
|
202
|
+
}
|
|
203
|
+
writeEndArr() {
|
|
204
|
+
this.writer.u8(0x5d);
|
|
205
|
+
}
|
|
206
|
+
writeStartObj() {
|
|
207
|
+
this.writer.u8(0x7b);
|
|
208
|
+
}
|
|
209
|
+
writeObjChunk(key, value) {
|
|
210
|
+
this.writeKey(key);
|
|
211
|
+
this.writeAny(value);
|
|
212
|
+
}
|
|
213
|
+
writeEndObj() {
|
|
214
|
+
this.writer.u8(0x7d);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
exports.UbjsonEncoder = UbjsonEncoder;
|
|
218
|
+
//# sourceMappingURL=UbjsonEncoder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UbjsonEncoder.js","sourceRoot":"","sources":["../../src/ubjson/UbjsonEncoder.ts"],"names":[],"mappings":";;;AAGA,MAAa,aAAa;IACxB,YAA4B,MAAiC;QAAjC,WAAM,GAAN,MAAM,CAA2B;IAAG,CAAC;IAE1D,MAAM,CAAC,KAAc;QAC1B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,MAAM,CAAC,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACrB,OAAO,MAAM,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;IAEM,QAAQ,CAAC,KAAc;QAC5B,QAAQ,OAAO,KAAK,EAAE,CAAC;YACrB,KAAK,SAAS;gBACZ,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;YAClC,KAAK,QAAQ;gBACX,OAAO,IAAI,CAAC,WAAW,CAAC,KAAe,CAAC,CAAC;YAC3C,KAAK,QAAQ;gBACX,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YAC9B,KAAK,QAAQ,CAAC,CAAC,CAAC;gBACd,IAAI,KAAK,KAAK,IAAI;oBAAE,OAAO,IAAI,CAAC,SAAS,EAAE,CAAC;gBAC5C,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;gBACtC,QAAQ,WAAW,EAAE,CAAC;oBACpB,KAAK,KAAK;wBACR,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAkB,CAAC,CAAC;oBAC3C,KAAK,UAAU;wBACb,OAAO,IAAI,CAAC,QAAQ,CAAC,KA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{ value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./UbjsonEncoder"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./UbjsonDecoder"), exports);
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ubjson/index.ts"],"names":[],"mappings":";;;AAAA,0DAAgC;AAChC,0DAAgC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare class CompressionTable {
|
|
2
|
+
static create(value: unknown): CompressionTable;
|
|
3
|
+
protected integers: Set<number>;
|
|
4
|
+
protected nonIntegers: Set<unknown>;
|
|
5
|
+
protected table: unknown[];
|
|
6
|
+
protected map: Map<unknown, number>;
|
|
7
|
+
addInteger(int: number): void;
|
|
8
|
+
addLiteral(value: number | string | unknown): void;
|
|
9
|
+
walk(value: unknown): void;
|
|
10
|
+
finalize(): void;
|
|
11
|
+
getIndex(value: unknown): number;
|
|
12
|
+
getTable(): unknown[];
|
|
13
|
+
compress(value: unknown): unknown;
|
|
14
|
+
}
|