@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.
Files changed (380) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +9 -123
  3. package/dist/cjs/bufferWithExtensions-Cg4LGSIy.d.cts +51 -0
  4. package/dist/cjs/bufferWithExtensions-Cg4LGSIy.d.cts.map +1 -0
  5. package/dist/cjs/bufferWithExtensions.cjs +79 -16
  6. package/dist/cjs/bufferWithExtensions.d.cts +1 -1
  7. package/dist/cjs/decode-BraWmoPw.d.cts +5 -0
  8. package/dist/cjs/decode-BraWmoPw.d.cts.map +1 -0
  9. package/dist/cjs/decoder/decode.cjs +8 -0
  10. package/dist/cjs/decoder/decode.d.cts +2 -0
  11. package/dist/cjs/decoder/decoder.cjs +268 -19
  12. package/dist/cjs/decoder/decoder.d.cts +1 -1
  13. package/dist/cjs/decoder/index.cjs +6 -2
  14. package/dist/cjs/decoder/index.d.cts +7 -5
  15. package/dist/cjs/decoder/interfaces/index.d.cts +4 -4
  16. package/dist/cjs/decoder/interfaces/messagePackDecoder.d.cts +2 -0
  17. package/dist/cjs/decoder/interfaces/messagePackTextDecoder.d.cts +1 -1
  18. package/dist/cjs/decoder/textDecoders/defaultTextDecoder.d.cts +1 -1
  19. package/dist/cjs/decoder/textDecoders/index.cjs +5 -0
  20. package/dist/cjs/decoder/textDecoders/index.d.cts +4 -0
  21. package/dist/cjs/decoder/textDecoders/nodeTextDecoder.cjs +8 -0
  22. package/dist/cjs/decoder/textDecoders/nodeTextDecoder.d.cts +2 -0
  23. package/dist/cjs/decoder/types.d.cts +2 -2
  24. package/dist/cjs/decoder-T6p4ZZJi.d.cts +30 -0
  25. package/dist/cjs/decoder-T6p4ZZJi.d.cts.map +1 -0
  26. package/dist/cjs/defaultNewBufferFn.cjs +1 -3
  27. package/dist/cjs/defaultNewBufferFn.d.cts +2 -1
  28. package/dist/cjs/defaultNewBufferFn.d.cts.map +1 -1
  29. package/dist/cjs/defaultTextDecoder-CyZtJbK1.d.cts +10 -0
  30. package/dist/cjs/defaultTextDecoder-CyZtJbK1.d.cts.map +1 -0
  31. package/dist/{esm/defaultTextEncoder-BkIjtDkg.d.mts → cjs/defaultTextEncoder-BpUrJKD9.d.cts} +2 -2
  32. package/dist/cjs/{defaultTextEncoder-DzdGBX6s.d.cts.map → defaultTextEncoder-BpUrJKD9.d.cts.map} +1 -1
  33. package/dist/cjs/encode-4SxHVw0M.d.cts +5 -0
  34. package/dist/cjs/encode-4SxHVw0M.d.cts.map +1 -0
  35. package/dist/cjs/encoder/encode.cjs +8 -0
  36. package/dist/cjs/encoder/encode.d.cts +2 -0
  37. package/dist/cjs/encoder/encoder.cjs +690 -26
  38. package/dist/cjs/encoder/encoder.d.cts +1 -1
  39. package/dist/cjs/encoder/index.cjs +2 -2
  40. package/dist/cjs/encoder/index.d.cts +7 -7
  41. package/dist/cjs/encoder/interfaces/index.d.cts +4 -4
  42. package/dist/cjs/encoder/interfaces/messagePackEncoder.d.cts +2 -0
  43. package/dist/cjs/encoder/interfaces/messagePackTextEncoder.d.cts +1 -1
  44. package/dist/cjs/encoder/textEncoders/defaultTextEncoder.d.cts +1 -1
  45. package/dist/cjs/encoder/textEncoders/index.d.cts +3 -3
  46. package/dist/cjs/encoder/textEncoders/nodeTextEncoder.d.cts +1 -1
  47. package/dist/cjs/encoder/types.d.cts +2 -2
  48. package/dist/cjs/{encoderBuffer-DWGIXXjj.d.cts → encoder-yQYOtvXU.d.cts} +38 -16
  49. package/dist/cjs/encoder-yQYOtvXU.d.cts.map +1 -0
  50. package/dist/cjs/{messagePackExtension-C_TQXlEn.d.cts → error-B129l__v.d.cts} +306 -52
  51. package/dist/cjs/error-B129l__v.d.cts.map +1 -0
  52. package/dist/cjs/extensions/error/defaultFactories.cjs +15 -0
  53. package/dist/cjs/extensions/error/defaultFactories.d.cts +6 -0
  54. package/dist/cjs/extensions/error/defaultFactories.d.cts.map +1 -0
  55. package/dist/cjs/extensions/error/error.cjs +139 -0
  56. package/dist/cjs/extensions/error/error.d.cts +2 -0
  57. package/dist/cjs/extensions/error/index.cjs +3 -0
  58. package/dist/cjs/extensions/error/index.d.cts +4 -0
  59. package/dist/cjs/extensions/error/symbols.cjs +19 -0
  60. package/dist/cjs/extensions/error/symbols.d.cts +19 -0
  61. package/dist/cjs/extensions/error/symbols.d.cts.map +1 -0
  62. package/dist/cjs/extensions/error/types.d.cts +2 -0
  63. package/dist/cjs/extensions/index.cjs +4 -0
  64. package/dist/cjs/extensions/index.d.cts +6 -3
  65. package/dist/cjs/extensions/interfaces/messagePackBuiltInExtension.d.cts +2 -0
  66. package/dist/cjs/extensions/interfaces/messagePackExtension.d.cts +1 -1
  67. package/dist/cjs/extensions/interfaces/messagePackExtensionBase.cjs +0 -0
  68. package/dist/cjs/extensions/interfaces/messagePackExtensionBase.d.cts +2 -0
  69. package/dist/cjs/extensions/interfaces/types.cjs +0 -0
  70. package/dist/cjs/extensions/interfaces/types.d.cts +2 -0
  71. package/dist/cjs/extensions/serializer/index.cjs +3 -0
  72. package/dist/cjs/extensions/serializer/index.d.cts +4 -0
  73. package/dist/cjs/extensions/serializer/serializer.cjs +27 -0
  74. package/dist/cjs/extensions/serializer/serializer.d.cts +2 -0
  75. package/dist/cjs/extensions/serializer/types.cjs +0 -0
  76. package/dist/cjs/extensions/serializer/types.d.cts +2 -0
  77. package/dist/cjs/extensions/timestampDate/index.d.cts +2 -2
  78. package/dist/cjs/extensions/timestampDate/timestampDate.cjs +41 -24
  79. package/dist/cjs/extensions/timestampDate/timestampDate.d.cts +1 -1
  80. package/dist/cjs/index-B5vbV8Ak.d.cts +1 -0
  81. package/dist/cjs/index.cjs +15 -32
  82. package/dist/cjs/index.d.cts +16 -23
  83. package/dist/cjs/interfaces/messagePackBufferWithExtensions.d.cts +1 -1
  84. package/dist/cjs/messagePackDecoder-BZOBJ2h5.d.cts +12 -0
  85. package/dist/cjs/messagePackDecoder-BZOBJ2h5.d.cts.map +1 -0
  86. package/dist/cjs/messagePackExtensionBase-DVMgQv12.d.cts +30 -0
  87. package/dist/cjs/messagePackExtensionBase-DVMgQv12.d.cts.map +1 -0
  88. package/dist/cjs/messagePackTextDecoder-CfBSOsxU.d.cts +8 -0
  89. package/dist/cjs/messagePackTextDecoder-CfBSOsxU.d.cts.map +1 -0
  90. package/dist/cjs/{messagePackTextEncoder-D7iCft_t.d.cts → messagePackTextEncoder-MeyNUt3L.d.cts} +2 -2
  91. package/dist/cjs/messagePackTextEncoder-MeyNUt3L.d.cts.map +1 -0
  92. package/dist/cjs/nodeTextDecoder-B48jwo-L.d.cts +9 -0
  93. package/dist/cjs/nodeTextDecoder-B48jwo-L.d.cts.map +1 -0
  94. package/dist/{esm/nodeTextEncoder-CegSnA6z.d.mts → cjs/nodeTextEncoder-BpJi8Jx-.d.cts} +3 -3
  95. package/dist/cjs/nodeTextEncoder-BpJi8Jx-.d.cts.map +1 -0
  96. package/dist/cjs/serializer-nJmZCyQ0.d.cts +19 -0
  97. package/dist/cjs/serializer-nJmZCyQ0.d.cts.map +1 -0
  98. package/dist/cjs/types-BLh5F2iA.d.cts +22 -0
  99. package/dist/cjs/types-BLh5F2iA.d.cts.map +1 -0
  100. package/dist/cjs/types-BcIA43h9.d.cts +5 -0
  101. package/dist/cjs/types-BcIA43h9.d.cts.map +1 -0
  102. package/dist/cjs/types-CbicLx9m.d.cts +21 -0
  103. package/dist/cjs/types-CbicLx9m.d.cts.map +1 -0
  104. package/dist/cjs/types-aODRmLZq.d.cts +7 -0
  105. package/dist/cjs/types-aODRmLZq.d.cts.map +1 -0
  106. package/dist/cjs/types.d.cts +2 -2
  107. package/dist/cjs/utils/assertValidExtensionType.cjs +7 -0
  108. package/dist/cjs/utils/assertValidExtensionType.d.cts +4 -0
  109. package/dist/cjs/utils/assertValidExtensionType.d.cts.map +1 -0
  110. package/dist/cjs/utils/fitIn16Bits.d.cts +4 -2
  111. package/dist/cjs/utils/fitIn16Bits.d.cts.map +1 -0
  112. package/dist/cjs/utils/fitIn32Bits.d.cts +4 -2
  113. package/dist/cjs/utils/fitIn32Bits.d.cts.map +1 -0
  114. package/dist/cjs/utils/fitIn7Bits.d.cts +4 -2
  115. package/dist/cjs/utils/fitIn7Bits.d.cts.map +1 -0
  116. package/dist/cjs/utils/fitIn8Bits.d.cts +4 -2
  117. package/dist/cjs/utils/fitIn8Bits.d.cts.map +1 -0
  118. package/dist/esm/bufferWithExtensions-DSU4ekuD.d.mts +51 -0
  119. package/dist/esm/bufferWithExtensions-DSU4ekuD.d.mts.map +1 -0
  120. package/dist/esm/bufferWithExtensions.d.mts +1 -1
  121. package/dist/esm/bufferWithExtensions.mjs +79 -16
  122. package/dist/esm/bufferWithExtensions.mjs.map +1 -1
  123. package/dist/esm/decode-BraWmoPw.d.mts +5 -0
  124. package/dist/esm/decode-BraWmoPw.d.mts.map +1 -0
  125. package/dist/esm/decoder/decode.d.mts +2 -0
  126. package/dist/esm/decoder/decode.mjs +11 -0
  127. package/dist/esm/decoder/decode.mjs.map +1 -0
  128. package/dist/esm/decoder/decoder.d.mts +1 -1
  129. package/dist/esm/decoder/decoder.mjs +268 -19
  130. package/dist/esm/decoder/decoder.mjs.map +1 -1
  131. package/dist/esm/decoder/index.d.mts +7 -5
  132. package/dist/esm/decoder/index.mjs +4 -2
  133. package/dist/esm/decoder/interfaces/index.d.mts +4 -4
  134. package/dist/esm/decoder/interfaces/messagePackDecoder.d.mts +2 -0
  135. package/dist/esm/decoder/interfaces/messagePackTextDecoder.d.mts +1 -1
  136. package/dist/esm/decoder/textDecoders/defaultTextDecoder.d.mts +1 -1
  137. package/dist/esm/decoder/textDecoders/defaultTextDecoder.mjs.map +1 -1
  138. package/dist/esm/decoder/textDecoders/index.d.mts +4 -0
  139. package/dist/esm/decoder/textDecoders/index.mjs +3 -0
  140. package/dist/esm/decoder/textDecoders/nodeTextDecoder.d.mts +2 -0
  141. package/dist/esm/decoder/textDecoders/nodeTextDecoder.mjs +10 -0
  142. package/dist/esm/decoder/textDecoders/nodeTextDecoder.mjs.map +1 -0
  143. package/dist/esm/decoder/types.d.mts +2 -2
  144. package/dist/esm/decoder-Bdqx1C7P.d.mts +30 -0
  145. package/dist/esm/decoder-Bdqx1C7P.d.mts.map +1 -0
  146. package/dist/esm/defaultNewBufferFn.d.mts +2 -1
  147. package/dist/esm/defaultNewBufferFn.d.mts.map +1 -1
  148. package/dist/esm/defaultNewBufferFn.mjs +1 -3
  149. package/dist/esm/defaultNewBufferFn.mjs.map +1 -1
  150. package/dist/esm/defaultTextDecoder-BkW5T2EO.d.mts +10 -0
  151. package/dist/esm/defaultTextDecoder-BkW5T2EO.d.mts.map +1 -0
  152. package/dist/{cjs/defaultTextEncoder-DzdGBX6s.d.cts → esm/defaultTextEncoder-9dqnRXnL.d.mts} +2 -2
  153. package/dist/esm/{defaultTextEncoder-BkIjtDkg.d.mts.map → defaultTextEncoder-9dqnRXnL.d.mts.map} +1 -1
  154. package/dist/esm/encode-4SxHVw0M.d.mts +5 -0
  155. package/dist/esm/encode-4SxHVw0M.d.mts.map +1 -0
  156. package/dist/esm/encoder/encode.d.mts +2 -0
  157. package/dist/esm/encoder/encode.mjs +11 -0
  158. package/dist/esm/encoder/encode.mjs.map +1 -0
  159. package/dist/esm/encoder/encoder.d.mts +1 -1
  160. package/dist/esm/encoder/encoder.mjs +690 -26
  161. package/dist/esm/encoder/encoder.mjs.map +1 -1
  162. package/dist/esm/encoder/index.d.mts +7 -7
  163. package/dist/esm/encoder/index.mjs +2 -2
  164. package/dist/esm/encoder/interfaces/index.d.mts +4 -4
  165. package/dist/esm/encoder/interfaces/messagePackEncoder.d.mts +2 -0
  166. package/dist/esm/encoder/interfaces/messagePackTextEncoder.d.mts +1 -1
  167. package/dist/esm/encoder/textEncoders/defaultTextEncoder.d.mts +1 -1
  168. package/dist/esm/encoder/textEncoders/index.d.mts +3 -3
  169. package/dist/esm/encoder/textEncoders/nodeTextEncoder.d.mts +1 -1
  170. package/dist/esm/encoder/textEncoders/nodeTextEncoder.mjs.map +1 -1
  171. package/dist/esm/encoder/types.d.mts +2 -2
  172. package/dist/esm/{encoderBuffer-DEy8CuWQ.d.mts → encoder-C5Oo57-h.d.mts} +38 -16
  173. package/dist/esm/encoder-C5Oo57-h.d.mts.map +1 -0
  174. package/dist/esm/{messagePackExtension-5TI02KG6.d.mts → error-BtKEZf6W.d.mts} +306 -52
  175. package/dist/esm/error-BtKEZf6W.d.mts.map +1 -0
  176. package/dist/esm/extensions/error/defaultFactories.d.mts +7 -0
  177. package/dist/esm/extensions/error/defaultFactories.d.mts.map +1 -0
  178. package/dist/esm/extensions/error/defaultFactories.mjs +17 -0
  179. package/dist/esm/extensions/error/defaultFactories.mjs.map +1 -0
  180. package/dist/esm/extensions/error/error.d.mts +2 -0
  181. package/dist/esm/extensions/error/error.mjs +141 -0
  182. package/dist/esm/extensions/error/error.mjs.map +1 -0
  183. package/dist/esm/extensions/error/index.d.mts +4 -0
  184. package/dist/esm/extensions/error/index.mjs +2 -0
  185. package/dist/esm/extensions/error/symbols.d.mts +20 -0
  186. package/dist/esm/extensions/error/symbols.d.mts.map +1 -0
  187. package/dist/esm/extensions/error/symbols.mjs +21 -0
  188. package/dist/esm/extensions/error/symbols.mjs.map +1 -0
  189. package/dist/esm/extensions/error/types.d.mts +2 -0
  190. package/dist/esm/extensions/index.d.mts +6 -3
  191. package/dist/esm/extensions/index.mjs +3 -1
  192. package/dist/esm/extensions/interfaces/messagePackBuiltInExtension.d.mts +2 -0
  193. package/dist/esm/extensions/interfaces/messagePackExtension.d.mts +1 -1
  194. package/dist/esm/extensions/interfaces/messagePackExtensionBase.d.mts +2 -0
  195. package/dist/esm/extensions/interfaces/messagePackExtensionBase.mjs +1 -0
  196. package/dist/esm/extensions/interfaces/types.d.mts +2 -0
  197. package/dist/esm/extensions/interfaces/types.mjs +1 -0
  198. package/dist/esm/extensions/serializer/index.d.mts +4 -0
  199. package/dist/esm/extensions/serializer/index.mjs +2 -0
  200. package/dist/esm/extensions/serializer/serializer.d.mts +2 -0
  201. package/dist/esm/extensions/serializer/serializer.mjs +29 -0
  202. package/dist/esm/extensions/serializer/serializer.mjs.map +1 -0
  203. package/dist/esm/extensions/serializer/types.d.mts +2 -0
  204. package/dist/esm/extensions/serializer/types.mjs +1 -0
  205. package/dist/esm/extensions/timestampDate/index.d.mts +2 -2
  206. package/dist/esm/extensions/timestampDate/timestampDate.d.mts +1 -1
  207. package/dist/esm/extensions/timestampDate/timestampDate.mjs +41 -24
  208. package/dist/esm/extensions/timestampDate/timestampDate.mjs.map +1 -1
  209. package/dist/esm/index-B5vbV8Ak.d.mts +1 -0
  210. package/dist/esm/index.d.mts +16 -23
  211. package/dist/esm/index.mjs +10 -17
  212. package/dist/esm/interfaces/messagePackBufferWithExtensions.d.mts +1 -1
  213. package/dist/esm/messagePackDecoder-96W4gsyQ.d.mts +12 -0
  214. package/dist/esm/messagePackDecoder-96W4gsyQ.d.mts.map +1 -0
  215. package/dist/esm/messagePackExtensionBase-w6KYZsVn.d.mts +30 -0
  216. package/dist/esm/messagePackExtensionBase-w6KYZsVn.d.mts.map +1 -0
  217. package/dist/esm/messagePackTextDecoder-CfBSOsxU.d.mts +8 -0
  218. package/dist/esm/messagePackTextDecoder-CfBSOsxU.d.mts.map +1 -0
  219. package/dist/esm/{messagePackTextEncoder-D7iCft_t.d.mts → messagePackTextEncoder-MeyNUt3L.d.mts} +2 -2
  220. package/dist/esm/messagePackTextEncoder-MeyNUt3L.d.mts.map +1 -0
  221. package/dist/esm/nodeTextDecoder-D95BppeH.d.mts +9 -0
  222. package/dist/esm/nodeTextDecoder-D95BppeH.d.mts.map +1 -0
  223. package/dist/{cjs/nodeTextEncoder-DJzFDBXd.d.cts → esm/nodeTextEncoder-Bv6YQGyH.d.mts} +3 -3
  224. package/dist/esm/nodeTextEncoder-Bv6YQGyH.d.mts.map +1 -0
  225. package/dist/esm/serializer-Bu3RyF09.d.mts +19 -0
  226. package/dist/esm/serializer-Bu3RyF09.d.mts.map +1 -0
  227. package/dist/esm/types-BcIA43h9.d.mts +5 -0
  228. package/dist/esm/types-BcIA43h9.d.mts.map +1 -0
  229. package/dist/esm/types-DcVlVqj4.d.mts +21 -0
  230. package/dist/esm/types-DcVlVqj4.d.mts.map +1 -0
  231. package/dist/esm/types-LHP7oHpt.d.mts +22 -0
  232. package/dist/esm/types-LHP7oHpt.d.mts.map +1 -0
  233. package/dist/esm/types-xD3JER2f.d.mts +7 -0
  234. package/dist/esm/types-xD3JER2f.d.mts.map +1 -0
  235. package/dist/esm/types.d.mts +2 -2
  236. package/dist/esm/utils/assertValidExtensionType.d.mts +5 -0
  237. package/dist/esm/utils/assertValidExtensionType.d.mts.map +1 -0
  238. package/dist/esm/utils/assertValidExtensionType.mjs +9 -0
  239. package/dist/esm/utils/assertValidExtensionType.mjs.map +1 -0
  240. package/dist/esm/utils/fitIn16Bits.d.mts +5 -2
  241. package/dist/esm/utils/fitIn16Bits.d.mts.map +1 -0
  242. package/dist/esm/utils/fitIn32Bits.d.mts +5 -2
  243. package/dist/esm/utils/fitIn32Bits.d.mts.map +1 -0
  244. package/dist/esm/utils/fitIn7Bits.d.mts +5 -2
  245. package/dist/esm/utils/fitIn7Bits.d.mts.map +1 -0
  246. package/dist/esm/utils/fitIn8Bits.d.mts +5 -2
  247. package/dist/esm/utils/fitIn8Bits.d.mts.map +1 -0
  248. package/package.json +68 -43
  249. package/dist/cjs/benchmark/decoderDataTypesFactory.cjs +0 -37
  250. package/dist/cjs/benchmark/decoderDataTypesFactory.d.cts +0 -5
  251. package/dist/cjs/benchmark/decoderDataTypesFactory.d.cts.map +0 -1
  252. package/dist/cjs/bigInt-CBB8PGpe.d.cts +0 -35
  253. package/dist/cjs/bigInt-CBB8PGpe.d.cts.map +0 -1
  254. package/dist/cjs/bufferWithExtensions-BAinwJsn.d.cts +0 -12
  255. package/dist/cjs/bufferWithExtensions-BAinwJsn.d.cts.map +0 -1
  256. package/dist/cjs/decoder/decoderBuffer.cjs +0 -239
  257. package/dist/cjs/decoder/decoderBuffer.d.cts +0 -2
  258. package/dist/cjs/decoder/interfaces/messagePackDecoderBuffer.d.cts +0 -2
  259. package/dist/cjs/decoder-C1cd4I8S.d.cts +0 -15
  260. package/dist/cjs/decoder-C1cd4I8S.d.cts.map +0 -1
  261. package/dist/cjs/decoderBuffer-C9_0y-3q.d.cts +0 -22
  262. package/dist/cjs/decoderBuffer-C9_0y-3q.d.cts.map +0 -1
  263. package/dist/cjs/defaultTextDecoder-Ji2hTZkf.d.cts +0 -10
  264. package/dist/cjs/defaultTextDecoder-Ji2hTZkf.d.cts.map +0 -1
  265. package/dist/cjs/encoder/encoderBuffer.cjs +0 -602
  266. package/dist/cjs/encoder/encoderBuffer.d.cts +0 -2
  267. package/dist/cjs/encoder/interfaces/messagePackEncoderBuffer.d.cts +0 -2
  268. package/dist/cjs/encoder-DXuhGwd7.d.cts +0 -23
  269. package/dist/cjs/encoder-DXuhGwd7.d.cts.map +0 -1
  270. package/dist/cjs/encoderBuffer-DWGIXXjj.d.cts.map +0 -1
  271. package/dist/cjs/extensions/bigint/bigInt.cjs +0 -54
  272. package/dist/cjs/extensions/bigint/bigInt.d.cts +0 -2
  273. package/dist/cjs/extensions/bigint/index.cjs +0 -2
  274. package/dist/cjs/extensions/bigint/index.d.cts +0 -3
  275. package/dist/cjs/extensions/interfaces/index.d.cts +0 -3
  276. package/dist/cjs/fitIn16Bits-D9lga-sP.d.cts +0 -5
  277. package/dist/cjs/fitIn16Bits-D9lga-sP.d.cts.map +0 -1
  278. package/dist/cjs/fitIn32Bits-BrGIMOff.d.cts +0 -5
  279. package/dist/cjs/fitIn32Bits-BrGIMOff.d.cts.map +0 -1
  280. package/dist/cjs/fitIn7Bits-BVHyKXCg.d.cts +0 -5
  281. package/dist/cjs/fitIn7Bits-BVHyKXCg.d.cts.map +0 -1
  282. package/dist/cjs/fitIn8Bits-DQnQIhdh.d.cts +0 -5
  283. package/dist/cjs/fitIn8Bits-DQnQIhdh.d.cts.map +0 -1
  284. package/dist/cjs/fitInt64Bits-CY7lVKne.d.cts +0 -5
  285. package/dist/cjs/fitInt64Bits-CY7lVKne.d.cts.map +0 -1
  286. package/dist/cjs/interfaces/index.d.cts +0 -2
  287. package/dist/cjs/messagePackDecoderBuffer-CMG0LPbJ.d.cts +0 -12
  288. package/dist/cjs/messagePackDecoderBuffer-CMG0LPbJ.d.cts.map +0 -1
  289. package/dist/cjs/messagePackExtension-C_TQXlEn.d.cts.map +0 -1
  290. package/dist/cjs/messagePackTextDecoder-CtyB0N6j.d.cts +0 -7
  291. package/dist/cjs/messagePackTextDecoder-CtyB0N6j.d.cts.map +0 -1
  292. package/dist/cjs/messagePackTextEncoder-D7iCft_t.d.cts.map +0 -1
  293. package/dist/cjs/nodeTextEncoder-DJzFDBXd.d.cts.map +0 -1
  294. package/dist/cjs/timestampDate-BtBd4bAx.d.cts +0 -33
  295. package/dist/cjs/timestampDate-BtBd4bAx.d.cts.map +0 -1
  296. package/dist/cjs/types-BJie2edF.d.cts +0 -20
  297. package/dist/cjs/types-BJie2edF.d.cts.map +0 -1
  298. package/dist/cjs/types-DHnp4kMw.d.cts +0 -6
  299. package/dist/cjs/types-DHnp4kMw.d.cts.map +0 -1
  300. package/dist/cjs/untypedExtension-WQvArYoO.d.cts +0 -16
  301. package/dist/cjs/untypedExtension-WQvArYoO.d.cts.map +0 -1
  302. package/dist/cjs/untypedExtension.cjs +0 -13
  303. package/dist/cjs/untypedExtension.d.cts +0 -2
  304. package/dist/cjs/utils/fitInt64Bits.cjs +0 -6
  305. package/dist/cjs/utils/fitInt64Bits.d.cts +0 -2
  306. package/dist/cjs/utils/index.cjs +0 -11
  307. package/dist/cjs/utils/index.d.cts +0 -6
  308. package/dist/esm/benchmark/decoderDataTypesFactory.d.mts +0 -6
  309. package/dist/esm/benchmark/decoderDataTypesFactory.d.mts.map +0 -1
  310. package/dist/esm/benchmark/decoderDataTypesFactory.mjs +0 -39
  311. package/dist/esm/benchmark/decoderDataTypesFactory.mjs.map +0 -1
  312. package/dist/esm/bigInt-BvNVHUwj.d.mts +0 -35
  313. package/dist/esm/bigInt-BvNVHUwj.d.mts.map +0 -1
  314. package/dist/esm/bufferWithExtensions-Bikyeyt1.d.mts +0 -12
  315. package/dist/esm/bufferWithExtensions-Bikyeyt1.d.mts.map +0 -1
  316. package/dist/esm/decoder/decoderBuffer.d.mts +0 -2
  317. package/dist/esm/decoder/decoderBuffer.mjs +0 -241
  318. package/dist/esm/decoder/decoderBuffer.mjs.map +0 -1
  319. package/dist/esm/decoder/interfaces/messagePackDecoderBuffer.d.mts +0 -2
  320. package/dist/esm/decoder-DEzsJjYj.d.mts +0 -15
  321. package/dist/esm/decoder-DEzsJjYj.d.mts.map +0 -1
  322. package/dist/esm/decoderBuffer-BxJJdy5k.d.mts +0 -22
  323. package/dist/esm/decoderBuffer-BxJJdy5k.d.mts.map +0 -1
  324. package/dist/esm/defaultTextDecoder-B6a1HH2u.d.mts +0 -10
  325. package/dist/esm/defaultTextDecoder-B6a1HH2u.d.mts.map +0 -1
  326. package/dist/esm/encoder/encoderBuffer.d.mts +0 -2
  327. package/dist/esm/encoder/encoderBuffer.mjs +0 -604
  328. package/dist/esm/encoder/encoderBuffer.mjs.map +0 -1
  329. package/dist/esm/encoder/interfaces/messagePackEncoderBuffer.d.mts +0 -2
  330. package/dist/esm/encoder-CQfcjnAe.d.mts +0 -23
  331. package/dist/esm/encoder-CQfcjnAe.d.mts.map +0 -1
  332. package/dist/esm/encoderBuffer-DEy8CuWQ.d.mts.map +0 -1
  333. package/dist/esm/extensions/bigint/bigInt.d.mts +0 -2
  334. package/dist/esm/extensions/bigint/bigInt.mjs +0 -56
  335. package/dist/esm/extensions/bigint/bigInt.mjs.map +0 -1
  336. package/dist/esm/extensions/bigint/index.d.mts +0 -3
  337. package/dist/esm/extensions/bigint/index.mjs +0 -2
  338. package/dist/esm/extensions/interfaces/index.d.mts +0 -3
  339. package/dist/esm/fitIn16Bits-D9lga-sP.d.mts +0 -5
  340. package/dist/esm/fitIn16Bits-D9lga-sP.d.mts.map +0 -1
  341. package/dist/esm/fitIn32Bits-BrGIMOff.d.mts +0 -5
  342. package/dist/esm/fitIn32Bits-BrGIMOff.d.mts.map +0 -1
  343. package/dist/esm/fitIn7Bits-BVHyKXCg.d.mts +0 -5
  344. package/dist/esm/fitIn7Bits-BVHyKXCg.d.mts.map +0 -1
  345. package/dist/esm/fitIn8Bits-DQnQIhdh.d.mts +0 -5
  346. package/dist/esm/fitIn8Bits-DQnQIhdh.d.mts.map +0 -1
  347. package/dist/esm/fitInt64Bits-CY7lVKne.d.mts +0 -5
  348. package/dist/esm/fitInt64Bits-CY7lVKne.d.mts.map +0 -1
  349. package/dist/esm/interfaces/index.d.mts +0 -2
  350. package/dist/esm/messagePackDecoderBuffer-CGyYSweZ.d.mts +0 -12
  351. package/dist/esm/messagePackDecoderBuffer-CGyYSweZ.d.mts.map +0 -1
  352. package/dist/esm/messagePackExtension-5TI02KG6.d.mts.map +0 -1
  353. package/dist/esm/messagePackTextDecoder-CtyB0N6j.d.mts +0 -7
  354. package/dist/esm/messagePackTextDecoder-CtyB0N6j.d.mts.map +0 -1
  355. package/dist/esm/messagePackTextEncoder-D7iCft_t.d.mts.map +0 -1
  356. package/dist/esm/nodeTextEncoder-CegSnA6z.d.mts.map +0 -1
  357. package/dist/esm/timestampDate-C1UzHhZL.d.mts +0 -33
  358. package/dist/esm/timestampDate-C1UzHhZL.d.mts.map +0 -1
  359. package/dist/esm/types-BJie2edF.d.mts +0 -20
  360. package/dist/esm/types-BJie2edF.d.mts.map +0 -1
  361. package/dist/esm/types-DoBZbRkk.d.mts +0 -6
  362. package/dist/esm/types-DoBZbRkk.d.mts.map +0 -1
  363. package/dist/esm/untypedExtension-6bNMj-lY.d.mts +0 -16
  364. package/dist/esm/untypedExtension-6bNMj-lY.d.mts.map +0 -1
  365. package/dist/esm/untypedExtension.d.mts +0 -2
  366. package/dist/esm/untypedExtension.mjs +0 -15
  367. package/dist/esm/untypedExtension.mjs.map +0 -1
  368. package/dist/esm/utils/fitInt64Bits.d.mts +0 -2
  369. package/dist/esm/utils/fitInt64Bits.mjs +0 -8
  370. package/dist/esm/utils/fitInt64Bits.mjs.map +0 -1
  371. package/dist/esm/utils/index.d.mts +0 -6
  372. package/dist/esm/utils/index.mjs +0 -6
  373. /package/dist/cjs/decoder/interfaces/{messagePackDecoderBuffer.cjs → messagePackDecoder.cjs} +0 -0
  374. /package/dist/cjs/encoder/interfaces/{messagePackEncoderBuffer.cjs → messagePackEncoder.cjs} +0 -0
  375. /package/dist/cjs/extensions/{interfaces/index.cjs → error/types.cjs} +0 -0
  376. /package/dist/cjs/{interfaces/index.cjs → extensions/interfaces/messagePackBuiltInExtension.cjs} +0 -0
  377. /package/dist/esm/decoder/interfaces/{messagePackDecoderBuffer.mjs → messagePackDecoder.mjs} +0 -0
  378. /package/dist/esm/encoder/interfaces/{messagePackEncoderBuffer.mjs → messagePackEncoder.mjs} +0 -0
  379. /package/dist/esm/extensions/{interfaces/index.mjs → error/types.mjs} +0 -0
  380. /package/dist/esm/{interfaces/index.mjs → extensions/interfaces/messagePackBuiltInExtension.mjs} +0 -0
@@ -1,604 +0,0 @@
1
- import BufferWithExtensions from "../bufferWithExtensions.mjs";
2
- import { INT64_MIN, UINT64_MAX } from "../constants.mjs";
3
- import defaultNewBufferFn from "../defaultNewBufferFn.mjs";
4
- import Symbols from "../symbols.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";
9
- import DefaultTextEncoder from "./textEncoders/defaultTextEncoder.mjs";
10
- //#region src/encoder/encoderBuffer.ts
11
- var EncoderBuffer = class EncoderBuffer extends BufferWithExtensions {
12
- /** The current offset in the buffer where the next write operation will occur. */
13
- offset;
14
- /**
15
- * Shared buffer is used to encode strings, to avoid allocating a new buffer
16
- * for each string. The shared buffer is resized if the string is larger than
17
- * the current size of the shared buffer. This helps to improve performance by
18
- * reducing memory allocations and garbage collection overhead.
19
- */
20
- sharedBuffer;
21
- /**
22
- * Determines whether the keys of a map should be sorted before encoding.
23
- * Sorting keys can be useful for ensuring consistent serialization of
24
- * objects, which is important for tasks like hashing or comparing serialized
25
- * data.
26
- */
27
- sortKeys;
28
- /**
29
- * If true, forces the encoder to use 32-bit floating point representation for
30
- * numbers, even if they could be represented as 64-bit floats. This can be
31
- * useful for reducing the size of the encoded data when high precision is not
32
- * required. However, it may lead to loss of precision for very large or very
33
- * small numbers.
34
- */
35
- forceFloat32;
36
- /**
37
- * A function that creates a new buffer of the specified size. This function
38
- * is used to allocate new buffers when the current buffer is not large enough
39
- * to accommodate the data being written. The function should return a new
40
- * instance of TBuffer with the specified size.
41
- */
42
- newBufferFn;
43
- textEncoder;
44
- buffer;
45
- view;
46
- /**
47
- * The extension buffer is used to encode extension types. It is a separate
48
- * buffer from the main buffer, and is used to encode the extension data
49
- * before writing it to the main buffer. This allows for efficient encoding of
50
- * extension types, as the extension data can be encoded in a separate buffer
51
- * and then written to the main buffer in a single operation.
52
- *
53
- * The extension buffer must be resized using ensureCapacity before writing to
54
- * it, to ensure that there is enough space for the extension data.
55
- */
56
- #extensionBuffer;
57
- constructor(options) {
58
- super();
59
- this.offset = 0;
60
- this.textEncoder = options?.textEncoder ?? new DefaultTextEncoder();
61
- this.newBufferFn = options?.newBufferFn ?? defaultNewBufferFn;
62
- this.buffer = this.newBufferFn(options?.initialBufferSize ?? 1024);
63
- this.sharedBuffer = this.newBufferFn(options?.initialSharedBufferSize ?? 1024);
64
- this.view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
65
- this.sortKeys = options?.sortKeys ?? false;
66
- this.forceFloat32 = options?.forceFloat32 ?? false;
67
- }
68
- getExtensionBuffer() {
69
- if (!this.#extensionBuffer) this.#extensionBuffer = new EncoderBuffer({
70
- initialBufferSize: this.sharedBuffer.byteLength,
71
- initialSharedBufferSize: 0,
72
- newBufferFn: this.newBufferFn,
73
- sortKeys: this.sortKeys,
74
- textEncoder: this.textEncoder
75
- });
76
- return this.#extensionBuffer;
77
- }
78
- resizeBuffer(newSize) {
79
- const newBuffer = this.newBufferFn(newSize);
80
- newBuffer.set(this.buffer);
81
- this.buffer = newBuffer;
82
- this.view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
83
- return this;
84
- }
85
- ensureCapacity(sizeToWrite) {
86
- const required = this.offset + sizeToWrite;
87
- if (this.buffer.byteLength < required) this.resizeBuffer(required * 2);
88
- return this;
89
- }
90
- resetBuffer() {
91
- this.offset = 0;
92
- return this;
93
- }
94
- flush() {
95
- const buffer = this.buffer.subarray(0, this.offset);
96
- this.resetBuffer();
97
- return buffer;
98
- }
99
- writePositiveFixInt(value) {
100
- this.writeUint8(value);
101
- return this;
102
- }
103
- writeNegativeFixInt(value) {
104
- this.buffer[this.offset++] = value + 256;
105
- return this;
106
- }
107
- writeBin(bytes) {
108
- this.buffer.set(bytes, this.offset);
109
- this.offset += bytes.length;
110
- return this;
111
- }
112
- writeFloat32(value) {
113
- this.view.setFloat32(this.offset, value);
114
- this.offset += 4;
115
- return this;
116
- }
117
- writeFloat64(value) {
118
- this.view.setFloat64(this.offset, value);
119
- this.offset += 8;
120
- return this;
121
- }
122
- writeUint8(value) {
123
- this.buffer[this.offset++] = value;
124
- return this;
125
- }
126
- writeUint16(value) {
127
- this.view.setUint16(this.offset, value);
128
- this.offset += 2;
129
- return this;
130
- }
131
- writeUint32(value) {
132
- this.view.setUint32(this.offset, value);
133
- this.offset += 4;
134
- return this;
135
- }
136
- writeUint64(value) {
137
- const high = value / 4294967296;
138
- const low = value;
139
- this.view.setUint32(this.offset, high);
140
- this.offset += 4;
141
- this.view.setUint32(this.offset, low);
142
- this.offset += 4;
143
- return this;
144
- }
145
- writeInt8(value) {
146
- this.view.setInt8(this.offset++, value & 255);
147
- return this;
148
- }
149
- writeInt16(value) {
150
- this.view.setInt16(this.offset, value);
151
- this.offset += 2;
152
- return this;
153
- }
154
- writeInt32(value) {
155
- this.view.setInt32(this.offset, value);
156
- this.offset += 4;
157
- return this;
158
- }
159
- writeInt64(value) {
160
- const high = Math.floor(value / 4294967296);
161
- const low = value;
162
- this.view.setInt32(this.offset, high);
163
- this.offset += 4;
164
- this.view.setInt32(this.offset, low);
165
- this.offset += 4;
166
- return this;
167
- }
168
- writeStr(value) {
169
- this.offset += this.textEncoder.writeBytes(value, this.buffer);
170
- return this;
171
- }
172
- writeNilSymbol() {
173
- this.buffer[this.offset++] = Symbols.NIL;
174
- return this;
175
- }
176
- writeFalseSymbol() {
177
- this.buffer[this.offset++] = Symbols.FALSE;
178
- return this;
179
- }
180
- writeTrueSymbol() {
181
- this.buffer[this.offset++] = Symbols.TRUE;
182
- return this;
183
- }
184
- writeFixMapSymbol(keysSize) {
185
- this.buffer[this.offset++] = Symbols.FIXMAP_START | keysSize;
186
- return this;
187
- }
188
- writeFixArraySymbol(arraySize) {
189
- this.buffer[this.offset++] = Symbols.FIXARRAY_START | arraySize;
190
- return this;
191
- }
192
- writeFixStrSymbol(byteLength) {
193
- this.buffer[this.offset++] = Symbols.FIXSTR_START | byteLength;
194
- return this;
195
- }
196
- writeBin8Symbol(size) {
197
- this.buffer[this.offset++] = Symbols.BIN8;
198
- this.buffer[this.offset++] = size;
199
- return this;
200
- }
201
- writeBin16Symbol(size) {
202
- this.buffer[this.offset++] = Symbols.BIN16;
203
- this.view.setUint16(this.offset, size);
204
- this.offset += 2;
205
- return this;
206
- }
207
- writeBin32Symbol(size) {
208
- this.buffer[this.offset++] = Symbols.BIN32;
209
- this.view.setUint32(this.offset, size);
210
- this.offset += 4;
211
- return this;
212
- }
213
- writeFloat32Symbol() {
214
- this.buffer[this.offset++] = Symbols.FLOAT32;
215
- return this;
216
- }
217
- writeFloat64Symbol() {
218
- this.buffer[this.offset++] = Symbols.FLOAT64;
219
- return this;
220
- }
221
- writeUint8Symbol() {
222
- this.buffer[this.offset++] = Symbols.UINT8;
223
- return this;
224
- }
225
- writeUint16Symbol() {
226
- this.buffer[this.offset++] = Symbols.UINT16;
227
- return this;
228
- }
229
- writeUint32Symbol() {
230
- this.buffer[this.offset++] = Symbols.UINT32;
231
- return this;
232
- }
233
- writeUint64Symbol() {
234
- this.buffer[this.offset++] = Symbols.UINT64;
235
- return this;
236
- }
237
- writeInt8Symbol() {
238
- this.buffer[this.offset++] = Symbols.INT8;
239
- return this;
240
- }
241
- writeInt16Symbol() {
242
- this.buffer[this.offset++] = Symbols.INT16;
243
- return this;
244
- }
245
- writeInt32Symbol() {
246
- this.buffer[this.offset++] = Symbols.INT32;
247
- return this;
248
- }
249
- writeInt64Symbol() {
250
- this.buffer[this.offset++] = Symbols.INT64;
251
- return this;
252
- }
253
- writeStr8Symbol(size) {
254
- this.buffer[this.offset++] = Symbols.STR8;
255
- this.buffer[this.offset++] = size;
256
- return this;
257
- }
258
- writeStr16Symbol(size) {
259
- this.buffer[this.offset++] = Symbols.STR16;
260
- this.view.setUint16(this.offset, size);
261
- this.offset += 2;
262
- return this;
263
- }
264
- writeStr32Symbol(size) {
265
- this.buffer[this.offset++] = Symbols.STR32;
266
- this.view.setUint32(this.offset, size);
267
- this.offset += 4;
268
- return this;
269
- }
270
- writeArray16Symbol(size) {
271
- this.buffer[this.offset++] = Symbols.ARRAY16;
272
- this.view.setUint16(this.offset, size);
273
- this.offset += 2;
274
- return this;
275
- }
276
- writeArray32Symbol(size) {
277
- this.buffer[this.offset++] = Symbols.ARRAY32;
278
- this.view.setUint32(this.offset, size);
279
- this.offset += 4;
280
- return this;
281
- }
282
- writeMap16Symbol(size) {
283
- this.buffer[this.offset++] = Symbols.MAP16;
284
- this.view.setUint16(this.offset, size);
285
- this.offset += 2;
286
- return this;
287
- }
288
- writeMap32Symbol(size) {
289
- this.buffer[this.offset++] = Symbols.MAP32;
290
- this.view.setUint32(this.offset, size);
291
- this.offset += 4;
292
- return this;
293
- }
294
- writeFixExt1Symbol(type) {
295
- this.buffer[this.offset++] = Symbols.FIXEXT1;
296
- this.buffer[this.offset++] = type;
297
- return this;
298
- }
299
- writeFixExt2Symbol(type) {
300
- this.buffer[this.offset++] = Symbols.FIXEXT2;
301
- this.buffer[this.offset++] = type;
302
- return this;
303
- }
304
- writeFixExt4Symbol(type) {
305
- this.buffer[this.offset++] = Symbols.FIXEXT4;
306
- this.buffer[this.offset++] = type;
307
- return this;
308
- }
309
- writeFixExt8Symbol(type) {
310
- this.buffer[this.offset++] = Symbols.FIXEXT8;
311
- this.buffer[this.offset++] = type;
312
- return this;
313
- }
314
- writeFixExt16Symbol(type) {
315
- this.buffer[this.offset++] = Symbols.FIXEXT16;
316
- this.buffer[this.offset++] = type;
317
- return this;
318
- }
319
- writeExt8Symbol(type, size) {
320
- this.buffer[this.offset++] = Symbols.EXT8;
321
- this.buffer[this.offset++] = size;
322
- this.buffer[this.offset++] = type;
323
- return this;
324
- }
325
- writeExt16Symbol(type, size) {
326
- this.buffer[this.offset++] = Symbols.EXT16;
327
- this.view.setUint16(this.offset, size);
328
- this.offset += 2;
329
- this.buffer[this.offset++] = type;
330
- return this;
331
- }
332
- writeExt32Symbol(type, size) {
333
- this.buffer[this.offset++] = Symbols.EXT32;
334
- this.view.setUint32(this.offset, size);
335
- this.offset += 4;
336
- this.buffer[this.offset++] = type;
337
- return this;
338
- }
339
- writeString(value) {
340
- const valueLength = value.length;
341
- const requiredSize = value.length * 4;
342
- if (valueLength < 51) {
343
- this.ensureCapacity(1 + requiredSize);
344
- const initialoffset = this.offset;
345
- const byteLengthoffset = this.offset++;
346
- let totalBytes = 0;
347
- let fitInFixStr = true;
348
- let fitInStr8 = true;
349
- let { offset } = this;
350
- for (let index = 0; index < valueLength; index++) {
351
- const code = value.charCodeAt(index);
352
- if (code < 128) {
353
- this.buffer[offset++] = code;
354
- totalBytes++;
355
- } else if (code < 2048) {
356
- this.buffer[offset++] = 192 | code >> 6;
357
- this.buffer[offset++] = 128 | code & 63;
358
- totalBytes += 2;
359
- } else if (code < 55296 || code >= 57344) {
360
- this.buffer[offset++] = 224 | code >> 12;
361
- this.buffer[offset++] = 128 | code >> 6 & 63;
362
- this.buffer[offset++] = 128 | code & 63;
363
- totalBytes += 3;
364
- } else {
365
- index++;
366
- const nextCode = value.charCodeAt(index);
367
- const surrogatePair = ((code & 1023) << 10 | nextCode & 1023) + 65536;
368
- this.buffer[offset++] = 240 | surrogatePair >> 18;
369
- this.buffer[offset++] = 128 | surrogatePair >> 12 & 63;
370
- this.buffer[offset++] = 128 | surrogatePair >> 6 & 63;
371
- this.buffer[offset++] = 128 | surrogatePair & 63;
372
- totalBytes += 4;
373
- }
374
- if (totalBytes > 31) fitInFixStr = false;
375
- else if (totalBytes > 255) {
376
- fitInStr8 = false;
377
- break;
378
- }
379
- }
380
- if (fitInFixStr) {
381
- this.buffer[byteLengthoffset] = Symbols.FIXSTR_START | totalBytes;
382
- this.offset += totalBytes;
383
- return this;
384
- } else if (fitInStr8) {
385
- this.buffer[byteLengthoffset] = Symbols.STR8;
386
- const totalBytesPosition = byteLengthoffset + 1;
387
- this.buffer.copyWithin(totalBytesPosition + 1, totalBytesPosition, offset);
388
- this.buffer[totalBytesPosition] = totalBytes;
389
- this.offset++;
390
- this.offset += totalBytes;
391
- return this;
392
- }
393
- this.offset = initialoffset;
394
- }
395
- if (this.sharedBuffer.byteLength < requiredSize) this.sharedBuffer = this.newBufferFn(requiredSize);
396
- const { sharedBuffer } = this;
397
- const byteLength = this.textEncoder.writeBytes(value, sharedBuffer);
398
- if (fitIn8Bits(byteLength)) {
399
- this.ensureCapacity(2 + byteLength);
400
- this.writeStr8Symbol(byteLength);
401
- } else if (fitIn16Bits(byteLength)) {
402
- this.ensureCapacity(3 + byteLength);
403
- this.writeStr16Symbol(byteLength);
404
- } else {
405
- this.ensureCapacity(5 + byteLength);
406
- this.writeStr32Symbol(byteLength);
407
- }
408
- this.writeBin(sharedBuffer.subarray(0, byteLength));
409
- return this;
410
- }
411
- writeNumber(value) {
412
- if (Number.isInteger(value)) {
413
- if (value < 0) {
414
- if (value > -33) {
415
- this.ensureCapacity(1);
416
- return this.writeNegativeFixInt(value);
417
- } else if (value > -129) {
418
- this.ensureCapacity(2);
419
- this.writeInt8Symbol();
420
- return this.writeInt8(value);
421
- } else if (value > -32769) {
422
- this.ensureCapacity(3);
423
- this.writeInt16Symbol();
424
- return this.writeInt16(value);
425
- } else if (value > -2147483649) {
426
- this.ensureCapacity(5);
427
- this.writeInt32Symbol();
428
- return this.writeInt32(value);
429
- } else if (value >= INT64_MIN) {
430
- this.ensureCapacity(9);
431
- this.writeInt64Symbol();
432
- return this.writeInt64(value);
433
- }
434
- throw new Error(`Integer too small to encode: ${value}. Consider using BigIntExtension.`);
435
- } else {
436
- if (fitIn7Bits(value)) {
437
- this.ensureCapacity(1);
438
- return this.writePositiveFixInt(value);
439
- }
440
- if (fitIn8Bits(value)) {
441
- this.ensureCapacity(2);
442
- this.writeUint8Symbol();
443
- return this.writeUint8(value);
444
- }
445
- if (fitIn16Bits(value)) {
446
- this.ensureCapacity(3);
447
- this.writeUint16Symbol();
448
- return this.writeUint16(value);
449
- }
450
- if (fitIn32Bits(value)) {
451
- this.ensureCapacity(5);
452
- this.writeUint32Symbol();
453
- return this.writeUint32(value);
454
- }
455
- if (value <= UINT64_MAX) {
456
- this.ensureCapacity(9);
457
- this.writeUint64Symbol();
458
- return this.writeUint64(value);
459
- }
460
- throw new Error(`Integer too large to encode: ${value}. Consider using BigIntExtension.`);
461
- }
462
- } else if (this.forceFloat32) {
463
- this.ensureCapacity(5);
464
- this.writeFloat32Symbol();
465
- this.writeFloat32(value);
466
- } else {
467
- this.ensureCapacity(9);
468
- this.writeFloat64Symbol();
469
- this.writeFloat64(value);
470
- }
471
- return this;
472
- }
473
- writeMap(value) {
474
- const keys = Object.keys(value);
475
- if (this.sortKeys) keys.sort();
476
- const keysLength = keys.length;
477
- const requiredSize = keysLength * 4;
478
- if (keysLength < 16) {
479
- this.ensureCapacity(requiredSize + 1);
480
- this.writeFixMapSymbol(keysLength);
481
- } else if (fitIn16Bits(keysLength)) {
482
- this.ensureCapacity(requiredSize + 3);
483
- this.writeMap16Symbol(keysLength);
484
- } else if (fitIn32Bits(keysLength)) {
485
- this.ensureCapacity(requiredSize + 5);
486
- this.writeMap32Symbol(keysLength);
487
- } else throw new Error(`Map too large to encode: ${keysLength} keys`);
488
- for (const key of keys) {
489
- this.write(key);
490
- this.write(value[key]);
491
- }
492
- return this;
493
- }
494
- writeArray(value) {
495
- const length = value.length;
496
- const requiredSize = length * 4;
497
- if (length < 16) {
498
- this.ensureCapacity(requiredSize + 1);
499
- this.writeFixArraySymbol(length);
500
- } else if (fitIn16Bits(length)) {
501
- this.ensureCapacity(requiredSize + 3);
502
- this.writeArray16Symbol(length);
503
- } else if (fitIn32Bits(length)) {
504
- this.ensureCapacity(requiredSize + 5);
505
- this.writeArray32Symbol(length);
506
- } else throw new Error(`Array too large to encode: ${length}`);
507
- for (let index = 0; index < length; ++index) this.write(value[index]);
508
- return this;
509
- }
510
- writeUint8Array(value) {
511
- if (fitIn8Bits(value.length)) {
512
- this.ensureCapacity(2 + value.length);
513
- this.writeBin8Symbol(value.length);
514
- } else if (fitIn16Bits(value.length)) {
515
- this.ensureCapacity(3 + value.length);
516
- this.writeBin16Symbol(value.length);
517
- } else if (fitIn32Bits(value.length)) {
518
- this.ensureCapacity(5 + value.length);
519
- this.writeBin32Symbol(value.length);
520
- } else throw new Error(`Uint8Array too large to encode: ${value.length}`);
521
- return this.writeBin(value);
522
- }
523
- writeExtension(extension, buffer) {
524
- const writtenBytes = buffer.offset;
525
- if (writtenBytes === 1) {
526
- this.ensureCapacity(3);
527
- this.writeFixExt1Symbol(extension.type);
528
- } else if (writtenBytes === 2) {
529
- this.ensureCapacity(4);
530
- this.writeFixExt2Symbol(extension.type);
531
- } else if (writtenBytes === 4) {
532
- this.ensureCapacity(6);
533
- this.writeFixExt4Symbol(extension.type);
534
- } else if (writtenBytes === 8) {
535
- this.ensureCapacity(10);
536
- this.writeFixExt8Symbol(extension.type);
537
- } else if (writtenBytes === 16) {
538
- this.ensureCapacity(18);
539
- this.writeFixExt16Symbol(extension.type);
540
- } else if (fitIn8Bits(writtenBytes)) {
541
- this.ensureCapacity(3 + writtenBytes);
542
- this.writeExt8Symbol(extension.type, writtenBytes);
543
- } else if (fitIn16Bits(writtenBytes)) {
544
- this.ensureCapacity(4 + writtenBytes);
545
- this.writeExt16Symbol(extension.type, writtenBytes);
546
- } else if (fitIn32Bits(writtenBytes)) {
547
- this.ensureCapacity(6 + writtenBytes);
548
- this.writeExt32Symbol(extension.type, writtenBytes);
549
- } else throw new Error(`Extension data too large to encode: ${writtenBytes} bytes`);
550
- this.buffer.set(buffer.buffer.subarray(0, writtenBytes), this.offset);
551
- this.offset += writtenBytes;
552
- return this;
553
- }
554
- tryToWriteExtensionValue(value) {
555
- if (this.extensions.size > 0) {
556
- const iterator = this.extensions.values();
557
- const extensionBuffer = this.getExtensionBuffer();
558
- for (const extension of iterator) {
559
- extensionBuffer.resetBuffer();
560
- extension.encode(value, extensionBuffer);
561
- if (extensionBuffer.offset > 0) {
562
- this.writeExtension(extension, extensionBuffer);
563
- return extensionBuffer.offset;
564
- }
565
- }
566
- }
567
- return 0;
568
- }
569
- writeBigInt(value) {
570
- if (this.tryToWriteExtensionValue(value) > 0) return this;
571
- throw new TypeError("\"bigint\" encoding is not supported by default. Consider using BigIntExtension");
572
- }
573
- writeObject(value) {
574
- if (Array.isArray(value)) return this.writeArray(value);
575
- if (this.tryToWriteExtensionValue(value) > 0) return this;
576
- if (value instanceof Uint8Array) return this.writeUint8Array(value);
577
- return this.writeMap(value);
578
- }
579
- write(value) {
580
- switch (typeof value) {
581
- case "number": return this.writeNumber(value);
582
- case "string": return this.writeString(value);
583
- case "boolean":
584
- this.ensureCapacity(1);
585
- if (value) return this.writeTrueSymbol();
586
- return this.writeFalseSymbol();
587
- case "undefined":
588
- this.ensureCapacity(1);
589
- return this.writeNilSymbol();
590
- case "bigint": return this.writeBigInt(value);
591
- case "object":
592
- if (value === null) {
593
- this.ensureCapacity(1);
594
- return this.writeNilSymbol();
595
- }
596
- return this.writeObject(value);
597
- default: throw new TypeError(`Unsupported type for encoding: ${typeof value}. Consider using an extension.`);
598
- }
599
- }
600
- };
601
- //#endregion
602
- export { EncoderBuffer as default };
603
-
604
- //# sourceMappingURL=encoderBuffer.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"encoderBuffer.mjs","names":["#extensionBuffer"],"sources":["../../../src/encoder/encoderBuffer.ts"],"sourcesContent":["// oxlint-disable unicorn/prefer-code-point\nimport BufferWithExtensions from '../bufferWithExtensions.ts';\nimport {\n DEFAULT_ALLOCATION_SIZE,\n INT64_MIN,\n UINT64_MAX,\n} from '../constants.ts';\nimport defaultNewBufferFn from '../defaultNewBufferFn.ts';\nimport type MessagePackExtension from '../extensions/interfaces/messagePackExtension.ts';\nimport Symbols from '../symbols.ts';\nimport type { NewBufferFn } from '../types.ts';\nimport fitIn7Bits from '../utils/fitIn7Bits.ts';\nimport fitIn8Bits from '../utils/fitIn8Bits.ts';\nimport fitIn16Bits from '../utils/fitIn16Bits.ts';\nimport fitIn32Bits from '../utils/fitIn32Bits.ts';\nimport type {\n MessagePackEncoderBuffer,\n MessagePackTextEncoder,\n} from './interfaces/index.ts';\nimport DefaultTextEncoder from './textEncoders/defaultTextEncoder.ts';\nimport type { EncoderBufferOptions, ExtensionEncoderBuffer } from './types.ts';\n\nclass EncoderBuffer<TBuffer extends Uint8Array = Uint8Array>\n extends BufferWithExtensions<TBuffer>\n implements MessagePackEncoderBuffer<TBuffer>\n{\n /** The current offset in the buffer where the next write operation will occur. */\n offset: number;\n\n /**\n * Shared buffer is used to encode strings, to avoid allocating a new buffer\n * for each string. The shared buffer is resized if the string is larger than\n * the current size of the shared buffer. This helps to improve performance by\n * reducing memory allocations and garbage collection overhead.\n */\n protected sharedBuffer: TBuffer;\n\n /**\n * Determines whether the keys of a map should be sorted before encoding.\n * Sorting keys can be useful for ensuring consistent serialization of\n * objects, which is important for tasks like hashing or comparing serialized\n * data.\n */\n readonly sortKeys: boolean;\n\n /**\n * If true, forces the encoder to use 32-bit floating point representation for\n * numbers, even if they could be represented as 64-bit floats. This can be\n * useful for reducing the size of the encoded data when high precision is not\n * required. However, it may lead to loss of precision for very large or very\n * small numbers.\n */\n readonly forceFloat32: boolean;\n\n /**\n * A function that creates a new buffer of the specified size. This function\n * is used to allocate new buffers when the current buffer is not large enough\n * to accommodate the data being written. The function should return a new\n * instance of TBuffer with the specified size.\n */\n protected newBufferFn: NewBufferFn<TBuffer>;\n\n readonly textEncoder: MessagePackTextEncoder<TBuffer>;\n\n buffer: TBuffer;\n view: DataView;\n\n /**\n * The extension buffer is used to encode extension types. It is a separate\n * buffer from the main buffer, and is used to encode the extension data\n * before writing it to the main buffer. This allows for efficient encoding of\n * extension types, as the extension data can be encoded in a separate buffer\n * and then written to the main buffer in a single operation.\n *\n * The extension buffer must be resized using ensureCapacity before writing to\n * it, to ensure that there is enough space for the extension data.\n */\n #extensionBuffer?: EncoderBuffer<TBuffer>;\n\n constructor(options?: Partial<EncoderBufferOptions<TBuffer>>) {\n super();\n\n this.offset = 0;\n this.textEncoder = options?.textEncoder ?? new DefaultTextEncoder();\n\n this.newBufferFn = options?.newBufferFn ?? defaultNewBufferFn<TBuffer>;\n\n this.buffer = this.newBufferFn(\n options?.initialBufferSize ?? DEFAULT_ALLOCATION_SIZE,\n );\n this.sharedBuffer = this.newBufferFn(\n options?.initialSharedBufferSize ?? DEFAULT_ALLOCATION_SIZE,\n );\n this.view = new DataView(\n this.buffer.buffer,\n this.buffer.byteOffset,\n this.buffer.byteLength,\n );\n\n this.sortKeys = options?.sortKeys ?? false;\n this.forceFloat32 = options?.forceFloat32 ?? false;\n }\n\n getExtensionBuffer(): EncoderBuffer<TBuffer> {\n if (!this.#extensionBuffer) {\n this.#extensionBuffer = new EncoderBuffer<TBuffer>({\n initialBufferSize: this.sharedBuffer.byteLength,\n initialSharedBufferSize: 0,\n newBufferFn: this.newBufferFn,\n sortKeys: this.sortKeys,\n textEncoder: this.textEncoder,\n });\n }\n\n return this.#extensionBuffer;\n }\n\n resizeBuffer(newSize: number): this {\n const newBuffer = this.newBufferFn(newSize);\n\n newBuffer.set(this.buffer);\n\n this.buffer = newBuffer;\n this.view = new DataView(\n this.buffer.buffer,\n this.buffer.byteOffset,\n this.buffer.byteLength,\n );\n\n return this;\n }\n\n ensureCapacity(sizeToWrite: number): this {\n const required = this.offset + sizeToWrite;\n\n if (this.buffer.byteLength < required) {\n this.resizeBuffer(required * 2);\n }\n\n return this;\n }\n\n resetBuffer(): this {\n this.offset = 0;\n\n return this;\n }\n\n flush(): TBuffer {\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion\n const buffer = this.buffer.subarray(0, this.offset) as TBuffer;\n\n this.resetBuffer();\n\n return buffer;\n }\n\n writePositiveFixInt(value: number): this {\n this.writeUint8(value);\n\n return this;\n }\n\n writeNegativeFixInt(value: number): this {\n // this.buffer[this.offset++] = NEGATIVE_FIXINT_START | (value + 32);\n this.buffer[this.offset++] = value + 0x1_00;\n\n return this;\n }\n\n writeBin(bytes: Uint8Array): this {\n this.buffer.set(bytes, this.offset);\n\n this.offset += bytes.length;\n\n return this;\n }\n\n writeFloat32(value: number): this {\n this.view.setFloat32(this.offset, value);\n this.offset += 4;\n\n return this;\n }\n\n writeFloat64(value: number): this {\n this.view.setFloat64(this.offset, value);\n this.offset += 8;\n\n return this;\n }\n\n writeUint8(value: number): this {\n this.buffer[this.offset++] = value;\n\n return this;\n }\n\n writeUint16(value: number): this {\n this.view.setUint16(this.offset, value);\n this.offset += 2;\n\n return this;\n }\n\n writeUint32(value: number): this {\n this.view.setUint32(this.offset, value);\n this.offset += 4;\n\n return this;\n }\n\n writeUint64(value: number): this {\n const high = value / 0x1_00_00_00_00;\n const low = value;\n\n this.view.setUint32(this.offset, high);\n this.offset += 4;\n\n this.view.setUint32(this.offset, low);\n this.offset += 4;\n\n return this;\n }\n\n writeInt8(value: number): this {\n this.view.setInt8(this.offset++, value & 0xff);\n\n return this;\n }\n\n writeInt16(value: number): this {\n this.view.setInt16(this.offset, value);\n this.offset += 2;\n\n return this;\n }\n\n writeInt32(value: number): this {\n this.view.setInt32(this.offset, value);\n this.offset += 4;\n\n return this;\n }\n\n writeInt64(value: number): this {\n const high = Math.floor(value / 0x1_00_00_00_00);\n const low = value;\n\n this.view.setInt32(this.offset, high);\n this.offset += 4;\n this.view.setInt32(this.offset, low);\n this.offset += 4;\n\n return this;\n }\n\n // writeBigInt64(value: bigint): this {\n // this.view.setBigInt64(this.offset, value);\n // this.offset += 8;\n\n // return this;\n // }\n\n // writeBigUint64(value: bigint): this {\n // this.view.setBigUint64(this.offset, value);\n // this.offset += 8;\n\n // return this;\n // }\n\n writeStr(value: string): this {\n this.offset += this.textEncoder.writeBytes(value, this.buffer);\n\n return this;\n }\n\n writeNilSymbol(): this {\n this.buffer[this.offset++] = Symbols.NIL;\n\n return this;\n }\n\n writeFalseSymbol(): this {\n this.buffer[this.offset++] = Symbols.FALSE;\n\n return this;\n }\n\n writeTrueSymbol(): this {\n this.buffer[this.offset++] = Symbols.TRUE;\n\n return this;\n }\n\n writeFixMapSymbol(keysSize: number): this {\n this.buffer[this.offset++] = Symbols.FIXMAP_START | keysSize;\n\n return this;\n }\n\n writeFixArraySymbol(arraySize: number): this {\n this.buffer[this.offset++] = Symbols.FIXARRAY_START | arraySize;\n\n return this;\n }\n\n writeFixStrSymbol(byteLength: number): this {\n this.buffer[this.offset++] = Symbols.FIXSTR_START | byteLength;\n\n return this;\n }\n\n writeBin8Symbol(size: number): this {\n this.buffer[this.offset++] = Symbols.BIN8;\n this.buffer[this.offset++] = size;\n\n return this;\n }\n\n writeBin16Symbol(size: number): this {\n this.buffer[this.offset++] = Symbols.BIN16;\n this.view.setUint16(this.offset, size);\n this.offset += 2;\n\n return this;\n }\n\n writeBin32Symbol(size: number): this {\n this.buffer[this.offset++] = Symbols.BIN32;\n this.view.setUint32(this.offset, size);\n this.offset += 4;\n\n return this;\n }\n\n writeFloat32Symbol(): this {\n this.buffer[this.offset++] = Symbols.FLOAT32;\n\n return this;\n }\n\n writeFloat64Symbol(): this {\n this.buffer[this.offset++] = Symbols.FLOAT64;\n\n return this;\n }\n\n writeUint8Symbol(): this {\n this.buffer[this.offset++] = Symbols.UINT8;\n\n return this;\n }\n\n writeUint16Symbol(): this {\n this.buffer[this.offset++] = Symbols.UINT16;\n\n return this;\n }\n\n writeUint32Symbol(): this {\n this.buffer[this.offset++] = Symbols.UINT32;\n\n return this;\n }\n\n writeUint64Symbol(): this {\n this.buffer[this.offset++] = Symbols.UINT64;\n\n return this;\n }\n\n writeInt8Symbol(): this {\n this.buffer[this.offset++] = Symbols.INT8;\n\n return this;\n }\n\n writeInt16Symbol(): this {\n this.buffer[this.offset++] = Symbols.INT16;\n\n return this;\n }\n\n writeInt32Symbol(): this {\n this.buffer[this.offset++] = Symbols.INT32;\n\n return this;\n }\n\n writeInt64Symbol(): this {\n this.buffer[this.offset++] = Symbols.INT64;\n\n return this;\n }\n\n writeStr8Symbol(size: number): this {\n this.buffer[this.offset++] = Symbols.STR8;\n this.buffer[this.offset++] = size;\n\n return this;\n }\n\n writeStr16Symbol(size: number): this {\n this.buffer[this.offset++] = Symbols.STR16;\n this.view.setUint16(this.offset, size);\n\n this.offset += 2;\n\n return this;\n }\n\n writeStr32Symbol(size: number): this {\n this.buffer[this.offset++] = Symbols.STR32;\n this.view.setUint32(this.offset, size);\n\n this.offset += 4;\n\n return this;\n }\n\n writeArray16Symbol(size: number): this {\n this.buffer[this.offset++] = Symbols.ARRAY16;\n this.view.setUint16(this.offset, size);\n\n this.offset += 2;\n\n return this;\n }\n\n writeArray32Symbol(size: number): this {\n this.buffer[this.offset++] = Symbols.ARRAY32;\n this.view.setUint32(this.offset, size);\n\n this.offset += 4;\n\n return this;\n }\n\n writeMap16Symbol(size: number): this {\n this.buffer[this.offset++] = Symbols.MAP16;\n this.view.setUint16(this.offset, size);\n\n this.offset += 2;\n\n return this;\n }\n\n writeMap32Symbol(size: number): this {\n this.buffer[this.offset++] = Symbols.MAP32;\n this.view.setUint32(this.offset, size);\n\n this.offset += 4;\n\n return this;\n }\n\n writeFixExt1Symbol(type: number): this {\n this.buffer[this.offset++] = Symbols.FIXEXT1;\n this.buffer[this.offset++] = type;\n\n return this;\n }\n\n writeFixExt2Symbol(type: number): this {\n this.buffer[this.offset++] = Symbols.FIXEXT2;\n this.buffer[this.offset++] = type;\n\n return this;\n }\n\n writeFixExt4Symbol(type: number): this {\n this.buffer[this.offset++] = Symbols.FIXEXT4;\n this.buffer[this.offset++] = type;\n\n return this;\n }\n\n writeFixExt8Symbol(type: number): this {\n this.buffer[this.offset++] = Symbols.FIXEXT8;\n this.buffer[this.offset++] = type;\n\n return this;\n }\n\n writeFixExt16Symbol(type: number): this {\n this.buffer[this.offset++] = Symbols.FIXEXT16;\n this.buffer[this.offset++] = type;\n\n return this;\n }\n\n writeExt8Symbol(type: number, size: number): this {\n this.buffer[this.offset++] = Symbols.EXT8;\n this.buffer[this.offset++] = size;\n this.buffer[this.offset++] = type;\n\n return this;\n }\n\n writeExt16Symbol(type: number, size: number): this {\n this.buffer[this.offset++] = Symbols.EXT16;\n\n this.view.setUint16(this.offset, size);\n this.offset += 2;\n\n this.buffer[this.offset++] = type;\n\n return this;\n }\n\n writeExt32Symbol(type: number, size: number): this {\n this.buffer[this.offset++] = Symbols.EXT32;\n\n this.view.setUint32(this.offset, size);\n this.offset += 4;\n\n this.buffer[this.offset++] = type;\n\n return this;\n }\n\n writeString(value: string): this {\n const valueLength = value.length;\n const requiredSize = value.length * 4;\n\n // optimization for short strings, to avoid the overhead of using\n // a text encoder for small strings\n if (valueLength < 51) {\n this.ensureCapacity(1 + requiredSize);\n\n const initialoffset = this.offset;\n const byteLengthoffset = this.offset++;\n let totalBytes = 0;\n let fitInFixStr = true;\n let fitInStr8 = true;\n let { offset } = this;\n\n for (let index = 0; index < valueLength; index++) {\n const code = value.charCodeAt(index);\n\n if (code < 0x80) {\n this.buffer[offset++] = code;\n totalBytes++;\n } else if (code < 0x8_00) {\n this.buffer[offset++] = 0xc0 | (code >> 6);\n this.buffer[offset++] = 0x80 | (code & 0x3f);\n totalBytes += 2;\n } else if (code < 0xd8_00 || code >= 0xe0_00) {\n this.buffer[offset++] = 0xe0 | (code >> 12);\n this.buffer[offset++] = 0x80 | ((code >> 6) & 0x3f);\n this.buffer[offset++] = 0x80 | (code & 0x3f);\n totalBytes += 3;\n } else {\n // surrogate pair\n index++;\n const nextCode = value.charCodeAt(index);\n\n const surrogatePair =\n (((code & 0x3_ff) << 10) | (nextCode & 0x3_ff)) + 0x1_00_00;\n\n this.buffer[offset++] = 0xf0 | (surrogatePair >> 18);\n this.buffer[offset++] = 0x80 | ((surrogatePair >> 12) & 0x3f);\n this.buffer[offset++] = 0x80 | ((surrogatePair >> 6) & 0x3f);\n this.buffer[offset++] = 0x80 | (surrogatePair & 0x3f);\n totalBytes += 4;\n }\n\n if (totalBytes > 31) {\n fitInFixStr = false;\n } else if (totalBytes > 255) {\n fitInStr8 = false;\n break;\n }\n }\n\n if (fitInFixStr) {\n this.buffer[byteLengthoffset] = Symbols.FIXSTR_START | totalBytes;\n\n this.offset += totalBytes;\n\n return this;\n } else if (fitInStr8) {\n this.buffer[byteLengthoffset] = Symbols.STR8;\n\n const totalBytesPosition = byteLengthoffset + 1;\n\n this.buffer.copyWithin(\n totalBytesPosition + 1,\n totalBytesPosition,\n offset,\n );\n\n this.buffer[totalBytesPosition] = totalBytes;\n this.offset++;\n\n this.offset += totalBytes;\n return this;\n }\n // fallback\n this.offset = initialoffset;\n }\n\n if (this.sharedBuffer.byteLength < requiredSize) {\n this.sharedBuffer = this.newBufferFn(requiredSize);\n }\n\n const { sharedBuffer } = this;\n\n const byteLength = this.textEncoder.writeBytes(value, sharedBuffer);\n\n if (fitIn8Bits(byteLength)) {\n this.ensureCapacity(2 + byteLength);\n this.writeStr8Symbol(byteLength);\n } else if (fitIn16Bits(byteLength)) {\n this.ensureCapacity(3 + byteLength);\n this.writeStr16Symbol(byteLength);\n } else {\n this.ensureCapacity(5 + byteLength);\n this.writeStr32Symbol(byteLength);\n }\n\n this.writeBin(sharedBuffer.subarray(0, byteLength));\n\n return this;\n }\n\n writeNumber(value: number): this {\n if (Number.isInteger(value)) {\n if (value < 0) {\n // siged integers\n if (value > -33) {\n this.ensureCapacity(1);\n return this.writeNegativeFixInt(value);\n } else if (value > -129) {\n this.ensureCapacity(2);\n this.writeInt8Symbol();\n return this.writeInt8(value);\n } else if (value > -32_769) {\n this.ensureCapacity(3);\n this.writeInt16Symbol();\n return this.writeInt16(value);\n } else if (value > -2_147_483_649) {\n this.ensureCapacity(5);\n this.writeInt32Symbol();\n return this.writeInt32(value);\n } else if (value >= INT64_MIN) {\n this.ensureCapacity(9);\n this.writeInt64Symbol();\n return this.writeInt64(value);\n }\n\n throw new Error(\n `Integer too small to encode: ${value}. Consider using BigIntExtension.`,\n );\n } else {\n // unsiged integers\n if (fitIn7Bits(value)) {\n this.ensureCapacity(1);\n return this.writePositiveFixInt(value);\n }\n\n if (fitIn8Bits(value)) {\n this.ensureCapacity(2);\n this.writeUint8Symbol();\n return this.writeUint8(value);\n }\n\n if (fitIn16Bits(value)) {\n this.ensureCapacity(3);\n this.writeUint16Symbol();\n return this.writeUint16(value);\n }\n\n if (fitIn32Bits(value)) {\n this.ensureCapacity(5);\n this.writeUint32Symbol();\n return this.writeUint32(value);\n }\n\n if (value <= UINT64_MAX) {\n this.ensureCapacity(9);\n this.writeUint64Symbol();\n return this.writeUint64(value);\n }\n\n throw new Error(\n `Integer too large to encode: ${value}. Consider using BigIntExtension.`,\n );\n }\n } else if (this.forceFloat32) {\n this.ensureCapacity(5);\n this.writeFloat32Symbol();\n this.writeFloat32(value);\n } else {\n this.ensureCapacity(9);\n this.writeFloat64Symbol();\n this.writeFloat64(value);\n }\n\n return this;\n }\n\n writeMap<TKey extends string | number, TValue>(\n value: Record<TKey, TValue>,\n ): this {\n const keys = Object.keys(value);\n\n if (this.sortKeys) {\n keys.sort();\n }\n\n const keysLength = keys.length;\n const requiredSize = keysLength * 4;\n\n if (keysLength < 16) {\n this.ensureCapacity(requiredSize + 1);\n this.writeFixMapSymbol(keysLength);\n } else if (fitIn16Bits(keysLength)) {\n this.ensureCapacity(requiredSize + 3);\n this.writeMap16Symbol(keysLength);\n } else if (fitIn32Bits(keysLength)) {\n this.ensureCapacity(requiredSize + 5);\n this.writeMap32Symbol(keysLength);\n } else {\n throw new Error(`Map too large to encode: ${keysLength} keys`);\n }\n\n for (const key of keys) {\n this.write(key);\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion\n this.write(value[key as TKey]);\n }\n\n return this;\n }\n\n writeArray(value: unknown[]): this {\n const length = value.length;\n const requiredSize = length * 4;\n\n if (length < 16) {\n this.ensureCapacity(requiredSize + 1);\n this.writeFixArraySymbol(length);\n } else if (fitIn16Bits(length)) {\n this.ensureCapacity(requiredSize + 3);\n this.writeArray16Symbol(length);\n } else if (fitIn32Bits(length)) {\n this.ensureCapacity(requiredSize + 5);\n this.writeArray32Symbol(length);\n } else {\n throw new Error(`Array too large to encode: ${length}`);\n }\n\n for (let index = 0; index < length; ++index) {\n this.write(value[index]);\n }\n\n return this;\n }\n\n // writeBigInt(value: bigint): this {\n // this.ensureCapacity(9);\n\n // if (value < 0n) {\n // this.writeInt64Symbol();\n // return this.writeBigInt64(value);\n // }\n\n // this.writeUint64Symbol();\n // return this.writeBigUint64(value);\n // }\n\n writeUint8Array(value: Uint8Array): this {\n if (fitIn8Bits(value.length)) {\n this.ensureCapacity(2 + value.length);\n this.writeBin8Symbol(value.length);\n } else if (fitIn16Bits(value.length)) {\n this.ensureCapacity(3 + value.length);\n this.writeBin16Symbol(value.length);\n } else if (fitIn32Bits(value.length)) {\n this.ensureCapacity(5 + value.length);\n this.writeBin32Symbol(value.length);\n } else {\n throw new Error(`Uint8Array too large to encode: ${value.length}`);\n }\n\n return this.writeBin(value);\n }\n\n writeExtension(\n extension: MessagePackExtension,\n buffer: ExtensionEncoderBuffer<TBuffer>,\n ): this {\n const writtenBytes = buffer.offset;\n\n if (writtenBytes === 1) {\n this.ensureCapacity(3);\n\n this.writeFixExt1Symbol(extension.type);\n } else if (writtenBytes === 2) {\n this.ensureCapacity(4);\n\n this.writeFixExt2Symbol(extension.type);\n } else if (writtenBytes === 4) {\n this.ensureCapacity(6);\n\n this.writeFixExt4Symbol(extension.type);\n } else if (writtenBytes === 8) {\n this.ensureCapacity(10);\n\n this.writeFixExt8Symbol(extension.type);\n } else if (writtenBytes === 16) {\n this.ensureCapacity(18);\n\n this.writeFixExt16Symbol(extension.type);\n } else if (fitIn8Bits(writtenBytes)) {\n this.ensureCapacity(3 + writtenBytes);\n\n this.writeExt8Symbol(extension.type, writtenBytes);\n } else if (fitIn16Bits(writtenBytes)) {\n this.ensureCapacity(4 + writtenBytes);\n\n this.writeExt16Symbol(extension.type, writtenBytes);\n } else if (fitIn32Bits(writtenBytes)) {\n this.ensureCapacity(6 + writtenBytes);\n\n this.writeExt32Symbol(extension.type, writtenBytes);\n } else {\n throw new Error(\n `Extension data too large to encode: ${writtenBytes} bytes`,\n );\n }\n\n this.buffer.set(buffer.buffer.subarray(0, writtenBytes), this.offset);\n\n this.offset += writtenBytes;\n\n return this;\n }\n\n tryToWriteExtensionValue(value: object | bigint): number {\n if (this.extensions.size > 0) {\n const iterator = this.extensions.values();\n const extensionBuffer = this.getExtensionBuffer();\n\n for (const extension of iterator) {\n extensionBuffer.resetBuffer();\n\n extension.encode(value, extensionBuffer);\n\n if (extensionBuffer.offset > 0) {\n this.writeExtension(extension, extensionBuffer);\n\n return extensionBuffer.offset;\n }\n }\n }\n\n return 0;\n }\n\n writeBigInt(value: bigint): this {\n const writtenBytes = this.tryToWriteExtensionValue(value);\n\n if (writtenBytes > 0) {\n return this;\n }\n\n throw new TypeError(\n '\"bigint\" encoding is not supported by default. Consider using BigIntExtension',\n );\n }\n\n writeObject(value: object): this {\n if (Array.isArray(value)) {\n return this.writeArray(value);\n }\n\n const writtenBytes = this.tryToWriteExtensionValue(value);\n\n if (writtenBytes > 0) {\n return this;\n }\n\n if (value instanceof Uint8Array) {\n return this.writeUint8Array(value);\n }\n\n return this.writeMap(value);\n }\n\n write(value: unknown): this {\n // oxlint-disable-next-line typescript/switch-exhaustiveness-check\n switch (typeof value) {\n case 'number': {\n return this.writeNumber(value);\n }\n case 'string': {\n return this.writeString(value);\n }\n case 'boolean': {\n this.ensureCapacity(1);\n\n if (value) {\n return this.writeTrueSymbol();\n }\n\n return this.writeFalseSymbol();\n }\n case 'undefined': {\n this.ensureCapacity(1);\n return this.writeNilSymbol();\n }\n case 'bigint': {\n return this.writeBigInt(value);\n }\n case 'object': {\n if (value === null) {\n this.ensureCapacity(1);\n return this.writeNilSymbol();\n }\n\n return this.writeObject(value);\n }\n default: {\n throw new TypeError(\n `Unsupported type for encoding: ${typeof value}. Consider using an extension.`,\n );\n }\n }\n }\n}\n\nexport default EncoderBuffer;\n"],"mappings":";;;;;;;;;;AAsBA,IAAM,gBAAN,MAAM,sBACI,qBAEV;;CAEE;;;;;;;CAQA;;;;;;;CAQA;;;;;;;;CASA;;;;;;;CAQA;CAEA;CAEA;CACA;;;;;;;;;;;CAYA;CAEA,YAAY,SAAkD;EAC5D,MAAM;EAEN,KAAK,SAAS;EACd,KAAK,cAAc,SAAS,eAAe,IAAI,mBAAmB;EAElE,KAAK,cAAc,SAAS,eAAe;EAE3C,KAAK,SAAS,KAAK,YACjB,SAAS,qBAAA,IACX;EACA,KAAK,eAAe,KAAK,YACvB,SAAS,2BAAA,IACX;EACA,KAAK,OAAO,IAAI,SACd,KAAK,OAAO,QACZ,KAAK,OAAO,YACZ,KAAK,OAAO,UACd;EAEA,KAAK,WAAW,S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F,OAAO,KAAK,gBAAgB;IAG9B,OAAO,KAAK,iBAAiB;GAE/B,KAAK;IACH,KAAK,eAAe,CAAC;IACrB,OAAO,KAAK,eAAe;GAE7B,KAAK,UACH,OAAO,KAAK,YAAY,KAAK;GAE/B,KAAK;IACH,IAAI,UAAU,MAAM;KAClB,KAAK,eAAe,CAAC;KACrB,OAAO,KAAK,eAAe;IAC7B;IAEA,OAAO,KAAK,YAAY,KAAK;GAE/B,SACE,MAAM,IAAI,UACR,kCAAkC,OAAO,MAAM,+BACjD;EAEJ;CACF;AACF"}
@@ -1,2 +0,0 @@
1
- import { n as MessagePackEncoderBuffer } from "../../messagePackExtension-5TI02KG6.mjs";
2
- export { MessagePackEncoderBuffer as default };