@adonis-agora/durable 0.49.0 → 0.50.0

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 (324) hide show
  1. package/CHANGELOG.md +261 -0
  2. package/README.md +53 -22
  3. package/dist/assets/spa/assets/index-DupjrK7N.js +16 -0
  4. package/dist/assets/spa/assets/index-DupjrK7N.js.map +1 -0
  5. package/dist/assets/spa/index.html +1 -1
  6. package/dist/commands/durable_worker.d.ts.map +1 -1
  7. package/dist/commands/durable_worker.js +9 -8
  8. package/dist/commands/durable_worker.js.map +1 -1
  9. package/dist/configure.d.ts.map +1 -1
  10. package/dist/configure.js +1 -0
  11. package/dist/configure.js.map +1 -1
  12. package/dist/providers/dashboard_provider.d.ts +2 -0
  13. package/dist/providers/dashboard_provider.d.ts.map +1 -1
  14. package/dist/providers/dashboard_provider.js +50 -6
  15. package/dist/providers/dashboard_provider.js.map +1 -1
  16. package/dist/providers/durable_provider.d.ts.map +1 -1
  17. package/dist/providers/durable_provider.js +143 -34
  18. package/dist/providers/durable_provider.js.map +1 -1
  19. package/dist/src/admission-redis/redis-admission-backend.d.ts.map +1 -1
  20. package/dist/src/admission-redis/redis-admission-backend.js +3 -1
  21. package/dist/src/admission-redis/redis-admission-backend.js.map +1 -1
  22. package/dist/src/ambient-step.d.ts +24 -0
  23. package/dist/src/ambient-step.d.ts.map +1 -0
  24. package/dist/src/ambient-step.js +42 -0
  25. package/dist/src/ambient-step.js.map +1 -0
  26. package/dist/src/base-workflow.d.ts +10 -1
  27. package/dist/src/base-workflow.d.ts.map +1 -1
  28. package/dist/src/base-workflow.js.map +1 -1
  29. package/dist/src/codec-state-store.d.ts +28 -2
  30. package/dist/src/codec-state-store.d.ts.map +1 -1
  31. package/dist/src/codec-state-store.js +61 -3
  32. package/dist/src/codec-state-store.js.map +1 -1
  33. package/dist/src/commands/worker.d.ts +4 -1
  34. package/dist/src/commands/worker.d.ts.map +1 -1
  35. package/dist/src/commands/worker.js +27 -3
  36. package/dist/src/commands/worker.js.map +1 -1
  37. package/dist/src/config_types.d.ts +6 -0
  38. package/dist/src/config_types.d.ts.map +1 -1
  39. package/dist/src/control-plane-redis/redis-control-plane.d.ts.map +1 -1
  40. package/dist/src/control-plane-redis/redis-control-plane.js +22 -6
  41. package/dist/src/control-plane-redis/redis-control-plane.js.map +1 -1
  42. package/dist/src/control-planes/factory.d.ts +6 -0
  43. package/dist/src/control-planes/factory.d.ts.map +1 -1
  44. package/dist/src/control-planes/factory.js +1 -0
  45. package/dist/src/control-planes/factory.js.map +1 -1
  46. package/dist/src/dashboard/gateway-adapter.d.ts +15 -5
  47. package/dist/src/dashboard/gateway-adapter.d.ts.map +1 -1
  48. package/dist/src/dashboard/gateway-adapter.js +71 -7
  49. package/dist/src/dashboard/gateway-adapter.js.map +1 -1
  50. package/dist/src/dashboard/handlers.d.ts +53 -1
  51. package/dist/src/dashboard/handlers.d.ts.map +1 -1
  52. package/dist/src/dashboard/handlers.js +200 -20
  53. package/dist/src/dashboard/handlers.js.map +1 -1
  54. package/dist/src/dashboard/index.d.ts +2 -2
  55. package/dist/src/dashboard/index.d.ts.map +1 -1
  56. package/dist/src/dashboard/index.js +2 -2
  57. package/dist/src/dashboard/index.js.map +1 -1
  58. package/dist/src/dashboard/openapi.d.ts.map +1 -1
  59. package/dist/src/dashboard/openapi.js +71 -1
  60. package/dist/src/dashboard/openapi.js.map +1 -1
  61. package/dist/src/define_config.d.ts +122 -8
  62. package/dist/src/define_config.d.ts.map +1 -1
  63. package/dist/src/define_config.js.map +1 -1
  64. package/dist/src/diagnostics-bridge.d.ts +16 -3
  65. package/dist/src/diagnostics-bridge.d.ts.map +1 -1
  66. package/dist/src/diagnostics-bridge.js +9 -3
  67. package/dist/src/diagnostics-bridge.js.map +1 -1
  68. package/dist/src/discovery-roots.d.ts +92 -0
  69. package/dist/src/discovery-roots.d.ts.map +1 -0
  70. package/dist/src/discovery-roots.js +150 -0
  71. package/dist/src/discovery-roots.js.map +1 -0
  72. package/dist/src/engine.d.ts +418 -20
  73. package/dist/src/engine.d.ts.map +1 -1
  74. package/dist/src/engine.js +1523 -159
  75. package/dist/src/engine.js.map +1 -1
  76. package/dist/src/entities.d.ts +36 -1
  77. package/dist/src/entities.d.ts.map +1 -1
  78. package/dist/src/entities.js +65 -4
  79. package/dist/src/entities.js.map +1 -1
  80. package/dist/src/errors.d.ts +36 -0
  81. package/dist/src/errors.d.ts.map +1 -1
  82. package/dist/src/errors.js +44 -0
  83. package/dist/src/errors.js.map +1 -1
  84. package/dist/src/event-trigger-bridge.d.ts +8 -0
  85. package/dist/src/event-trigger-bridge.d.ts.map +1 -1
  86. package/dist/src/event-trigger-bridge.js +24 -3
  87. package/dist/src/event-trigger-bridge.js.map +1 -1
  88. package/dist/src/handshake/announced.d.ts +27 -0
  89. package/dist/src/handshake/announced.d.ts.map +1 -1
  90. package/dist/src/handshake/announced.js +62 -0
  91. package/dist/src/handshake/announced.js.map +1 -1
  92. package/dist/src/handshake/directory.d.ts +92 -0
  93. package/dist/src/handshake/directory.d.ts.map +1 -0
  94. package/dist/src/handshake/directory.js +139 -0
  95. package/dist/src/handshake/directory.js.map +1 -0
  96. package/dist/src/hooks/barrel-sources.d.ts +28 -0
  97. package/dist/src/hooks/barrel-sources.d.ts.map +1 -0
  98. package/dist/src/hooks/barrel-sources.js +92 -0
  99. package/dist/src/hooks/barrel-sources.js.map +1 -0
  100. package/dist/src/hooks/steps.d.ts +12 -3
  101. package/dist/src/hooks/steps.d.ts.map +1 -1
  102. package/dist/src/hooks/steps.js +7 -11
  103. package/dist/src/hooks/steps.js.map +1 -1
  104. package/dist/src/hooks/workflows.d.ts +12 -3
  105. package/dist/src/hooks/workflows.d.ts.map +1 -1
  106. package/dist/src/hooks/workflows.js +7 -13
  107. package/dist/src/hooks/workflows.js.map +1 -1
  108. package/dist/src/index.d.ts +12 -3
  109. package/dist/src/index.d.ts.map +1 -1
  110. package/dist/src/index.js +12 -3
  111. package/dist/src/index.js.map +1 -1
  112. package/dist/src/interfaces.d.ts +309 -21
  113. package/dist/src/interfaces.d.ts.map +1 -1
  114. package/dist/src/interfaces.js +10 -0
  115. package/dist/src/interfaces.js.map +1 -1
  116. package/dist/src/metrics.d.ts.map +1 -1
  117. package/dist/src/metrics.js +5 -0
  118. package/dist/src/metrics.js.map +1 -1
  119. package/dist/src/namespaces.d.ts +17 -0
  120. package/dist/src/namespaces.d.ts.map +1 -0
  121. package/dist/src/namespaces.js +24 -0
  122. package/dist/src/namespaces.js.map +1 -0
  123. package/dist/src/otel/durable-metrics.d.ts.map +1 -1
  124. package/dist/src/otel/durable-metrics.js +5 -0
  125. package/dist/src/otel/durable-metrics.js.map +1 -1
  126. package/dist/src/otel/durable-otel.d.ts.map +1 -1
  127. package/dist/src/otel/durable-otel.js +5 -0
  128. package/dist/src/otel/durable-otel.js.map +1 -1
  129. package/dist/src/pollers.d.ts +10 -1
  130. package/dist/src/pollers.d.ts.map +1 -1
  131. package/dist/src/pollers.js +15 -5
  132. package/dist/src/pollers.js.map +1 -1
  133. package/dist/src/protocol.d.ts +12 -0
  134. package/dist/src/protocol.d.ts.map +1 -1
  135. package/dist/src/protocol.js +27 -1
  136. package/dist/src/protocol.js.map +1 -1
  137. package/dist/src/remote-event.d.ts +6 -0
  138. package/dist/src/remote-event.d.ts.map +1 -0
  139. package/dist/src/remote-event.js +19 -0
  140. package/dist/src/remote-event.js.map +1 -0
  141. package/dist/src/remote-workflow-executor.d.ts +34 -12
  142. package/dist/src/remote-workflow-executor.d.ts.map +1 -1
  143. package/dist/src/remote-workflow-executor.js +42 -40
  144. package/dist/src/remote-workflow-executor.js.map +1 -1
  145. package/dist/src/run-detail-summary.d.ts +90 -3
  146. package/dist/src/run-detail-summary.d.ts.map +1 -1
  147. package/dist/src/run-detail-summary.js +360 -2
  148. package/dist/src/run-detail-summary.js.map +1 -1
  149. package/dist/src/run-facets.d.ts +48 -0
  150. package/dist/src/run-facets.d.ts.map +1 -0
  151. package/dist/src/run-facets.js +100 -0
  152. package/dist/src/run-facets.js.map +1 -0
  153. package/dist/src/run-gateway/interface.d.ts +27 -1
  154. package/dist/src/run-gateway/interface.d.ts.map +1 -1
  155. package/dist/src/run-gateway/proxy-run-gateway.d.ts +32 -4
  156. package/dist/src/run-gateway/proxy-run-gateway.d.ts.map +1 -1
  157. package/dist/src/run-gateway/proxy-run-gateway.js +101 -5
  158. package/dist/src/run-gateway/proxy-run-gateway.js.map +1 -1
  159. package/dist/src/run-gateway/run-request-responder.d.ts +18 -5
  160. package/dist/src/run-gateway/run-request-responder.d.ts.map +1 -1
  161. package/dist/src/run-gateway/run-request-responder.js +155 -32
  162. package/dist/src/run-gateway/run-request-responder.js.map +1 -1
  163. package/dist/src/run-gateway/store-run-gateway.d.ts +23 -1
  164. package/dist/src/run-gateway/store-run-gateway.d.ts.map +1 -1
  165. package/dist/src/run-gateway/store-run-gateway.js +38 -0
  166. package/dist/src/run-gateway/store-run-gateway.js.map +1 -1
  167. package/dist/src/search-attributes-schema.d.ts +44 -0
  168. package/dist/src/search-attributes-schema.d.ts.map +1 -0
  169. package/dist/src/search-attributes-schema.js +51 -0
  170. package/dist/src/search-attributes-schema.js.map +1 -0
  171. package/dist/src/singleton-admission.d.ts +75 -0
  172. package/dist/src/singleton-admission.d.ts.map +1 -0
  173. package/dist/src/singleton-admission.js +156 -0
  174. package/dist/src/singleton-admission.js.map +1 -0
  175. package/dist/src/singleton-gate.d.ts +23 -8
  176. package/dist/src/singleton-gate.d.ts.map +1 -1
  177. package/dist/src/singleton-gate.js +59 -12
  178. package/dist/src/singleton-gate.js.map +1 -1
  179. package/dist/src/standard-schema.d.ts +83 -0
  180. package/dist/src/standard-schema.d.ts.map +1 -0
  181. package/dist/src/standard-schema.js +31 -0
  182. package/dist/src/standard-schema.js.map +1 -0
  183. package/dist/src/step-discovery.d.ts +21 -11
  184. package/dist/src/step-discovery.d.ts.map +1 -1
  185. package/dist/src/step-discovery.js +86 -45
  186. package/dist/src/step-discovery.js.map +1 -1
  187. package/dist/src/step-ref.d.ts +38 -12
  188. package/dist/src/step-ref.d.ts.map +1 -1
  189. package/dist/src/step-ref.js +5 -13
  190. package/dist/src/step-ref.js.map +1 -1
  191. package/dist/src/stores/factory.d.ts +6 -0
  192. package/dist/src/stores/factory.d.ts.map +1 -1
  193. package/dist/src/stores/factory.js +4 -1
  194. package/dist/src/stores/factory.js.map +1 -1
  195. package/dist/src/stores/lucid-helpers.d.ts +2 -0
  196. package/dist/src/stores/lucid-helpers.d.ts.map +1 -1
  197. package/dist/src/stores/lucid-helpers.js +7 -0
  198. package/dist/src/stores/lucid-helpers.js.map +1 -1
  199. package/dist/src/stores/lucid-mappers.d.ts +25 -0
  200. package/dist/src/stores/lucid-mappers.d.ts.map +1 -1
  201. package/dist/src/stores/lucid-mappers.js +81 -18
  202. package/dist/src/stores/lucid-mappers.js.map +1 -1
  203. package/dist/src/stores/lucid-schema.d.ts +59 -1
  204. package/dist/src/stores/lucid-schema.d.ts.map +1 -1
  205. package/dist/src/stores/lucid-schema.js +271 -25
  206. package/dist/src/stores/lucid-schema.js.map +1 -1
  207. package/dist/src/stores/lucid.d.ts +61 -2
  208. package/dist/src/stores/lucid.d.ts.map +1 -1
  209. package/dist/src/stores/lucid.js +346 -41
  210. package/dist/src/stores/lucid.js.map +1 -1
  211. package/dist/src/telescope/dashboard.d.ts.map +1 -1
  212. package/dist/src/telescope/dashboard.js +30 -1
  213. package/dist/src/telescope/dashboard.js.map +1 -1
  214. package/dist/src/telescope/data-providers.d.ts +19 -1
  215. package/dist/src/telescope/data-providers.d.ts.map +1 -1
  216. package/dist/src/telescope/data-providers.js +119 -3
  217. package/dist/src/telescope/data-providers.js.map +1 -1
  218. package/dist/src/telescope/extension.d.ts.map +1 -1
  219. package/dist/src/telescope/extension.js +2 -1
  220. package/dist/src/telescope/extension.js.map +1 -1
  221. package/dist/src/telescope/index.d.ts +1 -1
  222. package/dist/src/telescope/index.d.ts.map +1 -1
  223. package/dist/src/telescope/index.js +1 -1
  224. package/dist/src/telescope/index.js.map +1 -1
  225. package/dist/src/testing/in-memory-state-store.d.ts +44 -15
  226. package/dist/src/testing/in-memory-state-store.d.ts.map +1 -1
  227. package/dist/src/testing/in-memory-state-store.js +204 -41
  228. package/dist/src/testing/in-memory-state-store.js.map +1 -1
  229. package/dist/src/testing-kit/checkpoint-aggregation-contract.d.ts +16 -0
  230. package/dist/src/testing-kit/checkpoint-aggregation-contract.d.ts.map +1 -0
  231. package/dist/src/testing-kit/checkpoint-aggregation-contract.js +228 -0
  232. package/dist/src/testing-kit/checkpoint-aggregation-contract.js.map +1 -0
  233. package/dist/src/testing-kit/state-store-conformance.d.ts.map +1 -1
  234. package/dist/src/testing-kit/state-store-conformance.js +355 -3
  235. package/dist/src/testing-kit/state-store-conformance.js.map +1 -1
  236. package/dist/src/transport-pool.d.ts +15 -1
  237. package/dist/src/transport-pool.d.ts.map +1 -1
  238. package/dist/src/transport-pool.js +50 -4
  239. package/dist/src/transport-pool.js.map +1 -1
  240. package/dist/src/transports/adaptive-concurrency.d.ts +168 -0
  241. package/dist/src/transports/adaptive-concurrency.d.ts.map +1 -0
  242. package/dist/src/transports/adaptive-concurrency.js +353 -0
  243. package/dist/src/transports/adaptive-concurrency.js.map +1 -0
  244. package/dist/src/transports/bullmq/adaptive-concurrency.d.ts +1 -143
  245. package/dist/src/transports/bullmq/adaptive-concurrency.d.ts.map +1 -1
  246. package/dist/src/transports/bullmq/adaptive-concurrency.js +3 -311
  247. package/dist/src/transports/bullmq/adaptive-concurrency.js.map +1 -1
  248. package/dist/src/transports/bullmq/bullmq-transport.d.ts +49 -1
  249. package/dist/src/transports/bullmq/bullmq-transport.d.ts.map +1 -1
  250. package/dist/src/transports/bullmq/bullmq-transport.js +330 -38
  251. package/dist/src/transports/bullmq/bullmq-transport.js.map +1 -1
  252. package/dist/src/transports/bullmq/deps.d.ts +18 -2
  253. package/dist/src/transports/bullmq/deps.d.ts.map +1 -1
  254. package/dist/src/transports/bullmq/deps.js +44 -2
  255. package/dist/src/transports/bullmq/deps.js.map +1 -1
  256. package/dist/src/transports/db-helpers.d.ts +39 -0
  257. package/dist/src/transports/db-helpers.d.ts.map +1 -1
  258. package/dist/src/transports/db-helpers.js +73 -0
  259. package/dist/src/transports/db-helpers.js.map +1 -1
  260. package/dist/src/transports/db-remote.d.ts +53 -0
  261. package/dist/src/transports/db-remote.d.ts.map +1 -0
  262. package/dist/src/transports/db-remote.js +147 -0
  263. package/dist/src/transports/db-remote.js.map +1 -0
  264. package/dist/src/transports/db-schema.d.ts +44 -1
  265. package/dist/src/transports/db-schema.d.ts.map +1 -1
  266. package/dist/src/transports/db-schema.js +227 -88
  267. package/dist/src/transports/db-schema.js.map +1 -1
  268. package/dist/src/transports/db.d.ts +189 -6
  269. package/dist/src/transports/db.d.ts.map +1 -1
  270. package/dist/src/transports/db.js +1291 -137
  271. package/dist/src/transports/db.js.map +1 -1
  272. package/dist/src/transports/event-emitter.d.ts +8 -0
  273. package/dist/src/transports/event-emitter.d.ts.map +1 -1
  274. package/dist/src/transports/event-emitter.js +36 -3
  275. package/dist/src/transports/event-emitter.js.map +1 -1
  276. package/dist/src/transports/factory.d.ts +110 -5
  277. package/dist/src/transports/factory.d.ts.map +1 -1
  278. package/dist/src/transports/factory.js +56 -9
  279. package/dist/src/transports/factory.js.map +1 -1
  280. package/dist/src/transports/queue-mock-adapter.d.ts +7 -2
  281. package/dist/src/transports/queue-mock-adapter.d.ts.map +1 -1
  282. package/dist/src/transports/queue-mock-adapter.js +18 -2
  283. package/dist/src/transports/queue-mock-adapter.js.map +1 -1
  284. package/dist/src/transports/queue-remote.d.ts +146 -0
  285. package/dist/src/transports/queue-remote.d.ts.map +1 -0
  286. package/dist/src/transports/queue-remote.js +398 -0
  287. package/dist/src/transports/queue-remote.js.map +1 -0
  288. package/dist/src/transports/queue.d.ts +159 -6
  289. package/dist/src/transports/queue.d.ts.map +1 -1
  290. package/dist/src/transports/queue.js +747 -37
  291. package/dist/src/transports/queue.js.map +1 -1
  292. package/dist/src/transports/task-failure.d.ts +31 -0
  293. package/dist/src/transports/task-failure.d.ts.map +1 -0
  294. package/dist/src/transports/task-failure.js +50 -0
  295. package/dist/src/transports/task-failure.js.map +1 -0
  296. package/dist/src/workflow-als.d.ts +1 -1
  297. package/dist/src/workflow-als.d.ts.map +1 -1
  298. package/dist/src/workflow-ctx.d.ts +10 -0
  299. package/dist/src/workflow-ctx.d.ts.map +1 -1
  300. package/dist/src/workflow-ctx.js +97 -15
  301. package/dist/src/workflow-ctx.js.map +1 -1
  302. package/dist/src/workflow-discovery.d.ts +32 -41
  303. package/dist/src/workflow-discovery.d.ts.map +1 -1
  304. package/dist/src/workflow-discovery.js +65 -88
  305. package/dist/src/workflow-discovery.js.map +1 -1
  306. package/dist/src/workflow-ref.d.ts +24 -0
  307. package/dist/src/workflow-ref.d.ts.map +1 -1
  308. package/dist/src/workflow-ref.js.map +1 -1
  309. package/dist/stubs/config/durable.stub +6 -0
  310. package/dist/stubs/config/durable_dashboard.stub +7 -3
  311. package/dist/stubs/database/migrations/create_durable_tables.stub +2 -1
  312. package/dist/stubs/database/migrations/create_durable_transport_messages.stub +43 -0
  313. package/dist/stubs/database/migrations/create_durable_transport_tables.stub +12 -9
  314. package/dist/stubs/database/migrations/create_durable_transport_worker_keys.stub +1 -1
  315. package/dist/stubs/make/workflow/main.stub +1 -1
  316. package/package.json +6 -4
  317. package/skills/durable-cluster/SKILL.md +80 -11
  318. package/skills/durable-determinism/SKILL.md +11 -5
  319. package/skills/durable-reliability/SKILL.md +77 -37
  320. package/skills/durable-setup/SKILL.md +51 -22
  321. package/skills/durable-transports-stores/SKILL.md +130 -19
  322. package/skills/durable-workflows/SKILL.md +71 -18
  323. package/dist/assets/spa/assets/index-DdB9zxuX.js +0 -16
  324. package/dist/assets/spa/assets/index-DdB9zxuX.js.map +0 -1
@@ -39,7 +39,16 @@ export interface RedisLike {
39
39
  get(key: string): Promise<string | null>;
40
40
  /** Batched read — optional: a client without it falls back to per-key `get`. */
41
41
  mget?(...keys: string[]): Promise<(string | null)[]>;
42
- disconnect(): void;
42
+ /**
43
+ * Liveness probe the subscriber watchdog sends (legal in subscriber mode). Optional: a client
44
+ * without it is simply never probed.
45
+ */
46
+ ping?(): Promise<unknown>;
47
+ /** ioredis connection state (`'ready'`, `'connecting'`, `'reconnecting'`, ...). The watchdog only
48
+ * probes a `'ready'` connection; absent reads as ready. */
49
+ readonly status?: string | undefined;
50
+ /** `disconnect(true)` drops the socket and lets ioredis reconnect (and `autoResubscribe`). */
51
+ disconnect(reconnect?: boolean): void;
43
52
  }
44
53
  /**
45
54
  * The broker factory the transport is constructed with. Each `make*` mints a fresh broker object
@@ -75,5 +84,12 @@ export declare function workerConcurrency(value: number | undefined, fallback?:
75
84
  * an ioredis client with NO host/port, landing on ioredis's own default (`127.0.0.1:6379`) instead of
76
85
  * the caller's Redis.
77
86
  */
78
- export declare function createBullMQDeps(connection: unknown, concurrency?: number): Promise<BullMQDeps>;
87
+ /**
88
+ * A `redis://` / `rediss://` URL as ioredis `ConnectionOptions`. BullMQ's `Queue`/`Worker` and this
89
+ * module's own `{ keepAlive, ...connection }` spread only understand an options object or a `Redis`
90
+ * instance: a bare string was spread character by character and silently fell back to ioredis's
91
+ * default 127.0.0.1:6379. `rediss:` turns on TLS; the path's first segment selects the db.
92
+ */
93
+ export declare function redisUrlToOptions(url: string): Record<string, unknown>;
94
+ export declare function createBullMQDeps(rawConnection: unknown, concurrency?: number): Promise<BullMQDeps>;
79
95
  //# sourceMappingURL=deps.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deps.d.ts","sourceRoot":"","sources":["../../../../src/transports/bullmq/deps.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,gGAAgG;AAChG,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC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AE,QAAQ,SAAI,GAAG,MAAM,CAEjF;AAED;;;;;;;;;;;;;GAaG;AACH;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAqCtE;AAED,wBAAsB,gBAAgB,CACpC,aAAa,EAAE,OAAO,EACtB,WAAW,SAAI,GACd,OAAO,CAAC,UAAU,CAAC,CAuDrB"}
@@ -26,7 +26,50 @@ export function workerConcurrency(value, fallback = 1) {
26
26
  * an ioredis client with NO host/port, landing on ioredis's own default (`127.0.0.1:6379`) instead of
27
27
  * the caller's Redis.
28
28
  */
29
- export async function createBullMQDeps(connection, concurrency = 1) {
29
+ /**
30
+ * A `redis://` / `rediss://` URL as ioredis `ConnectionOptions`. BullMQ's `Queue`/`Worker` and this
31
+ * module's own `{ keepAlive, ...connection }` spread only understand an options object or a `Redis`
32
+ * instance: a bare string was spread character by character and silently fell back to ioredis's
33
+ * default 127.0.0.1:6379. `rediss:` turns on TLS; the path's first segment selects the db.
34
+ */
35
+ export function redisUrlToOptions(url) {
36
+ let parsed;
37
+ try {
38
+ parsed = new URL(url);
39
+ }
40
+ catch {
41
+ throw new Error(`@agora/durable: transports.bullmq() got an invalid Redis URL: ${url}`);
42
+ }
43
+ if (parsed.protocol !== 'redis:' && parsed.protocol !== 'rediss:') {
44
+ throw new Error(`@agora/durable: transports.bullmq() expects a redis:// or rediss:// URL, got ${parsed.protocol}`);
45
+ }
46
+ const options = {
47
+ host: parsed.hostname || '127.0.0.1',
48
+ port: parsed.port ? Number(parsed.port) : 6379,
49
+ };
50
+ if (parsed.username)
51
+ options.username = decodeURIComponent(parsed.username);
52
+ if (parsed.password)
53
+ options.password = decodeURIComponent(parsed.password);
54
+ const db = parsed.pathname.replace(/^\//, '').split('/')[0];
55
+ if (db) {
56
+ const n = Number(db);
57
+ if (!Number.isInteger(n) || n < 0) {
58
+ throw new Error(`@agora/durable: transports.bullmq() got an invalid Redis db "${db}" in ${url}`);
59
+ }
60
+ options.db = n;
61
+ }
62
+ // Query parameters (ioredis-style knobs, TLS CA paths…) are not mapped: refuse them rather than drop
63
+ // them silently — pass `ConnectionOptions` for anything beyond host, port, credentials, db and TLS.
64
+ if (parsed.search) {
65
+ throw new Error(`@agora/durable: transports.bullmq() does not read query parameters from a Redis URL (${parsed.search}); pass ConnectionOptions instead.`);
66
+ }
67
+ if (parsed.protocol === 'rediss:')
68
+ options.tls = {};
69
+ return options;
70
+ }
71
+ export async function createBullMQDeps(rawConnection, concurrency = 1) {
72
+ const connection = typeof rawConnection === 'string' ? redisUrlToOptions(rawConnection) : rawConnection;
30
73
  const defaultConcurrency = workerConcurrency(concurrency);
31
74
  // Non-literal specifiers: keep `tsc` from resolving 'bullmq'/'ioredis' at build time (they are a
32
75
  // runtime-only dependency of the selected transport), so the wider package builds without them.
@@ -42,7 +85,6 @@ export async function createBullMQDeps(connection, concurrency = 1) {
42
85
  // instead, the same way `resolveQueueAdapter` does for a missing `transports.queue()` connection: an
43
86
  // existing `Redis` instance, a connection string, or a non-empty options object is required.
44
87
  const hasUsableConnection = isRedisInstance(connection) ||
45
- typeof connection === 'string' ||
46
88
  (typeof connection === 'object' && connection !== null && Object.keys(connection).length > 0);
47
89
  if (!hasUsableConnection) {
48
90
  const got = connection === undefined ? 'undefined' : JSON.stringify(connection);
@@ -1 +1 @@
1
- {"version":3,"file":"deps.js","sourceRoot":"","sources":["../../../../src/transports/bullmq/deps.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAuDH;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAyB,EAAE,QAAQ,GAAG,CAAC;IACvE,OAAO,KAAK,KAAK,SAAS,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;AACpG,CAAC;AAED;;;;;;;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AK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QAChF,MAAM,IAAI,KAAK,CACb,2KAA2K,GAAG,mHAAmH,CAClS,CAAC;IACJ,CAAC;IAED,2FAA2F;IAC3F,MAAM,gBAAgB,GAAG,GAAY,EAAE,CACrC,UAAU,IAAI,OAAO,UAAU,KAAK,QAAQ,IAAI,CAAC,CAAC,SAAS,IAAI,UAAU,CAAC;QACxE,CAAC,CAAC,EAAE,GAAI,UAAqB,EAAE,oBAAoB,EAAE,IAAI,EAAE;QAC3D,CAAC,CAAC,UAAU,CAAC;IAEjB,MAAM,SAAS,GAAG,GAAc,EAAE;QAChC,IAAI,eAAe,CAAC,UAAU,CAAC;YAAE,OAAO,UAAU,CAAC,SAAS,EAAE,CAAC;QAC/D,OAAO,IAAI,KAAK,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,GAAI,UAAqB,EAAE,CAAC,CAAC;IACrE,CAAC,CAAC;IAEF,OAAO;QACL,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,CAAC,IAAI,EAAE,EAAE,UAAU,EAAE,CAAC;QACpD,UAAU,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAClC,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YACtC,UAAU,EAAE,gBAAgB,EAAE;YAC9B,WAAW,EAAE,iBAAiB,CAAC,IAAI,EAAE,WAAW,EAAE,kBAAkB,CAAC;SACtE,CAAC;QACJ,SAAS;KACV,CAAC;AACJ,CAAC"}
@@ -7,4 +7,43 @@ import { Database } from '@adonisjs/lucid/database';
7
7
  export declare function makeMemoryDb(): Database;
8
8
  /** A fresh in-memory db with the transport tables already created. */
9
9
  export declare function makeTransportDb(): Promise<Database>;
10
+ /**
11
+ * Prefix of the throwaway schemas {@link makeIsolatedPostgresDb} creates. The test suite's global
12
+ * teardown drops every schema carrying it, so a run that crashed mid-file leaves nothing behind.
13
+ */
14
+ export declare const POSTGRES_TEST_SCHEMA_PREFIX = "durable_t_";
15
+ /**
16
+ * The prefix of THIS test run's throwaway schemas: {@link POSTGRES_TEST_SCHEMA_PREFIX} plus the run id
17
+ * the suite's global setup puts in `DURABLE_PG_TEST_RUN` (inherited by every test worker). The global
18
+ * teardown drops only this run's schemas, so two runs sharing one server (a developer's parallel runs,
19
+ * two packages, a retried job on a shared runner) never drop each other's tables mid-test.
20
+ */
21
+ export declare function postgresTestSchemaPrefix(): string;
22
+ /**
23
+ * Connections per Postgres test pool. Small on purpose: test files run in parallel (and the
24
+ * multi-process scenarios fork workers, each with its own pool), and a slow machine makes every pool
25
+ * grow to its max, so a pool of 10 per database exhausted the server's `max_connections` in CI.
26
+ */
27
+ export declare const POSTGRES_TEST_POOL_MAX = 3;
28
+ /**
29
+ * A standalone Lucid `Database` over Postgres (`pg`), every query scoped to `schema` through the
30
+ * connection's `search_path` — the Postgres twin of {@link makeMemoryDb}. The schema must exist (see
31
+ * {@link makeIsolatedPostgresDb}); this only connects. Used by tests and by the child processes the
32
+ * multi-process transport tests spawn against a schema their parent created.
33
+ */
34
+ export declare function makePostgresDb(url: string, schema: string, poolMax?: number): Database;
35
+ /**
36
+ * A fresh, EMPTY Postgres database for one test: a new schema (unique per call, so test files running
37
+ * in parallel never see each other's tables) and a `Database` scoped to it. `db.manager.closeAll()`
38
+ * drops the schema before closing — the same "gone when closed" lifetime a `:memory:` SQLite db has.
39
+ * `keepSchema` leaves it (the caller drops it), and `schema` reports its name, for tests that hand it
40
+ * to child processes.
41
+ */
42
+ export declare function makeIsolatedPostgresDb(url: string, opts?: {
43
+ keepSchema?: boolean;
44
+ }): Promise<Database & {
45
+ schemaName: string;
46
+ }>;
47
+ /** A fresh isolated Postgres schema with the transport tables already created. */
48
+ export declare function makePostgresTransportDb(url: string): Promise<Database>;
10
49
  //# sourceMappingURL=db-helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"db-helpers.d.ts","sourceRoot":"","sources":["../../../src/transports/db-helpers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGpD;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,QAAQ,CAoBvC;AAED,sEAAsE;AACtE,wBAAsB,eAAe,IAAI,OAAO,CAAC,QAAQ,CAAC,CAIzD"}
1
+ {"version":3,"file":"db-helpers.d.ts","sourceRoot":"","sources":["../../../src/transports/db-helpers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGpD;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,QAAQ,CAoBvC;AAED,sEAAsE;AACtE,wBAAsB,eAAe,IAAI,OAAO,CAAC,QAAQ,CAAC,CAIzD;AAED;;;GAGG;AACH,eAAO,MAAM,2BAA2B,eAAe,CAAC;AAExD;;;;;GAKG;AACH,wBAAgB,wBAAwB,IAAI,MAAM,CAGjD;AAED;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,MAA+B,GACvC,QAAQ,CAkBV;AAED;;;;;;GAMG;AACH,wBAAsB,sBAAsB,CAC1C,GAAG,EAAE,MAAM,EACX,IAAI,GAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAO,GAClC,OAAO,CAAC,QAAQ,GAAG;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,CAiB5C;AAED,kFAAkF;AAClF,wBAAsB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAI5E"}
@@ -30,4 +30,77 @@ export async function makeTransportDb() {
30
30
  await createDurableTransportTables(db);
31
31
  return db;
32
32
  }
33
+ /**
34
+ * Prefix of the throwaway schemas {@link makeIsolatedPostgresDb} creates. The test suite's global
35
+ * teardown drops every schema carrying it, so a run that crashed mid-file leaves nothing behind.
36
+ */
37
+ export const POSTGRES_TEST_SCHEMA_PREFIX = 'durable_t_';
38
+ /**
39
+ * The prefix of THIS test run's throwaway schemas: {@link POSTGRES_TEST_SCHEMA_PREFIX} plus the run id
40
+ * the suite's global setup puts in `DURABLE_PG_TEST_RUN` (inherited by every test worker). The global
41
+ * teardown drops only this run's schemas, so two runs sharing one server (a developer's parallel runs,
42
+ * two packages, a retried job on a shared runner) never drop each other's tables mid-test.
43
+ */
44
+ export function postgresTestSchemaPrefix() {
45
+ const run = process.env.DURABLE_PG_TEST_RUN;
46
+ return run ? `${POSTGRES_TEST_SCHEMA_PREFIX}${run}_` : POSTGRES_TEST_SCHEMA_PREFIX;
47
+ }
48
+ /**
49
+ * Connections per Postgres test pool. Small on purpose: test files run in parallel (and the
50
+ * multi-process scenarios fork workers, each with its own pool), and a slow machine makes every pool
51
+ * grow to its max, so a pool of 10 per database exhausted the server's `max_connections` in CI.
52
+ */
53
+ export const POSTGRES_TEST_POOL_MAX = 3;
54
+ /**
55
+ * A standalone Lucid `Database` over Postgres (`pg`), every query scoped to `schema` through the
56
+ * connection's `search_path` — the Postgres twin of {@link makeMemoryDb}. The schema must exist (see
57
+ * {@link makeIsolatedPostgresDb}); this only connects. Used by tests and by the child processes the
58
+ * multi-process transport tests spawn against a schema their parent created.
59
+ */
60
+ export function makePostgresDb(url, schema, poolMax = POSTGRES_TEST_POOL_MAX) {
61
+ const logger = new Logger({ enabled: false });
62
+ const emitter = new Emitter(undefined);
63
+ return new Database({
64
+ connection: 'pg',
65
+ connections: {
66
+ pg: {
67
+ client: 'pg',
68
+ connection: { connectionString: url },
69
+ searchPath: [schema],
70
+ pool: { min: 0, max: poolMax },
71
+ },
72
+ },
73
+ }, logger, emitter);
74
+ }
75
+ /**
76
+ * A fresh, EMPTY Postgres database for one test: a new schema (unique per call, so test files running
77
+ * in parallel never see each other's tables) and a `Database` scoped to it. `db.manager.closeAll()`
78
+ * drops the schema before closing — the same "gone when closed" lifetime a `:memory:` SQLite db has.
79
+ * `keepSchema` leaves it (the caller drops it), and `schema` reports its name, for tests that hand it
80
+ * to child processes.
81
+ */
82
+ export async function makeIsolatedPostgresDb(url, opts = {}) {
83
+ const schema = `${postgresTestSchemaPrefix()}${process.pid}_${Math.random().toString(36).slice(2, 10)}`;
84
+ const db = makePostgresDb(url, schema);
85
+ db.schemaName = schema;
86
+ await db.rawQuery(`create schema "${schema}"`);
87
+ if (!opts.keepSchema) {
88
+ const closeAll = db.manager.closeAll.bind(db.manager);
89
+ let dropped = false;
90
+ db.manager.closeAll = async (...args) => {
91
+ if (!dropped) {
92
+ dropped = true;
93
+ await db.rawQuery(`drop schema if exists "${schema}" cascade`).catch(() => { });
94
+ }
95
+ return closeAll(...args);
96
+ };
97
+ }
98
+ return db;
99
+ }
100
+ /** A fresh isolated Postgres schema with the transport tables already created. */
101
+ export async function makePostgresTransportDb(url) {
102
+ const db = await makeIsolatedPostgresDb(url);
103
+ await createDurableTransportTables(db);
104
+ return db;
105
+ }
33
106
  //# sourceMappingURL=db-helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"db-helpers.js","sourceRoot":"","sources":["../../../src/transports/db-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;AAE9D;;;;GAIG;AACH,MAAM,UAAU,YAAY;IAC1B,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;IAC9C,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,SAAkB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EAAE,CAAC;AACZ,CAAC"}
@@ -0,0 +1,53 @@
1
+ import { type WorkerKeyStore } from './worker-keys.js';
2
+ /**
3
+ * The live-subscriber registry of the db transport's store-less protocol. Run replies, tenant events
4
+ * and remote-workflow decisions are rows of the messages table addressed to ONE instance (its
5
+ * `recipient`); this tracks who is there to address them to, in the worker-key table every db instance
6
+ * already reads and writes:
7
+ *
8
+ * - `${P}-inbox:<instance>` — "this instance is alive and consuming its addressed rows". Written by
9
+ * every instance that consumes an inbox (a requester waiting for replies, a tenant-event subscriber,
10
+ * an engine waiting for decisions).
11
+ * - `${P}-tenant-subscriber:<tenant>:<instance>` — "this instance wants `tenant`'s events". A publisher
12
+ * writes one row per live subscriber of the event's tenant.
13
+ *
14
+ * Both live for {@link DbInboxRegistryOptions.ttlMs} and are re-written every third of it. Unlike the
15
+ * queue transport, a subscriber writes its keys itself — a pod on the db transport reaches the same
16
+ * database as the control plane by definition, so there is no announcement to relay. Key names are the
17
+ * queue transport's (`queue-remote.ts`): URI-encoded tenant and instance segments, so a tenant name
18
+ * containing `:` can never match another tenant's keys.
19
+ */
20
+ /** Default TTL (ms) of the subscriber and inbox keys; re-written every third of it. */
21
+ export declare const DEFAULT_DB_INBOX_TTL_MS = 30000;
22
+ /** Default reuse window (ms) of a publisher's read of the live tenant subscribers. */
23
+ export declare const DEFAULT_DB_TENANT_SUBSCRIBERS_CACHE_MS = 1000;
24
+ /** Default cadence (ms) of the janitor that deletes rows addressed to instances that are gone. */
25
+ export declare const DEFAULT_DB_INBOX_SWEEP_INTERVAL_MS = 30000;
26
+ export interface DbInboxRegistryOptions {
27
+ store: () => WorkerKeyStore;
28
+ /** The effective key prefix, read on every use (the namespace can be adopted after construction). */
29
+ prefix: () => string;
30
+ instanceId: string;
31
+ ttlMs: number;
32
+ subscribersCacheMs: number;
33
+ onError: (err: unknown) => void;
34
+ now?: () => number;
35
+ }
36
+ export declare class DbInboxRegistry {
37
+ #private;
38
+ constructor(options: DbInboxRegistryOptions);
39
+ /** Mark this instance as consuming its addressed rows: its inbox key is written now and kept fresh.
40
+ * Resolves once the first write landed (or failed). */
41
+ activateInbox(): Promise<void>;
42
+ /** Subscribe to `tenant`'s events (idempotent). Resolves once the keys are written. */
43
+ subscribe(tenant: string): Promise<void>;
44
+ /** End the subscription to `tenant` (its last handler went away): its key is removed. */
45
+ unsubscribe(tenant: string): void;
46
+ /** The instance ids with a live subscription to `tenant` (deduplicated; malformed values skipped). */
47
+ subscribersOf(tenant: string): Promise<string[]>;
48
+ /** The instance ids with a live inbox key — read fresh, never cached (the janitor decides on it). */
49
+ liveInboxOwners(): Promise<Set<string>>;
50
+ /** Stop refreshing and remove every key this instance wrote (a clean shutdown). */
51
+ close(): Promise<void>;
52
+ }
53
+ //# sourceMappingURL=db-remote.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db-remote.d.ts","sourceRoot":"","sources":["../../../src/transports/db-remote.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvE;;;;;;;;;;;;;;;;;GAiBG;AAEH,uFAAuF;AACvF,eAAO,MAAM,uBAAuB,QAAS,CAAC;AAC9C,sFAAsF;AACtF,eAAO,MAAM,sCAAsC,OAAQ,CAAC;AAC5D,kGAAkG;AAClG,eAAO,MAAM,kCAAkC,QAAS,CAAC;AAEzD,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,cAAc,CAAC;IAC5B,qGAAqG;IACrG,MAAM,EAAE,MAAM,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,kBAAkB,EAAE,MAAM,CAAC;IAC3B,OAAO,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;IAChC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAWD,qBAAa,eAAe;;IAU1B,YAAY,OAAO,EAAE,sBAAsB,EAG1C;IAmCD;4DACwD;IACxD,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAK7B;IAED,uFAAuF;IACvF,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAMvC;IAED,yFAAyF;IACzF,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAMhC;IAED,sGAAsG;IAChG,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAcrD;IAED,qGAAqG;IAC/F,eAAe,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAS5C;IAED,mFAAmF;IAC7E,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAW3B;CACF"}
@@ -0,0 +1,147 @@
1
+ import { inboxKey, tenantSubscriberKey, tenantSubscriberKeyPrefix } from './queue-remote.js';
2
+ import { cachedLiveKeys } from './worker-keys.js';
3
+ /**
4
+ * The live-subscriber registry of the db transport's store-less protocol. Run replies, tenant events
5
+ * and remote-workflow decisions are rows of the messages table addressed to ONE instance (its
6
+ * `recipient`); this tracks who is there to address them to, in the worker-key table every db instance
7
+ * already reads and writes:
8
+ *
9
+ * - `${P}-inbox:<instance>` — "this instance is alive and consuming its addressed rows". Written by
10
+ * every instance that consumes an inbox (a requester waiting for replies, a tenant-event subscriber,
11
+ * an engine waiting for decisions).
12
+ * - `${P}-tenant-subscriber:<tenant>:<instance>` — "this instance wants `tenant`'s events". A publisher
13
+ * writes one row per live subscriber of the event's tenant.
14
+ *
15
+ * Both live for {@link DbInboxRegistryOptions.ttlMs} and are re-written every third of it. Unlike the
16
+ * queue transport, a subscriber writes its keys itself — a pod on the db transport reaches the same
17
+ * database as the control plane by definition, so there is no announcement to relay. Key names are the
18
+ * queue transport's (`queue-remote.ts`): URI-encoded tenant and instance segments, so a tenant name
19
+ * containing `:` can never match another tenant's keys.
20
+ */
21
+ /** Default TTL (ms) of the subscriber and inbox keys; re-written every third of it. */
22
+ export const DEFAULT_DB_INBOX_TTL_MS = 30_000;
23
+ /** Default reuse window (ms) of a publisher's read of the live tenant subscribers. */
24
+ export const DEFAULT_DB_TENANT_SUBSCRIBERS_CACHE_MS = 1_000;
25
+ /** Default cadence (ms) of the janitor that deletes rows addressed to instances that are gone. */
26
+ export const DEFAULT_DB_INBOX_SWEEP_INTERVAL_MS = 30_000;
27
+ const ownerOf = (value) => {
28
+ try {
29
+ const parsed = JSON.parse(value);
30
+ return typeof parsed.instanceId === 'string' ? parsed.instanceId : undefined;
31
+ }
32
+ catch {
33
+ return undefined;
34
+ }
35
+ };
36
+ export class DbInboxRegistry {
37
+ #options;
38
+ #now;
39
+ #tenants = new Set();
40
+ #inboxActive = false;
41
+ #refreshTimer;
42
+ /** Key writes in flight — `close()` lets them land before removing the keys. */
43
+ #writes = new Set();
44
+ #subscribers;
45
+ constructor(options) {
46
+ this.#options = options;
47
+ this.#now = options.now ?? Date.now;
48
+ }
49
+ get #value() {
50
+ return JSON.stringify({ instanceId: this.#options.instanceId });
51
+ }
52
+ /** Write `keys`, live for a TTL from now. Best-effort: a failure is reported, never thrown. */
53
+ #put(keys) {
54
+ const expiresAt = this.#now() + this.#options.ttlMs;
55
+ const write = (async () => {
56
+ for (const key of keys)
57
+ await this.#options.store().put(key, this.#value, expiresAt);
58
+ })().catch((err) => this.#options.onError(err));
59
+ this.#writes.add(write);
60
+ void write.finally(() => this.#writes.delete(write));
61
+ return write;
62
+ }
63
+ #keys() {
64
+ const prefix = this.#options.prefix();
65
+ const id = this.#options.instanceId;
66
+ return [
67
+ ...(this.#inboxActive ? [inboxKey(prefix, id)] : []),
68
+ ...[...this.#tenants].map((t) => tenantSubscriberKey(prefix, t, id)),
69
+ ];
70
+ }
71
+ #ensureRefresh() {
72
+ if (this.#refreshTimer)
73
+ return;
74
+ this.#refreshTimer = setInterval(() => void this.#put(this.#keys()), Math.max(Math.floor(this.#options.ttlMs / 3), 1));
75
+ this.#refreshTimer.unref?.();
76
+ }
77
+ /** Mark this instance as consuming its addressed rows: its inbox key is written now and kept fresh.
78
+ * Resolves once the first write landed (or failed). */
79
+ activateInbox() {
80
+ if (this.#inboxActive)
81
+ return Promise.resolve();
82
+ this.#inboxActive = true;
83
+ this.#ensureRefresh();
84
+ return this.#put([inboxKey(this.#options.prefix(), this.#options.instanceId)]);
85
+ }
86
+ /** Subscribe to `tenant`'s events (idempotent). Resolves once the keys are written. */
87
+ subscribe(tenant) {
88
+ if (this.#tenants.has(tenant))
89
+ return Promise.resolve();
90
+ this.#tenants.add(tenant);
91
+ this.#inboxActive = true;
92
+ this.#ensureRefresh();
93
+ return this.#put(this.#keys());
94
+ }
95
+ /** End the subscription to `tenant` (its last handler went away): its key is removed. */
96
+ unsubscribe(tenant) {
97
+ if (!this.#tenants.delete(tenant))
98
+ return;
99
+ const key = tenantSubscriberKey(this.#options.prefix(), tenant, this.#options.instanceId);
100
+ void Promise.allSettled([...this.#writes])
101
+ .then(() => this.#options.store().remove([key]))
102
+ .catch((err) => this.#options.onError(err));
103
+ }
104
+ /** The instance ids with a live subscription to `tenant` (deduplicated; malformed values skipped). */
105
+ async subscribersOf(tenant) {
106
+ this.#subscribers ??= cachedLiveKeys(this.#options.store(), this.#options.subscribersCacheMs, this.#now);
107
+ const marker = tenantSubscriberKeyPrefix(this.#options.prefix(), tenant);
108
+ const owners = new Set();
109
+ for (const { key, value } of await this.#subscribers()) {
110
+ if (!key.startsWith(marker))
111
+ continue;
112
+ const owner = ownerOf(value);
113
+ if (owner !== undefined)
114
+ owners.add(owner);
115
+ }
116
+ return [...owners];
117
+ }
118
+ /** The instance ids with a live inbox key — read fresh, never cached (the janitor decides on it). */
119
+ async liveInboxOwners() {
120
+ const marker = inboxKey(this.#options.prefix(), '');
121
+ const alive = new Set();
122
+ for (const { key, value } of await this.#options.store().live(this.#now())) {
123
+ if (!key.startsWith(marker))
124
+ continue;
125
+ const owner = ownerOf(value);
126
+ if (owner !== undefined)
127
+ alive.add(owner);
128
+ }
129
+ return alive;
130
+ }
131
+ /** Stop refreshing and remove every key this instance wrote (a clean shutdown). */
132
+ async close() {
133
+ if (this.#refreshTimer)
134
+ clearInterval(this.#refreshTimer);
135
+ this.#refreshTimer = undefined;
136
+ const keys = this.#keys();
137
+ this.#tenants.clear();
138
+ this.#inboxActive = false;
139
+ if (keys.length === 0)
140
+ return;
141
+ await Promise.allSettled([...this.#writes]);
142
+ await Promise.resolve()
143
+ .then(() => this.#options.store().remove(keys))
144
+ .catch((err) => this.#options.onError(err));
145
+ }
146
+ }
147
+ //# sourceMappingURL=db-remote.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db-remote.js","sourceRoot":"","sources":["../../../src/transports/db-remote.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC7F,OAAO,EAAE,cAAc,EAAuB,MAAM,kBAAkB,CAAC;AAEvE;;;;;;;;;;;;;;;;;GAiBG;AAEH,uFAAuF;AACvF,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC;AAC9C,sFAAsF;AACtF,MAAM,CAAC,MAAM,sCAAsC,GAAG,KAAK,CAAC;AAC5D,kGAAkG;AAClG,MAAM,CAAC,MAAM,kCAAkC,GAAG,MAAM,CAAC;AAazD,MAAM,OAAO,GAAG,CAAC,KAAa,EAAsB,EAAE;IACpD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAA6B,CAAC;QAC7D,OAAO,OAAO,MAAM,CAAC,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC;IAC/E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,OAAO,eAAe;IACjB,QAAQ,CAAyB;IACjC,IAAI,CAAe;IACnB,QAAQ,GAAG,IAAI,GAAG,EAAU,CAA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AAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QAC5C,MAAM,OAAO,CAAC,OAAO,EAAE;aACpB,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;aAC9C,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;IAChD,CAAC;CACF"}
@@ -1,4 +1,5 @@
1
1
  import type { Database } from '@adonisjs/lucid/database';
2
+ type CreateTableBuilder = Parameters<Parameters<ReturnType<Database['connection']>['schema']['createTable']>[1]>[0];
2
3
  /**
3
4
  * The DB transport's table names. Distinct from the durable *store* tables (`durable_workflow_runs`
4
5
  * etc.) — these carry the point-to-point work channels (tasks / results / heartbeats / control), so
@@ -9,7 +10,23 @@ export declare const TRANSPORT_TABLES: {
9
10
  readonly results: 'durable_transport_results';
10
11
  readonly heartbeats: 'durable_transport_heartbeats';
11
12
  readonly control: 'durable_transport_control';
13
+ /** Remote-workflow decisions and step events, and the store-less (tenant pod) protocol's start-run,
14
+ * run-request, run-reply and tenant-event rows — one table told apart by `kind`. */
15
+ readonly messages: 'durable_transport_messages';
12
16
  };
17
+ /**
18
+ * The `kind`s of a {@link TRANSPORT_TABLES.messages} row. `recipient` is `''` for a row any consumer
19
+ * of the kind may claim, or the instance id of the one consumer it is addressed to.
20
+ */
21
+ export declare const MESSAGE_KINDS: {
22
+ readonly decision: 'decision';
23
+ readonly stepEvent: 'stepEvent';
24
+ readonly startRun: 'startRun';
25
+ readonly runRequest: 'runRequest';
26
+ readonly runReply: 'runReply';
27
+ readonly tenantEvent: 'tenantEvent';
28
+ };
29
+ export type MessageKind = (typeof MESSAGE_KINDS)[keyof typeof MESSAGE_KINDS];
13
30
  /**
14
31
  * The worker advertisement keys (design §7.2) — the descriptor and heartbeat keys a worker runtime
15
32
  * writes, each with an expiry. Kept out of {@link TRANSPORT_TABLES}: it is a key/value board, not a
@@ -23,7 +40,18 @@ export declare const WORKER_KEYS_TABLE = "durable_transport_worker_keys";
23
40
  */
24
41
  export declare function createWorkerKeysTable(db: Database): Promise<void>;
25
42
  /**
26
- * Idempotent DDL for the four transport tables, via Lucid's schema builder (Knex). Portable across
43
+ * The columns that hold free-form JSON payloads (a step's input/output/error/events, the control and
44
+ * message payloads, a worker key's value). They are `longtext` on MySQL, where `text` stops at 64KB
45
+ * and a bigger step input or output fails to write (strict mode) or is cut off; an existing `text`
46
+ * one is widened in place on boot. Postgres and SQLite `text` has no limit and is unchanged.
47
+ * `notNull` lists the `NOT NULL` ones, which a MySQL `MODIFY` must restate.
48
+ */
49
+ export declare const TRANSPORT_JSON_COLUMNS: Record<string, {
50
+ columns: string[];
51
+ notNull?: string[];
52
+ }>;
53
+ /**
54
+ * Idempotent DDL for the transport tables, via Lucid's schema builder (Knex). Portable across
27
55
  * SQLite / Postgres / MySQL: JSON payloads (`input`/`output`/`error`/`payload`) are stored as TEXT
28
56
  * and (de)serialized by the transport, and every timestamp is an epoch-ms `bigInteger`, so there's
29
57
  * no dependency on a dialect's native JSON/date type.
@@ -35,6 +63,21 @@ export declare function createWorkerKeysTable(db: Database): Promise<void>;
35
63
  * (`node ace configure @adonis-agora/durable`); this helper is for standalone use and tests.
36
64
  */
37
65
  export declare function createDurableTransportTables(db: Database): Promise<void>;
66
+ /**
67
+ * Idempotent DDL for the messages table: one-shot rows like the other channels (claimed by one
68
+ * consumer, deleted once handled), told apart by `kind` and addressed by `recipient` — `''` for any
69
+ * consumer of the kind, else the instance id of the one it is for (a run reply, a tenant event, a
70
+ * decision for the engine that dispatched the turn). `reply_to` carries a request's requester.
71
+ */
72
+ export declare function createMessagesTable(db: Database): Promise<void>;
73
+ type TableBuild = (table: CreateTableBuilder) => void;
74
+ /**
75
+ * The CREATE TABLE body of every transport table (Knex schema builder), shared by
76
+ * {@link createDurableTransportTables} and the dialect tests. Payload columns are `longtext`, which
77
+ * Knex emits on MySQL only (Postgres and SQLite get `text`). See {@link TRANSPORT_JSON_COLUMNS}.
78
+ */
79
+ export declare const TRANSPORT_TABLE_DEFS: Record<string, TableBuild>;
38
80
  /** Drop every transport table. Used by tests and the migration `down`. */
39
81
  export declare function dropDurableTransportTables(db: Database): Promise<void>;
82
+ export {};
40
83
  //# sourceMappingURL=db-schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"db-schema.d.ts","sourceRoot":"","sources":["../../../src/transports/db-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD;;;;GAIG;AACH,eAAO,MAAM,gBAAgB;aAC3B,KAAK,EAAE,yBAAyB;aAChC,OAAO,EAAE,2BAA2B;aACpC,UAAU,EAAE,8BAA8B;aAC1C,OAAO,EAAE,2BAA2B;CAC5B,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,kCAAkC,CAAC;AAEjE;;;;GAIG;AACH,wBAAsB,qBAAqB,CAAC,EAAE,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CASvE;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,4BAA4B,CAAC,EAAE,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAoF9E;AAcD,0EAA0E;AAC1E,wBAAsB,0BAA0B,CAAC,EAAE,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAO5E"}
1
+ {"version":3,"file":"db-schema.d.ts","sourceRoot":"","sources":["../../../src/transports/db-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAMzD,KAAK,kBAAkB,GAAG,UAAU,CAClC,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAC3E,CAAC,CA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