@schema-pack/message-pack 0.0.0-commit.8d5dca5ce6fa2841d57d39bd48f82979461a0a69 → 0.0.0-commit.a13995b1ec0a9d8be0fcfbdf0d45a0c8a2c75b3c
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/LICENSE +21 -0
- package/README.md +9 -123
- package/dist/cjs/bufferWithExtensions-Cg4LGSIy.d.cts +51 -0
- package/dist/cjs/bufferWithExtensions-Cg4LGSIy.d.cts.map +1 -0
- package/dist/cjs/bufferWithExtensions.cjs +79 -16
- package/dist/cjs/bufferWithExtensions.d.cts +1 -1
- package/dist/cjs/decode-BraWmoPw.d.cts +5 -0
- package/dist/cjs/decode-BraWmoPw.d.cts.map +1 -0
- package/dist/cjs/decoder/decode.cjs +8 -0
- package/dist/cjs/decoder/decode.d.cts +2 -0
- package/dist/cjs/decoder/decoder.cjs +268 -19
- package/dist/cjs/decoder/decoder.d.cts +1 -1
- package/dist/cjs/decoder/index.cjs +6 -2
- package/dist/cjs/decoder/index.d.cts +7 -5
- package/dist/cjs/decoder/interfaces/index.d.cts +4 -4
- package/dist/cjs/decoder/interfaces/messagePackDecoder.d.cts +2 -0
- package/dist/cjs/decoder/interfaces/messagePackTextDecoder.d.cts +1 -1
- package/dist/cjs/decoder/textDecoders/defaultTextDecoder.d.cts +1 -1
- package/dist/cjs/decoder/textDecoders/index.cjs +5 -0
- package/dist/cjs/decoder/textDecoders/index.d.cts +4 -0
- package/dist/cjs/decoder/textDecoders/nodeTextDecoder.cjs +8 -0
- package/dist/cjs/decoder/textDecoders/nodeTextDecoder.d.cts +2 -0
- package/dist/cjs/decoder/types.d.cts +2 -2
- package/dist/cjs/decoder-T6p4ZZJi.d.cts +30 -0
- package/dist/cjs/decoder-T6p4ZZJi.d.cts.map +1 -0
- package/dist/cjs/defaultNewBufferFn.cjs +1 -3
- package/dist/cjs/defaultNewBufferFn.d.cts +2 -1
- package/dist/cjs/defaultNewBufferFn.d.cts.map +1 -1
- package/dist/cjs/defaultTextDecoder-CyZtJbK1.d.cts +10 -0
- package/dist/cjs/defaultTextDecoder-CyZtJbK1.d.cts.map +1 -0
- package/dist/{esm/defaultTextEncoder-BkIjtDkg.d.mts → cjs/defaultTextEncoder-BpUrJKD9.d.cts} +2 -2
- package/dist/cjs/{defaultTextEncoder-DzdGBX6s.d.cts.map → defaultTextEncoder-BpUrJKD9.d.cts.map} +1 -1
- package/dist/cjs/encode-4SxHVw0M.d.cts +5 -0
- package/dist/cjs/encode-4SxHVw0M.d.cts.map +1 -0
- package/dist/cjs/encoder/encode.cjs +8 -0
- package/dist/cjs/encoder/encode.d.cts +2 -0
- package/dist/cjs/encoder/encoder.cjs +690 -26
- package/dist/cjs/encoder/encoder.d.cts +1 -1
- package/dist/cjs/encoder/index.cjs +2 -2
- package/dist/cjs/encoder/index.d.cts +7 -7
- package/dist/cjs/encoder/interfaces/index.d.cts +4 -4
- package/dist/cjs/encoder/interfaces/messagePackEncoder.d.cts +2 -0
- package/dist/cjs/encoder/interfaces/messagePackTextEncoder.d.cts +1 -1
- package/dist/cjs/encoder/textEncoders/defaultTextEncoder.d.cts +1 -1
- package/dist/cjs/encoder/textEncoders/index.d.cts +3 -3
- package/dist/cjs/encoder/textEncoders/nodeTextEncoder.d.cts +1 -1
- package/dist/cjs/encoder/types.d.cts +2 -2
- package/dist/cjs/{encoderBuffer-DWGIXXjj.d.cts → encoder-yQYOtvXU.d.cts} +38 -16
- package/dist/cjs/encoder-yQYOtvXU.d.cts.map +1 -0
- package/dist/cjs/{messagePackExtension-C_TQXlEn.d.cts → error-B129l__v.d.cts} +306 -52
- package/dist/cjs/error-B129l__v.d.cts.map +1 -0
- package/dist/cjs/extensions/error/defaultFactories.cjs +15 -0
- package/dist/cjs/extensions/error/defaultFactories.d.cts +6 -0
- package/dist/cjs/extensions/error/defaultFactories.d.cts.map +1 -0
- package/dist/cjs/extensions/error/error.cjs +139 -0
- package/dist/cjs/extensions/error/error.d.cts +2 -0
- package/dist/cjs/extensions/error/index.cjs +3 -0
- package/dist/cjs/extensions/error/index.d.cts +4 -0
- package/dist/cjs/extensions/error/symbols.cjs +19 -0
- package/dist/cjs/extensions/error/symbols.d.cts +19 -0
- package/dist/cjs/extensions/error/symbols.d.cts.map +1 -0
- package/dist/cjs/extensions/error/types.d.cts +2 -0
- package/dist/cjs/extensions/index.cjs +4 -0
- package/dist/cjs/extensions/index.d.cts +6 -3
- package/dist/cjs/extensions/interfaces/messagePackBuiltInExtension.d.cts +2 -0
- package/dist/cjs/extensions/interfaces/messagePackExtension.d.cts +1 -1
- package/dist/cjs/extensions/interfaces/messagePackExtensionBase.cjs +0 -0
- package/dist/cjs/extensions/interfaces/messagePackExtensionBase.d.cts +2 -0
- package/dist/cjs/extensions/interfaces/types.cjs +0 -0
- package/dist/cjs/extensions/interfaces/types.d.cts +2 -0
- package/dist/cjs/extensions/serializer/index.cjs +3 -0
- package/dist/cjs/extensions/serializer/index.d.cts +4 -0
- package/dist/cjs/extensions/serializer/serializer.cjs +27 -0
- package/dist/cjs/extensions/serializer/serializer.d.cts +2 -0
- package/dist/cjs/extensions/serializer/types.cjs +0 -0
- package/dist/cjs/extensions/serializer/types.d.cts +2 -0
- package/dist/cjs/extensions/timestampDate/index.d.cts +2 -2
- package/dist/cjs/extensions/timestampDate/timestampDate.cjs +41 -24
- package/dist/cjs/extensions/timestampDate/timestampDate.d.cts +1 -1
- package/dist/cjs/index-B5vbV8Ak.d.cts +1 -0
- package/dist/cjs/index.cjs +15 -32
- package/dist/cjs/index.d.cts +16 -23
- package/dist/cjs/interfaces/messagePackBufferWithExtensions.d.cts +1 -1
- package/dist/cjs/messagePackDecoder-BZOBJ2h5.d.cts +12 -0
- package/dist/cjs/messagePackDecoder-BZOBJ2h5.d.cts.map +1 -0
- package/dist/cjs/messagePackExtensionBase-DVMgQv12.d.cts +30 -0
- package/dist/cjs/messagePackExtensionBase-DVMgQv12.d.cts.map +1 -0
- package/dist/cjs/messagePackTextDecoder-CfBSOsxU.d.cts +8 -0
- package/dist/cjs/messagePackTextDecoder-CfBSOsxU.d.cts.map +1 -0
- package/dist/cjs/{messagePackTextEncoder-D7iCft_t.d.cts → messagePackTextEncoder-MeyNUt3L.d.cts} +2 -2
- package/dist/cjs/messagePackTextEncoder-MeyNUt3L.d.cts.map +1 -0
- package/dist/cjs/nodeTextDecoder-B48jwo-L.d.cts +9 -0
- package/dist/cjs/nodeTextDecoder-B48jwo-L.d.cts.map +1 -0
- package/dist/{esm/nodeTextEncoder-CegSnA6z.d.mts → cjs/nodeTextEncoder-BpJi8Jx-.d.cts} +3 -3
- package/dist/cjs/nodeTextEncoder-BpJi8Jx-.d.cts.map +1 -0
- package/dist/cjs/serializer-nJmZCyQ0.d.cts +19 -0
- package/dist/cjs/serializer-nJmZCyQ0.d.cts.map +1 -0
- package/dist/cjs/types-BLh5F2iA.d.cts +22 -0
- package/dist/cjs/types-BLh5F2iA.d.cts.map +1 -0
- package/dist/cjs/types-BcIA43h9.d.cts +5 -0
- package/dist/cjs/types-BcIA43h9.d.cts.map +1 -0
- package/dist/cjs/types-CbicLx9m.d.cts +21 -0
- package/dist/cjs/types-CbicLx9m.d.cts.map +1 -0
- package/dist/cjs/types-aODRmLZq.d.cts +7 -0
- package/dist/cjs/types-aODRmLZq.d.cts.map +1 -0
- package/dist/cjs/types.d.cts +2 -2
- package/dist/cjs/utils/assertValidExtensionType.cjs +7 -0
- package/dist/cjs/utils/assertValidExtensionType.d.cts +4 -0
- package/dist/cjs/utils/assertValidExtensionType.d.cts.map +1 -0
- package/dist/cjs/utils/fitIn16Bits.d.cts +4 -2
- package/dist/cjs/utils/fitIn16Bits.d.cts.map +1 -0
- package/dist/cjs/utils/fitIn32Bits.d.cts +4 -2
- package/dist/cjs/utils/fitIn32Bits.d.cts.map +1 -0
- package/dist/cjs/utils/fitIn7Bits.d.cts +4 -2
- package/dist/cjs/utils/fitIn7Bits.d.cts.map +1 -0
- package/dist/cjs/utils/fitIn8Bits.d.cts +4 -2
- package/dist/cjs/utils/fitIn8Bits.d.cts.map +1 -0
- package/dist/esm/bufferWithExtensions-DSU4ekuD.d.mts +51 -0
- package/dist/esm/bufferWithExtensions-DSU4ekuD.d.mts.map +1 -0
- package/dist/esm/bufferWithExtensions.d.mts +1 -1
- package/dist/esm/bufferWithExtensions.mjs +79 -16
- package/dist/esm/bufferWithExtensions.mjs.map +1 -1
- package/dist/esm/decode-BraWmoPw.d.mts +5 -0
- package/dist/esm/decode-BraWmoPw.d.mts.map +1 -0
- package/dist/esm/decoder/decode.d.mts +2 -0
- package/dist/esm/decoder/decode.mjs +11 -0
- package/dist/esm/decoder/decode.mjs.map +1 -0
- package/dist/esm/decoder/decoder.d.mts +1 -1
- package/dist/esm/decoder/decoder.mjs +268 -19
- package/dist/esm/decoder/decoder.mjs.map +1 -1
- package/dist/esm/decoder/index.d.mts +7 -5
- package/dist/esm/decoder/index.mjs +4 -2
- package/dist/esm/decoder/interfaces/index.d.mts +4 -4
- package/dist/esm/decoder/interfaces/messagePackDecoder.d.mts +2 -0
- package/dist/esm/decoder/interfaces/messagePackTextDecoder.d.mts +1 -1
- package/dist/esm/decoder/textDecoders/defaultTextDecoder.d.mts +1 -1
- package/dist/esm/decoder/textDecoders/defaultTextDecoder.mjs.map +1 -1
- package/dist/esm/decoder/textDecoders/index.d.mts +4 -0
- package/dist/esm/decoder/textDecoders/index.mjs +3 -0
- package/dist/esm/decoder/textDecoders/nodeTextDecoder.d.mts +2 -0
- package/dist/esm/decoder/textDecoders/nodeTextDecoder.mjs +10 -0
- package/dist/esm/decoder/textDecoders/nodeTextDecoder.mjs.map +1 -0
- package/dist/esm/decoder/types.d.mts +2 -2
- package/dist/esm/decoder-Bdqx1C7P.d.mts +30 -0
- package/dist/esm/decoder-Bdqx1C7P.d.mts.map +1 -0
- package/dist/esm/defaultNewBufferFn.d.mts +2 -1
- package/dist/esm/defaultNewBufferFn.d.mts.map +1 -1
- package/dist/esm/defaultNewBufferFn.mjs +1 -3
- package/dist/esm/defaultNewBufferFn.mjs.map +1 -1
- package/dist/esm/defaultTextDecoder-BkW5T2EO.d.mts +10 -0
- package/dist/esm/defaultTextDecoder-BkW5T2EO.d.mts.map +1 -0
- package/dist/{cjs/defaultTextEncoder-DzdGBX6s.d.cts → esm/defaultTextEncoder-9dqnRXnL.d.mts} +2 -2
- package/dist/esm/{defaultTextEncoder-BkIjtDkg.d.mts.map → defaultTextEncoder-9dqnRXnL.d.mts.map} +1 -1
- package/dist/esm/encode-4SxHVw0M.d.mts +5 -0
- package/dist/esm/encode-4SxHVw0M.d.mts.map +1 -0
- package/dist/esm/encoder/encode.d.mts +2 -0
- package/dist/esm/encoder/encode.mjs +11 -0
- package/dist/esm/encoder/encode.mjs.map +1 -0
- package/dist/esm/encoder/encoder.d.mts +1 -1
- package/dist/esm/encoder/encoder.mjs +690 -26
- package/dist/esm/encoder/encoder.mjs.map +1 -1
- package/dist/esm/encoder/index.d.mts +7 -7
- package/dist/esm/encoder/index.mjs +2 -2
- package/dist/esm/encoder/interfaces/index.d.mts +4 -4
- package/dist/esm/encoder/interfaces/messagePackEncoder.d.mts +2 -0
- package/dist/esm/encoder/interfaces/messagePackTextEncoder.d.mts +1 -1
- package/dist/esm/encoder/textEncoders/defaultTextEncoder.d.mts +1 -1
- package/dist/esm/encoder/textEncoders/index.d.mts +3 -3
- package/dist/esm/encoder/textEncoders/nodeTextEncoder.d.mts +1 -1
- package/dist/esm/encoder/textEncoders/nodeTextEncoder.mjs.map +1 -1
- package/dist/esm/encoder/types.d.mts +2 -2
- package/dist/esm/{encoderBuffer-DEy8CuWQ.d.mts → encoder-C5Oo57-h.d.mts} +38 -16
- package/dist/esm/encoder-C5Oo57-h.d.mts.map +1 -0
- package/dist/esm/{messagePackExtension-5TI02KG6.d.mts → error-BtKEZf6W.d.mts} +306 -52
- package/dist/esm/error-BtKEZf6W.d.mts.map +1 -0
- package/dist/esm/extensions/error/defaultFactories.d.mts +7 -0
- package/dist/esm/extensions/error/defaultFactories.d.mts.map +1 -0
- package/dist/esm/extensions/error/defaultFactories.mjs +17 -0
- package/dist/esm/extensions/error/defaultFactories.mjs.map +1 -0
- package/dist/esm/extensions/error/error.d.mts +2 -0
- package/dist/esm/extensions/error/error.mjs +141 -0
- package/dist/esm/extensions/error/error.mjs.map +1 -0
- package/dist/esm/extensions/error/index.d.mts +4 -0
- package/dist/esm/extensions/error/index.mjs +2 -0
- package/dist/esm/extensions/error/symbols.d.mts +20 -0
- package/dist/esm/extensions/error/symbols.d.mts.map +1 -0
- package/dist/esm/extensions/error/symbols.mjs +21 -0
- package/dist/esm/extensions/error/symbols.mjs.map +1 -0
- package/dist/esm/extensions/error/types.d.mts +2 -0
- package/dist/esm/extensions/index.d.mts +6 -3
- package/dist/esm/extensions/index.mjs +3 -1
- package/dist/esm/extensions/interfaces/messagePackBuiltInExtension.d.mts +2 -0
- package/dist/esm/extensions/interfaces/messagePackExtension.d.mts +1 -1
- package/dist/esm/extensions/interfaces/messagePackExtensionBase.d.mts +2 -0
- package/dist/esm/extensions/interfaces/messagePackExtensionBase.mjs +1 -0
- package/dist/esm/extensions/interfaces/types.d.mts +2 -0
- package/dist/esm/extensions/interfaces/types.mjs +1 -0
- package/dist/esm/extensions/serializer/index.d.mts +4 -0
- package/dist/esm/extensions/serializer/index.mjs +2 -0
- package/dist/esm/extensions/serializer/serializer.d.mts +2 -0
- package/dist/esm/extensions/serializer/serializer.mjs +29 -0
- package/dist/esm/extensions/serializer/serializer.mjs.map +1 -0
- package/dist/esm/extensions/serializer/types.d.mts +2 -0
- package/dist/esm/extensions/serializer/types.mjs +1 -0
- package/dist/esm/extensions/timestampDate/index.d.mts +2 -2
- package/dist/esm/extensions/timestampDate/timestampDate.d.mts +1 -1
- package/dist/esm/extensions/timestampDate/timestampDate.mjs +41 -24
- package/dist/esm/extensions/timestampDate/timestampDate.mjs.map +1 -1
- package/dist/esm/index-B5vbV8Ak.d.mts +1 -0
- package/dist/esm/index.d.mts +16 -23
- package/dist/esm/index.mjs +10 -17
- package/dist/esm/interfaces/messagePackBufferWithExtensions.d.mts +1 -1
- package/dist/esm/messagePackDecoder-96W4gsyQ.d.mts +12 -0
- package/dist/esm/messagePackDecoder-96W4gsyQ.d.mts.map +1 -0
- package/dist/esm/messagePackExtensionBase-w6KYZsVn.d.mts +30 -0
- package/dist/esm/messagePackExtensionBase-w6KYZsVn.d.mts.map +1 -0
- package/dist/esm/messagePackTextDecoder-CfBSOsxU.d.mts +8 -0
- package/dist/esm/messagePackTextDecoder-CfBSOsxU.d.mts.map +1 -0
- package/dist/esm/{messagePackTextEncoder-D7iCft_t.d.mts → messagePackTextEncoder-MeyNUt3L.d.mts} +2 -2
- package/dist/esm/messagePackTextEncoder-MeyNUt3L.d.mts.map +1 -0
- package/dist/esm/nodeTextDecoder-D95BppeH.d.mts +9 -0
- package/dist/esm/nodeTextDecoder-D95BppeH.d.mts.map +1 -0
- package/dist/{cjs/nodeTextEncoder-DJzFDBXd.d.cts → esm/nodeTextEncoder-Bv6YQGyH.d.mts} +3 -3
- package/dist/esm/nodeTextEncoder-Bv6YQGyH.d.mts.map +1 -0
- package/dist/esm/serializer-Bu3RyF09.d.mts +19 -0
- package/dist/esm/serializer-Bu3RyF09.d.mts.map +1 -0
- package/dist/esm/types-BcIA43h9.d.mts +5 -0
- package/dist/esm/types-BcIA43h9.d.mts.map +1 -0
- package/dist/esm/types-DcVlVqj4.d.mts +21 -0
- package/dist/esm/types-DcVlVqj4.d.mts.map +1 -0
- package/dist/esm/types-LHP7oHpt.d.mts +22 -0
- package/dist/esm/types-LHP7oHpt.d.mts.map +1 -0
- package/dist/esm/types-xD3JER2f.d.mts +7 -0
- package/dist/esm/types-xD3JER2f.d.mts.map +1 -0
- package/dist/esm/types.d.mts +2 -2
- package/dist/esm/utils/assertValidExtensionType.d.mts +5 -0
- package/dist/esm/utils/assertValidExtensionType.d.mts.map +1 -0
- package/dist/esm/utils/assertValidExtensionType.mjs +9 -0
- package/dist/esm/utils/assertValidExtensionType.mjs.map +1 -0
- package/dist/esm/utils/fitIn16Bits.d.mts +5 -2
- package/dist/esm/utils/fitIn16Bits.d.mts.map +1 -0
- package/dist/esm/utils/fitIn32Bits.d.mts +5 -2
- package/dist/esm/utils/fitIn32Bits.d.mts.map +1 -0
- package/dist/esm/utils/fitIn7Bits.d.mts +5 -2
- package/dist/esm/utils/fitIn7Bits.d.mts.map +1 -0
- package/dist/esm/utils/fitIn8Bits.d.mts +5 -2
- package/dist/esm/utils/fitIn8Bits.d.mts.map +1 -0
- package/package.json +68 -43
- package/dist/cjs/benchmark/decoderDataTypesFactory.cjs +0 -37
- package/dist/cjs/benchmark/decoderDataTypesFactory.d.cts +0 -5
- package/dist/cjs/benchmark/decoderDataTypesFactory.d.cts.map +0 -1
- package/dist/cjs/bigInt-CBB8PGpe.d.cts +0 -35
- package/dist/cjs/bigInt-CBB8PGpe.d.cts.map +0 -1
- package/dist/cjs/bufferWithExtensions-BAinwJsn.d.cts +0 -12
- package/dist/cjs/bufferWithExtensions-BAinwJsn.d.cts.map +0 -1
- package/dist/cjs/decoder/decoderBuffer.cjs +0 -239
- package/dist/cjs/decoder/decoderBuffer.d.cts +0 -2
- package/dist/cjs/decoder/interfaces/messagePackDecoderBuffer.d.cts +0 -2
- package/dist/cjs/decoder-C1cd4I8S.d.cts +0 -15
- package/dist/cjs/decoder-C1cd4I8S.d.cts.map +0 -1
- package/dist/cjs/decoderBuffer-C9_0y-3q.d.cts +0 -22
- package/dist/cjs/decoderBuffer-C9_0y-3q.d.cts.map +0 -1
- package/dist/cjs/defaultTextDecoder-Ji2hTZkf.d.cts +0 -10
- package/dist/cjs/defaultTextDecoder-Ji2hTZkf.d.cts.map +0 -1
- package/dist/cjs/encoder/encoderBuffer.cjs +0 -602
- package/dist/cjs/encoder/encoderBuffer.d.cts +0 -2
- package/dist/cjs/encoder/interfaces/messagePackEncoderBuffer.d.cts +0 -2
- package/dist/cjs/encoder-DXuhGwd7.d.cts +0 -23
- package/dist/cjs/encoder-DXuhGwd7.d.cts.map +0 -1
- package/dist/cjs/encoderBuffer-DWGIXXjj.d.cts.map +0 -1
- package/dist/cjs/extensions/bigint/bigInt.cjs +0 -54
- package/dist/cjs/extensions/bigint/bigInt.d.cts +0 -2
- package/dist/cjs/extensions/bigint/index.cjs +0 -2
- package/dist/cjs/extensions/bigint/index.d.cts +0 -3
- package/dist/cjs/extensions/interfaces/index.d.cts +0 -3
- package/dist/cjs/fitIn16Bits-D9lga-sP.d.cts +0 -5
- package/dist/cjs/fitIn16Bits-D9lga-sP.d.cts.map +0 -1
- package/dist/cjs/fitIn32Bits-BrGIMOff.d.cts +0 -5
- package/dist/cjs/fitIn32Bits-BrGIMOff.d.cts.map +0 -1
- package/dist/cjs/fitIn7Bits-BVHyKXCg.d.cts +0 -5
- package/dist/cjs/fitIn7Bits-BVHyKXCg.d.cts.map +0 -1
- package/dist/cjs/fitIn8Bits-DQnQIhdh.d.cts +0 -5
- package/dist/cjs/fitIn8Bits-DQnQIhdh.d.cts.map +0 -1
- package/dist/cjs/fitInt64Bits-CY7lVKne.d.cts +0 -5
- package/dist/cjs/fitInt64Bits-CY7lVKne.d.cts.map +0 -1
- package/dist/cjs/interfaces/index.d.cts +0 -2
- package/dist/cjs/messagePackDecoderBuffer-CMG0LPbJ.d.cts +0 -12
- package/dist/cjs/messagePackDecoderBuffer-CMG0LPbJ.d.cts.map +0 -1
- package/dist/cjs/messagePackExtension-C_TQXlEn.d.cts.map +0 -1
- package/dist/cjs/messagePackTextDecoder-CtyB0N6j.d.cts +0 -7
- package/dist/cjs/messagePackTextDecoder-CtyB0N6j.d.cts.map +0 -1
- package/dist/cjs/messagePackTextEncoder-D7iCft_t.d.cts.map +0 -1
- package/dist/cjs/nodeTextEncoder-DJzFDBXd.d.cts.map +0 -1
- package/dist/cjs/timestampDate-BtBd4bAx.d.cts +0 -33
- package/dist/cjs/timestampDate-BtBd4bAx.d.cts.map +0 -1
- package/dist/cjs/types-BJie2edF.d.cts +0 -20
- package/dist/cjs/types-BJie2edF.d.cts.map +0 -1
- package/dist/cjs/types-DHnp4kMw.d.cts +0 -6
- package/dist/cjs/types-DHnp4kMw.d.cts.map +0 -1
- package/dist/cjs/untypedExtension-WQvArYoO.d.cts +0 -16
- package/dist/cjs/untypedExtension-WQvArYoO.d.cts.map +0 -1
- package/dist/cjs/untypedExtension.cjs +0 -13
- package/dist/cjs/untypedExtension.d.cts +0 -2
- package/dist/cjs/utils/fitInt64Bits.cjs +0 -6
- package/dist/cjs/utils/fitInt64Bits.d.cts +0 -2
- package/dist/cjs/utils/index.cjs +0 -11
- package/dist/cjs/utils/index.d.cts +0 -6
- package/dist/esm/benchmark/decoderDataTypesFactory.d.mts +0 -6
- package/dist/esm/benchmark/decoderDataTypesFactory.d.mts.map +0 -1
- package/dist/esm/benchmark/decoderDataTypesFactory.mjs +0 -39
- package/dist/esm/benchmark/decoderDataTypesFactory.mjs.map +0 -1
- package/dist/esm/bigInt-BvNVHUwj.d.mts +0 -35
- package/dist/esm/bigInt-BvNVHUwj.d.mts.map +0 -1
- package/dist/esm/bufferWithExtensions-Bikyeyt1.d.mts +0 -12
- package/dist/esm/bufferWithExtensions-Bikyeyt1.d.mts.map +0 -1
- package/dist/esm/decoder/decoderBuffer.d.mts +0 -2
- package/dist/esm/decoder/decoderBuffer.mjs +0 -241
- package/dist/esm/decoder/decoderBuffer.mjs.map +0 -1
- package/dist/esm/decoder/interfaces/messagePackDecoderBuffer.d.mts +0 -2
- package/dist/esm/decoder-DEzsJjYj.d.mts +0 -15
- package/dist/esm/decoder-DEzsJjYj.d.mts.map +0 -1
- package/dist/esm/decoderBuffer-BxJJdy5k.d.mts +0 -22
- package/dist/esm/decoderBuffer-BxJJdy5k.d.mts.map +0 -1
- package/dist/esm/defaultTextDecoder-B6a1HH2u.d.mts +0 -10
- package/dist/esm/defaultTextDecoder-B6a1HH2u.d.mts.map +0 -1
- package/dist/esm/encoder/encoderBuffer.d.mts +0 -2
- package/dist/esm/encoder/encoderBuffer.mjs +0 -604
- package/dist/esm/encoder/encoderBuffer.mjs.map +0 -1
- package/dist/esm/encoder/interfaces/messagePackEncoderBuffer.d.mts +0 -2
- package/dist/esm/encoder-CQfcjnAe.d.mts +0 -23
- package/dist/esm/encoder-CQfcjnAe.d.mts.map +0 -1
- package/dist/esm/encoderBuffer-DEy8CuWQ.d.mts.map +0 -1
- package/dist/esm/extensions/bigint/bigInt.d.mts +0 -2
- package/dist/esm/extensions/bigint/bigInt.mjs +0 -56
- package/dist/esm/extensions/bigint/bigInt.mjs.map +0 -1
- package/dist/esm/extensions/bigint/index.d.mts +0 -3
- package/dist/esm/extensions/bigint/index.mjs +0 -2
- package/dist/esm/extensions/interfaces/index.d.mts +0 -3
- package/dist/esm/fitIn16Bits-D9lga-sP.d.mts +0 -5
- package/dist/esm/fitIn16Bits-D9lga-sP.d.mts.map +0 -1
- package/dist/esm/fitIn32Bits-BrGIMOff.d.mts +0 -5
- package/dist/esm/fitIn32Bits-BrGIMOff.d.mts.map +0 -1
- package/dist/esm/fitIn7Bits-BVHyKXCg.d.mts +0 -5
- package/dist/esm/fitIn7Bits-BVHyKXCg.d.mts.map +0 -1
- package/dist/esm/fitIn8Bits-DQnQIhdh.d.mts +0 -5
- package/dist/esm/fitIn8Bits-DQnQIhdh.d.mts.map +0 -1
- package/dist/esm/fitInt64Bits-CY7lVKne.d.mts +0 -5
- package/dist/esm/fitInt64Bits-CY7lVKne.d.mts.map +0 -1
- package/dist/esm/interfaces/index.d.mts +0 -2
- package/dist/esm/messagePackDecoderBuffer-CGyYSweZ.d.mts +0 -12
- package/dist/esm/messagePackDecoderBuffer-CGyYSweZ.d.mts.map +0 -1
- package/dist/esm/messagePackExtension-5TI02KG6.d.mts.map +0 -1
- package/dist/esm/messagePackTextDecoder-CtyB0N6j.d.mts +0 -7
- package/dist/esm/messagePackTextDecoder-CtyB0N6j.d.mts.map +0 -1
- package/dist/esm/messagePackTextEncoder-D7iCft_t.d.mts.map +0 -1
- package/dist/esm/nodeTextEncoder-CegSnA6z.d.mts.map +0 -1
- package/dist/esm/timestampDate-C1UzHhZL.d.mts +0 -33
- package/dist/esm/timestampDate-C1UzHhZL.d.mts.map +0 -1
- package/dist/esm/types-BJie2edF.d.mts +0 -20
- package/dist/esm/types-BJie2edF.d.mts.map +0 -1
- package/dist/esm/types-DoBZbRkk.d.mts +0 -6
- package/dist/esm/types-DoBZbRkk.d.mts.map +0 -1
- package/dist/esm/untypedExtension-6bNMj-lY.d.mts +0 -16
- package/dist/esm/untypedExtension-6bNMj-lY.d.mts.map +0 -1
- package/dist/esm/untypedExtension.d.mts +0 -2
- package/dist/esm/untypedExtension.mjs +0 -15
- package/dist/esm/untypedExtension.mjs.map +0 -1
- package/dist/esm/utils/fitInt64Bits.d.mts +0 -2
- package/dist/esm/utils/fitInt64Bits.mjs +0 -8
- package/dist/esm/utils/fitInt64Bits.mjs.map +0 -1
- package/dist/esm/utils/index.d.mts +0 -6
- package/dist/esm/utils/index.mjs +0 -6
- /package/dist/cjs/decoder/interfaces/{messagePackDecoderBuffer.cjs → messagePackDecoder.cjs} +0 -0
- /package/dist/cjs/encoder/interfaces/{messagePackEncoderBuffer.cjs → messagePackEncoder.cjs} +0 -0
- /package/dist/cjs/extensions/{interfaces/index.cjs → error/types.cjs} +0 -0
- /package/dist/cjs/{interfaces/index.cjs → extensions/interfaces/messagePackBuiltInExtension.cjs} +0 -0
- /package/dist/esm/decoder/interfaces/{messagePackDecoderBuffer.mjs → messagePackDecoder.mjs} +0 -0
- /package/dist/esm/encoder/interfaces/{messagePackEncoderBuffer.mjs → messagePackEncoder.mjs} +0 -0
- /package/dist/esm/extensions/{interfaces/index.mjs → error/types.mjs} +0 -0
- /package/dist/esm/{interfaces/index.mjs → extensions/interfaces/messagePackBuiltInExtension.mjs} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.mjs","names":[],"sources":["../../../../src/extensions/error/error.ts"],"sourcesContent":["import type MessagePackDecoder from '../../decoder/interfaces/messagePackDecoder.ts';\nimport type MessagePackEncoder from '../../encoder/interfaces/messagePackEncoder.ts';\nimport type MessagePackBuiltInExtension from '../interfaces/messagePackBuiltInExtension.ts';\nimport SerializerExtension from '../serializer/serializer.ts';\nimport defaultFactories from './defaultFactories.ts';\nimport errorExtensionSymbols from './symbols.ts';\nimport type {\n ErrorExtensionFactory,\n ErrorExtensionFactoryInput,\n ErrorExtensionOptions,\n} from './types.ts';\n\nconst excludedKeys = new Set(['stack', 'message', 'name', 'cause']);\n\nclass ErrorExtension<TBuffer extends Uint8Array = Uint8Array>\n extends SerializerExtension<\n Error,\n ErrorExtensionFactoryInput,\n ErrorExtensionFactory,\n TBuffer\n >\n implements MessagePackBuiltInExtension<Error, TBuffer>\n{\n /**\n * The default type value for the error extension. This is used when no\n * specific type is provided during instantiation.\n */\n static readonly DEFAULT_TYPE = 1;\n\n type: number;\n\n constructor(options?: ErrorExtensionOptions) {\n super(defaultFactories());\n\n this.type = options?.type ?? ErrorExtension.DEFAULT_TYPE;\n\n if (options?.factories) {\n for (const [constructor, factory] of options.factories) {\n this.registerFactory(constructor, factory);\n }\n }\n }\n\n /**\n * Encodes an Error value into the provided buffer. The method is responsible\n * for serializing the Error object according to the Message Pack extension\n * format.\n *\n * @param value - The Error value to encode.\n * @param encoder - The extension encoder to write the encoded data to.\n */\n encodeInto(value: Error, encoder: MessagePackEncoder<TBuffer>): void {\n const stack = value.stack;\n const message = value.message;\n const cause = value.cause;\n const constructorName = value.constructor.name;\n let name: string | undefined;\n\n if (Object.hasOwn(value, 'name')) {\n name = value.name;\n }\n\n const extensionEncoder = encoder.getExtensionEncoder().resetBuffer();\n\n if (stack !== undefined) {\n const capacity = 1 + stack.length * 4;\n extensionEncoder.ensureCapacity(capacity);\n extensionEncoder.buffer[extensionEncoder.offset++] =\n errorExtensionSymbols.STACK;\n extensionEncoder.writeString(stack);\n }\n\n if (message.length > 0) {\n const capacity = 1 + message.length * 4;\n\n extensionEncoder.ensureCapacity(capacity);\n extensionEncoder.buffer[extensionEncoder.offset++] =\n errorExtensionSymbols.MESSAGE;\n extensionEncoder.writeString(message);\n }\n\n if (name !== undefined) {\n const capacity = 1 + name.length * 4;\n\n extensionEncoder.ensureCapacity(capacity);\n extensionEncoder.buffer[extensionEncoder.offset++] =\n errorExtensionSymbols.NAME;\n extensionEncoder.writeString(name);\n }\n\n if (cause !== undefined) {\n extensionEncoder.ensureCapacity(1);\n extensionEncoder.buffer[extensionEncoder.offset++] =\n errorExtensionSymbols.CAUSE;\n extensionEncoder.write(cause);\n }\n\n if (Object.hasOwn(value, 'errors') && value instanceof AggregateError) {\n extensionEncoder.ensureCapacity(1);\n extensionEncoder.buffer[extensionEncoder.offset++] =\n errorExtensionSymbols.ERRORS;\n extensionEncoder.writeArray(value.errors);\n }\n\n const keys = Object.keys(value).filter((key) => !excludedKeys.has(key));\n\n if (keys.length > 0) {\n extensionEncoder.ensureCapacity(1);\n extensionEncoder.buffer[extensionEncoder.offset++] =\n errorExtensionSymbols.PROPERTIES;\n extensionEncoder.openMap(keys.length);\n\n for (const key of keys) {\n extensionEncoder.writeString(key);\n // @ts-expect-error - We are iterating over the keys of the object, so we can safely access the value using the key.\n extensionEncoder.write(value[key]);\n }\n }\n\n extensionEncoder.ensureCapacity(1 + constructorName.length * 4);\n extensionEncoder.buffer[extensionEncoder.offset++] =\n errorExtensionSymbols.CONSTRUCTOR_NAME;\n extensionEncoder.writeString(constructorName);\n\n encoder.writeExtension(this, extensionEncoder);\n }\n\n /**\n * Decodes an Error value from the provided DataView. It reads the encoded\n * data and reconstructs the Error object according to the Message Pack\n * extension format. The method returns the decoded Error value.\n */\n decode(decoder: MessagePackDecoder<TBuffer>, size: number): Error {\n let stack: string | undefined;\n let message = '';\n let name: string | undefined;\n let cause: unknown;\n let constructorName: string | undefined;\n let errors: Error[] = [];\n let properties: Record<string, unknown> = {};\n\n const limit = size + decoder.offset;\n\n while (decoder.offset < limit) {\n const errorExtensionSymbol = decoder.buffer[decoder.offset++];\n\n switch (errorExtensionSymbol) {\n case errorExtensionSymbols.STACK: {\n stack = decoder.nextValue<string>();\n\n break;\n }\n case errorExtensionSymbols.MESSAGE: {\n message = decoder.nextValue<string>();\n\n break;\n }\n case errorExtensionSymbols.NAME: {\n name = decoder.nextValue<string>();\n\n break;\n }\n case errorExtensionSymbols.CAUSE: {\n cause = decoder.nextValue();\n\n break;\n }\n case errorExtensionSymbols.CONSTRUCTOR_NAME: {\n constructorName = decoder.nextValue<string>();\n\n break;\n }\n case errorExtensionSymbols.ERRORS: {\n errors = decoder.nextValue<Error[]>();\n\n break;\n }\n case errorExtensionSymbols.PROPERTIES: {\n properties = decoder.nextValue<Record<string, unknown>>();\n\n break;\n }\n default: {\n throw new Error(\n `unknown error extension symbol: ${errorExtensionSymbol} at offset ${decoder.offset - 1}`,\n );\n }\n }\n }\n\n if (constructorName === undefined) {\n throw new Error('Failed to get constructor name from error extension');\n }\n\n let options: ErrorOptions | undefined;\n\n if (cause !== undefined) {\n options = {\n cause,\n };\n }\n\n const input: ErrorExtensionFactoryInput = {\n errors,\n message,\n options,\n properties,\n };\n\n const factory = this.fetchFactoryByConstructorName(constructorName);\n\n const error = factory(input);\n\n if (stack !== undefined) {\n error.stack = stack;\n }\n\n if (name !== undefined) {\n error.name = name;\n }\n\n return error;\n }\n}\n\nexport default ErrorExtension;\n"],"mappings":";;;;AAYA,MAAM,+BAAe,IAAI,IAAI;CAAC;CAAS;CAAW;CAAQ;AAAO,CAAC;AAElE,IAAM,iBAAN,MAAM,uBACI,oBAOV;;;;;CAKE,OAAgB,eAAe;CAE/B;CAEA,YAAY,SAAiC;EAC3C,MAAM,iBAAiB,CAAC;EAExB,KAAK,OAAO,SAAS,QAAQ,eAAe;EAE5C,IAAI,SAAS,WACX,KAAK,MAAM,CAAC,aAAa,YAAY,QAAQ,WAC3C,KAAK,gBAAgB,aAAa,OAAO;CAG/C;;;;;;;;;CAUA,WAAW,OAAc,SAA4C;EACnE,MAAM,QAAQ,MAAM;EACpB,MAAM,UAAU,MAAM;EACtB,MAAM,QAAQ,MAAM;EACpB,MAAM,kBAAkB,MAAM,YAAY;EAC1C,IAAI;EAEJ,IAAI,OAAO,OAAO,OAAO,MAAM,GAC7B,OAAO,MAAM;EAGf,MAAM,mBAAmB,QAAQ,oBAAoB,CAAC,CAAC,YAAY;EAEnE,IAAI,UAAU,KAAA,GAAW;GACvB,MAAM,WAAW,IAAI,MAAM,SAAS;GACpC,iBAAiB,eAAe,QAAQ;GACxC,iBAAiB,OAAO,iBAAiB,YACvC,sBAAsB;GACxB,iBAAiB,YAAY,KAAK;EACpC;EAEA,IAAI,QAAQ,SAAS,GAAG;GACtB,MAAM,WAAW,IAAI,QAAQ,SAAS;GAEtC,iBAAiB,eAAe,QAAQ;GACxC,iBAAiB,OAAO,iBAAiB,YACvC,sBAAsB;GACxB,iBAAiB,YAAY,OAAO;EACtC;EAEA,IAAI,SAAS,KAAA,GAAW;GACtB,MAAM,WAAW,IAAI,KAAK,SAAS;GAEnC,iBAAiB,eAAe,QAAQ;GACxC,iBAAiB,OAAO,iBAAiB,YACvC,sBAAsB;GACxB,iBAAiB,YAAY,IAAI;EACnC;EAEA,IAAI,UAAU,KAAA,GAAW;GACvB,iBAAiB,eAAe,CAAC;GACjC,iBAAiB,OAAO,iBAAiB,YACvC,sBAAsB;GACxB,iBAAiB,MAAM,KAAK;EAC9B;EAEA,IAAI,OAAO,OAAO,OAAO,QAAQ,KAAK,iBAAiB,gBAAgB;GACrE,iBAAiB,eAAe,CAAC;GACjC,iBAAiB,OAAO,iBAAiB,YACvC,sBAAsB;GACxB,iBAAiB,WAAW,MAAM,MAAM;EAC1C;EAEA,MAAM,OAAO,OAAO,KAAK,KAAK,CAAC,CAAC,QAAQ,QAAQ,CAAC,aAAa,IAAI,GAAG,CAAC;EAEtE,IAAI,KAAK,SAAS,GAAG;GACnB,iBAAiB,eAAe,CAAC;GACjC,iBAAiB,OAAO,iBAAiB,YACvC,sBAAsB;GACxB,iBAAiB,QAAQ,KAAK,MAAM;GAEpC,KAAK,MAAM,OAAO,MAAM;IACtB,iBAAiB,YAAY,GAAG;IAEhC,iBAAiB,MAAM,MAAM,IAAI;GACnC;EACF;EAEA,iBAAiB,eAAe,IAAI,gBAAgB,SAAS,CAAC;EAC9D,iBAAiB,OAAO,iBAAiB,YACvC,sBAAsB;EACxB,iBAAiB,YAAY,eAAe;EAE5C,QAAQ,eAAe,MAAM,gBAAgB;CAC/C;;;;;;CAOA,OAAO,SAAsC,MAAqB;EAChE,IAAI;EACJ,IAAI,UAAU;EACd,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI,SAAkB,CAAC;EACvB,IAAI,aAAsC,CAAC;EAE3C,MAAM,QAAQ,OAAO,QAAQ;EAE7B,OAAO,QAAQ,SAAS,OAAO;GAC7B,MAAM,uBAAuB,QAAQ,OAAO,QAAQ;GAEpD,QAAQ,sBAAR;IACE,KAAK,sBAAsB;KACzB,QAAQ,QAAQ,UAAkB;KAElC;IAEF,KAAK,sBAAsB;KACzB,UAAU,QAAQ,UAAkB;KAEpC;IAEF,KAAK,sBAAsB;KACzB,OAAO,QAAQ,UAAkB;KAEjC;IAEF,KAAK,sBAAsB;KACzB,QAAQ,QAAQ,UAAU;KAE1B;IAEF,KAAK,sBAAsB;KACzB,kBAAkB,QAAQ,UAAkB;KAE5C;IAEF,KAAK,sBAAsB;KACzB,SAAS,QAAQ,UAAmB;KAEpC;IAEF,KAAK,sBAAsB;KACzB,aAAa,QAAQ,UAAmC;KAExD;IAEF,SACE,MAAM,IAAI,MACR,mCAAmC,qBAAqB,aAAa,QAAQ,SAAS,GACxF;GAEJ;EACF;EAEA,IAAI,oBAAoB,KAAA,GACtB,MAAM,IAAI,MAAM,qDAAqD;EAGvE,IAAI;EAEJ,IAAI,UAAU,KAAA,GACZ,UAAU,EACR,MACF;EAGF,MAAM,QAAoC;GACxC;GACA;GACA;GACA;EACF;EAIA,MAAM,QAFU,KAAK,8BAA8B,eAE/B,CAAC,CAAC,KAAK;EAE3B,IAAI,UAAU,KAAA,GACZ,MAAM,QAAQ;EAGhB,IAAI,SAAS,KAAA,GACX,MAAM,OAAO;EAGf,OAAO;CACT;AACF"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { t as ErrorExtension } from "../../error-BtKEZf6W.mjs";
|
|
2
|
+
import { n as ErrorExtensionFactoryInput, r as ErrorExtensionOptions, t as ErrorExtensionFactory } from "../../types-LHP7oHpt.mjs";
|
|
3
|
+
import "../../index-5OuLsWCC.mjs";
|
|
4
|
+
export { ErrorExtension, type ErrorExtensionFactory, type ErrorExtensionFactoryInput, type ErrorExtensionOptions };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/extensions/error/symbols.d.ts
|
|
2
|
+
declare const errorExtensionSymbols: {
|
|
3
|
+
/** Symbol for the stack property of an error object. */
|
|
4
|
+
STACK: number;
|
|
5
|
+
/** Symbol for the message property of an error object. */
|
|
6
|
+
MESSAGE: number;
|
|
7
|
+
/** Symbol for the name property of an error object. */
|
|
8
|
+
NAME: number;
|
|
9
|
+
/** Symbol for the cause property of an error object. */
|
|
10
|
+
CAUSE: number;
|
|
11
|
+
/** Symbol for the constructor name property of an error object. */
|
|
12
|
+
CONSTRUCTOR_NAME: number;
|
|
13
|
+
/** Symbol for the errors property of an error object. */
|
|
14
|
+
ERRORS: number;
|
|
15
|
+
/** Symbol for the custom properties of an error object. */
|
|
16
|
+
PROPERTIES: number;
|
|
17
|
+
};
|
|
18
|
+
//#endregion
|
|
19
|
+
export { errorExtensionSymbols as default };
|
|
20
|
+
//# sourceMappingURL=symbols.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"symbols.d.mts","names":[],"sources":["../../../../src/extensions/error/symbols.ts"],"mappings":";cACM;;EAEJ;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/extensions/error/symbols.ts
|
|
2
|
+
const errorExtensionSymbols = {
|
|
3
|
+
/** Symbol for the stack property of an error object. */
|
|
4
|
+
STACK: 1,
|
|
5
|
+
/** Symbol for the message property of an error object. */
|
|
6
|
+
MESSAGE: 2,
|
|
7
|
+
/** Symbol for the name property of an error object. */
|
|
8
|
+
NAME: 3,
|
|
9
|
+
/** Symbol for the cause property of an error object. */
|
|
10
|
+
CAUSE: 4,
|
|
11
|
+
/** Symbol for the constructor name property of an error object. */
|
|
12
|
+
CONSTRUCTOR_NAME: 5,
|
|
13
|
+
/** Symbol for the errors property of an error object. */
|
|
14
|
+
ERRORS: 6,
|
|
15
|
+
/** Symbol for the custom properties of an error object. */
|
|
16
|
+
PROPERTIES: 7
|
|
17
|
+
};
|
|
18
|
+
//#endregion
|
|
19
|
+
export { errorExtensionSymbols as default };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=symbols.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"symbols.mjs","names":[],"sources":["../../../../src/extensions/error/symbols.ts"],"sourcesContent":["// oxlint-disable-next-line sort-keys\nconst errorExtensionSymbols = {\n /** Symbol for the stack property of an error object. */\n STACK: 1,\n /** Symbol for the message property of an error object. */\n MESSAGE: 2,\n /** Symbol for the name property of an error object. */\n NAME: 3,\n /** Symbol for the cause property of an error object. */\n CAUSE: 4,\n /** Symbol for the constructor name property of an error object. */\n CONSTRUCTOR_NAME: 5,\n /** Symbol for the errors property of an error object. */\n ERRORS: 6,\n /** Symbol for the custom properties of an error object. */\n PROPERTIES: 7,\n};\n\nexport default errorExtensionSymbols;\n"],"mappings":";AACA,MAAM,wBAAwB;;CAE5B,OAAO;;CAEP,SAAS;;CAET,MAAM;;CAEN,OAAO;;CAEP,kBAAkB;;CAElB,QAAQ;;CAER,YAAY;AACd"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { t as
|
|
1
|
+
import { t as Constructor } from "../types-BcIA43h9.mjs";
|
|
2
|
+
import { d as TimestampDateExtension, i as MessagePackExtension, t as ErrorExtension } from "../error-BtKEZf6W.mjs";
|
|
3
|
+
import { n as SerializerExtensionFactory, t as SerializerExtensionFactories } from "../types-xD3JER2f.mjs";
|
|
4
|
+
import { n as ErrorExtensionFactoryInput, r as ErrorExtensionOptions, t as ErrorExtensionFactory } from "../types-LHP7oHpt.mjs";
|
|
2
5
|
import { t as MessagePackTime } from "../types-B9KMW-kD.mjs";
|
|
3
|
-
import { t as
|
|
4
|
-
export { type MessagePackExtension, type MessagePackTime, TimestampDateExtension };
|
|
6
|
+
import { t as SerializerExtension } from "../serializer-Bu3RyF09.mjs";
|
|
7
|
+
export { type Constructor, ErrorExtension, type ErrorExtensionFactory, type ErrorExtensionFactoryInput, type ErrorExtensionOptions, type MessagePackExtension, type MessagePackTime, SerializerExtension, type SerializerExtensionFactories, type SerializerExtensionFactory, TimestampDateExtension };
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
import SerializerExtension from "./serializer/serializer.mjs";
|
|
2
|
+
import ErrorExtension from "./error/error.mjs";
|
|
1
3
|
import TimestampDateExtension from "./timestampDate/timestampDate.mjs";
|
|
2
|
-
export { TimestampDateExtension };
|
|
4
|
+
export { ErrorExtension, SerializerExtension, TimestampDateExtension };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as MessagePackExtension } from "../../error-BtKEZf6W.mjs";
|
|
2
2
|
export { MessagePackExtension as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { n as SerializerExtensionFactory, t as SerializerExtensionFactories } from "../../types-xD3JER2f.mjs";
|
|
2
|
+
import { t as SerializerExtension } from "../../serializer-Bu3RyF09.mjs";
|
|
3
|
+
import "../../index-B5vbV8Ak.mjs";
|
|
4
|
+
export { SerializerExtension, type SerializerExtensionFactories, type SerializerExtensionFactory };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//#region src/extensions/serializer/serializer.ts
|
|
2
|
+
var SerializerExtension = class {
|
|
3
|
+
constructors = [];
|
|
4
|
+
factories = /* @__PURE__ */ new Map();
|
|
5
|
+
factoriesByConstructorName = /* @__PURE__ */ new Map();
|
|
6
|
+
constructor(factories) {
|
|
7
|
+
for (const [constructor, factory] of factories) this.registerFactory(constructor, factory);
|
|
8
|
+
}
|
|
9
|
+
registerFactory(construct, factory) {
|
|
10
|
+
if (this.factories.has(construct) || this.factoriesByConstructorName.has(construct.name)) throw new Error(`Factory already registered for constructor: "${construct.name}"`);
|
|
11
|
+
this.factories.set(construct, factory);
|
|
12
|
+
this.constructors.push(construct);
|
|
13
|
+
this.factoriesByConstructorName.set(construct.name, factory);
|
|
14
|
+
}
|
|
15
|
+
fetchFactoryByConstructor(constructor) {
|
|
16
|
+
const factory = this.factories.get(constructor);
|
|
17
|
+
if (!factory) throw new Error(`No factory registered for constructor: "${constructor.name}"`);
|
|
18
|
+
return factory;
|
|
19
|
+
}
|
|
20
|
+
fetchFactoryByConstructorName(constructorName) {
|
|
21
|
+
const factory = this.factoriesByConstructorName.get(constructorName);
|
|
22
|
+
if (!factory) throw new Error(`No factory registered for constructor name: "${constructorName}"`);
|
|
23
|
+
return factory;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
//#endregion
|
|
27
|
+
export { SerializerExtension as default };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=serializer.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializer.mjs","names":[],"sources":["../../../../src/extensions/serializer/serializer.ts"],"sourcesContent":["import type MessagePackDecoder from '../../decoder/interfaces/messagePackDecoder.ts';\nimport type MessagePackExtensionBase from '../interfaces/messagePackExtensionBase.ts';\nimport type { Constructor } from '../interfaces/types.ts';\nimport type {\n SerializerExtensionFactories,\n SerializerExtensionFactory,\n} from './types.ts';\n\nabstract class SerializerExtension<\n TValue extends object,\n TInput,\n TFactory extends SerializerExtensionFactory<TValue, TInput>,\n TBuffer extends Uint8Array = Uint8Array,\n> implements MessagePackExtensionBase<TValue, TBuffer> {\n abstract readonly type: number;\n readonly constructors: Constructor<TValue>[] = [];\n\n readonly factories = new Map<Constructor<TValue>, TFactory>();\n\n protected readonly factoriesByConstructorName = new Map<string, TFactory>();\n\n constructor(\n factories: SerializerExtensionFactories<TValue, TInput, TFactory>,\n ) {\n for (const [constructor, factory] of factories) {\n this.registerFactory(constructor, factory);\n }\n }\n\n protected registerFactory(\n construct: Constructor<TValue>,\n factory: TFactory,\n ): void {\n if (\n this.factories.has(construct) ||\n this.factoriesByConstructorName.has(construct.name)\n ) {\n throw new Error(\n `Factory already registered for constructor: \"${construct.name}\"`,\n );\n }\n\n this.factories.set(construct, factory);\n this.constructors.push(construct);\n this.factoriesByConstructorName.set(construct.name, factory);\n }\n\n fetchFactoryByConstructor(constructor: Constructor<TValue>): TFactory {\n const factory = this.factories.get(constructor);\n\n if (!factory) {\n throw new Error(\n `No factory registered for constructor: \"${constructor.name}\"`,\n );\n }\n\n return factory;\n }\n\n fetchFactoryByConstructorName(constructorName: string): TFactory {\n const factory = this.factoriesByConstructorName.get(constructorName);\n\n if (!factory) {\n throw new Error(\n `No factory registered for constructor name: \"${constructorName}\"`,\n );\n }\n\n return factory;\n }\n\n abstract decode(decoder: MessagePackDecoder<TBuffer>, size: number): TValue;\n}\n\nexport default SerializerExtension;\n"],"mappings":";AAQA,IAAe,sBAAf,MAKuD;CAErD,eAA+C,CAAC;CAEhD,4BAAqB,IAAI,IAAmC;CAE5D,6CAAgD,IAAI,IAAsB;CAE1E,YACE,WACA;EACA,KAAK,MAAM,CAAC,aAAa,YAAY,WACnC,KAAK,gBAAgB,aAAa,OAAO;CAE7C;CAEA,gBACE,WACA,SACM;EACN,IACE,KAAK,UAAU,IAAI,SAAS,KAC5B,KAAK,2BAA2B,IAAI,UAAU,IAAI,GAElD,MAAM,IAAI,MACR,gDAAgD,UAAU,KAAK,EACjE;EAGF,KAAK,UAAU,IAAI,WAAW,OAAO;EACrC,KAAK,aAAa,KAAK,SAAS;EAChC,KAAK,2BAA2B,IAAI,UAAU,MAAM,OAAO;CAC7D;CAEA,0BAA0B,aAA4C;EACpE,MAAM,UAAU,KAAK,UAAU,IAAI,WAAW;EAE9C,IAAI,CAAC,SACH,MAAM,IAAI,MACR,2CAA2C,YAAY,KAAK,EAC9D;EAGF,OAAO;CACT;CAEA,8BAA8B,iBAAmC;EAC/D,MAAM,UAAU,KAAK,2BAA2B,IAAI,eAAe;EAEnE,IAAI,CAAC,SACH,MAAM,IAAI,MACR,gDAAgD,gBAAgB,EAClE;EAGF,OAAO;CACT;AAGF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
+
import { d as TimestampDateExtension } from "../../error-BtKEZf6W.mjs";
|
|
1
2
|
import { t as MessagePackTime } from "../../types-B9KMW-kD.mjs";
|
|
2
|
-
import
|
|
3
|
-
import "../../index-5OuLsWCC.mjs";
|
|
3
|
+
import "../../index-CUX405iZ.mjs";
|
|
4
4
|
export { type MessagePackTime, TimestampDateExtension };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as TimestampDateExtension } from "../../error-BtKEZf6W.mjs";
|
|
2
2
|
export { TimestampDateExtension as default };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import Symbols from "../../symbols.mjs";
|
|
1
2
|
//#region src/extensions/timestampDate/timestampDate.ts
|
|
2
3
|
const TIMESTAMP32_MAX_SEC = 4294967295;
|
|
3
4
|
const TIMESTAMP64_MAX_SEC = 17179869183;
|
|
@@ -21,8 +22,10 @@ const TIMESTAMP64_MAX_SEC = 17179869183;
|
|
|
21
22
|
* @see https://github.com/msgpack/msgpack-javascript/blob/main/src/timestamp.ts
|
|
22
23
|
* @see https://github.com/msgpack/msgpack-javascript/issues/216
|
|
23
24
|
*/
|
|
24
|
-
var TimestampDateExtension = class {
|
|
25
|
-
|
|
25
|
+
var TimestampDateExtension = class TimestampDateExtension {
|
|
26
|
+
static DEFAULT_TYPE = -1;
|
|
27
|
+
type = TimestampDateExtension.DEFAULT_TYPE;
|
|
28
|
+
constructors = [Date];
|
|
26
29
|
parseToMessagePackTime(date) {
|
|
27
30
|
const msec = date.getTime();
|
|
28
31
|
const sec = Math.floor(msec / 1e3);
|
|
@@ -33,45 +36,59 @@ var TimestampDateExtension = class {
|
|
|
33
36
|
sec: sec + nsecInSec
|
|
34
37
|
};
|
|
35
38
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if (time.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
buffer.writeUint32(time.nsec << 2 | secHigh & 3);
|
|
45
|
-
buffer.writeUint32(secLow);
|
|
46
|
-
}
|
|
39
|
+
encodeInto(value, encoder) {
|
|
40
|
+
const time = this.parseToMessagePackTime(value);
|
|
41
|
+
if (time.sec >= 0 && time.nsec >= 0 && time.sec <= TIMESTAMP64_MAX_SEC) {
|
|
42
|
+
if (time.nsec === 0 && time.sec <= TIMESTAMP32_MAX_SEC) {
|
|
43
|
+
encoder.ensureCapacity(6);
|
|
44
|
+
encoder.buffer[encoder.offset++] = Symbols.FIXEXT4;
|
|
45
|
+
encoder.buffer[encoder.offset++] = this.type;
|
|
46
|
+
encoder.writeUint32(time.sec);
|
|
47
47
|
} else {
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
const secHigh = time.sec / 4294967296;
|
|
49
|
+
const secLow = time.sec & 4294967295;
|
|
50
|
+
encoder.ensureCapacity(10);
|
|
51
|
+
encoder.buffer[encoder.offset++] = Symbols.FIXEXT8;
|
|
52
|
+
encoder.buffer[encoder.offset++] = this.type;
|
|
53
|
+
encoder.writeUint32(time.nsec << 2 | secHigh & 3);
|
|
54
|
+
encoder.writeUint32(secLow);
|
|
50
55
|
}
|
|
56
|
+
} else {
|
|
57
|
+
encoder.ensureCapacity(15);
|
|
58
|
+
encoder.buffer[encoder.offset++] = Symbols.EXT8;
|
|
59
|
+
encoder.buffer[encoder.offset++] = 12;
|
|
60
|
+
encoder.buffer[encoder.offset++] = this.type;
|
|
61
|
+
encoder.writeUint32(time.nsec);
|
|
62
|
+
encoder.writeInt64(time.sec);
|
|
51
63
|
}
|
|
52
64
|
}
|
|
53
|
-
decode(
|
|
54
|
-
const byteOffset = decoderBuffer.offset;
|
|
65
|
+
decode(decoder, size) {
|
|
55
66
|
switch (size) {
|
|
56
67
|
case 4: {
|
|
57
|
-
const sec =
|
|
68
|
+
const sec = decoder.view.getUint32(decoder.offset);
|
|
69
|
+
decoder.offset += 4;
|
|
58
70
|
return /* @__PURE__ */ new Date(sec * 1e3 + 0);
|
|
59
71
|
}
|
|
60
72
|
case 8: {
|
|
61
|
-
const nsec30AndSecHigh2 =
|
|
62
|
-
|
|
73
|
+
const nsec30AndSecHigh2 = decoder.view.getUint32(decoder.offset);
|
|
74
|
+
decoder.offset += 4;
|
|
75
|
+
const secLow32 = decoder.view.getUint32(decoder.offset);
|
|
76
|
+
decoder.offset += 4;
|
|
63
77
|
const sec = (nsec30AndSecHigh2 & 3) * 4294967296 + secLow32;
|
|
64
78
|
const nsec = nsec30AndSecHigh2 >>> 2;
|
|
65
79
|
return /* @__PURE__ */ new Date(sec * 1e3 + nsec / 1e6);
|
|
66
80
|
}
|
|
67
81
|
case 12: {
|
|
68
|
-
const
|
|
69
|
-
|
|
82
|
+
const nsec = decoder.view.getUint32(decoder.offset);
|
|
83
|
+
decoder.offset += 4;
|
|
84
|
+
const high = decoder.view.getInt32(decoder.offset);
|
|
85
|
+
decoder.offset += 4;
|
|
86
|
+
const low = decoder.view.getUint32(decoder.offset);
|
|
87
|
+
decoder.offset += 4;
|
|
70
88
|
const sec = high * 4294967296 + low;
|
|
71
|
-
const nsec = decoderBuffer.view.getUint32(byteOffset);
|
|
72
89
|
return /* @__PURE__ */ new Date(sec * 1e3 + nsec / 1e6);
|
|
73
90
|
}
|
|
74
|
-
default: throw new Error(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${
|
|
91
|
+
default: throw new Error(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${decoder.view.byteLength}`);
|
|
75
92
|
}
|
|
76
93
|
}
|
|
77
94
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timestampDate.mjs","names":[],"sources":["../../../../src/extensions/timestampDate/timestampDate.ts"],"sourcesContent":["import type
|
|
1
|
+
{"version":3,"file":"timestampDate.mjs","names":[],"sources":["../../../../src/extensions/timestampDate/timestampDate.ts"],"sourcesContent":["import type MessagePackDecoder from '../../decoder/interfaces/messagePackDecoder.ts';\nimport type MessagePackEncoder from '../../encoder/interfaces/messagePackEncoder.ts';\nimport Symbols from '../../symbols.ts';\nimport type MessagePackBuiltInExtension from '../interfaces/messagePackBuiltInExtension.ts';\nimport type { Constructor } from '../interfaces/types.ts';\nimport type { MessagePackTime } from './types.ts';\n\nconst TIMESTAMP32_MAX_SEC = 0x1_00_00_00_00 - 1; // 32-bit unsigned int // 4_294_967_295\nconst TIMESTAMP64_MAX_SEC = 0x4_00_00_00_00 - 1; // 34-bit unsigned int // 17_179_869_183\n\n/**\n * The `TimestampDateExtension` class is responsible for encoding JavaScript\n * `Date` objects into the MessagePack timestamp format.\n *\n * Timestamp extension type is assigned to extension type -1. It defines 3\n * formats: 32-bit format, 64-bit format, and 96-bit format.\n *\n * - Timestamp 32 format can represent a timestamp in [1970-01-01 00:00:00 UTC,\n * 2106-02-07 06:28:16 UTC) range. Nanoseconds part is 0.\n * - Timestamp 64 format can represent a timestamp in [1970-01-01\n * 00:00:00.000000000 UTC, 2514-05-30 01:53:04.000000000 UTC) range.\n * - Timestamp 96 format can represent a timestamp in [-292277022657-01-27\n * 08:29:52 UTC, 292277026596-12-04 15:30:08.000000000 UTC) range.\n * - In timestamp 64 and timestamp 96 formats, nanoseconds must not be larger than\n * 999999999.\n *\n * @see https://github.com/msgpack/msgpack/blob/master/spec.md#timestamp-extension-type\n * @see https://github.com/msgpack/msgpack-javascript/blob/main/src/timestamp.ts\n * @see https://github.com/msgpack/msgpack-javascript/issues/216\n */\nclass TimestampDateExtension<\n TBuffer extends Uint8Array = Uint8Array,\n> implements MessagePackBuiltInExtension<Date, TBuffer> {\n static readonly DEFAULT_TYPE = -1;\n\n readonly type = TimestampDateExtension.DEFAULT_TYPE;\n readonly constructors: Constructor<Date>[] = [Date];\n\n parseToMessagePackTime(date: Date): MessagePackTime {\n const msec = date.getTime();\n const sec = Math.floor(msec / 1e3);\n const nsec = (msec - sec * 1e3) * 1e6;\n\n // Normalizes { sec, nsec } to ensure nsec is unsigned.\n const nsecInSec = Math.floor(nsec / 1e9);\n\n return {\n nsec: nsec - nsecInSec * 1e9,\n sec: sec + nsecInSec,\n };\n }\n\n encodeInto(value: Date, encoder: MessagePackEncoder<TBuffer>): void {\n const time = this.parseToMessagePackTime(value);\n\n if (time.sec >= 0 && time.nsec >= 0 && time.sec <= TIMESTAMP64_MAX_SEC) {\n // Here sec >= 0 && nsec >= 0\n if (time.nsec === 0 && time.sec <= TIMESTAMP32_MAX_SEC) {\n encoder.ensureCapacity(6);\n\n encoder.buffer[encoder.offset++] = Symbols.FIXEXT4;\n encoder.buffer[encoder.offset++] = this.type;\n\n encoder.writeUint32(time.sec);\n } else {\n // timestamp 64 = { nsec30 (unsigned), sec34 (unsigned) }\n const secHigh = time.sec / 0x1_00_00_00_00;\n const secLow = time.sec & 0xff_ff_ff_ff;\n\n encoder.ensureCapacity(10);\n\n encoder.buffer[encoder.offset++] = Symbols.FIXEXT8;\n encoder.buffer[encoder.offset++] = this.type;\n\n encoder.writeUint32((time.nsec << 2) | (secHigh & 0x3));\n encoder.writeUint32(secLow);\n }\n } else {\n encoder.ensureCapacity(15);\n\n encoder.buffer[encoder.offset++] = Symbols.EXT8;\n encoder.buffer[encoder.offset++] = 12;\n encoder.buffer[encoder.offset++] = this.type;\n\n encoder.writeUint32(time.nsec);\n encoder.writeInt64(time.sec);\n }\n }\n\n decode(decoder: MessagePackDecoder<TBuffer>, size: number): Date {\n switch (size) {\n case 4: {\n // timestamp 32 = { sec32 }\n const sec = decoder.view.getUint32(decoder.offset);\n decoder.offset += 4;\n const nsec = 0;\n // return { sec, nsec };\n return new Date(sec * 1e3 + nsec / 1e6);\n }\n case 8: {\n // timestamp 64 = { nsec30, sec34 }\n const nsec30AndSecHigh2 = decoder.view.getUint32(decoder.offset);\n decoder.offset += 4;\n const secLow32 = decoder.view.getUint32(decoder.offset);\n decoder.offset += 4;\n const sec = (nsec30AndSecHigh2 & 0x3) * 0x1_00_00_00_00 + secLow32;\n const nsec = nsec30AndSecHigh2 >>> 2;\n return new Date(sec * 1e3 + nsec / 1e6);\n }\n case 12: {\n // timestamp 96 = { nsec32 (unsigned), sec64 (signed) }\n const nsec = decoder.view.getUint32(decoder.offset);\n decoder.offset += 4;\n\n const high = decoder.view.getInt32(decoder.offset);\n decoder.offset += 4;\n\n const low = decoder.view.getUint32(decoder.offset);\n decoder.offset += 4;\n\n // const sec = getInt64(view, 4);\n const sec = high * 0x1_00_00_00_00 + low;\n return new Date(sec * 1e3 + nsec / 1e6);\n }\n default: {\n throw new Error(\n `Unrecognized data size for timestamp (expected 4, 8, or 12): ${decoder.view.byteLength}`,\n );\n }\n }\n }\n}\n\nexport default TimestampDateExtension;\n"],"mappings":";;AAOA,MAAM,sBAAsB;AAC5B,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;AAsB5B,IAAM,yBAAN,MAAM,uBAEkD;CACtD,OAAgB,eAAe;CAE/B,OAAgB,uBAAuB;CACvC,eAA6C,CAAC,IAAI;CAElD,uBAAuB,MAA6B;EAClD,MAAM,OAAO,KAAK,QAAQ;EAC1B,MAAM,MAAM,KAAK,MAAM,OAAO,GAAG;EACjC,MAAM,QAAQ,OAAO,MAAM,OAAO;EAGlC,MAAM,YAAY,KAAK,MAAM,OAAO,GAAG;EAEvC,OAAO;GACL,MAAM,OAAO,YAAY;GACzB,KAAK,MAAM;EACb;CACF;CAEA,WAAW,OAAa,SAA4C;EAClE,MAAM,OAAO,KAAK,uBAAuB,KAAK;EAE9C,IAAI,KAAK,OAAO,KAAK,KAAK,QAAQ,KAAK,KAAK,OAAO,qBAAqB;GAEtE,IAAI,KAAK,SAAS,KAAK,KAAK,OAAO,qBAAqB;IACtD,QAAQ,eAAe,CAAC;IAExB,QAAQ,OAAO,QAAQ,YAAY,QAAQ;IAC3C,QAAQ,OAAO,QAAQ,YAAY,KAAK;IAExC,QAAQ,YAAY,KAAK,GAAG;GAC9B,OAAO;IAEL,MAAM,UAAU,KAAK,MAAM;IAC3B,MAAM,SAAS,KAAK,MAAM;IAE1B,QAAQ,eAAe,EAAE;IAEzB,QAAQ,OAAO,QAAQ,YAAY,QAAQ;IAC3C,QAAQ,OAAO,QAAQ,YAAY,KAAK;IAExC,QAAQ,YAAa,KAAK,QAAQ,IAAM,UAAU,CAAI;IACtD,QAAQ,YAAY,MAAM;GAC5B;EACF,OAAO;GACL,QAAQ,eAAe,EAAE;GAEzB,QAAQ,OAAO,QAAQ,YAAY,QAAQ;GAC3C,QAAQ,OAAO,QAAQ,YAAY;GACnC,QAAQ,OAAO,QAAQ,YAAY,KAAK;GAExC,QAAQ,YAAY,KAAK,IAAI;GAC7B,QAAQ,WAAW,KAAK,GAAG;EAC7B;CACF;CAEA,OAAO,SAAsC,MAAoB;EAC/D,QAAQ,MAAR;GACE,KAAK,GAAG;IAEN,MAAM,MAAM,QAAQ,KAAK,UAAU,QAAQ,MAAM;IACjD,QAAQ,UAAU;IAGlB,uBAAO,IAAI,KAAK,MAAM,MAAM,CAAU;GACxC;GACA,KAAK,GAAG;IAEN,MAAM,oBAAoB,QAAQ,KAAK,UAAU,QAAQ,MAAM;IAC/D,QAAQ,UAAU;IAClB,MAAM,WAAW,QAAQ,KAAK,UAAU,QAAQ,MAAM;IACtD,QAAQ,UAAU;IAClB,MAAM,OAAO,oBAAoB,KAAO,aAAkB;IAC1D,MAAM,OAAO,sBAAsB;IACnC,uBAAO,IAAI,KAAK,MAAM,MAAM,OAAO,GAAG;GACxC;GACA,KAAK,IAAI;IAEP,MAAM,OAAO,QAAQ,KAAK,UAAU,QAAQ,MAAM;IAClD,QAAQ,UAAU;IAElB,MAAM,OAAO,QAAQ,KAAK,SAAS,QAAQ,MAAM;IACjD,QAAQ,UAAU;IAElB,MAAM,MAAM,QAAQ,KAAK,UAAU,QAAQ,MAAM;IACjD,QAAQ,UAAU;IAGlB,MAAM,MAAM,OAAO,aAAkB;IACrC,uBAAO,IAAI,KAAK,MAAM,MAAM,OAAO,GAAG;GACxC;GACA,SACE,MAAM,IAAI,MACR,gEAAgE,QAAQ,KAAK,YAC/E;EAEJ;CACF;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
package/dist/esm/index.d.mts
CHANGED
|
@@ -1,23 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { t as
|
|
3
|
-
import { t as
|
|
4
|
-
import { a as
|
|
5
|
-
import { t as
|
|
6
|
-
import { t as
|
|
7
|
-
import {
|
|
8
|
-
import { t as
|
|
9
|
-
import { t as
|
|
10
|
-
import { t as
|
|
11
|
-
import { t as
|
|
12
|
-
import { t as
|
|
13
|
-
import { t as
|
|
14
|
-
import { t as
|
|
15
|
-
import { t as
|
|
16
|
-
|
|
17
|
-
import Symbols from "./symbols.mjs";
|
|
18
|
-
import { t as fitIn7Bits } from "./fitIn7Bits-BVHyKXCg.mjs";
|
|
19
|
-
import { t as fitIn8Bits } from "./fitIn8Bits-DQnQIhdh.mjs";
|
|
20
|
-
import { t as fitIn16Bits } from "./fitIn16Bits-D9lga-sP.mjs";
|
|
21
|
-
import { t as fitIn32Bits } from "./fitIn32Bits-BrGIMOff.mjs";
|
|
22
|
-
import { t as fitInt64Bits } from "./fitInt64Bits-CY7lVKne.mjs";
|
|
23
|
-
export { BufferWithExtensions, DEFAULT_ALLOCATION_SIZE, Decoder, DecoderBuffer, DefaultTextEncoder, Encoder, EncoderBuffer, type EncoderBufferOptions, type ExtensionEncoderBuffer, INT32_MIN, INT64_MIN, type MessagePackBufferWithExtensions, type MessagePackDecoderBuffer, type MessagePackEncoderBuffer, type MessagePackExtension, type MessagePackTextDecoder, type MessagePackTextEncoder, type MessagePackTime, NodeTextEncoder, type OmitByPattern, Symbols, TimestampDateExtension, UINT32_MAX, UINT64_MAX, UntypedExtension, decoderDataTypesFactory, fitIn16Bits, fitIn32Bits, fitIn7Bits, fitIn8Bits, fitInt64Bits };
|
|
1
|
+
import { t as MessagePackTextDecoder } from "./messagePackTextDecoder-CfBSOsxU.mjs";
|
|
2
|
+
import { t as MessagePackDecoder } from "./messagePackDecoder-96W4gsyQ.mjs";
|
|
3
|
+
import { t as Constructor } from "./types-BcIA43h9.mjs";
|
|
4
|
+
import { a as EncoderOptions, d as TimestampDateExtension, i as MessagePackExtension, n as MessagePackEncoder, o as ExtensionEncoder, t as ErrorExtension } from "./error-BtKEZf6W.mjs";
|
|
5
|
+
import { n as ErrorExtensionFactoryInput, r as ErrorExtensionOptions, t as ErrorExtensionFactory } from "./types-LHP7oHpt.mjs";
|
|
6
|
+
import { t as MessagePackTextEncoder } from "./messagePackTextEncoder-MeyNUt3L.mjs";
|
|
7
|
+
import { t as SerializerExtension } from "./serializer-Bu3RyF09.mjs";
|
|
8
|
+
import { t as decode } from "./decode-BraWmoPw.mjs";
|
|
9
|
+
import { t as Encoder } from "./encoder-C5Oo57-h.mjs";
|
|
10
|
+
import { t as Decoder } from "./decoder-Bdqx1C7P.mjs";
|
|
11
|
+
import { t as DefaultTextDecoder } from "./defaultTextDecoder-BkW5T2EO.mjs";
|
|
12
|
+
import { t as NodeTextDecoder } from "./nodeTextDecoder-D95BppeH.mjs";
|
|
13
|
+
import { t as encode } from "./encode-4SxHVw0M.mjs";
|
|
14
|
+
import { t as DefaultTextEncoder } from "./defaultTextEncoder-9dqnRXnL.mjs";
|
|
15
|
+
import { t as NodeTextEncoder } from "./nodeTextEncoder-Bv6YQGyH.mjs";
|
|
16
|
+
export { type Constructor, Decoder, DefaultTextDecoder, DefaultTextEncoder, Encoder, type EncoderOptions, ErrorExtension, type ErrorExtensionFactory, type ErrorExtensionFactoryInput, type ErrorExtensionOptions, type ExtensionEncoder, type MessagePackDecoder, type MessagePackEncoder, type MessagePackExtension, type MessagePackTextDecoder, type MessagePackTextEncoder, NodeTextDecoder, NodeTextEncoder, SerializerExtension, TimestampDateExtension, decode, encode };
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,22 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import UntypedExtension from "./untypedExtension.mjs";
|
|
5
|
-
import fitIn7Bits from "./utils/fitIn7Bits.mjs";
|
|
6
|
-
import fitIn8Bits from "./utils/fitIn8Bits.mjs";
|
|
7
|
-
import fitIn16Bits from "./utils/fitIn16Bits.mjs";
|
|
8
|
-
import fitIn32Bits from "./utils/fitIn32Bits.mjs";
|
|
1
|
+
import SerializerExtension from "./extensions/serializer/serializer.mjs";
|
|
2
|
+
import ErrorExtension from "./extensions/error/error.mjs";
|
|
3
|
+
import TimestampDateExtension from "./extensions/timestampDate/timestampDate.mjs";
|
|
9
4
|
import DefaultTextEncoder from "./encoder/textEncoders/defaultTextEncoder.mjs";
|
|
10
|
-
import EncoderBuffer from "./encoder/encoderBuffer.mjs";
|
|
11
5
|
import Encoder from "./encoder/encoder.mjs";
|
|
12
|
-
import decoderDataTypesFactory from "./benchmark/decoderDataTypesFactory.mjs";
|
|
13
|
-
import DecoderBuffer from "./decoder/decoderBuffer.mjs";
|
|
14
|
-
import Decoder from "./decoder/decoder.mjs";
|
|
15
|
-
import "./decoder/index.mjs";
|
|
16
6
|
import NodeTextEncoder from "./encoder/textEncoders/nodeTextEncoder.mjs";
|
|
7
|
+
import encode from "./encoder/encode.mjs";
|
|
17
8
|
import "./encoder/index.mjs";
|
|
18
|
-
import
|
|
9
|
+
import DefaultTextDecoder from "./decoder/textDecoders/defaultTextDecoder.mjs";
|
|
10
|
+
import NodeTextDecoder from "./decoder/textDecoders/nodeTextDecoder.mjs";
|
|
11
|
+
import Decoder from "./decoder/decoder.mjs";
|
|
12
|
+
import decode from "./decoder/decode.mjs";
|
|
13
|
+
import "./decoder/index.mjs";
|
|
19
14
|
import "./extensions/index.mjs";
|
|
20
|
-
|
|
21
|
-
import "./utils/index.mjs";
|
|
22
|
-
export { BufferWithExtensions, DEFAULT_ALLOCATION_SIZE, Decoder, DecoderBuffer, DefaultTextEncoder, Encoder, EncoderBuffer, INT32_MIN, INT64_MIN, NodeTextEncoder, Symbols, TimestampDateExtension, UINT32_MAX, UINT64_MAX, UntypedExtension, decoderDataTypesFactory, fitIn16Bits, fitIn32Bits, fitIn7Bits, fitIn8Bits, fitInt64Bits };
|
|
15
|
+
export { Decoder, DefaultTextDecoder, DefaultTextEncoder, Encoder, ErrorExtension, NodeTextDecoder, NodeTextEncoder, SerializerExtension, TimestampDateExtension, decode, encode };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as MessagePackBufferWithExtensions } from "../error-BtKEZf6W.mjs";
|
|
2
2
|
export { MessagePackBufferWithExtensions as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { t as MessagePackTextDecoder } from "./messagePackTextDecoder-CfBSOsxU.mjs";
|
|
2
|
+
//#region src/decoder/interfaces/messagePackDecoder.d.ts
|
|
3
|
+
interface MessagePackDecoder<TBuffer extends Uint8Array = Uint8Array> {
|
|
4
|
+
view: DataView;
|
|
5
|
+
buffer: TBuffer;
|
|
6
|
+
textDecoder: MessagePackTextDecoder<TBuffer>;
|
|
7
|
+
offset: number;
|
|
8
|
+
nextValue<TValue = unknown>(): TValue;
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { MessagePackDecoder as t };
|
|
12
|
+
//# sourceMappingURL=messagePackDecoder-96W4gsyQ.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messagePackDecoder-96W4gsyQ.d.mts","names":[],"sources":["../../src/decoder/interfaces/messagePackDecoder.ts"],"mappings":";;UAEyB,mBACvB,gBAAgB,aAAa;EAE7B,MAAM;EACN,QAAQ;EACR,aAAa,uBAAuB;EACpC;EACA,UAAU,qBAAqB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { t as MessagePackDecoder } from "./messagePackDecoder-96W4gsyQ.mjs";
|
|
2
|
+
import { t as Constructor } from "./types-BcIA43h9.mjs";
|
|
3
|
+
//#region src/extensions/interfaces/messagePackExtensionBase.d.ts
|
|
4
|
+
interface MessagePackExtensionBase<TValue extends object = object, TBuffer extends Uint8Array = Uint8Array> {
|
|
5
|
+
/**
|
|
6
|
+
* The unique type identifier for this extension. This value is used to
|
|
7
|
+
* distinguish between different extensions during the encoding and decoding
|
|
8
|
+
* process.
|
|
9
|
+
*/
|
|
10
|
+
readonly type: number;
|
|
11
|
+
/**
|
|
12
|
+
* The constructor associated with this extension. This constructor is used to
|
|
13
|
+
* create instances of the value type during decoding.
|
|
14
|
+
*/
|
|
15
|
+
readonly constructors: Constructor<TValue> | Constructor<TValue>[];
|
|
16
|
+
/**
|
|
17
|
+
* Decodes a value from the provided decoder buffer starting at the specified
|
|
18
|
+
* offset. The method should read the necessary bytes from the buffer,
|
|
19
|
+
* reconstruct the original value, and return it.
|
|
20
|
+
*
|
|
21
|
+
* @param decoder - The decoder containing the encoded data to be decoded.
|
|
22
|
+
* @param size - The number of bytes to read from the buffer for decoding.
|
|
23
|
+
*
|
|
24
|
+
* @returns The decoded value of type TValue.
|
|
25
|
+
*/
|
|
26
|
+
decode(decoder: MessagePackDecoder<TBuffer>, size: number): TValue;
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { MessagePackExtensionBase as t };
|
|
30
|
+
//# sourceMappingURL=messagePackExtensionBase-w6KYZsVn.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messagePackExtensionBase-w6KYZsVn.d.mts","names":[],"sources":["../../src/extensions/interfaces/messagePackExtensionBase.ts"],"mappings":";;;UAGyB,yBACvB,gCACA,gBAAgB,aAAa;;;;;;WAOpB;;;;;WAMA,cAAc,YAAY,UAAU,YAAY;;;;;;;;;;;EAYzD,OAAO,SAAS,mBAAmB,UAAU,eAAe"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/decoder/interfaces/messagePackTextDecoder.d.ts
|
|
2
|
+
interface MessagePackTextDecoder<TBuffer extends Uint8Array = Uint8Array> {
|
|
3
|
+
/** Decodes a portion of the buffer into a string. */
|
|
4
|
+
decode: (buffer: TBuffer, startOffset: number, endOffset: number) => string;
|
|
5
|
+
}
|
|
6
|
+
//#endregion
|
|
7
|
+
export { MessagePackTextDecoder as t };
|
|
8
|
+
//# sourceMappingURL=messagePackTextDecoder-CfBSOsxU.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messagePackTextDecoder-CfBSOsxU.d.mts","names":[],"sources":["../../src/decoder/interfaces/messagePackTextDecoder.ts"],"mappings":";UAAyB,uBACvB,gBAAgB,aAAa;;EAU7B,SAAS,QAAQ,SAAS,qBAAqB"}
|
package/dist/esm/{messagePackTextEncoder-D7iCft_t.d.mts → messagePackTextEncoder-MeyNUt3L.d.mts}
RENAMED
|
@@ -9,8 +9,8 @@ interface MessagePackTextEncoder<TBuffer extends Uint8Array = Uint8Array> {
|
|
|
9
9
|
*
|
|
10
10
|
* @returns The number of bytes written to the buffer.
|
|
11
11
|
*/
|
|
12
|
-
writeBytes(source: string, buffer: TBuffer)
|
|
12
|
+
writeBytes: (source: string, buffer: TBuffer) => number;
|
|
13
13
|
}
|
|
14
14
|
//#endregion
|
|
15
15
|
export { MessagePackTextEncoder as t };
|
|
16
|
-
//# sourceMappingURL=messagePackTextEncoder-
|
|
16
|
+
//# sourceMappingURL=messagePackTextEncoder-MeyNUt3L.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messagePackTextEncoder-MeyNUt3L.d.mts","names":[],"sources":["../../src/encoder/interfaces/messagePackTextEncoder.ts"],"mappings":";;UACyB,uBACvB,gBAAgB,aAAa;;;;;;;;;EAe7B,aAAa,gBAAgB,QAAQ"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { t as MessagePackTextDecoder } from "./messagePackTextDecoder-CfBSOsxU.mjs";
|
|
2
|
+
import { Buffer } from "node:buffer";
|
|
3
|
+
//#region src/decoder/textDecoders/nodeTextDecoder.d.ts
|
|
4
|
+
declare class NodeTextDecoder implements MessagePackTextDecoder<Buffer> {
|
|
5
|
+
decode(buffer: Buffer, start: number, end: number): string;
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { NodeTextDecoder as t };
|
|
9
|
+
//# sourceMappingURL=nodeTextDecoder-D95BppeH.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeTextDecoder-D95BppeH.d.mts","names":[],"sources":["../../src/decoder/textDecoders/nodeTextDecoder.ts"],"mappings":";;;cAIM,2BAA2B,uBAAuB;EACtD,OAAO,QAAQ,QAAQ,eAAe"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as MessagePackTextEncoder } from "./messagePackTextEncoder-
|
|
1
|
+
import { t as MessagePackTextEncoder } from "./messagePackTextEncoder-MeyNUt3L.mjs";
|
|
2
2
|
//#region src/encoder/textEncoders/nodeTextEncoder.d.ts
|
|
3
|
-
declare class NodeTextEncoder implements MessagePackTextEncoder {
|
|
3
|
+
declare class NodeTextEncoder implements MessagePackTextEncoder<Buffer> {
|
|
4
4
|
writeBytes(value: string, buffer: Buffer): number;
|
|
5
5
|
}
|
|
6
6
|
//#endregion
|
|
7
7
|
export { NodeTextEncoder as t };
|
|
8
|
-
//# sourceMappingURL=nodeTextEncoder-
|
|
8
|
+
//# sourceMappingURL=nodeTextEncoder-Bv6YQGyH.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeTextEncoder-Bv6YQGyH.d.mts","names":[],"sources":["../../src/encoder/textEncoders/nodeTextEncoder.ts"],"mappings":";;cAEM,2BAA2B,uBAAuB;EACtD,WAAW,eAAe,QAAQ"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { t as MessagePackDecoder } from "./messagePackDecoder-96W4gsyQ.mjs";
|
|
2
|
+
import { t as Constructor } from "./types-BcIA43h9.mjs";
|
|
3
|
+
import { t as MessagePackExtensionBase } from "./messagePackExtensionBase-w6KYZsVn.mjs";
|
|
4
|
+
import { n as SerializerExtensionFactory, t as SerializerExtensionFactories } from "./types-xD3JER2f.mjs";
|
|
5
|
+
//#region src/extensions/serializer/serializer.d.ts
|
|
6
|
+
declare abstract class SerializerExtension<TValue extends object, TInput, TFactory extends SerializerExtensionFactory<TValue, TInput>, TBuffer extends Uint8Array = Uint8Array> implements MessagePackExtensionBase<TValue, TBuffer> {
|
|
7
|
+
abstract readonly type: number;
|
|
8
|
+
readonly constructors: Constructor<TValue>[];
|
|
9
|
+
readonly factories: Map<Constructor<TValue>, TFactory>;
|
|
10
|
+
protected readonly factoriesByConstructorName: Map<string, TFactory>;
|
|
11
|
+
constructor(factories: SerializerExtensionFactories<TValue, TInput, TFactory>);
|
|
12
|
+
protected registerFactory(construct: Constructor<TValue>, factory: TFactory): void;
|
|
13
|
+
fetchFactoryByConstructor(constructor: Constructor<TValue>): TFactory;
|
|
14
|
+
fetchFactoryByConstructorName(constructorName: string): TFactory;
|
|
15
|
+
abstract decode(decoder: MessagePackDecoder<TBuffer>, size: number): TValue;
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { SerializerExtension as t };
|
|
19
|
+
//# sourceMappingURL=serializer-Bu3RyF09.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializer-Bu3RyF09.d.mts","names":[],"sources":["../../src/extensions/serializer/serializer.ts"],"mappings":";;;;;uBAQe,oBACb,uBACA,QACA,iBAAiB,2BAA2B,QAAQ,SACpD,gBAAgB,aAAa,uBAClB,yBAAyB,QAAQ;oBAC1B;WACT,cAAc,YAAY;WAE1B,WAAS,IAAA,YAAA,SAAA;qBAEC,4BAA0B,YAAA;EAE7C,YACE,WAAW,6BAA6B,QAAQ,QAAQ;YAOhD,gBACR,WAAW,YAAY,SACvB,SAAS;EAgBX,0BAA0B,aAAa,YAAY,UAAU;EAY7D,8BAA8B,0BAA0B;WAY/C,OAAO,SAAS,mBAAmB,UAAU,eAAe"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-BcIA43h9.d.mts","names":[],"sources":["../../src/extensions/interfaces/types.ts"],"mappings":";KAAY,YAAY,2BAEnB,gBACA"}
|