@mavogel/awscdk-rootmail 0.1.24 → 0.1.26

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 (252) hide show
  1. package/.jsii +9 -9
  2. package/lib/rootmail.js +1 -1
  3. package/lib/ses-receive.js +1 -1
  4. package/lib/ses-receive.ops-santa-handler.js +2 -2
  5. package/node_modules/@aws-sdk/checksums/package.json +3 -3
  6. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-cjs/index.js +9 -7
  7. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-es/schemas/schemas_0.js +11 -6
  8. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/commands/DescribeDeliveriesCommand.d.ts +3 -0
  9. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/commands/DescribeDeliveryDestinationsCommand.d.ts +3 -0
  10. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/commands/DescribeDeliverySourcesCommand.d.ts +3 -0
  11. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/commands/PutResourcePolicyCommand.d.ts +1 -1
  12. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/models/models_0.d.ts +27 -1
  13. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/ts3.4/models/models_0.d.ts +3 -0
  14. package/node_modules/@aws-sdk/client-cloudwatch-logs/package.json +4 -4
  15. package/node_modules/@aws-sdk/client-route-53/dist-cjs/index.js +1 -1
  16. package/node_modules/@aws-sdk/client-route-53/package.json +4 -4
  17. package/node_modules/@aws-sdk/client-s3/dist-cjs/index.js +1 -1
  18. package/node_modules/@aws-sdk/client-s3/package.json +7 -7
  19. package/node_modules/@aws-sdk/client-ses/dist-cjs/index.js +1 -1
  20. package/node_modules/@aws-sdk/client-ses/package.json +4 -4
  21. package/node_modules/@aws-sdk/client-ssm/dist-cjs/index.js +1 -1
  22. package/node_modules/@aws-sdk/client-ssm/package.json +4 -4
  23. package/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js +94 -1589
  24. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/index.js +1 -7
  25. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsJsonRpcProtocol.js +1 -3
  26. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsRestJsonProtocol.js +1 -3
  27. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/index.d.ts +2 -8
  28. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsJson1_0Protocol.d.ts +1 -2
  29. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsJson1_1Protocol.d.ts +1 -2
  30. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsJsonRpcProtocol.d.ts +2 -3
  31. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsRestJsonProtocol.d.ts +2 -3
  32. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/index.d.ts +10 -10
  33. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsJson1_0Protocol.d.ts +1 -2
  34. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsJson1_1Protocol.d.ts +1 -2
  35. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsJsonRpcProtocol.d.ts +2 -3
  36. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsRestJsonProtocol.d.ts +2 -3
  37. package/node_modules/@aws-sdk/core/package.json +2 -2
  38. package/node_modules/@aws-sdk/credential-provider-env/package.json +3 -3
  39. package/node_modules/@aws-sdk/credential-provider-http/package.json +3 -3
  40. package/node_modules/@aws-sdk/credential-provider-ini/package.json +10 -10
  41. package/node_modules/@aws-sdk/credential-provider-login/package.json +4 -4
  42. package/node_modules/@aws-sdk/credential-provider-node/package.json +8 -8
  43. package/node_modules/@aws-sdk/credential-provider-process/package.json +3 -3
  44. package/node_modules/@aws-sdk/credential-provider-sso/package.json +5 -5
  45. package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +4 -4
  46. package/node_modules/@aws-sdk/middleware-sdk-s3/package.json +3 -3
  47. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +1 -1
  48. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +1 -1
  49. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +1 -1
  50. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +1 -1
  51. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +1 -1
  52. package/node_modules/@aws-sdk/nested-clients/package.json +3 -3
  53. package/node_modules/@aws-sdk/token-providers/dist-cjs/index.js +37 -19
  54. package/node_modules/@aws-sdk/token-providers/dist-es/fromSso.js +37 -19
  55. package/node_modules/@aws-sdk/token-providers/package.json +4 -4
  56. package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +1695 -3
  57. package/node_modules/@smithy/core/dist-es/submodules/protocols/ConfigurableSerdeContext.js +6 -0
  58. package/node_modules/@smithy/core/dist-es/submodules/protocols/UnionSerde.js +26 -0
  59. package/node_modules/@smithy/core/dist-es/submodules/protocols/common.js +3 -0
  60. package/node_modules/@smithy/core/dist-es/submodules/protocols/index.js +8 -0
  61. package/node_modules/@smithy/core/dist-es/submodules/protocols/json/SmithyRpcV2JsonProtocol.js +102 -0
  62. package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/codec-v1/JsonShapeDeserializer.js +8 -1
  63. package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/codec-v1/JsonShapeSerializer.js +8 -1
  64. package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.js +13 -2
  65. package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/codec-v2/JsonShapeSerializer2.js +11 -1
  66. package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/parseJsonBody.js +16 -1
  67. package/node_modules/@smithy/core/dist-es/submodules/protocols/writeKey.js +3 -0
  68. package/node_modules/@smithy/core/dist-types/submodules/protocols/ConfigurableSerdeContext.d.ts +8 -0
  69. package/node_modules/@smithy/core/dist-types/submodules/protocols/UnionSerde.d.ts +24 -0
  70. package/node_modules/@smithy/core/dist-types/submodules/protocols/common.d.ts +2 -0
  71. package/node_modules/@smithy/core/dist-types/submodules/protocols/index.d.ts +9 -0
  72. package/node_modules/@smithy/core/dist-types/submodules/protocols/json/JsonSettings.d.ts +13 -0
  73. package/node_modules/@smithy/core/dist-types/submodules/protocols/json/SmithyRpcV2JsonProtocol.d.ts +28 -0
  74. package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/parseJsonBody.d.ts +16 -0
  75. package/node_modules/@smithy/core/dist-types/submodules/protocols/writeKey.d.ts +4 -0
  76. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/ConfigurableSerdeContext.d.ts +8 -0
  77. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/UnionSerde.d.ts +24 -0
  78. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/common.d.ts +2 -0
  79. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/index.d.ts +9 -0
  80. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/JsonSettings.d.ts +13 -0
  81. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/SmithyRpcV2JsonProtocol.d.ts +28 -0
  82. package/node_modules/{@aws-sdk → @smithy}/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonCodec.d.ts +15 -11
  83. package/node_modules/{@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json → @smithy/core/dist-types/ts3.4/submodules/protocols/json/codec-v1}/JsonSettings.d.ts +7 -4
  84. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonShapeDeserializer.d.ts +14 -0
  85. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonShapeSerializer.d.ts +29 -0
  86. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.d.ts +51 -0
  87. package/node_modules/{@aws-sdk → @smithy}/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonCodec2.d.ts +13 -9
  88. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.d.ts +30 -0
  89. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonShapeSerializer2.d.ts +60 -0
  90. package/node_modules/{@aws-sdk → @smithy}/core/dist-types/ts3.4/submodules/protocols/json/detectBufferParsing.d.ts +1 -1
  91. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/jsonReplacer.d.ts +21 -0
  92. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/jsonReviver.d.ts +15 -0
  93. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/needsReviver.d.ts +11 -0
  94. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/parseJsonBody.d.ts +38 -0
  95. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/writeKey.d.ts +4 -0
  96. package/node_modules/@smithy/core/package.json +2 -1
  97. package/node_modules/@zone-eu/mailsplit/README.md +43 -54
  98. package/node_modules/@zone-eu/mailsplit/lib/headers.js +10 -4
  99. package/node_modules/@zone-eu/mailsplit/lib/message-splitter.js +5 -4
  100. package/node_modules/@zone-eu/mailsplit/lib/mime-node.d.ts +4 -1
  101. package/node_modules/@zone-eu/mailsplit/lib/mime-node.js +30 -5
  102. package/node_modules/@zone-eu/mailsplit/lib/types.d.ts +3 -1
  103. package/node_modules/@zone-eu/mailsplit/package.json +22 -17
  104. package/node_modules/libbase64/CHANGELOG.md +20 -0
  105. package/node_modules/libbase64/README.md +40 -13
  106. package/node_modules/libbase64/dist/cjs/libbase64.d.ts +80 -0
  107. package/node_modules/libbase64/dist/cjs/libbase64.js +310 -0
  108. package/node_modules/libbase64/dist/cjs/package.json +3 -0
  109. package/node_modules/libbase64/dist/esm/libbase64.d.ts +80 -0
  110. package/node_modules/libbase64/{lib → dist/esm}/libbase64.js +74 -117
  111. package/node_modules/libbase64/dist/esm/package.json +3 -0
  112. package/node_modules/libbase64/package.json +59 -13
  113. package/node_modules/libmime/CHANGELOG.md +38 -0
  114. package/node_modules/libmime/README.md +55 -26
  115. package/node_modules/libmime/SECURITY.md +152 -0
  116. package/node_modules/libmime/dist/cjs/charset.d.ts +43 -0
  117. package/node_modules/libmime/dist/cjs/charset.js +135 -0
  118. package/node_modules/libmime/dist/cjs/charsets.d.ts +2 -0
  119. package/node_modules/libmime/dist/cjs/charsets.js +213 -0
  120. package/node_modules/libmime/dist/cjs/get-charset-name.d.ts +1 -0
  121. package/node_modules/libmime/dist/cjs/get-charset-name.js +224 -0
  122. package/node_modules/libmime/dist/cjs/libmime.d.ts +218 -0
  123. package/node_modules/libmime/dist/cjs/libmime.js +1027 -0
  124. package/node_modules/libmime/dist/cjs/mimetypes.d.ts +7 -0
  125. package/node_modules/libmime/dist/cjs/mimetypes.js +2072 -0
  126. package/node_modules/libmime/dist/cjs/package.json +3 -0
  127. package/node_modules/libmime/dist/cjs/types.d.ts +59 -0
  128. package/node_modules/libmime/dist/cjs/types.js +4 -0
  129. package/node_modules/libmime/dist/esm/charset.d.ts +43 -0
  130. package/node_modules/libmime/dist/esm/charset.js +125 -0
  131. package/node_modules/libmime/dist/esm/charsets.d.ts +2 -0
  132. package/node_modules/libmime/{lib → dist/esm}/charsets.js +3 -5
  133. package/node_modules/libmime/dist/esm/get-charset-name.d.ts +1 -0
  134. package/node_modules/libmime/{lib → dist/esm}/get-charset-name.js +1 -8
  135. package/node_modules/libmime/dist/esm/libmime.d.ts +219 -0
  136. package/node_modules/libmime/{lib → dist/esm}/libmime.js +275 -334
  137. package/node_modules/libmime/dist/esm/mimetypes.d.ts +7 -0
  138. package/node_modules/libmime/dist/esm/mimetypes.js +2068 -0
  139. package/node_modules/libmime/dist/esm/package.json +3 -0
  140. package/node_modules/libmime/dist/esm/types.d.ts +59 -0
  141. package/node_modules/libmime/dist/esm/types.js +3 -0
  142. package/node_modules/libmime/package.json +60 -15
  143. package/node_modules/libqp/CHANGELOG.md +18 -0
  144. package/node_modules/libqp/README.md +50 -19
  145. package/node_modules/libqp/dist/cjs/libqp.d.ts +74 -0
  146. package/node_modules/libqp/dist/cjs/libqp.js +378 -0
  147. package/node_modules/libqp/dist/cjs/package.json +3 -0
  148. package/node_modules/libqp/dist/esm/libqp.d.ts +74 -0
  149. package/node_modules/libqp/dist/esm/libqp.js +369 -0
  150. package/node_modules/libqp/dist/esm/package.json +3 -0
  151. package/node_modules/libqp/lib/libqp.js +4 -383
  152. package/node_modules/libqp/lib/package.json +3 -0
  153. package/node_modules/libqp/package.json +62 -6
  154. package/node_modules/mailparser/CHANGELOG.md +56 -0
  155. package/node_modules/mailparser/README.md +6 -0
  156. package/node_modules/mailparser/dist/cjs/index.d.ts +10 -0
  157. package/node_modules/mailparser/dist/cjs/index.js +12 -0
  158. package/node_modules/mailparser/dist/cjs/mail-parser.d.ts +98 -0
  159. package/node_modules/mailparser/dist/cjs/mail-parser.js +1419 -0
  160. package/node_modules/mailparser/dist/cjs/package.json +3 -0
  161. package/node_modules/mailparser/dist/cjs/simple-parser.d.ts +17 -0
  162. package/node_modules/mailparser/dist/cjs/simple-parser.js +133 -0
  163. package/node_modules/mailparser/dist/cjs/stream-hash.d.ts +24 -0
  164. package/node_modules/mailparser/dist/cjs/stream-hash.js +33 -0
  165. package/node_modules/mailparser/dist/cjs/tlds.cjs +8 -0
  166. package/node_modules/mailparser/dist/cjs/types.d.ts +309 -0
  167. package/node_modules/mailparser/dist/cjs/types.js +2 -0
  168. package/node_modules/mailparser/dist/esm/index.d.ts +10 -0
  169. package/node_modules/mailparser/dist/esm/index.js +4 -0
  170. package/node_modules/mailparser/dist/esm/mail-parser.d.ts +98 -0
  171. package/node_modules/mailparser/{lib → dist/esm}/mail-parser.js +302 -368
  172. package/node_modules/mailparser/dist/esm/package.json +3 -0
  173. package/node_modules/mailparser/dist/esm/simple-parser.d.ts +17 -0
  174. package/node_modules/mailparser/{lib → dist/esm}/simple-parser.js +45 -68
  175. package/node_modules/mailparser/dist/esm/stream-hash.d.ts +24 -0
  176. package/node_modules/mailparser/{lib → dist/esm}/stream-hash.js +7 -9
  177. package/node_modules/mailparser/dist/esm/tlds.cjs +8 -0
  178. package/node_modules/mailparser/dist/esm/types.d.ts +309 -0
  179. package/node_modules/mailparser/dist/esm/types.js +1 -0
  180. package/node_modules/mailparser/package.json +88 -17
  181. package/node_modules/nodemailer/CHANGELOG.md +44 -0
  182. package/node_modules/nodemailer/dist/cjs/addressparser/index.js +695 -267
  183. package/node_modules/nodemailer/dist/cjs/mailer/mail-message.js +4 -1
  184. package/node_modules/nodemailer/dist/cjs/mime-funcs/index.js +8 -2
  185. package/node_modules/nodemailer/dist/cjs/mime-node/index.js +48 -16
  186. package/node_modules/nodemailer/dist/cjs/package-info.d.ts +1 -1
  187. package/node_modules/nodemailer/dist/cjs/package-info.js +1 -1
  188. package/node_modules/nodemailer/dist/cjs/shared/url.js +22 -5
  189. package/node_modules/nodemailer/dist/esm/addressparser/index.js +695 -267
  190. package/node_modules/nodemailer/dist/esm/mailer/mail-message.js +4 -1
  191. package/node_modules/nodemailer/dist/esm/mime-funcs/index.js +8 -2
  192. package/node_modules/nodemailer/dist/esm/mime-node/index.js +48 -16
  193. package/node_modules/nodemailer/dist/esm/package-info.d.ts +1 -1
  194. package/node_modules/nodemailer/dist/esm/package-info.js +1 -1
  195. package/node_modules/nodemailer/dist/esm/shared/url.js +22 -5
  196. package/node_modules/nodemailer/package.json +1 -1
  197. package/package.json +9 -9
  198. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/codec-v1/JsonSettings.d.ts +0 -7
  199. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonSettings.d.ts +0 -4
  200. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonShapeDeserializer.d.ts +0 -13
  201. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonShapeSerializer.d.ts +0 -18
  202. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.d.ts +0 -27
  203. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.d.ts +0 -15
  204. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonShapeSerializer2.d.ts +0 -39
  205. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/jsonReplacer.d.ts +0 -7
  206. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/jsonReviver.d.ts +0 -7
  207. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/needsReviver.d.ts +0 -2
  208. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/parseJsonBody.d.ts +0 -14
  209. package/node_modules/libbase64/.eslintrc +0 -11
  210. package/node_modules/libbase64/.github/FUNDING.yml +0 -4
  211. package/node_modules/libbase64/.github/VULNERABILITY_REPORT.yml +0 -75
  212. package/node_modules/libbase64/.github/workflows/release.yaml +0 -39
  213. package/node_modules/libbase64/.github/workflows/test.yml +0 -21
  214. package/node_modules/libbase64/.ncurc.js +0 -13
  215. package/node_modules/libbase64/.prettierrc.js +0 -8
  216. package/node_modules/libmime/lib/charset.js +0 -131
  217. package/node_modules/libmime/lib/mimetypes.js +0 -2049
  218. package/node_modules/libqp/.eslintrc +0 -15
  219. package/node_modules/libqp/.github/FUNDING.yml +0 -4
  220. package/node_modules/libqp/.github/VULNERABILITY_REPORT.yml +0 -75
  221. package/node_modules/libqp/.github/workflows/release.yaml +0 -39
  222. package/node_modules/libqp/.github/workflows/test.yml +0 -21
  223. package/node_modules/libqp/.prettierrc.js +0 -8
  224. package/node_modules/libqp/test/libqp-test.js +0 -366
  225. package/node_modules/mailparser/.gitattributes +0 -1
  226. package/node_modules/mailparser/.prettierignore +0 -3
  227. package/node_modules/mailparser/.prettierrc.js +0 -10
  228. package/node_modules/mailparser/.release-please-manifest.json +0 -3
  229. package/node_modules/mailparser/eslint.config.js +0 -33
  230. package/node_modules/mailparser/index.js +0 -9
  231. package/node_modules/mailparser/release-please-config.json +0 -10
  232. /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/JsonSettings.js +0 -0
  233. /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/codec-v1/JsonCodec.js +0 -0
  234. /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/codec-v1/JsonSettings.js +0 -0
  235. /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.js +0 -0
  236. /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/codec-v2/JsonCodec2.js +0 -0
  237. /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/detectBufferParsing.js +0 -0
  238. /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/jsonReplacer.js +0 -0
  239. /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/jsonReviver.js +0 -0
  240. /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/needsReviver.js +0 -0
  241. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/codec-v1/JsonCodec.d.ts +0 -0
  242. /package/node_modules/{@aws-sdk/core/dist-types/submodules/protocols/json → @smithy/core/dist-types/submodules/protocols/json/codec-v1}/JsonSettings.d.ts +0 -0
  243. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/codec-v1/JsonShapeDeserializer.d.ts +0 -0
  244. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/codec-v1/JsonShapeSerializer.d.ts +0 -0
  245. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.d.ts +0 -0
  246. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/codec-v2/JsonCodec2.d.ts +0 -0
  247. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.d.ts +0 -0
  248. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/codec-v2/JsonShapeSerializer2.d.ts +0 -0
  249. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/detectBufferParsing.d.ts +0 -0
  250. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/jsonReplacer.d.ts +0 -0
  251. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/jsonReviver.d.ts +0 -0
  252. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/needsReviver.d.ts +0 -0
@@ -0,0 +1,29 @@
1
+ import { NormalizedSchema } from "@smithy/core/schema";
2
+ import { Schema, ShapeSerializer } from "@smithy/types";
3
+ import { SerdeContextConfig } from "../../ConfigurableSerdeContext";
4
+ import { JsonSettings } from "./JsonSettings";
5
+ /**
6
+ * @deprecated prefer byte-targeting JsonShapeSerializer or its string adapter StringJsonShapeSerializer in codec-v2.
7
+ * @public
8
+ */
9
+ export declare class JsonShapeSerializer extends SerdeContextConfig implements ShapeSerializer<string> {
10
+ readonly settings: JsonSettings;
11
+ /**
12
+ * Write buffer. Reused per value serialization pass.
13
+ * In the initial implementation, this is not an incremental buffer.
14
+ */
15
+ protected buffer: any;
16
+ protected useReplacer: boolean;
17
+ protected rootSchema: NormalizedSchema | undefined;
18
+ constructor(settings: JsonSettings);
19
+ write(schema: Schema, value: unknown): void;
20
+ flush(): string;
21
+ /**
22
+ * @internal
23
+ */
24
+ writeDiscriminatedDocument(schema: Schema, value: unknown): void;
25
+ /**
26
+ * Order if-statements by likelihood.
27
+ */
28
+ protected _write(schema: Schema, value: unknown, container?: NormalizedSchema): any;
29
+ }
@@ -0,0 +1,51 @@
1
+ /**
2
+ * A Uint8Array subclass holding serialized JSON bytes that provides
3
+ * string method compatibility for customer middleware.
4
+ *
5
+ * Middleware historically observed `request.body` as a string for JSON
6
+ * protocol services. This class preserves that contract: string methods
7
+ * and coercion (template literals, `+` operator) lazily decode the bytes
8
+ * to a cached string. The HTTP transport layer still sees a Uint8Array
9
+ * and sends raw bytes without conversion.
10
+ *
11
+ * @internal
12
+ * @deprecated this adapter will be removed in a future version.
13
+ */
14
+ export declare class JsonBytesStringAdapter extends Uint8Array {
15
+ private string;
16
+ static allocUnsafe(bytes: number): JsonBytesStringAdapter;
17
+ /**
18
+ * Enables string coercion via template literals and `+` operator.
19
+ */
20
+ toString(): string;
21
+ /**
22
+ * Enables string coercion in comparison and arithmetic contexts.
23
+ * @returns a string. The signature is set to avoid incompatibility with extending Uint8Array.
24
+ */
25
+ valueOf(): any;
26
+ includes(searchString: string | number, position?: number): boolean;
27
+ indexOf(searchString: string | number, position?: number): number;
28
+ lastIndexOf(searchString: string | number, position?: number): number;
29
+ startsWith(searchString: string, position?: number): boolean;
30
+ endsWith(searchString: string, endPosition?: number): boolean;
31
+ match(regexp: string | RegExp): RegExpMatchArray | null;
32
+ replace(searchValue: string | RegExp, replaceValue: string): string;
33
+ search(regexp: string | RegExp): number;
34
+ split(separator: string | RegExp, limit?: number): string[];
35
+ substring(start: number, end?: number): string;
36
+ trim(): string;
37
+ trimStart(): string;
38
+ trimEnd(): string;
39
+ charAt(pos: number): string;
40
+ charCodeAt(index: number): number;
41
+ padStart(maxLength: number, fillString?: string): string;
42
+ padEnd(maxLength: number, fillString?: string): string;
43
+ repeat(count: number): string;
44
+ toUpperCase(): string;
45
+ toLowerCase(): string;
46
+ /**
47
+ * Decodes the bytes to a UTF-8 string on first access, then caches.
48
+ * Subsequent calls return the cached string with zero cost.
49
+ */
50
+ private s;
51
+ }
@@ -1,9 +1,13 @@
1
- import { $ShapeSerializer, $Codec, $ShapeDeserializer } from "@smithy/types";
2
- import { SerdeContextConfig } from "../../ConfigurableSerdeContext";
3
- import { JsonSettings } from "../JsonSettings";
4
- export declare class JsonCodec2 extends SerdeContextConfig implements $Codec<Uint8Array, string> {
5
- readonly settings: JsonSettings;
6
- constructor(settings: JsonSettings);
7
- createSerializer(): $ShapeSerializer<Uint8Array>;
8
- createDeserializer(): $ShapeDeserializer<string>;
9
- }
1
+ import { $ShapeSerializer, $Codec, $ShapeDeserializer } from "@smithy/types";
2
+ import { SerdeContextConfig } from "../../ConfigurableSerdeContext";
3
+ import { JsonSettings } from "../JsonSettings";
4
+ /**
5
+ * Codec grouping the v2 serializer and deserializer.
6
+ * @public
7
+ */
8
+ export declare class JsonCodec2 extends SerdeContextConfig implements $Codec<Uint8Array, string> {
9
+ readonly settings: JsonSettings;
10
+ constructor(settings: JsonSettings);
11
+ createSerializer(): $ShapeSerializer<Uint8Array>;
12
+ createDeserializer(): $ShapeDeserializer<string>;
13
+ }
@@ -0,0 +1,30 @@
1
+ import { DocumentType, Schema, ShapeDeserializer } from "@smithy/types";
2
+ import { SerdeContextConfig } from "../../ConfigurableSerdeContext";
3
+ import { JsonSettings } from "../JsonSettings";
4
+ /**
5
+ * Performance-optimized JSON deserializer.
6
+ *
7
+ * Skips UTF-8 decoding when the runtime supports JSON.parse(Buffer) (Node 22+).
8
+ *
9
+ * After JSON.parse, lists, maps, and document containers are mutated in place
10
+ * (element values are overwritten with their deserialized form) rather than
11
+ * copied into new arrays/objects. Structs allocate a fresh object because
12
+ * jsonName traits require key renaming, and building the output object
13
+ * incrementally lets V8 assign a stable hidden class rather than
14
+ * deoptimizing from repeated property deletion/addition on an existing shape.
15
+ *
16
+ * In-place mutation is safe here because the parsed tree is locally owned
17
+ * after JSON.parse with no external references, so rewriting values avoids
18
+ * redundant allocation and GC pressure.
19
+ *
20
+ * @public
21
+ */
22
+ export declare class JsonShapeDeserializer2 extends SerdeContextConfig implements ShapeDeserializer<string> {
23
+ readonly settings: JsonSettings;
24
+ constructor(settings: JsonSettings);
25
+ read(schema: Schema, data: string | Uint8Array | unknown): Promise<any>;
26
+ readObject(schema: Schema, data: DocumentType): any;
27
+ protected _read(schema: Schema, value: unknown): any;
28
+ private _readStruct;
29
+ private needsTransform;
30
+ }
@@ -0,0 +1,60 @@
1
+ import { NormalizedSchema } from "@smithy/core/schema";
2
+ import { Schema, ShapeSerializer } from "@smithy/types";
3
+ import { SerdeContextConfig } from "../../ConfigurableSerdeContext";
4
+ import { JsonSettings } from "../JsonSettings";
5
+ /**
6
+ * Single-pass JSON serializer that writes directly to a Uint8Array buffer.
7
+ * Fewer intermediate states as when compared to the initial multi-pass implementation.
8
+ *
9
+ * @public
10
+ */
11
+ export declare class JsonShapeSerializer2 extends SerdeContextConfig implements ShapeSerializer<Uint8Array> {
12
+ readonly settings: JsonSettings;
13
+ private json;
14
+ private i;
15
+ private rootSchema;
16
+ private rawValue;
17
+ private passthrough;
18
+ constructor(settings: JsonSettings);
19
+ write(schema: Schema, value: unknown): void;
20
+ /**
21
+ * @internal
22
+ */
23
+ writeDiscriminatedDocument(schema: Schema, value: unknown): void;
24
+ /**
25
+ * Returns the serialized JSON as a Uint8Array (UTF-8 bytes).
26
+ * This is the primary output — pass directly to request.body.
27
+ */
28
+ flush(): Uint8Array;
29
+ protected ensure(byteCount: number): void;
30
+ /**
31
+ * Write a raw ASCII string (no JSON escaping). Used for pre-validated content
32
+ * like numeric literals and pre-encoded base64.
33
+ */
34
+ protected writeAscii(s: string): void;
35
+ /**
36
+ * Write a quoted ASCII string with no escape checking.
37
+ * Used for struct member keys (jsonName or model names) which are
38
+ * guaranteed to be safe ASCII identifiers. No control chars, quotes,
39
+ * backslashes, or non-ASCII.
40
+ * Ensures extra room for surrounding structural chars (comma, colon).
41
+ */
42
+ protected writeAsciiQuoted(s: string): void;
43
+ /**
44
+ * Write a JSON-escaped string including the surrounding quotes.
45
+ * Fast-path for ASCII, falls back to TextEncoder for multi-byte.
46
+ */
47
+ protected writeJsonString(s: string): void;
48
+ protected writeUnicodeEscape(code: number): void;
49
+ protected static readonly B64: Uint8Array;
50
+ /**
51
+ * Write a Uint8Array as a quoted base64 string directly into the buffer.
52
+ * No intermediate JS string, no escape checking (base64 alphabet is safe ASCII).
53
+ */
54
+ protected writeBase64(data: Uint8Array): void;
55
+ protected writeValue(schema: Schema, value: unknown, container: NormalizedSchema | undefined): void;
56
+ protected writeStruct(ns: NormalizedSchema, value: Record<string, unknown>): void;
57
+ protected writeList(ns: NormalizedSchema, value: unknown[], isDocument?: boolean): void;
58
+ protected writeMap(ns: NormalizedSchema, value: Record<string, unknown>, isDocument?: boolean): void;
59
+ protected writeTimestamp(ns: NormalizedSchema, value: Date): void;
60
+ }
@@ -1 +1 @@
1
- export declare function detectBufferParsing(): boolean;
1
+ export declare function detectBufferParsing(): boolean;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Serializes BigInt and NumericValue to JSON-number.
3
+ * @internal
4
+ */
5
+ export declare class JsonReplacer {
6
+ /**
7
+ * Stores placeholder key to true serialized value lookup.
8
+ */
9
+ private readonly values;
10
+ private counter;
11
+ private stage;
12
+ /**
13
+ * Creates a jsonReplacer function that reserves big integer and big decimal values
14
+ * for later replacement.
15
+ */
16
+ createReplacer(): (key: string, value: unknown) => unknown;
17
+ /**
18
+ * Replaces placeholder keys with their true values.
19
+ */
20
+ replaceInJson(json: string): string;
21
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @param key - JSON object key.
3
+ * @param value - parsed value.
4
+ * @param context - original JSON string for reference. Not available until Node.js 21 and unavailable in Safari as
5
+ * of April 2025.
6
+ *
7
+ * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#browser_compatibility
8
+ *
9
+ * @internal
10
+ *
11
+ * @returns transformed value.
12
+ */
13
+ export declare function jsonReviver(key: string, value: any, context?: {
14
+ source?: string;
15
+ }): any;
@@ -0,0 +1,11 @@
1
+ import { Schema } from "@smithy/types";
2
+ /**
3
+ * Determines whether a schema tree contains BigInteger or BigDecimal members,
4
+ * which require a JSON.parse reviver to preserve numeric precision.
5
+ *
6
+ * The result is cached on the root static schema array (struct schemas) via a Symbol key,
7
+ * so subsequent calls for the same schema are O(1).
8
+ *
9
+ * @internal
10
+ */
11
+ export declare function needsReviver(schema: Schema): boolean;
@@ -0,0 +1,38 @@
1
+ import { HttpResponse, Schema, SerdeFunctions } from "@smithy/types";
2
+ /**
3
+ * @deprecated new calls to parseJsonBody must pass schema.
4
+ * @internal
5
+ */
6
+ export declare function parseJsonBody(streamBody: any, context: SerdeFunctions): Promise<any>;
7
+ /**
8
+ * @internal
9
+ */
10
+ export declare function parseJsonBody(streamBody: any, context: SerdeFunctions, schema: Schema): Promise<any>;
11
+ /**
12
+ * @internal
13
+ */
14
+ export declare const parseJsonErrorBody: (errorBody: any, context: SerdeFunctions) => Promise<any>;
15
+ /**
16
+ * @internal
17
+ */
18
+ export declare const loadRestJsonErrorCode: (output: HttpResponse, data: any) => string | undefined;
19
+ /**
20
+ * @internal
21
+ */
22
+ export declare const loadJsonRpcErrorCode: (output: HttpResponse, data: any, queryCompat?: boolean) => string | undefined;
23
+ /**
24
+ * Smithy RPCv2 JSON error identifier loader.
25
+ *
26
+ * Unlike {@link loadJsonRpcErrorCode} (used by AWS JSON 1.0/1.1 and restJson1),
27
+ * this preserves the ABSOLUTE shape id carried in `__type`. The RPCv2 JSON SEP
28
+ * requires `__type` to contain the fully-qualified shape id, and the protocol
29
+ * resolves errors by that absolute id to avoid ambiguous resolution when the
30
+ * same shape name exists in more than one namespace.
31
+ *
32
+ * It trims the Smithy-specific `,` fault/tag suffix and the `:` suffix, but does
33
+ * NOT strip the `#` namespace separator:
34
+ * "com.a.b#Error:Sender,tag" -> "com.a.b#Error"
35
+ *
36
+ * @internal
37
+ */
38
+ export declare const loadSmithyRpcV2JsonErrorCode: (output: HttpResponse, data: any) => string | undefined;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Makes __proto__ writable on a given object.
3
+ */
4
+ export declare function writeKey(obj: object | Record<string, unknown> | any): void;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/core",
3
- "version": "3.35.2",
3
+ "version": "3.36.0",
4
4
  "homepage": "https://github.com/smithy-lang/smithy-typescript/tree/main/packages/core",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -226,6 +226,7 @@
226
226
  "scripts": {
227
227
  "benchmark:cbor": "node ./scripts/cbor-perf.mjs",
228
228
  "benchmark:checksum": "node ./scripts/checksum-perf.mjs",
229
+ "benchmark:json": "npx tsx ./scripts/benchmark-json-serializer.ts",
229
230
  "benchmark:schema:cbor": "node ./scripts/cbor-shape-perf.mjs",
230
231
  "build": "concurrently 'yarn:build:types' 'yarn:build:es:cjs'",
231
232
  "build:es:cjs": "node ../../scripts/compilation/es_cjs.js",
@@ -29,9 +29,9 @@ let splitter = new Splitter(options);
29
29
 
30
30
  Where
31
31
 
32
- - **options** is an optional options object
33
- - **options.ignoreEmbedded** (boolean, defaults to false) if true then treat message/rfc822 node as normal leaf node and do not try to parse it
34
- - **options.maxHeadSize** (number, defaults to Infinity) limits message header size in bytes
32
+ - **options** is an optional options object
33
+ - **options.ignoreEmbedded** (boolean, defaults to false) if true then treat message/rfc822 node as normal leaf node and do not try to parse it
34
+ - **options.maxHeadSize** (number, defaults to 1 MiB) limits the header size of a MIME node in bytes, every header line counting for at least 64 bytes
35
35
 
36
36
  #### Events
37
37
 
@@ -39,13 +39,13 @@ Where
39
39
 
40
40
  #### Data objects
41
41
 
42
- - **type**
43
- - `'node'` means that we reached the next mime node and the previous one is completely processed
44
- - `'data'` provides us multipart body parts, including boundaries. This data is not directly related to any specific multipart node, basically it includes everything between the end of one normal node and the header of next node
45
- - `'body'` provides us next chunk for the last seen `'node'` element
46
- - **value** is a buffer value for `'body'` and `'data'` parts
47
- - **getDecoder()** is a function that returns a stream object you can use to decode node contents. Write data from 'body' to decoder and read decoded Buffer value out from it
48
- - **getEncoder()** is a function that returns a stream object you can use to encode node contents. Write buffer data to encoder and read encoded object value out that you can pass to a Joiner
42
+ - **type**
43
+ - `'node'` means that we reached the next mime node and the previous one is completely processed
44
+ - `'data'` provides us multipart body parts, including boundaries. This data is not directly related to any specific multipart node, basically it includes everything between the end of one normal node and the header of next node
45
+ - `'body'` provides us next chunk for the last seen `'node'` element
46
+ - **value** is a buffer value for `'body'` and `'data'` parts
47
+ - **getDecoder()** is a function that returns a stream object you can use to decode node contents. Write data from 'body' to decoder and read decoded Buffer value out from it
48
+ - **getEncoder()** is a function that returns a stream object you can use to encode node contents. Write buffer data to encoder and read encoded object value out that you can pass to a Joiner
49
49
 
50
50
  Element with type `'node'` has a bunch of header related methods and properties, see [below](#manipulating-headers).
51
51
 
@@ -82,31 +82,31 @@ someMessagStream.pipe(splitter);
82
82
 
83
83
  If the data object has `type='node'` then you can modify headers for that node (headers can be modified until the data object is passed over to a `Joiner`)
84
84
 
85
- - **node.getHeaders()** returns a Buffer value with generated headers. If you have not modified the headers object in any way then you should get the exact copy of the original. In case you have done something (for example removed a key, or added a new header key), then all linebreaks are forced to &lt;CR&gt;&lt;LF&gt; even if the original headers used just &lt;LF&gt;
86
- - **node.setContentType(contentType)** sets or updates mime type for the node
87
- - **node.setCharset(charset)** sets or updates character set in the Content-Type header
88
- - **node.setFilename(filename)** sets or updates filename in the Content-Disposition header (unicode allowed)
85
+ - **node.getHeaders()** returns a Buffer value with generated headers. If you have not modified the headers object in any way then you should get the exact copy of the original. In case you have done something (for example removed a key, or added a new header key), then all linebreaks are forced to &lt;CR&gt;&lt;LF&gt; even if the original headers used just &lt;LF&gt;
86
+ - **node.setContentType(contentType)** sets or updates mime type for the node
87
+ - **node.setCharset(charset)** sets or updates character set in the Content-Type header
88
+ - **node.setFilename(filename)** sets or updates filename in the Content-Disposition header (unicode allowed)
89
89
 
90
90
  You can manipulate specific header keys as well using the `headers` object
91
91
 
92
- - **node.headers.get(key)** returns an array of strings with all header rows for the selected key (these are full header lines, so key name is part of the row string, eg `["Subject: This is subject line"]`)
93
- - **node.headers.getFirst(key)** returns string value of the specified header key (eg `"This is subject line"`)
94
- - **node.headers.hasHeader(key)** returns boolean value if the specified header key exists
95
- - **node.headers.add(key, value [,index])** adds a new header value to the specified index or to the top of the header block if index is not specified
96
- - **node.headers.update(key, value, [,relativeKeyIndex])** replaces a header value to the specified relative key index (note that relative key index means relative to the same header key, eg if multiple exist and you specify `1` as the value, then it will update the second) or if no relative key index is specified, then it will remove all header value matches found for the key and append one at the last matching key index found with the specified value. If a relative key index is specified and it does not exist then it will be replaced (eg if there are two headers of `X-Foo-Bar` and you pass `2`, meaning it will update the third, no updates will be made since the third did not exist)
97
- - **node.headers.remove(key)** remove header value
98
- - **node.headers.mbox** If this is a MBOX formatted message then this value holds the prefix line (eg. "From MAILER-DAEMON Fri Jul 8 12:08:34 2011")
99
- - **node.headers.mbox** If this is a POST form-data then this value holds the HTTP prefix line (eg. "POST /upload.php HTTP/1.1")
92
+ - **node.headers.get(key)** returns an array of strings with all header rows for the selected key (these are full header lines, so key name is part of the row string, eg `["Subject: This is subject line"]`)
93
+ - **node.headers.getFirst(key)** returns string value of the specified header key (eg `"This is subject line"`)
94
+ - **node.headers.hasHeader(key)** returns boolean value if the specified header key exists
95
+ - **node.headers.add(key, value [,index])** adds a new header value to the specified index or to the top of the header block if index is not specified
96
+ - **node.headers.update(key, value, [,relativeKeyIndex])** replaces a header value to the specified relative key index (note that relative key index means relative to the same header key, eg if multiple exist and you specify `1` as the value, then it will update the second) or if no relative key index is specified, then it will remove all header value matches found for the key and append one at the last matching key index found with the specified value. If a relative key index is specified and it does not exist then it will be replaced (eg if there are two headers of `X-Foo-Bar` and you pass `2`, meaning it will update the third, no updates will be made since the third did not exist)
97
+ - **node.headers.remove(key)** remove header value
98
+ - **node.headers.mbox** If this is a MBOX formatted message then this value holds the prefix line (eg. "From MAILER-DAEMON Fri Jul 8 12:08:34 2011")
99
+ - **node.headers.mbox** If this is a POST form-data then this value holds the HTTP prefix line (eg. "POST /upload.php HTTP/1.1")
100
100
 
101
101
  Additionally you can check the details of the node with the following properties automatically parsed from the headers:
102
102
 
103
- - **node.root** if true then it means this is the message root, so this node should contain Subject, From, To etc. headers
104
- - **node.contentType** returns the mime type of the node (eg. 'text/html')
105
- - **node.disposition** either `'attachment'`, `'inline'` or `false` if not set
106
- - **node.charset** returns the charset of the node as defined in 'Content-Type' header (eg. 'UTF-8') or false if not defined
107
- - **node.encoding** returns the Transfer-Encoding value (eg. 'base64' or 'quoted-printable') or false if not defined
108
- - **node.multipart** if has value, then this is a multipart node (does not have 'body' parts)
109
- - **node.filename** is set if the headers contain a filename value. This is decoded to unicode, so it is a normal string or false if not found
103
+ - **node.root** if true then it means this is the message root, so this node should contain Subject, From, To etc. headers
104
+ - **node.contentType** returns the mime type of the node (eg. 'text/html')
105
+ - **node.disposition** either `'attachment'`, `'inline'` or `false` if not set
106
+ - **node.charset** returns the charset of the node as defined in 'Content-Type' header (eg. 'UTF-8') or false if not defined
107
+ - **node.encoding** returns the Transfer-Encoding value (eg. 'base64' or 'quoted-printable') or false if not defined
108
+ - **node.multipart** if has value, then this is a multipart node (does not have 'body' parts)
109
+ - **node.filename** is set if the headers contain a filename value. This is decoded to unicode, so it is a normal string or false if not found
110
110
 
111
111
  ### Join parsed message stream
112
112
 
@@ -118,10 +118,7 @@ let Joiner = require('mailsplit').Joiner;
118
118
  let splitter = new Splitter();
119
119
  let joiner = new Joiner();
120
120
  // pipe a message source to splitter, then joiner and finally to stdout
121
- someMessagStream
122
- .pipe(splitter)
123
- .pipe(joiner)
124
- .pipe(process.stdout);
121
+ someMessagStream.pipe(splitter).pipe(joiner).pipe(process.stdout);
125
122
  ```
126
123
 
127
124
  ### Rewrite specific nodes
@@ -130,14 +127,14 @@ someMessagStream
130
127
 
131
128
  Rewriter takes the following argument:
132
129
 
133
- - **filterFunc** gets the current node as argument and starts processing it if `filterFunc` returns true
130
+ - **filterFunc** gets the current node as argument and starts processing it if `filterFunc` returns true
134
131
 
135
132
  Once Rewriter finds a matching node, it emits the following event:
136
133
 
137
- - _'node'_ with an object argument `data`
138
- - `data.node` includes the current node with headers
139
- - `data.decoder` is the decoder stream that you can read data from
140
- - `data.encoder` is the encoder stream that you can write data to. Whatever you write into that stream will be encoded properly and inserted as the content of the current node
134
+ - _'node'_ with an object argument `data`
135
+ - `data.node` includes the current node with headers
136
+ - `data.decoder` is the decoder stream that you can read data from
137
+ - `data.encoder` is the encoder stream that you can write data to. Whatever you write into that stream will be encoded properly and inserted as the content of the current node
141
138
 
142
139
  ```javascript
143
140
  let Splitter = require('mailsplit').Splitter;
@@ -153,11 +150,7 @@ rewriter.on('node', data => {
153
150
  data.decoder.pipe(data.encoder);
154
151
  });
155
152
  // pipe a message source to splitter, then rewriter, then joiner and finally to stdout
156
- someMessagStream
157
- .pipe(splitter)
158
- .pipe(rewriter)
159
- .pipe(joiner)
160
- .pipe(process.stdout);
153
+ someMessagStream.pipe(splitter).pipe(rewriter).pipe(joiner).pipe(process.stdout);
161
154
  ```
162
155
 
163
156
  ### Stream specific nodes
@@ -166,14 +159,14 @@ someMessagStream
166
159
 
167
160
  Streamer takes the following argument:
168
161
 
169
- - **filterFunc** gets the current node as argument and starts processing it if `filterFunc` returns true
162
+ - **filterFunc** gets the current node as argument and starts processing it if `filterFunc` returns true
170
163
 
171
164
  Once Streamer finds a matching node, it emits the following event:
172
165
 
173
- - _'node'_ with an object argument `data`
174
- - `data.node` includes the current node with headers (informational only, you can't modify it)
175
- - `data.decoder` is the decoder stream that you can read data from
176
- - `data.done` is a function you must call once you have processed the stream
166
+ - _'node'_ with an object argument `data`
167
+ - `data.node` includes the current node with headers (informational only, you can't modify it)
168
+ - `data.decoder` is the decoder stream that you can read data from
169
+ - `data.done` is a function you must call once you have processed the stream
177
170
 
178
171
  ```javascript
179
172
  let Splitter = require('mailsplit').Splitter;
@@ -189,11 +182,7 @@ streamer.on('node', data => {
189
182
  data.done();
190
183
  });
191
184
  // pipe a message source to splitter, then streamer, then joiner and finally to stdout
192
- someMessagStream
193
- .pipe(splitter)
194
- .pipe(streamer)
195
- .pipe(joiner)
196
- .pipe(process.stdout);
185
+ someMessagStream.pipe(splitter).pipe(streamer).pipe(joiner).pipe(process.stdout);
197
186
  ```
198
187
 
199
188
  ### Benchmark
@@ -211,4 +200,4 @@ Done. 20000 messages [1244 MB] processed in 55.882 s. with average of 358 messag
211
200
 
212
201
  Dual licensed under **MIT** or **EUPLv1.1+**
213
202
 
214
- > `mailsplit` is part of the Zone Mail Suite (ZMS). Suite of programs and modules for an efficient, fast and modern email server.
203
+ > `mailsplit` is part of the Zone Mail Suite (ZMS). Suite of programs and modules for an efficient, fast and modern email server.
@@ -365,10 +365,16 @@ class Headers {
365
365
  return;
366
366
  }
367
367
 
368
- let rawLines = this.headers
369
- .toString('binary')
370
- .replace(/[\r\n]+$/, '')
371
- .split(/\r?\n/);
368
+ let raw = this.headers.toString('binary');
369
+
370
+ // Trailing line breaks go with an index scan. /[\r\n]+$/ retried a run of carriage
371
+ // returns from every position in it, quadratic on a header line made of them
372
+ let end = raw.length;
373
+ while (end > 0 && (raw.charCodeAt(end - 1) === 0x0a || raw.charCodeAt(end - 1) === 0x0d)) {
374
+ end--;
375
+ }
376
+
377
+ let rawLines = raw.slice(0, end).split(/\r?\n/);
372
378
 
373
379
  // Single forward pass. Splicing folded lines out of the source array in place was
374
380
  // quadratic on a header block with many continuation lines.
@@ -488,13 +488,14 @@ class MessageSplitter extends Transform {
488
488
  }
489
489
 
490
490
  /**
491
- * Checks the header bytes collected for the current node against maxHeadSize.
491
+ * Checks the header bytes collected for the current node against maxHeadSize. See
492
+ * MimeNode#headerCost.
492
493
  *
493
494
  * @param {number} [extra] Bytes that belong to the header block but are not stored yet.
494
495
  * @returns {(Error & {code?: string}) | null} Error object if the limit was exceeded.
495
496
  */
496
497
  checkHeadSize(extra) {
497
- if (this.node._headerlen + (extra || 0) > this.maxHeadSize) {
498
+ if (this.node.headerCost(extra) > this.maxHeadSize) {
498
499
  return maxLenError('Max header size for a MIME node exceeded');
499
500
  }
500
501
  return null;
@@ -630,12 +631,12 @@ class MessageSplitter extends Transform {
630
631
 
631
632
  switch (this.state) {
632
633
  case HEAD: {
633
- this.node.addHeaderChunk(line);
634
+ let endsBlock = this.node.addHeaderChunk(line);
634
635
  let headSizeError = this.checkHeadSize();
635
636
  if (headSizeError) {
636
637
  return next(headSizeError);
637
638
  }
638
- if (final || (line.length === 1 && line[0] === 0x0a) || (line.length === 2 && line[0] === 0x0d && line[1] === 0x0a)) {
639
+ if (final || endsBlock) {
639
640
  let currentNode = this.node;
640
641
 
641
642
  currentNode.parseHeaders();
@@ -23,6 +23,7 @@ declare class MimeNode implements MimeNodeShape {
23
23
 
24
24
  /** Length, in bytes, of the raw header block collected for this node. */
25
25
  _headerlen: number;
26
+ _headerCost: number;
26
27
 
27
28
  /** Multipart subtype such as `mixed` or `alternative`, or `false` for leaf nodes. */
28
29
  multipart: string | false;
@@ -88,7 +89,9 @@ declare class MimeNode implements MimeNodeShape {
88
89
  * @param line Raw header line bytes; falsy values are ignored.
89
90
  * @returns Nothing.
90
91
  */
91
- addHeaderChunk(line?: Buffer | false): void;
92
+ addHeaderChunk(line?: Buffer | false): boolean;
93
+ /** What the header lines count for against maxHeadSize, every line at least 64 bytes */
94
+ headerCost(extra?: number): number;
92
95
 
93
96
  /**
94
97
  * Parses collected header bytes and populates MIME metadata fields.
@@ -18,6 +18,10 @@ const pathlib = require('path');
18
18
 
19
19
  const Libmime = /** @type {any} */ (libmime.Libmime);
20
20
 
21
+ // The least a header line counts for against maxHeadSize. A parsed line costs a fixed
22
+ // overhead on top of its bytes, so 1 MiB of header is at most 16k lines
23
+ const HEADER_LINE_MIN_COST = 64;
24
+
21
25
  /**
22
26
  * Removes everything from the first `(` to the last `)` of each line, the same result as
23
27
  * `value.replace(/\(.*\)/g, '')`, but in linear time. The regex backtracks quadratically
@@ -69,7 +73,11 @@ function rfc2231ParamNames(value) {
69
73
  if (eq < 0) {
70
74
  return;
71
75
  }
72
- let match = segment.substring(0, eq).trim().toLowerCase().match(/^(.+?)\*(\d+\*?)?$/);
76
+ let match = segment
77
+ .substring(0, eq)
78
+ .trim()
79
+ .toLowerCase()
80
+ .match(/^(.+?)\*(\d+\*?)?$/);
73
81
  if (match) {
74
82
  names.add(match[1]);
75
83
  }
@@ -117,6 +125,7 @@ class MimeNode {
117
125
  /** @type {Buffer[]} */
118
126
  this._headersLines = [];
119
127
  this._headerlen = 0;
128
+ this._headerCost = 0;
120
129
 
121
130
  /** @type {StructuredHeader | false} */
122
131
  this._parsedContentType = false;
@@ -171,14 +180,28 @@ class MimeNode {
171
180
 
172
181
  /**
173
182
  * @param {Buffer | false} [line]
174
- * @returns {void}
183
+ * @returns {boolean} Whether the line is the empty line that ends the header block.
175
184
  */
176
185
  addHeaderChunk(line) {
177
186
  if (!line) {
178
- return;
187
+ return false;
179
188
  }
180
189
  this._headersLines.push(line);
181
190
  this._headerlen += line.length;
191
+ let endsBlock = (line.length === 1 && line[0] === 0x0a) || (line.length === 2 && line[0] === 0x0d && line[1] === 0x0a);
192
+ // the empty line that ends the block costs its bytes, every other line at least the floor
193
+ this._headerCost += endsBlock ? line.length : Math.max(line.length, HEADER_LINE_MIN_COST);
194
+ return endsBlock;
195
+ }
196
+
197
+ /**
198
+ * What the header lines of this node count for against maxHeadSize, see HEADER_LINE_MIN_COST.
199
+ *
200
+ * @param {number} [extra] Bytes of a header line that is not stored yet.
201
+ * @returns {number} The cost in bytes.
202
+ */
203
+ headerCost(extra) {
204
+ return this._headerCost + (extra ? Math.max(extra, HEADER_LINE_MIN_COST) : 0);
182
205
  }
183
206
 
184
207
  /**
@@ -189,6 +212,8 @@ class MimeNode {
189
212
  return;
190
213
  }
191
214
  this.headers = new Headers(Buffer.concat(this._headersLines, this._headerlen), this.config);
215
+ // the views held the input chunks alive, the block lives on in the copy
216
+ this._headersLines = [];
192
217
  let headers = this.headers;
193
218
 
194
219
  let dispositionHeader = headers.getFirst('Content-Disposition');
@@ -227,7 +252,7 @@ class MimeNode {
227
252
  if (this.disposition) {
228
253
  try {
229
254
  this.disposition = this.libmime.decodeWords(this.disposition);
230
- } catch (E) {
255
+ } catch (_E) {
231
256
  // failed to parse disposition, keep as is (most probably an unknown charset is used)
232
257
  }
233
258
  }
@@ -249,7 +274,7 @@ class MimeNode {
249
274
  if (!decoded) {
250
275
  try {
251
276
  this.filename = this.libmime.decodeWords(this.filename);
252
- } catch (E) {
277
+ } catch (_E) {
253
278
  // failed to parse filename, keep as is (most probably an unknown charset is used)
254
279
  }
255
280
  }