@shipfox/api-workflows 2.0.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 (661) hide show
  1. package/.turbo/turbo-build.log +2 -0
  2. package/.turbo/turbo-type$colon$emit.log +1 -0
  3. package/.turbo/turbo-type.log +1 -0
  4. package/CHANGELOG.md +311 -0
  5. package/LICENSE +21 -0
  6. package/dist/core/agent-tool-capability-warning.d.ts +7 -0
  7. package/dist/core/agent-tool-capability-warning.d.ts.map +1 -0
  8. package/dist/core/agent-tool-capability-warning.js +149 -0
  9. package/dist/core/agent-tool-capability-warning.js.map +1 -0
  10. package/dist/core/agent-tools.d.ts +51 -0
  11. package/dist/core/agent-tools.d.ts.map +1 -0
  12. package/dist/core/agent-tools.js +296 -0
  13. package/dist/core/agent-tools.js.map +1 -0
  14. package/dist/core/checkout.d.ts +29 -0
  15. package/dist/core/checkout.d.ts.map +1 -0
  16. package/dist/core/checkout.js +42 -0
  17. package/dist/core/checkout.js.map +1 -0
  18. package/dist/core/condition-trace.d.ts +13 -0
  19. package/dist/core/condition-trace.d.ts.map +1 -0
  20. package/dist/core/condition-trace.js +51 -0
  21. package/dist/core/condition-trace.js.map +1 -0
  22. package/dist/core/entities/index.d.ts +5 -0
  23. package/dist/core/entities/index.d.ts.map +1 -0
  24. package/dist/core/entities/index.js +3 -0
  25. package/dist/core/entities/index.js.map +1 -0
  26. package/dist/core/entities/job-execution.d.ts +30 -0
  27. package/dist/core/entities/job-execution.d.ts.map +1 -0
  28. package/dist/core/entities/job-execution.js +3 -0
  29. package/dist/core/entities/job-execution.js.map +1 -0
  30. package/dist/core/entities/job-listener-event.d.ts +15 -0
  31. package/dist/core/entities/job-listener-event.d.ts.map +1 -0
  32. package/dist/core/entities/job-listener-event.js +3 -0
  33. package/dist/core/entities/job-listener-event.js.map +1 -0
  34. package/dist/core/entities/job.d.ts +54 -0
  35. package/dist/core/entities/job.d.ts.map +1 -0
  36. package/dist/core/entities/job.js +29 -0
  37. package/dist/core/entities/job.js.map +1 -0
  38. package/dist/core/entities/step.d.ts +86 -0
  39. package/dist/core/entities/step.d.ts.map +1 -0
  40. package/dist/core/entities/step.js +12 -0
  41. package/dist/core/entities/step.js.map +1 -0
  42. package/dist/core/entities/workflow-run-attempt.d.ts +20 -0
  43. package/dist/core/entities/workflow-run-attempt.d.ts.map +1 -0
  44. package/dist/core/entities/workflow-run-attempt.js +3 -0
  45. package/dist/core/entities/workflow-run-attempt.js.map +1 -0
  46. package/dist/core/entities/workflow-run.d.ts +66 -0
  47. package/dist/core/entities/workflow-run.d.ts.map +1 -0
  48. package/dist/core/entities/workflow-run.js +10 -0
  49. package/dist/core/entities/workflow-run.js.map +1 -0
  50. package/dist/core/errors.d.ts +85 -0
  51. package/dist/core/errors.d.ts.map +1 -0
  52. package/dist/core/errors.js +134 -0
  53. package/dist/core/errors.js.map +1 -0
  54. package/dist/core/index.d.ts +14 -0
  55. package/dist/core/index.d.ts.map +1 -0
  56. package/dist/core/index.js +9 -0
  57. package/dist/core/index.js.map +1 -0
  58. package/dist/core/job-execution-outcome.d.ts +29 -0
  59. package/dist/core/job-execution-outcome.d.ts.map +1 -0
  60. package/dist/core/job-execution-outcome.js +31 -0
  61. package/dist/core/job-execution-outcome.js.map +1 -0
  62. package/dist/core/job-execution.d.ts +37 -0
  63. package/dist/core/job-execution.d.ts.map +1 -0
  64. package/dist/core/job-execution.js +425 -0
  65. package/dist/core/job-execution.js.map +1 -0
  66. package/dist/core/job-transition/decide-job-activation.d.ts +29 -0
  67. package/dist/core/job-transition/decide-job-activation.d.ts.map +1 -0
  68. package/dist/core/job-transition/decide-job-activation.js +51 -0
  69. package/dist/core/job-transition/decide-job-activation.js.map +1 -0
  70. package/dist/core/job-transition/derive-job-execution-outputs.d.ts +18 -0
  71. package/dist/core/job-transition/derive-job-execution-outputs.d.ts.map +1 -0
  72. package/dist/core/job-transition/derive-job-execution-outputs.js +23 -0
  73. package/dist/core/job-transition/derive-job-execution-outputs.js.map +1 -0
  74. package/dist/core/job-transition/derive-job-success.d.ts +16 -0
  75. package/dist/core/job-transition/derive-job-success.d.ts.map +1 -0
  76. package/dist/core/job-transition/derive-job-success.js +47 -0
  77. package/dist/core/job-transition/derive-job-success.js.map +1 -0
  78. package/dist/core/job-transition/index.d.ts +5 -0
  79. package/dist/core/job-transition/index.d.ts.map +1 -0
  80. package/dist/core/job-transition/index.js +6 -0
  81. package/dist/core/job-transition/index.js.map +1 -0
  82. package/dist/core/job-transition/runtime-completion-status-for-job.d.ts +4 -0
  83. package/dist/core/job-transition/runtime-completion-status-for-job.d.ts.map +1 -0
  84. package/dist/core/job-transition/runtime-completion-status-for-job.js +8 -0
  85. package/dist/core/job-transition/runtime-completion-status-for-job.js.map +1 -0
  86. package/dist/core/listener-execution-materialization.d.ts +30 -0
  87. package/dist/core/listener-execution-materialization.d.ts.map +1 -0
  88. package/dist/core/listener-execution-materialization.js +87 -0
  89. package/dist/core/listener-execution-materialization.js.map +1 -0
  90. package/dist/core/run-workflow.d.ts +11 -0
  91. package/dist/core/run-workflow.d.ts.map +1 -0
  92. package/dist/core/run-workflow.js +28 -0
  93. package/dist/core/run-workflow.js.map +1 -0
  94. package/dist/core/source-control.d.ts +5 -0
  95. package/dist/core/source-control.d.ts.map +1 -0
  96. package/dist/core/source-control.js +19 -0
  97. package/dist/core/source-control.js.map +1 -0
  98. package/dist/core/step-config/agent.d.ts +49 -0
  99. package/dist/core/step-config/agent.d.ts.map +1 -0
  100. package/dist/core/step-config/agent.js +337 -0
  101. package/dist/core/step-config/agent.js.map +1 -0
  102. package/dist/core/step-config/assemble-run-context.d.ts +94 -0
  103. package/dist/core/step-config/assemble-run-context.d.ts.map +1 -0
  104. package/dist/core/step-config/assemble-run-context.js +393 -0
  105. package/dist/core/step-config/assemble-run-context.js.map +1 -0
  106. package/dist/core/step-config/complete-step-dispatch-config.d.ts +13 -0
  107. package/dist/core/step-config/complete-step-dispatch-config.d.ts.map +1 -0
  108. package/dist/core/step-config/complete-step-dispatch-config.js +38 -0
  109. package/dist/core/step-config/complete-step-dispatch-config.js.map +1 -0
  110. package/dist/core/step-config/fields.d.ts +38 -0
  111. package/dist/core/step-config/fields.d.ts.map +1 -0
  112. package/dist/core/step-config/fields.js +72 -0
  113. package/dist/core/step-config/fields.js.map +1 -0
  114. package/dist/core/step-config/index.d.ts +8 -0
  115. package/dist/core/step-config/index.d.ts.map +1 -0
  116. package/dist/core/step-config/index.js +7 -0
  117. package/dist/core/step-config/index.js.map +1 -0
  118. package/dist/core/step-config/materialize-job-execution-steps.d.ts +35 -0
  119. package/dist/core/step-config/materialize-job-execution-steps.d.ts.map +1 -0
  120. package/dist/core/step-config/materialize-job-execution-steps.js +92 -0
  121. package/dist/core/step-config/materialize-job-execution-steps.js.map +1 -0
  122. package/dist/core/step-config/materialize-workflow-model.d.ts +42 -0
  123. package/dist/core/step-config/materialize-workflow-model.d.ts.map +1 -0
  124. package/dist/core/step-config/materialize-workflow-model.js +96 -0
  125. package/dist/core/step-config/materialize-workflow-model.js.map +1 -0
  126. package/dist/core/step-config/resolve-job-execution-name.d.ts +18 -0
  127. package/dist/core/step-config/resolve-job-execution-name.d.ts.map +1 -0
  128. package/dist/core/step-config/resolve-job-execution-name.js +36 -0
  129. package/dist/core/step-config/resolve-job-execution-name.js.map +1 -0
  130. package/dist/core/step-config/resolve-step-config.d.ts +33 -0
  131. package/dist/core/step-config/resolve-step-config.d.ts.map +1 -0
  132. package/dist/core/step-config/resolve-step-config.js +164 -0
  133. package/dist/core/step-config/resolve-step-config.js.map +1 -0
  134. package/dist/core/step-config/run.d.ts +39 -0
  135. package/dist/core/step-config/run.d.ts.map +1 -0
  136. package/dist/core/step-config/run.js +360 -0
  137. package/dist/core/step-config/run.js.map +1 -0
  138. package/dist/core/step-config/workflow-evaluation-context.d.ts +6 -0
  139. package/dist/core/step-config/workflow-evaluation-context.d.ts.map +1 -0
  140. package/dist/core/step-config/workflow-evaluation-context.js +3 -0
  141. package/dist/core/step-config/workflow-evaluation-context.js.map +1 -0
  142. package/dist/core/step-transition/apply-step-transition.d.ts +26 -0
  143. package/dist/core/step-transition/apply-step-transition.d.ts.map +1 -0
  144. package/dist/core/step-transition/apply-step-transition.js +141 -0
  145. package/dist/core/step-transition/apply-step-transition.js.map +1 -0
  146. package/dist/core/step-transition/decide-step-transition.d.ts +71 -0
  147. package/dist/core/step-transition/decide-step-transition.d.ts.map +1 -0
  148. package/dist/core/step-transition/decide-step-transition.js +110 -0
  149. package/dist/core/step-transition/decide-step-transition.js.map +1 -0
  150. package/dist/core/step-transition/evaluate-gate.d.ts +28 -0
  151. package/dist/core/step-transition/evaluate-gate.d.ts.map +1 -0
  152. package/dist/core/step-transition/evaluate-gate.js +159 -0
  153. package/dist/core/step-transition/evaluate-gate.js.map +1 -0
  154. package/dist/core/step-transition/read-step-outputs.d.ts +3 -0
  155. package/dist/core/step-transition/read-step-outputs.d.ts.map +1 -0
  156. package/dist/core/step-transition/read-step-outputs.js +24 -0
  157. package/dist/core/step-transition/read-step-outputs.js.map +1 -0
  158. package/dist/core/workflow-run-creation.d.ts +43 -0
  159. package/dist/core/workflow-run-creation.d.ts.map +1 -0
  160. package/dist/core/workflow-run-creation.js +80 -0
  161. package/dist/core/workflow-run-creation.js.map +1 -0
  162. package/dist/core/workflow-scheduling/index.d.ts +5 -0
  163. package/dist/core/workflow-scheduling/index.d.ts.map +1 -0
  164. package/dist/core/workflow-scheduling/index.js +4 -0
  165. package/dist/core/workflow-scheduling/index.js.map +1 -0
  166. package/dist/core/workflow-scheduling/run-progress.d.ts +20 -0
  167. package/dist/core/workflow-scheduling/run-progress.d.ts.map +1 -0
  168. package/dist/core/workflow-scheduling/run-progress.js +40 -0
  169. package/dist/core/workflow-scheduling/run-progress.js.map +1 -0
  170. package/dist/core/workflow-scheduling/runtime-dag.d.ts +10 -0
  171. package/dist/core/workflow-scheduling/runtime-dag.d.ts.map +1 -0
  172. package/dist/core/workflow-scheduling/runtime-dag.js +3 -0
  173. package/dist/core/workflow-scheduling/runtime-dag.js.map +1 -0
  174. package/dist/core/workflow-scheduling/runtime-scheduling-command.d.ts +16 -0
  175. package/dist/core/workflow-scheduling/runtime-scheduling-command.d.ts.map +1 -0
  176. package/dist/core/workflow-scheduling/runtime-scheduling-command.js +3 -0
  177. package/dist/core/workflow-scheduling/runtime-scheduling-command.js.map +1 -0
  178. package/dist/core/workflow-scheduling/schedule-runtime-dag.d.ts +9 -0
  179. package/dist/core/workflow-scheduling/schedule-runtime-dag.d.ts.map +1 -0
  180. package/dist/core/workflow-scheduling/schedule-runtime-dag.js +72 -0
  181. package/dist/core/workflow-scheduling/schedule-runtime-dag.js.map +1 -0
  182. package/dist/db/db.d.ts +4959 -0
  183. package/dist/db/db.d.ts.map +1 -0
  184. package/dist/db/db.js +37 -0
  185. package/dist/db/db.js.map +1 -0
  186. package/dist/db/index.d.ts +9 -0
  187. package/dist/db/index.d.ts.map +1 -0
  188. package/dist/db/index.js +10 -0
  189. package/dist/db/index.js.map +1 -0
  190. package/dist/db/job-listener-events.d.ts +18 -0
  191. package/dist/db/job-listener-events.d.ts.map +1 -0
  192. package/dist/db/job-listener-events.js +59 -0
  193. package/dist/db/job-listener-events.js.map +1 -0
  194. package/dist/db/job-listeners.d.ts +55 -0
  195. package/dist/db/job-listeners.d.ts.map +1 -0
  196. package/dist/db/job-listeners.js +358 -0
  197. package/dist/db/job-listeners.js.map +1 -0
  198. package/dist/db/outbox-writes.d.ts +12 -0
  199. package/dist/db/outbox-writes.d.ts.map +1 -0
  200. package/dist/db/outbox-writes.js +20 -0
  201. package/dist/db/outbox-writes.js.map +1 -0
  202. package/dist/db/runner-lease-table.d.ts +469 -0
  203. package/dist/db/runner-lease-table.d.ts.map +1 -0
  204. package/dist/db/runner-lease-table.js +42 -0
  205. package/dist/db/runner-lease-table.js.map +1 -0
  206. package/dist/db/schema/common.d.ts +2 -0
  207. package/dist/db/schema/common.d.ts.map +1 -0
  208. package/dist/db/schema/common.js +4 -0
  209. package/dist/db/schema/common.js.map +1 -0
  210. package/dist/db/schema/job-executions.d.ts +311 -0
  211. package/dist/db/schema/job-executions.d.ts.map +1 -0
  212. package/dist/db/schema/job-executions.js +76 -0
  213. package/dist/db/schema/job-executions.js.map +1 -0
  214. package/dist/db/schema/job-listener-events.d.ts +200 -0
  215. package/dist/db/schema/job-listener-events.d.ts.map +1 -0
  216. package/dist/db/schema/job-listener-events.js +50 -0
  217. package/dist/db/schema/job-listener-events.js.map +1 -0
  218. package/dist/db/schema/jobs.d.ts +542 -0
  219. package/dist/db/schema/jobs.d.ts.map +1 -0
  220. package/dist/db/schema/jobs.js +121 -0
  221. package/dist/db/schema/jobs.js.map +1 -0
  222. package/dist/db/schema/outbox.d.ts +195 -0
  223. package/dist/db/schema/outbox.d.ts.map +1 -0
  224. package/dist/db/schema/outbox.js +5 -0
  225. package/dist/db/schema/outbox.js.map +1 -0
  226. package/dist/db/schema/step-attempts.d.ts +330 -0
  227. package/dist/db/schema/step-attempts.d.ts.map +1 -0
  228. package/dist/db/schema/step-attempts.js +80 -0
  229. package/dist/db/schema/step-attempts.js.map +1 -0
  230. package/dist/db/schema/steps.d.ts +352 -0
  231. package/dist/db/schema/steps.d.ts.map +1 -0
  232. package/dist/db/schema/steps.js +80 -0
  233. package/dist/db/schema/steps.js.map +1 -0
  234. package/dist/db/schema/workflow-run-attempts.d.ts +239 -0
  235. package/dist/db/schema/workflow-run-attempts.d.ts.map +1 -0
  236. package/dist/db/schema/workflow-run-attempts.js +53 -0
  237. package/dist/db/schema/workflow-run-attempts.js.map +1 -0
  238. package/dist/db/schema/workflow-runs.d.ts +360 -0
  239. package/dist/db/schema/workflow-runs.d.ts.map +1 -0
  240. package/dist/db/schema/workflow-runs.js +85 -0
  241. package/dist/db/schema/workflow-runs.js.map +1 -0
  242. package/dist/db/workflow-runs/job-executions.d.ts +49 -0
  243. package/dist/db/workflow-runs/job-executions.d.ts.map +1 -0
  244. package/dist/db/workflow-runs/job-executions.js +271 -0
  245. package/dist/db/workflow-runs/job-executions.js.map +1 -0
  246. package/dist/db/workflow-runs/jobs.d.ts +60 -0
  247. package/dist/db/workflow-runs/jobs.d.ts.map +1 -0
  248. package/dist/db/workflow-runs/jobs.js +288 -0
  249. package/dist/db/workflow-runs/jobs.js.map +1 -0
  250. package/dist/db/workflow-runs/outbox.d.ts +20 -0
  251. package/dist/db/workflow-runs/outbox.d.ts.map +1 -0
  252. package/dist/db/workflow-runs/outbox.js +68 -0
  253. package/dist/db/workflow-runs/outbox.js.map +1 -0
  254. package/dist/db/workflow-runs/queries.d.ts +71 -0
  255. package/dist/db/workflow-runs/queries.d.ts.map +1 -0
  256. package/dist/db/workflow-runs/queries.js +253 -0
  257. package/dist/db/workflow-runs/queries.js.map +1 -0
  258. package/dist/db/workflow-runs/run-create.d.ts +32 -0
  259. package/dist/db/workflow-runs/run-create.d.ts.map +1 -0
  260. package/dist/db/workflow-runs/run-create.js +288 -0
  261. package/dist/db/workflow-runs/run-create.js.map +1 -0
  262. package/dist/db/workflow-runs/run-graph.d.ts +27 -0
  263. package/dist/db/workflow-runs/run-graph.d.ts.map +1 -0
  264. package/dist/db/workflow-runs/run-graph.js +63 -0
  265. package/dist/db/workflow-runs/run-graph.js.map +1 -0
  266. package/dist/db/workflow-runs/run-rerun.d.ts +8 -0
  267. package/dist/db/workflow-runs/run-rerun.d.ts.map +1 -0
  268. package/dist/db/workflow-runs/run-rerun.js +207 -0
  269. package/dist/db/workflow-runs/run-rerun.js.map +1 -0
  270. package/dist/db/workflow-runs/run-status.d.ts +24 -0
  271. package/dist/db/workflow-runs/run-status.d.ts.map +1 -0
  272. package/dist/db/workflow-runs/run-status.js +249 -0
  273. package/dist/db/workflow-runs/run-status.js.map +1 -0
  274. package/dist/db/workflow-runs/runs.d.ts +7 -0
  275. package/dist/db/workflow-runs/runs.d.ts.map +1 -0
  276. package/dist/db/workflow-runs/runs.js +5 -0
  277. package/dist/db/workflow-runs/runs.js.map +1 -0
  278. package/dist/db/workflow-runs/shared.d.ts +24 -0
  279. package/dist/db/workflow-runs/shared.d.ts.map +1 -0
  280. package/dist/db/workflow-runs/shared.js +50 -0
  281. package/dist/db/workflow-runs/shared.js.map +1 -0
  282. package/dist/db/workflow-runs/steps.d.ts +83 -0
  283. package/dist/db/workflow-runs/steps.d.ts.map +1 -0
  284. package/dist/db/workflow-runs/steps.js +246 -0
  285. package/dist/db/workflow-runs/steps.js.map +1 -0
  286. package/dist/db/workflow-runs.d.ts +12 -0
  287. package/dist/db/workflow-runs.d.ts.map +1 -0
  288. package/dist/db/workflow-runs.js +8 -0
  289. package/dist/db/workflow-runs.js.map +1 -0
  290. package/dist/index.d.ts +10 -0
  291. package/dist/index.d.ts.map +1 -0
  292. package/dist/index.js +54 -0
  293. package/dist/index.js.map +1 -0
  294. package/dist/metrics/index.d.ts +2 -0
  295. package/dist/metrics/index.d.ts.map +1 -0
  296. package/dist/metrics/index.js +3 -0
  297. package/dist/metrics/index.js.map +1 -0
  298. package/dist/metrics/instance.d.ts +20 -0
  299. package/dist/metrics/instance.d.ts.map +1 -0
  300. package/dist/metrics/instance.js +127 -0
  301. package/dist/metrics/instance.js.map +1 -0
  302. package/dist/metrics/service.d.ts +2 -0
  303. package/dist/metrics/service.d.ts.map +1 -0
  304. package/dist/metrics/service.js +30 -0
  305. package/dist/metrics/service.js.map +1 -0
  306. package/dist/presentation/dto/checkout-token.d.ts +6 -0
  307. package/dist/presentation/dto/checkout-token.d.ts.map +1 -0
  308. package/dist/presentation/dto/checkout-token.js +74 -0
  309. package/dist/presentation/dto/checkout-token.js.map +1 -0
  310. package/dist/presentation/dto/index.d.ts +4 -0
  311. package/dist/presentation/dto/index.d.ts.map +1 -0
  312. package/dist/presentation/dto/index.js +5 -0
  313. package/dist/presentation/dto/index.js.map +1 -0
  314. package/dist/presentation/dto/job.d.ts +6 -0
  315. package/dist/presentation/dto/job.d.ts.map +1 -0
  316. package/dist/presentation/dto/job.js +59 -0
  317. package/dist/presentation/dto/job.js.map +1 -0
  318. package/dist/presentation/dto/step.d.ts +6 -0
  319. package/dist/presentation/dto/step.d.ts.map +1 -0
  320. package/dist/presentation/dto/step.js +162 -0
  321. package/dist/presentation/dto/step.js.map +1 -0
  322. package/dist/presentation/dto/workflow-run.d.ts +6 -0
  323. package/dist/presentation/dto/workflow-run.d.ts.map +1 -0
  324. package/dist/presentation/dto/workflow-run.js +35 -0
  325. package/dist/presentation/dto/workflow-run.js.map +1 -0
  326. package/dist/presentation/index.d.ts +3 -0
  327. package/dist/presentation/index.d.ts.map +1 -0
  328. package/dist/presentation/index.js +4 -0
  329. package/dist/presentation/index.js.map +1 -0
  330. package/dist/presentation/routes/agent-runtime-config.d.ts +2 -0
  331. package/dist/presentation/routes/agent-runtime-config.d.ts.map +1 -0
  332. package/dist/presentation/routes/agent-runtime-config.js +71 -0
  333. package/dist/presentation/routes/agent-runtime-config.js.map +1 -0
  334. package/dist/presentation/routes/cancel-run.d.ts +2 -0
  335. package/dist/presentation/routes/cancel-run.d.ts.map +1 -0
  336. package/dist/presentation/routes/cancel-run.js +46 -0
  337. package/dist/presentation/routes/cancel-run.js.map +1 -0
  338. package/dist/presentation/routes/checkout-token.d.ts +2 -0
  339. package/dist/presentation/routes/checkout-token.d.ts.map +1 -0
  340. package/dist/presentation/routes/checkout-token.js +64 -0
  341. package/dist/presentation/routes/checkout-token.js.map +1 -0
  342. package/dist/presentation/routes/get-run-aggregates.d.ts +2 -0
  343. package/dist/presentation/routes/get-run-aggregates.d.ts.map +1 -0
  344. package/dist/presentation/routes/get-run-aggregates.js +60 -0
  345. package/dist/presentation/routes/get-run-aggregates.js.map +1 -0
  346. package/dist/presentation/routes/get-run.d.ts +2 -0
  347. package/dist/presentation/routes/get-run.d.ts.map +1 -0
  348. package/dist/presentation/routes/get-run.js +60 -0
  349. package/dist/presentation/routes/get-run.js.map +1 -0
  350. package/dist/presentation/routes/get-step-secrets.d.ts +2 -0
  351. package/dist/presentation/routes/get-step-secrets.d.ts.map +1 -0
  352. package/dist/presentation/routes/get-step-secrets.js +115 -0
  353. package/dist/presentation/routes/get-step-secrets.js.map +1 -0
  354. package/dist/presentation/routes/index.d.ts +4 -0
  355. package/dist/presentation/routes/index.d.ts.map +1 -0
  356. package/dist/presentation/routes/index.js +41 -0
  357. package/dist/presentation/routes/index.js.map +1 -0
  358. package/dist/presentation/routes/leased-step.d.ts +14 -0
  359. package/dist/presentation/routes/leased-step.d.ts.map +1 -0
  360. package/dist/presentation/routes/leased-step.js +50 -0
  361. package/dist/presentation/routes/leased-step.js.map +1 -0
  362. package/dist/presentation/routes/list-run-attempts.d.ts +2 -0
  363. package/dist/presentation/routes/list-run-attempts.d.ts.map +1 -0
  364. package/dist/presentation/routes/list-run-attempts.js +35 -0
  365. package/dist/presentation/routes/list-run-attempts.js.map +1 -0
  366. package/dist/presentation/routes/list-runs.d.ts +2 -0
  367. package/dist/presentation/routes/list-runs.d.ts.map +1 -0
  368. package/dist/presentation/routes/list-runs.js +70 -0
  369. package/dist/presentation/routes/list-runs.js.map +1 -0
  370. package/dist/presentation/routes/next-step.d.ts +2 -0
  371. package/dist/presentation/routes/next-step.d.ts.map +1 -0
  372. package/dist/presentation/routes/next-step.js +65 -0
  373. package/dist/presentation/routes/next-step.js.map +1 -0
  374. package/dist/presentation/routes/report-step.d.ts +2 -0
  375. package/dist/presentation/routes/report-step.d.ts.map +1 -0
  376. package/dist/presentation/routes/report-step.js +73 -0
  377. package/dist/presentation/routes/report-step.js.map +1 -0
  378. package/dist/presentation/routes/require-accessible-run.d.ts +7 -0
  379. package/dist/presentation/routes/require-accessible-run.d.ts.map +1 -0
  380. package/dist/presentation/routes/require-accessible-run.js +25 -0
  381. package/dist/presentation/routes/require-accessible-run.js.map +1 -0
  382. package/dist/presentation/routes/rerun-run.d.ts +2 -0
  383. package/dist/presentation/routes/rerun-run.d.ts.map +1 -0
  384. package/dist/presentation/routes/rerun-run.js +56 -0
  385. package/dist/presentation/routes/rerun-run.js.map +1 -0
  386. package/dist/presentation/subscribers/index.d.ts +8 -0
  387. package/dist/presentation/subscribers/index.d.ts.map +1 -0
  388. package/dist/presentation/subscribers/index.js +9 -0
  389. package/dist/presentation/subscribers/index.js.map +1 -0
  390. package/dist/presentation/subscribers/on-job-event-delivered.d.ts +3 -0
  391. package/dist/presentation/subscribers/on-job-event-delivered.d.ts.map +1 -0
  392. package/dist/presentation/subscribers/on-job-event-delivered.js +24 -0
  393. package/dist/presentation/subscribers/on-job-event-delivered.js.map +1 -0
  394. package/dist/presentation/subscribers/on-job-steps-settled.d.ts +3 -0
  395. package/dist/presentation/subscribers/on-job-steps-settled.d.ts.map +1 -0
  396. package/dist/presentation/subscribers/on-job-steps-settled.js +36 -0
  397. package/dist/presentation/subscribers/on-job-steps-settled.js.map +1 -0
  398. package/dist/presentation/subscribers/on-runner-job-claimed.d.ts +3 -0
  399. package/dist/presentation/subscribers/on-runner-job-claimed.d.ts.map +1 -0
  400. package/dist/presentation/subscribers/on-runner-job-claimed.js +20 -0
  401. package/dist/presentation/subscribers/on-runner-job-claimed.js.map +1 -0
  402. package/dist/presentation/subscribers/on-runner-job-lease-expired.d.ts +3 -0
  403. package/dist/presentation/subscribers/on-runner-job-lease-expired.d.ts.map +1 -0
  404. package/dist/presentation/subscribers/on-runner-job-lease-expired.js +35 -0
  405. package/dist/presentation/subscribers/on-runner-job-lease-expired.js.map +1 -0
  406. package/dist/presentation/subscribers/on-runner-job-queued.d.ts +3 -0
  407. package/dist/presentation/subscribers/on-runner-job-queued.d.ts.map +1 -0
  408. package/dist/presentation/subscribers/on-runner-job-queued.js +20 -0
  409. package/dist/presentation/subscribers/on-runner-job-queued.js.map +1 -0
  410. package/dist/presentation/subscribers/on-workflow-run-attempt-created.d.ts +3 -0
  411. package/dist/presentation/subscribers/on-workflow-run-attempt-created.d.ts.map +1 -0
  412. package/dist/presentation/subscribers/on-workflow-run-attempt-created.js +35 -0
  413. package/dist/presentation/subscribers/on-workflow-run-attempt-created.js.map +1 -0
  414. package/dist/presentation/subscribers/on-workflow-run-cancelled.d.ts +3 -0
  415. package/dist/presentation/subscribers/on-workflow-run-cancelled.d.ts.map +1 -0
  416. package/dist/presentation/subscribers/on-workflow-run-cancelled.js +25 -0
  417. package/dist/presentation/subscribers/on-workflow-run-cancelled.js.map +1 -0
  418. package/dist/temporal/activities/index.d.ts +23 -0
  419. package/dist/temporal/activities/index.d.ts.map +1 -0
  420. package/dist/temporal/activities/index.js +26 -0
  421. package/dist/temporal/activities/index.js.map +1 -0
  422. package/dist/temporal/activities/orchestration-activities.d.ts +130 -0
  423. package/dist/temporal/activities/orchestration-activities.d.ts.map +1 -0
  424. package/dist/temporal/activities/orchestration-activities.js +188 -0
  425. package/dist/temporal/activities/orchestration-activities.js.map +1 -0
  426. package/dist/temporal/constants.d.ts +7 -0
  427. package/dist/temporal/constants.d.ts.map +1 -0
  428. package/dist/temporal/constants.js +8 -0
  429. package/dist/temporal/constants.js.map +1 -0
  430. package/dist/temporal/index.d.ts +3 -0
  431. package/dist/temporal/index.d.ts.map +1 -0
  432. package/dist/temporal/index.js +4 -0
  433. package/dist/temporal/index.js.map +1 -0
  434. package/dist/temporal/workflow-not-found.d.ts +2 -0
  435. package/dist/temporal/workflow-not-found.d.ts.map +1 -0
  436. package/dist/temporal/workflow-not-found.js +10 -0
  437. package/dist/temporal/workflow-not-found.js.map +1 -0
  438. package/dist/temporal/workflows/deadline.d.ts +3 -0
  439. package/dist/temporal/workflows/deadline.d.ts.map +1 -0
  440. package/dist/temporal/workflows/deadline.js +8 -0
  441. package/dist/temporal/workflows/deadline.js.map +1 -0
  442. package/dist/temporal/workflows/index.d.ts +4 -0
  443. package/dist/temporal/workflows/index.d.ts.map +1 -0
  444. package/dist/temporal/workflows/index.js +5 -0
  445. package/dist/temporal/workflows/index.js.map +1 -0
  446. package/dist/temporal/workflows/job-execution-orchestration.d.ts +27 -0
  447. package/dist/temporal/workflows/job-execution-orchestration.d.ts.map +1 -0
  448. package/dist/temporal/workflows/job-execution-orchestration.js +265 -0
  449. package/dist/temporal/workflows/job-execution-orchestration.js.map +1 -0
  450. package/dist/temporal/workflows/job-listener-orchestration.d.ts +40 -0
  451. package/dist/temporal/workflows/job-listener-orchestration.d.ts.map +1 -0
  452. package/dist/temporal/workflows/job-listener-orchestration.js +332 -0
  453. package/dist/temporal/workflows/job-listener-orchestration.js.map +1 -0
  454. package/dist/temporal/workflows/run-orchestration.d.ts +8 -0
  455. package/dist/temporal/workflows/run-orchestration.d.ts.map +1 -0
  456. package/dist/temporal/workflows/run-orchestration.js +243 -0
  457. package/dist/temporal/workflows/run-orchestration.js.map +1 -0
  458. package/dist/temporal/workflows/test-env.d.ts +114 -0
  459. package/dist/temporal/workflows/test-env.d.ts.map +1 -0
  460. package/dist/temporal/workflows/test-env.js +323 -0
  461. package/dist/temporal/workflows/test-env.js.map +1 -0
  462. package/dist/tsconfig.test.tsbuildinfo +1 -0
  463. package/drizzle/0000_initial.sql +211 -0
  464. package/drizzle/0001_agent_tool_materialization.sql +1 -0
  465. package/drizzle/meta/0000_snapshot.json +1613 -0
  466. package/drizzle/meta/_journal.json +20 -0
  467. package/drizzle.config.ts +7 -0
  468. package/package.json +91 -0
  469. package/src/core/README.md +79 -0
  470. package/src/core/agent-tool-capability-warning.test.ts +280 -0
  471. package/src/core/agent-tool-capability-warning.ts +200 -0
  472. package/src/core/agent-tools.ts +422 -0
  473. package/src/core/checkout.test.ts +112 -0
  474. package/src/core/checkout.ts +63 -0
  475. package/src/core/condition-trace.ts +64 -0
  476. package/src/core/entities/index.ts +9 -0
  477. package/src/core/entities/job-execution.ts +32 -0
  478. package/src/core/entities/job-listener-event.ts +15 -0
  479. package/src/core/entities/job.ts +91 -0
  480. package/src/core/entities/step.ts +126 -0
  481. package/src/core/entities/workflow-run-attempt.ts +21 -0
  482. package/src/core/entities/workflow-run.ts +94 -0
  483. package/src/core/errors.test.ts +45 -0
  484. package/src/core/errors.ts +209 -0
  485. package/src/core/index.ts +54 -0
  486. package/src/core/job-execution-outcome.ts +64 -0
  487. package/src/core/job-execution.test.ts +1560 -0
  488. package/src/core/job-execution.ts +581 -0
  489. package/src/core/job-transition/decide-job-activation.test.ts +196 -0
  490. package/src/core/job-transition/decide-job-activation.ts +79 -0
  491. package/src/core/job-transition/derive-job-execution-outputs.ts +41 -0
  492. package/src/core/job-transition/derive-job-success.test.ts +133 -0
  493. package/src/core/job-transition/derive-job-success.ts +67 -0
  494. package/src/core/job-transition/index.ts +11 -0
  495. package/src/core/job-transition/runtime-completion-status-for-job.ts +14 -0
  496. package/src/core/listener-execution-materialization.test.ts +49 -0
  497. package/src/core/listener-execution-materialization.ts +162 -0
  498. package/src/core/run-workflow.test.ts +229 -0
  499. package/src/core/run-workflow.ts +41 -0
  500. package/src/core/source-control.test.ts +17 -0
  501. package/src/core/source-control.ts +22 -0
  502. package/src/core/step-config/agent.ts +459 -0
  503. package/src/core/step-config/assemble-run-context.test.ts +1021 -0
  504. package/src/core/step-config/assemble-run-context.ts +535 -0
  505. package/src/core/step-config/complete-step-dispatch-config.test.ts +354 -0
  506. package/src/core/step-config/complete-step-dispatch-config.ts +40 -0
  507. package/src/core/step-config/fields.ts +111 -0
  508. package/src/core/step-config/index.ts +41 -0
  509. package/src/core/step-config/materialize-job-execution-steps.test.ts +494 -0
  510. package/src/core/step-config/materialize-job-execution-steps.ts +136 -0
  511. package/src/core/step-config/materialize-workflow-model.test.ts +1214 -0
  512. package/src/core/step-config/materialize-workflow-model.ts +140 -0
  513. package/src/core/step-config/resolve-job-execution-name.test.ts +94 -0
  514. package/src/core/step-config/resolve-job-execution-name.ts +51 -0
  515. package/src/core/step-config/resolve-step-config.ts +199 -0
  516. package/src/core/step-config/run.ts +467 -0
  517. package/src/core/step-config/workflow-evaluation-context.ts +6 -0
  518. package/src/core/step-transition/apply-step-transition.ts +163 -0
  519. package/src/core/step-transition/decide-step-transition.test.ts +307 -0
  520. package/src/core/step-transition/decide-step-transition.ts +200 -0
  521. package/src/core/step-transition/evaluate-gate.test.ts +317 -0
  522. package/src/core/step-transition/evaluate-gate.ts +168 -0
  523. package/src/core/step-transition/read-step-outputs.ts +27 -0
  524. package/src/core/workflow-run-creation.test.ts +155 -0
  525. package/src/core/workflow-run-creation.ts +131 -0
  526. package/src/core/workflow-scheduling/index.ts +15 -0
  527. package/src/core/workflow-scheduling/run-progress.test.ts +46 -0
  528. package/src/core/workflow-scheduling/run-progress.ts +68 -0
  529. package/src/core/workflow-scheduling/runtime-dag.ts +10 -0
  530. package/src/core/workflow-scheduling/runtime-scheduling-command.ts +20 -0
  531. package/src/core/workflow-scheduling/schedule-runtime-dag.test.ts +197 -0
  532. package/src/core/workflow-scheduling/schedule-runtime-dag.ts +115 -0
  533. package/src/db/db.ts +40 -0
  534. package/src/db/index.ts +86 -0
  535. package/src/db/job-listener-events.test.ts +113 -0
  536. package/src/db/job-listener-events.ts +73 -0
  537. package/src/db/job-listeners.test.ts +865 -0
  538. package/src/db/job-listeners.ts +564 -0
  539. package/src/db/outbox-writes.ts +40 -0
  540. package/src/db/rerun-listener.test.ts +64 -0
  541. package/src/db/run-timeout.test.ts +102 -0
  542. package/src/db/runner-lease-table.ts +39 -0
  543. package/src/db/schema/common.ts +3 -0
  544. package/src/db/schema/job-executions.ts +85 -0
  545. package/src/db/schema/job-listener-events.ts +58 -0
  546. package/src/db/schema/jobs.ts +136 -0
  547. package/src/db/schema/outbox.ts +4 -0
  548. package/src/db/schema/step-attempts.ts +99 -0
  549. package/src/db/schema/steps.ts +99 -0
  550. package/src/db/schema/workflow-run-attempts.ts +59 -0
  551. package/src/db/schema/workflow-runs.ts +112 -0
  552. package/src/db/workflow-runs/job-executions.test.ts +99 -0
  553. package/src/db/workflow-runs/job-executions.ts +421 -0
  554. package/src/db/workflow-runs/job-status.test.ts +532 -0
  555. package/src/db/workflow-runs/jobs.test.ts +194 -0
  556. package/src/db/workflow-runs/jobs.ts +418 -0
  557. package/src/db/workflow-runs/outbox.ts +109 -0
  558. package/src/db/workflow-runs/queries.test.ts +256 -0
  559. package/src/db/workflow-runs/queries.ts +437 -0
  560. package/src/db/workflow-runs/run-create.test.ts +1281 -0
  561. package/src/db/workflow-runs/run-create.ts +373 -0
  562. package/src/db/workflow-runs/run-graph.ts +95 -0
  563. package/src/db/workflow-runs/run-rerun.test.ts +625 -0
  564. package/src/db/workflow-runs/run-rerun.ts +266 -0
  565. package/src/db/workflow-runs/run-status.test.ts +425 -0
  566. package/src/db/workflow-runs/run-status.ts +391 -0
  567. package/src/db/workflow-runs/runs.ts +17 -0
  568. package/src/db/workflow-runs/shared.ts +84 -0
  569. package/src/db/workflow-runs/steps.test.ts +191 -0
  570. package/src/db/workflow-runs/steps.ts +476 -0
  571. package/src/db/workflow-runs.ts +111 -0
  572. package/src/index.ts +99 -0
  573. package/src/metrics/index.ts +1 -0
  574. package/src/metrics/instance.ts +160 -0
  575. package/src/metrics/service.ts +30 -0
  576. package/src/presentation/dto/checkout-token.test.ts +107 -0
  577. package/src/presentation/dto/checkout-token.ts +85 -0
  578. package/src/presentation/dto/index.ts +3 -0
  579. package/src/presentation/dto/job.test.ts +108 -0
  580. package/src/presentation/dto/job.ts +64 -0
  581. package/src/presentation/dto/step.test.ts +307 -0
  582. package/src/presentation/dto/step.ts +145 -0
  583. package/src/presentation/dto/workflow-run.ts +38 -0
  584. package/src/presentation/index.ts +10 -0
  585. package/src/presentation/routes/agent-runtime-config.test.ts +478 -0
  586. package/src/presentation/routes/agent-runtime-config.ts +81 -0
  587. package/src/presentation/routes/cancel-run.test.ts +156 -0
  588. package/src/presentation/routes/cancel-run.ts +37 -0
  589. package/src/presentation/routes/checkout-token.test.ts +366 -0
  590. package/src/presentation/routes/checkout-token.ts +61 -0
  591. package/src/presentation/routes/get-run-aggregates.test.ts +114 -0
  592. package/src/presentation/routes/get-run-aggregates.ts +69 -0
  593. package/src/presentation/routes/get-run.test.ts +604 -0
  594. package/src/presentation/routes/get-run.ts +66 -0
  595. package/src/presentation/routes/get-step-secrets.test.ts +260 -0
  596. package/src/presentation/routes/get-step-secrets.ts +117 -0
  597. package/src/presentation/routes/index.test.ts +71 -0
  598. package/src/presentation/routes/index.ts +42 -0
  599. package/src/presentation/routes/leased-step.ts +54 -0
  600. package/src/presentation/routes/list-run-attempts.test.ts +163 -0
  601. package/src/presentation/routes/list-run-attempts.ts +27 -0
  602. package/src/presentation/routes/list-runs.test.ts +244 -0
  603. package/src/presentation/routes/list-runs.ts +83 -0
  604. package/src/presentation/routes/next-step.test.ts +366 -0
  605. package/src/presentation/routes/next-step.ts +62 -0
  606. package/src/presentation/routes/report-step.test.ts +374 -0
  607. package/src/presentation/routes/report-step.ts +61 -0
  608. package/src/presentation/routes/require-accessible-run.ts +27 -0
  609. package/src/presentation/routes/rerun-run.test.ts +202 -0
  610. package/src/presentation/routes/rerun-run.ts +48 -0
  611. package/src/presentation/subscribers/index.ts +7 -0
  612. package/src/presentation/subscribers/on-job-event-delivered.test.ts +71 -0
  613. package/src/presentation/subscribers/on-job-event-delivered.ts +30 -0
  614. package/src/presentation/subscribers/on-job-steps-settled.test.ts +75 -0
  615. package/src/presentation/subscribers/on-job-steps-settled.ts +42 -0
  616. package/src/presentation/subscribers/on-runner-job-claimed.test.ts +57 -0
  617. package/src/presentation/subscribers/on-runner-job-claimed.ts +23 -0
  618. package/src/presentation/subscribers/on-runner-job-lease-expired.test.ts +73 -0
  619. package/src/presentation/subscribers/on-runner-job-lease-expired.ts +36 -0
  620. package/src/presentation/subscribers/on-runner-job-queued.test.ts +57 -0
  621. package/src/presentation/subscribers/on-runner-job-queued.ts +23 -0
  622. package/src/presentation/subscribers/on-workflow-run-attempt-created.test.ts +69 -0
  623. package/src/presentation/subscribers/on-workflow-run-attempt-created.ts +40 -0
  624. package/src/presentation/subscribers/on-workflow-run-cancelled.test.ts +59 -0
  625. package/src/presentation/subscribers/on-workflow-run-cancelled.ts +29 -0
  626. package/src/temporal/activities/index.ts +45 -0
  627. package/src/temporal/activities/orchestration-activities.test.ts +115 -0
  628. package/src/temporal/activities/orchestration-activities.ts +305 -0
  629. package/src/temporal/constants.ts +6 -0
  630. package/src/temporal/index.ts +6 -0
  631. package/src/temporal/workflow-not-found.ts +9 -0
  632. package/src/temporal/workflows/deadline.ts +7 -0
  633. package/src/temporal/workflows/index.ts +11 -0
  634. package/src/temporal/workflows/job-execution-orchestration-timeout.test.ts +165 -0
  635. package/src/temporal/workflows/job-execution-orchestration.test.ts +311 -0
  636. package/src/temporal/workflows/job-execution-orchestration.ts +314 -0
  637. package/src/temporal/workflows/job-listener-orchestration-continuation.test.ts +93 -0
  638. package/src/temporal/workflows/job-listener-orchestration.test.ts +406 -0
  639. package/src/temporal/workflows/job-listener-orchestration.ts +490 -0
  640. package/src/temporal/workflows/run-orchestration.test.ts +409 -0
  641. package/src/temporal/workflows/run-orchestration.ts +283 -0
  642. package/src/temporal/workflows/test-env.ts +409 -0
  643. package/test/env.ts +11 -0
  644. package/test/factories/job.ts +83 -0
  645. package/test/factories/project.ts +16 -0
  646. package/test/factories/workflow-model.test.ts +26 -0
  647. package/test/factories/workflow-model.ts +268 -0
  648. package/test/factories/workflow-run.ts +58 -0
  649. package/test/fixtures/active-lease-token.ts +85 -0
  650. package/test/fixtures/job-with-steps.ts +42 -0
  651. package/test/fixtures/lease-token.ts +44 -0
  652. package/test/fixtures/strip-setup-step.ts +23 -0
  653. package/test/globalSetup.ts +54 -0
  654. package/test/helpers/workflow-runs.ts +210 -0
  655. package/test/index.ts +3 -0
  656. package/test/setup.ts +17 -0
  657. package/tsconfig.build.json +9 -0
  658. package/tsconfig.build.tsbuildinfo +1 -0
  659. package/tsconfig.json +3 -0
  660. package/tsconfig.test.json +8 -0
  661. package/vitest.config.ts +12 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/db/schema/jobs.ts"],"sourcesContent":["import {uuidv7PrimaryKey} from '@shipfox/node-drizzle';\nimport {sql} from 'drizzle-orm';\nimport {\n bigint,\n boolean,\n index,\n integer,\n jsonb,\n pgEnum,\n text,\n timestamp,\n uuid,\n} from 'drizzle-orm/pg-core';\nimport {\n JOB_STATUS_REASONS,\n type Job,\n type JobListeningTrigger,\n toJobStatusReason,\n} from '#core/entities/job.js';\nimport type {PersistedEvaluationTraceEntry} from '#core/entities/step.js';\nimport {pgTable} from './common.js';\nimport {workflowRunAttempts} from './workflow-run-attempts.js';\n\nexport const jobStatusEnum = pgEnum('workflows_job_status', [\n 'pending',\n 'running',\n 'succeeded',\n 'failed',\n 'cancelled',\n 'skipped',\n]);\n\nexport const jobStatusReasonEnum = pgEnum('workflows_job_status_reason', JOB_STATUS_REASONS);\n\nexport const jobModeEnum = pgEnum('workflows_job_mode', ['one_shot', 'listening']);\n\nexport const jobCheckoutContentsEnum = pgEnum('workflows_checkout_contents', ['read', 'write']);\n\nexport const jobOnResolveEnum = pgEnum('workflows_job_on_resolve', ['finish', 'cancel']);\n\nexport const listenerStatusEnum = pgEnum('workflows_listener_status', [\n 'inactive',\n 'listening',\n 'resolved',\n]);\n\nexport const resolutionReasonEnum = pgEnum('workflows_resolution_reason', [\n 'until',\n 'timeout',\n 'max_executions',\n 'cancelled',\n]);\n\nexport const jobs = pgTable(\n 'jobs',\n {\n id: uuidv7PrimaryKey(),\n workflowRunAttemptId: uuid('workflow_run_attempt_id')\n .notNull()\n .references(() => workflowRunAttempts.id, {onDelete: 'cascade'}),\n key: text('key').notNull(),\n mode: jobModeEnum('mode').notNull().default('one_shot'),\n name: text('name'),\n status: jobStatusEnum('status').notNull().default('pending'),\n statusReason: jobStatusReasonEnum('status_reason'),\n carriedOver: boolean('carried_over').notNull().default(false),\n checkoutPersistCredentials: boolean('checkout_persist_credentials').notNull(),\n checkoutPermissionsContents: jobCheckoutContentsEnum('checkout_permissions_contents').notNull(),\n success: text('success'),\n evaluationTrace: jsonb('evaluation_trace').$type<readonly PersistedEvaluationTraceEntry[]>(),\n executionTimeoutMs: integer('execution_timeout_ms'),\n listeningTimeoutMs: bigint('listening_timeout_ms', {mode: 'number'}),\n maxExecutions: integer('max_executions'),\n onResolve: jobOnResolveEnum('on_resolve'),\n batchDebounceMs: integer('batch_debounce_ms'),\n batchMaxSize: integer('batch_max_size'),\n batchMaxWaitMs: integer('batch_max_wait_ms'),\n listenerStatus: listenerStatusEnum('listener_status').notNull().default('inactive'),\n resolutionReason: resolutionReasonEnum('resolution_reason'),\n listeningOn: jsonb('listening_on').$type<JobListeningTrigger[]>(),\n listeningUntil: jsonb('listening_until').$type<JobListeningTrigger[]>(),\n outputs: jsonb('outputs').$type<Record<string, unknown> | null>(),\n dependencies: jsonb('dependencies').notNull().$type<string[]>(),\n runner: jsonb('runner').$type<string[]>(),\n position: integer('position').notNull(),\n version: integer('version').notNull().default(1),\n createdAt: timestamp('created_at', {withTimezone: true}).notNull().defaultNow(),\n updatedAt: timestamp('updated_at', {withTimezone: true}).notNull().defaultNow(),\n },\n (table) => [\n index('workflows_jobs_workflow_run_attempt_id_idx').on(table.workflowRunAttemptId),\n index('workflows_jobs_active_listeners_idx')\n .on(table.listenerStatus)\n .where(sql`${table.listenerStatus} = 'listening'`),\n ],\n);\n\nexport type JobDb = typeof jobs.$inferSelect;\nexport type JobCreateDb = typeof jobs.$inferInsert;\n\nexport function toJob(row: JobDb): Job {\n return {\n id: row.id,\n workflowRunAttemptId: row.workflowRunAttemptId,\n key: row.key,\n name: row.name,\n mode: row.mode,\n status: row.status,\n statusReason: toJobStatusReason(row.statusReason),\n carriedOver: row.carriedOver,\n checkout: {\n permissions: {contents: row.checkoutPermissionsContents},\n persistCredentials: row.checkoutPersistCredentials,\n },\n success: row.success,\n evaluationTrace: row.evaluationTrace ?? null,\n executionTimeoutMs: row.executionTimeoutMs,\n listeningTimeoutMs: row.listeningTimeoutMs,\n maxExecutions: row.maxExecutions,\n onResolve: row.onResolve,\n batchDebounceMs: row.batchDebounceMs,\n batchMaxSize: row.batchMaxSize,\n batchMaxWaitMs: row.batchMaxWaitMs,\n listenerStatus: row.listenerStatus,\n resolutionReason: row.resolutionReason,\n listeningOn: row.listeningOn,\n listeningUntil: row.listeningUntil,\n outputs: row.outputs,\n dependencies: row.dependencies as string[],\n runner: row.runner as string[] | null,\n position: row.position,\n version: row.version,\n createdAt: row.createdAt,\n updatedAt: row.updatedAt,\n };\n}\n"],"names":["uuidv7PrimaryKey","sql","bigint","boolean","index","integer","jsonb","pgEnum","text","timestamp","uuid","JOB_STATUS_REASONS","toJobStatusReason","pgTable","workflowRunAttempts","jobStatusEnum","jobStatusReasonEnum","jobModeEnum","jobCheckoutContentsEnum","jobOnResolveEnum","listenerStatusEnum","resolutionReasonEnum","jobs","id","workflowRunAttemptId","notNull","references","onDelete","key","mode","default","name","status","statusReason","carriedOver","checkoutPersistCredentials","checkoutPermissionsContents","success","evaluationTrace","$type","executionTimeoutMs","listeningTimeoutMs","maxExecutions","onResolve","batchDebounceMs","batchMaxSize","batchMaxWaitMs","listenerStatus","resolutionReason","listeningOn","listeningUntil","outputs","dependencies","runner","position","version","createdAt","withTimezone","defaultNow","updatedAt","table","on","where","toJob","row","checkout","permissions","contents","persistCredentials"],"mappings":"AAAA,SAAQA,gBAAgB,QAAO,wBAAwB;AACvD,SAAQC,GAAG,QAAO,cAAc;AAChC,SACEC,MAAM,EACNC,OAAO,EACPC,KAAK,EACLC,OAAO,EACPC,KAAK,EACLC,MAAM,EACNC,IAAI,EACJC,SAAS,EACTC,IAAI,QACC,sBAAsB;AAC7B,SACEC,kBAAkB,EAGlBC,iBAAiB,QACZ,wBAAwB;AAE/B,SAAQC,OAAO,QAAO,cAAc;AACpC,SAAQC,mBAAmB,QAAO,6BAA6B;AAE/D,OAAO,MAAMC,gBAAgBR,OAAO,wBAAwB;IAC1D;IACA;IACA;IACA;IACA;IACA;CACD,EAAE;AAEH,OAAO,MAAMS,sBAAsBT,OAAO,+BAA+BI,oBAAoB;AAE7F,OAAO,MAAMM,cAAcV,OAAO,sBAAsB;IAAC;IAAY;CAAY,EAAE;AAEnF,OAAO,MAAMW,0BAA0BX,OAAO,+BAA+B;IAAC;IAAQ;CAAQ,EAAE;AAEhG,OAAO,MAAMY,mB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AIhB,gBAAgB;QACtCC,aAAae,IAAIf,WAAW;QAC5BC,gBAAgBc,IAAId,cAAc;QAClCC,SAASa,IAAIb,OAAO;QACpBC,cAAcY,IAAIZ,YAAY;QAC9BC,QAAQW,IAAIX,MAAM;QAClBC,UAAUU,IAAIV,QAAQ;QACtBC,SAASS,IAAIT,OAAO;QACpBC,WAAWQ,IAAIR,SAAS;QACxBG,WAAWK,IAAIL,SAAS;IAC1B;AACF"}
@@ -0,0 +1,195 @@
1
+ export declare const workflowsOutbox: import("drizzle-orm/pg-core").PgTableWithColumns<{
2
+ name: "outbox";
3
+ schema: undefined;
4
+ columns: {
5
+ id: import("drizzle-orm/pg-core").PgColumn<{
6
+ name: "id";
7
+ tableName: "outbox";
8
+ dataType: "string";
9
+ columnType: "PgUUID";
10
+ data: string;
11
+ driverParam: string;
12
+ notNull: true;
13
+ hasDefault: true;
14
+ isPrimaryKey: true;
15
+ isAutoincrement: false;
16
+ hasRuntimeDefault: false;
17
+ enumValues: undefined;
18
+ baseColumn: never;
19
+ identity: undefined;
20
+ generated: undefined;
21
+ }, {}, {}>;
22
+ eventType: import("drizzle-orm/pg-core").PgColumn<{
23
+ name: "event_type";
24
+ tableName: "outbox";
25
+ dataType: "string";
26
+ columnType: "PgText";
27
+ data: string;
28
+ driverParam: string;
29
+ notNull: true;
30
+ hasDefault: false;
31
+ isPrimaryKey: false;
32
+ isAutoincrement: false;
33
+ hasRuntimeDefault: false;
34
+ enumValues: [string, ...string[]];
35
+ baseColumn: never;
36
+ identity: undefined;
37
+ generated: undefined;
38
+ }, {}, {}>;
39
+ orderingKey: import("drizzle-orm/pg-core").PgColumn<{
40
+ name: "ordering_key";
41
+ tableName: "outbox";
42
+ dataType: "string";
43
+ columnType: "PgText";
44
+ data: string;
45
+ driverParam: string;
46
+ notNull: false;
47
+ hasDefault: false;
48
+ isPrimaryKey: false;
49
+ isAutoincrement: false;
50
+ hasRuntimeDefault: false;
51
+ enumValues: [string, ...string[]];
52
+ baseColumn: never;
53
+ identity: undefined;
54
+ generated: undefined;
55
+ }, {}, {}>;
56
+ payload: import("drizzle-orm/pg-core").PgColumn<{
57
+ name: "payload";
58
+ tableName: "outbox";
59
+ dataType: "json";
60
+ columnType: "PgJsonb";
61
+ data: unknown;
62
+ driverParam: unknown;
63
+ notNull: true;
64
+ hasDefault: false;
65
+ isPrimaryKey: false;
66
+ isAutoincrement: false;
67
+ hasRuntimeDefault: false;
68
+ enumValues: undefined;
69
+ baseColumn: never;
70
+ identity: undefined;
71
+ generated: undefined;
72
+ }, {}, {}>;
73
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
74
+ name: "created_at";
75
+ tableName: "outbox";
76
+ dataType: "date";
77
+ columnType: "PgTimestamp";
78
+ data: Date;
79
+ driverParam: string;
80
+ notNull: true;
81
+ hasDefault: true;
82
+ isPrimaryKey: false;
83
+ isAutoincrement: false;
84
+ hasRuntimeDefault: false;
85
+ enumValues: undefined;
86
+ baseColumn: never;
87
+ identity: undefined;
88
+ generated: undefined;
89
+ }, {}, {}>;
90
+ dispatchedAt: import("drizzle-orm/pg-core").PgColumn<{
91
+ name: "dispatched_at";
92
+ tableName: "outbox";
93
+ dataType: "date";
94
+ columnType: "PgTimestamp";
95
+ data: Date;
96
+ driverParam: string;
97
+ notNull: false;
98
+ hasDefault: false;
99
+ isPrimaryKey: false;
100
+ isAutoincrement: false;
101
+ hasRuntimeDefault: false;
102
+ enumValues: undefined;
103
+ baseColumn: never;
104
+ identity: undefined;
105
+ generated: undefined;
106
+ }, {}, {}>;
107
+ dispatchAttempts: import("drizzle-orm/pg-core").PgColumn<{
108
+ name: "dispatch_attempts";
109
+ tableName: "outbox";
110
+ dataType: "number";
111
+ columnType: "PgInteger";
112
+ data: number;
113
+ driverParam: string | number;
114
+ notNull: true;
115
+ hasDefault: true;
116
+ isPrimaryKey: false;
117
+ isAutoincrement: false;
118
+ hasRuntimeDefault: false;
119
+ enumValues: undefined;
120
+ baseColumn: never;
121
+ identity: undefined;
122
+ generated: undefined;
123
+ }, {}, {}>;
124
+ nextDispatchAt: import("drizzle-orm/pg-core").PgColumn<{
125
+ name: "next_dispatch_at";
126
+ tableName: "outbox";
127
+ dataType: "date";
128
+ columnType: "PgTimestamp";
129
+ data: Date;
130
+ driverParam: string;
131
+ notNull: true;
132
+ hasDefault: true;
133
+ isPrimaryKey: false;
134
+ isAutoincrement: false;
135
+ hasRuntimeDefault: false;
136
+ enumValues: undefined;
137
+ baseColumn: never;
138
+ identity: undefined;
139
+ generated: undefined;
140
+ }, {}, {}>;
141
+ lastDispatchError: import("drizzle-orm/pg-core").PgColumn<{
142
+ name: "last_dispatch_error";
143
+ tableName: "outbox";
144
+ dataType: "json";
145
+ columnType: "PgJsonb";
146
+ data: unknown;
147
+ driverParam: unknown;
148
+ notNull: false;
149
+ hasDefault: false;
150
+ isPrimaryKey: false;
151
+ isAutoincrement: false;
152
+ hasRuntimeDefault: false;
153
+ enumValues: undefined;
154
+ baseColumn: never;
155
+ identity: undefined;
156
+ generated: undefined;
157
+ }, {}, {}>;
158
+ lastDispatchFailedAt: import("drizzle-orm/pg-core").PgColumn<{
159
+ name: "last_dispatch_failed_at";
160
+ tableName: "outbox";
161
+ dataType: "date";
162
+ columnType: "PgTimestamp";
163
+ data: Date;
164
+ driverParam: string;
165
+ notNull: false;
166
+ hasDefault: false;
167
+ isPrimaryKey: false;
168
+ isAutoincrement: false;
169
+ hasRuntimeDefault: false;
170
+ enumValues: undefined;
171
+ baseColumn: never;
172
+ identity: undefined;
173
+ generated: undefined;
174
+ }, {}, {}>;
175
+ deadLetteredAt: import("drizzle-orm/pg-core").PgColumn<{
176
+ name: "dead_lettered_at";
177
+ tableName: "outbox";
178
+ dataType: "date";
179
+ columnType: "PgTimestamp";
180
+ data: Date;
181
+ driverParam: string;
182
+ notNull: false;
183
+ hasDefault: false;
184
+ isPrimaryKey: false;
185
+ isAutoincrement: false;
186
+ hasRuntimeDefault: false;
187
+ enumValues: undefined;
188
+ baseColumn: never;
189
+ identity: undefined;
190
+ generated: undefined;
191
+ }, {}, {}>;
192
+ };
193
+ dialect: "pg";
194
+ }>;
195
+ //# sourceMappingURL=outbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outbox.d.ts","sourceRoot":"","sources":["../../../src/db/schema/outbox.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA6B,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { createOutboxTable } from '@shipfox/node-outbox';
2
+ import { pgTable } from './common.js';
3
+ export const workflowsOutbox = createOutboxTable(pgTable);
4
+
5
+ //# sourceMappingURL=outbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/db/schema/outbox.ts"],"sourcesContent":["import {createOutboxTable} from '@shipfox/node-outbox';\nimport {pgTable} from './common.js';\n\nexport const workflowsOutbox = createOutboxTable(pgTable);\n"],"names":["createOutboxTable","pgTable","workflowsOutbox"],"mappings":"AAAA,SAAQA,iBAAiB,QAAO,uBAAuB;AACvD,SAAQC,OAAO,QAAO,cAAc;AAEpC,OAAO,MAAMC,kBAAkBF,kBAAkBC,SAAS"}
@@ -0,0 +1,330 @@
1
+ import type { PersistedEvaluationTraceEntry, StepAttempt, StepAttemptLogOutcome } from '#core/entities/step.js';
2
+ export declare const stepAttempts: import("drizzle-orm/pg-core").PgTableWithColumns<{
3
+ name: "step_attempts";
4
+ schema: undefined;
5
+ columns: {
6
+ id: import("drizzle-orm/pg-core").PgColumn<{
7
+ name: "id";
8
+ tableName: "step_attempts";
9
+ dataType: "string";
10
+ columnType: "PgUUID";
11
+ data: string;
12
+ driverParam: string;
13
+ notNull: true;
14
+ hasDefault: true;
15
+ isPrimaryKey: true;
16
+ isAutoincrement: false;
17
+ hasRuntimeDefault: false;
18
+ enumValues: undefined;
19
+ baseColumn: never;
20
+ identity: undefined;
21
+ generated: undefined;
22
+ }, {}, {}>;
23
+ stepId: import("drizzle-orm/pg-core").PgColumn<{
24
+ name: "step_id";
25
+ tableName: "step_attempts";
26
+ dataType: "string";
27
+ columnType: "PgUUID";
28
+ data: string;
29
+ driverParam: string;
30
+ notNull: true;
31
+ hasDefault: false;
32
+ isPrimaryKey: false;
33
+ isAutoincrement: false;
34
+ hasRuntimeDefault: false;
35
+ enumValues: undefined;
36
+ baseColumn: never;
37
+ identity: undefined;
38
+ generated: undefined;
39
+ }, {}, {}>;
40
+ jobExecutionId: import("drizzle-orm/pg-core").PgColumn<{
41
+ name: "job_execution_id";
42
+ tableName: "step_attempts";
43
+ dataType: "string";
44
+ columnType: "PgUUID";
45
+ data: string;
46
+ driverParam: string;
47
+ notNull: true;
48
+ hasDefault: false;
49
+ isPrimaryKey: false;
50
+ isAutoincrement: false;
51
+ hasRuntimeDefault: false;
52
+ enumValues: undefined;
53
+ baseColumn: never;
54
+ identity: undefined;
55
+ generated: undefined;
56
+ }, {}, {}>;
57
+ attempt: import("drizzle-orm/pg-core").PgColumn<{
58
+ name: "attempt";
59
+ tableName: "step_attempts";
60
+ dataType: "number";
61
+ columnType: "PgInteger";
62
+ data: number;
63
+ driverParam: string | number;
64
+ notNull: true;
65
+ hasDefault: false;
66
+ isPrimaryKey: false;
67
+ isAutoincrement: false;
68
+ hasRuntimeDefault: false;
69
+ enumValues: undefined;
70
+ baseColumn: never;
71
+ identity: undefined;
72
+ generated: undefined;
73
+ }, {}, {}>;
74
+ executionOrder: import("drizzle-orm/pg-core").PgColumn<{
75
+ name: "execution_order";
76
+ tableName: "step_attempts";
77
+ dataType: "number";
78
+ columnType: "PgInteger";
79
+ data: number;
80
+ driverParam: string | number;
81
+ notNull: true;
82
+ hasDefault: false;
83
+ isPrimaryKey: false;
84
+ isAutoincrement: false;
85
+ hasRuntimeDefault: false;
86
+ enumValues: undefined;
87
+ baseColumn: never;
88
+ identity: undefined;
89
+ generated: undefined;
90
+ }, {}, {}>;
91
+ status: import("drizzle-orm/pg-core").PgColumn<{
92
+ name: "status";
93
+ tableName: "step_attempts";
94
+ dataType: "string";
95
+ columnType: "PgEnumColumn";
96
+ data: "pending" | "running" | "succeeded" | "failed" | "cancelled" | "skipped";
97
+ driverParam: string;
98
+ notNull: true;
99
+ hasDefault: false;
100
+ isPrimaryKey: false;
101
+ isAutoincrement: false;
102
+ hasRuntimeDefault: false;
103
+ enumValues: ["pending", "running", "succeeded", "failed", "cancelled", "skipped"];
104
+ baseColumn: never;
105
+ identity: undefined;
106
+ generated: undefined;
107
+ }, {}, {}>;
108
+ config: import("drizzle-orm/pg-core").PgColumn<{
109
+ name: "config";
110
+ tableName: "step_attempts";
111
+ dataType: "json";
112
+ columnType: "PgJsonb";
113
+ data: Record<string, unknown>;
114
+ driverParam: unknown;
115
+ notNull: false;
116
+ hasDefault: false;
117
+ isPrimaryKey: false;
118
+ isAutoincrement: false;
119
+ hasRuntimeDefault: false;
120
+ enumValues: undefined;
121
+ baseColumn: never;
122
+ identity: undefined;
123
+ generated: undefined;
124
+ }, {}, {
125
+ $type: Record<string, unknown>;
126
+ }>;
127
+ evaluationTrace: import("drizzle-orm/pg-core").PgColumn<{
128
+ name: "evaluation_trace";
129
+ tableName: "step_attempts";
130
+ dataType: "json";
131
+ columnType: "PgJsonb";
132
+ data: readonly PersistedEvaluationTraceEntry[];
133
+ driverParam: unknown;
134
+ notNull: false;
135
+ hasDefault: false;
136
+ isPrimaryKey: false;
137
+ isAutoincrement: false;
138
+ hasRuntimeDefault: false;
139
+ enumValues: undefined;
140
+ baseColumn: never;
141
+ identity: undefined;
142
+ generated: undefined;
143
+ }, {}, {
144
+ $type: readonly PersistedEvaluationTraceEntry[];
145
+ }>;
146
+ output: import("drizzle-orm/pg-core").PgColumn<{
147
+ name: "output";
148
+ tableName: "step_attempts";
149
+ dataType: "json";
150
+ columnType: "PgJsonb";
151
+ data: Record<string, unknown>;
152
+ driverParam: unknown;
153
+ notNull: false;
154
+ hasDefault: false;
155
+ isPrimaryKey: false;
156
+ isAutoincrement: false;
157
+ hasRuntimeDefault: false;
158
+ enumValues: undefined;
159
+ baseColumn: never;
160
+ identity: undefined;
161
+ generated: undefined;
162
+ }, {}, {
163
+ $type: Record<string, unknown>;
164
+ }>;
165
+ response: import("drizzle-orm/pg-core").PgColumn<{
166
+ name: "response";
167
+ tableName: "step_attempts";
168
+ dataType: "string";
169
+ columnType: "PgText";
170
+ data: string;
171
+ driverParam: string;
172
+ notNull: false;
173
+ hasDefault: false;
174
+ isPrimaryKey: false;
175
+ isAutoincrement: false;
176
+ hasRuntimeDefault: false;
177
+ enumValues: [string, ...string[]];
178
+ baseColumn: never;
179
+ identity: undefined;
180
+ generated: undefined;
181
+ }, {}, {}>;
182
+ error: import("drizzle-orm/pg-core").PgColumn<{
183
+ name: "error";
184
+ tableName: "step_attempts";
185
+ dataType: "json";
186
+ columnType: "PgJsonb";
187
+ data: Record<string, unknown>;
188
+ driverParam: unknown;
189
+ notNull: false;
190
+ hasDefault: false;
191
+ isPrimaryKey: false;
192
+ isAutoincrement: false;
193
+ hasRuntimeDefault: false;
194
+ enumValues: undefined;
195
+ baseColumn: never;
196
+ identity: undefined;
197
+ generated: undefined;
198
+ }, {}, {
199
+ $type: Record<string, unknown>;
200
+ }>;
201
+ exitCode: import("drizzle-orm/pg-core").PgColumn<{
202
+ name: "exit_code";
203
+ tableName: "step_attempts";
204
+ dataType: "number";
205
+ columnType: "PgInteger";
206
+ data: number;
207
+ driverParam: string | number;
208
+ notNull: false;
209
+ hasDefault: false;
210
+ isPrimaryKey: false;
211
+ isAutoincrement: false;
212
+ hasRuntimeDefault: false;
213
+ enumValues: undefined;
214
+ baseColumn: never;
215
+ identity: undefined;
216
+ generated: undefined;
217
+ }, {}, {}>;
218
+ logOutcome: import("drizzle-orm/pg-core").PgColumn<{
219
+ name: "log_outcome";
220
+ tableName: "step_attempts";
221
+ dataType: "string";
222
+ columnType: "PgText";
223
+ data: StepAttemptLogOutcome;
224
+ driverParam: string;
225
+ notNull: false;
226
+ hasDefault: false;
227
+ isPrimaryKey: false;
228
+ isAutoincrement: false;
229
+ hasRuntimeDefault: false;
230
+ enumValues: [string, ...string[]];
231
+ baseColumn: never;
232
+ identity: undefined;
233
+ generated: undefined;
234
+ }, {}, {
235
+ $type: StepAttemptLogOutcome;
236
+ }>;
237
+ gateResult: import("drizzle-orm/pg-core").PgColumn<{
238
+ name: "gate_result";
239
+ tableName: "step_attempts";
240
+ dataType: "json";
241
+ columnType: "PgJsonb";
242
+ data: Record<string, unknown>;
243
+ driverParam: unknown;
244
+ notNull: false;
245
+ hasDefault: false;
246
+ isPrimaryKey: false;
247
+ isAutoincrement: false;
248
+ hasRuntimeDefault: false;
249
+ enumValues: undefined;
250
+ baseColumn: never;
251
+ identity: undefined;
252
+ generated: undefined;
253
+ }, {}, {
254
+ $type: Record<string, unknown>;
255
+ }>;
256
+ restartFeedback: import("drizzle-orm/pg-core").PgColumn<{
257
+ name: "restart_feedback";
258
+ tableName: "step_attempts";
259
+ dataType: "string";
260
+ columnType: "PgText";
261
+ data: string;
262
+ driverParam: string;
263
+ notNull: false;
264
+ hasDefault: false;
265
+ isPrimaryKey: false;
266
+ isAutoincrement: false;
267
+ hasRuntimeDefault: false;
268
+ enumValues: [string, ...string[]];
269
+ baseColumn: never;
270
+ identity: undefined;
271
+ generated: undefined;
272
+ }, {}, {}>;
273
+ startedAt: import("drizzle-orm/pg-core").PgColumn<{
274
+ name: "started_at";
275
+ tableName: "step_attempts";
276
+ dataType: "date";
277
+ columnType: "PgTimestamp";
278
+ data: Date;
279
+ driverParam: string;
280
+ notNull: true;
281
+ hasDefault: true;
282
+ isPrimaryKey: false;
283
+ isAutoincrement: false;
284
+ hasRuntimeDefault: false;
285
+ enumValues: undefined;
286
+ baseColumn: never;
287
+ identity: undefined;
288
+ generated: undefined;
289
+ }, {}, {}>;
290
+ finishedAt: import("drizzle-orm/pg-core").PgColumn<{
291
+ name: "finished_at";
292
+ tableName: "step_attempts";
293
+ dataType: "date";
294
+ columnType: "PgTimestamp";
295
+ data: Date;
296
+ driverParam: string;
297
+ notNull: false;
298
+ hasDefault: false;
299
+ isPrimaryKey: false;
300
+ isAutoincrement: false;
301
+ hasRuntimeDefault: false;
302
+ enumValues: undefined;
303
+ baseColumn: never;
304
+ identity: undefined;
305
+ generated: undefined;
306
+ }, {}, {}>;
307
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
308
+ name: "created_at";
309
+ tableName: "step_attempts";
310
+ dataType: "date";
311
+ columnType: "PgTimestamp";
312
+ data: Date;
313
+ driverParam: string;
314
+ notNull: true;
315
+ hasDefault: true;
316
+ isPrimaryKey: false;
317
+ isAutoincrement: false;
318
+ hasRuntimeDefault: false;
319
+ enumValues: undefined;
320
+ baseColumn: never;
321
+ identity: undefined;
322
+ generated: undefined;
323
+ }, {}, {}>;
324
+ };
325
+ dialect: "pg";
326
+ }>;
327
+ export type StepAttemptDb = typeof stepAttempts.$inferSelect;
328
+ export type StepAttemptCreateDb = typeof stepAttempts.$inferInsert;
329
+ export declare function toStepAttempt(row: StepAttemptDb): StepAttempt;
330
+ //# sourceMappingURL=step-attempts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"step-attempts.d.ts","sourceRoot":"","sources":["../../../src/db/schema/step-attempts.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,6BAA6B,EAC7B,WAAW,EACX,qBAAqB,EAEtB,MAAM,wBAAwB,CAAC;AAQhC,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgDxB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,OAAO,YAAY,CAAC,YAAY,CAAC;AAC7D,MAAM,MAAM,mBAAmB,GAAG,OAAO,YAAY,CAAC,YAAY,CAAC;AAEnE,wBAAgB,aAAa,CAAC,GAAG,EAAE,aAAa,GAAG,WAAW,CAoB7D"}
@@ -0,0 +1,80 @@
1
+ import { uuidv7PrimaryKey } from '@shipfox/node-drizzle';
2
+ import { sql } from 'drizzle-orm';
3
+ import { check, foreignKey, integer, jsonb, text, timestamp, unique, uuid } from 'drizzle-orm/pg-core';
4
+ import { pgTable } from './common.js';
5
+ import { stepStatusEnum, steps } from './steps.js';
6
+ // Append-only execution history. One row per dispatched attempt of a step,
7
+ // inserted `running` at dispatch and finalized terminal at report. `steps` holds
8
+ // the fast current projection; this table is the audit trail and — via the
9
+ // unique (step_id, attempt) constraint — the idempotency anchor.
10
+ export const stepAttempts = pgTable('step_attempts', {
11
+ id: uuidv7PrimaryKey(),
12
+ stepId: uuid('step_id').notNull().references(()=>steps.id, {
13
+ onDelete: 'cascade'
14
+ }),
15
+ jobExecutionId: uuid('job_execution_id').notNull(),
16
+ attempt: integer('attempt').notNull(),
17
+ executionOrder: integer('execution_order').notNull(),
18
+ // Reuses the step status enum, but a row is created only once dispatched, so
19
+ // it is never 'pending'.
20
+ status: stepStatusEnum('status').notNull(),
21
+ config: jsonb('config').$type(),
22
+ evaluationTrace: jsonb('evaluation_trace').$type(),
23
+ output: jsonb('output').$type(),
24
+ response: text('response'),
25
+ error: jsonb('error').$type(),
26
+ exitCode: integer('exit_code'),
27
+ logOutcome: text('log_outcome').$type(),
28
+ gateResult: jsonb('gate_result').$type(),
29
+ restartFeedback: text('restart_feedback'),
30
+ startedAt: timestamp('started_at', {
31
+ withTimezone: true
32
+ }).notNull().defaultNow(),
33
+ finishedAt: timestamp('finished_at', {
34
+ withTimezone: true
35
+ }),
36
+ createdAt: timestamp('created_at', {
37
+ withTimezone: true
38
+ }).notNull().defaultNow()
39
+ }, (table)=>[
40
+ unique('workflows_step_attempts_step_id_attempt_uq').on(table.stepId, table.attempt),
41
+ unique('workflows_step_attempts_job_execution_id_execution_order_uq').on(table.jobExecutionId, table.executionOrder),
42
+ foreignKey({
43
+ name: 'workflows_step_attempts_step_id_job_execution_id_workflows_steps_fk',
44
+ columns: [
45
+ table.stepId,
46
+ table.jobExecutionId
47
+ ],
48
+ foreignColumns: [
49
+ steps.id,
50
+ steps.jobExecutionId
51
+ ]
52
+ }).onDelete('cascade'),
53
+ check('workflows_step_attempts_attempt_positive_ck', sql`${table.attempt} > 0`),
54
+ check('workflows_step_attempts_execution_order_positive_ck', sql`${table.executionOrder} > 0`),
55
+ check('workflows_step_attempts_status_dispatched_ck', sql`${table.status} NOT IN ('pending', 'skipped')`),
56
+ check('workflows_step_attempts_log_outcome_ck', sql`${table.logOutcome} IS NULL OR ${table.logOutcome} IN ('drained', 'abandoned')`)
57
+ ]);
58
+ export function toStepAttempt(row) {
59
+ return {
60
+ id: row.id,
61
+ stepId: row.stepId,
62
+ attempt: row.attempt,
63
+ executionOrder: row.executionOrder,
64
+ status: row.status,
65
+ config: row.config ?? null,
66
+ evaluationTrace: row.evaluationTrace ?? null,
67
+ output: row.output ?? null,
68
+ response: row.response ?? null,
69
+ error: row.error ?? null,
70
+ exitCode: row.exitCode ?? null,
71
+ logOutcome: row.logOutcome ?? null,
72
+ gateResult: row.gateResult ?? null,
73
+ restartFeedback: row.restartFeedback ?? null,
74
+ startedAt: row.startedAt,
75
+ finishedAt: row.finishedAt ?? null,
76
+ createdAt: row.createdAt
77
+ };
78
+ }
79
+
80
+ //# sourceMappingURL=step-attempts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/db/schema/step-attempts.ts"],"sourcesContent":["import {uuidv7PrimaryKey} from '@shipfox/node-drizzle';\nimport {sql} from 'drizzle-orm';\nimport {\n check,\n foreignKey,\n integer,\n jsonb,\n text,\n timestamp,\n unique,\n uuid,\n} from 'drizzle-orm/pg-core';\nimport type {\n PersistedEvaluationTraceEntry,\n StepAttempt,\n StepAttemptLogOutcome,\n StepAttemptStatus,\n} from '#core/entities/step.js';\nimport {pgTable} from './common.js';\nimport {stepStatusEnum, steps} from './steps.js';\n\n// Append-only execution history. One row per dispatched attempt of a step,\n// inserted `running` at dispatch and finalized terminal at report. `steps` holds\n// the fast current projection; this table is the audit trail and — via the\n// unique (step_id, attempt) constraint — the idempotency anchor.\nexport const stepAttempts = pgTable(\n 'step_attempts',\n {\n id: uuidv7PrimaryKey(),\n stepId: uuid('step_id')\n .notNull()\n .references(() => steps.id, {onDelete: 'cascade'}),\n jobExecutionId: uuid('job_execution_id').notNull(),\n attempt: integer('attempt').notNull(),\n executionOrder: integer('execution_order').notNull(),\n // Reuses the step status enum, but a row is created only once dispatched, so\n // it is never 'pending'.\n status: stepStatusEnum('status').notNull(),\n config: jsonb('config').$type<Record<string, unknown>>(),\n evaluationTrace: jsonb('evaluation_trace').$type<readonly PersistedEvaluationTraceEntry[]>(),\n output: jsonb('output').$type<Record<string, unknown>>(),\n response: text('response'),\n error: jsonb('error').$type<Record<string, unknown>>(),\n exitCode: integer('exit_code'),\n logOutcome: text('log_outcome').$type<StepAttemptLogOutcome>(),\n gateResult: jsonb('gate_result').$type<Record<string, unknown>>(),\n restartFeedback: text('restart_feedback'),\n startedAt: timestamp('started_at', {withTimezone: true}).notNull().defaultNow(),\n finishedAt: timestamp('finished_at', {withTimezone: true}),\n createdAt: timestamp('created_at', {withTimezone: true}).notNull().defaultNow(),\n },\n (table) => [\n unique('workflows_step_attempts_step_id_attempt_uq').on(table.stepId, table.attempt),\n unique('workflows_step_attempts_job_execution_id_execution_order_uq').on(\n table.jobExecutionId,\n table.executionOrder,\n ),\n foreignKey({\n name: 'workflows_step_attempts_step_id_job_execution_id_workflows_steps_fk',\n columns: [table.stepId, table.jobExecutionId],\n foreignColumns: [steps.id, steps.jobExecutionId],\n }).onDelete('cascade'),\n check('workflows_step_attempts_attempt_positive_ck', sql`${table.attempt} > 0`),\n check('workflows_step_attempts_execution_order_positive_ck', sql`${table.executionOrder} > 0`),\n check(\n 'workflows_step_attempts_status_dispatched_ck',\n sql`${table.status} NOT IN ('pending', 'skipped')`,\n ),\n check(\n 'workflows_step_attempts_log_outcome_ck',\n sql`${table.logOutcome} IS NULL OR ${table.logOutcome} IN ('drained', 'abandoned')`,\n ),\n ],\n);\n\nexport type StepAttemptDb = typeof stepAttempts.$inferSelect;\nexport type StepAttemptCreateDb = typeof stepAttempts.$inferInsert;\n\nexport function toStepAttempt(row: StepAttemptDb): StepAttempt {\n return {\n id: row.id,\n stepId: row.stepId,\n attempt: row.attempt,\n executionOrder: row.executionOrder,\n status: row.status as StepAttemptStatus,\n config: (row.config as Record<string, unknown>) ?? null,\n evaluationTrace: row.evaluationTrace ?? null,\n output: (row.output as Record<string, unknown>) ?? null,\n response: row.response ?? null,\n error: (row.error as Record<string, unknown>) ?? null,\n exitCode: row.exitCode ?? null,\n logOutcome: row.logOutcome ?? null,\n gateResult: (row.gateResult as Record<string, unknown>) ?? null,\n restartFeedback: row.restartFeedback ?? null,\n startedAt: row.startedAt,\n finishedAt: row.finishedAt ?? null,\n createdAt: row.createdAt,\n };\n}\n"],"names":["uuidv7PrimaryKey","sql","check","foreignKey","integer","jsonb","text","timestamp","unique","uuid","pgTable","stepStatusEnum","steps","stepAttempts","id","stepId","notNull","references","onDelete","jobExecutionId","attempt","executionOrder","status","config","$type","evaluationTrace","output","response","error","exitCode","logOutcome","gateResult","restartFeedback","startedAt","withTimezone","defaultNow","finishedAt","createdAt","table","on","name","columns","foreignColumns","toStepAttempt","row"],"mappings":"AAA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