@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
@@ -1,3 +1,4 @@
1
+ import { type BarrelTree, type RootedBarrel } from './discovery-roots.js';
1
2
  import type { WorkflowEngine } from './engine.js';
2
3
  import { type WorkflowMeta } from './workflow-ref.js';
3
4
  /**
@@ -16,6 +17,8 @@ export type DiscoveredWorkflowClass = new () => {
16
17
  export interface DiscoveredWorkflow {
17
18
  meta: WorkflowMeta;
18
19
  cls: DiscoveredWorkflowClass;
20
+ /** The module it was found in: an absolute path for a directory scan, the key for a barrel. */
21
+ file: string;
19
22
  }
20
23
  /**
21
24
  * A factory that instantiates a workflow class. When provided, it replaces the default `new Ctor()` —
@@ -37,57 +40,45 @@ export type WorkflowClassFactory = (ctor: DiscoveredWorkflowClass) => Discovered
37
40
  * (the Adonis container's `make` resolves async), so this function is async.
38
41
  */
39
42
  export declare function registerWorkflowClass(engine: WorkflowEngine, cls: unknown, factory?: WorkflowClassFactory): Promise<boolean>;
43
+ /** Re-exported from its shared home so existing `pickModuleExt` imports keep working. */
44
+ export { pickModuleExt } from './discovery-roots.js';
40
45
  /**
41
- * Pick the module extension a directory scan should import, from the `readdir` entries already in
42
- * hand — NOT from this library's own compiled file. A consuming app resolves this library as built
43
- * `.js` from `node_modules`, but its own `app/workflows` / `app/steps` are `.ts` in dev; deriving the
44
- * extension from `import.meta.url` (the old bug) always picked `.js` in that setup and silently
45
- * discovered nothing, because every entry was then skipped.
46
+ * Scan one directory — or several — RECURSIVELY for modules and collect every exported workflow
47
+ * class — a `BaseWorkflow` subclass (the default export and any named export are considered) — so
48
+ * nested conventions like `app/workflows/billing/charge_workflow.ts` are found, matching
49
+ * `make:workflow`'s nested-path scaffolding. Only the extension present in each directory is
50
+ * imported (see {@link pickModuleExt}), and each module path is visited once, so a built `.js` and a
51
+ * dev `.ts` of the same module never both register. Missing directory → nothing from it (the
52
+ * convention is opt-in: no `app/workflows`, nothing to register).
46
53
  *
47
- * Rules, in order:
48
- * 1. `.d.ts` entries are never importable modules — ignored entirely.
49
- * 2. If any remaining entry ends in `.ts`, the scan imports `.ts` files.
50
- * 3. Otherwise, if any entry ends in `.js`, the scan imports `.js` files.
51
- * 4. If neither is present, returns `null` (the scan registers nothing).
52
- *
53
- * This preserves the original de-duplication intent: a directory containing both a built `foo.js`
54
- * and its source `foo.ts` resolves to `.ts` only, so the same module is never registered twice.
55
- * Shared with {@link import('./step-discovery.js').registerStepsFromDir} so the two scanners can't
56
- * drift apart again.
57
- */
58
- export declare function pickModuleExt(entries: readonly string[]): '.ts' | '.js' | null;
59
- /**
60
- * Scan a directory RECURSIVELY for modules and collect every exported workflow class — a
61
- * `BaseWorkflow` subclass (the default export and any named export are considered) — so nested
62
- * conventions like
63
- * `app/workflows/billing/charge_workflow.ts` are found, matching `make:workflow`'s nested-path
64
- * scaffolding. Only the extension present in `dir` is imported (see {@link pickModuleExt}), and
65
- * each module path is visited once, so a built `.js` and a dev `.ts` of the same module never both
66
- * register. Missing directory → empty list (the convention is opt-in: no `app/workflows`, nothing to
67
- * register).
54
+ * With several directories (a modular app: `['app/orders/flows', 'app/billing/flows']`) every root
55
+ * is walked in order, and the same workflow name + version defined by different classes in two
56
+ * roots throws a {@link DuplicateDiscoveryError} naming both files.
68
57
  */
69
- export declare function discoverWorkflows(dir: string): Promise<DiscoveredWorkflow[]>;
58
+ export declare function discoverWorkflows(dir: string | readonly string[]): Promise<DiscoveredWorkflow[]>;
70
59
  /**
71
- * Discover every workflow class (`BaseWorkflow` subclass) under `dir` and register each on the
72
- * engine. Returns the registered metadata so the caller can log what was wired.
73
- * Best-effort over a missing directory.
60
+ * Discover every workflow class (`BaseWorkflow` subclass) under `dir` — one directory or several,
61
+ * see {@link discoverWorkflows} — and register each on the engine. Returns the registered metadata
62
+ * so the caller can log what was wired. Best-effort over a missing directory; throws a
63
+ * {@link DuplicateDiscoveryError} (registering nothing) on a cross-directory name clash.
74
64
  */
75
- export declare function registerWorkflowsFromDir(engine: WorkflowEngine, dir: string, factory?: WorkflowClassFactory): Promise<WorkflowMeta[]>;
65
+ export declare function registerWorkflowsFromDir(engine: WorkflowEngine, dir: string | readonly string[], factory?: WorkflowClassFactory): Promise<WorkflowMeta[]>;
76
66
  /**
77
67
  * The shape of the build-time barrel generated by the Assembler `init` hook
78
68
  * (`@adonis-agora/durable/hooks/workflows`): a map of stable key → lazy module import, e.g.
79
- * `{ Charge: () => import('#workflows/charge_workflow') }`. The exact key is irrelevant here — we
80
- * register every workflow export of every module (`BaseWorkflow` subclass), identical to the runtime
81
- * scan.
69
+ * `{ Charge: () => import('#workflows/charge_workflow') }`, nested one level per sub-directory
70
+ * (`{ billing: { Refund: () => import(...) } }`). The exact key is irrelevant here — we register
71
+ * every workflow export of every module (`BaseWorkflow` subclass), identical to the runtime scan.
72
+ * When the hook's `source` lists several directories it writes a {@link RootedBarrel} array instead.
82
73
  */
83
- export type WorkflowsBarrel = Record<string, () => Promise<Record<string, unknown>>>;
74
+ export type WorkflowsBarrel = BarrelTree;
84
75
  /**
85
76
  * Register every workflow class reachable from a generated {@link WorkflowsBarrel} (`BaseWorkflow`
86
- * subclass), by awaiting each lazy module import and registering each
87
- * workflow export — the build-time equivalent of {@link registerWorkflowsFromDir}, with no runtime
88
- * `readdir`. Each module is imported once and each class registered once (deduped), so a class
89
- * re-exported from several modules is safe. Returns the registered metadata so the caller can log
90
- * what was wired.
77
+ * subclass) — or from the multi-root {@link RootedBarrel} array — by awaiting each lazy module import
78
+ * and registering each workflow export: the build-time equivalent of {@link registerWorkflowsFromDir},
79
+ * with no runtime `readdir`. Each module is imported once and each class registered once (deduped),
80
+ * so a class re-exported from several modules is safe. Same cross-root duplicate rule as the scan.
81
+ * Returns the registered metadata so the caller can log what was wired.
91
82
  */
92
- export declare function registerWorkflowsFromBarrel(engine: WorkflowEngine, barrel: WorkflowsBarrel, factory?: WorkflowClassFactory): Promise<WorkflowMeta[]>;
83
+ export declare function registerWorkflowsFromBarrel(engine: WorkflowEngine, barrel: WorkflowsBarrel | readonly RootedBarrel[], factory?: WorkflowClassFactory): Promise<WorkflowMeta[]>;
93
84
  //# sourceMappingURL=workflow-discovery.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-discovery.d.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MAAM,sBAAsB,CAAC;AAqCrD;;;;;;;;;;;;GAYG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,GAC9B,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAE/B;AAED;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,cAAc,EACtB,GAAG,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,EAC/B,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,YAAY,EAAE,CAAC,CAIzB;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC;AAEzC;;;;;;;GAOG;AACH,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,eAAe,GAAG,SAAS,YAAY,EAAE,EACjD,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,YAAY,EAAE,CAAC,CAIzB"}
@@ -1,6 +1,4 @@
1
- import { readdir } from 'node:fs/promises';
2
- import { extname, join } from 'node:path';
3
- import { pathToFileURL } from 'node:url';
1
+ import { barrelModules, DuplicateDiscoveryError, scanDirsModules, } from './discovery-roots.js';
4
2
  import { eventTriggerCanonicalName, workflowEvents } from './workflow-events.js';
5
3
  import { onErrorRoutesOf, workflowMeta, workflowSchedules, } from './workflow-ref.js';
6
4
  function defaultWorkflowFactory(ctor) {
@@ -32,7 +30,19 @@ export async function registerWorkflowClass(engine, cls, factory = defaultWorkfl
32
30
  const exactNames = events
33
31
  .map(eventTriggerCanonicalName)
34
32
  .filter((name) => name !== null);
33
+ // Inline dead-letter handler: a `deadLetter(ctx, dead)` method becomes the workflow `<name>.dlq`.
34
+ const inlineDeadLetter = instance.deadLetter;
35
+ let deadLetterWorkflow = meta.deadLetterWorkflow;
36
+ if (typeof inlineDeadLetter === 'function') {
37
+ if (meta.deadLetterWorkflow !== undefined) {
38
+ throw new Error(`workflow ${meta.name} declares both a deadLetter() method and a deadLetterWorkflow option. Use one: the inline handler, or the reference.`);
39
+ }
40
+ const dlqName = `${meta.name}.dlq`;
41
+ engine.register(dlqName, meta.version, (ctx, input) => Promise.resolve(inlineDeadLetter.call(instance, ctx, input)), meta.origin ? { origin: meta.origin } : undefined);
42
+ deadLetterWorkflow = dlqName;
43
+ }
35
44
  engine.register(meta.name, meta.version, (ctx, input) => Promise.resolve(instance.run(ctx, input)), {
45
+ ...(deadLetterWorkflow !== undefined ? { deadLetterWorkflow } : {}),
36
46
  ...(meta.tags ? { tags: meta.tags } : {}),
37
47
  ...(meta.executionTimeout !== undefined ? { executionTimeout: meta.executionTimeout } : {}),
38
48
  ...(meta.onEvent || exactNames.length > 0
@@ -42,6 +52,8 @@ export async function registerWorkflowClass(engine, cls, factory = defaultWorkfl
42
52
  ...(meta.concurrency ? { concurrency: meta.concurrency } : {}),
43
53
  ...(meta.origin ? { origin: meta.origin } : {}),
44
54
  ...(meta.onError?.length ? { onError: onErrorRoutesOf(meta) } : {}),
55
+ ...(meta.inputSchema ? { inputSchema: meta.inputSchema } : {}),
56
+ ...(meta.searchAttributes ? { searchAttributesSchema: meta.searchAttributes } : {}),
45
57
  });
46
58
  // Collect any colocated `static schedule` on the class so the worker loop can fire it alongside the
47
59
  // config schedules. Both discovery paths (dir scan + generated barrel) funnel through here, so this
@@ -51,87 +63,64 @@ export async function registerWorkflowClass(engine, cls, factory = defaultWorkfl
51
63
  engine.registerSchedules(schedules);
52
64
  return true;
53
65
  }
66
+ /** Re-exported from its shared home so existing `pickModuleExt` imports keep working. */
67
+ export { pickModuleExt } from './discovery-roots.js';
54
68
  /**
55
- * Pick the module extension a directory scan should import, from the `readdir` entries already in
56
- * hand — NOT from this library's own compiled file. A consuming app resolves this library as built
57
- * `.js` from `node_modules`, but its own `app/workflows` / `app/steps` are `.ts` in dev; deriving the
58
- * extension from `import.meta.url` (the old bug) always picked `.js` in that setup and silently
59
- * discovered nothing, because every entry was then skipped.
69
+ * Collect every workflow class reachable from `modules`, in order: each export is considered
70
+ * (default and named), and a class seen twice (re-exported from several modules, or reachable from
71
+ * two overlapping roots) is kept once.
60
72
  *
61
- * Rules, in order:
62
- * 1. `.d.ts` entries are never importable modules — ignored entirely.
63
- * 2. If any remaining entry ends in `.ts`, the scan imports `.ts` files.
64
- * 3. Otherwise, if any entry ends in `.js`, the scan imports `.js` files.
65
- * 4. If neither is present, returns `null` (the scan registers nothing).
66
- *
67
- * This preserves the original de-duplication intent: a directory containing both a built `foo.js`
68
- * and its source `foo.ts` resolves to `.ts` only, so the same module is never registered twice.
69
- * Shared with {@link import('./step-discovery.js').registerStepsFromDir} so the two scanners can't
70
- * drift apart again.
71
- */
72
- export function pickModuleExt(entries) {
73
- let hasTs = false;
74
- let hasJs = false;
75
- for (const entry of entries) {
76
- if (entry.endsWith('.d.ts'))
77
- continue;
78
- const ext = extname(entry);
79
- if (ext === '.ts')
80
- hasTs = true;
81
- else if (ext === '.js')
82
- hasJs = true;
83
- }
84
- if (hasTs)
85
- return '.ts';
86
- if (hasJs)
87
- return '.js';
88
- return null;
89
- }
90
- /**
91
- * Scan a directory RECURSIVELY for modules and collect every exported workflow class — a
92
- * `BaseWorkflow` subclass (the default export and any named export are considered) — so nested
93
- * conventions like
94
- * `app/workflows/billing/charge_workflow.ts` are found, matching `make:workflow`'s nested-path
95
- * scaffolding. Only the extension present in `dir` is imported (see {@link pickModuleExt}), and
96
- * each module path is visited once, so a built `.js` and a dev `.ts` of the same module never both
97
- * register. Missing directory → empty list (the convention is opt-in: no `app/workflows`, nothing to
98
- * register).
73
+ * Two DIFFERENT classes claiming the same name + version from two different roots throw a
74
+ * {@link DuplicateDiscoveryError} quoting both files — before anything is registered. Within a single
75
+ * root nothing changes from the single-directory behaviour (both are kept; the later registration
76
+ * wins on the engine).
99
77
  */
100
- export async function discoverWorkflows(dir) {
101
- let entries;
102
- try {
103
- entries = await readdir(dir, { recursive: true });
104
- }
105
- catch (err) {
106
- if (err.code === 'ENOENT')
107
- return [];
108
- throw err;
109
- }
110
- const moduleExt = pickModuleExt(entries);
78
+ async function collectWorkflows(modules) {
111
79
  const found = [];
112
- if (moduleExt === null)
113
- return found;
114
80
  const seen = new Set();
115
- for (const entry of entries.sort()) {
116
- if (extname(entry) !== moduleExt || entry.endsWith(`.d${moduleExt}`))
117
- continue;
118
- const mod = (await import(pathToFileURL(join(dir, entry)).href));
81
+ const owners = new Map();
82
+ for (const { root, file, load } of modules) {
83
+ const mod = await load();
119
84
  for (const exported of Object.values(mod)) {
120
85
  if (seen.has(exported))
121
86
  continue;
122
87
  const meta = workflowMeta(exported);
123
88
  if (!meta)
124
89
  continue;
90
+ const id = `${meta.name}@${meta.version}`;
91
+ const owner = owners.get(id);
92
+ if (owner && owner.root !== root) {
93
+ throw new DuplicateDiscoveryError('workflow', id, [owner.file, file]);
94
+ }
95
+ if (!owner)
96
+ owners.set(id, { root, file });
125
97
  seen.add(exported);
126
- found.push({ meta, cls: exported });
98
+ found.push({ meta, cls: exported, file });
127
99
  }
128
100
  }
129
101
  return found;
130
102
  }
131
103
  /**
132
- * Discover every workflow class (`BaseWorkflow` subclass) under `dir` and register each on the
133
- * engine. Returns the registered metadata so the caller can log what was wired.
134
- * Best-effort over a missing directory.
104
+ * Scan one directory — or several — RECURSIVELY for modules and collect every exported workflow
105
+ * class — a `BaseWorkflow` subclass (the default export and any named export are considered) — so
106
+ * nested conventions like `app/workflows/billing/charge_workflow.ts` are found, matching
107
+ * `make:workflow`'s nested-path scaffolding. Only the extension present in each directory is
108
+ * imported (see {@link pickModuleExt}), and each module path is visited once, so a built `.js` and a
109
+ * dev `.ts` of the same module never both register. Missing directory → nothing from it (the
110
+ * convention is opt-in: no `app/workflows`, nothing to register).
111
+ *
112
+ * With several directories (a modular app: `['app/orders/flows', 'app/billing/flows']`) every root
113
+ * is walked in order, and the same workflow name + version defined by different classes in two
114
+ * roots throws a {@link DuplicateDiscoveryError} naming both files.
115
+ */
116
+ export async function discoverWorkflows(dir) {
117
+ return collectWorkflows(await scanDirsModules(typeof dir === 'string' ? [dir] : dir));
118
+ }
119
+ /**
120
+ * Discover every workflow class (`BaseWorkflow` subclass) under `dir` — one directory or several,
121
+ * see {@link discoverWorkflows} — and register each on the engine. Returns the registered metadata
122
+ * so the caller can log what was wired. Best-effort over a missing directory; throws a
123
+ * {@link DuplicateDiscoveryError} (registering nothing) on a cross-directory name clash.
135
124
  */
136
125
  export async function registerWorkflowsFromDir(engine, dir, factory) {
137
126
  const discovered = await discoverWorkflows(dir);
@@ -141,28 +130,16 @@ export async function registerWorkflowsFromDir(engine, dir, factory) {
141
130
  }
142
131
  /**
143
132
  * Register every workflow class reachable from a generated {@link WorkflowsBarrel} (`BaseWorkflow`
144
- * subclass), by awaiting each lazy module import and registering each
145
- * workflow export — the build-time equivalent of {@link registerWorkflowsFromDir}, with no runtime
146
- * `readdir`. Each module is imported once and each class registered once (deduped), so a class
147
- * re-exported from several modules is safe. Returns the registered metadata so the caller can log
148
- * what was wired.
133
+ * subclass) — or from the multi-root {@link RootedBarrel} array — by awaiting each lazy module import
134
+ * and registering each workflow export: the build-time equivalent of {@link registerWorkflowsFromDir},
135
+ * with no runtime `readdir`. Each module is imported once and each class registered once (deduped),
136
+ * so a class re-exported from several modules is safe. Same cross-root duplicate rule as the scan.
137
+ * Returns the registered metadata so the caller can log what was wired.
149
138
  */
150
139
  export async function registerWorkflowsFromBarrel(engine, barrel, factory) {
151
- const registered = [];
152
- const seen = new Set();
153
- for (const load of Object.values(barrel)) {
154
- const mod = await load();
155
- for (const exported of Object.values(mod)) {
156
- if (seen.has(exported))
157
- continue;
158
- const meta = workflowMeta(exported);
159
- if (!meta)
160
- continue;
161
- seen.add(exported);
162
- await registerWorkflowClass(engine, exported, factory);
163
- registered.push(meta);
164
- }
165
- }
166
- return registered;
140
+ const discovered = await collectWorkflows(barrelModules(barrel));
141
+ for (const { cls } of discovered)
142
+ await registerWorkflowClass(engine, cls, factory);
143
+ return discovered.map((d) => d.meta);
167
144
  }
168
145
  //# sourceMappingURL=workflow-discovery.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-discovery.js","sourceRoot":"","sources":["../../src/workflow-discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,EACL,eAAe,EAEf,YAAY,EACZ,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAgC3B,SAAS,sBAAsB,CAC7B,IAA6B;IAE7B,OAAO,IAAI,IAAI,EAAE,CAAC;AACpB,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,MAAsB,EACtB,GAAY,EACZ,OAAO,GAAyB,sBAAsB;IAEtD,MAAM,IAAI,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;IAC/B,IAAI,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC;IACxB,MAAM,IAAI,GAAG,GAA8B,CAAC;IAC5C,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,sFAAsF;IACtF,kFAAkF;IAClF,mFAAmF;IACnF,MAAM,MAAM,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;IACnC,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC;QAAE,MAAM,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAC5D,MAAM,UAAU,GAAG,MAAM;SACtB,GAAG,CAAC,yBAAyB,CAAC;SAC9B,MAAM,CAAC,CAAC,IAAI,EAAkB,EAAE,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IACnD,MAAM,CAAC,QAAQ,CACb,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,OAAO,EACZ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,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AACvC,CAAC;AAYD;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAC/C,MAAsB,EACtB,MAAiD,EACjD,OAA8B;IAE9B,MAAM,UAAU,GAAG,MAAM,gBAAgB,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;IACjE,KAAK,MAAM,EAAE,GAAG,EAAE,IAAI,UAAU;QAAE,MAAM,qBAAqB,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IACpF,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AACvC,CAAC"}
@@ -7,7 +7,9 @@
7
7
  */
8
8
  import type { ConcurrencyConfig } from './concurrency.js';
9
9
  import type { SingletonConfig } from './engine.js';
10
+ import type { SearchAttributesSchema } from './interfaces.js';
10
11
  import type { ScheduledWorkflow, WorkflowScheduleConfig } from './scheduler.js';
12
+ import type { StandardSchemaV1 } from './standard-schema.js';
11
13
  /** Options for a workflow's `static workflow = { name, version, … }` config (see {@link BaseWorkflow}). */
12
14
  export interface WorkflowOptions {
13
15
  /** The registered workflow name (the cross-runtime identity, e.g. `order`). */
@@ -57,6 +59,28 @@ export interface WorkflowOptions {
57
59
  };
58
60
  workflow: WorkflowRef;
59
61
  }[];
62
+ /**
63
+ * Where a run of this workflow that goes `dead` (past `maxRecoveryAttempts`) is handed: the engine
64
+ * starts this workflow with a `DeadLetter` input (`{ deadRunId, workflow, input, error }`) under
65
+ * the run id `dlq:<deadRunId>`, in the dead run's namespace. Overrides the config-level
66
+ * `deadLetterWorkflow`. A class can instead define a `deadLetter(ctx, dead)` method (registered as
67
+ * `<name>.dlq`); declaring both is an error at boot.
68
+ */
69
+ deadLetterWorkflow?: WorkflowRef;
70
+ /**
71
+ * Validate the run input at start against any Standard Schema (zod, valibot, arktype, …). A bad
72
+ * payload throws a `SchemaValidationError` from `start` and no run is created (an `onEvent`
73
+ * trigger with a rejected payload simply doesn't start this workflow). The schema's OUTPUT value
74
+ * (parsed / coerced / defaulted) is what the run stores and `run(ctx, input)` receives.
75
+ */
76
+ inputSchema?: StandardSchemaV1;
77
+ /**
78
+ * The run's typed search-attributes shape (a {@link SearchAttributesSchema}): every
79
+ * `ctx.upsertSearchAttributes` validates the merged attributes against it and rejects a
80
+ * non-conforming write. Pair with `run(ctx: WorkflowCtx<InferSearchAttributes<typeof schema>>)`
81
+ * for compile-time typing, and read them back typed with `attributesOf(WorkflowClass, run)`.
82
+ */
83
+ searchAttributes?: SearchAttributesSchema;
60
84
  }
61
85
  /** The metadata read off a workflow class's `static workflow` config for discovery + registration. */
62
86
  export interface WorkflowMeta extends WorkflowOptions {
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-ref.d.ts","sourceRoot":"","sources":["../../src/workflow-ref.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAEhF,2GAA2G;AAC3G,MAAM,WAAW,eAAe;IAC9B,+EAA+E;IAC/E,IAAI,EAAE,MAAM,CAAC;IACb,yFAAyF;IACzF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,kFAAkF;IAClF,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACnC,oFAAoF;IACpF,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC;;;;OAIG;IACH,MAAM,CA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IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/C,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACpE,CAAC;AACJ,CAAC"}
@@ -50,6 +50,12 @@ export default defineConfig({
50
50
  // remoteRedispatchMs: 5 * 60 * 1000,
51
51
  // remoteRedispatchMax: 10,
52
52
 
53
+ /**
54
+ * Liveness window of a remote (polyglot) workflow turn: with no decision and no run-scoped
55
+ * heartbeat for this long, the turn is re-driven instead of waiting forever. Heartbeats rearm it.
56
+ */
57
+ // remoteAdvanceSilenceMs: 2 * 60 * 1000,
58
+
53
59
  /**
54
60
  * Recurring workflows fired by the \`durable:work\` worker loop on every tick. Each window starts
55
61
  * exactly once even with several worker instances racing (idempotent by the schedule's time-bucket
@@ -2,13 +2,17 @@
2
2
  exports({ to: app.configPath('durable_dashboard.ts') })
3
3
  }}}
4
4
  import { defineConfig } from '@adonis-agora/durable/dashboard'
5
+ // Used by the commented-out dashboardAuth example below.
6
+ // import env from '#start/env'
5
7
 
6
8
  /**
7
9
  * Configuration for the @adonis-agora/durable dashboard.
8
10
  *
9
- * By default the dashboard is open OUTSIDE production, and in production it
10
- * requires a bearer token equal to \`DURABLE_DASHBOARD_TOKEN\` (deny if unset).
11
- * Replace \`authorize\` with your own guard (session, role, IP allow-list, …).
11
+ * By default the dashboard FAILS CLOSED in every environment: it requires a
12
+ * bearer token equal to \`DURABLE_DASHBOARD_TOKEN\`, and denies everything when
13
+ * that env var is unset. Replace \`authorize\` with your own guard (session,
14
+ * role, IP allow-list, …), or set \`allowUnauthenticated: true\` for a trusted
15
+ * local network only.
12
16
  *
13
17
  * \`dashboardAuth\` is an ADDITIVE, optional session gate on top of \`authorize\` —
14
18
  * a signed cookie minted via a built-in login page (Mode B: \`login\`) and/or a
@@ -7,7 +7,8 @@ import { createDurableTables, dropDurableTables } from '@adonis-agora/durable'
7
7
 
8
8
  /**
9
9
  * Durable workflow tables for the @adonis-agora/durable \`lucid\` state store: runs, step checkpoints,
10
- * the search-attribute side-table, signal waiters, buffered signals and buffered events.
10
+ * the search-attribute side-table, signal waiters, buffered signals, buffered events and persisted
11
+ * schedules (seven tables, plus the one-row \`durable_schema_meta\` marker).
11
12
  *
12
13
  * This migration DELEGATES to the library instead of reproducing its DDL. The schema belongs to the
13
14
  * library — \`LucidStateStore\` decides what columns it reads and writes — so a hand-copied snapshot
@@ -0,0 +1,43 @@
1
+ {{{
2
+ exports({ to: app.migrationsPath(`${new Date().getTime()}_create_durable_transport_messages.ts`) })
3
+ }}}
4
+ import { BaseSchema } from '@adonisjs/lucid/schema'
5
+
6
+ /**
7
+ * The message channel of the @adonis-agora/durable \`db\` transport: remote-workflow decisions and step
8
+ * events, and the store-less (tenant pod) protocol's start-run, run-request, run-reply and tenant-event
9
+ * rows. Also adds the \`kind\` column (\`step\` / \`workflow\`) to \`durable_transport_tasks\` when an
10
+ * older migration created that table without it. Only needed when you select the \`db\` transport in
11
+ * config/durable.ts.
12
+ */
13
+ export default class extends BaseSchema {
14
+ async up() {
15
+ this.schema.createTable('durable_transport_messages', (table) => {
16
+ table.increments('id').primary()
17
+ table.string('kind', 32).notNullable()
18
+ table.string('namespace').notNullable().defaultTo('default')
19
+ table.string('recipient').notNullable().defaultTo('')
20
+ table.string('reply_to')
21
+ table.text('payload', 'longtext').notNullable()
22
+ table.string('claimed_by')
23
+ table.bigInteger('claimed_at')
24
+ table.bigInteger('created_at').notNullable()
25
+ table.index(['namespace', 'kind', 'recipient', 'claimed_at', 'id'], 'durable_transport_messages_idx')
26
+ })
27
+
28
+ // Upgrading: a tasks table from an earlier release has no kind column. (A fresh install creates
29
+ // it with one, whichever of the two migrations runs first.)
30
+ // Each check takes a fresh schema builder: a Knex schema builder is stateful.
31
+ this.defer(async (db) => {
32
+ if (!(await db.schema.hasTable('durable_transport_tasks'))) return
33
+ if (await db.schema.hasColumn('durable_transport_tasks', 'kind')) return
34
+ await db.schema.alterTable('durable_transport_tasks', (table) => {
35
+ table.string('kind', 16).notNullable().defaultTo('step')
36
+ })
37
+ })
38
+ }
39
+
40
+ async down() {
41
+ this.schema.dropTableIfExists('durable_transport_messages')
42
+ }
43
+ }
@@ -6,9 +6,9 @@ import { BaseSchema } from '@adonisjs/lucid/schema'
6
6
  /**
7
7
  * Transport tables for the @adonis-agora/durable \`db\` transport: the point-to-point work channels (tasks /
8
8
  * results / heartbeats / control) that let durable remote steps run cross-process over the database
9
- * alone. JSON payloads are stored as TEXT (the transport (de)serializes them) and timestamps as
10
- * epoch-ms integers, so the schema is portable across SQLite / Postgres / MySQL. Only needed when you
11
- * select the \`db\` transport in config/durable.ts.
9
+ * alone. JSON payloads are stored as text (the transport (de)serializes them) — \`longtext\` on MySQL,
10
+ * where \`text\` stops at 64KB — and timestamps as epoch-ms integers, so the schema is portable across
11
+ * SQLite / Postgres / MySQL. Only needed when you select the \`db\` transport in config/durable.ts.
12
12
  */
13
13
  export default class extends BaseSchema {
14
14
  async up() {
@@ -19,11 +19,14 @@ export default class extends BaseSchema {
19
19
  table.string('name').notNullable()
20
20
  table.string('grp').notNullable()
21
21
  table.string('namespace').notNullable().defaultTo('default')
22
- table.text('input')
22
+ table.text('input', 'longtext')
23
23
  table.string('traceparent')
24
- table.text('context')
24
+ table.text('context', 'longtext')
25
25
  table.string('transport')
26
26
  table.integer('attempt').notNullable()
27
+ table.integer('reclaims').notNullable().defaultTo(0)
28
+ table.integer('priority').notNullable().defaultTo(0)
29
+ table.string('kind', 16).notNullable().defaultTo('step')
27
30
  table.string('claimed_by')
28
31
  table.bigInteger('claimed_at')
29
32
  table.bigInteger('created_at').notNullable()
@@ -36,10 +39,10 @@ export default class extends BaseSchema {
36
39
  table.integer('seq').notNullable()
37
40
  table.string('status').notNullable()
38
41
  table.string('namespace').notNullable().defaultTo('default')
39
- table.text('output')
40
- table.text('error')
42
+ table.text('output', 'longtext')
43
+ table.text('error', 'longtext')
41
44
  table.bigInteger('started_at')
42
- table.text('events')
45
+ table.text('events', 'longtext')
43
46
  table.string('claimed_by')
44
47
  table.bigInteger('claimed_at')
45
48
  table.bigInteger('created_at').notNullable()
@@ -61,7 +64,7 @@ export default class extends BaseSchema {
61
64
 
62
65
  this.schema.createTable('durable_transport_control', (table) => {
63
66
  table.increments('id').primary()
64
- table.text('payload').notNullable()
67
+ table.text('payload', 'longtext').notNullable()
65
68
  table.string('namespace').notNullable().defaultTo('default')
66
69
  table.string('claimed_by')
67
70
  table.bigInteger('claimed_at')
@@ -12,7 +12,7 @@ export default class extends BaseSchema {
12
12
  async up() {
13
13
  this.schema.createTable('durable_transport_worker_keys', (table) => {
14
14
  table.string('key', 512).primary()
15
- table.text('value').notNullable()
15
+ table.text('value', 'longtext').notNullable()
16
16
  table.bigInteger('expires_at').notNullable()
17
17
  table.index(['expires_at'], 'durable_transport_worker_keys_expires_idx')
18
18
  })
@@ -1,4 +1,4 @@
1
- {{#var workflowName = string(entity.name).pascalCase().toString()}}
1
+ {{#var workflowName = string(entity.name).snakeCase().removeSuffix('workflow').pascalCase().toString()}}
2
2
  {{#var workflowFileName = string(entity.name).snakeCase().removeSuffix('workflow').toString() + '_workflow'}}
3
3
  {{#var registeredName = string(entity.name).snakeCase().removeSuffix('workflow').toString()}}
4
4
  {{{