@contrast/agent-bundle 5.41.0 → 5.45.1

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 (489) hide show
  1. package/README.md +1 -10
  2. package/node_modules/@contrast/agent/README.md +1 -10
  3. package/node_modules/@contrast/agent/package.json +13 -12
  4. package/node_modules/@contrast/agent-swc-plugin/package.json +3 -3
  5. package/node_modules/@contrast/agentify/lib/rewrite-hooks.js +3 -3
  6. package/node_modules/@contrast/agentify/lib/utils.js +13 -7
  7. package/node_modules/@contrast/agentify/package.json +17 -17
  8. package/node_modules/@contrast/architecture-components/package.json +6 -6
  9. package/node_modules/@contrast/assess/lib/dataflow/propagation/install/ejs/template.js +1 -1
  10. package/node_modules/@contrast/assess/lib/dataflow/propagation/install/pug/index.js +1 -1
  11. package/node_modules/@contrast/assess/lib/dataflow/sinks/install/http/server-response.js +1 -12
  12. package/node_modules/@contrast/assess/lib/dataflow/sinks/install/restify.js +1 -1
  13. package/node_modules/@contrast/assess/lib/dataflow/sources/install/http.js +1 -1
  14. package/node_modules/@contrast/assess/lib/dataflow/tracker.js +1 -1
  15. package/node_modules/@contrast/assess/lib/get-source-context.js +1 -1
  16. package/node_modules/@contrast/assess/lib/response-scanning/install/http.js +0 -12
  17. package/node_modules/@contrast/assess/package.json +14 -14
  18. package/node_modules/@contrast/code-events/binding.gyp +1 -1
  19. package/node_modules/@contrast/code-events/package.json +11 -9
  20. package/node_modules/@contrast/code-events/prebuilds/darwin-x64+arm64/@contrast+code-events.abi108.node +0 -0
  21. package/node_modules/@contrast/code-events/prebuilds/darwin-x64+arm64/@contrast+code-events.abi115.node +0 -0
  22. package/node_modules/@contrast/code-events/prebuilds/darwin-x64+arm64/@contrast+code-events.abi127.node +0 -0
  23. package/node_modules/@contrast/code-events/prebuilds/darwin-x64+arm64/{@contrast+code-events.abi93.node → @contrast+code-events.abi137.node} +0 -0
  24. package/node_modules/@contrast/code-events/prebuilds/linux-arm64/@contrast+code-events.abi108.armv8.node +0 -0
  25. package/node_modules/@contrast/code-events/prebuilds/linux-arm64/@contrast+code-events.abi115.armv8.node +0 -0
  26. package/node_modules/@contrast/code-events/prebuilds/linux-arm64/@contrast+code-events.abi127.armv8.node +0 -0
  27. package/node_modules/@contrast/code-events/prebuilds/linux-arm64/@contrast+code-events.abi137.armv8.node +0 -0
  28. package/node_modules/@contrast/code-events/prebuilds/linux-x64/@contrast+code-events.abi108.glibc.node +0 -0
  29. package/node_modules/@contrast/code-events/prebuilds/linux-x64/@contrast+code-events.abi108.musl.node +0 -0
  30. package/node_modules/@contrast/code-events/prebuilds/linux-x64/@contrast+code-events.abi115.glibc.node +0 -0
  31. package/node_modules/@contrast/code-events/prebuilds/linux-x64/@contrast+code-events.abi115.musl.node +0 -0
  32. package/node_modules/@contrast/code-events/prebuilds/linux-x64/@contrast+code-events.abi127.glibc.node +0 -0
  33. package/node_modules/@contrast/code-events/prebuilds/linux-x64/@contrast+code-events.abi127.musl.node +0 -0
  34. package/node_modules/@contrast/code-events/prebuilds/linux-x64/@contrast+code-events.abi137.glibc.node +0 -0
  35. package/node_modules/@contrast/code-events/prebuilds/linux-x64/@contrast+code-events.abi137.musl.node +0 -0
  36. package/node_modules/@contrast/code-events/prebuilds/win32-x64/@contrast+code-events.abi108.node +0 -0
  37. package/node_modules/@contrast/code-events/prebuilds/win32-x64/@contrast+code-events.abi115.node +0 -0
  38. package/node_modules/@contrast/code-events/prebuilds/win32-x64/@contrast+code-events.abi127.node +0 -0
  39. package/node_modules/@contrast/code-events/prebuilds/win32-x64/@contrast+code-events.abi137.node +0 -0
  40. package/node_modules/@contrast/common/lib/constants.d.ts +1 -1
  41. package/node_modules/@contrast/common/lib/constants.js +1 -1
  42. package/node_modules/@contrast/common/lib/index.js +15 -15
  43. package/node_modules/@contrast/common/lib/primordials.d.ts +22 -20
  44. package/node_modules/@contrast/common/lib/types.d.ts +18 -6
  45. package/node_modules/@contrast/common/package.json +2 -2
  46. package/node_modules/@contrast/config/lib/options.js +29 -4
  47. package/node_modules/@contrast/config/package.json +4 -4
  48. package/node_modules/@contrast/core/lib/app-info.js +53 -74
  49. package/node_modules/@contrast/core/lib/index.d.ts +17 -1
  50. package/node_modules/@contrast/core/lib/sensitive-data-masking/index.js +33 -5
  51. package/node_modules/@contrast/core/package.json +10 -9
  52. package/node_modules/@contrast/deadzones/package.json +6 -6
  53. package/node_modules/@contrast/dep-hooks/lib/export-handler-registry.d.ts +17 -13
  54. package/node_modules/@contrast/dep-hooks/lib/export-handler-registry.js +16 -4
  55. package/node_modules/@contrast/dep-hooks/lib/export-hook-descriptor.d.ts +2 -2
  56. package/node_modules/@contrast/dep-hooks/lib/export-hook-descriptor.js +2 -3
  57. package/node_modules/@contrast/dep-hooks/lib/handler-invoker.d.ts +6 -6
  58. package/node_modules/@contrast/dep-hooks/lib/handler-invoker.js +0 -1
  59. package/node_modules/@contrast/dep-hooks/lib/helpers.d.ts +0 -7
  60. package/node_modules/@contrast/dep-hooks/lib/helpers.js +2 -18
  61. package/node_modules/@contrast/dep-hooks/lib/index.d.ts +17 -12
  62. package/node_modules/@contrast/dep-hooks/lib/index.js +5 -3
  63. package/node_modules/@contrast/dep-hooks/lib/package-finder.d.ts +2 -1
  64. package/node_modules/@contrast/dep-hooks/lib/package-finder.js +6 -6
  65. package/node_modules/@contrast/dep-hooks/package.json +4 -3
  66. package/node_modules/@contrast/distringuish/package.json +7 -6
  67. package/node_modules/@contrast/distringuish/prebuilds/darwin-x64+arm64/@contrast+distringuish.abi108.node +0 -0
  68. package/node_modules/@contrast/distringuish/prebuilds/darwin-x64+arm64/@contrast+distringuish.abi115.node +0 -0
  69. package/node_modules/@contrast/distringuish/prebuilds/darwin-x64+arm64/@contrast+distringuish.abi127.node +0 -0
  70. package/node_modules/@contrast/distringuish/prebuilds/darwin-x64+arm64/{@contrast+distringuish.abi93.node → @contrast+distringuish.abi137.node} +0 -0
  71. package/node_modules/@contrast/distringuish/prebuilds/linux-arm64/@contrast+distringuish.abi108.armv8.node +0 -0
  72. package/node_modules/@contrast/distringuish/prebuilds/linux-arm64/@contrast+distringuish.abi115.armv8.node +0 -0
  73. package/node_modules/@contrast/distringuish/prebuilds/linux-arm64/@contrast+distringuish.abi127.armv8.node +0 -0
  74. package/node_modules/@contrast/distringuish/prebuilds/linux-arm64/@contrast+distringuish.abi137.armv8.node +0 -0
  75. package/node_modules/@contrast/distringuish/prebuilds/linux-x64/@contrast+distringuish.abi108.glibc.node +0 -0
  76. package/node_modules/@contrast/distringuish/prebuilds/linux-x64/@contrast+distringuish.abi108.musl.node +0 -0
  77. package/node_modules/@contrast/distringuish/prebuilds/linux-x64/@contrast+distringuish.abi115.glibc.node +0 -0
  78. package/node_modules/@contrast/distringuish/prebuilds/linux-x64/@contrast+distringuish.abi115.musl.node +0 -0
  79. package/node_modules/@contrast/distringuish/prebuilds/linux-x64/@contrast+distringuish.abi127.glibc.node +0 -0
  80. package/node_modules/@contrast/distringuish/prebuilds/linux-x64/@contrast+distringuish.abi127.musl.node +0 -0
  81. package/node_modules/@contrast/distringuish/prebuilds/linux-x64/@contrast+distringuish.abi137.glibc.node +0 -0
  82. package/node_modules/@contrast/distringuish/prebuilds/linux-x64/@contrast+distringuish.abi137.musl.node +0 -0
  83. package/node_modules/@contrast/distringuish/prebuilds/win32-x64/@contrast+distringuish.abi108.node +0 -0
  84. package/node_modules/@contrast/distringuish/prebuilds/win32-x64/@contrast+distringuish.abi115.node +0 -0
  85. package/node_modules/@contrast/distringuish/prebuilds/win32-x64/@contrast+distringuish.abi127.node +0 -0
  86. package/node_modules/@contrast/distringuish/prebuilds/win32-x64/@contrast+distringuish.abi137.node +0 -0
  87. package/node_modules/@contrast/esm-hooks/lib/debug-methods.mjs +4 -4
  88. package/node_modules/@contrast/esm-hooks/lib/get-file-type.mjs +2 -9
  89. package/node_modules/@contrast/esm-hooks/lib/hooks.mjs +0 -2
  90. package/node_modules/@contrast/esm-hooks/lib/redirects/builtin/fs/promises.mjs +2 -0
  91. package/node_modules/@contrast/esm-hooks/lib/redirects/builtin/fs.mjs +3 -0
  92. package/node_modules/@contrast/esm-hooks/lib/redirects/builtin/util.mjs +1 -0
  93. package/node_modules/@contrast/esm-hooks/package.json +7 -7
  94. package/node_modules/@contrast/fn-inspect/package.json +9 -5
  95. package/node_modules/@contrast/fn-inspect/prebuilds/darwin-x64+arm64/@contrast+fn-inspect.abi108.node +0 -0
  96. package/node_modules/@contrast/fn-inspect/prebuilds/darwin-x64+arm64/@contrast+fn-inspect.abi115.node +0 -0
  97. package/node_modules/@contrast/fn-inspect/prebuilds/darwin-x64+arm64/@contrast+fn-inspect.abi127.node +0 -0
  98. package/node_modules/@contrast/fn-inspect/prebuilds/darwin-x64+arm64/{@contrast+fn-inspect.abi93.node → @contrast+fn-inspect.abi137.node} +0 -0
  99. package/node_modules/@contrast/fn-inspect/prebuilds/linux-arm64/@contrast+fn-inspect.abi108.armv8.node +0 -0
  100. package/node_modules/@contrast/fn-inspect/prebuilds/linux-arm64/@contrast+fn-inspect.abi115.armv8.node +0 -0
  101. package/node_modules/@contrast/fn-inspect/prebuilds/linux-arm64/@contrast+fn-inspect.abi127.armv8.node +0 -0
  102. package/node_modules/@contrast/fn-inspect/prebuilds/linux-arm64/@contrast+fn-inspect.abi137.armv8.node +0 -0
  103. package/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/@contrast+fn-inspect.abi108.glibc.node +0 -0
  104. package/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/@contrast+fn-inspect.abi108.musl.node +0 -0
  105. package/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/@contrast+fn-inspect.abi115.glibc.node +0 -0
  106. package/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/@contrast+fn-inspect.abi115.musl.node +0 -0
  107. package/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/@contrast+fn-inspect.abi127.glibc.node +0 -0
  108. package/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/@contrast+fn-inspect.abi127.musl.node +0 -0
  109. package/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/@contrast+fn-inspect.abi137.glibc.node +0 -0
  110. package/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/{@contrast+fn-inspect.abi93.musl.node → @contrast+fn-inspect.abi137.musl.node} +0 -0
  111. package/node_modules/@contrast/fn-inspect/prebuilds/win32-x64/@contrast+fn-inspect.abi108.node +0 -0
  112. package/node_modules/@contrast/fn-inspect/prebuilds/win32-x64/@contrast+fn-inspect.abi115.node +0 -0
  113. package/node_modules/@contrast/fn-inspect/prebuilds/win32-x64/@contrast+fn-inspect.abi127.node +0 -0
  114. package/node_modules/@contrast/fn-inspect/prebuilds/win32-x64/@contrast+fn-inspect.abi137.node +0 -0
  115. package/node_modules/@contrast/instrumentation/lib/http2.js +0 -11
  116. package/node_modules/@contrast/instrumentation/package.json +6 -6
  117. package/node_modules/@contrast/library-analysis/lib/install/library-reporting/dep.json +312 -224
  118. package/node_modules/@contrast/library-analysis/package.json +6 -6
  119. package/node_modules/@contrast/logger/lib/index.js +18 -8
  120. package/node_modules/@contrast/logger/lib/serializers.js +5 -5
  121. package/node_modules/@contrast/logger/lib/utils.d.ts +0 -6
  122. package/node_modules/@contrast/logger/package.json +4 -4
  123. package/node_modules/@contrast/metrics/lib/index.d.ts +6 -6
  124. package/node_modules/@contrast/metrics/lib/index.js +0 -1
  125. package/node_modules/@contrast/metrics/package.json +7 -7
  126. package/node_modules/@contrast/patcher/package.json +3 -3
  127. package/node_modules/@contrast/perf/package.json +7 -4
  128. package/node_modules/@contrast/protect/lib/hardening/handlers.js +37 -21
  129. package/node_modules/@contrast/protect/lib/index.d.ts +3 -2
  130. package/node_modules/@contrast/protect/lib/index.js +9 -2
  131. package/node_modules/@contrast/protect/lib/input-analysis/handlers.js +275 -233
  132. package/node_modules/@contrast/protect/lib/input-analysis/install/http.js +3 -4
  133. package/node_modules/@contrast/protect/lib/input-tracing/{handlers/index.js → handlers.js} +15 -15
  134. package/node_modules/@contrast/protect/lib/input-tracing/index.js +0 -1
  135. package/node_modules/@contrast/protect/lib/make-source-context.js +5 -7
  136. package/node_modules/@contrast/protect/lib/policy.js +130 -95
  137. package/node_modules/@contrast/protect/lib/semantic-analysis/handlers.js +19 -18
  138. package/node_modules/@contrast/protect/package.json +12 -12
  139. package/node_modules/@contrast/reporter/lib/index.js +1 -1
  140. package/node_modules/@contrast/reporter/lib/reporters/base.d.ts +0 -1
  141. package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/application-activity/index.d.ts +4 -2
  142. package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/application-activity/index.js +14 -14
  143. package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/application-activity/translations.d.ts +43 -6
  144. package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/application-activity/translations.js +262 -429
  145. package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/server-inventory.d.ts +3 -3
  146. package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/traces/index.d.ts +11 -11
  147. package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/traces/index.js +93 -93
  148. package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/traces/translations.js +12 -13
  149. package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/utils.js +6 -7
  150. package/node_modules/@contrast/reporter/lib/reporters/file.js +1 -1
  151. package/node_modules/@contrast/reporter/lib/reporters/security-logger/index.d.ts +2 -3
  152. package/node_modules/@contrast/reporter/lib/reporters/security-logger/index.js +72 -86
  153. package/node_modules/@contrast/reporter/lib/reporters/security-logger/messages.js +6 -7
  154. package/node_modules/@contrast/reporter/lib/validators.js +0 -1
  155. package/node_modules/@contrast/reporter/node_modules/sonic-boom/.husky/pre-commit +2 -2
  156. package/node_modules/@contrast/reporter/node_modules/sonic-boom/.taprc +5 -0
  157. package/node_modules/@contrast/reporter/node_modules/sonic-boom/README.md +2 -4
  158. package/node_modules/@contrast/reporter/node_modules/sonic-boom/bench.js +5 -36
  159. package/node_modules/@contrast/reporter/node_modules/sonic-boom/index.js +56 -300
  160. package/node_modules/@contrast/reporter/node_modules/sonic-boom/package.json +12 -7
  161. package/node_modules/@contrast/reporter/node_modules/sonic-boom/test.js +1684 -0
  162. package/node_modules/@contrast/reporter/node_modules/sonic-boom/types/index.d.ts +1 -2
  163. package/node_modules/@contrast/reporter/package.json +10 -10
  164. package/node_modules/@contrast/rewriter/lib/index.js +5 -43
  165. package/node_modules/@contrast/rewriter/package.json +8 -8
  166. package/node_modules/@contrast/route-coverage/lib/install/express/express5.js +0 -5
  167. package/node_modules/@contrast/route-coverage/lib/install/hapi.js +9 -2
  168. package/node_modules/@contrast/route-coverage/lib/install/restify.js +1 -1
  169. package/node_modules/@contrast/route-coverage/package.json +10 -10
  170. package/node_modules/@contrast/scopes/package.json +6 -6
  171. package/node_modules/@contrast/sec-obs/lib/traces/http.js +1 -1
  172. package/node_modules/@contrast/sec-obs/lib/traces/http.test.js +1 -1
  173. package/node_modules/@contrast/sec-obs/package.json +10 -10
  174. package/node_modules/@contrast/sources/lib/index.js +1 -1
  175. package/node_modules/@contrast/sources/lib/index.test.js +0 -26
  176. package/node_modules/@contrast/sources/package.json +3 -3
  177. package/node_modules/@contrast/telemetry/package.json +6 -6
  178. package/node_modules/@opentelemetry/semantic-conventions/README.md +3 -2
  179. package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_attributes.d.ts +4350 -2882
  180. package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_attributes.js +4350 -2882
  181. package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_attributes.js.map +1 -1
  182. package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_events.d.ts +136 -0
  183. package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_events.js +154 -0
  184. package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_events.js.map +1 -0
  185. package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_metrics.d.ts +713 -141
  186. package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_metrics.js +713 -141
  187. package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_metrics.js.map +1 -1
  188. package/node_modules/@opentelemetry/semantic-conventions/build/esm/index-incubating.d.ts +2 -0
  189. package/node_modules/@opentelemetry/semantic-conventions/build/esm/index-incubating.js +2 -0
  190. package/node_modules/@opentelemetry/semantic-conventions/build/esm/index-incubating.js.map +1 -1
  191. package/node_modules/@opentelemetry/semantic-conventions/build/esm/index.d.ts +1 -0
  192. package/node_modules/@opentelemetry/semantic-conventions/build/esm/index.js +1 -0
  193. package/node_modules/@opentelemetry/semantic-conventions/build/esm/index.js.map +1 -1
  194. package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.d.ts +7 -1
  195. package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js +7 -1
  196. package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js.map +1 -1
  197. package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_events.d.ts +5 -0
  198. package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_events.js +23 -0
  199. package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_events.js.map +1 -0
  200. package/node_modules/@opentelemetry/semantic-conventions/build/esm/version.d.ts +1 -1
  201. package/node_modules/@opentelemetry/semantic-conventions/build/esm/version.js +1 -1
  202. package/node_modules/@opentelemetry/semantic-conventions/build/esm/version.js.map +1 -1
  203. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_attributes.d.ts +4350 -2882
  204. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_attributes.js +4350 -2882
  205. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_attributes.js.map +1 -1
  206. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_events.d.ts +136 -0
  207. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_events.js +154 -0
  208. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_events.js.map +1 -0
  209. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_metrics.d.ts +713 -141
  210. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_metrics.js +713 -141
  211. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_metrics.js.map +1 -1
  212. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/index-incubating.d.ts +2 -0
  213. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/index-incubating.js +2 -0
  214. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/index-incubating.js.map +1 -1
  215. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/index.d.ts +1 -0
  216. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/index.js +1 -0
  217. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/index.js.map +1 -1
  218. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_attributes.d.ts +7 -1
  219. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_attributes.js +7 -1
  220. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_attributes.js.map +1 -1
  221. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_events.d.ts +5 -0
  222. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_events.js +23 -0
  223. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_events.js.map +1 -0
  224. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/version.d.ts +1 -1
  225. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/version.js +1 -1
  226. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/version.js.map +1 -1
  227. package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_attributes.d.ts +4350 -2882
  228. package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_attributes.js +4354 -2883
  229. package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_attributes.js.map +1 -1
  230. package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_events.d.ts +136 -0
  231. package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_events.js +157 -0
  232. package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_events.js.map +1 -0
  233. package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_metrics.d.ts +713 -141
  234. package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_metrics.js +720 -147
  235. package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_metrics.js.map +1 -1
  236. package/node_modules/@opentelemetry/semantic-conventions/build/src/index-incubating.d.ts +2 -0
  237. package/node_modules/@opentelemetry/semantic-conventions/build/src/index-incubating.js +2 -0
  238. package/node_modules/@opentelemetry/semantic-conventions/build/src/index-incubating.js.map +1 -1
  239. package/node_modules/@opentelemetry/semantic-conventions/build/src/index.d.ts +1 -0
  240. package/node_modules/@opentelemetry/semantic-conventions/build/src/index.js +1 -0
  241. package/node_modules/@opentelemetry/semantic-conventions/build/src/index.js.map +1 -1
  242. package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_attributes.d.ts +7 -1
  243. package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_attributes.js +10 -4
  244. package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_attributes.js.map +1 -1
  245. package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_events.d.ts +5 -0
  246. package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_events.js +26 -0
  247. package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_events.js.map +1 -0
  248. package/node_modules/@opentelemetry/semantic-conventions/build/src/version.d.ts +1 -1
  249. package/node_modules/@opentelemetry/semantic-conventions/build/src/version.js +1 -1
  250. package/node_modules/@opentelemetry/semantic-conventions/build/src/version.js.map +1 -1
  251. package/node_modules/@opentelemetry/semantic-conventions/package.json +6 -7
  252. package/node_modules/@swc/core/README.md +5 -0
  253. package/node_modules/@swc/core/binding.d.ts +2 -2
  254. package/node_modules/@swc/core/index.d.ts +5 -4
  255. package/node_modules/@swc/core/index.js +2 -2
  256. package/node_modules/@swc/core/package.json +12 -12
  257. package/node_modules/@swc/core-darwin-arm64/package.json +1 -1
  258. package/node_modules/@swc/core-darwin-arm64/swc.darwin-arm64.node +0 -0
  259. package/node_modules/@swc/core-darwin-x64/package.json +1 -1
  260. package/node_modules/@swc/core-darwin-x64/swc.darwin-x64.node +0 -0
  261. package/node_modules/@swc/core-linux-arm64-gnu/package.json +1 -1
  262. package/node_modules/@swc/core-linux-arm64-gnu/swc.linux-arm64-gnu.node +0 -0
  263. package/node_modules/@swc/core-linux-arm64-musl/package.json +1 -1
  264. package/node_modules/@swc/core-linux-arm64-musl/swc.linux-arm64-musl.node +0 -0
  265. package/node_modules/@swc/core-linux-x64-gnu/package.json +1 -1
  266. package/node_modules/@swc/core-linux-x64-gnu/swc.linux-x64-gnu.node +0 -0
  267. package/node_modules/@swc/core-linux-x64-musl/package.json +1 -1
  268. package/node_modules/@swc/core-linux-x64-musl/swc.linux-x64-musl.node +0 -0
  269. package/node_modules/@swc/core-win32-arm64-msvc/package.json +1 -1
  270. package/node_modules/@swc/core-win32-arm64-msvc/swc.win32-arm64-msvc.node +0 -0
  271. package/node_modules/@swc/core-win32-x64-msvc/package.json +1 -1
  272. package/node_modules/@swc/core-win32-x64-msvc/swc.win32-x64-msvc.node +0 -0
  273. package/node_modules/@swc/types/index.d.ts +15 -5
  274. package/node_modules/@swc/types/package.json +2 -2
  275. package/node_modules/@types/node/README.md +1 -1
  276. package/node_modules/@types/node/buffer.d.ts +1 -1
  277. package/node_modules/@types/node/child_process.d.ts +26 -122
  278. package/node_modules/@types/node/crypto.d.ts +61 -11
  279. package/node_modules/@types/node/dns.d.ts +5 -0
  280. package/node_modules/@types/node/fs/promises.d.ts +48 -29
  281. package/node_modules/@types/node/fs.d.ts +52 -37
  282. package/node_modules/@types/node/globals.d.ts +148 -347
  283. package/node_modules/@types/node/http.d.ts +29 -5
  284. package/node_modules/@types/node/http2.d.ts +13 -11
  285. package/node_modules/@types/node/https.d.ts +5 -0
  286. package/node_modules/@types/node/index.d.ts +7 -2
  287. package/node_modules/@types/node/inspector.d.ts +187 -3985
  288. package/node_modules/@types/node/inspector.generated.d.ts +4052 -0
  289. package/node_modules/@types/node/module.d.ts +25 -0
  290. package/node_modules/@types/node/net.d.ts +21 -0
  291. package/node_modules/@types/node/package.json +4 -9
  292. package/node_modules/@types/node/perf_hooks.d.ts +14 -0
  293. package/node_modules/@types/node/repl.d.ts +11 -1
  294. package/node_modules/@types/node/sqlite.d.ts +34 -1
  295. package/node_modules/@types/node/stream/web.d.ts +4 -0
  296. package/node_modules/@types/node/stream.d.ts +17 -6
  297. package/node_modules/@types/node/test.d.ts +120 -1
  298. package/node_modules/@types/node/timers.d.ts +0 -2
  299. package/node_modules/@types/node/tls.d.ts +32 -0
  300. package/node_modules/@types/node/ts5.6/index.d.ts +7 -2
  301. package/node_modules/@types/node/ts5.7/index.d.ts +7 -2
  302. package/node_modules/@types/node/url.d.ts +20 -6
  303. package/node_modules/@types/node/util.d.ts +12 -6
  304. package/node_modules/@types/node/vm.d.ts +73 -10
  305. package/node_modules/@types/node/wasi.d.ts +21 -0
  306. package/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
  307. package/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
  308. package/node_modules/@types/node/{dom-events.d.ts → web-globals/events.d.ts} +47 -52
  309. package/node_modules/@types/node/web-globals/fetch.d.ts +50 -0
  310. package/node_modules/@types/node/web-globals/navigator.d.ts +25 -0
  311. package/node_modules/@types/node/web-globals/storage.d.ts +24 -0
  312. package/node_modules/@types/node/worker_threads.d.ts +63 -3
  313. package/node_modules/@types/node/zlib.d.ts +8 -2
  314. package/node_modules/axios/CHANGELOG.md +58 -0
  315. package/node_modules/axios/README.md +87 -10
  316. package/node_modules/axios/dist/axios.js +355 -289
  317. package/node_modules/axios/dist/axios.js.map +1 -1
  318. package/node_modules/axios/dist/axios.min.js +2 -2
  319. package/node_modules/axios/dist/axios.min.js.map +1 -1
  320. package/node_modules/axios/dist/browser/axios.cjs +286 -213
  321. package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
  322. package/node_modules/axios/dist/esm/axios.js +286 -213
  323. package/node_modules/axios/dist/esm/axios.js.map +1 -1
  324. package/node_modules/axios/dist/esm/axios.min.js +2 -2
  325. package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
  326. package/node_modules/axios/dist/node/axios.cjs +377 -213
  327. package/node_modules/axios/dist/node/axios.cjs.map +1 -1
  328. package/node_modules/axios/index.d.cts +12 -5
  329. package/node_modules/axios/index.d.ts +13 -4
  330. package/node_modules/axios/lib/adapters/adapters.js +6 -4
  331. package/node_modules/axios/lib/adapters/fetch.js +221 -162
  332. package/node_modules/axios/lib/adapters/http.js +18 -0
  333. package/node_modules/axios/lib/adapters/xhr.js +11 -8
  334. package/node_modules/axios/lib/core/Axios.js +0 -2
  335. package/node_modules/axios/lib/core/AxiosError.js +10 -3
  336. package/node_modules/axios/lib/core/dispatchRequest.js +1 -1
  337. package/node_modules/axios/lib/defaults/index.js +1 -1
  338. package/node_modules/axios/lib/env/data.js +1 -1
  339. package/node_modules/axios/lib/helpers/buildURL.js +1 -3
  340. package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +73 -0
  341. package/node_modules/axios/lib/helpers/resolveConfig.js +13 -9
  342. package/node_modules/axios/lib/utils.js +5 -3
  343. package/node_modules/axios/package.json +18 -12
  344. package/node_modules/balanced-match/.github/FUNDING.yml +2 -0
  345. package/node_modules/balanced-match/LICENSE.md +21 -0
  346. package/node_modules/balanced-match/README.md +97 -0
  347. package/node_modules/balanced-match/index.js +62 -0
  348. package/node_modules/balanced-match/package.json +48 -0
  349. package/node_modules/brace-expansion/.github/FUNDING.yml +2 -0
  350. package/node_modules/brace-expansion/LICENSE +21 -0
  351. package/node_modules/brace-expansion/README.md +135 -0
  352. package/node_modules/brace-expansion/index.js +203 -0
  353. package/node_modules/brace-expansion/package.json +49 -0
  354. package/node_modules/detect-libc/lib/detect-libc.js +59 -13
  355. package/node_modules/detect-libc/lib/elf.js +39 -0
  356. package/node_modules/detect-libc/lib/filesystem.js +18 -8
  357. package/node_modules/detect-libc/package.json +3 -2
  358. package/node_modules/minimatch/LICENSE +15 -0
  359. package/node_modules/minimatch/README.md +454 -0
  360. package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts +2 -0
  361. package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts.map +1 -0
  362. package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js +14 -0
  363. package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js.map +1 -0
  364. package/node_modules/minimatch/dist/commonjs/ast.d.ts +20 -0
  365. package/node_modules/minimatch/dist/commonjs/ast.d.ts.map +1 -0
  366. package/node_modules/minimatch/dist/commonjs/ast.js +592 -0
  367. package/node_modules/minimatch/dist/commonjs/ast.js.map +1 -0
  368. package/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts +8 -0
  369. package/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts.map +1 -0
  370. package/node_modules/minimatch/dist/commonjs/brace-expressions.js +152 -0
  371. package/node_modules/minimatch/dist/commonjs/brace-expressions.js.map +1 -0
  372. package/node_modules/minimatch/dist/commonjs/escape.d.ts +12 -0
  373. package/node_modules/minimatch/dist/commonjs/escape.d.ts.map +1 -0
  374. package/node_modules/minimatch/dist/commonjs/escape.js +22 -0
  375. package/node_modules/minimatch/dist/commonjs/escape.js.map +1 -0
  376. package/node_modules/minimatch/dist/commonjs/index.d.ts +94 -0
  377. package/node_modules/minimatch/dist/commonjs/index.d.ts.map +1 -0
  378. package/node_modules/minimatch/dist/commonjs/index.js +1017 -0
  379. package/node_modules/minimatch/dist/commonjs/index.js.map +1 -0
  380. package/node_modules/minimatch/dist/commonjs/package.json +3 -0
  381. package/node_modules/minimatch/dist/commonjs/unescape.d.ts +17 -0
  382. package/node_modules/minimatch/dist/commonjs/unescape.d.ts.map +1 -0
  383. package/node_modules/minimatch/dist/commonjs/unescape.js +24 -0
  384. package/node_modules/minimatch/dist/commonjs/unescape.js.map +1 -0
  385. package/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts +2 -0
  386. package/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts.map +1 -0
  387. package/node_modules/minimatch/dist/esm/assert-valid-pattern.js +10 -0
  388. package/node_modules/minimatch/dist/esm/assert-valid-pattern.js.map +1 -0
  389. package/node_modules/minimatch/dist/esm/ast.d.ts +20 -0
  390. package/node_modules/minimatch/dist/esm/ast.d.ts.map +1 -0
  391. package/node_modules/minimatch/dist/esm/ast.js +588 -0
  392. package/node_modules/minimatch/dist/esm/ast.js.map +1 -0
  393. package/node_modules/minimatch/dist/esm/brace-expressions.d.ts +8 -0
  394. package/node_modules/minimatch/dist/esm/brace-expressions.d.ts.map +1 -0
  395. package/node_modules/minimatch/dist/esm/brace-expressions.js +148 -0
  396. package/node_modules/minimatch/dist/esm/brace-expressions.js.map +1 -0
  397. package/node_modules/minimatch/dist/esm/escape.d.ts +12 -0
  398. package/node_modules/minimatch/dist/esm/escape.d.ts.map +1 -0
  399. package/node_modules/minimatch/dist/esm/escape.js +18 -0
  400. package/node_modules/minimatch/dist/esm/escape.js.map +1 -0
  401. package/node_modules/minimatch/dist/esm/index.d.ts +94 -0
  402. package/node_modules/minimatch/dist/esm/index.d.ts.map +1 -0
  403. package/node_modules/minimatch/dist/esm/index.js +1001 -0
  404. package/node_modules/minimatch/dist/esm/index.js.map +1 -0
  405. package/node_modules/minimatch/dist/esm/package.json +3 -0
  406. package/node_modules/minimatch/dist/esm/unescape.d.ts +17 -0
  407. package/node_modules/minimatch/dist/esm/unescape.d.ts.map +1 -0
  408. package/node_modules/minimatch/dist/esm/unescape.js +20 -0
  409. package/node_modules/minimatch/dist/esm/unescape.js.map +1 -0
  410. package/node_modules/minimatch/package.json +82 -0
  411. package/node_modules/node-abi/LICENSE +21 -0
  412. package/node_modules/node-abi/README.md +54 -0
  413. package/node_modules/node-abi/abi_registry.json +408 -0
  414. package/node_modules/node-abi/getNextTarget.js +13 -0
  415. package/node_modules/node-abi/index.js +161 -0
  416. package/node_modules/node-abi/package.json +46 -0
  417. package/node_modules/node-addon-api/README.md +25 -249
  418. package/node_modules/node-addon-api/common.gypi +1 -0
  419. package/node_modules/node-addon-api/index.js +2 -0
  420. package/node_modules/node-addon-api/napi-inl.h +592 -166
  421. package/node_modules/node-addon-api/napi.h +167 -59
  422. package/node_modules/node-addon-api/node_addon_api.gyp +10 -0
  423. package/node_modules/node-addon-api/noexcept.gypi +1 -1
  424. package/node_modules/node-addon-api/package.json +13 -13
  425. package/node_modules/node-addon-api/tools/conversion.js +1 -1
  426. package/node_modules/protobufjs/dist/light/protobuf.js +2 -2
  427. package/node_modules/protobufjs/dist/light/protobuf.min.js +2 -2
  428. package/node_modules/protobufjs/dist/minimal/protobuf.js +2 -2
  429. package/node_modules/protobufjs/dist/minimal/protobuf.min.js +2 -2
  430. package/node_modules/protobufjs/dist/protobuf.js +2 -2
  431. package/node_modules/protobufjs/dist/protobuf.min.js +2 -2
  432. package/node_modules/protobufjs/google/protobuf/descriptor.json +2 -2
  433. package/node_modules/protobufjs/google/protobuf/descriptor.proto +2 -1
  434. package/node_modules/protobufjs/package.json +1 -1
  435. package/node_modules/undici-types/agent.d.ts +4 -0
  436. package/node_modules/undici-types/client-stats.d.ts +15 -0
  437. package/node_modules/undici-types/client.d.ts +6 -3
  438. package/node_modules/undici-types/diagnostics-channel.d.ts +9 -0
  439. package/node_modules/undici-types/dispatcher.d.ts +3 -2
  440. package/node_modules/undici-types/env-http-proxy-agent.d.ts +2 -1
  441. package/node_modules/undici-types/eventsource.d.ts +3 -3
  442. package/node_modules/undici-types/fetch.d.ts +1 -0
  443. package/node_modules/undici-types/handlers.d.ts +1 -1
  444. package/node_modules/undici-types/mock-agent.d.ts +3 -0
  445. package/node_modules/undici-types/mock-client.d.ts +2 -0
  446. package/node_modules/undici-types/mock-interceptor.d.ts +2 -0
  447. package/node_modules/undici-types/mock-pool.d.ts +2 -0
  448. package/node_modules/undici-types/package.json +1 -1
  449. package/node_modules/undici-types/pool.d.ts +2 -0
  450. package/node_modules/undici-types/proxy-agent.d.ts +1 -0
  451. package/node_modules/undici-types/retry-handler.d.ts +9 -0
  452. package/node_modules/undici-types/webidl.d.ts +29 -15
  453. package/node_modules/undici-types/websocket.d.ts +3 -1
  454. package/node_modules/yaml/README.md +2 -20
  455. package/node_modules/yaml/browser/dist/stringify/stringifyString.js +1 -1
  456. package/node_modules/yaml/dist/stringify/stringifyString.js +1 -1
  457. package/node_modules/yaml/package.json +2 -1
  458. package/package.json +4 -3
  459. package/node_modules/@contrast/code-events/prebuilds/linux-arm64/@contrast+code-events.abi93.armv8.node +0 -0
  460. package/node_modules/@contrast/code-events/prebuilds/linux-x64/@contrast+code-events.abi93.glibc.node +0 -0
  461. package/node_modules/@contrast/code-events/prebuilds/linux-x64/@contrast+code-events.abi93.musl.node +0 -0
  462. package/node_modules/@contrast/code-events/prebuilds/win32-x64/@contrast+code-events.abi93.node +0 -0
  463. package/node_modules/@contrast/core/lib/sensitive-data-masking/protect-listener.js +0 -111
  464. package/node_modules/@contrast/distringuish/prebuilds/linux-arm64/@contrast+distringuish.abi93.armv8.node +0 -0
  465. package/node_modules/@contrast/distringuish/prebuilds/linux-x64/@contrast+distringuish.abi93.glibc.node +0 -0
  466. package/node_modules/@contrast/distringuish/prebuilds/linux-x64/@contrast+distringuish.abi93.musl.node +0 -0
  467. package/node_modules/@contrast/distringuish/prebuilds/win32-x64/@contrast+distringuish.abi93.node +0 -0
  468. package/node_modules/@contrast/fn-inspect/prebuilds/linux-arm64/@contrast+fn-inspect.abi93.armv8.node +0 -0
  469. package/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/@contrast+fn-inspect.abi93.glibc.node +0 -0
  470. package/node_modules/@contrast/fn-inspect/prebuilds/win32-x64/@contrast+fn-inspect.abi93.node +0 -0
  471. package/node_modules/@contrast/perf/lib/index.test.js +0 -547
  472. package/node_modules/@contrast/perf/lib/tsconfig.json +0 -31
  473. package/node_modules/@contrast/protect/lib/input-tracing/install/spdy.js +0 -63
  474. package/node_modules/@contrast/reporter/node_modules/sonic-boom/.taprc.yaml +0 -11
  475. package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/destroy.test.js +0 -49
  476. package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/end.test.js +0 -98
  477. package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/flush-sync.test.js +0 -140
  478. package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/flush.test.js +0 -419
  479. package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/fsync.test.js +0 -63
  480. package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/helper.js +0 -42
  481. package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/minlength.test.js +0 -35
  482. package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/mode.test.js +0 -116
  483. package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/reopen.test.js +0 -239
  484. package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/retry.test.js +0 -414
  485. package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/sync.test.js +0 -261
  486. package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/write.test.js +0 -465
  487. package/node_modules/@types/node/ts5.1/compatibility/disposable.d.ts +0 -12
  488. package/node_modules/@types/node/ts5.1/index.d.ts +0 -98
  489. package/node_modules/node-addon-api/tools/eslint-format.js +0 -79
@@ -7,15 +7,11 @@ const path = require('path')
7
7
  const sleep = require('atomic-sleep')
8
8
 
9
9
  const BUSY_WRITE_TIMEOUT = 100
10
- const kEmptyBuffer = Buffer.allocUnsafe(0)
11
10
 
12
11
  // 16 KB. Don't write more than docker buffer size.
13
12
  // https://github.com/moby/moby/blob/513ec73831269947d38a644c278ce3cac36783b2/daemon/logger/copier.go#L13
14
13
  const MAX_WRITE = 16 * 1024
15
14
 
16
- const kContentModeBuffer = 'buffer'
17
- const kContentModeUtf8 = 'utf8'
18
-
19
15
  function openFile (file, sonic) {
20
16
  sonic._opening = true
21
17
  sonic._writing = true
@@ -42,8 +38,6 @@ function openFile (file, sonic) {
42
38
  return
43
39
  }
44
40
 
45
- const reopening = sonic._reopening
46
-
47
41
  sonic.fd = fd
48
42
  sonic.file = file
49
43
  sonic._reopening = false
@@ -56,15 +50,13 @@ function openFile (file, sonic) {
56
50
  sonic.emit('ready')
57
51
  }
58
52
 
59
- if (sonic.destroyed) {
53
+ if (sonic._reopening) {
60
54
  return
61
55
  }
62
56
 
63
57
  // start
64
- if ((!sonic._writing && sonic._len > sonic.minLength) || sonic._flushPending) {
65
- sonic._actualWrite()
66
- } else if (reopening) {
67
- process.nextTick(() => sonic.emit('drain'))
58
+ if (!sonic._writing && sonic._len > sonic.minLength && !sonic.destroyed) {
59
+ actualWrite(sonic)
68
60
  }
69
61
  }
70
62
 
@@ -95,19 +87,18 @@ function SonicBoom (opts) {
95
87
  return new SonicBoom(opts)
96
88
  }
97
89
 
98
- let { fd, dest, minLength, maxLength, maxWrite, sync, append = true, mkdir, retryEAGAIN, fsync, contentMode, mode } = opts || {}
90
+ let { fd, dest, minLength, maxLength, maxWrite, sync, append = true, mode, mkdir, retryEAGAIN, fsync } = opts || {}
99
91
 
100
92
  fd = fd || dest
101
93
 
94
+ this._bufs = []
102
95
  this._len = 0
103
96
  this.fd = -1
104
- this._bufs = []
105
- this._lens = []
106
97
  this._writing = false
98
+ this._writingBuf = ''
107
99
  this._ending = false
108
100
  this._reopening = false
109
101
  this._asyncDrainScheduled = false
110
- this._flushPending = false
111
102
  this._hwm = Math.max(minLength || 0, 16387)
112
103
  this.file = null
113
104
  this.destroyed = false
@@ -115,35 +106,12 @@ function SonicBoom (opts) {
115
106
  this.maxLength = maxLength || 0
116
107
  this.maxWrite = maxWrite || MAX_WRITE
117
108
  this.sync = sync || false
118
- this.writable = true
119
109
  this._fsync = fsync || false
120
110
  this.append = append || false
121
111
  this.mode = mode
122
112
  this.retryEAGAIN = retryEAGAIN || (() => true)
123
113
  this.mkdir = mkdir || false
124
114
 
125
- let fsWriteSync
126
- let fsWrite
127
- if (contentMode === kContentModeBuffer) {
128
- this._writingBuf = kEmptyBuffer
129
- this.write = writeBuffer
130
- this.flush = flushBuffer
131
- this.flushSync = flushBufferSync
132
- this._actualWrite = actualWriteBuffer
133
- fsWriteSync = () => fs.writeSync(this.fd, this._writingBuf)
134
- fsWrite = () => fs.write(this.fd, this._writingBuf, this.release)
135
- } else if (contentMode === undefined || contentMode === kContentModeUtf8) {
136
- this._writingBuf = ''
137
- this.write = write
138
- this.flush = flush
139
- this.flushSync = flushSync
140
- this._actualWrite = actualWrite
141
- fsWriteSync = () => fs.writeSync(this.fd, this._writingBuf, 'utf8')
142
- fsWrite = () => fs.write(this.fd, this._writingBuf, 'utf8', this.release)
143
- } else {
144
- throw new Error(`SonicBoom supports "${kContentModeUtf8}" and "${kContentModeBuffer}", but passed ${contentMode}`)
145
- }
146
-
147
115
  if (typeof fd === 'number') {
148
116
  this.fd = fd
149
117
  process.nextTick(() => this.emit('ready'))
@@ -158,7 +126,7 @@ function SonicBoom (opts) {
158
126
 
159
127
  this.release = (err, n) => {
160
128
  if (err) {
161
- if ((err.code === 'EAGAIN' || err.code === 'EBUSY') && this.retryEAGAIN(err, this._writingBuf.length, this._len - this._writingBuf.length)) {
129
+ if (err.code === 'EAGAIN' && this.retryEAGAIN(err, this._writingBuf.length, this._len - this._writingBuf.length)) {
162
130
  if (this.sync) {
163
131
  // This error code should not happen in sync mode, because it is
164
132
  // not using the underlining operating system asynchronous functions.
@@ -172,7 +140,9 @@ function SonicBoom (opts) {
172
140
  }
173
141
  } else {
174
142
  // Let's give the destination some time to process the chunk.
175
- setTimeout(fsWrite, BUSY_WRITE_TIMEOUT)
143
+ setTimeout(() => {
144
+ fs.write(this.fd, this._writingBuf, 'utf8', this.release)
145
+ }, BUSY_WRITE_TIMEOUT)
176
146
  }
177
147
  } else {
178
148
  this._writing = false
@@ -183,23 +153,34 @@ function SonicBoom (opts) {
183
153
  }
184
154
 
185
155
  this.emit('write', n)
186
- const releasedBufObj = releaseWritingBuf(this._writingBuf, this._len, n)
187
- this._len = releasedBufObj.len
188
- this._writingBuf = releasedBufObj.writingBuf
156
+
157
+ this._len -= n
158
+ // In case of multi-byte characters, the length of the written buffer
159
+ // may be different from the length of the string. Let's make sure
160
+ // we do not have an accumulated string with a negative length.
161
+ // This also mean that ._len is not precise, but it's not a problem as some
162
+ // writes might be triggered earlier than ._minLength.
163
+ if (this._len < 0) {
164
+ this._len = 0
165
+ }
166
+
167
+ // TODO if we have a multi-byte character in the buffer, we need to
168
+ // n might not be the same as this._writingBuf.length, so we might loose
169
+ // characters here. The solution to this problem is to use a Buffer for _writingBuf.
170
+ this._writingBuf = this._writingBuf.slice(n)
189
171
 
190
172
  if (this._writingBuf.length) {
191
173
  if (!this.sync) {
192
- fsWrite()
174
+ fs.write(this.fd, this._writingBuf, 'utf8', this.release)
193
175
  return
194
176
  }
195
177
 
196
178
  try {
197
179
  do {
198
- const n = fsWriteSync()
199
- const releasedBufObj = releaseWritingBuf(this._writingBuf, this._len, n)
200
- this._len = releasedBufObj.len
201
- this._writingBuf = releasedBufObj.writingBuf
202
- } while (this._writingBuf.length)
180
+ const n = fs.writeSync(this.fd, this._writingBuf, 'utf8')
181
+ this._len -= n
182
+ this._writingBuf = this._writingBuf.slice(n)
183
+ } while (this._writingBuf)
203
184
  } catch (err) {
204
185
  this.release(err)
205
186
  return
@@ -216,10 +197,10 @@ function SonicBoom (opts) {
216
197
  this._reopening = false
217
198
  this.reopen()
218
199
  } else if (len > this.minLength) {
219
- this._actualWrite()
200
+ actualWrite(this)
220
201
  } else if (this._ending) {
221
202
  if (len > 0) {
222
- this._actualWrite()
203
+ actualWrite(this)
223
204
  } else {
224
205
  this._writing = false
225
206
  actualClose(this)
@@ -244,25 +225,6 @@ function SonicBoom (opts) {
244
225
  })
245
226
  }
246
227
 
247
- /**
248
- * Release the writingBuf after fs.write n bytes data
249
- * @param {string | Buffer} writingBuf - currently writing buffer, usually be instance._writingBuf.
250
- * @param {number} len - currently buffer length, usually be instance._len.
251
- * @param {number} n - number of bytes fs already written
252
- * @returns {{writingBuf: string | Buffer, len: number}} released writingBuf and length
253
- */
254
- function releaseWritingBuf (writingBuf, len, n) {
255
- // if Buffer.byteLength is equal to n, that means writingBuf contains no multi-byte character
256
- if (typeof writingBuf === 'string' && Buffer.byteLength(writingBuf) !== n) {
257
- // Since the fs.write callback parameter `n` means how many bytes the passed of string
258
- // We calculate the original string length for avoiding the multi-byte character issue
259
- n = Buffer.from(writingBuf).subarray(0, n).toString().length
260
- }
261
- len = Math.max(len - n, 0)
262
- writingBuf = writingBuf.slice(n)
263
- return { writingBuf, len }
264
- }
265
-
266
228
  function emitDrain (sonic) {
267
229
  const hasListeners = sonic.listenerCount('drain') > 0
268
230
  if (!hasListeners) return
@@ -272,19 +234,7 @@ function emitDrain (sonic) {
272
234
 
273
235
  inherits(SonicBoom, EventEmitter)
274
236
 
275
- function mergeBuf (bufs, len) {
276
- if (bufs.length === 0) {
277
- return kEmptyBuffer
278
- }
279
-
280
- if (bufs.length === 1) {
281
- return bufs[0]
282
- }
283
-
284
- return Buffer.concat(bufs, len)
285
- }
286
-
287
- function write (data) {
237
+ SonicBoom.prototype.write = function (data) {
288
238
  if (this.destroyed) {
289
239
  throw new Error('SonicBoom destroyed')
290
240
  }
@@ -309,96 +259,18 @@ function write (data) {
309
259
  this._len = len
310
260
 
311
261
  if (!this._writing && this._len >= this.minLength) {
312
- this._actualWrite()
262
+ actualWrite(this)
313
263
  }
314
264
 
315
265
  return this._len < this._hwm
316
266
  }
317
267
 
318
- function writeBuffer (data) {
268
+ SonicBoom.prototype.flush = function () {
319
269
  if (this.destroyed) {
320
270
  throw new Error('SonicBoom destroyed')
321
271
  }
322
272
 
323
- const len = this._len + data.length
324
- const bufs = this._bufs
325
- const lens = this._lens
326
-
327
- if (this.maxLength && len > this.maxLength) {
328
- this.emit('drop', data)
329
- return this._len < this._hwm
330
- }
331
-
332
- if (
333
- bufs.length === 0 ||
334
- lens[lens.length - 1] + data.length > this.maxWrite
335
- ) {
336
- bufs.push([data])
337
- lens.push(data.length)
338
- } else {
339
- bufs[bufs.length - 1].push(data)
340
- lens[lens.length - 1] += data.length
341
- }
342
-
343
- this._len = len
344
-
345
- if (!this._writing && this._len >= this.minLength) {
346
- this._actualWrite()
347
- }
348
-
349
- return this._len < this._hwm
350
- }
351
-
352
- function callFlushCallbackOnDrain (cb) {
353
- this._flushPending = true
354
- const onDrain = () => {
355
- // only if _fsync is false to avoid double fsync
356
- if (!this._fsync) {
357
- fs.fsync(this.fd, (err) => {
358
- this._flushPending = false
359
- cb(err)
360
- })
361
- } else {
362
- this._flushPending = false
363
- cb()
364
- }
365
- this.off('error', onError)
366
- }
367
- const onError = (err) => {
368
- this._flushPending = false
369
- cb(err)
370
- this.off('drain', onDrain)
371
- }
372
-
373
- this.once('drain', onDrain)
374
- this.once('error', onError)
375
- }
376
-
377
- function flush (cb) {
378
- if (cb != null && typeof cb !== 'function') {
379
- throw new Error('flush cb must be a function')
380
- }
381
-
382
- if (this.destroyed) {
383
- const error = new Error('SonicBoom destroyed')
384
- if (cb) {
385
- cb(error)
386
- return
387
- }
388
-
389
- throw error
390
- }
391
-
392
- if (this.minLength <= 0) {
393
- cb?.()
394
- return
395
- }
396
-
397
- if (cb) {
398
- callFlushCallbackOnDrain.call(this, cb)
399
- }
400
-
401
- if (this._writing) {
273
+ if (this._writing || this.minLength <= 0) {
402
274
  return
403
275
  }
404
276
 
@@ -406,43 +278,7 @@ function flush (cb) {
406
278
  this._bufs.push('')
407
279
  }
408
280
 
409
- this._actualWrite()
410
- }
411
-
412
- function flushBuffer (cb) {
413
- if (cb != null && typeof cb !== 'function') {
414
- throw new Error('flush cb must be a function')
415
- }
416
-
417
- if (this.destroyed) {
418
- const error = new Error('SonicBoom destroyed')
419
- if (cb) {
420
- cb(error)
421
- return
422
- }
423
-
424
- throw error
425
- }
426
-
427
- if (this.minLength <= 0) {
428
- cb?.()
429
- return
430
- }
431
-
432
- if (cb) {
433
- callFlushCallbackOnDrain.call(this, cb)
434
- }
435
-
436
- if (this._writing) {
437
- return
438
- }
439
-
440
- if (this._bufs.length === 0) {
441
- this._bufs.push([])
442
- this._lens.push(0)
443
- }
444
-
445
- this._actualWrite()
281
+ actualWrite(this)
446
282
  }
447
283
 
448
284
  SonicBoom.prototype.reopen = function (file) {
@@ -465,9 +301,6 @@ SonicBoom.prototype.reopen = function (file) {
465
301
  throw new Error('Unable to reopen a file descriptor, you must pass a file to SonicBoom')
466
302
  }
467
303
 
468
- if (file) {
469
- this.file = file
470
- }
471
304
  this._reopening = true
472
305
 
473
306
  if (this._writing) {
@@ -485,7 +318,7 @@ SonicBoom.prototype.reopen = function (file) {
485
318
  }
486
319
  })
487
320
 
488
- openFile(this.file, this)
321
+ openFile(file || this.file, this)
489
322
  }
490
323
 
491
324
  SonicBoom.prototype.end = function () {
@@ -511,13 +344,13 @@ SonicBoom.prototype.end = function () {
511
344
  }
512
345
 
513
346
  if (this._len > 0 && this.fd >= 0) {
514
- this._actualWrite()
347
+ actualWrite(this)
515
348
  } else {
516
349
  actualClose(this)
517
350
  }
518
351
  }
519
352
 
520
- function flushSync () {
353
+ SonicBoom.prototype.flushSync = function () {
521
354
  if (this.destroyed) {
522
355
  throw new Error('SonicBoom destroyed')
523
356
  }
@@ -531,66 +364,13 @@ function flushSync () {
531
364
  this._writingBuf = ''
532
365
  }
533
366
 
534
- let buf = ''
535
- while (this._bufs.length || buf) {
536
- if (buf.length <= 0) {
537
- buf = this._bufs[0]
538
- }
539
- try {
540
- const n = fs.writeSync(this.fd, buf, 'utf8')
541
- const releasedBufObj = releaseWritingBuf(buf, this._len, n)
542
- buf = releasedBufObj.writingBuf
543
- this._len = releasedBufObj.len
544
- if (buf.length <= 0) {
545
- this._bufs.shift()
546
- }
547
- } catch (err) {
548
- const shouldRetry = err.code === 'EAGAIN' || err.code === 'EBUSY'
549
- if (shouldRetry && !this.retryEAGAIN(err, buf.length, this._len - buf.length)) {
550
- throw err
551
- }
552
-
553
- sleep(BUSY_WRITE_TIMEOUT)
554
- }
555
- }
556
-
557
- try {
558
- fs.fsyncSync(this.fd)
559
- } catch {
560
- // Skip the error. The fd might not support fsync.
561
- }
562
- }
563
-
564
- function flushBufferSync () {
565
- if (this.destroyed) {
566
- throw new Error('SonicBoom destroyed')
567
- }
568
-
569
- if (this.fd < 0) {
570
- throw new Error('sonic boom is not ready yet')
571
- }
572
-
573
- if (!this._writing && this._writingBuf.length > 0) {
574
- this._bufs.unshift([this._writingBuf])
575
- this._writingBuf = kEmptyBuffer
576
- }
577
-
578
- let buf = kEmptyBuffer
579
- while (this._bufs.length || buf.length) {
580
- if (buf.length <= 0) {
581
- buf = mergeBuf(this._bufs[0], this._lens[0])
582
- }
367
+ while (this._bufs.length) {
368
+ const buf = this._bufs[0]
583
369
  try {
584
- const n = fs.writeSync(this.fd, buf)
585
- buf = buf.subarray(n)
586
- this._len = Math.max(this._len - n, 0)
587
- if (buf.length <= 0) {
588
- this._bufs.shift()
589
- this._lens.shift()
590
- }
370
+ this._len -= fs.writeSync(this.fd, buf, 'utf8')
371
+ this._bufs.shift()
591
372
  } catch (err) {
592
- const shouldRetry = err.code === 'EAGAIN' || err.code === 'EBUSY'
593
- if (shouldRetry && !this.retryEAGAIN(err, buf.length, this._len - buf.length)) {
373
+ if (err.code !== 'EAGAIN' || !this.retryEAGAIN(err, buf.length, this._len - buf.length)) {
594
374
  throw err
595
375
  }
596
376
 
@@ -606,37 +386,20 @@ SonicBoom.prototype.destroy = function () {
606
386
  actualClose(this)
607
387
  }
608
388
 
609
- function actualWrite () {
610
- const release = this.release
611
- this._writing = true
612
- this._writingBuf = this._writingBuf || this._bufs.shift() || ''
613
-
614
- if (this.sync) {
615
- try {
616
- const written = fs.writeSync(this.fd, this._writingBuf, 'utf8')
617
- release(null, written)
618
- } catch (err) {
619
- release(err)
620
- }
621
- } else {
622
- fs.write(this.fd, this._writingBuf, 'utf8', release)
623
- }
624
- }
625
-
626
- function actualWriteBuffer () {
627
- const release = this.release
628
- this._writing = true
629
- this._writingBuf = this._writingBuf.length ? this._writingBuf : mergeBuf(this._bufs.shift(), this._lens.shift())
389
+ function actualWrite (sonic) {
390
+ const release = sonic.release
391
+ sonic._writing = true
392
+ sonic._writingBuf = sonic._writingBuf || sonic._bufs.shift() || ''
630
393
 
631
- if (this.sync) {
394
+ if (sonic.sync) {
632
395
  try {
633
- const written = fs.writeSync(this.fd, this._writingBuf)
396
+ const written = fs.writeSync(sonic.fd, sonic._writingBuf, 'utf8')
634
397
  release(null, written)
635
398
  } catch (err) {
636
399
  release(err)
637
400
  }
638
401
  } else {
639
- fs.write(this.fd, this._writingBuf, release)
402
+ fs.write(sonic.fd, sonic._writingBuf, 'utf8', release)
640
403
  }
641
404
  }
642
405
 
@@ -648,18 +411,11 @@ function actualClose (sonic) {
648
411
 
649
412
  sonic.destroyed = true
650
413
  sonic._bufs = []
651
- sonic._lens = []
652
-
653
- fs.fsync(sonic.fd, closeWrapped)
654
414
 
655
- function closeWrapped () {
656
- // We skip errors in fsync
657
-
658
- if (sonic.fd !== 1 && sonic.fd !== 2) {
659
- fs.close(sonic.fd, done)
660
- } else {
661
- done()
662
- }
415
+ if (sonic.fd !== 1 && sonic.fd !== 2) {
416
+ fs.close(sonic.fd, done)
417
+ } else {
418
+ setImmediate(done)
663
419
  }
664
420
 
665
421
  function done (err) {
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "sonic-boom",
3
- "version": "3.8.1",
3
+ "version": "3.2.0",
4
4
  "description": "Extremely fast utf8 only stream implementation",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",
7
7
  "types": "types/index.d.ts",
8
8
  "scripts": {
9
- "test": "npm run test:types && standard && npm run test:unit",
10
- "test:unit": "tap",
9
+ "test": "npm run test:types && standard && tap test.js",
10
+ "test:unit": "tap test.js",
11
11
  "test:types": "tsc && tsd && ts-node types/tests/test.ts",
12
12
  "prepare": "husky install"
13
13
  },
@@ -31,19 +31,24 @@
31
31
  },
32
32
  "homepage": "https://github.com/pinojs/sonic-boom#readme",
33
33
  "devDependencies": {
34
- "@types/node": "^20.1.0",
34
+ "@types/node": "^18.0.0",
35
35
  "fastbench": "^1.0.1",
36
- "husky": "^9.0.6",
36
+ "husky": "^8.0.1",
37
37
  "proxyquire": "^2.1.3",
38
38
  "standard": "^17.0.0",
39
39
  "tap": "^16.2.0",
40
- "tsd": "^0.31.0",
41
- "typescript": "^5.0.2",
40
+ "tsd": "^0.22.0",
41
+ "typescript": "^4.7.2",
42
42
  "ts-node": "^10.8.0"
43
43
  },
44
44
  "dependencies": {
45
45
  "atomic-sleep": "^1.0.0"
46
46
  },
47
+ "husky": {
48
+ "hooks": {
49
+ "pre-commit": "npm test"
50
+ }
51
+ },
47
52
  "tsd": {
48
53
  "directory": "./types"
49
54
  }