@adonis-agora/durable 0.49.1 → 0.51.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 (335) hide show
  1. package/CHANGELOG.md +279 -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/commands/work.d.ts.map +1 -1
  10. package/dist/commands/work.js +3 -1
  11. package/dist/commands/work.js.map +1 -1
  12. package/dist/configure.d.ts.map +1 -1
  13. package/dist/configure.js +1 -0
  14. package/dist/configure.js.map +1 -1
  15. package/dist/providers/dashboard_provider.d.ts +2 -0
  16. package/dist/providers/dashboard_provider.d.ts.map +1 -1
  17. package/dist/providers/dashboard_provider.js +50 -6
  18. package/dist/providers/dashboard_provider.js.map +1 -1
  19. package/dist/providers/durable_provider.d.ts.map +1 -1
  20. package/dist/providers/durable_provider.js +146 -35
  21. package/dist/providers/durable_provider.js.map +1 -1
  22. package/dist/src/admission-redis/redis-admission-backend.d.ts.map +1 -1
  23. package/dist/src/admission-redis/redis-admission-backend.js +3 -1
  24. package/dist/src/admission-redis/redis-admission-backend.js.map +1 -1
  25. package/dist/src/ambient-step.d.ts +24 -0
  26. package/dist/src/ambient-step.d.ts.map +1 -0
  27. package/dist/src/ambient-step.js +42 -0
  28. package/dist/src/ambient-step.js.map +1 -0
  29. package/dist/src/base-workflow.d.ts +10 -1
  30. package/dist/src/base-workflow.d.ts.map +1 -1
  31. package/dist/src/base-workflow.js.map +1 -1
  32. package/dist/src/codec-state-store.d.ts +28 -2
  33. package/dist/src/codec-state-store.d.ts.map +1 -1
  34. package/dist/src/codec-state-store.js +61 -3
  35. package/dist/src/codec-state-store.js.map +1 -1
  36. package/dist/src/commands/worker.d.ts +8 -3
  37. package/dist/src/commands/worker.d.ts.map +1 -1
  38. package/dist/src/commands/worker.js +35 -8
  39. package/dist/src/commands/worker.js.map +1 -1
  40. package/dist/src/config_types.d.ts +6 -0
  41. package/dist/src/config_types.d.ts.map +1 -1
  42. package/dist/src/control-plane-redis/redis-control-plane.d.ts.map +1 -1
  43. package/dist/src/control-plane-redis/redis-control-plane.js +22 -6
  44. package/dist/src/control-plane-redis/redis-control-plane.js.map +1 -1
  45. package/dist/src/control-planes/factory.d.ts +6 -0
  46. package/dist/src/control-planes/factory.d.ts.map +1 -1
  47. package/dist/src/control-planes/factory.js +1 -0
  48. package/dist/src/control-planes/factory.js.map +1 -1
  49. package/dist/src/dashboard/gateway-adapter.d.ts +15 -5
  50. package/dist/src/dashboard/gateway-adapter.d.ts.map +1 -1
  51. package/dist/src/dashboard/gateway-adapter.js +71 -7
  52. package/dist/src/dashboard/gateway-adapter.js.map +1 -1
  53. package/dist/src/dashboard/handlers.d.ts +53 -1
  54. package/dist/src/dashboard/handlers.d.ts.map +1 -1
  55. package/dist/src/dashboard/handlers.js +200 -20
  56. package/dist/src/dashboard/handlers.js.map +1 -1
  57. package/dist/src/dashboard/index.d.ts +2 -2
  58. package/dist/src/dashboard/index.d.ts.map +1 -1
  59. package/dist/src/dashboard/index.js +2 -2
  60. package/dist/src/dashboard/index.js.map +1 -1
  61. package/dist/src/dashboard/openapi.d.ts.map +1 -1
  62. package/dist/src/dashboard/openapi.js +71 -1
  63. package/dist/src/dashboard/openapi.js.map +1 -1
  64. package/dist/src/define_config.d.ts +122 -8
  65. package/dist/src/define_config.d.ts.map +1 -1
  66. package/dist/src/define_config.js.map +1 -1
  67. package/dist/src/diagnostics-bridge.d.ts +16 -3
  68. package/dist/src/diagnostics-bridge.d.ts.map +1 -1
  69. package/dist/src/diagnostics-bridge.js +9 -3
  70. package/dist/src/diagnostics-bridge.js.map +1 -1
  71. package/dist/src/discovery-roots.d.ts +92 -0
  72. package/dist/src/discovery-roots.d.ts.map +1 -0
  73. package/dist/src/discovery-roots.js +150 -0
  74. package/dist/src/discovery-roots.js.map +1 -0
  75. package/dist/src/engine.d.ts +428 -21
  76. package/dist/src/engine.d.ts.map +1 -1
  77. package/dist/src/engine.js +1566 -164
  78. package/dist/src/engine.js.map +1 -1
  79. package/dist/src/entities.d.ts +36 -1
  80. package/dist/src/entities.d.ts.map +1 -1
  81. package/dist/src/entities.js +65 -4
  82. package/dist/src/entities.js.map +1 -1
  83. package/dist/src/errors.d.ts +46 -0
  84. package/dist/src/errors.d.ts.map +1 -1
  85. package/dist/src/errors.js +48 -0
  86. package/dist/src/errors.js.map +1 -1
  87. package/dist/src/event-trigger-bridge.d.ts +8 -0
  88. package/dist/src/event-trigger-bridge.d.ts.map +1 -1
  89. package/dist/src/event-trigger-bridge.js +24 -3
  90. package/dist/src/event-trigger-bridge.js.map +1 -1
  91. package/dist/src/handshake/announced.d.ts +27 -0
  92. package/dist/src/handshake/announced.d.ts.map +1 -1
  93. package/dist/src/handshake/announced.js +62 -0
  94. package/dist/src/handshake/announced.js.map +1 -1
  95. package/dist/src/handshake/directory.d.ts +92 -0
  96. package/dist/src/handshake/directory.d.ts.map +1 -0
  97. package/dist/src/handshake/directory.js +139 -0
  98. package/dist/src/handshake/directory.js.map +1 -0
  99. package/dist/src/hooks/barrel-sources.d.ts +28 -0
  100. package/dist/src/hooks/barrel-sources.d.ts.map +1 -0
  101. package/dist/src/hooks/barrel-sources.js +92 -0
  102. package/dist/src/hooks/barrel-sources.js.map +1 -0
  103. package/dist/src/hooks/steps.d.ts +12 -3
  104. package/dist/src/hooks/steps.d.ts.map +1 -1
  105. package/dist/src/hooks/steps.js +7 -11
  106. package/dist/src/hooks/steps.js.map +1 -1
  107. package/dist/src/hooks/workflows.d.ts +12 -3
  108. package/dist/src/hooks/workflows.d.ts.map +1 -1
  109. package/dist/src/hooks/workflows.js +7 -13
  110. package/dist/src/hooks/workflows.js.map +1 -1
  111. package/dist/src/index.d.ts +12 -3
  112. package/dist/src/index.d.ts.map +1 -1
  113. package/dist/src/index.js +12 -3
  114. package/dist/src/index.js.map +1 -1
  115. package/dist/src/interfaces.d.ts +309 -21
  116. package/dist/src/interfaces.d.ts.map +1 -1
  117. package/dist/src/interfaces.js +10 -0
  118. package/dist/src/interfaces.js.map +1 -1
  119. package/dist/src/metrics.d.ts.map +1 -1
  120. package/dist/src/metrics.js +5 -0
  121. package/dist/src/metrics.js.map +1 -1
  122. package/dist/src/namespaces.d.ts +17 -0
  123. package/dist/src/namespaces.d.ts.map +1 -0
  124. package/dist/src/namespaces.js +24 -0
  125. package/dist/src/namespaces.js.map +1 -0
  126. package/dist/src/on-error.d.ts +4 -1
  127. package/dist/src/on-error.d.ts.map +1 -1
  128. package/dist/src/on-error.js +15 -2
  129. package/dist/src/on-error.js.map +1 -1
  130. package/dist/src/otel/durable-metrics.d.ts.map +1 -1
  131. package/dist/src/otel/durable-metrics.js +5 -0
  132. package/dist/src/otel/durable-metrics.js.map +1 -1
  133. package/dist/src/otel/durable-otel.d.ts.map +1 -1
  134. package/dist/src/otel/durable-otel.js +5 -0
  135. package/dist/src/otel/durable-otel.js.map +1 -1
  136. package/dist/src/pollers.d.ts +10 -1
  137. package/dist/src/pollers.d.ts.map +1 -1
  138. package/dist/src/pollers.js +15 -5
  139. package/dist/src/pollers.js.map +1 -1
  140. package/dist/src/protocol.d.ts +12 -0
  141. package/dist/src/protocol.d.ts.map +1 -1
  142. package/dist/src/protocol.js +27 -1
  143. package/dist/src/protocol.js.map +1 -1
  144. package/dist/src/remote-event.d.ts +6 -0
  145. package/dist/src/remote-event.d.ts.map +1 -0
  146. package/dist/src/remote-event.js +19 -0
  147. package/dist/src/remote-event.js.map +1 -0
  148. package/dist/src/remote-workflow-executor.d.ts +34 -12
  149. package/dist/src/remote-workflow-executor.d.ts.map +1 -1
  150. package/dist/src/remote-workflow-executor.js +42 -40
  151. package/dist/src/remote-workflow-executor.js.map +1 -1
  152. package/dist/src/run-detail-summary.d.ts +90 -3
  153. package/dist/src/run-detail-summary.d.ts.map +1 -1
  154. package/dist/src/run-detail-summary.js +360 -2
  155. package/dist/src/run-detail-summary.js.map +1 -1
  156. package/dist/src/run-facets.d.ts +48 -0
  157. package/dist/src/run-facets.d.ts.map +1 -0
  158. package/dist/src/run-facets.js +100 -0
  159. package/dist/src/run-facets.js.map +1 -0
  160. package/dist/src/run-gateway/interface.d.ts +27 -1
  161. package/dist/src/run-gateway/interface.d.ts.map +1 -1
  162. package/dist/src/run-gateway/proxy-run-gateway.d.ts +32 -4
  163. package/dist/src/run-gateway/proxy-run-gateway.d.ts.map +1 -1
  164. package/dist/src/run-gateway/proxy-run-gateway.js +101 -5
  165. package/dist/src/run-gateway/proxy-run-gateway.js.map +1 -1
  166. package/dist/src/run-gateway/run-request-responder.d.ts +18 -5
  167. package/dist/src/run-gateway/run-request-responder.d.ts.map +1 -1
  168. package/dist/src/run-gateway/run-request-responder.js +155 -32
  169. package/dist/src/run-gateway/run-request-responder.js.map +1 -1
  170. package/dist/src/run-gateway/store-run-gateway.d.ts +23 -1
  171. package/dist/src/run-gateway/store-run-gateway.d.ts.map +1 -1
  172. package/dist/src/run-gateway/store-run-gateway.js +38 -0
  173. package/dist/src/run-gateway/store-run-gateway.js.map +1 -1
  174. package/dist/src/scheduler.d.ts +44 -3
  175. package/dist/src/scheduler.d.ts.map +1 -1
  176. package/dist/src/scheduler.js +36 -1
  177. package/dist/src/scheduler.js.map +1 -1
  178. package/dist/src/search-attributes-schema.d.ts +44 -0
  179. package/dist/src/search-attributes-schema.d.ts.map +1 -0
  180. package/dist/src/search-attributes-schema.js +51 -0
  181. package/dist/src/search-attributes-schema.js.map +1 -0
  182. package/dist/src/singleton-admission.d.ts +75 -0
  183. package/dist/src/singleton-admission.d.ts.map +1 -0
  184. package/dist/src/singleton-admission.js +156 -0
  185. package/dist/src/singleton-admission.js.map +1 -0
  186. package/dist/src/singleton-gate.d.ts +23 -8
  187. package/dist/src/singleton-gate.d.ts.map +1 -1
  188. package/dist/src/singleton-gate.js +59 -12
  189. package/dist/src/singleton-gate.js.map +1 -1
  190. package/dist/src/standard-schema.d.ts +86 -0
  191. package/dist/src/standard-schema.d.ts.map +1 -0
  192. package/dist/src/standard-schema.js +33 -0
  193. package/dist/src/standard-schema.js.map +1 -0
  194. package/dist/src/step-discovery.d.ts +21 -11
  195. package/dist/src/step-discovery.d.ts.map +1 -1
  196. package/dist/src/step-discovery.js +86 -45
  197. package/dist/src/step-discovery.js.map +1 -1
  198. package/dist/src/step-ref.d.ts +38 -12
  199. package/dist/src/step-ref.d.ts.map +1 -1
  200. package/dist/src/step-ref.js +5 -13
  201. package/dist/src/step-ref.js.map +1 -1
  202. package/dist/src/stores/factory.d.ts +6 -0
  203. package/dist/src/stores/factory.d.ts.map +1 -1
  204. package/dist/src/stores/factory.js +4 -1
  205. package/dist/src/stores/factory.js.map +1 -1
  206. package/dist/src/stores/lucid-helpers.d.ts +2 -0
  207. package/dist/src/stores/lucid-helpers.d.ts.map +1 -1
  208. package/dist/src/stores/lucid-helpers.js +7 -0
  209. package/dist/src/stores/lucid-helpers.js.map +1 -1
  210. package/dist/src/stores/lucid-mappers.d.ts +25 -0
  211. package/dist/src/stores/lucid-mappers.d.ts.map +1 -1
  212. package/dist/src/stores/lucid-mappers.js +81 -18
  213. package/dist/src/stores/lucid-mappers.js.map +1 -1
  214. package/dist/src/stores/lucid-schema.d.ts +59 -1
  215. package/dist/src/stores/lucid-schema.d.ts.map +1 -1
  216. package/dist/src/stores/lucid-schema.js +271 -25
  217. package/dist/src/stores/lucid-schema.js.map +1 -1
  218. package/dist/src/stores/lucid.d.ts +61 -2
  219. package/dist/src/stores/lucid.d.ts.map +1 -1
  220. package/dist/src/stores/lucid.js +346 -41
  221. package/dist/src/stores/lucid.js.map +1 -1
  222. package/dist/src/telescope/dashboard.d.ts.map +1 -1
  223. package/dist/src/telescope/dashboard.js +30 -1
  224. package/dist/src/telescope/dashboard.js.map +1 -1
  225. package/dist/src/telescope/data-providers.d.ts +19 -1
  226. package/dist/src/telescope/data-providers.d.ts.map +1 -1
  227. package/dist/src/telescope/data-providers.js +119 -3
  228. package/dist/src/telescope/data-providers.js.map +1 -1
  229. package/dist/src/telescope/extension.d.ts.map +1 -1
  230. package/dist/src/telescope/extension.js +2 -1
  231. package/dist/src/telescope/extension.js.map +1 -1
  232. package/dist/src/telescope/index.d.ts +1 -1
  233. package/dist/src/telescope/index.d.ts.map +1 -1
  234. package/dist/src/telescope/index.js +1 -1
  235. package/dist/src/telescope/index.js.map +1 -1
  236. package/dist/src/testing/in-memory-state-store.d.ts +44 -15
  237. package/dist/src/testing/in-memory-state-store.d.ts.map +1 -1
  238. package/dist/src/testing/in-memory-state-store.js +204 -41
  239. package/dist/src/testing/in-memory-state-store.js.map +1 -1
  240. package/dist/src/testing-kit/checkpoint-aggregation-contract.d.ts +16 -0
  241. package/dist/src/testing-kit/checkpoint-aggregation-contract.d.ts.map +1 -0
  242. package/dist/src/testing-kit/checkpoint-aggregation-contract.js +228 -0
  243. package/dist/src/testing-kit/checkpoint-aggregation-contract.js.map +1 -0
  244. package/dist/src/testing-kit/state-store-conformance.d.ts.map +1 -1
  245. package/dist/src/testing-kit/state-store-conformance.js +355 -3
  246. package/dist/src/testing-kit/state-store-conformance.js.map +1 -1
  247. package/dist/src/transport-pool.d.ts +15 -1
  248. package/dist/src/transport-pool.d.ts.map +1 -1
  249. package/dist/src/transport-pool.js +50 -4
  250. package/dist/src/transport-pool.js.map +1 -1
  251. package/dist/src/transports/adaptive-concurrency.d.ts +168 -0
  252. package/dist/src/transports/adaptive-concurrency.d.ts.map +1 -0
  253. package/dist/src/transports/adaptive-concurrency.js +353 -0
  254. package/dist/src/transports/adaptive-concurrency.js.map +1 -0
  255. package/dist/src/transports/bullmq/adaptive-concurrency.d.ts +1 -165
  256. package/dist/src/transports/bullmq/adaptive-concurrency.d.ts.map +1 -1
  257. package/dist/src/transports/bullmq/adaptive-concurrency.js +3 -351
  258. package/dist/src/transports/bullmq/adaptive-concurrency.js.map +1 -1
  259. package/dist/src/transports/bullmq/bullmq-transport.d.ts +49 -1
  260. package/dist/src/transports/bullmq/bullmq-transport.d.ts.map +1 -1
  261. package/dist/src/transports/bullmq/bullmq-transport.js +330 -38
  262. package/dist/src/transports/bullmq/bullmq-transport.js.map +1 -1
  263. package/dist/src/transports/bullmq/deps.d.ts +18 -2
  264. package/dist/src/transports/bullmq/deps.d.ts.map +1 -1
  265. package/dist/src/transports/bullmq/deps.js +44 -2
  266. package/dist/src/transports/bullmq/deps.js.map +1 -1
  267. package/dist/src/transports/db-helpers.d.ts +39 -0
  268. package/dist/src/transports/db-helpers.d.ts.map +1 -1
  269. package/dist/src/transports/db-helpers.js +73 -0
  270. package/dist/src/transports/db-helpers.js.map +1 -1
  271. package/dist/src/transports/db-remote.d.ts +53 -0
  272. package/dist/src/transports/db-remote.d.ts.map +1 -0
  273. package/dist/src/transports/db-remote.js +147 -0
  274. package/dist/src/transports/db-remote.js.map +1 -0
  275. package/dist/src/transports/db-schema.d.ts +44 -1
  276. package/dist/src/transports/db-schema.d.ts.map +1 -1
  277. package/dist/src/transports/db-schema.js +227 -88
  278. package/dist/src/transports/db-schema.js.map +1 -1
  279. package/dist/src/transports/db.d.ts +189 -6
  280. package/dist/src/transports/db.d.ts.map +1 -1
  281. package/dist/src/transports/db.js +1291 -137
  282. package/dist/src/transports/db.js.map +1 -1
  283. package/dist/src/transports/event-emitter.d.ts +8 -0
  284. package/dist/src/transports/event-emitter.d.ts.map +1 -1
  285. package/dist/src/transports/event-emitter.js +36 -3
  286. package/dist/src/transports/event-emitter.js.map +1 -1
  287. package/dist/src/transports/factory.d.ts +110 -5
  288. package/dist/src/transports/factory.d.ts.map +1 -1
  289. package/dist/src/transports/factory.js +56 -9
  290. package/dist/src/transports/factory.js.map +1 -1
  291. package/dist/src/transports/queue-mock-adapter.d.ts +7 -2
  292. package/dist/src/transports/queue-mock-adapter.d.ts.map +1 -1
  293. package/dist/src/transports/queue-mock-adapter.js +18 -2
  294. package/dist/src/transports/queue-mock-adapter.js.map +1 -1
  295. package/dist/src/transports/queue-remote.d.ts +146 -0
  296. package/dist/src/transports/queue-remote.d.ts.map +1 -0
  297. package/dist/src/transports/queue-remote.js +398 -0
  298. package/dist/src/transports/queue-remote.js.map +1 -0
  299. package/dist/src/transports/queue.d.ts +159 -6
  300. package/dist/src/transports/queue.d.ts.map +1 -1
  301. package/dist/src/transports/queue.js +747 -37
  302. package/dist/src/transports/queue.js.map +1 -1
  303. package/dist/src/transports/task-failure.d.ts +31 -0
  304. package/dist/src/transports/task-failure.d.ts.map +1 -0
  305. package/dist/src/transports/task-failure.js +50 -0
  306. package/dist/src/transports/task-failure.js.map +1 -0
  307. package/dist/src/workflow-als.d.ts +1 -1
  308. package/dist/src/workflow-als.d.ts.map +1 -1
  309. package/dist/src/workflow-ctx.d.ts +10 -0
  310. package/dist/src/workflow-ctx.d.ts.map +1 -1
  311. package/dist/src/workflow-ctx.js +97 -15
  312. package/dist/src/workflow-ctx.js.map +1 -1
  313. package/dist/src/workflow-discovery.d.ts +32 -41
  314. package/dist/src/workflow-discovery.d.ts.map +1 -1
  315. package/dist/src/workflow-discovery.js +65 -88
  316. package/dist/src/workflow-discovery.js.map +1 -1
  317. package/dist/src/workflow-ref.d.ts +26 -0
  318. package/dist/src/workflow-ref.d.ts.map +1 -1
  319. package/dist/src/workflow-ref.js.map +1 -1
  320. package/dist/stubs/config/durable.stub +6 -0
  321. package/dist/stubs/config/durable_dashboard.stub +7 -3
  322. package/dist/stubs/database/migrations/create_durable_tables.stub +2 -1
  323. package/dist/stubs/database/migrations/create_durable_transport_messages.stub +43 -0
  324. package/dist/stubs/database/migrations/create_durable_transport_tables.stub +12 -9
  325. package/dist/stubs/database/migrations/create_durable_transport_worker_keys.stub +1 -1
  326. package/dist/stubs/make/workflow/main.stub +1 -1
  327. package/package.json +6 -4
  328. package/skills/durable-cluster/SKILL.md +80 -11
  329. package/skills/durable-determinism/SKILL.md +11 -5
  330. package/skills/durable-reliability/SKILL.md +77 -37
  331. package/skills/durable-setup/SKILL.md +51 -22
  332. package/skills/durable-transports-stores/SKILL.md +128 -18
  333. package/skills/durable-workflows/SKILL.md +83 -18
  334. package/dist/assets/spa/assets/index-DdB9zxuX.js +0 -16
  335. package/dist/assets/spa/assets/index-DdB9zxuX.js.map +0 -1
@@ -1,25 +1,28 @@
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';
2
+ import { validateStandard } from './standard-schema.js';
4
3
  import { DURABLE_STEP_NAME } from './step-name-symbol.js';
5
4
  import { stepMetaOf } from './step-ref.js';
6
- import { pickModuleExt } from './workflow-discovery.js';
7
- /** Wrap a handler with the opt-in zod validation its `@Step`/`defineStep` metadata declared: `input`
8
- * is parsed before the body runs, `output` before the result is handed back. A handler with neither
9
- * schema is served as-is (compile-time types only). */
5
+ /** Wrap a handler with the opt-in Standard Schema validation its `@Step`/`defineStep` metadata
6
+ * declared: `input` is validated before the body runs (the body receives the schema's OUTPUT value),
7
+ * `output` before the result is handed back. A failure throws a non-retryable
8
+ * `SchemaValidationError`. A handler with neither schema is served as-is (compile-time types only). */
10
9
  function validating(step) {
11
10
  const { meta, handler } = step;
12
11
  if (!meta.input && !meta.output)
13
12
  return handler;
14
13
  return async (input, log) => {
15
- const parsed = meta.input ? meta.input.parse(input) : input;
14
+ const parsed = meta.input
15
+ ? await validateStandard(meta.input, input, `step "${meta.name}" input`, 'invalid_input')
16
+ : input;
16
17
  const output = await handler(parsed, log);
17
- return meta.output ? meta.output.parse(output) : output;
18
+ return meta.output
19
+ ? validateStandard(meta.output, output, `step "${meta.name}" output`, 'invalid_output')
20
+ : output;
18
21
  };
19
22
  }
20
23
  /**
21
24
  * Register a single discovered step on `server` under its stamped name, wrapping it with any
22
- * declared zod validation. The low-level `transport.handle(name, fn)` stays the escape hatch — this
25
+ * declared schema validation. The low-level `transport.handle(name, fn)` stays the escape hatch — this
23
26
  * is the convention the `app/steps` discovery builds on.
24
27
  */
25
28
  export function registerStep(server, step) {
@@ -77,32 +80,65 @@ export function registerSteps(server, exports) {
77
80
  }
78
81
  return registered;
79
82
  }
83
+ /** The routing names an export would serve, read off its stamps WITHOUT instantiating anything. */
84
+ function stepNamesOf(exported) {
85
+ const direct = stepMetaOf(exported);
86
+ if (direct)
87
+ return [direct.name];
88
+ if (typeof exported !== 'function' || !exported.prototype)
89
+ return [];
90
+ const proto = exported.prototype;
91
+ const names = [];
92
+ for (const key of Object.getOwnPropertyNames(proto)) {
93
+ const value = proto[key];
94
+ if (typeof value !== 'function')
95
+ continue;
96
+ const name = stepMetaOf(value)?.name;
97
+ if (name)
98
+ names.push(name);
99
+ }
100
+ return names;
101
+ }
80
102
  /**
81
- * Scan `dir` RECURSIVELY for modules and register every exported `@Step` class / `defineStep`
82
- * handler on `server` — the `app/steps` convention, mirroring `app/workflows` discovery. Only the
83
- * extension present in `dir` is imported (see {@link pickModuleExt}). Missing directory → no-op
84
- * (the convention is opt-in). Returns the registered metadata.
103
+ * Register every step reachable from `modules`, in order. Per module this is exactly
104
+ * {@link registerSteps} — the single-directory behaviour, kept as-is: inside one root a name served
105
+ * twice is served by the later module.
106
+ *
107
+ * Across roots, a step name already served from another root by a DIFFERENT export throws a
108
+ * {@link DuplicateDiscoveryError} naming both files — checked for every module BEFORE any handler is
109
+ * registered, so a clash never leaves a half-served transport. The same export reachable from two
110
+ * roots (a re-export, or overlapping roots) is served once.
85
111
  */
86
- export async function registerStepsFromDir(server, dir) {
87
- let entries;
88
- try {
89
- entries = await readdir(dir, { recursive: true });
90
- }
91
- catch (err) {
92
- if (err.code === 'ENOENT')
93
- return [];
94
- throw err;
112
+ async function registerStepModules(server, modules) {
113
+ const owners = new Map();
114
+ const plan = [];
115
+ for (const { root, file, load } of modules) {
116
+ const mod = await load();
117
+ const exports = [];
118
+ for (const exported of Object.values(mod)) {
119
+ let servedElsewhere = false;
120
+ for (const name of stepNamesOf(exported)) {
121
+ const owner = owners.get(name);
122
+ if (!owner) {
123
+ owners.set(name, { root, file, source: exported });
124
+ continue;
125
+ }
126
+ if (owner.root === root)
127
+ continue;
128
+ if (owner.source !== exported) {
129
+ throw new DuplicateDiscoveryError('step', name, [owner.file, file]);
130
+ }
131
+ servedElsewhere = true;
132
+ }
133
+ if (!servedElsewhere)
134
+ exports.push(exported);
135
+ }
136
+ plan.push(exports);
95
137
  }
96
- const moduleExt = pickModuleExt(entries);
97
138
  const registered = [];
98
- if (moduleExt === null)
99
- return registered;
100
139
  const seen = new Set();
101
- for (const entry of entries.sort()) {
102
- if (extname(entry) !== moduleExt || entry.endsWith(`.d${moduleExt}`))
103
- continue;
104
- const mod = (await import(pathToFileURL(join(dir, entry)).href));
105
- for (const meta of registerSteps(server, Object.values(mod))) {
140
+ for (const exports of plan) {
141
+ for (const meta of registerSteps(server, exports)) {
106
142
  if (seen.has(meta.name))
107
143
  continue;
108
144
  seen.add(meta.name);
@@ -111,20 +147,25 @@ export async function registerStepsFromDir(server, dir) {
111
147
  }
112
148
  return registered;
113
149
  }
114
- /** Register every `@Step`/`defineStep` reachable from a generated {@link StepsBarrel} onto `server`
115
- * — the build-time equivalent of {@link registerStepsFromDir} with no runtime `readdir`. */
150
+ /**
151
+ * Scan `dir` — one directory or several — RECURSIVELY and register every exported `@Step` class /
152
+ * `defineStep` handler on `server`: the `app/steps` convention, mirroring `app/workflows` discovery.
153
+ * Only the extension present in each directory is imported (see `pickModuleExt`). Missing
154
+ * directory → nothing from it (the convention is opt-in). With several directories the same step
155
+ * name defined by different handlers in two of them throws a {@link DuplicateDiscoveryError}.
156
+ * Returns the registered metadata.
157
+ *
158
+ * `server` is anything with `handle(name, fn)`: a transport, the store-less `WorkerRuntime`, or the
159
+ * `WorkflowEngine` itself (it forwards to its primary transport) — the latter is how app code
160
+ * serves an extra directory from a preload: `await registerStepsFromDir(engine, dir)`.
161
+ */
162
+ export async function registerStepsFromDir(server, dir) {
163
+ return registerStepModules(server, await scanDirsModules(typeof dir === 'string' ? [dir] : dir));
164
+ }
165
+ /** Register every `@Step`/`defineStep` reachable from a generated {@link StepsBarrel} (or a
166
+ * multi-root {@link RootedBarrel} array) onto `server` — the build-time equivalent of
167
+ * {@link registerStepsFromDir} with no runtime `readdir`, same cross-root duplicate rule. */
116
168
  export async function registerStepsFromBarrel(server, barrel) {
117
- const registered = [];
118
- const seen = new Set();
119
- for (const load of Object.values(barrel)) {
120
- const mod = await load();
121
- for (const meta of registerSteps(server, Object.values(mod))) {
122
- if (seen.has(meta.name))
123
- continue;
124
- seen.add(meta.name);
125
- registered.push(meta);
126
- }
127
- }
128
- return registered;
169
+ return registerStepModules(server, barrelModules(barrel));
129
170
  }
130
171
  //# sourceMappingURL=step-discovery.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"step-discovery.js","sourceRoot":"","sources":["../../src/step-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;AAGzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAwB,UAAU,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAcxD;;wDAEwD;AACxD,SAAS,UAAU,CAAC,IAAoB;IACtC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAC/B,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,MAAM;QAAE,OAAO,OAAO,CAAC;IAChD,OAAO,KAAK,EAAE,KAAc,EAAE,GAAe,EAAE,EAAE;QAC/C,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,C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AAe,CAAC,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AACnG,CAAC;AAQD;;8FAE8F;AAC9F,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,MAAkB,EAClB,MAA6C;IAE7C,OAAO,mBAAmB,CAAC,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;AAC5D,CAAC"}
@@ -1,30 +1,33 @@
1
- import type { z } from 'zod';
2
1
  import type { BackoffStrategy, StepLogger } from './interfaces.js';
2
+ import type { StandardSchemaV1 } from './standard-schema.js';
3
3
  import { type StepRef } from './step-name-symbol.js';
4
4
  /**
5
5
  * The full metadata a `@Step` / {@link defineStep} stamps on a step handler for discovery: its
6
- * resolved routing `name` plus the opt-in runtime zod schemas an authoring layer attached. Stamped
6
+ * resolved routing `name` plus the opt-in runtime Standard Schemas (zod, valibot, arktype, …) an
7
+ * authoring layer attached. Stamped
7
8
  * under {@link DURABLE_STEP_META} on the handler function so step discovery can wrap it with
8
9
  * validation at the serve boundary. A global-registry symbol so it survives duplicate copies.
9
10
  */
10
11
  export declare const DURABLE_STEP_META: unique symbol;
11
- /** Discovery metadata a decorated/`defineStep` handler carries: routing name + optional zod schemas. */
12
+ /** Discovery metadata a decorated/`defineStep` handler carries: routing name + optional schemas. */
12
13
  export interface DurableStepMeta {
13
14
  /** The resolved routing name — derived (`Class.method`) or explicit, always present. */
14
15
  name: string;
15
16
  /** Opt-in runtime input schema, validated when the handler is served. Absent on a bare `@Step()`. */
16
- input?: z.ZodType | undefined;
17
+ input?: StandardSchemaV1 | undefined;
17
18
  /** Opt-in runtime output schema, validated before the handler's result is handed back. */
18
- output?: z.ZodType | undefined;
19
+ output?: StandardSchemaV1 | undefined;
19
20
  }
20
21
  /** Options for the object call form of {@link Step} / {@link defineStep}. */
21
22
  export interface StepDecoratorOptions {
22
23
  /** Explicit routing name, overriding the derived `Class.method`. */
23
24
  name?: string;
24
- /** Runtime input schema, validated at the serve boundary (opt-in — a bare `@Step()` skips it). */
25
- input?: z.ZodType;
26
- /** Runtime output schema, validated before the result is returned (opt-in). */
27
- output?: z.ZodType;
25
+ /** Runtime input schema — any Standard Schema (zod, valibot, arktype, …) — validated at the serve
26
+ * boundary (opt-in — a bare `@Step()` skips it). The handler receives the schema's OUTPUT value. */
27
+ input?: StandardSchemaV1;
28
+ /** Runtime output schema (any Standard Schema), validated before the result is returned (opt-in).
29
+ * The caller receives the schema's OUTPUT value. */
30
+ output?: StandardSchemaV1;
28
31
  /** Def-level policy: max attempts before the step (and run) fails. Read by `ctx.step` via `stepConfigOf`. */
29
32
  retries?: number;
30
33
  /** How the delay between retries grows: `fixed` (constant) or `exp` (doubles each attempt). */
@@ -45,6 +48,8 @@ export interface StepDecoratorOptions {
45
48
  * protocol-compatible the run parks `blocked` with a precise reason. Absent/empty = runs anywhere. */
46
49
  requires?: string[];
47
50
  }
51
+ /** {@link defineStep}'s options minus the schemas — the overloads add `input`/`output` typed. */
52
+ export type DefineStepOptions = Omit<StepDecoratorOptions, 'name' | 'input' | 'output'>;
48
53
  /**
49
54
  * Marks a class method as a durable **step handler**. A dispatched task is routed to it BY NAME —
50
55
  * `ctx.step(this.svc.method, input)` reads that same name off the method reference (the shared
@@ -56,21 +61,42 @@ export interface StepDecoratorOptions {
56
61
  * - `@Step()` — bare: the routing name is DERIVED as `` `${ClassName}.${method}` `` — refactor-safe.
57
62
  * - `@Step('custom:name')` — explicit name override (a stable cross-runtime contract).
58
63
  * - `@Step({ name?, input?, output?, retries?, backoff?, backoffMs?, backoffMaxMs?, jitter?,
59
- * timeoutMs? })` — optional name override, opt-in RUNTIME zod schemas (validated at the serve
60
- * boundary by step discovery), and a def-level durable-retry/liveness policy `ctx.step` reads via
64
+ * timeoutMs? })` — optional name override, opt-in RUNTIME Standard Schemas (zod, valibot,
65
+ * arktype, … — validated at the serve boundary by step discovery; a failure is a non-retryable
66
+ * `SchemaValidationError`), and a def-level durable-retry/liveness policy `ctx.step` reads via
61
67
  * `stepConfigOf` (a per-call `opts` overrides it field-by-field).
62
68
  */
63
69
  export declare function Step(nameOrOptions?: string | StepDecoratorOptions): MethodDecorator;
64
70
  /**
65
71
  * Build a durable step handler WITHOUT a class/decorator: stamps `fn` with the routing `name` (and
66
- * optional zod schemas + dispatch policy) so it works as a typed {@link StepRef} for
72
+ * optional Standard Schemas + dispatch policy) so it works as a typed {@link StepRef} for
67
73
  * `ctx.step(fn, input)` AND is discoverable/registerable by name. The cross-runtime baseline — pass
68
74
  * the returned ref to `ctx.step`, or register it on a transport via `registerStep`.
69
75
  *
70
76
  * ```ts
71
77
  * export const charge = defineStep('billing:charge', async (input: ChargeInput) => { ... })
72
78
  * ```
79
+ *
80
+ * With an `input` / `output` Standard Schema the types are INFERRED from it: the handler receives
81
+ * the input schema's output type (parsed/coerced), and the returned ref takes the input schema's
82
+ * input type and resolves to the output schema's output type — no hand-written annotation needed.
83
+ *
84
+ * ```ts
85
+ * const charge = defineStep('billing:charge', async (input) => ({ id: `ch_${input.amount}` }), {
86
+ * input: v.object({ amount: v.number() }), // valibot, zod, arktype, …
87
+ * })
88
+ * ```
73
89
  */
90
+ export declare function defineStep<SI extends StandardSchemaV1, SO extends StandardSchemaV1>(name: string, fn: (input: StandardSchemaV1.InferOutput<SI>, log: StepLogger) => StandardSchemaV1.InferInput<SO> | Promise<StandardSchemaV1.InferInput<SO>>, config: DefineStepOptions & {
91
+ input: SI;
92
+ output: SO;
93
+ }): StepRef<StandardSchemaV1.InferInput<SI>, StandardSchemaV1.InferOutput<SO>>;
94
+ export declare function defineStep<SI extends StandardSchemaV1, TOutput>(name: string, fn: (input: StandardSchemaV1.InferOutput<SI>, log: StepLogger) => TOutput | Promise<TOutput>, config: DefineStepOptions & {
95
+ input: SI;
96
+ }): StepRef<StandardSchemaV1.InferInput<SI>, TOutput>;
97
+ export declare function defineStep<TInput, SO extends StandardSchemaV1>(name: string, fn: (input: TInput, log: StepLogger) => StandardSchemaV1.InferInput<SO> | Promise<StandardSchemaV1.InferInput<SO>>, config: DefineStepOptions & {
98
+ output: SO;
99
+ }): StepRef<TInput, StandardSchemaV1.InferOutput<SO>>;
74
100
  export declare function defineStep<TInput, TOutput>(name: string, fn: (input: TInput, log: StepLogger) => TOutput | Promise<TOutput>, config?: Omit<StepDecoratorOptions, 'name'>): StepRef<TInput, TOutput>;
75
101
  /** Read the {@link DurableStepMeta} a `@Step`/`defineStep` stamped on a handler, or `undefined`. */
76
102
  export declare function stepMetaOf(ref: unknown): DurableStepMeta | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"step-ref.d.ts","sourceRoot":"","sources":["../../src/step-ref.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAIL,KAAK,OAAO,EACb,MAAM,uBAAuB,CAAC;AAE/B;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,OAAO,MAA+C,CAAC;AAEvF,wGAAwG;AACxG,MAAM,WAAW,eAAe;IAC9B,wFAAwF;IACxF,IAAI,EAAE,MAAM,CAAC;IACb,qGAAqG;IACrG,KAAK,CAAC,EAAE,CAAC,CAAC,OAAO,GAAG,SAAS,CAAC;IAC9B,0FAA0F;IAC1F,MAAM,CAAC,EAAE,CAAC,CAAC,OAAO,GAAG,SAAS,CAAC;CAChC;AAED,6EAA6E;AAC7E,MAAM,WAAW,oBAAoB;IACnC,oEAAoE;IACpE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kGAAkG;IAClG,KAAK,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC;IAClB,+EAA+E;IAC/E,MAAM,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC;IACnB,6GAA6G;IAC7G,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+FAA+F;IA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AK,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,EAClE,MAAM,CAAC,EAAE,IAAI,CAAC,oBAAoB,EAAE,MAAM,CAAC,GAC1C,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAe5B,oGAAoG;AACpG,wBAAgB,UAAU,CAAC,GAAG,EAAE,OAAO,GAAG,eAAe,GAAG,SAAS,CAGpE"}
@@ -1,7 +1,8 @@
1
1
  import { DURABLE_STEP_CONFIG, DURABLE_STEP_NAME, } from './step-name-symbol.js';
2
2
  /**
3
3
  * The full metadata a `@Step` / {@link defineStep} stamps on a step handler for discovery: its
4
- * resolved routing `name` plus the opt-in runtime zod schemas an authoring layer attached. Stamped
4
+ * resolved routing `name` plus the opt-in runtime Standard Schemas (zod, valibot, arktype, …) an
5
+ * authoring layer attached. Stamped
5
6
  * under {@link DURABLE_STEP_META} on the handler function so step discovery can wrap it with
6
7
  * validation at the serve boundary. A global-registry symbol so it survives duplicate copies.
7
8
  */
@@ -48,8 +49,9 @@ function stamp(fn, meta, config) {
48
49
  * - `@Step()` — bare: the routing name is DERIVED as `` `${ClassName}.${method}` `` — refactor-safe.
49
50
  * - `@Step('custom:name')` — explicit name override (a stable cross-runtime contract).
50
51
  * - `@Step({ name?, input?, output?, retries?, backoff?, backoffMs?, backoffMaxMs?, jitter?,
51
- * timeoutMs? })` — optional name override, opt-in RUNTIME zod schemas (validated at the serve
52
- * boundary by step discovery), and a def-level durable-retry/liveness policy `ctx.step` reads via
52
+ * timeoutMs? })` — optional name override, opt-in RUNTIME Standard Schemas (zod, valibot,
53
+ * arktype, … — validated at the serve boundary by step discovery; a failure is a non-retryable
54
+ * `SchemaValidationError`), and a def-level durable-retry/liveness policy `ctx.step` reads via
53
55
  * `stepConfigOf` (a per-call `opts` overrides it field-by-field).
54
56
  */
55
57
  export function Step(nameOrOptions) {
@@ -69,16 +71,6 @@ export function Step(nameOrOptions) {
69
71
  stamp(value, meta, stepConfigFrom(options));
70
72
  });
71
73
  }
72
- /**
73
- * Build a durable step handler WITHOUT a class/decorator: stamps `fn` with the routing `name` (and
74
- * optional zod schemas + dispatch policy) so it works as a typed {@link StepRef} for
75
- * `ctx.step(fn, input)` AND is discoverable/registerable by name. The cross-runtime baseline — pass
76
- * the returned ref to `ctx.step`, or register it on a transport via `registerStep`.
77
- *
78
- * ```ts
79
- * export const charge = defineStep('billing:charge', async (input: ChargeInput) => { ... })
80
- * ```
81
- */
82
74
  export function defineStep(name, fn, config) {
83
75
  const meta = {
84
76
  name,
@@ -1 +1 @@
1
- {"version":3,"file":"step-ref.js","sourceRoot":"","sources":["../../src/step-ref.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,GAGlB,MAAM,uBAAuB,CAAC;AAE/B;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAkB,MAAM,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;AAyCvF;;uCAEuC;AACvC,SAAS,cAAc,CAAC,OAA6B;IACnD,MAAM,MAAM,GAAe,EAAE,CAAC;IAC9B,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS;QAAE,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IACpE,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS;QAAE,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IACpE,IAAI,OAAO,CAAC,SAAS,KAAK,SAAS;QAAE,MAAM,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;IAC1E,IAAI,OAAO,CAAC,YAAY,KAAK,SAAS;QAAE,MAAM,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;IACnF,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS;QAAE,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IACjE,IAAI,OAAO,CAAC,SAAS,KAAK,SAAS;QAAE,M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AAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACtD,CAAC;QACF,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IAC9C,CAAC,CAAoB,CAAC;AACxB,CAAC;AAgDD,MAAM,UAAU,UAAU,CACxB,IAAY,EACZ,EAA8C,EAC9C,MAA2C;IAE3C,MAAM,IAAI,GAAoB;QAC5B,IAAI;QACJ,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACjD,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACrD,CAAC;IACF,KAAK,CAAC,EAAE,EAAE,IAAI,EAAE,cAAc,CAAC,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACrD,OAAO,EAA0C,CAAC;AACpD,CAAC;AAED,oGAAoG;AACpG,MAAM,UAAU,UAAU,CAAC,GAAY;IACrC,IAAI,OAAO,GAAG,KAAK,UAAU,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IAC3E,OAAQ,GAAwD,EAAE,CAAC,iBAAiB,CAAC,CAAC;AACxF,CAAC"}
@@ -16,6 +16,12 @@ export type StoreFactory = (ctx: StoreContext) => Promise<StateStore>;
16
16
  export interface LucidStoreConfig {
17
17
  /** Lucid connection name to use. Defaults to the `Database` default connection. */
18
18
  connection?: string;
19
+ /**
20
+ * MySQL/MariaDB only: the collation the durable tables use — new tables are created with it and
21
+ * existing ones are converted to it at boot. Set it to your own tables' collation (e.g.
22
+ * `'utf8mb4_unicode_ci'`) so a JOIN against them doesn't fail with `Illegal mix of collations`.
23
+ */
24
+ collation?: string;
19
25
  }
20
26
  /**
21
27
  * The store factory namespace used in `config/durable.ts`:
@@ -1 +1 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/stores/factory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAEjE;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,gBAAgB,CAAC;AAE5C;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE,YAAY,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtE,qDAAqD;AACrD,MAAM,WAAW,gBAAgB;IAC/B,mFAAmF;IACnF,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,MAAM;IACjB,4EAA4E;IAC5E,KAAK,UAAS,gBAAgB,GAAQ,YAAY;CAUnD,CAAC"}
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/stores/factory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAEjE;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,gBAAgB,CAAC;AAE5C;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE,YAAY,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtE,qDAAqD;AACrD,MAAM,WAAW,gBAAgB;IAC/B,mFAAmF;IACnF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,MAAM;IACjB,4EAA4E;IAC5E,KAAK,UAAS,gBAAgB,GAAQ,YAAY;CAUnD,CAAC"}
@@ -23,7 +23,10 @@ export const stores = {
23
23
  return async (ctx) => {
24
24
  const db = (await resolveLucidDatabase(ctx));
25
25
  const { LucidStateStore } = await import('./lucid.js');
26
- return new LucidStateStore(db, config.connection !== undefined ? { connectionName: config.connection } : {});
26
+ return new LucidStateStore(db, {
27
+ ...(config.connection !== undefined ? { connectionName: config.connection } : {}),
28
+ ...(config.collation !== undefined ? { collation: config.collation } : {}),
29
+ });
27
30
  };
28
31
  },
29
32
  };
@@ -1 +1 @@
1
- {"version":3,"file":"factory.js","sourceRoot":"","sources":["../../../src/stores/factory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAuB9D;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,4EAA4E;IAC5E,KAAK,CAAC,MAAM,GAAqB,EAAE;QACjC,OAAO,KAAK,EAAE,GAAG,EAAE,EAAE;YACnB,MAAM,EAAE,GAAG,CAAC,MAAM,oBAAoB,CAAC,GAAG,CAAC,CAAa,CAAC;YACzD,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC;YACvD,OAAO,IAAI,eAAe,CACxB,EAAE,EACF,MAAM,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAC7E,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;CACF,CAAC"}
1
+ {"version":3,"file":"factory.js","sourceRoot":"","sources":["../../../src/stores/factory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AA6B9D;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,4EAA4E;IAC5E,KAAK,CAAC,MAAM,GAAqB,EAAE;QACjC,OAAO,KAAK,EAAE,GAAG,EAAE,EAAE;YACnB,MAAM,EAAE,GAAG,CAAC,MAAM,oBAAoB,CAAC,GAAG,CAAC,CAAa,CAAC;YACzD,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC;YACvD,OAAO,IAAI,eAAe,CAAC,EAAE,EAAE;gBAC7B,GAAG,CAAC,MAAM,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACjF,GAAG,CAAC,MAAM,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC3E,CAAC,CAAC;QACL,CAAC,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -8,4 +8,6 @@ import { Database } from '@adonisjs/lucid/database';
8
8
  export declare function makeMemoryDb(): Database;
9
9
  /** A fresh in-memory db with the durable tables already created. */
10
10
  export declare function makeStoreDb(): Promise<Database>;
11
+ /** A fresh isolated Postgres schema (see `makeIsolatedPostgresDb`) with the durable tables created. */
12
+ export declare function makePostgresStoreDb(url: string): Promise<Database>;
11
13
  //# sourceMappingURL=lucid-helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lucid-helpers.d.ts","sourceRoot":"","sources":["../../../src/stores/lucid-helpers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGpD;;;;;GAKG;AACH,wBAAgB,YAAY,IAAI,QAAQ,CAwBvC;AAED,oEAAoE;AACpE,wBAAsB,WAAW,IAAI,OAAO,CAAC,QAAQ,CAAC,CAIrD"}
1
+ {"version":3,"file":"lucid-helpers.d.ts","sourceRoot":"","sources":["../../../src/stores/lucid-helpers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAIpD;;;;;GAKG;AACH,wBAAgB,YAAY,IAAI,QAAQ,CAwBvC;AAED,oEAAoE;AACpE,wBAAsB,WAAW,IAAI,OAAO,CAAC,QAAQ,CAAC,CAIrD;AAED,uGAAuG;AACvG,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAIxE"}
@@ -1,6 +1,7 @@
1
1
  import { Emitter } from '@adonisjs/core/events';
2
2
  import { Logger } from '@adonisjs/core/logger';
3
3
  import { Database } from '@adonisjs/lucid/database';
4
+ import { makeIsolatedPostgresDb } from '../transports/db-helpers.js';
4
5
  import { createDurableTables } from './lucid-schema.js';
5
6
  /**
6
7
  * Build a standalone Lucid `Database` pointed at an in-memory SQLite (`better-sqlite3`) — the
@@ -35,4 +36,10 @@ export async function makeStoreDb() {
35
36
  await createDurableTables(db);
36
37
  return db;
37
38
  }
39
+ /** A fresh isolated Postgres schema (see `makeIsolatedPostgresDb`) with the durable tables created. */
40
+ export async function makePostgresStoreDb(url) {
41
+ const db = await makeIsolatedPostgresDb(url);
42
+ await createDurableTables(db);
43
+ return db;
44
+ }
38
45
  //# sourceMappingURL=lucid-helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lucid-helpers.js","sourceRoot":"","sources":["../../../src/stores/lucid-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,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD;;;;;GAKG;AACH,MAAM,UAAU,YAAY;IAC1B,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;IAC9C,kG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AChD,MAAM,EAAE,GAAG,IAAI,QAAQ,CACrB;QACE,UAAU,EAAE,QAAQ;QACpB,WAAW,EAAE;YACX,MAAM,EAAE;gBACN,MAAM,EAAE,gBAAgB;gBACxB,UAAU,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE;gBACpC,gBAAgB,EAAE,IAAI;gBACtB,uFAAuF;gBACvF,2FAA2F;gBAC3F,8BAA8B;gBAC9B,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE;aACzB;SACF;KACF,EACD,MAAM,EACN,OAAO,CACR,CAAC;IACF,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,oEAAoE;AACpE,MAAM,CAAC,KAAK,UAAU,WAAW;IAC/B,MAAM,EAAE,GAAG,YAAY,EAAE,CAAC;IAC1B,MAAM,mBAAmB,CAAC,EAAE,CAAC,CAAC;IAC9B,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,uGAAuG;AACvG,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,GAAW;IACnD,MAAM,EAAE,GAAG,MAAM,sBAAsB,CAAC,GAAG,CAAC,CAAC;IAC7C,MAAM,mBAAmB,CAAC,EAAE,CAAC,CAAC;IAC9B,OAAO,EAAE,CAAC;AACZ,CAAC"}
@@ -26,6 +26,8 @@ export interface RunRow {
26
26
  tags: string | null;
27
27
  search_attributes: string | null;
28
28
  priority: number | string | null;
29
+ /** Nullable + optional: the column arrived in a later schema wave (multi-instance remote decisions). */
30
+ awaiting_decision_task_id?: string | null;
29
31
  created_at: number | string;
30
32
  updated_at: number | string;
31
33
  }
@@ -55,6 +57,29 @@ export interface CheckpointRow {
55
57
  last_heartbeat_at?: number | string | null;
56
58
  heartbeat_progress?: string | null;
57
59
  }
60
+ /** Where a column held text that is not JSON — see {@link parseJsonColumn}. */
61
+ export interface CorruptJsonColumn {
62
+ /** `<table>.<column>`, e.g. `durable_step_checkpoints.events`. */
63
+ column: string;
64
+ /** The row's key: a run id, `runId#seq`, a schedule id, a buffered row id. */
65
+ row: string;
66
+ /** The parse error's message. */
67
+ message: string;
68
+ }
69
+ /**
70
+ * Route the corrupt-column report of the Lucid store (default: one `console.warn` per row and
71
+ * column) — to a logger or an error tracker; the store keeps reading either way. Returns the
72
+ * previous reporter. Installing one resets the once-per-row memory.
73
+ */
74
+ export declare function onCorruptJsonColumn(reporter: (info: CorruptJsonColumn) => void): (info: CorruptJsonColumn) => void;
75
+ /**
76
+ * Parse a TEXT JSON column back to its value, treating NULL as "absent". A value that is not JSON — a
77
+ * MySQL `text` column cut off at 64KB before the schema used `longtext`, or a row edited by hand —
78
+ * reads back as `undefined` and is reported once (see {@link onCorruptJsonColumn}) instead of
79
+ * throwing: a throw here fails every read that touches the row, so one broken checkpoint used to take
80
+ * down `listRuns`, the dashboard and the run detail, not just its own field.
81
+ */
82
+ export declare function parseJsonColumn<T>(value: string | null | undefined, column: string, row: string): T | undefined;
58
83
  export declare function runToRow(run: WorkflowRun): RunRow;
59
84
  /**
60
85
  * Map a run patch to a column patch using presence (`'x' in patch`) semantics for nullable fields, so
@@ -1 +1 @@
1
- {"version":3,"file":"lucid-mappers.d.ts","sourceRoot":"","sources":["../../../src/stores/lucid-mappers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,cAAc,EAGd,WAAW,EACZ,MAAM,kBAAkB,CAAC;AAE1B;;;;;;;;GAQG;AACH,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,2FAA2F;IAC3F,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,KAAK,EAAE,MAA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