repoburg 1.3.87 → 1.3.88

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 (544) hide show
  1. package/backend/.env +20 -0
  2. package/backend/.repoburg/hooks/README.md +53 -0
  3. package/backend/.repoburg/hooks/eslint-hook.ts +46 -0
  4. package/backend/.repoburg/hooks/example-hook.ts +62 -0
  5. package/backend/dist/src/ai-actions/ai-actions.controller.js +67 -0
  6. package/backend/dist/src/ai-actions/ai-actions.controller.js.map +1 -1
  7. package/backend/dist/src/application-state/application-state.controller.js +123 -0
  8. package/backend/dist/src/application-state/application-state.controller.js.map +1 -1
  9. package/backend/dist/src/application-state/dto/set-alibaba-config.dto.js +2 -0
  10. package/backend/dist/src/application-state/dto/set-alibaba-config.dto.js.map +1 -1
  11. package/backend/dist/src/application-state/dto/set-auto-context-fetch-enabled.dto.js +4 -0
  12. package/backend/dist/src/application-state/dto/set-auto-context-fetch-enabled.dto.js.map +1 -1
  13. package/backend/dist/src/application-state/dto/set-auto-send-to-ai-studio-enabled.dto.js +2 -0
  14. package/backend/dist/src/application-state/dto/set-auto-send-to-ai-studio-enabled.dto.js.map +1 -1
  15. package/backend/dist/src/application-state/dto/set-context-token-limit.dto.js +6 -0
  16. package/backend/dist/src/application-state/dto/set-context-token-limit.dto.js.map +1 -1
  17. package/backend/dist/src/application-state/dto/set-execution-strategy.dto.js +6 -0
  18. package/backend/dist/src/application-state/dto/set-execution-strategy.dto.js.map +1 -1
  19. package/backend/dist/src/application-state/dto/set-followup-token-limit.dto.js +5 -0
  20. package/backend/dist/src/application-state/dto/set-followup-token-limit.dto.js.map +1 -1
  21. package/backend/dist/src/application-state/dto/set-history-compression-enabled.dto.js +4 -0
  22. package/backend/dist/src/application-state/dto/set-history-compression-enabled.dto.js.map +1 -1
  23. package/backend/dist/src/application-state/dto/set-llm-retry-enabled.dto.js +4 -0
  24. package/backend/dist/src/application-state/dto/set-llm-retry-enabled.dto.js.map +1 -1
  25. package/backend/dist/src/application-state/dto/set-llm-retry-max-attempts.dto.js +6 -0
  26. package/backend/dist/src/application-state/dto/set-llm-retry-max-attempts.dto.js.map +1 -1
  27. package/backend/dist/src/application-state/dto/set-manual-llm-enabled.dto.js +4 -0
  28. package/backend/dist/src/application-state/dto/set-manual-llm-enabled.dto.js.map +1 -1
  29. package/backend/dist/src/application-state/dto/set-openrouter-config.dto.js +2 -0
  30. package/backend/dist/src/application-state/dto/set-openrouter-config.dto.js.map +1 -1
  31. package/backend/dist/src/application-state/dto/set-streaming-enabled.dto.js +2 -0
  32. package/backend/dist/src/application-state/dto/set-streaming-enabled.dto.js.map +1 -1
  33. package/backend/dist/src/application-state/dto/set-syntax-validation-enabled.dto.js +4 -0
  34. package/backend/dist/src/application-state/dto/set-syntax-validation-enabled.dto.js.map +1 -1
  35. package/backend/dist/src/application-state/dto/set-theme.dto.js +6 -0
  36. package/backend/dist/src/application-state/dto/set-theme.dto.js.map +1 -1
  37. package/backend/dist/src/application-state/dto/set-tools-enabled.dto.js +4 -0
  38. package/backend/dist/src/application-state/dto/set-tools-enabled.dto.js.map +1 -1
  39. package/backend/dist/src/application-state/dto/set-websocket-enabled.dto.js +2 -0
  40. package/backend/dist/src/application-state/dto/set-websocket-enabled.dto.js.map +1 -1
  41. package/backend/dist/src/application-state/dto/set-yolo-mode-message.dto.js +5 -0
  42. package/backend/dist/src/application-state/dto/set-yolo-mode-message.dto.js.map +1 -1
  43. package/backend/dist/src/application-state/dto/set-yolo-mode.dto.js +4 -0
  44. package/backend/dist/src/application-state/dto/set-yolo-mode.dto.js.map +1 -1
  45. package/backend/dist/src/application-state/dto/set-zai-config.dto.js +2 -0
  46. package/backend/dist/src/application-state/dto/set-zai-config.dto.js.map +1 -1
  47. package/backend/dist/src/context-snippets/context-snippets.controller.js +38 -0
  48. package/backend/dist/src/context-snippets/context-snippets.controller.js.map +1 -1
  49. package/backend/dist/src/context-templates/context-templates.controller.js +104 -0
  50. package/backend/dist/src/context-templates/context-templates.controller.js.map +1 -1
  51. package/backend/dist/src/context-templates/dto/context-template.dto.d.ts +1 -1
  52. package/backend/dist/src/context-templates/dto/context-template.dto.js +44 -1
  53. package/backend/dist/src/context-templates/dto/context-template.dto.js.map +1 -1
  54. package/backend/dist/src/core-entities/ai-action.entity.js +73 -0
  55. package/backend/dist/src/core-entities/ai-action.entity.js.map +1 -1
  56. package/backend/dist/src/core-entities/base.entity.js +18 -0
  57. package/backend/dist/src/core-entities/base.entity.js.map +1 -1
  58. package/backend/dist/src/core-entities/context-snippet.entity.js +12 -0
  59. package/backend/dist/src/core-entities/context-snippet.entity.js.map +1 -1
  60. package/backend/dist/src/core-entities/context-template.entity.d.ts +2 -4
  61. package/backend/dist/src/core-entities/context-template.entity.js +50 -7
  62. package/backend/dist/src/core-entities/context-template.entity.js.map +1 -1
  63. package/backend/dist/src/core-entities/custom-snippet.entity.js +16 -0
  64. package/backend/dist/src/core-entities/custom-snippet.entity.js.map +1 -1
  65. package/backend/dist/src/core-entities/custom-variable.entity.js +24 -0
  66. package/backend/dist/src/core-entities/custom-variable.entity.js.map +1 -1
  67. package/backend/dist/src/core-entities/enums.d.ts +64 -0
  68. package/backend/dist/src/core-entities/enums.js +77 -0
  69. package/backend/dist/src/core-entities/enums.js.map +1 -0
  70. package/backend/dist/src/core-entities/execution-log.entity.js +15 -0
  71. package/backend/dist/src/core-entities/execution-log.entity.js.map +1 -1
  72. package/backend/dist/src/core-entities/index.d.ts +1 -2
  73. package/backend/dist/src/core-entities/index.js +1 -2
  74. package/backend/dist/src/core-entities/index.js.map +1 -1
  75. package/backend/dist/src/core-entities/llm-call-log.entity.js +43 -0
  76. package/backend/dist/src/core-entities/llm-call-log.entity.js.map +1 -1
  77. package/backend/dist/src/core-entities/mcp-config.entity.js +27 -0
  78. package/backend/dist/src/core-entities/mcp-config.entity.js.map +1 -1
  79. package/backend/dist/src/core-entities/mcp-tool.entity.js +26 -0
  80. package/backend/dist/src/core-entities/mcp-tool.entity.js.map +1 -1
  81. package/backend/dist/src/core-entities/project.entity.js +13 -0
  82. package/backend/dist/src/core-entities/project.entity.js.map +1 -1
  83. package/backend/dist/src/core-entities/session-input.entity.js +94 -0
  84. package/backend/dist/src/core-entities/session-input.entity.js.map +1 -1
  85. package/backend/dist/src/core-entities/session.entity.d.ts +1 -1
  86. package/backend/dist/src/core-entities/session.entity.js +96 -1
  87. package/backend/dist/src/core-entities/session.entity.js.map +1 -1
  88. package/backend/dist/src/core-entities/system-prompt.entity.js +29 -0
  89. package/backend/dist/src/core-entities/system-prompt.entity.js.map +1 -1
  90. package/backend/dist/src/core-entities/tool-hook.entity.js +21 -0
  91. package/backend/dist/src/core-entities/tool-hook.entity.js.map +1 -1
  92. package/backend/dist/src/custom-snippets/custom-snippets.controller.js +48 -0
  93. package/backend/dist/src/custom-snippets/custom-snippets.controller.js.map +1 -1
  94. package/backend/dist/src/custom-variables/custom-variables.controller.js +46 -0
  95. package/backend/dist/src/custom-variables/custom-variables.controller.js.map +1 -1
  96. package/backend/dist/src/global-config/global-config.controller.js +12 -0
  97. package/backend/dist/src/global-config/global-config.controller.js.map +1 -1
  98. package/backend/dist/src/interactive-chat/streaming.controller.js +38 -0
  99. package/backend/dist/src/interactive-chat/streaming.controller.js.map +1 -1
  100. package/backend/dist/src/llm-call-logs/llm-call-logs.controller.js +96 -0
  101. package/backend/dist/src/llm-call-logs/llm-call-logs.controller.js.map +1 -1
  102. package/backend/dist/src/llm-provider/llm-provider.controller.js +18 -0
  103. package/backend/dist/src/llm-provider/llm-provider.controller.js.map +1 -1
  104. package/backend/dist/src/llm-provider/zai-llm.provider.js +0 -1
  105. package/backend/dist/src/llm-provider/zai-llm.provider.js.map +1 -1
  106. package/backend/dist/src/llm-responses/dto/submit-llm-response.dto.js +45 -0
  107. package/backend/dist/src/llm-responses/dto/submit-llm-response.dto.js.map +1 -1
  108. package/backend/dist/src/llm-responses/dto/sync-conversation.dto.js +24 -0
  109. package/backend/dist/src/llm-responses/dto/sync-conversation.dto.js.map +1 -1
  110. package/backend/dist/src/llm-responses/llm-responses.controller.js +32 -0
  111. package/backend/dist/src/llm-responses/llm-responses.controller.js.map +1 -1
  112. package/backend/dist/src/main.js +9 -0
  113. package/backend/dist/src/main.js.map +1 -1
  114. package/backend/dist/src/mcp/dto/batch-update-mcp-tools.dto.js +8 -0
  115. package/backend/dist/src/mcp/dto/batch-update-mcp-tools.dto.js.map +1 -1
  116. package/backend/dist/src/mcp/dto/create-mcp-config.dto.js +5 -0
  117. package/backend/dist/src/mcp/dto/create-mcp-config.dto.js.map +1 -1
  118. package/backend/dist/src/mcp/dto/update-mcp-config.dto.js +2 -0
  119. package/backend/dist/src/mcp/dto/update-mcp-config.dto.js.map +1 -1
  120. package/backend/dist/src/mcp/mcp.controller.js +21 -0
  121. package/backend/dist/src/mcp/mcp.controller.js.map +1 -1
  122. package/backend/dist/src/projects/dto/project.dto.js +14 -0
  123. package/backend/dist/src/projects/dto/project.dto.js.map +1 -1
  124. package/backend/dist/src/projects/projects.controller.js +31 -0
  125. package/backend/dist/src/projects/projects.controller.js.map +1 -1
  126. package/backend/dist/src/session-inputs/dto/session-input.dto.d.ts +12 -1
  127. package/backend/dist/src/session-inputs/dto/session-input.dto.js +103 -1
  128. package/backend/dist/src/session-inputs/dto/session-input.dto.js.map +1 -1
  129. package/backend/dist/src/session-inputs/session-input.subscriber.js.map +1 -1
  130. package/backend/dist/src/session-inputs/session-inputs.controller.d.ts +2 -1
  131. package/backend/dist/src/session-inputs/session-inputs.controller.js +84 -0
  132. package/backend/dist/src/session-inputs/session-inputs.controller.js.map +1 -1
  133. package/backend/dist/src/session-inputs/session-inputs.module.js +1 -0
  134. package/backend/dist/src/session-inputs/session-inputs.module.js.map +1 -1
  135. package/backend/dist/src/session-inputs/session-inputs.service.d.ts +7 -3
  136. package/backend/dist/src/session-inputs/session-inputs.service.js +51 -4
  137. package/backend/dist/src/session-inputs/session-inputs.service.js.map +1 -1
  138. package/backend/dist/src/sessions/dto/session.dto.js +91 -0
  139. package/backend/dist/src/sessions/dto/session.dto.js.map +1 -1
  140. package/backend/dist/src/sessions/sessions.controller.js +112 -0
  141. package/backend/dist/src/sessions/sessions.controller.js.map +1 -1
  142. package/backend/dist/src/sub-agents/dto/create-sub-agent.dto.js +26 -0
  143. package/backend/dist/src/sub-agents/dto/create-sub-agent.dto.js.map +1 -1
  144. package/backend/dist/src/sub-agents/dto/update-sub-agent.dto.js +22 -0
  145. package/backend/dist/src/sub-agents/dto/update-sub-agent.dto.js.map +1 -1
  146. package/backend/dist/src/sub-agents/sub-agent-run.entity.d.ts +2 -7
  147. package/backend/dist/src/sub-agents/sub-agent-run.entity.js +63 -9
  148. package/backend/dist/src/sub-agents/sub-agent-run.entity.js.map +1 -1
  149. package/backend/dist/src/sub-agents/sub-agent-runs.controller.js +63 -0
  150. package/backend/dist/src/sub-agents/sub-agent-runs.controller.js.map +1 -1
  151. package/backend/dist/src/sub-agents/sub-agent.entity.js +47 -0
  152. package/backend/dist/src/sub-agents/sub-agent.entity.js.map +1 -1
  153. package/backend/dist/src/sub-agents/sub-agents.controller.js +25 -0
  154. package/backend/dist/src/sub-agents/sub-agents.controller.js.map +1 -1
  155. package/backend/dist/src/system-prompts/dto/set-enabled-tools.dto.js +9 -0
  156. package/backend/dist/src/system-prompts/dto/set-enabled-tools.dto.js.map +1 -1
  157. package/backend/dist/src/system-prompts/dto/system-prompt.dto.js +43 -0
  158. package/backend/dist/src/system-prompts/dto/system-prompt.dto.js.map +1 -1
  159. package/backend/dist/src/system-prompts/dto/toggle-tool.dto.js +5 -0
  160. package/backend/dist/src/system-prompts/dto/toggle-tool.dto.js.map +1 -1
  161. package/backend/dist/src/system-prompts/system-prompts.controller.js +80 -0
  162. package/backend/dist/src/system-prompts/system-prompts.controller.js.map +1 -1
  163. package/backend/dist/src/tool-hooks/dto/create-tool-hook.dto.js +14 -0
  164. package/backend/dist/src/tool-hooks/dto/create-tool-hook.dto.js.map +1 -1
  165. package/backend/dist/src/tool-hooks/dto/update-tool-hook.dto.js +11 -0
  166. package/backend/dist/src/tool-hooks/dto/update-tool-hook.dto.js.map +1 -1
  167. package/backend/dist/src/tool-hooks/tool-hooks.controller.js +52 -0
  168. package/backend/dist/src/tool-hooks/tool-hooks.controller.js.map +1 -1
  169. package/backend/dist/src/visual-editor/visual-editor.controller.js +15 -0
  170. package/backend/dist/src/visual-editor/visual-editor.controller.js.map +1 -1
  171. package/backend/dist/src/workspace/workspace.controller.js +41 -0
  172. package/backend/dist/src/workspace/workspace.controller.js.map +1 -1
  173. package/backend/dist/tsconfig.build.tsbuildinfo +1 -1
  174. package/{daemon/node_modules/undici-types → backend/node_modules/@eslint/eslintrc}/LICENSE +5 -7
  175. package/backend/node_modules/@eslint/eslintrc/README.md +115 -0
  176. package/backend/node_modules/@eslint/eslintrc/conf/config-schema.js +79 -0
  177. package/backend/node_modules/@eslint/eslintrc/conf/environments.js +215 -0
  178. package/backend/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs +1104 -0
  179. package/backend/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs.map +1 -0
  180. package/backend/node_modules/@eslint/eslintrc/dist/eslintrc.cjs +4344 -0
  181. package/backend/node_modules/@eslint/eslintrc/dist/eslintrc.cjs.map +1 -0
  182. package/backend/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js +532 -0
  183. package/backend/node_modules/@eslint/eslintrc/lib/config-array/config-array.js +523 -0
  184. package/backend/node_modules/@eslint/eslintrc/lib/config-array/config-dependency.js +124 -0
  185. package/backend/node_modules/@eslint/eslintrc/lib/config-array/extracted-config.js +145 -0
  186. package/backend/node_modules/@eslint/eslintrc/lib/config-array/ignore-pattern.js +238 -0
  187. package/backend/node_modules/@eslint/eslintrc/lib/config-array/index.js +19 -0
  188. package/backend/node_modules/@eslint/eslintrc/lib/config-array/override-tester.js +225 -0
  189. package/backend/node_modules/@eslint/eslintrc/lib/config-array-factory.js +1151 -0
  190. package/backend/node_modules/@eslint/eslintrc/lib/flat-compat.js +318 -0
  191. package/backend/node_modules/@eslint/eslintrc/lib/index-universal.js +29 -0
  192. package/backend/node_modules/@eslint/eslintrc/lib/index.js +56 -0
  193. package/backend/node_modules/@eslint/eslintrc/lib/shared/ajv.js +191 -0
  194. package/backend/node_modules/@eslint/eslintrc/lib/shared/config-ops.js +135 -0
  195. package/backend/node_modules/@eslint/eslintrc/lib/shared/config-validator.js +325 -0
  196. package/backend/node_modules/@eslint/eslintrc/lib/shared/deprecation-warnings.js +63 -0
  197. package/backend/node_modules/@eslint/eslintrc/lib/shared/naming.js +96 -0
  198. package/backend/node_modules/@eslint/eslintrc/lib/shared/relative-module-resolver.js +42 -0
  199. package/backend/node_modules/@eslint/eslintrc/lib/shared/types.js +149 -0
  200. package/backend/node_modules/@eslint/eslintrc/package.json +82 -0
  201. package/backend/node_modules/@eslint/eslintrc/universal.js +9 -0
  202. package/backend/package.json +1 -3
  203. package/daemon/dist/api/system.js +25 -0
  204. package/daemon/dist/daemon.blob +0 -0
  205. package/daemon/dist/index.js +0 -0
  206. package/package.json +3 -1
  207. package/visual-editor-proxy/.repoburg/data.sqlite +0 -0
  208. package/visual-editor-proxy/dist/tsconfig.tsbuildinfo +1 -1
  209. package/backend/node_modules/@types/node/LICENSE +0 -21
  210. package/backend/node_modules/@types/node/README.md +0 -15
  211. package/backend/node_modules/@types/node/assert/strict.d.ts +0 -8
  212. package/backend/node_modules/@types/node/assert.d.ts +0 -1044
  213. package/backend/node_modules/@types/node/async_hooks.d.ts +0 -605
  214. package/backend/node_modules/@types/node/buffer.buffer.d.ts +0 -462
  215. package/backend/node_modules/@types/node/buffer.d.ts +0 -1932
  216. package/backend/node_modules/@types/node/child_process.d.ts +0 -1452
  217. package/backend/node_modules/@types/node/cluster.d.ts +0 -578
  218. package/backend/node_modules/@types/node/compatibility/disposable.d.ts +0 -16
  219. package/backend/node_modules/@types/node/compatibility/index.d.ts +0 -9
  220. package/backend/node_modules/@types/node/compatibility/indexable.d.ts +0 -20
  221. package/backend/node_modules/@types/node/compatibility/iterators.d.ts +0 -21
  222. package/backend/node_modules/@types/node/console.d.ts +0 -452
  223. package/backend/node_modules/@types/node/constants.d.ts +0 -21
  224. package/backend/node_modules/@types/node/crypto.d.ts +0 -4570
  225. package/backend/node_modules/@types/node/dgram.d.ts +0 -596
  226. package/backend/node_modules/@types/node/diagnostics_channel.d.ts +0 -578
  227. package/backend/node_modules/@types/node/dns/promises.d.ts +0 -479
  228. package/backend/node_modules/@types/node/dns.d.ts +0 -871
  229. package/backend/node_modules/@types/node/domain.d.ts +0 -170
  230. package/backend/node_modules/@types/node/events.d.ts +0 -931
  231. package/backend/node_modules/@types/node/fs/promises.d.ts +0 -1248
  232. package/backend/node_modules/@types/node/fs.d.ts +0 -4362
  233. package/backend/node_modules/@types/node/globals.d.ts +0 -170
  234. package/backend/node_modules/@types/node/globals.typedarray.d.ts +0 -21
  235. package/backend/node_modules/@types/node/http.d.ts +0 -2031
  236. package/backend/node_modules/@types/node/http2.d.ts +0 -2623
  237. package/backend/node_modules/@types/node/https.d.ts +0 -549
  238. package/backend/node_modules/@types/node/index.d.ts +0 -93
  239. package/backend/node_modules/@types/node/inspector.generated.d.ts +0 -3966
  240. package/backend/node_modules/@types/node/module.d.ts +0 -539
  241. package/backend/node_modules/@types/node/net.d.ts +0 -1011
  242. package/backend/node_modules/@types/node/os.d.ts +0 -495
  243. package/backend/node_modules/@types/node/package.json +0 -140
  244. package/backend/node_modules/@types/node/path.d.ts +0 -200
  245. package/backend/node_modules/@types/node/perf_hooks.d.ts +0 -963
  246. package/backend/node_modules/@types/node/process.d.ts +0 -1956
  247. package/backend/node_modules/@types/node/punycode.d.ts +0 -117
  248. package/backend/node_modules/@types/node/querystring.d.ts +0 -152
  249. package/backend/node_modules/@types/node/readline/promises.d.ts +0 -162
  250. package/backend/node_modules/@types/node/readline.d.ts +0 -589
  251. package/backend/node_modules/@types/node/repl.d.ts +0 -430
  252. package/backend/node_modules/@types/node/sea.d.ts +0 -153
  253. package/backend/node_modules/@types/node/stream/consumers.d.ts +0 -38
  254. package/backend/node_modules/@types/node/stream/promises.d.ts +0 -90
  255. package/backend/node_modules/@types/node/stream/web.d.ts +0 -533
  256. package/backend/node_modules/@types/node/stream.d.ts +0 -1668
  257. package/backend/node_modules/@types/node/string_decoder.d.ts +0 -67
  258. package/backend/node_modules/@types/node/test.d.ts +0 -1807
  259. package/backend/node_modules/@types/node/timers/promises.d.ts +0 -108
  260. package/backend/node_modules/@types/node/timers.d.ts +0 -286
  261. package/backend/node_modules/@types/node/tls.d.ts +0 -1231
  262. package/backend/node_modules/@types/node/trace_events.d.ts +0 -197
  263. package/backend/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +0 -460
  264. package/backend/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +0 -19
  265. package/backend/node_modules/@types/node/ts5.6/index.d.ts +0 -93
  266. package/backend/node_modules/@types/node/tty.d.ts +0 -208
  267. package/backend/node_modules/@types/node/url.d.ts +0 -964
  268. package/backend/node_modules/@types/node/util.d.ts +0 -2331
  269. package/backend/node_modules/@types/node/v8.d.ts +0 -808
  270. package/backend/node_modules/@types/node/vm.d.ts +0 -1030
  271. package/backend/node_modules/@types/node/wasi.d.ts +0 -181
  272. package/backend/node_modules/@types/node/web-globals/abortcontroller.d.ts +0 -34
  273. package/backend/node_modules/@types/node/web-globals/domexception.d.ts +0 -68
  274. package/backend/node_modules/@types/node/web-globals/events.d.ts +0 -94
  275. package/backend/node_modules/@types/node/web-globals/fetch.d.ts +0 -46
  276. package/backend/node_modules/@types/node/worker_threads.d.ts +0 -743
  277. package/backend/node_modules/@types/node/zlib.d.ts +0 -539
  278. package/backend/node_modules/debug/LICENSE +0 -20
  279. package/backend/node_modules/debug/README.md +0 -481
  280. package/backend/node_modules/debug/package.json +0 -64
  281. package/backend/node_modules/debug/src/browser.js +0 -272
  282. package/backend/node_modules/debug/src/common.js +0 -292
  283. package/backend/node_modules/debug/src/index.js +0 -10
  284. package/backend/node_modules/debug/src/node.js +0 -263
  285. package/backend/node_modules/undici-types/LICENSE +0 -21
  286. package/backend/node_modules/undici-types/README.md +0 -6
  287. package/backend/node_modules/undici-types/agent.d.ts +0 -31
  288. package/backend/node_modules/undici-types/api.d.ts +0 -43
  289. package/backend/node_modules/undici-types/balanced-pool.d.ts +0 -29
  290. package/backend/node_modules/undici-types/cache.d.ts +0 -36
  291. package/backend/node_modules/undici-types/client.d.ts +0 -108
  292. package/backend/node_modules/undici-types/connector.d.ts +0 -34
  293. package/backend/node_modules/undici-types/content-type.d.ts +0 -21
  294. package/backend/node_modules/undici-types/cookies.d.ts +0 -28
  295. package/backend/node_modules/undici-types/diagnostics-channel.d.ts +0 -66
  296. package/backend/node_modules/undici-types/dispatcher.d.ts +0 -256
  297. package/backend/node_modules/undici-types/env-http-proxy-agent.d.ts +0 -21
  298. package/backend/node_modules/undici-types/errors.d.ts +0 -149
  299. package/backend/node_modules/undici-types/eventsource.d.ts +0 -61
  300. package/backend/node_modules/undici-types/fetch.d.ts +0 -209
  301. package/backend/node_modules/undici-types/file.d.ts +0 -39
  302. package/backend/node_modules/undici-types/filereader.d.ts +0 -54
  303. package/backend/node_modules/undici-types/formdata.d.ts +0 -108
  304. package/backend/node_modules/undici-types/global-dispatcher.d.ts +0 -9
  305. package/backend/node_modules/undici-types/global-origin.d.ts +0 -7
  306. package/backend/node_modules/undici-types/handlers.d.ts +0 -15
  307. package/backend/node_modules/undici-types/header.d.ts +0 -4
  308. package/backend/node_modules/undici-types/index.d.ts +0 -71
  309. package/backend/node_modules/undici-types/interceptors.d.ts +0 -17
  310. package/backend/node_modules/undici-types/mock-agent.d.ts +0 -50
  311. package/backend/node_modules/undici-types/mock-client.d.ts +0 -25
  312. package/backend/node_modules/undici-types/mock-errors.d.ts +0 -12
  313. package/backend/node_modules/undici-types/mock-interceptor.d.ts +0 -93
  314. package/backend/node_modules/undici-types/mock-pool.d.ts +0 -25
  315. package/backend/node_modules/undici-types/package.json +0 -55
  316. package/backend/node_modules/undici-types/patch.d.ts +0 -33
  317. package/backend/node_modules/undici-types/pool-stats.d.ts +0 -19
  318. package/backend/node_modules/undici-types/pool.d.ts +0 -39
  319. package/backend/node_modules/undici-types/proxy-agent.d.ts +0 -28
  320. package/backend/node_modules/undici-types/readable.d.ts +0 -65
  321. package/backend/node_modules/undici-types/retry-agent.d.ts +0 -8
  322. package/backend/node_modules/undici-types/retry-handler.d.ts +0 -116
  323. package/backend/node_modules/undici-types/util.d.ts +0 -18
  324. package/backend/node_modules/undici-types/webidl.d.ts +0 -228
  325. package/backend/node_modules/undici-types/websocket.d.ts +0 -150
  326. package/daemon/node_modules/@types/node/LICENSE +0 -21
  327. package/daemon/node_modules/@types/node/README.md +0 -15
  328. package/daemon/node_modules/@types/node/assert/strict.d.ts +0 -8
  329. package/daemon/node_modules/@types/node/assert.d.ts +0 -1044
  330. package/daemon/node_modules/@types/node/async_hooks.d.ts +0 -605
  331. package/daemon/node_modules/@types/node/buffer.buffer.d.ts +0 -462
  332. package/daemon/node_modules/@types/node/buffer.d.ts +0 -1932
  333. package/daemon/node_modules/@types/node/child_process.d.ts +0 -1452
  334. package/daemon/node_modules/@types/node/cluster.d.ts +0 -578
  335. package/daemon/node_modules/@types/node/compatibility/disposable.d.ts +0 -16
  336. package/daemon/node_modules/@types/node/compatibility/index.d.ts +0 -9
  337. package/daemon/node_modules/@types/node/compatibility/indexable.d.ts +0 -20
  338. package/daemon/node_modules/@types/node/compatibility/iterators.d.ts +0 -21
  339. package/daemon/node_modules/@types/node/console.d.ts +0 -452
  340. package/daemon/node_modules/@types/node/constants.d.ts +0 -21
  341. package/daemon/node_modules/@types/node/crypto.d.ts +0 -4570
  342. package/daemon/node_modules/@types/node/dgram.d.ts +0 -596
  343. package/daemon/node_modules/@types/node/diagnostics_channel.d.ts +0 -578
  344. package/daemon/node_modules/@types/node/dns/promises.d.ts +0 -479
  345. package/daemon/node_modules/@types/node/dns.d.ts +0 -871
  346. package/daemon/node_modules/@types/node/domain.d.ts +0 -170
  347. package/daemon/node_modules/@types/node/events.d.ts +0 -931
  348. package/daemon/node_modules/@types/node/fs/promises.d.ts +0 -1248
  349. package/daemon/node_modules/@types/node/fs.d.ts +0 -4362
  350. package/daemon/node_modules/@types/node/globals.d.ts +0 -170
  351. package/daemon/node_modules/@types/node/globals.typedarray.d.ts +0 -21
  352. package/daemon/node_modules/@types/node/http.d.ts +0 -2031
  353. package/daemon/node_modules/@types/node/http2.d.ts +0 -2623
  354. package/daemon/node_modules/@types/node/https.d.ts +0 -549
  355. package/daemon/node_modules/@types/node/index.d.ts +0 -93
  356. package/daemon/node_modules/@types/node/inspector.generated.d.ts +0 -3966
  357. package/daemon/node_modules/@types/node/module.d.ts +0 -539
  358. package/daemon/node_modules/@types/node/net.d.ts +0 -1011
  359. package/daemon/node_modules/@types/node/os.d.ts +0 -495
  360. package/daemon/node_modules/@types/node/package.json +0 -140
  361. package/daemon/node_modules/@types/node/path.d.ts +0 -200
  362. package/daemon/node_modules/@types/node/perf_hooks.d.ts +0 -963
  363. package/daemon/node_modules/@types/node/process.d.ts +0 -1956
  364. package/daemon/node_modules/@types/node/punycode.d.ts +0 -117
  365. package/daemon/node_modules/@types/node/querystring.d.ts +0 -152
  366. package/daemon/node_modules/@types/node/readline/promises.d.ts +0 -162
  367. package/daemon/node_modules/@types/node/readline.d.ts +0 -589
  368. package/daemon/node_modules/@types/node/repl.d.ts +0 -430
  369. package/daemon/node_modules/@types/node/sea.d.ts +0 -153
  370. package/daemon/node_modules/@types/node/stream/consumers.d.ts +0 -38
  371. package/daemon/node_modules/@types/node/stream/promises.d.ts +0 -90
  372. package/daemon/node_modules/@types/node/stream/web.d.ts +0 -533
  373. package/daemon/node_modules/@types/node/stream.d.ts +0 -1668
  374. package/daemon/node_modules/@types/node/string_decoder.d.ts +0 -67
  375. package/daemon/node_modules/@types/node/test.d.ts +0 -1807
  376. package/daemon/node_modules/@types/node/timers/promises.d.ts +0 -108
  377. package/daemon/node_modules/@types/node/timers.d.ts +0 -286
  378. package/daemon/node_modules/@types/node/tls.d.ts +0 -1231
  379. package/daemon/node_modules/@types/node/trace_events.d.ts +0 -197
  380. package/daemon/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +0 -460
  381. package/daemon/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +0 -19
  382. package/daemon/node_modules/@types/node/ts5.6/index.d.ts +0 -93
  383. package/daemon/node_modules/@types/node/tty.d.ts +0 -208
  384. package/daemon/node_modules/@types/node/url.d.ts +0 -964
  385. package/daemon/node_modules/@types/node/util.d.ts +0 -2331
  386. package/daemon/node_modules/@types/node/v8.d.ts +0 -808
  387. package/daemon/node_modules/@types/node/vm.d.ts +0 -1030
  388. package/daemon/node_modules/@types/node/wasi.d.ts +0 -181
  389. package/daemon/node_modules/@types/node/web-globals/abortcontroller.d.ts +0 -34
  390. package/daemon/node_modules/@types/node/web-globals/domexception.d.ts +0 -68
  391. package/daemon/node_modules/@types/node/web-globals/events.d.ts +0 -94
  392. package/daemon/node_modules/@types/node/web-globals/fetch.d.ts +0 -46
  393. package/daemon/node_modules/@types/node/worker_threads.d.ts +0 -743
  394. package/daemon/node_modules/@types/node/zlib.d.ts +0 -539
  395. package/daemon/node_modules/undici-types/README.md +0 -6
  396. package/daemon/node_modules/undici-types/agent.d.ts +0 -31
  397. package/daemon/node_modules/undici-types/api.d.ts +0 -43
  398. package/daemon/node_modules/undici-types/balanced-pool.d.ts +0 -29
  399. package/daemon/node_modules/undici-types/cache.d.ts +0 -36
  400. package/daemon/node_modules/undici-types/client.d.ts +0 -108
  401. package/daemon/node_modules/undici-types/connector.d.ts +0 -34
  402. package/daemon/node_modules/undici-types/content-type.d.ts +0 -21
  403. package/daemon/node_modules/undici-types/cookies.d.ts +0 -28
  404. package/daemon/node_modules/undici-types/diagnostics-channel.d.ts +0 -66
  405. package/daemon/node_modules/undici-types/dispatcher.d.ts +0 -256
  406. package/daemon/node_modules/undici-types/env-http-proxy-agent.d.ts +0 -21
  407. package/daemon/node_modules/undici-types/errors.d.ts +0 -149
  408. package/daemon/node_modules/undici-types/eventsource.d.ts +0 -61
  409. package/daemon/node_modules/undici-types/fetch.d.ts +0 -209
  410. package/daemon/node_modules/undici-types/file.d.ts +0 -39
  411. package/daemon/node_modules/undici-types/filereader.d.ts +0 -54
  412. package/daemon/node_modules/undici-types/formdata.d.ts +0 -108
  413. package/daemon/node_modules/undici-types/global-dispatcher.d.ts +0 -9
  414. package/daemon/node_modules/undici-types/global-origin.d.ts +0 -7
  415. package/daemon/node_modules/undici-types/handlers.d.ts +0 -15
  416. package/daemon/node_modules/undici-types/header.d.ts +0 -4
  417. package/daemon/node_modules/undici-types/index.d.ts +0 -71
  418. package/daemon/node_modules/undici-types/interceptors.d.ts +0 -17
  419. package/daemon/node_modules/undici-types/mock-agent.d.ts +0 -50
  420. package/daemon/node_modules/undici-types/mock-client.d.ts +0 -25
  421. package/daemon/node_modules/undici-types/mock-errors.d.ts +0 -12
  422. package/daemon/node_modules/undici-types/mock-interceptor.d.ts +0 -93
  423. package/daemon/node_modules/undici-types/mock-pool.d.ts +0 -25
  424. package/daemon/node_modules/undici-types/package.json +0 -55
  425. package/daemon/node_modules/undici-types/patch.d.ts +0 -33
  426. package/daemon/node_modules/undici-types/pool-stats.d.ts +0 -19
  427. package/daemon/node_modules/undici-types/pool.d.ts +0 -39
  428. package/daemon/node_modules/undici-types/proxy-agent.d.ts +0 -28
  429. package/daemon/node_modules/undici-types/readable.d.ts +0 -65
  430. package/daemon/node_modules/undici-types/retry-agent.d.ts +0 -8
  431. package/daemon/node_modules/undici-types/retry-handler.d.ts +0 -116
  432. package/daemon/node_modules/undici-types/util.d.ts +0 -18
  433. package/daemon/node_modules/undici-types/webidl.d.ts +0 -228
  434. package/daemon/node_modules/undici-types/websocket.d.ts +0 -150
  435. package/visual-editor-proxy/node_modules/@types/node/LICENSE +0 -21
  436. package/visual-editor-proxy/node_modules/@types/node/README.md +0 -15
  437. package/visual-editor-proxy/node_modules/@types/node/assert/strict.d.ts +0 -8
  438. package/visual-editor-proxy/node_modules/@types/node/assert.d.ts +0 -1062
  439. package/visual-editor-proxy/node_modules/@types/node/async_hooks.d.ts +0 -605
  440. package/visual-editor-proxy/node_modules/@types/node/buffer.buffer.d.ts +0 -462
  441. package/visual-editor-proxy/node_modules/@types/node/buffer.d.ts +0 -1932
  442. package/visual-editor-proxy/node_modules/@types/node/child_process.d.ts +0 -1458
  443. package/visual-editor-proxy/node_modules/@types/node/cluster.d.ts +0 -577
  444. package/visual-editor-proxy/node_modules/@types/node/compatibility/disposable.d.ts +0 -16
  445. package/visual-editor-proxy/node_modules/@types/node/compatibility/index.d.ts +0 -9
  446. package/visual-editor-proxy/node_modules/@types/node/compatibility/indexable.d.ts +0 -20
  447. package/visual-editor-proxy/node_modules/@types/node/compatibility/iterators.d.ts +0 -21
  448. package/visual-editor-proxy/node_modules/@types/node/console.d.ts +0 -452
  449. package/visual-editor-proxy/node_modules/@types/node/constants.d.ts +0 -21
  450. package/visual-editor-proxy/node_modules/@types/node/crypto.d.ts +0 -4570
  451. package/visual-editor-proxy/node_modules/@types/node/dgram.d.ts +0 -596
  452. package/visual-editor-proxy/node_modules/@types/node/diagnostics_channel.d.ts +0 -578
  453. package/visual-editor-proxy/node_modules/@types/node/dns/promises.d.ts +0 -479
  454. package/visual-editor-proxy/node_modules/@types/node/dns.d.ts +0 -871
  455. package/visual-editor-proxy/node_modules/@types/node/domain.d.ts +0 -170
  456. package/visual-editor-proxy/node_modules/@types/node/events.d.ts +0 -977
  457. package/visual-editor-proxy/node_modules/@types/node/fs/promises.d.ts +0 -1248
  458. package/visual-editor-proxy/node_modules/@types/node/fs.d.ts +0 -4362
  459. package/visual-editor-proxy/node_modules/@types/node/globals.d.ts +0 -172
  460. package/visual-editor-proxy/node_modules/@types/node/globals.typedarray.d.ts +0 -21
  461. package/visual-editor-proxy/node_modules/@types/node/http.d.ts +0 -2030
  462. package/visual-editor-proxy/node_modules/@types/node/http2.d.ts +0 -2624
  463. package/visual-editor-proxy/node_modules/@types/node/https.d.ts +0 -546
  464. package/visual-editor-proxy/node_modules/@types/node/index.d.ts +0 -93
  465. package/visual-editor-proxy/node_modules/@types/node/inspector.generated.d.ts +0 -3966
  466. package/visual-editor-proxy/node_modules/@types/node/module.d.ts +0 -539
  467. package/visual-editor-proxy/node_modules/@types/node/net.d.ts +0 -1011
  468. package/visual-editor-proxy/node_modules/@types/node/os.d.ts +0 -505
  469. package/visual-editor-proxy/node_modules/@types/node/package.json +0 -140
  470. package/visual-editor-proxy/node_modules/@types/node/path.d.ts +0 -200
  471. package/visual-editor-proxy/node_modules/@types/node/perf_hooks.d.ts +0 -961
  472. package/visual-editor-proxy/node_modules/@types/node/process.d.ts +0 -1944
  473. package/visual-editor-proxy/node_modules/@types/node/punycode.d.ts +0 -117
  474. package/visual-editor-proxy/node_modules/@types/node/querystring.d.ts +0 -152
  475. package/visual-editor-proxy/node_modules/@types/node/readline/promises.d.ts +0 -162
  476. package/visual-editor-proxy/node_modules/@types/node/readline.d.ts +0 -589
  477. package/visual-editor-proxy/node_modules/@types/node/repl.d.ts +0 -430
  478. package/visual-editor-proxy/node_modules/@types/node/sea.d.ts +0 -153
  479. package/visual-editor-proxy/node_modules/@types/node/stream/consumers.d.ts +0 -38
  480. package/visual-editor-proxy/node_modules/@types/node/stream/promises.d.ts +0 -90
  481. package/visual-editor-proxy/node_modules/@types/node/stream/web.d.ts +0 -533
  482. package/visual-editor-proxy/node_modules/@types/node/stream.d.ts +0 -1675
  483. package/visual-editor-proxy/node_modules/@types/node/string_decoder.d.ts +0 -67
  484. package/visual-editor-proxy/node_modules/@types/node/test.d.ts +0 -1787
  485. package/visual-editor-proxy/node_modules/@types/node/timers/promises.d.ts +0 -108
  486. package/visual-editor-proxy/node_modules/@types/node/timers.d.ts +0 -286
  487. package/visual-editor-proxy/node_modules/@types/node/tls.d.ts +0 -1231
  488. package/visual-editor-proxy/node_modules/@types/node/trace_events.d.ts +0 -197
  489. package/visual-editor-proxy/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +0 -460
  490. package/visual-editor-proxy/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +0 -19
  491. package/visual-editor-proxy/node_modules/@types/node/ts5.6/index.d.ts +0 -93
  492. package/visual-editor-proxy/node_modules/@types/node/tty.d.ts +0 -208
  493. package/visual-editor-proxy/node_modules/@types/node/url.d.ts +0 -964
  494. package/visual-editor-proxy/node_modules/@types/node/util.d.ts +0 -2331
  495. package/visual-editor-proxy/node_modules/@types/node/v8.d.ts +0 -808
  496. package/visual-editor-proxy/node_modules/@types/node/vm.d.ts +0 -1000
  497. package/visual-editor-proxy/node_modules/@types/node/wasi.d.ts +0 -181
  498. package/visual-editor-proxy/node_modules/@types/node/web-globals/abortcontroller.d.ts +0 -34
  499. package/visual-editor-proxy/node_modules/@types/node/web-globals/domexception.d.ts +0 -68
  500. package/visual-editor-proxy/node_modules/@types/node/web-globals/events.d.ts +0 -97
  501. package/visual-editor-proxy/node_modules/@types/node/web-globals/fetch.d.ts +0 -46
  502. package/visual-editor-proxy/node_modules/@types/node/worker_threads.d.ts +0 -715
  503. package/visual-editor-proxy/node_modules/@types/node/zlib.d.ts +0 -539
  504. package/visual-editor-proxy/node_modules/undici-types/LICENSE +0 -21
  505. package/visual-editor-proxy/node_modules/undici-types/README.md +0 -6
  506. package/visual-editor-proxy/node_modules/undici-types/agent.d.ts +0 -31
  507. package/visual-editor-proxy/node_modules/undici-types/api.d.ts +0 -43
  508. package/visual-editor-proxy/node_modules/undici-types/balanced-pool.d.ts +0 -29
  509. package/visual-editor-proxy/node_modules/undici-types/cache.d.ts +0 -36
  510. package/visual-editor-proxy/node_modules/undici-types/client.d.ts +0 -108
  511. package/visual-editor-proxy/node_modules/undici-types/connector.d.ts +0 -34
  512. package/visual-editor-proxy/node_modules/undici-types/content-type.d.ts +0 -21
  513. package/visual-editor-proxy/node_modules/undici-types/cookies.d.ts +0 -28
  514. package/visual-editor-proxy/node_modules/undici-types/diagnostics-channel.d.ts +0 -66
  515. package/visual-editor-proxy/node_modules/undici-types/dispatcher.d.ts +0 -256
  516. package/visual-editor-proxy/node_modules/undici-types/env-http-proxy-agent.d.ts +0 -21
  517. package/visual-editor-proxy/node_modules/undici-types/errors.d.ts +0 -149
  518. package/visual-editor-proxy/node_modules/undici-types/eventsource.d.ts +0 -61
  519. package/visual-editor-proxy/node_modules/undici-types/fetch.d.ts +0 -209
  520. package/visual-editor-proxy/node_modules/undici-types/file.d.ts +0 -39
  521. package/visual-editor-proxy/node_modules/undici-types/filereader.d.ts +0 -54
  522. package/visual-editor-proxy/node_modules/undici-types/formdata.d.ts +0 -108
  523. package/visual-editor-proxy/node_modules/undici-types/global-dispatcher.d.ts +0 -9
  524. package/visual-editor-proxy/node_modules/undici-types/global-origin.d.ts +0 -7
  525. package/visual-editor-proxy/node_modules/undici-types/handlers.d.ts +0 -15
  526. package/visual-editor-proxy/node_modules/undici-types/header.d.ts +0 -4
  527. package/visual-editor-proxy/node_modules/undici-types/index.d.ts +0 -71
  528. package/visual-editor-proxy/node_modules/undici-types/interceptors.d.ts +0 -17
  529. package/visual-editor-proxy/node_modules/undici-types/mock-agent.d.ts +0 -50
  530. package/visual-editor-proxy/node_modules/undici-types/mock-client.d.ts +0 -25
  531. package/visual-editor-proxy/node_modules/undici-types/mock-errors.d.ts +0 -12
  532. package/visual-editor-proxy/node_modules/undici-types/mock-interceptor.d.ts +0 -93
  533. package/visual-editor-proxy/node_modules/undici-types/mock-pool.d.ts +0 -25
  534. package/visual-editor-proxy/node_modules/undici-types/package.json +0 -55
  535. package/visual-editor-proxy/node_modules/undici-types/patch.d.ts +0 -33
  536. package/visual-editor-proxy/node_modules/undici-types/pool-stats.d.ts +0 -19
  537. package/visual-editor-proxy/node_modules/undici-types/pool.d.ts +0 -39
  538. package/visual-editor-proxy/node_modules/undici-types/proxy-agent.d.ts +0 -28
  539. package/visual-editor-proxy/node_modules/undici-types/readable.d.ts +0 -65
  540. package/visual-editor-proxy/node_modules/undici-types/retry-agent.d.ts +0 -8
  541. package/visual-editor-proxy/node_modules/undici-types/retry-handler.d.ts +0 -116
  542. package/visual-editor-proxy/node_modules/undici-types/util.d.ts +0 -18
  543. package/visual-editor-proxy/node_modules/undici-types/webidl.d.ts +0 -228
  544. package/visual-editor-proxy/node_modules/undici-types/websocket.d.ts +0 -150
@@ -1,743 +0,0 @@
1
- /**
2
- * The `node:worker_threads` module enables the use of threads that execute
3
- * JavaScript in parallel. To access it:
4
- *
5
- * ```js
6
- * import worker from 'node:worker_threads';
7
- * ```
8
- *
9
- * Workers (threads) are useful for performing CPU-intensive JavaScript operations.
10
- * They do not help much with I/O-intensive work. The Node.js built-in
11
- * asynchronous I/O operations are more efficient than Workers can be.
12
- *
13
- * Unlike `child_process` or `cluster`, `worker_threads` can share memory. They do
14
- * so by transferring `ArrayBuffer` instances or sharing `SharedArrayBuffer` instances.
15
- *
16
- * ```js
17
- * import {
18
- * Worker, isMainThread, parentPort, workerData,
19
- * } from 'node:worker_threads';
20
- * import { parse } = from 'some-js-parsing-library';
21
- *
22
- * if (isMainThread) {
23
- * module.exports = function parseJSAsync(script) {
24
- * return new Promise((resolve, reject) => {
25
- * const worker = new Worker(__filename, {
26
- * workerData: script,
27
- * });
28
- * worker.on('message', resolve);
29
- * worker.on('error', reject);
30
- * worker.on('exit', (code) => {
31
- * if (code !== 0)
32
- * reject(new Error(`Worker stopped with exit code ${code}`));
33
- * });
34
- * });
35
- * };
36
- * } else {
37
- * const script = workerData;
38
- * parentPort.postMessage(parse(script));
39
- * }
40
- * ```
41
- *
42
- * The above example spawns a Worker thread for each `parseJSAsync()` call. In
43
- * practice, use a pool of Workers for these kinds of tasks. Otherwise, the
44
- * overhead of creating Workers would likely exceed their benefit.
45
- *
46
- * When implementing a worker pool, use the `AsyncResource` API to inform
47
- * diagnostic tools (e.g. to provide asynchronous stack traces) about the
48
- * correlation between tasks and their outcomes. See `"Using AsyncResource for a Worker thread pool"` in the `async_hooks` documentation for an example implementation.
49
- *
50
- * Worker threads inherit non-process-specific options by default. Refer to `Worker constructor options` to know how to customize worker thread options,
51
- * specifically `argv` and `execArgv` options.
52
- * @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/worker_threads.js)
53
- */
54
- declare module "worker_threads" {
55
- import { Context } from "node:vm";
56
- import { EventEmitter } from "node:events";
57
- import { EventLoopUtilityFunction } from "node:perf_hooks";
58
- import { FileHandle } from "node:fs/promises";
59
- import { Readable, Writable } from "node:stream";
60
- import { ReadableStream, TransformStream, WritableStream } from "node:stream/web";
61
- import { URL } from "node:url";
62
- import { MessageEvent } from "undici-types";
63
- const isMainThread: boolean;
64
- const parentPort: null | MessagePort;
65
- const resourceLimits: ResourceLimits;
66
- const SHARE_ENV: unique symbol;
67
- const threadId: number;
68
- const workerData: any;
69
- /**
70
- * Instances of the `worker.MessageChannel` class represent an asynchronous,
71
- * two-way communications channel.
72
- * The `MessageChannel` has no methods of its own. `new MessageChannel()` yields an object with `port1` and `port2` properties, which refer to linked `MessagePort` instances.
73
- *
74
- * ```js
75
- * import { MessageChannel } from 'node:worker_threads';
76
- *
77
- * const { port1, port2 } = new MessageChannel();
78
- * port1.on('message', (message) => console.log('received', message));
79
- * port2.postMessage({ foo: 'bar' });
80
- * // Prints: received { foo: 'bar' } from the `port1.on('message')` listener
81
- * ```
82
- * @since v10.5.0
83
- */
84
- class MessageChannel {
85
- readonly port1: MessagePort;
86
- readonly port2: MessagePort;
87
- }
88
- interface WorkerPerformance {
89
- eventLoopUtilization: EventLoopUtilityFunction;
90
- }
91
- type Transferable =
92
- | ArrayBuffer
93
- | MessagePort
94
- | AbortSignal
95
- | FileHandle
96
- | ReadableStream
97
- | WritableStream
98
- | TransformStream;
99
- /** @deprecated Use `import { Transferable } from "node:worker_threads"` instead. */
100
- type TransferListItem = Transferable;
101
- /**
102
- * Instances of the `worker.MessagePort` class represent one end of an
103
- * asynchronous, two-way communications channel. It can be used to transfer
104
- * structured data, memory regions and other `MessagePort`s between different `Worker`s.
105
- *
106
- * This implementation matches [browser `MessagePort`](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort) s.
107
- * @since v10.5.0
108
- */
109
- class MessagePort extends EventEmitter {
110
- /**
111
- * Disables further sending of messages on either side of the connection.
112
- * This method can be called when no further communication will happen over this `MessagePort`.
113
- *
114
- * The `'close' event` is emitted on both `MessagePort` instances that
115
- * are part of the channel.
116
- * @since v10.5.0
117
- */
118
- close(): void;
119
- /**
120
- * Sends a JavaScript value to the receiving side of this channel. `value` is transferred in a way which is compatible with
121
- * the [HTML structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm).
122
- *
123
- * In particular, the significant differences to `JSON` are:
124
- *
125
- * * `value` may contain circular references.
126
- * * `value` may contain instances of builtin JS types such as `RegExp`s, `BigInt`s, `Map`s, `Set`s, etc.
127
- * * `value` may contain typed arrays, both using `ArrayBuffer`s
128
- * and `SharedArrayBuffer`s.
129
- * * `value` may contain [`WebAssembly.Module`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Module) instances.
130
- * * `value` may not contain native (C++-backed) objects other than:
131
- *
132
- * ```js
133
- * import { MessageChannel } from 'node:worker_threads';
134
- * const { port1, port2 } = new MessageChannel();
135
- *
136
- * port1.on('message', (message) => console.log(message));
137
- *
138
- * const circularData = {};
139
- * circularData.foo = circularData;
140
- * // Prints: { foo: [Circular] }
141
- * port2.postMessage(circularData);
142
- * ```
143
- *
144
- * `transferList` may be a list of [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer), `MessagePort`, and `FileHandle` objects.
145
- * After transferring, they are not usable on the sending side of the channel
146
- * anymore (even if they are not contained in `value`). Unlike with `child processes`, transferring handles such as network sockets is currently
147
- * not supported.
148
- *
149
- * If `value` contains [`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) instances, those are accessible
150
- * from either thread. They cannot be listed in `transferList`.
151
- *
152
- * `value` may still contain `ArrayBuffer` instances that are not in `transferList`; in that case, the underlying memory is copied rather than moved.
153
- *
154
- * ```js
155
- * import { MessageChannel } from 'node:worker_threads';
156
- * const { port1, port2 } = new MessageChannel();
157
- *
158
- * port1.on('message', (message) => console.log(message));
159
- *
160
- * const uint8Array = new Uint8Array([ 1, 2, 3, 4 ]);
161
- * // This posts a copy of `uint8Array`:
162
- * port2.postMessage(uint8Array);
163
- * // This does not copy data, but renders `uint8Array` unusable:
164
- * port2.postMessage(uint8Array, [ uint8Array.buffer ]);
165
- *
166
- * // The memory for the `sharedUint8Array` is accessible from both the
167
- * // original and the copy received by `.on('message')`:
168
- * const sharedUint8Array = new Uint8Array(new SharedArrayBuffer(4));
169
- * port2.postMessage(sharedUint8Array);
170
- *
171
- * // This transfers a freshly created message port to the receiver.
172
- * // This can be used, for example, to create communication channels between
173
- * // multiple `Worker` threads that are children of the same parent thread.
174
- * const otherChannel = new MessageChannel();
175
- * port2.postMessage({ port: otherChannel.port1 }, [ otherChannel.port1 ]);
176
- * ```
177
- *
178
- * The message object is cloned immediately, and can be modified after
179
- * posting without having side effects.
180
- *
181
- * For more information on the serialization and deserialization mechanisms
182
- * behind this API, see the `serialization API of the node:v8 module`.
183
- * @since v10.5.0
184
- */
185
- postMessage(value: any, transferList?: readonly Transferable[]): void;
186
- /**
187
- * Opposite of `unref()`. Calling `ref()` on a previously `unref()`ed port does _not_ let the program exit if it's the only active handle left (the default
188
- * behavior). If the port is `ref()`ed, calling `ref()` again has no effect.
189
- *
190
- * If listeners are attached or removed using `.on('message')`, the port
191
- * is `ref()`ed and `unref()`ed automatically depending on whether
192
- * listeners for the event exist.
193
- * @since v10.5.0
194
- */
195
- ref(): void;
196
- /**
197
- * Calling `unref()` on a port allows the thread to exit if this is the only
198
- * active handle in the event system. If the port is already `unref()`ed calling `unref()` again has no effect.
199
- *
200
- * If listeners are attached or removed using `.on('message')`, the port is `ref()`ed and `unref()`ed automatically depending on whether
201
- * listeners for the event exist.
202
- * @since v10.5.0
203
- */
204
- unref(): void;
205
- /**
206
- * Starts receiving messages on this `MessagePort`. When using this port
207
- * as an event emitter, this is called automatically once `'message'` listeners are attached.
208
- *
209
- * This method exists for parity with the Web `MessagePort` API. In Node.js,
210
- * it is only useful for ignoring messages when no event listener is present.
211
- * Node.js also diverges in its handling of `.onmessage`. Setting it
212
- * automatically calls `.start()`, but unsetting it lets messages queue up
213
- * until a new handler is set or the port is discarded.
214
- * @since v10.5.0
215
- */
216
- start(): void;
217
- addListener(event: "close", listener: () => void): this;
218
- addListener(event: "message", listener: (value: any) => void): this;
219
- addListener(event: "messageerror", listener: (error: Error) => void): this;
220
- addListener(event: string | symbol, listener: (...args: any[]) => void): this;
221
- emit(event: "close"): boolean;
222
- emit(event: "message", value: any): boolean;
223
- emit(event: "messageerror", error: Error): boolean;
224
- emit(event: string | symbol, ...args: any[]): boolean;
225
- on(event: "close", listener: () => void): this;
226
- on(event: "message", listener: (value: any) => void): this;
227
- on(event: "messageerror", listener: (error: Error) => void): this;
228
- on(event: string | symbol, listener: (...args: any[]) => void): this;
229
- once(event: "close", listener: () => void): this;
230
- once(event: "message", listener: (value: any) => void): this;
231
- once(event: "messageerror", listener: (error: Error) => void): this;
232
- once(event: string | symbol, listener: (...args: any[]) => void): this;
233
- prependListener(event: "close", listener: () => void): this;
234
- prependListener(event: "message", listener: (value: any) => void): this;
235
- prependListener(event: "messageerror", listener: (error: Error) => void): this;
236
- prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
237
- prependOnceListener(event: "close", listener: () => void): this;
238
- prependOnceListener(event: "message", listener: (value: any) => void): this;
239
- prependOnceListener(event: "messageerror", listener: (error: Error) => void): this;
240
- prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
241
- removeListener(event: "close", listener: () => void): this;
242
- removeListener(event: "message", listener: (value: any) => void): this;
243
- removeListener(event: "messageerror", listener: (error: Error) => void): this;
244
- removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
245
- off(event: "close", listener: () => void): this;
246
- off(event: "message", listener: (value: any) => void): this;
247
- off(event: "messageerror", listener: (error: Error) => void): this;
248
- off(event: string | symbol, listener: (...args: any[]) => void): this;
249
- addEventListener: EventTarget["addEventListener"];
250
- dispatchEvent: EventTarget["dispatchEvent"];
251
- removeEventListener: EventTarget["removeEventListener"];
252
- }
253
- interface WorkerOptions {
254
- /**
255
- * List of arguments which would be stringified and appended to
256
- * `process.argv` in the worker. This is mostly similar to the `workerData`
257
- * but the values will be available on the global `process.argv` as if they
258
- * were passed as CLI options to the script.
259
- */
260
- argv?: any[] | undefined;
261
- env?: NodeJS.Dict<string> | typeof SHARE_ENV | undefined;
262
- eval?: boolean | undefined;
263
- workerData?: any;
264
- stdin?: boolean | undefined;
265
- stdout?: boolean | undefined;
266
- stderr?: boolean | undefined;
267
- execArgv?: string[] | undefined;
268
- resourceLimits?: ResourceLimits | undefined;
269
- /**
270
- * Additional data to send in the first worker message.
271
- */
272
- transferList?: Transferable[] | undefined;
273
- /**
274
- * @default true
275
- */
276
- trackUnmanagedFds?: boolean | undefined;
277
- /**
278
- * An optional `name` to be appended to the worker title
279
- * for debuggin/identification purposes, making the final title as
280
- * `[worker ${id}] ${name}`.
281
- */
282
- name?: string | undefined;
283
- }
284
- interface ResourceLimits {
285
- /**
286
- * The maximum size of a heap space for recently created objects.
287
- */
288
- maxYoungGenerationSizeMb?: number | undefined;
289
- /**
290
- * The maximum size of the main heap in MB.
291
- */
292
- maxOldGenerationSizeMb?: number | undefined;
293
- /**
294
- * The size of a pre-allocated memory range used for generated code.
295
- */
296
- codeRangeSizeMb?: number | undefined;
297
- /**
298
- * The default maximum stack size for the thread. Small values may lead to unusable Worker instances.
299
- * @default 4
300
- */
301
- stackSizeMb?: number | undefined;
302
- }
303
- /**
304
- * The `Worker` class represents an independent JavaScript execution thread.
305
- * Most Node.js APIs are available inside of it.
306
- *
307
- * Notable differences inside a Worker environment are:
308
- *
309
- * * The `process.stdin`, `process.stdout`, and `process.stderr` streams may be redirected by the parent thread.
310
- * * The `import { isMainThread } from 'node:worker_threads'` property is set to `false`.
311
- * * The `import { parentPort } from 'node:worker_threads'` message port is available.
312
- * * `process.exit()` does not stop the whole program, just the single thread,
313
- * and `process.abort()` is not available.
314
- * * `process.chdir()` and `process` methods that set group or user ids
315
- * are not available.
316
- * * `process.env` is a copy of the parent thread's environment variables,
317
- * unless otherwise specified. Changes to one copy are not visible in other
318
- * threads, and are not visible to native add-ons (unless `worker.SHARE_ENV` is passed as the `env` option to the `Worker` constructor). On Windows, unlike the main thread, a copy of the
319
- * environment variables operates in a case-sensitive manner.
320
- * * `process.title` cannot be modified.
321
- * * Signals are not delivered through `process.on('...')`.
322
- * * Execution may stop at any point as a result of `worker.terminate()` being invoked.
323
- * * IPC channels from parent processes are not accessible.
324
- * * The `trace_events` module is not supported.
325
- * * Native add-ons can only be loaded from multiple threads if they fulfill `certain conditions`.
326
- *
327
- * Creating `Worker` instances inside of other `Worker`s is possible.
328
- *
329
- * Like [Web Workers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) and the `node:cluster module`, two-way communication
330
- * can be achieved through inter-thread message passing. Internally, a `Worker` has
331
- * a built-in pair of `MessagePort` s that are already associated with each
332
- * other when the `Worker` is created. While the `MessagePort` object on the parent
333
- * side is not directly exposed, its functionalities are exposed through `worker.postMessage()` and the `worker.on('message')` event
334
- * on the `Worker` object for the parent thread.
335
- *
336
- * To create custom messaging channels (which is encouraged over using the default
337
- * global channel because it facilitates separation of concerns), users can create
338
- * a `MessageChannel` object on either thread and pass one of the`MessagePort`s on that `MessageChannel` to the other thread through a
339
- * pre-existing channel, such as the global one.
340
- *
341
- * See `port.postMessage()` for more information on how messages are passed,
342
- * and what kind of JavaScript values can be successfully transported through
343
- * the thread barrier.
344
- *
345
- * ```js
346
- * import assert from 'node:assert';
347
- * import {
348
- * Worker, MessageChannel, MessagePort, isMainThread, parentPort,
349
- * } from 'node:worker_threads';
350
- * if (isMainThread) {
351
- * const worker = new Worker(__filename);
352
- * const subChannel = new MessageChannel();
353
- * worker.postMessage({ hereIsYourPort: subChannel.port1 }, [subChannel.port1]);
354
- * subChannel.port2.on('message', (value) => {
355
- * console.log('received:', value);
356
- * });
357
- * } else {
358
- * parentPort.once('message', (value) => {
359
- * assert(value.hereIsYourPort instanceof MessagePort);
360
- * value.hereIsYourPort.postMessage('the worker is sending this');
361
- * value.hereIsYourPort.close();
362
- * });
363
- * }
364
- * ```
365
- * @since v10.5.0
366
- */
367
- class Worker extends EventEmitter {
368
- /**
369
- * If `stdin: true` was passed to the `Worker` constructor, this is a
370
- * writable stream. The data written to this stream will be made available in
371
- * the worker thread as `process.stdin`.
372
- * @since v10.5.0
373
- */
374
- readonly stdin: Writable | null;
375
- /**
376
- * This is a readable stream which contains data written to `process.stdout` inside the worker thread. If `stdout: true` was not passed to the `Worker` constructor, then data is piped to the
377
- * parent thread's `process.stdout` stream.
378
- * @since v10.5.0
379
- */
380
- readonly stdout: Readable;
381
- /**
382
- * This is a readable stream which contains data written to `process.stderr` inside the worker thread. If `stderr: true` was not passed to the `Worker` constructor, then data is piped to the
383
- * parent thread's `process.stderr` stream.
384
- * @since v10.5.0
385
- */
386
- readonly stderr: Readable;
387
- /**
388
- * An integer identifier for the referenced thread. Inside the worker thread,
389
- * it is available as `import { threadId } from 'node:node:worker_threads'`.
390
- * This value is unique for each `Worker` instance inside a single process.
391
- * @since v10.5.0
392
- */
393
- readonly threadId: number;
394
- /**
395
- * Provides the set of JS engine resource constraints for this Worker thread.
396
- * If the `resourceLimits` option was passed to the `Worker` constructor,
397
- * this matches its values.
398
- *
399
- * If the worker has stopped, the return value is an empty object.
400
- * @since v13.2.0, v12.16.0
401
- */
402
- readonly resourceLimits?: ResourceLimits | undefined;
403
- /**
404
- * An object that can be used to query performance information from a worker
405
- * instance. Similar to `perf_hooks.performance`.
406
- * @since v15.1.0, v14.17.0, v12.22.0
407
- */
408
- readonly performance: WorkerPerformance;
409
- /**
410
- * @param filename The path to the Worker’s main script or module.
411
- * Must be either an absolute path or a relative path (i.e. relative to the current working directory) starting with ./ or ../,
412
- * or a WHATWG URL object using file: protocol. If options.eval is true, this is a string containing JavaScript code rather than a path.
413
- */
414
- constructor(filename: string | URL, options?: WorkerOptions);
415
- /**
416
- * Send a message to the worker that is received via `require('node:worker_threads').parentPort.on('message')`.
417
- * See `port.postMessage()` for more details.
418
- * @since v10.5.0
419
- */
420
- postMessage(value: any, transferList?: readonly Transferable[]): void;
421
- /**
422
- * Sends a value to another worker, identified by its thread ID.
423
- * @param threadId The target thread ID. If the thread ID is invalid, a `ERR_WORKER_MESSAGING_FAILED` error will be thrown.
424
- * If the target thread ID is the current thread ID, a `ERR_WORKER_MESSAGING_SAME_THREAD` error will be thrown.
425
- * @param value The value to send.
426
- * @param transferList If one or more `MessagePort`-like objects are passed in value, a `transferList` is required for those items
427
- * or `ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST` is thrown. See `port.postMessage()` for more information.
428
- * @param timeout Time to wait for the message to be delivered in milliseconds. By default it's `undefined`, which means wait forever.
429
- * If the operation times out, a `ERR_WORKER_MESSAGING_TIMEOUT` error is thrown.
430
- * @since v20.19.0
431
- */
432
- postMessageToThread(threadId: number, value: any, timeout?: number): Promise<void>;
433
- postMessageToThread(
434
- threadId: number,
435
- value: any,
436
- transferList: readonly Transferable[],
437
- timeout?: number,
438
- ): Promise<void>;
439
- /**
440
- * Opposite of `unref()`, calling `ref()` on a previously `unref()`ed worker does _not_ let the program exit if it's the only active handle left (the default
441
- * behavior). If the worker is `ref()`ed, calling `ref()` again has
442
- * no effect.
443
- * @since v10.5.0
444
- */
445
- ref(): void;
446
- /**
447
- * Calling `unref()` on a worker allows the thread to exit if this is the only
448
- * active handle in the event system. If the worker is already `unref()`ed calling `unref()` again has no effect.
449
- * @since v10.5.0
450
- */
451
- unref(): void;
452
- /**
453
- * Stop all JavaScript execution in the worker thread as soon as possible.
454
- * Returns a Promise for the exit code that is fulfilled when the `'exit' event` is emitted.
455
- * @since v10.5.0
456
- */
457
- terminate(): Promise<number>;
458
- /**
459
- * Returns a readable stream for a V8 snapshot of the current state of the Worker.
460
- * See `v8.getHeapSnapshot()` for more details.
461
- *
462
- * If the Worker thread is no longer running, which may occur before the `'exit' event` is emitted, the returned `Promise` is rejected
463
- * immediately with an `ERR_WORKER_NOT_RUNNING` error.
464
- * @since v13.9.0, v12.17.0
465
- * @return A promise for a Readable Stream containing a V8 heap snapshot
466
- */
467
- getHeapSnapshot(): Promise<Readable>;
468
- addListener(event: "error", listener: (err: Error) => void): this;
469
- addListener(event: "exit", listener: (exitCode: number) => void): this;
470
- addListener(event: "message", listener: (value: any) => void): this;
471
- addListener(event: "messageerror", listener: (error: Error) => void): this;
472
- addListener(event: "online", listener: () => void): this;
473
- addListener(event: string | symbol, listener: (...args: any[]) => void): this;
474
- emit(event: "error", err: Error): boolean;
475
- emit(event: "exit", exitCode: number): boolean;
476
- emit(event: "message", value: any): boolean;
477
- emit(event: "messageerror", error: Error): boolean;
478
- emit(event: "online"): boolean;
479
- emit(event: string | symbol, ...args: any[]): boolean;
480
- on(event: "error", listener: (err: Error) => void): this;
481
- on(event: "exit", listener: (exitCode: number) => void): this;
482
- on(event: "message", listener: (value: any) => void): this;
483
- on(event: "messageerror", listener: (error: Error) => void): this;
484
- on(event: "online", listener: () => void): this;
485
- on(event: string | symbol, listener: (...args: any[]) => void): this;
486
- once(event: "error", listener: (err: Error) => void): this;
487
- once(event: "exit", listener: (exitCode: number) => void): this;
488
- once(event: "message", listener: (value: any) => void): this;
489
- once(event: "messageerror", listener: (error: Error) => void): this;
490
- once(event: "online", listener: () => void): this;
491
- once(event: string | symbol, listener: (...args: any[]) => void): this;
492
- prependListener(event: "error", listener: (err: Error) => void): this;
493
- prependListener(event: "exit", listener: (exitCode: number) => void): this;
494
- prependListener(event: "message", listener: (value: any) => void): this;
495
- prependListener(event: "messageerror", listener: (error: Error) => void): this;
496
- prependListener(event: "online", listener: () => void): this;
497
- prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
498
- prependOnceListener(event: "error", listener: (err: Error) => void): this;
499
- prependOnceListener(event: "exit", listener: (exitCode: number) => void): this;
500
- prependOnceListener(event: "message", listener: (value: any) => void): this;
501
- prependOnceListener(event: "messageerror", listener: (error: Error) => void): this;
502
- prependOnceListener(event: "online", listener: () => void): this;
503
- prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
504
- removeListener(event: "error", listener: (err: Error) => void): this;
505
- removeListener(event: "exit", listener: (exitCode: number) => void): this;
506
- removeListener(event: "message", listener: (value: any) => void): this;
507
- removeListener(event: "messageerror", listener: (error: Error) => void): this;
508
- removeListener(event: "online", listener: () => void): this;
509
- removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
510
- off(event: "error", listener: (err: Error) => void): this;
511
- off(event: "exit", listener: (exitCode: number) => void): this;
512
- off(event: "message", listener: (value: any) => void): this;
513
- off(event: "messageerror", listener: (error: Error) => void): this;
514
- off(event: "online", listener: () => void): this;
515
- off(event: string | symbol, listener: (...args: any[]) => void): this;
516
- }
517
- interface BroadcastChannel extends NodeJS.RefCounted {}
518
- /**
519
- * Instances of `BroadcastChannel` allow asynchronous one-to-many communication
520
- * with all other `BroadcastChannel` instances bound to the same channel name.
521
- *
522
- * ```js
523
- * 'use strict';
524
- *
525
- * import {
526
- * isMainThread,
527
- * BroadcastChannel,
528
- * Worker,
529
- * } from 'node:worker_threads';
530
- *
531
- * const bc = new BroadcastChannel('hello');
532
- *
533
- * if (isMainThread) {
534
- * let c = 0;
535
- * bc.onmessage = (event) => {
536
- * console.log(event.data);
537
- * if (++c === 10) bc.close();
538
- * };
539
- * for (let n = 0; n < 10; n++)
540
- * new Worker(__filename);
541
- * } else {
542
- * bc.postMessage('hello from every worker');
543
- * bc.close();
544
- * }
545
- * ```
546
- * @since v15.4.0
547
- */
548
- class BroadcastChannel extends EventTarget {
549
- readonly name: string;
550
- /**
551
- * Invoked with a single \`MessageEvent\` argument when a message is received.
552
- * @since v15.4.0
553
- */
554
- onmessage: (message: MessageEvent) => void;
555
- /**
556
- * Invoked with a received message cannot be deserialized.
557
- * @since v15.4.0
558
- */
559
- onmessageerror: (message: MessageEvent) => void;
560
- constructor(name: string);
561
- /**
562
- * Closes the `BroadcastChannel` connection.
563
- * @since v15.4.0
564
- */
565
- close(): void;
566
- /**
567
- * @since v15.4.0
568
- * @param message Any cloneable JavaScript value.
569
- */
570
- postMessage(message: unknown): void;
571
- }
572
- /**
573
- * Mark an object as not transferable. If `object` occurs in the transfer list of
574
- * a `port.postMessage()` call, it is ignored.
575
- *
576
- * In particular, this makes sense for objects that can be cloned, rather than
577
- * transferred, and which are used by other objects on the sending side.
578
- * For example, Node.js marks the `ArrayBuffer`s it uses for its `Buffer pool` with this.
579
- *
580
- * This operation cannot be undone.
581
- *
582
- * ```js
583
- * import { MessageChannel, markAsUntransferable } from 'node:worker_threads';
584
- *
585
- * const pooledBuffer = new ArrayBuffer(8);
586
- * const typedArray1 = new Uint8Array(pooledBuffer);
587
- * const typedArray2 = new Float64Array(pooledBuffer);
588
- *
589
- * markAsUntransferable(pooledBuffer);
590
- *
591
- * const { port1 } = new MessageChannel();
592
- * port1.postMessage(typedArray1, [ typedArray1.buffer ]);
593
- *
594
- * // The following line prints the contents of typedArray1 -- it still owns
595
- * // its memory and has been cloned, not transferred. Without
596
- * // `markAsUntransferable()`, this would print an empty Uint8Array.
597
- * // typedArray2 is intact as well.
598
- * console.log(typedArray1);
599
- * console.log(typedArray2);
600
- * ```
601
- *
602
- * There is no equivalent to this API in browsers.
603
- * @since v14.5.0, v12.19.0
604
- */
605
- function markAsUntransferable(object: object): void;
606
- /**
607
- * Transfer a `MessagePort` to a different `vm` Context. The original `port` object is rendered unusable, and the returned `MessagePort` instance
608
- * takes its place.
609
- *
610
- * The returned `MessagePort` is an object in the target context and
611
- * inherits from its global `Object` class. Objects passed to the [`port.onmessage()`](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort/onmessage) listener are also created in the
612
- * target context
613
- * and inherit from its global `Object` class.
614
- *
615
- * However, the created `MessagePort` no longer inherits from [`EventTarget`](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget), and only
616
- * [`port.onmessage()`](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort/onmessage) can be used to receive
617
- * events using it.
618
- * @since v11.13.0
619
- * @param port The message port to transfer.
620
- * @param contextifiedSandbox A `contextified` object as returned by the `vm.createContext()` method.
621
- */
622
- function moveMessagePortToContext(port: MessagePort, contextifiedSandbox: Context): MessagePort;
623
- /**
624
- * Receive a single message from a given `MessagePort`. If no message is available,`undefined` is returned, otherwise an object with a single `message` property
625
- * that contains the message payload, corresponding to the oldest message in the `MessagePort`'s queue.
626
- *
627
- * ```js
628
- * import { MessageChannel, receiveMessageOnPort } from 'node:worker_threads';
629
- * const { port1, port2 } = new MessageChannel();
630
- * port1.postMessage({ hello: 'world' });
631
- *
632
- * console.log(receiveMessageOnPort(port2));
633
- * // Prints: { message: { hello: 'world' } }
634
- * console.log(receiveMessageOnPort(port2));
635
- * // Prints: undefined
636
- * ```
637
- *
638
- * When this function is used, no `'message'` event is emitted and the `onmessage` listener is not invoked.
639
- * @since v12.3.0
640
- */
641
- function receiveMessageOnPort(port: MessagePort):
642
- | {
643
- message: any;
644
- }
645
- | undefined;
646
- type Serializable = string | object | number | boolean | bigint;
647
- /**
648
- * Within a worker thread, `worker.getEnvironmentData()` returns a clone
649
- * of data passed to the spawning thread's `worker.setEnvironmentData()`.
650
- * Every new `Worker` receives its own copy of the environment data
651
- * automatically.
652
- *
653
- * ```js
654
- * import {
655
- * Worker,
656
- * isMainThread,
657
- * setEnvironmentData,
658
- * getEnvironmentData,
659
- * } from 'node:worker_threads';
660
- *
661
- * if (isMainThread) {
662
- * setEnvironmentData('Hello', 'World!');
663
- * const worker = new Worker(__filename);
664
- * } else {
665
- * console.log(getEnvironmentData('Hello')); // Prints 'World!'.
666
- * }
667
- * ```
668
- * @since v15.12.0, v14.18.0
669
- * @param key Any arbitrary, cloneable JavaScript value that can be used as a {Map} key.
670
- */
671
- function getEnvironmentData(key: Serializable): Serializable;
672
- /**
673
- * The `worker.setEnvironmentData()` API sets the content of `worker.getEnvironmentData()` in the current thread and all new `Worker` instances spawned from the current context.
674
- * @since v15.12.0, v14.18.0
675
- * @param key Any arbitrary, cloneable JavaScript value that can be used as a {Map} key.
676
- * @param value Any arbitrary, cloneable JavaScript value that will be cloned and passed automatically to all new `Worker` instances. If `value` is passed as `undefined`, any previously set value
677
- * for the `key` will be deleted.
678
- */
679
- function setEnvironmentData(key: Serializable, value?: Serializable): void;
680
- /**
681
- * Sends a value to another worker, identified by its thread ID.
682
- * @param threadId The target thread ID. If the thread ID is invalid, a `ERR_WORKER_MESSAGING_FAILED` error will be thrown.
683
- * If the target thread ID is the current thread ID, a `ERR_WORKER_MESSAGING_SAME_THREAD` error will be thrown.
684
- * @param value The value to send.
685
- * @param transferList If one or more `MessagePort`-like objects are passed in value, a `transferList` is required for those items
686
- * or `ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST` is thrown. See `port.postMessage()` for more information.
687
- * @param timeout Time to wait for the message to be delivered in milliseconds. By default it's `undefined`, which means wait forever.
688
- * If the operation times out, a `ERR_WORKER_MESSAGING_TIMEOUT` error is thrown.
689
- * @since v22.5.0
690
- */
691
- function postMessageToThread(threadId: number, value: any, timeout?: number): Promise<void>;
692
- function postMessageToThread(
693
- threadId: number,
694
- value: any,
695
- transferList: readonly Transferable[],
696
- timeout?: number,
697
- ): Promise<void>;
698
-
699
- import {
700
- BroadcastChannel as _BroadcastChannel,
701
- MessageChannel as _MessageChannel,
702
- MessagePort as _MessagePort,
703
- } from "worker_threads";
704
- global {
705
- function structuredClone<T>(
706
- value: T,
707
- options?: { transfer?: Transferable[] },
708
- ): T;
709
- /**
710
- * `BroadcastChannel` class is a global reference for `import { BroadcastChannel } from 'node:worker_threads'`
711
- * https://nodejs.org/api/globals.html#broadcastchannel
712
- * @since v18.0.0
713
- */
714
- var BroadcastChannel: typeof globalThis extends {
715
- onmessage: any;
716
- BroadcastChannel: infer T;
717
- } ? T
718
- : typeof _BroadcastChannel;
719
- /**
720
- * `MessageChannel` class is a global reference for `import { MessageChannel } from 'node:worker_threads'`
721
- * https://nodejs.org/api/globals.html#messagechannel
722
- * @since v15.0.0
723
- */
724
- var MessageChannel: typeof globalThis extends {
725
- onmessage: any;
726
- MessageChannel: infer T;
727
- } ? T
728
- : typeof _MessageChannel;
729
- /**
730
- * `MessagePort` class is a global reference for `import { MessagePort } from 'node:worker_threads'`
731
- * https://nodejs.org/api/globals.html#messageport
732
- * @since v15.0.0
733
- */
734
- var MessagePort: typeof globalThis extends {
735
- onmessage: any;
736
- MessagePort: infer T;
737
- } ? T
738
- : typeof _MessagePort;
739
- }
740
- }
741
- declare module "node:worker_threads" {
742
- export * from "worker_threads";
743
- }