bunqueue-client 0.1.9 → 0.2.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 (582) hide show
  1. package/CHANGELOG.md +165 -0
  2. package/LEGACY.md +460 -0
  3. package/README.md +204 -349
  4. package/dist/ack-batcher.js +7 -67
  5. package/dist/canonical-manifest.json +934 -0
  6. package/dist/chunk-b967v3w3.js +79 -0
  7. package/dist/chunk-fekm0ma6.js +110 -0
  8. package/dist/chunk-jxkszwqp.js +573 -0
  9. package/dist/embedded.js +16510 -0
  10. package/dist/frame.js +14 -57
  11. package/dist/index.d.ts +1 -27
  12. package/dist/index.js +10953 -16
  13. package/dist/legacy.d.ts +1 -0
  14. package/dist/legacy.js +2081 -0
  15. package/dist/{ack-batcher.d.ts → types/sdk/typescript/src/ack-batcher.d.ts} +3 -3
  16. package/dist/{bunqueue → types/sdk/typescript/src/bunqueue}/aging.d.ts +2 -2
  17. package/dist/{bunqueue → types/sdk/typescript/src/bunqueue}/batch.d.ts +2 -2
  18. package/dist/{bunqueue → types/sdk/typescript/src/bunqueue}/bunqueue-api.d.ts +5 -5
  19. package/dist/{bunqueue → types/sdk/typescript/src/bunqueue}/bunqueue.d.ts +13 -13
  20. package/dist/{bunqueue → types/sdk/typescript/src/bunqueue}/circuit-breaker.d.ts +2 -2
  21. package/dist/{bunqueue → types/sdk/typescript/src/bunqueue}/dedup-debounce.d.ts +2 -2
  22. package/dist/{bunqueue → types/sdk/typescript/src/bunqueue}/dlq-rate-limit.d.ts +2 -2
  23. package/dist/{bunqueue → types/sdk/typescript/src/bunqueue}/rate-gate.d.ts +1 -1
  24. package/dist/{bunqueue → types/sdk/typescript/src/bunqueue}/retry.d.ts +1 -1
  25. package/dist/{bunqueue → types/sdk/typescript/src/bunqueue}/triggers.d.ts +3 -3
  26. package/dist/{bunqueue → types/sdk/typescript/src/bunqueue}/ttl.d.ts +1 -1
  27. package/dist/{bunqueue → types/sdk/typescript/src/bunqueue}/types.d.ts +4 -4
  28. package/dist/types/sdk/typescript/src/canonical-transport/bun-sqlite-types.d.ts +21 -0
  29. package/dist/{connection-pool.d.ts → types/sdk/typescript/src/connection-pool.d.ts} +1 -1
  30. package/dist/{connection-types.d.ts → types/sdk/typescript/src/connection-types.d.ts} +1 -1
  31. package/dist/{connection.d.ts → types/sdk/typescript/src/connection.d.ts} +6 -19
  32. package/dist/{errors.d.ts → types/sdk/typescript/src/errors.d.ts} +3 -0
  33. package/dist/types/sdk/typescript/src/flow-commit.d.ts +5 -0
  34. package/dist/types/sdk/typescript/src/flow-plan-legacy.d.ts +13 -0
  35. package/dist/types/sdk/typescript/src/flow-plan.d.ts +29 -0
  36. package/dist/{flow-types.d.ts → types/sdk/typescript/src/flow-types.d.ts} +7 -4
  37. package/dist/{flow.d.ts → types/sdk/typescript/src/flow.d.ts} +6 -10
  38. package/dist/{frame.d.ts → types/sdk/typescript/src/frame.d.ts} +1 -1
  39. package/dist/types/sdk/typescript/src/index.d.ts +10 -0
  40. package/dist/{job.d.ts → types/sdk/typescript/src/job.d.ts} +4 -3
  41. package/dist/types/sdk/typescript/src/legacy.d.ts +27 -0
  42. package/dist/{observability.d.ts → types/sdk/typescript/src/observability.d.ts} +14 -0
  43. package/dist/{queue-admin.d.ts → types/sdk/typescript/src/queue-admin.d.ts} +3 -4
  44. package/dist/{queue-control.d.ts → types/sdk/typescript/src/queue-control.d.ts} +5 -5
  45. package/dist/{queue-query.d.ts → types/sdk/typescript/src/queue-query.d.ts} +3 -3
  46. package/dist/{queue.d.ts → types/sdk/typescript/src/queue.d.ts} +8 -8
  47. package/dist/{responses.d.ts → types/sdk/typescript/src/responses.d.ts} +2 -2
  48. package/dist/types/sdk/typescript/src/serialization.d.ts +10 -0
  49. package/dist/{socket-factory.d.ts → types/sdk/typescript/src/socket-factory.d.ts} +1 -1
  50. package/dist/types/sdk/typescript/src/terminal-outcome.d.ts +8 -0
  51. package/dist/{types.d.ts → types/sdk/typescript/src/types.d.ts} +5 -2
  52. package/dist/{worker-base.d.ts → types/sdk/typescript/src/worker-base.d.ts} +6 -6
  53. package/dist/types/sdk/typescript/src/worker-slot-signal.d.ts +6 -0
  54. package/dist/{worker-types.d.ts → types/sdk/typescript/src/worker-types.d.ts} +3 -3
  55. package/dist/{worker.d.ts → types/sdk/typescript/src/worker.d.ts} +3 -2
  56. package/dist/types/src/application/background/dlq.d.ts +2 -0
  57. package/dist/types/src/application/background/lifecycle.d.ts +4 -0
  58. package/dist/types/src/application/background/recovery/active.d.ts +5 -0
  59. package/dist/types/src/application/background/recovery/index.d.ts +2 -0
  60. package/dist/types/src/application/background/recovery/pending.d.ts +3 -0
  61. package/dist/types/src/application/background/recovery/restore.d.ts +5 -0
  62. package/dist/types/src/application/background/recovery/shared.d.ts +6 -0
  63. package/dist/types/src/application/background/timeouts.d.ts +25 -0
  64. package/dist/types/src/application/backgroundTasks.d.ts +7 -0
  65. package/dist/types/src/application/cleanupTasks.d.ts +10 -0
  66. package/dist/types/src/application/clientOwnership.d.ts +65 -0
  67. package/dist/types/src/application/clientTracking.d.ts +40 -0
  68. package/dist/types/src/application/completedCleanup.d.ts +34 -0
  69. package/dist/types/src/application/completedRetry.d.ts +21 -0
  70. package/dist/types/src/application/contextFactory.d.ts +49 -0
  71. package/dist/types/src/application/dependencyCompletions.d.ts +63 -0
  72. package/dist/types/src/application/dependencyProcessor.d.ts +15 -0
  73. package/dist/types/src/application/dependencyResultTracker.d.ts +18 -0
  74. package/dist/types/src/application/dlqManager.d.ts +49 -0
  75. package/dist/types/src/application/dlqRetry.d.ts +12 -0
  76. package/dist/types/src/application/emptyQueueCleanup.d.ts +3 -0
  77. package/dist/types/src/application/eventsManager.d.ts +50 -0
  78. package/dist/types/src/application/flowFailureRecovery.d.ts +20 -0
  79. package/dist/types/src/application/flowParentBackpatch.d.ts +27 -0
  80. package/dist/types/src/application/jobLogsManager.d.ts +21 -0
  81. package/dist/types/src/application/latencyTracker.d.ts +39 -0
  82. package/dist/types/src/application/lockManager.d.ts +15 -0
  83. package/dist/types/src/application/lockOperations.d.ts +38 -0
  84. package/dist/types/src/application/metricsExporter.d.ts +27 -0
  85. package/dist/types/src/application/monitoringChecks.d.ts +36 -0
  86. package/dist/types/src/application/operations/ack/batch.d.ts +8 -0
  87. package/dist/types/src/application/operations/ack/completion.d.ts +3 -0
  88. package/dist/types/src/application/operations/ack/failure.d.ts +3 -0
  89. package/dist/types/src/application/operations/ack.d.ts +5 -0
  90. package/dist/types/src/application/operations/ackHelpers.d.ts +36 -0
  91. package/dist/types/src/application/operations/customId.d.ts +51 -0
  92. package/dist/types/src/application/operations/flowPush.d.ts +9 -0
  93. package/dist/types/src/application/operations/flowTopologyValidation.d.ts +3 -0
  94. package/dist/types/src/application/operations/flowValidation.d.ts +3 -0
  95. package/dist/types/src/application/operations/jobClaim.d.ts +17 -0
  96. package/dist/types/src/application/operations/jobManagement.d.ts +45 -0
  97. package/dist/types/src/application/operations/jobMoveOperations.d.ts +9 -0
  98. package/dist/types/src/application/operations/jobPromotion.d.ts +7 -0
  99. package/dist/types/src/application/operations/jobStateTransitions.d.ts +15 -0
  100. package/dist/types/src/application/operations/parentLink.d.ts +36 -0
  101. package/dist/types/src/application/operations/parentLinkInput.d.ts +8 -0
  102. package/dist/types/src/application/operations/pull.d.ts +20 -0
  103. package/dist/types/src/application/operations/pullFinalization.d.ts +6 -0
  104. package/dist/types/src/application/operations/pullStateTransition.d.ts +51 -0
  105. package/dist/types/src/application/operations/push.d.ts +13 -0
  106. package/dist/types/src/application/operations/pushAdmission.d.ts +36 -0
  107. package/dist/types/src/application/operations/pushBatch.d.ts +4 -0
  108. package/dist/types/src/application/operations/pushContext.d.ts +48 -0
  109. package/dist/types/src/application/operations/pushDeduplication.d.ts +42 -0
  110. package/dist/types/src/application/operations/pushInsert.d.ts +39 -0
  111. package/dist/types/src/application/operations/pushLocks.d.ts +15 -0
  112. package/dist/types/src/application/operations/query/collect.d.ts +12 -0
  113. package/dist/types/src/application/operations/query/jobLookup.d.ts +9 -0
  114. package/dist/types/src/application/operations/query/pagination.d.ts +8 -0
  115. package/dist/types/src/application/operations/query/state.d.ts +4 -0
  116. package/dist/types/src/application/operations/queryOperations.d.ts +5 -0
  117. package/dist/types/src/application/operations/queueControl.d.ts +50 -0
  118. package/dist/types/src/application/orphanRecovery.d.ts +25 -0
  119. package/dist/types/src/application/prometheusOperationalMetrics.d.ts +31 -0
  120. package/dist/types/src/application/queue-manager/ack.d.ts +23 -0
  121. package/dist/types/src/application/queue-manager/configuration.d.ts +27 -0
  122. package/dist/types/src/application/queue-manager/context.d.ts +5 -0
  123. package/dist/types/src/application/queue-manager/control.d.ts +20 -0
  124. package/dist/types/src/application/queue-manager/delivery.d.ts +33 -0
  125. package/dist/types/src/application/queue-manager/dependencies.d.ts +8 -0
  126. package/dist/types/src/application/queue-manager/dependency-runtime.d.ts +8 -0
  127. package/dist/types/src/application/queue-manager/flow-failures.d.ts +18 -0
  128. package/dist/types/src/application/queue-manager/flow-options.d.ts +8 -0
  129. package/dist/types/src/application/queue-manager/job-management.d.ts +17 -0
  130. package/dist/types/src/application/queue-manager/lifecycle.d.ts +4 -0
  131. package/dist/types/src/application/queue-manager/limits.d.ts +58 -0
  132. package/dist/types/src/application/queue-manager/locks.d.ts +21 -0
  133. package/dist/types/src/application/queue-manager/observability.d.ts +16 -0
  134. package/dist/types/src/application/queue-manager/queries.d.ts +24 -0
  135. package/dist/types/src/application/queue-manager/repeat.d.ts +4 -0
  136. package/dist/types/src/application/queue-manager/services.d.ts +19 -0
  137. package/dist/types/src/application/queue-manager/state.d.ts +98 -0
  138. package/dist/types/src/application/queue-manager/stats.d.ts +28 -0
  139. package/dist/types/src/application/queueManager.d.ts +5 -0
  140. package/dist/types/src/application/queueStatsAggregator.d.ts +23 -0
  141. package/dist/types/src/application/queueTelemetryJournal.d.ts +24 -0
  142. package/dist/types/src/application/repeatJobs.d.ts +7 -0
  143. package/dist/types/src/application/stallDetection.d.ts +26 -0
  144. package/dist/types/src/application/statsManager.d.ts +59 -0
  145. package/dist/types/src/application/taskErrorTracking.d.ts +22 -0
  146. package/dist/types/src/application/throughputTracker.d.ts +34 -0
  147. package/dist/types/src/application/types/ack.d.ts +136 -0
  148. package/dist/types/src/application/types/background.d.ts +18 -0
  149. package/dist/types/src/application/types/config.d.ts +41 -0
  150. package/dist/types/src/application/types/contextFactory.d.ts +89 -0
  151. package/dist/types/src/application/types/contexts.d.ts +117 -0
  152. package/dist/types/src/application/types/index.d.ts +7 -0
  153. package/dist/types/src/application/types/query.d.ts +23 -0
  154. package/dist/types/src/application/types/queueManager.d.ts +100 -0
  155. package/dist/types/src/application/webhookManager.d.ts +47 -0
  156. package/dist/types/src/application/workerManager.d.ts +61 -0
  157. package/dist/types/src/client/bunqueue/aging.d.ts +16 -0
  158. package/dist/types/src/client/bunqueue/batch.d.ts +16 -0
  159. package/dist/types/src/client/bunqueue/cancellation.d.ts +21 -0
  160. package/dist/types/src/client/bunqueue/circuitBreaker.d.ts +21 -0
  161. package/dist/types/src/client/bunqueue/dedupDebounce.d.ts +12 -0
  162. package/dist/types/src/client/bunqueue/dlqRateLimit.d.ts +26 -0
  163. package/dist/types/src/client/bunqueue/retry.d.ts +8 -0
  164. package/dist/types/src/client/bunqueue/runtime.d.ts +35 -0
  165. package/dist/types/src/client/bunqueue/triggers.d.ts +17 -0
  166. package/dist/types/src/client/bunqueue/ttl.d.ts +17 -0
  167. package/dist/types/src/client/bunqueue/types.d.ts +147 -0
  168. package/dist/types/src/client/bunqueue.d.ts +73 -0
  169. package/dist/types/src/client/dlqConversion.d.ts +5 -0
  170. package/dist/types/src/client/errors.d.ts +24 -0
  171. package/dist/types/src/client/events.d.ts +85 -0
  172. package/dist/types/src/client/flow.d.ts +70 -0
  173. package/dist/types/src/client/flowAtomic.d.ts +9 -0
  174. package/dist/types/src/client/flowJobCoreMethods.d.ts +28 -0
  175. package/dist/types/src/client/flowJobDependencies.d.ts +7 -0
  176. package/dist/types/src/client/flowJobFactory.d.ts +24 -0
  177. package/dist/types/src/client/flowJobMoveMethods.d.ts +16 -0
  178. package/dist/types/src/client/flowJobTypes.d.ts +29 -0
  179. package/dist/types/src/client/flowLegacyPlan.d.ts +16 -0
  180. package/dist/types/src/client/flowOptions.d.ts +10 -0
  181. package/dist/types/src/client/flowPlan.d.ts +16 -0
  182. package/dist/types/src/client/flowPush.d.ts +27 -0
  183. package/dist/types/src/client/flowReader.d.ts +10 -0
  184. package/dist/types/src/client/flowResults.d.ts +11 -0
  185. package/dist/types/src/client/flowTypes.d.ts +77 -0
  186. package/dist/types/src/client/forwarder.d.ts +75 -0
  187. package/dist/types/src/client/groupId.d.ts +1 -0
  188. package/dist/types/src/client/index.d.ts +46 -0
  189. package/dist/types/src/client/jobConversion.d.ts +10 -0
  190. package/dist/types/src/client/jobConversionHelpers.d.ts +28 -0
  191. package/dist/types/src/client/jobConversionTypes.d.ts +88 -0
  192. package/dist/types/src/client/jobDeduplication.d.ts +6 -0
  193. package/dist/types/src/client/jobHelpers.d.ts +31 -0
  194. package/dist/types/src/client/legacyConnectionOptions.d.ts +8 -0
  195. package/dist/types/src/client/manager.d.ts +15 -0
  196. package/dist/types/src/client/pro.d.ts +9 -0
  197. package/dist/types/src/client/queue/addBatcher.d.ts +59 -0
  198. package/dist/types/src/client/queue/bullmqCompat.d.ts +57 -0
  199. package/dist/types/src/client/queue/deduplication.d.ts +14 -0
  200. package/dist/types/src/client/queue/dlq.d.ts +61 -0
  201. package/dist/types/src/client/queue/dlqJobMethods.d.ts +9 -0
  202. package/dist/types/src/client/queue/dlqOps.d.ts +26 -0
  203. package/dist/types/src/client/queue/dlqStats.d.ts +3 -0
  204. package/dist/types/src/client/queue/failWire.d.ts +17 -0
  205. package/dist/types/src/client/queue/helpers.d.ts +19 -0
  206. package/dist/types/src/client/queue/job-proxy/dependencies.d.ts +9 -0
  207. package/dist/types/src/client/queue/job-proxy/reflection.d.ts +2 -0
  208. package/dist/types/src/client/queue/job-proxy/simple.d.ts +3 -0
  209. package/dist/types/src/client/queue/job-proxy/tcp.d.ts +4 -0
  210. package/dist/types/src/client/queue/jobMetadata.d.ts +10 -0
  211. package/dist/types/src/client/queue/jobMove.d.ts +32 -0
  212. package/dist/types/src/client/queue/jobProxy.d.ts +4 -0
  213. package/dist/types/src/client/queue/operations/add/bulk.d.ts +7 -0
  214. package/dist/types/src/client/queue/operations/add/payload.d.ts +25 -0
  215. package/dist/types/src/client/queue/operations/add/single.d.ts +3 -0
  216. package/dist/types/src/client/queue/operations/add.d.ts +2 -0
  217. package/dist/types/src/client/queue/operations/control.d.ts +42 -0
  218. package/dist/types/src/client/queue/operations/counts.d.ts +48 -0
  219. package/dist/types/src/client/queue/operations/groups.d.ts +24 -0
  220. package/dist/types/src/client/queue/operations/management.d.ts +51 -0
  221. package/dist/types/src/client/queue/operations/query.d.ts +50 -0
  222. package/dist/types/src/client/queue/operations/queryStates.d.ts +13 -0
  223. package/dist/types/src/client/queue/operations/queryTcpPages.d.ts +14 -0
  224. package/dist/types/src/client/queue/queue.d.ts +12 -0
  225. package/dist/types/src/client/queue/rateLimit.d.ts +46 -0
  226. package/dist/types/src/client/queue/runtime/compatibility.d.ts +13 -0
  227. package/dist/types/src/client/queue/runtime/configuration.d.ts +46 -0
  228. package/dist/types/src/client/queue/runtime/connection.d.ts +6 -0
  229. package/dist/types/src/client/queue/runtime/control.d.ts +41 -0
  230. package/dist/types/src/client/queue/runtime/queries.d.ts +66 -0
  231. package/dist/types/src/client/queue/runtime/scheduling.d.ts +33 -0
  232. package/dist/types/src/client/queue/runtime/state.d.ts +101 -0
  233. package/dist/types/src/client/queue/scheduler.d.ts +58 -0
  234. package/dist/types/src/client/queue/schedulerPagination.d.ts +7 -0
  235. package/dist/types/src/client/queue/stall.d.ts +20 -0
  236. package/dist/types/src/client/queue/types/add.d.ts +40 -0
  237. package/dist/types/src/client/queue/types/contexts.d.ts +33 -0
  238. package/dist/types/src/client/queue/types/index.d.ts +3 -0
  239. package/dist/types/src/client/queue/types/job.d.ts +50 -0
  240. package/dist/types/src/client/queue/types/runtime.d.ts +35 -0
  241. package/dist/types/src/client/queue/workers.d.ts +36 -0
  242. package/dist/types/src/client/queue-events/tcpSubscription.d.ts +23 -0
  243. package/dist/types/src/client/queue.d.ts +5 -0
  244. package/dist/types/src/client/queueGroup.d.ts +51 -0
  245. package/dist/types/src/client/resolveToken.d.ts +10 -0
  246. package/dist/types/src/client/sandboxed/index.d.ts +7 -0
  247. package/dist/types/src/client/sandboxed/queueOps.d.ts +24 -0
  248. package/dist/types/src/client/sandboxed/runtime/dispatch.d.ts +13 -0
  249. package/dist/types/src/client/sandboxed/runtime/lifecycle.d.ts +20 -0
  250. package/dist/types/src/client/sandboxed/runtime/log.d.ts +1 -0
  251. package/dist/types/src/client/sandboxed/runtime/pool.d.ts +11 -0
  252. package/dist/types/src/client/sandboxed/runtime/recovery.d.ts +11 -0
  253. package/dist/types/src/client/sandboxed/runtime/state.d.ts +39 -0
  254. package/dist/types/src/client/sandboxed/types/index.d.ts +2 -0
  255. package/dist/types/src/client/sandboxed/types/options.d.ts +27 -0
  256. package/dist/types/src/client/sandboxed/types/process.d.ts +39 -0
  257. package/dist/types/src/client/sandboxed/worker.d.ts +4 -0
  258. package/dist/types/src/client/sandboxed/wrapper.d.ts +12 -0
  259. package/dist/types/src/client/sandboxedWorker.d.ts +6 -0
  260. package/dist/types/src/client/tcp/client.d.ts +6 -0
  261. package/dist/types/src/client/tcp/commandQueue.d.ts +23 -0
  262. package/dist/types/src/client/tcp/connection.d.ts +4 -0
  263. package/dist/types/src/client/tcp/errors.d.ts +6 -0
  264. package/dist/types/src/client/tcp/health.d.ts +60 -0
  265. package/dist/types/src/client/tcp/index.d.ts +11 -0
  266. package/dist/types/src/client/tcp/reconnect.d.ts +47 -0
  267. package/dist/types/src/client/tcp/runtime/commands.d.ts +9 -0
  268. package/dist/types/src/client/tcp/runtime/connectivity.d.ts +13 -0
  269. package/dist/types/src/client/tcp/runtime/health.d.ts +14 -0
  270. package/dist/types/src/client/tcp/runtime/lifecycle.d.ts +8 -0
  271. package/dist/types/src/client/tcp/runtime/state.d.ts +50 -0
  272. package/dist/types/src/client/tcp/shared.d.ts +12 -0
  273. package/dist/types/src/client/tcp/transport.d.ts +18 -0
  274. package/dist/types/src/client/tcp/types/command.d.ts +9 -0
  275. package/dist/types/src/client/tcp/types/connection.d.ts +31 -0
  276. package/dist/types/src/client/tcp/types/index.d.ts +5 -0
  277. package/dist/types/src/client/tcp/types/socket.d.ts +8 -0
  278. package/dist/types/src/client/tcp/types/tls.d.ts +4 -0
  279. package/dist/types/src/client/tcp/types.d.ts +2 -0
  280. package/dist/types/src/client/tcpClient.d.ts +6 -0
  281. package/dist/types/src/client/tcpPool.d.ts +69 -0
  282. package/dist/types/src/client/types/connection.d.ts +30 -0
  283. package/dist/types/src/client/types/dlq.d.ts +45 -0
  284. package/dist/types/src/client/types/events.d.ts +54 -0
  285. package/dist/types/src/client/types/flow.d.ts +22 -0
  286. package/dist/types/src/client/types/index.d.ts +10 -0
  287. package/dist/types/src/client/types/job.d.ts +131 -0
  288. package/dist/types/src/client/types/metrics.d.ts +1 -0
  289. package/dist/types/src/client/types/options.d.ts +72 -0
  290. package/dist/types/src/client/types/worker.d.ts +54 -0
  291. package/dist/types/src/client/types.d.ts +2 -0
  292. package/dist/types/src/client/worker/ackBatcher.d.ts +55 -0
  293. package/dist/types/src/client/worker/ackFrontier.d.ts +21 -0
  294. package/dist/types/src/client/worker/ackOutcome.d.ts +8 -0
  295. package/dist/types/src/client/worker/batchExecution.d.ts +14 -0
  296. package/dist/types/src/client/worker/constants.d.ts +7 -0
  297. package/dist/types/src/client/worker/groupConcurrency.d.ts +49 -0
  298. package/dist/types/src/client/worker/handlers/completion.d.ts +29 -0
  299. package/dist/types/src/client/worker/handlers/dependencies.d.ts +11 -0
  300. package/dist/types/src/client/worker/handlers/mutations.d.ts +23 -0
  301. package/dist/types/src/client/worker/handlers/queries.d.ts +15 -0
  302. package/dist/types/src/client/worker/jobParser.d.ts +9 -0
  303. package/dist/types/src/client/worker/processor.d.ts +11 -0
  304. package/dist/types/src/client/worker/processorHandlers.d.ts +4 -0
  305. package/dist/types/src/client/worker/processorOutcome.d.ts +14 -0
  306. package/dist/types/src/client/worker/processorResult.d.ts +2 -0
  307. package/dist/types/src/client/worker/runtime/buffer.d.ts +8 -0
  308. package/dist/types/src/client/worker/runtime/control.d.ts +28 -0
  309. package/dist/types/src/client/worker/runtime/execution.d.ts +16 -0
  310. package/dist/types/src/client/worker/runtime/lifecycle.d.ts +7 -0
  311. package/dist/types/src/client/worker/runtime/manual.d.ts +10 -0
  312. package/dist/types/src/client/worker/runtime/options.d.ts +5 -0
  313. package/dist/types/src/client/worker/runtime/polling.d.ts +14 -0
  314. package/dist/types/src/client/worker/runtime/state.d.ts +121 -0
  315. package/dist/types/src/client/worker/types/index.d.ts +5 -0
  316. package/dist/types/src/client/worker/types/manual.d.ts +7 -0
  317. package/dist/types/src/client/worker/types/options.d.ts +26 -0
  318. package/dist/types/src/client/worker/types/outcome.d.ts +23 -0
  319. package/dist/types/src/client/worker/types/processor.d.ts +25 -0
  320. package/dist/types/src/client/worker/types/transport.d.ts +11 -0
  321. package/dist/types/src/client/worker/worker.d.ts +6 -0
  322. package/dist/types/src/client/worker/workerHeartbeat.d.ts +15 -0
  323. package/dist/types/src/client/worker/workerPull.d.ts +24 -0
  324. package/dist/types/src/client/worker/workerRateLimiter.d.ts +51 -0
  325. package/dist/types/src/client/worker.d.ts +6 -0
  326. package/dist/types/src/client/workflow/admission.d.ts +45 -0
  327. package/dist/types/src/client/workflow/clock.d.ts +60 -0
  328. package/dist/types/src/client/workflow/compensationChild.d.ts +33 -0
  329. package/dist/types/src/client/workflow/compensationClaim.d.ts +11 -0
  330. package/dist/types/src/client/workflow/compensationPass.d.ts +17 -0
  331. package/dist/types/src/client/workflow/compensationSupport.d.ts +24 -0
  332. package/dist/types/src/client/workflow/compensator.d.ts +34 -0
  333. package/dist/types/src/client/workflow/definitionGuard.d.ts +11 -0
  334. package/dist/types/src/client/workflow/emitter.d.ts +17 -0
  335. package/dist/types/src/client/workflow/engine.d.ts +66 -0
  336. package/dist/types/src/client/workflow/eventTypes.d.ts +44 -0
  337. package/dist/types/src/client/workflow/executionFence.d.ts +15 -0
  338. package/dist/types/src/client/workflow/executionTypes.d.ts +133 -0
  339. package/dist/types/src/client/workflow/executor.d.ts +52 -0
  340. package/dist/types/src/client/workflow/executorLifecycle.d.ts +19 -0
  341. package/dist/types/src/client/workflow/executorNodes.d.ts +18 -0
  342. package/dist/types/src/client/workflow/executorQueue.d.ts +9 -0
  343. package/dist/types/src/client/workflow/forEachRunner.d.ts +4 -0
  344. package/dist/types/src/client/workflow/identity.d.ts +48 -0
  345. package/dist/types/src/client/workflow/index.d.ts +23 -0
  346. package/dist/types/src/client/workflow/loops.d.ts +11 -0
  347. package/dist/types/src/client/workflow/mapRunner.d.ts +4 -0
  348. package/dist/types/src/client/workflow/recovery.d.ts +32 -0
  349. package/dist/types/src/client/workflow/rollbackControl.d.ts +37 -0
  350. package/dist/types/src/client/workflow/runner.d.ts +23 -0
  351. package/dist/types/src/client/workflow/runnerTiming.d.ts +14 -0
  352. package/dist/types/src/client/workflow/stepTypes.d.ts +171 -0
  353. package/dist/types/src/client/workflow/store.d.ts +83 -0
  354. package/dist/types/src/client/workflow/storeCodec.d.ts +7 -0
  355. package/dist/types/src/client/workflow/storeExecutionCodec.d.ts +11 -0
  356. package/dist/types/src/client/workflow/storeListing.d.ts +11 -0
  357. package/dist/types/src/client/workflow/storeMaintenance.d.ts +4 -0
  358. package/dist/types/src/client/workflow/storeSignals.d.ts +70 -0
  359. package/dist/types/src/client/workflow/subWorkflowRunner.d.ts +14 -0
  360. package/dist/types/src/client/workflow/types.d.ts +4 -0
  361. package/dist/types/src/client/workflow/unwindPlan.d.ts +87 -0
  362. package/dist/types/src/client/workflow/waitFor.d.ts +56 -0
  363. package/dist/types/src/client/workflow/workflow.d.ts +70 -0
  364. package/dist/types/src/client/workflow/workflowDecisions.d.ts +11 -0
  365. package/dist/types/src/client/workflow/workflowDefinition.d.ts +16 -0
  366. package/dist/types/src/client/workflow/workflowIntrospection.d.ts +5 -0
  367. package/dist/types/src/client/workflow/workflowValidation.d.ts +44 -0
  368. package/dist/types/src/config/index.d.ts +9 -0
  369. package/dist/types/src/config/loader.d.ts +7 -0
  370. package/dist/types/src/config/resolve.d.ts +59 -0
  371. package/dist/types/src/config/types.d.ts +88 -0
  372. package/dist/types/src/domain/job/constants.d.ts +14 -0
  373. package/dist/types/src/domain/job/create.d.ts +9 -0
  374. package/dist/types/src/domain/job/groupFifoOrder.d.ts +9 -0
  375. package/dist/types/src/domain/job/ids.d.ts +7 -0
  376. package/dist/types/src/domain/job/locks.d.ts +16 -0
  377. package/dist/types/src/domain/job/payload.d.ts +18 -0
  378. package/dist/types/src/domain/job/state.d.ts +23 -0
  379. package/dist/types/src/domain/job/terminal.d.ts +3 -0
  380. package/dist/types/src/domain/queue/dependencyTracker.d.ts +78 -0
  381. package/dist/types/src/domain/queue/dlqShard.d.ts +66 -0
  382. package/dist/types/src/domain/queue/groupLimiterManager.d.ts +30 -0
  383. package/dist/types/src/domain/queue/groupScheduler.d.ts +31 -0
  384. package/dist/types/src/domain/queue/groupSchedulerOrder.d.ts +6 -0
  385. package/dist/types/src/domain/queue/limiterManager.d.ts +68 -0
  386. package/dist/types/src/domain/queue/priorityQueue.d.ts +54 -0
  387. package/dist/types/src/domain/queue/priorityQueueOrder.d.ts +3 -0
  388. package/dist/types/src/domain/queue/shard/dependencies.d.ts +11 -0
  389. package/dist/types/src/domain/queue/shard/dlq.d.ts +26 -0
  390. package/dist/types/src/domain/queue/shard/keys.d.ts +19 -0
  391. package/dist/types/src/domain/queue/shard/lifecycle.d.ts +10 -0
  392. package/dist/types/src/domain/queue/shard/limits.d.ts +47 -0
  393. package/dist/types/src/domain/queue/shard/metrics.d.ts +32 -0
  394. package/dist/types/src/domain/queue/shard/state.d.ts +40 -0
  395. package/dist/types/src/domain/queue/shard.d.ts +7 -0
  396. package/dist/types/src/domain/queue/shardCounters.d.ts +35 -0
  397. package/dist/types/src/domain/queue/temporalIndex.d.ts +24 -0
  398. package/dist/types/src/domain/queue/temporalManager.d.ts +72 -0
  399. package/dist/types/src/domain/queue/uniqueKeyManager.d.ts +33 -0
  400. package/dist/types/src/domain/queue/waiterManager.d.ts +18 -0
  401. package/dist/types/src/domain/response/builders.d.ts +15 -0
  402. package/dist/types/src/domain/types/command.d.ts +2 -0
  403. package/dist/types/src/domain/types/commands/base.d.ts +5 -0
  404. package/dist/types/src/domain/types/commands/core.d.ts +107 -0
  405. package/dist/types/src/domain/types/commands/cron.d.ts +36 -0
  406. package/dist/types/src/domain/types/commands/dashboard.d.ts +13 -0
  407. package/dist/types/src/domain/types/commands/dlq.d.ts +44 -0
  408. package/dist/types/src/domain/types/commands/extended.d.ts +63 -0
  409. package/dist/types/src/domain/types/commands/index.d.ts +12 -0
  410. package/dist/types/src/domain/types/commands/limits.d.ts +108 -0
  411. package/dist/types/src/domain/types/commands/management.d.ts +73 -0
  412. package/dist/types/src/domain/types/commands/monitoring.d.ts +49 -0
  413. package/dist/types/src/domain/types/commands/protocol.d.ts +20 -0
  414. package/dist/types/src/domain/types/commands/query.d.ts +46 -0
  415. package/dist/types/src/domain/types/commands/union.d.ts +13 -0
  416. package/dist/types/src/domain/types/commands/workers.d.ts +39 -0
  417. package/dist/types/src/domain/types/cron.d.ts +89 -0
  418. package/dist/types/src/domain/types/deduplication.d.ts +43 -0
  419. package/dist/types/src/domain/types/dlq.d.ts +136 -0
  420. package/dist/types/src/domain/types/flow.d.ts +25 -0
  421. package/dist/types/src/domain/types/group.d.ts +26 -0
  422. package/dist/types/src/domain/types/job.d.ts +8 -0
  423. package/dist/types/src/domain/types/jobs/model.d.ts +150 -0
  424. package/dist/types/src/domain/types/metrics.d.ts +16 -0
  425. package/dist/types/src/domain/types/priorityQueue.d.ts +13 -0
  426. package/dist/types/src/domain/types/protocol.d.ts +5 -0
  427. package/dist/types/src/domain/types/queue.d.ts +110 -0
  428. package/dist/types/src/domain/types/response.d.ts +3 -0
  429. package/dist/types/src/domain/types/responses/model.d.ts +152 -0
  430. package/dist/types/src/domain/types/shard.d.ts +4 -0
  431. package/dist/types/src/domain/types/stall.d.ts +48 -0
  432. package/dist/types/src/domain/types/webhook.d.ts +42 -0
  433. package/dist/types/src/domain/types/worker.d.ts +40 -0
  434. package/dist/types/src/infrastructure/backup/backupTelemetry.d.ts +30 -0
  435. package/dist/types/src/infrastructure/backup/s3BackupConfig.d.ts +80 -0
  436. package/dist/types/src/infrastructure/cloud/types/config.d.ts +18 -0
  437. package/dist/types/src/infrastructure/cloud/types/event.d.ts +14 -0
  438. package/dist/types/src/infrastructure/cloud/types/snapshot.d.ts +52 -0
  439. package/dist/types/src/infrastructure/cloud/types/snapshotCore.d.ts +125 -0
  440. package/dist/types/src/infrastructure/cloud/types/snapshotJobs.d.ts +124 -0
  441. package/dist/types/src/infrastructure/cloud/types/snapshotTelemetry.d.ts +100 -0
  442. package/dist/types/src/infrastructure/cloud/types.d.ts +3 -0
  443. package/dist/types/src/infrastructure/persistence/batchInsert.d.ts +13 -0
  444. package/dist/types/src/infrastructure/persistence/completedJobCountSchema.d.ts +6 -0
  445. package/dist/types/src/infrastructure/persistence/dependencyCompletionSchema.d.ts +6 -0
  446. package/dist/types/src/infrastructure/persistence/dependencyCompletionStore.d.ts +40 -0
  447. package/dist/types/src/infrastructure/persistence/index.d.ts +5 -0
  448. package/dist/types/src/infrastructure/persistence/jobOptionsBlob.d.ts +19 -0
  449. package/dist/types/src/infrastructure/persistence/legacyNameMigration.d.ts +17 -0
  450. package/dist/types/src/infrastructure/persistence/migrationProgressSchema.d.ts +2 -0
  451. package/dist/types/src/infrastructure/persistence/migrations.d.ts +3 -0
  452. package/dist/types/src/infrastructure/persistence/schema.d.ts +8 -0
  453. package/dist/types/src/infrastructure/persistence/sqlite/admission.d.ts +9 -0
  454. package/dist/types/src/infrastructure/persistence/sqlite/completed.d.ts +17 -0
  455. package/dist/types/src/infrastructure/persistence/sqlite/control.d.ts +48 -0
  456. package/dist/types/src/infrastructure/persistence/sqlite/flows.d.ts +26 -0
  457. package/dist/types/src/infrastructure/persistence/sqlite/jobLifecycle.d.ts +17 -0
  458. package/dist/types/src/infrastructure/persistence/sqlite/jobs.d.ts +15 -0
  459. package/dist/types/src/infrastructure/persistence/sqlite/lifecycle.d.ts +6 -0
  460. package/dist/types/src/infrastructure/persistence/sqlite/mutations.d.ts +27 -0
  461. package/dist/types/src/infrastructure/persistence/sqlite/queries.d.ts +23 -0
  462. package/dist/types/src/infrastructure/persistence/sqlite/queueDeletionSql.d.ts +3 -0
  463. package/dist/types/src/infrastructure/persistence/sqlite/records.d.ts +24 -0
  464. package/dist/types/src/infrastructure/persistence/sqlite/state.d.ts +42 -0
  465. package/dist/types/src/infrastructure/persistence/sqlite/telemetry.d.ts +17 -0
  466. package/dist/types/src/infrastructure/persistence/sqlite/telemetryStore.d.ts +30 -0
  467. package/dist/types/src/infrastructure/persistence/sqlite/telemetryWrites.d.ts +47 -0
  468. package/dist/types/src/infrastructure/persistence/sqlite.d.ts +6 -0
  469. package/dist/types/src/infrastructure/persistence/sqliteBatch.d.ts +4 -0
  470. package/dist/types/src/infrastructure/persistence/sqliteMigration.d.ts +5 -0
  471. package/dist/types/src/infrastructure/persistence/sqliteSerializer.d.ts +50 -0
  472. package/dist/types/src/infrastructure/persistence/statements.d.ts +86 -0
  473. package/dist/types/src/infrastructure/persistence/types/admission.d.ts +8 -0
  474. package/dist/types/src/infrastructure/persistence/types/batch.d.ts +12 -0
  475. package/dist/types/src/infrastructure/persistence/types/sqlite.d.ts +27 -0
  476. package/dist/types/src/infrastructure/persistence/writeBuffer.d.ts +48 -0
  477. package/dist/types/src/infrastructure/persistence/writeBufferPending.d.ts +11 -0
  478. package/dist/types/src/infrastructure/scheduler/cron/execution.d.ts +12 -0
  479. package/dist/types/src/infrastructure/scheduler/cron/persisted.d.ts +5 -0
  480. package/dist/types/src/infrastructure/scheduler/cron/runtime.d.ts +31 -0
  481. package/dist/types/src/infrastructure/scheduler/cron/validation.d.ts +3 -0
  482. package/dist/types/src/infrastructure/scheduler/cronParser.d.ts +45 -0
  483. package/dist/types/src/infrastructure/scheduler/cronScheduler.d.ts +5 -0
  484. package/dist/types/src/infrastructure/scheduler/types/cronScheduler.d.ts +16 -0
  485. package/dist/types/src/infrastructure/server/protocol/commands.d.ts +8 -0
  486. package/dist/types/src/infrastructure/server/protocol/frameParser.d.ts +16 -0
  487. package/dist/types/src/infrastructure/server/protocol/lineBuffer.d.ts +6 -0
  488. package/dist/types/src/infrastructure/server/protocol/validation.d.ts +10 -0
  489. package/dist/types/src/infrastructure/server/protocol.d.ts +6 -0
  490. package/dist/types/src/infrastructure/server/socketWriteQueue.d.ts +66 -0
  491. package/dist/types/src/infrastructure/server/types/protocol.d.ts +4 -0
  492. package/dist/types/src/require-bun.d.ts +13 -0
  493. package/dist/types/src/shared/asyncLock.d.ts +13 -0
  494. package/dist/types/src/shared/boundedMap.d.ts +30 -0
  495. package/dist/types/src/shared/boundedSet.d.ts +26 -0
  496. package/dist/types/src/shared/hash.d.ts +30 -0
  497. package/dist/types/src/shared/histogram.d.ts +23 -0
  498. package/dist/types/src/shared/lock.d.ts +13 -0
  499. package/dist/types/src/shared/lockError.d.ts +3 -0
  500. package/dist/types/src/shared/lockTimeout.d.ts +2 -0
  501. package/dist/types/src/shared/logger.d.ts +48 -0
  502. package/dist/types/src/shared/lru.d.ts +9 -0
  503. package/dist/types/src/shared/lruMap.d.ts +42 -0
  504. package/dist/types/src/shared/lruSet.d.ts +36 -0
  505. package/dist/types/src/shared/minHeap.d.ts +43 -0
  506. package/dist/types/src/shared/msgpack.d.ts +3 -0
  507. package/dist/types/src/shared/pausedView.d.ts +19 -0
  508. package/dist/types/src/shared/rwLock.d.ts +22 -0
  509. package/dist/types/src/shared/serialization.d.ts +24 -0
  510. package/dist/types/src/shared/skipList.d.ts +97 -0
  511. package/dist/types/src/shared/skipListNodes.d.ts +6 -0
  512. package/dist/types/src/shared/storageHealth.d.ts +9 -0
  513. package/dist/types/src/shared/ttlMap.d.ts +81 -0
  514. package/dist/types/src/shared/types/lock.d.ts +7 -0
  515. package/dist/types/src/shared/types/skipList.d.ts +4 -0
  516. package/dist/types/src/shared/version.d.ts +4 -0
  517. package/dist/types/src/shared/webhookValidation.d.ts +6 -0
  518. package/package.json +27 -9
  519. package/src/ack-batcher.ts +8 -5
  520. package/src/bunqueue/bunqueue-api.ts +1 -1
  521. package/src/bunqueue/bunqueue.ts +2 -1
  522. package/src/canonical-transport/bun-sqlite-types.ts +22 -0
  523. package/src/canonical-transport/dlq.ts +12 -0
  524. package/src/canonical-transport/embedded.ts +55 -0
  525. package/src/canonical-transport/runtime.ts +49 -0
  526. package/src/canonical-transport/thread-worker.ts +83 -0
  527. package/src/canonical-transport/transport.ts +153 -0
  528. package/src/connection.ts +25 -30
  529. package/src/errors.ts +3 -0
  530. package/src/flow-commit.ts +45 -0
  531. package/src/flow-plan-legacy.ts +117 -0
  532. package/src/flow-plan.ts +209 -0
  533. package/src/flow-types.ts +4 -0
  534. package/src/flow.ts +31 -163
  535. package/src/frame.ts +5 -2
  536. package/src/index.ts +7 -75
  537. package/src/job.ts +43 -9
  538. package/src/legacy.ts +91 -0
  539. package/src/observability.ts +59 -1
  540. package/src/queue-admin.ts +5 -5
  541. package/src/queue-control.ts +8 -6
  542. package/src/queue.ts +10 -6
  543. package/src/serialization.ts +93 -0
  544. package/src/terminal-outcome.ts +58 -0
  545. package/src/types.ts +3 -6
  546. package/src/worker-base.ts +9 -6
  547. package/src/worker-slot-signal.ts +23 -0
  548. package/src/worker.ts +11 -5
  549. package/dist/backpressure.js +0 -39
  550. package/dist/bunqueue/aging.js +0 -53
  551. package/dist/bunqueue/batch.js +0 -60
  552. package/dist/bunqueue/bunqueue-api.js +0 -116
  553. package/dist/bunqueue/bunqueue.js +0 -194
  554. package/dist/bunqueue/cancellation.js +0 -48
  555. package/dist/bunqueue/circuit-breaker.js +0 -69
  556. package/dist/bunqueue/dedup-debounce.js +0 -37
  557. package/dist/bunqueue/dlq-rate-limit.js +0 -65
  558. package/dist/bunqueue/rate-gate.js +0 -61
  559. package/dist/bunqueue/retry.js +0 -56
  560. package/dist/bunqueue/triggers.js +0 -42
  561. package/dist/bunqueue/ttl.js +0 -31
  562. package/dist/bunqueue/types.js +0 -6
  563. package/dist/connection-pool.js +0 -60
  564. package/dist/connection-types.js +0 -2
  565. package/dist/connection.js +0 -281
  566. package/dist/errors.js +0 -25
  567. package/dist/flow-types.js +0 -2
  568. package/dist/flow.js +0 -212
  569. package/dist/job.js +0 -155
  570. package/dist/observability.js +0 -110
  571. package/dist/queue-admin.js +0 -158
  572. package/dist/queue-control.js +0 -107
  573. package/dist/queue-query.js +0 -187
  574. package/dist/queue.js +0 -92
  575. package/dist/responses.js +0 -10
  576. package/dist/socket-factory.js +0 -47
  577. package/dist/types.js +0 -50
  578. package/dist/worker-base.js +0 -159
  579. package/dist/worker-types.js +0 -5
  580. package/dist/worker.js +0 -211
  581. /package/dist/{backpressure.d.ts → types/sdk/typescript/src/backpressure.d.ts} +0 -0
  582. /package/dist/{bunqueue → types/sdk/typescript/src/bunqueue}/cancellation.d.ts +0 -0
@@ -0,0 +1,8 @@
1
+ interface AckEntry {
2
+ readonly id: string;
3
+ }
4
+ /** Parse structured ACKB evidence while preserving duplicate job-ID positions. */
5
+ export declare function ignoredAckIndices(data: unknown, batch: readonly AckEntry[]): ReadonlySet<number>;
6
+ /** Parse a single ACK/FAIL response; historical applied responses have no data. */
7
+ export declare function terminalOutcomeWasApplied(data: unknown): boolean;
8
+ export {};
@@ -59,8 +59,11 @@ export interface JobOptions {
59
59
  }
60
60
  /** Map SDK JobOptions to the PUSH/PUSHB wire fields (undefined keys dropped). */
61
61
  export declare function wireJobOptions(opts?: JobOptions): Record<string, unknown>;
62
- /** The job name travels inside `data`, mirroring the official client. */
63
- export declare function jobPayload(name: string, data: unknown): Record<string, unknown>;
62
+ /** Build the protocol-owned name field without changing user data. */
63
+ export declare function jobPayload(name: string, data: unknown): {
64
+ name: string;
65
+ data: unknown;
66
+ };
64
67
  export interface JobCounts {
65
68
  waiting: number;
66
69
  prioritized: number;
@@ -3,8 +3,9 @@
3
3
  * dispatch shared by the Worker pull loop (worker.ts).
4
4
  */
5
5
  import { EventEmitter } from 'node:events';
6
- import { Connection } from './connection.js';
7
- import { type WorkerEventMap, type WorkerOptions } from './worker-types.js';
6
+ import { Connection } from "./connection.js";
7
+ import type { Response } from "./connection-types.js";
8
+ import { type WorkerEventMap, type WorkerOptions } from "./worker-types.js";
8
9
  export declare class WorkerBase<T = unknown, R = unknown> extends EventEmitter {
9
10
  readonly queue: string;
10
11
  readonly concurrency: number;
@@ -63,12 +64,11 @@ export declare class WorkerBase<T = unknown, R = unknown> extends EventEmitter {
63
64
  * With `force` the wait for in-flight jobs is skipped (parity with the
64
65
  * official client's `close(force)`). */
65
66
  close(force?: boolean): Promise<void>;
66
- /** Dispatch a command, routing failures to 'error'. Returns whether the
67
- * command reached the server — callers gate success-only side effects
68
- * ('completed'/'failed' emits, counters) on it. */
67
+ /** Dispatch a command and route failures to 'error'. The optional outcome
68
+ * parser decides whether a successful response authorizes local effects. */
69
69
  protected safeCall(command: Record<string, unknown> & {
70
70
  cmd: string;
71
- }): Promise<boolean>;
71
+ }, outcome?: (response: Response) => boolean): Promise<boolean>;
72
72
  /** Hook run during close() before draining in-flight jobs (see Worker). */
73
73
  protected beforeClose(): Promise<void>;
74
74
  }
@@ -0,0 +1,6 @@
1
+ /** One-shot wake-up used by the pull loop while every worker slot is busy. */
2
+ export declare class SlotSignal {
3
+ private waiter;
4
+ wait(timeoutMs: number): Promise<void>;
5
+ notify(): void;
6
+ }
@@ -1,7 +1,7 @@
1
1
  /** Worker option types and shared constants. */
2
- import type { TlsOption } from './connection.js';
3
- import type { Job } from './job.js';
4
- import type { Observability } from './observability.js';
2
+ import type { TlsOption } from "./connection.js";
3
+ import type { Job } from "./job.js";
4
+ import type { Observability } from "./observability.js";
5
5
  export type Processor<T = unknown, R = unknown> = (job: Job<T>) => R | Promise<R>;
6
6
  /**
7
7
  * Typed Worker event map: listeners registered via `on`/`once`/`off` for these
@@ -5,11 +5,12 @@
5
5
  * live in the bunqueue server — the worker pulls, heartbeats and acks/fails.
6
6
  * Lifecycle state and cooperative cancel live in WorkerBase.
7
7
  */
8
- import { WorkerBase } from './worker-base.js';
9
- import { type Processor, type WorkerOptions } from './worker-types.js';
8
+ import { WorkerBase } from "./worker-base.js";
9
+ import { type Processor, type WorkerOptions } from "./worker-types.js";
10
10
  export declare class Worker<T = unknown, R = unknown> extends WorkerBase<T, R> {
11
11
  private readonly processor;
12
12
  private readonly ackBatcher;
13
+ private readonly slotSignal;
13
14
  constructor(queue: string, processor: Processor<T, R>, opts?: WorkerOptions);
14
15
  /** Flush batched ACKs before the base class drains in-flight jobs. */
15
16
  protected beforeClose(): Promise<void>;
@@ -0,0 +1,2 @@
1
+ import type { BackgroundContext } from "../types/index.js";
2
+ export declare function performDlqMaintenance(ctx: BackgroundContext): void;
@@ -0,0 +1,4 @@
1
+ import type { CronScheduler } from "../../infrastructure/scheduler/cronScheduler.js";
2
+ import type { BackgroundContext, BackgroundTaskHandles } from "../types/index.js";
3
+ export declare function startBackgroundTasks(ctx: BackgroundContext, cronScheduler: CronScheduler): BackgroundTaskHandles;
4
+ export declare function stopBackgroundTasks(handles: BackgroundTaskHandles): void;
@@ -0,0 +1,5 @@
1
+ import { type JobId } from "../../../domain/types/job.js";
2
+ import type { BackgroundContext } from "../../types/index.js";
3
+ export declare function restoreGroupPolicies(ctx: BackgroundContext, groupStates: ReturnType<NonNullable<BackgroundContext['storage']>['loadGroupState']>): void;
4
+ export declare function restoreRecoveryPolicies(ctx: BackgroundContext, queueStates: ReturnType<NonNullable<BackgroundContext['storage']>['loadQueueState']>): void;
5
+ export declare function recoverActiveJobs(ctx: BackgroundContext, dlqJobIds: Set<JobId>, now: number): void;
@@ -0,0 +1,2 @@
1
+ import type { BackgroundContext } from "../../types/index.js";
2
+ export declare function recover(ctx: BackgroundContext): void;
@@ -0,0 +1,3 @@
1
+ import type { JobId } from "../../../domain/types/job.js";
2
+ import type { BackgroundContext } from "../../types/index.js";
3
+ export declare function recoverPendingJobs(ctx: BackgroundContext, completionProofs: ReadonlySet<JobId>, now: number): void;
@@ -0,0 +1,5 @@
1
+ import type { BackgroundContext } from "../../types/index.js";
2
+ import { type QueueStateRecord } from "./shared.js";
3
+ export declare function restoreDlq(ctx: BackgroundContext): void;
4
+ export declare function restoreQueueState(ctx: BackgroundContext, queueStates: QueueStateRecord[]): void;
5
+ export declare function recoverCompletedJobs(ctx: BackgroundContext): void;
@@ -0,0 +1,6 @@
1
+ import type { Job } from "../../../domain/types/job.js";
2
+ import type { BackgroundContext } from "../../types/index.js";
3
+ export declare const RECOVERY_BATCH_SIZE = 10000;
4
+ export type RecoveryStorage = NonNullable<BackgroundContext['storage']>;
5
+ export type QueueStateRecord = ReturnType<RecoveryStorage['loadQueueState']>[number];
6
+ export declare function quarantineCorruptDependsOn(ctx: BackgroundContext, job: Job): void;
@@ -0,0 +1,25 @@
1
+ import type { Job, JobId } from "../../domain/types/job.js";
2
+ import type { BackgroundContext } from "../types/index.js";
3
+ export declare const MAX_TIMER_DELAY_MS = 2147483647;
4
+ export declare function timeoutTimerDelay(deadline: number, now?: number): number;
5
+ /** Compatibility entry point for explicit timeout checks in tests and tooling. */
6
+ export declare function checkJobTimeouts(ctx: BackgroundContext): Promise<void>;
7
+ /** One timer tracks the earliest active processing deadline. */
8
+ export declare class JobTimeoutScheduler {
9
+ private readonly active;
10
+ private readonly deadlines;
11
+ private timer;
12
+ private armedDeadline;
13
+ private stopped;
14
+ private ctx;
15
+ get pendingCount(): number;
16
+ start(ctx: BackgroundContext): void;
17
+ schedule(job: Job): void;
18
+ cancel(jobId: JobId): void;
19
+ stop(): void;
20
+ private isCurrent;
21
+ private pruneStaleRoots;
22
+ private maybeCompact;
23
+ private armNext;
24
+ private expireDue;
25
+ }
@@ -0,0 +1,7 @@
1
+ /** Stable background-task import surface. */
2
+ export { startBackgroundTasks, stopBackgroundTasks } from "./background/lifecycle.js";
3
+ export { recover } from "./background/recovery/index.js";
4
+ export { checkJobTimeouts } from "./background/timeouts.js";
5
+ export { processPendingDependencies } from "./dependencyProcessor.js";
6
+ export { getTaskErrorStats } from "./taskErrorTracking.js";
7
+ export type { BackgroundTaskHandles } from "./types/background.js";
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Cleanup Tasks - Periodic maintenance and garbage collection
3
+ * Handles orphaned entries, stale data, and memory management
4
+ */
5
+ import type { BackgroundContext } from "./types/index.js";
6
+ /**
7
+ * Main cleanup function - called periodically to maintain system health
8
+ * Cleans orphaned entries, stale data, and manages memory
9
+ */
10
+ export declare function cleanup(ctx: BackgroundContext): Promise<void>;
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Client Ownership - which connection owns a job's current delivery.
3
+ *
4
+ * `clientJobs` maps a connection to the jobs it pulled. `clientJobOwners` is
5
+ * its reverse index: one record per owned job naming the owning connection and
6
+ * the delivery it owns. A delivery is identified by the processing
7
+ * `JobLocation` object the pull installed in `jobIndex`. Only a pull installs a
8
+ * processing location, and every pull installs a fresh object, so the record
9
+ * of an earlier delivery never matches a later delivery of the same job id.
10
+ *
11
+ * Every mutation of the two maps goes through this module so they stay in
12
+ * step: a job is in `clientJobs.get(c)` exactly when its owner record names
13
+ * `c`. Every operation is O(1) per job.
14
+ */
15
+ import type { JobId } from "../domain/types/job.js";
16
+ import type { JobLocation } from "../domain/types/queue.js";
17
+ /** The connection that registered a job's delivery, and that delivery. */
18
+ export interface ClientJobOwner {
19
+ readonly clientId: string;
20
+ /** The `jobIndex` entry current when the connection registered the job. */
21
+ readonly delivery: JobLocation | undefined;
22
+ }
23
+ /** The two ownership maps plus the index that identifies deliveries. */
24
+ export interface ClientOwnershipContext {
25
+ jobIndex: Map<JobId, JobLocation>;
26
+ clientJobs: Map<string, Set<JobId>>;
27
+ clientJobOwners: Map<JobId, ClientJobOwner>;
28
+ }
29
+ /** The maps a detach touches; it never needs the job index. */
30
+ export type ClientOwnershipMaps = Pick<ClientOwnershipContext, 'clientJobs' | 'clientJobOwners'>;
31
+ /**
32
+ * Register `clientId` as the owner of the job's current delivery (called after
33
+ * PULL). A delivery has one owner, so any previous owner is detached first.
34
+ */
35
+ export declare function registerClientJob(clientId: string, jobId: JobId, ctx: ClientOwnershipContext): void;
36
+ /**
37
+ * Remove one connection's claim on a job (ACK/FAIL handled on that
38
+ * connection). Another connection's record for the same job is left alone: it
39
+ * may already own a newer delivery.
40
+ */
41
+ export declare function unregisterClientJob(clientId: string | undefined, jobId: JobId, ctx: ClientOwnershipMaps): void;
42
+ /**
43
+ * End ownership of a job's delivery, whoever holds it. Every transition that
44
+ * ends a delivery without the owner's ACK/FAIL calls this (stall recovery,
45
+ * orphan recovery, lock expiry, timeout, management claims, disconnect
46
+ * release), so a silent connection never keeps a job it no longer runs.
47
+ */
48
+ export declare function detachClientJob(jobId: JobId, ctx: ClientOwnershipMaps): void;
49
+ /**
50
+ * True only when `clientId` registered the job's current delivery: the job is
51
+ * processing and its processing entry is the one the connection registered.
52
+ * Disconnect release acts on nothing else, so a stale registration can never
53
+ * release or expire a later delivery owned by another worker.
54
+ */
55
+ export declare function ownsCurrentDelivery(clientId: string, jobId: JobId, ctx: ClientOwnershipContext): boolean;
56
+ /** Forget a disconnected client: its set and only its own owner records. */
57
+ export declare function dropClient(clientId: string, ctx: ClientOwnershipMaps): void;
58
+ /**
59
+ * Detach every record whose delivery has ended. An outcome sent on another
60
+ * connection than the pull (pooled clients) unregisters the sender, not the
61
+ * owner, so such records would otherwise live as long as the pulling
62
+ * connection. Runs synchronously from periodic cleanup.
63
+ * @returns the number of records removed.
64
+ */
65
+ export declare function pruneEndedClientDeliveries(ctx: ClientOwnershipContext): number;
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Client Tracking - Client-job relationship management
3
+ * Handles job ownership and release on client disconnect
4
+ */
5
+ import type { LockContext } from "./types/index.js";
6
+ export { registerClientJob, unregisterClientJob } from "./clientOwnership.js";
7
+ /**
8
+ * Release all jobs owned by a client back to queue (called on TCP disconnect).
9
+ * Returns the number of jobs released.
10
+ *
11
+ * Only deliveries the client still owns are touched (`ownsCurrentDelivery`): a
12
+ * job recovered from this client and delivered again to another worker is not
13
+ * this client's to release. The rule is checked when collecting and again
14
+ * under the shard and processing write locks.
15
+ */
16
+ export declare function releaseClientJobs(clientId: string, ctx: LockContext): Promise<number>;
17
+ /**
18
+ * Force-release client tracking without acquiring queue locks.
19
+ * Used as a last-resort fallback when releaseClientJobs has exhausted its
20
+ * retry budget (e.g. persistent lock contention on TCP disconnect). For each
21
+ * job whose current delivery the client still owns (`ownsCurrentDelivery`;
22
+ * a stale registration must not expire another worker's delivery):
23
+ * - clears `jobLocks` so a stale lock token can't survive the disconnect
24
+ * until its TTL expires;
25
+ * - expires both `lastHeartbeat` (so stall detection's heartbeat check
26
+ * fires) and `startedAt` (so the gracePeriod check passes immediately).
27
+ *
28
+ * Recovery latency: stall detection uses two-phase confirmation
29
+ * (stalledCandidates collected on one tick, acted on the next), so a job is
30
+ * recovered within ~2 stall-check ticks (≈10s with defaults). This is faster
31
+ * than the full stallTimeout (30s default) but NOT instant.
32
+ *
33
+ * This path runs lock-free: callers must accept that another path (stall
34
+ * detector, lock expiration) may concurrently mutate or remove the same job
35
+ * from processingShards. Worst case: our mutation lands on an object that is
36
+ * no longer in the Map, wasting the write. Never corrupts state.
37
+ *
38
+ * Returns the number of jobs whose state was reset.
39
+ */
40
+ export declare function forceReleaseClientJobs(clientId: string, ctx: LockContext): number;
@@ -0,0 +1,34 @@
1
+ import type { Job, JobId } from "../domain/types/job.js";
2
+ import type { SqliteStorage } from "../infrastructure/persistence/sqlite.js";
3
+ import type { DependencyResultTracker } from "./dependencyResultTracker.js";
4
+ export interface CompletedCleanupContext {
5
+ jobIndex: Map<JobId, {
6
+ type: string;
7
+ queueName?: string;
8
+ }>;
9
+ completedJobs: {
10
+ delete(jobId: JobId): boolean;
11
+ };
12
+ completedJobsData: {
13
+ get(jobId: JobId): Job | undefined;
14
+ delete(jobId: JobId): boolean;
15
+ };
16
+ jobResults?: {
17
+ delete(jobId: JobId): boolean;
18
+ };
19
+ jobResultQueues?: {
20
+ get(jobId: JobId): string | undefined;
21
+ delete(jobId: JobId): boolean;
22
+ };
23
+ jobLogs?: {
24
+ delete(jobId: JobId): boolean;
25
+ };
26
+ jobLogQueues?: {
27
+ get(jobId: JobId): string | undefined;
28
+ delete(jobId: JobId): boolean;
29
+ };
30
+ dependencyResults: DependencyResultTracker;
31
+ storage: SqliteStorage | null;
32
+ }
33
+ /** Delete completed rows first, then converge every bounded in-memory projection. */
34
+ export declare function cleanCompletedJobs(queue: string | null, completedBefore: number, limit: number, ctx: CompletedCleanupContext): JobId[];
@@ -0,0 +1,21 @@
1
+ import { type Job, type JobId } from "../domain/types/job.js";
2
+ import type { DlqContext } from "./dlqManager.js";
3
+ /** Completed-job retry state shared by embedded control surfaces. */
4
+ export interface RetryCompletedContext extends DlqContext {
5
+ completedJobs: {
6
+ has(id: JobId): boolean;
7
+ delete(id: JobId): boolean;
8
+ } & Iterable<JobId>;
9
+ completedJobsData: {
10
+ get(id: JobId): Job | undefined;
11
+ delete(id: JobId): boolean;
12
+ };
13
+ jobResults: {
14
+ delete(id: JobId): boolean;
15
+ };
16
+ }
17
+ /** Retry a selected completed generation or an oldest-first bounded set. */
18
+ export declare function retryCompletedJobs(queue: string, ctx: RetryCompletedContext, targetId?: JobId, options?: {
19
+ limit?: number;
20
+ timestamp?: number;
21
+ }): number;
@@ -0,0 +1,49 @@
1
+ /**
2
+ * ContextFactory - Builds context objects for delegated operations
3
+ */
4
+ import type { LockContext, BackgroundContext, StatsContext } from "./types/index.js";
5
+ import type { PushContext } from "./operations/push.js";
6
+ import type { PullContext } from "./operations/pull.js";
7
+ import type { AckContext } from "./operations/ack.js";
8
+ import type { JobManagementContext } from "./operations/jobManagement.js";
9
+ import type { QueryContext } from "./operations/queryOperations.js";
10
+ import type { DlqContext, RetryCompletedContext } from "./dlqManager.js";
11
+ import type { ContextCallbacks, ContextDependencies } from "./types/contextFactory.js";
12
+ export type { ContextCallbacks, ContextDependencies } from "./types/contextFactory.js";
13
+ /**
14
+ * Factory for building context objects
15
+ */
16
+ export declare class ContextFactory {
17
+ private readonly deps;
18
+ private readonly callbacks;
19
+ constructor(deps: ContextDependencies, callbacks: ContextCallbacks);
20
+ getLockContext(): LockContext;
21
+ getBackgroundContext(): BackgroundContext;
22
+ getStatsContext(): StatsContext;
23
+ getPushContext(): PushContext;
24
+ getPullContext(): PullContext;
25
+ getAckContext(): AckContext;
26
+ getJobMgmtContext(): JobManagementContext;
27
+ getQueryContext(): QueryContext;
28
+ getDlqContext(): DlqContext;
29
+ getRetryCompletedContext(): RetryCompletedContext;
30
+ getLogsContext(): {
31
+ jobIndex: Map<import("../domain/types/job.js").JobId, import("../domain/types/queue.js").JobLocation>;
32
+ jobLogs: import("../shared/lruMap.js").LRUMap<import("../domain/types/job.js").JobId, import("../domain/types/worker.js").JobLogEntry[]>;
33
+ jobLogQueues: Map<import("../domain/types/job.js").JobId, string>;
34
+ maxLogsPerJob: number;
35
+ };
36
+ getQueueControlContext(): {
37
+ shards: import("../domain/queue/shard.js").Shard[];
38
+ jobIndex: Map<import("../domain/types/job.js").JobId, import("../domain/types/queue.js").JobLocation>;
39
+ processingShards: Map<import("../domain/types/job.js").JobId, import("../domain/types/job.js").Job>[];
40
+ completedJobs: import("../shared/boundedSet.js").BoundedSet<import("../domain/types/job.js").JobId>;
41
+ completedJobsData: import("../shared/boundedMap.js").BoundedMap<import("../domain/types/job.js").JobId, import("../domain/types/job.js").Job>;
42
+ jobResults: import("../shared/lruMap.js").LRUMap<import("../domain/types/job.js").JobId, unknown>;
43
+ jobResultQueues: Map<import("../domain/types/job.js").JobId, string>;
44
+ dependencyResults: import("./dependencyResultTracker.js").DependencyResultTracker;
45
+ jobLogs: import("../shared/lruMap.js").LRUMap<import("../domain/types/job.js").JobId, import("../domain/types/worker.js").JobLogEntry[]>;
46
+ jobLogQueues: Map<import("../domain/types/job.js").JobId, string>;
47
+ storage: import("../infrastructure/persistence/index.js").SqliteStorage | null;
48
+ };
49
+ }
@@ -0,0 +1,63 @@
1
+ import type { Job, JobId } from "../domain/types/job.js";
2
+ import type { Shard } from "../domain/queue/shard.js";
3
+ import type { SqliteStorage } from "../infrastructure/persistence/sqlite.js";
4
+ import type { SetLike } from "../shared/lru.js";
5
+ interface CompletionRecord {
6
+ jobId: JobId;
7
+ queue: string;
8
+ pinned: boolean;
9
+ }
10
+ /**
11
+ * Payload-free completion evidence has two retention classes:
12
+ * recent IDs are FIFO-bounded, while IDs referenced by live dependency edges
13
+ * stay pinned until their final consumer is durably resolved or removed.
14
+ */
15
+ export declare class DependencyCompletionTracker implements SetLike<JobId> {
16
+ private readonly onRecentEvict?;
17
+ private readonly recent;
18
+ private recentOrder;
19
+ private recentOrderTokens;
20
+ private readonly recentTokens;
21
+ private recentOrderHead;
22
+ private nextRecentToken;
23
+ private readonly pinned;
24
+ private readonly owners;
25
+ private readonly maxRecent;
26
+ constructor(maxRecent: number, onRecentEvict?: ((jobId: JobId) => void) | undefined);
27
+ add(jobId: JobId, queue?: string): void;
28
+ pin(jobId: JobId, queue?: string): void;
29
+ unpin(jobId: JobId, retainAsRecent: boolean): void;
30
+ hydrate(records: Iterable<CompletionRecord>): void;
31
+ pinnedValues(): IterableIterator<JobId>;
32
+ has(jobId: JobId): boolean;
33
+ delete(jobId: JobId): boolean;
34
+ deleteForQueue(queue: string): JobId[];
35
+ clear(): void;
36
+ get size(): number;
37
+ private evictOldestRecent;
38
+ private compactRecentOrder;
39
+ }
40
+ export interface DependencyCompletionContext {
41
+ storage: SqliteStorage | null;
42
+ shards: Shard[];
43
+ depCompletions?: DependencyCompletionTracker;
44
+ maxDependencyCompletions: number;
45
+ }
46
+ export declare function hasDependencyWaiters(shards: Shard[], jobId: JobId): boolean;
47
+ /** Persist a removeOnComplete transition before publishing its RAM evidence. */
48
+ export declare function commitRemovedCompletion(job: Pick<Job, 'id' | 'queue'>, ctx: DependencyCompletionContext, completedAt?: number): void;
49
+ /**
50
+ * Protect recent proofs when a newly accepted parent waits on another
51
+ * dependency. SQLite is updated first so RAM never advertises a stronger
52
+ * durability guarantee than the database.
53
+ */
54
+ export declare function pinReferencedCompletions(dependencyIds: Iterable<JobId>, ctx: Pick<DependencyCompletionContext, 'storage' | 'depCompletions'>): void;
55
+ /**
56
+ * Unpin candidates only after every shard has released its reverse edge.
57
+ * Storage returns the complete retained set because pruning can also evict
58
+ * older recent entries; hydrating from it keeps both RAM tiers exact.
59
+ */
60
+ export declare function releaseDependencyCompletionPins(dependencyIds: Iterable<JobId>, ctx: DependencyCompletionContext): void;
61
+ /** Rebuild pin ownership from the authoritative reverse dependency indexes. */
62
+ export declare function reconcileDependencyCompletionPins(ctx: DependencyCompletionContext): void;
63
+ export {};
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Dependency Processor - Job dependency resolution
3
+ * Uses reverse index for O(m) where m = jobs waiting on completed deps
4
+ */
5
+ import type { Job } from "../domain/types/job.js";
6
+ import type { BackgroundContext } from "./types/index.js";
7
+ type DependencyReadyState = 'delayed' | 'prioritized' | 'waiting';
8
+ export declare function dependencyReadyState(job: Job, now: number): DependencyReadyState;
9
+ export declare function checkpointDependencyPromotion(job: Job, state: DependencyReadyState, now: number, storage: BackgroundContext['storage']): void;
10
+ /**
11
+ * Process pending dependency checks
12
+ * Resolves jobs whose dependencies have been completed
13
+ */
14
+ export declare function processPendingDependencies(ctx: BackgroundContext): Promise<void>;
15
+ export {};
@@ -0,0 +1,18 @@
1
+ import type { JobId } from "../domain/types/job.js";
2
+ /**
3
+ * Retains results while at least one live dependency consumer may still read
4
+ * them. Ordinary completed-job results remain governed by the configured LRU.
5
+ */
6
+ export declare class DependencyResultTracker {
7
+ private readonly consumersByDependency;
8
+ private readonly dependenciesByConsumer;
9
+ private readonly protectedResults;
10
+ registerConsumer(consumerId: JobId, dependencyIds: readonly JobId[]): void;
11
+ retain(dependencyId: JobId, result: unknown): void;
12
+ has(dependencyId: JobId): boolean;
13
+ get(dependencyId: JobId): unknown;
14
+ hasConsumers(dependencyId: JobId): boolean;
15
+ releaseConsumer(consumerId: JobId): void;
16
+ releaseDependency(consumerId: JobId, dependencyId: JobId): void;
17
+ clear(): void;
18
+ }
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Advanced DLQ Manager
3
+ * Dead Letter Queue operations with auto-retry, metadata, and lifecycle management
4
+ */
5
+ import type { Job, JobId } from "../domain/types/job.js";
6
+ import type { JobLocation } from "../domain/types/queue.js";
7
+ import type { Shard } from "../domain/queue/shard.js";
8
+ import type { DlqEntry, DlqConfig, DlqFilter, DlqStats } from "../domain/types/dlq.js";
9
+ import type { SqliteStorage } from "../infrastructure/persistence/sqlite.js";
10
+ /** Context for DLQ operations */
11
+ export interface DlqContext {
12
+ shards: Shard[];
13
+ jobIndex: Map<JobId, JobLocation>;
14
+ jobResults: {
15
+ delete(id: JobId): boolean;
16
+ };
17
+ jobResultQueues: Map<JobId, string>;
18
+ dependencyResults: {
19
+ releaseConsumer(id: JobId): void;
20
+ };
21
+ customIdMap: {
22
+ get(id: string): JobId | undefined;
23
+ set(id: string, jobId: JobId): void;
24
+ delete(id: string): boolean;
25
+ };
26
+ jobLogs: {
27
+ delete(id: JobId): boolean;
28
+ };
29
+ jobLogQueues: Map<JobId, string>;
30
+ storage: SqliteStorage | null;
31
+ }
32
+ export { processAutoRetry, retryDlqByFilter, retryDlqJob, retryDlqJobs } from "./dlqRetry.js";
33
+ export { retryCompletedJobs, type RetryCompletedContext } from "./completedRetry.js";
34
+ /** Get jobs from DLQ (backward compatible) */
35
+ export declare function getDlqJobs(queue: string, ctx: DlqContext, count?: number): Job[];
36
+ /** Get DLQ entries with full metadata */
37
+ export declare function getDlqEntries(queue: string, ctx: DlqContext, filter?: DlqFilter): DlqEntry[];
38
+ /** Get DLQ statistics */
39
+ export declare function getDlqStats(queue: string, ctx: DlqContext): DlqStats;
40
+ /** Purge expired entries from DLQ */
41
+ export declare function purgeExpiredDlq(queue: string, ctx: DlqContext): number;
42
+ /** Purge all jobs from DLQ */
43
+ export declare function purgeDlqJobs(queue: string, ctx: DlqContext): number;
44
+ /** Remove one DLQ entry without re-enqueuing it. */
45
+ export declare function removeDlqJob(queue: string, id: JobId, ctx: DlqContext): boolean;
46
+ /** Configure DLQ for a queue */
47
+ export declare function configureDlq(queue: string, ctx: DlqContext, config: Partial<DlqConfig>): void;
48
+ /** Get DLQ configuration */
49
+ export declare function getDlqConfig(queue: string, ctx: DlqContext): DlqConfig;
@@ -0,0 +1,12 @@
1
+ /** DLQ manual and automatic retry transitions. */
2
+ import { type Job, type JobId } from "../domain/types/job.js";
3
+ import type { DlqFilter } from "../domain/types/dlq.js";
4
+ import type { DlqContext } from "./dlqManager.js";
5
+ /** Retry a single job from DLQ and reset the automatic retry generation. */
6
+ export declare function retryDlqJob(queue: string, jobId: JobId, ctx: DlqContext): Job | null;
7
+ /** Retry jobs from DLQ, optionally bounded to the oldest `limit` entries. */
8
+ export declare function retryDlqJobs(queue: string, ctx: DlqContext, jobId?: JobId, limit?: number): number;
9
+ /** Retry all DLQ entries selected by a metadata filter. */
10
+ export declare function retryDlqByFilter(queue: string, ctx: DlqContext, filter: DlqFilter): number;
11
+ /** Dispatch due auto-retries while preserving their bounded retry chain. */
12
+ export declare function processAutoRetry(queue: string, ctx: DlqContext): number;
@@ -0,0 +1,3 @@
1
+ import type { BackgroundContext } from "./types/index.js";
2
+ /** Reconcile registered names with every live or durable queue projection. */
3
+ export declare function cleanEmptyQueues(ctx: BackgroundContext): void;
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Events Manager
3
+ * Job event subscription and broadcasting
4
+ */
5
+ import type { JobId } from "../domain/types/job.js";
6
+ import { EventType, type JobEvent } from "../domain/types/queue.js";
7
+ import type { WebhookManager } from "./webhookManager.js";
8
+ /** Event subscriber callback */
9
+ export type EventSubscriber = (event: JobEvent) => void;
10
+ export type EventBatchSubscriber = (events: readonly JobEvent[]) => void;
11
+ /** Events manager class */
12
+ export declare class EventsManager {
13
+ private readonly webhookManager;
14
+ /** Use Set for O(1) subscribe/unsubscribe instead of indexOf+splice */
15
+ private readonly subscribers;
16
+ /** Optional batch path for internal subscribers such as durable telemetry. */
17
+ private readonly batchSubscribers;
18
+ /** Waiters for specific job completions - for efficient WaitJob implementation */
19
+ private readonly completionWaiters;
20
+ constructor(webhookManager: WebhookManager);
21
+ /** Number of active event subscribers */
22
+ get subscriberCount(): number;
23
+ /** Number of jobs with active completion waiters */
24
+ get completionWaiterCount(): number;
25
+ /** Subscribe to job events - O(1) add and remove */
26
+ subscribe(callback: EventSubscriber, batchCallback?: EventBatchSubscriber): () => void;
27
+ /** Clear all subscribers (for shutdown) */
28
+ clear(): void;
29
+ /**
30
+ * Wait for a specific job to complete - event-driven, no polling
31
+ * Returns true if job completed, false if timeout
32
+ */
33
+ waitForJobCompletion(jobId: JobId, timeoutMs: number, signal?: AbortSignal): Promise<boolean>;
34
+ /** Check if broadcast has any listeners - for batch optimizations */
35
+ needsBroadcast(): boolean;
36
+ /** Broadcast event to all subscribers - optimized to skip work when no listeners */
37
+ broadcast(event: Partial<JobEvent> & {
38
+ eventType: EventType;
39
+ queue: string;
40
+ jobId: JobId;
41
+ timestamp: number;
42
+ error?: string;
43
+ }): void;
44
+ /** Broadcast an ordered batch while allowing internal subscribers to persist once. */
45
+ broadcastBatch(events: readonly JobEvent[]): void;
46
+ private notifyCompletionWaiters;
47
+ private triggerWebhook;
48
+ /** Map internal event type to webhook event */
49
+ private mapEventToWebhook;
50
+ }
@@ -0,0 +1,20 @@
1
+ import type { JobId } from "../domain/types/job.js";
2
+ import type { JobLocation } from "../domain/types/queue.js";
3
+ import type { Shard } from "../domain/queue/shard.js";
4
+ import type { SqliteStorage } from "../infrastructure/persistence/sqlite.js";
5
+ import type { SetLike } from "../shared/lru.js";
6
+ import type { DependencyResultTracker } from "./dependencyResultTracker.js";
7
+ import { type DependencyCompletionTracker } from "./dependencyCompletions.js";
8
+ export interface FlowFailureRecoveryContext {
9
+ readonly storage: SqliteStorage;
10
+ readonly shards: Shard[];
11
+ readonly jobIndex: Map<JobId, JobLocation>;
12
+ readonly completedJobs: SetLike<JobId>;
13
+ readonly depCompletions?: DependencyCompletionTracker;
14
+ readonly maxDependencyCompletions: number;
15
+ readonly dependencyResults: DependencyResultTracker;
16
+ readonly failedChildrenValues: Map<JobId, Record<string, string>>;
17
+ readonly ignoredChildrenFailures: Map<JobId, Record<string, string>>;
18
+ }
19
+ /** Replay the durable flow-failure outbox before workers can observe recovered jobs. */
20
+ export declare function recoverFlowFailures(ctx: FlowFailureRecoveryContext): void;