@shipfox/api-workflows 10.2.0 → 12.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 (354) hide show
  1. package/.turbo/turbo-build.log +8 -8
  2. package/CHANGELOG.md +117 -0
  3. package/README.md +75 -0
  4. package/dist/core/agent-defaults.d.ts +2 -1
  5. package/dist/core/agent-defaults.d.ts.map +1 -1
  6. package/dist/core/agent-defaults.js.map +1 -1
  7. package/dist/core/checkout.d.ts +7 -21
  8. package/dist/core/checkout.d.ts.map +1 -1
  9. package/dist/core/checkout.js +122 -41
  10. package/dist/core/checkout.js.map +1 -1
  11. package/dist/core/entities/job-execution.d.ts +8 -0
  12. package/dist/core/entities/job-execution.d.ts.map +1 -1
  13. package/dist/core/entities/job-execution.js +13 -1
  14. package/dist/core/entities/job-execution.js.map +1 -1
  15. package/dist/core/entities/job-listener-event.d.ts +2 -0
  16. package/dist/core/entities/job-listener-event.d.ts.map +1 -1
  17. package/dist/core/entities/job-listener-event.js.map +1 -1
  18. package/dist/core/entities/step.d.ts +13 -3
  19. package/dist/core/entities/step.d.ts.map +1 -1
  20. package/dist/core/entities/step.js +6 -0
  21. package/dist/core/entities/step.js.map +1 -1
  22. package/dist/core/entities/workflow-run-attempt.d.ts +1 -0
  23. package/dist/core/entities/workflow-run-attempt.d.ts.map +1 -1
  24. package/dist/core/entities/workflow-run-attempt.js.map +1 -1
  25. package/dist/core/entities/workflow-run.d.ts +17 -0
  26. package/dist/core/entities/workflow-run.d.ts.map +1 -1
  27. package/dist/core/entities/workflow-run.js.map +1 -1
  28. package/dist/core/errors.d.ts +9 -2
  29. package/dist/core/errors.d.ts.map +1 -1
  30. package/dist/core/errors.js +10 -5
  31. package/dist/core/errors.js.map +1 -1
  32. package/dist/core/job-execution.d.ts.map +1 -1
  33. package/dist/core/job-execution.js +14 -8
  34. package/dist/core/job-execution.js.map +1 -1
  35. package/dist/core/job-transition/decide-job-activation.d.ts +1 -0
  36. package/dist/core/job-transition/decide-job-activation.d.ts.map +1 -1
  37. package/dist/core/job-transition/decide-job-activation.js +1 -0
  38. package/dist/core/job-transition/decide-job-activation.js.map +1 -1
  39. package/dist/core/job-transition/derive-job-success.d.ts +1 -0
  40. package/dist/core/job-transition/derive-job-success.d.ts.map +1 -1
  41. package/dist/core/job-transition/derive-job-success.js +5 -8
  42. package/dist/core/job-transition/derive-job-success.js.map +1 -1
  43. package/dist/core/listener-execution-materialization.d.ts +6 -3
  44. package/dist/core/listener-execution-materialization.d.ts.map +1 -1
  45. package/dist/core/listener-execution-materialization.js +44 -6
  46. package/dist/core/listener-execution-materialization.js.map +1 -1
  47. package/dist/core/resolve-trigger-reference.d.ts +11 -0
  48. package/dist/core/resolve-trigger-reference.d.ts.map +1 -0
  49. package/dist/core/resolve-trigger-reference.js +39 -0
  50. package/dist/core/resolve-trigger-reference.js.map +1 -0
  51. package/dist/core/run-workflow.d.ts +1 -0
  52. package/dist/core/run-workflow.d.ts.map +1 -1
  53. package/dist/core/run-workflow.js +1 -0
  54. package/dist/core/run-workflow.js.map +1 -1
  55. package/dist/core/step-config/agent.d.ts +1 -2
  56. package/dist/core/step-config/agent.d.ts.map +1 -1
  57. package/dist/core/step-config/agent.js +22 -7
  58. package/dist/core/step-config/agent.js.map +1 -1
  59. package/dist/core/step-config/assemble-run-context.d.ts +19 -8
  60. package/dist/core/step-config/assemble-run-context.d.ts.map +1 -1
  61. package/dist/core/step-config/assemble-run-context.js +51 -19
  62. package/dist/core/step-config/assemble-run-context.js.map +1 -1
  63. package/dist/core/step-config/complete-step-dispatch-config.d.ts.map +1 -1
  64. package/dist/core/step-config/complete-step-dispatch-config.js +72 -4
  65. package/dist/core/step-config/complete-step-dispatch-config.js.map +1 -1
  66. package/dist/core/step-config/index.d.ts +1 -0
  67. package/dist/core/step-config/index.d.ts.map +1 -1
  68. package/dist/core/step-config/index.js +1 -0
  69. package/dist/core/step-config/index.js.map +1 -1
  70. package/dist/core/step-config/materialize-job-execution-steps.d.ts +1 -1
  71. package/dist/core/step-config/materialize-job-execution-steps.d.ts.map +1 -1
  72. package/dist/core/step-config/materialize-job-execution-steps.js +49 -8
  73. package/dist/core/step-config/materialize-job-execution-steps.js.map +1 -1
  74. package/dist/core/step-config/materialize-workflow-model.d.ts +3 -3
  75. package/dist/core/step-config/materialize-workflow-model.d.ts.map +1 -1
  76. package/dist/core/step-config/materialize-workflow-model.js +9 -5
  77. package/dist/core/step-config/materialize-workflow-model.js.map +1 -1
  78. package/dist/core/step-config/resolve-job-execution-name.d.ts +3 -3
  79. package/dist/core/step-config/resolve-job-execution-name.d.ts.map +1 -1
  80. package/dist/core/step-config/resolve-job-execution-name.js +24 -13
  81. package/dist/core/step-config/resolve-job-execution-name.js.map +1 -1
  82. package/dist/core/step-config/resolve-step-config.d.ts.map +1 -1
  83. package/dist/core/step-config/resolve-step-config.js +174 -9
  84. package/dist/core/step-config/resolve-step-config.js.map +1 -1
  85. package/dist/core/step-config/resolve-workflow-run-name.d.ts +19 -0
  86. package/dist/core/step-config/resolve-workflow-run-name.d.ts.map +1 -0
  87. package/dist/core/step-config/resolve-workflow-run-name.js +73 -0
  88. package/dist/core/step-config/resolve-workflow-run-name.js.map +1 -0
  89. package/dist/core/step-transition/decide-step-transition.js.map +1 -1
  90. package/dist/core/step-transition/evaluate-gate.d.ts +2 -1
  91. package/dist/core/step-transition/evaluate-gate.d.ts.map +1 -1
  92. package/dist/core/step-transition/evaluate-gate.js +5 -3
  93. package/dist/core/step-transition/evaluate-gate.js.map +1 -1
  94. package/dist/core/workflow-run-creation.d.ts +3 -0
  95. package/dist/core/workflow-run-creation.d.ts.map +1 -1
  96. package/dist/core/workflow-run-creation.js +22 -7
  97. package/dist/core/workflow-run-creation.js.map +1 -1
  98. package/dist/db/db.d.ts +278 -10
  99. package/dist/db/db.d.ts.map +1 -1
  100. package/dist/db/db.js +2 -0
  101. package/dist/db/db.js.map +1 -1
  102. package/dist/db/index.d.ts +3 -2
  103. package/dist/db/index.d.ts.map +1 -1
  104. package/dist/db/index.js +2 -1
  105. package/dist/db/index.js.map +1 -1
  106. package/dist/db/job-listener-events.d.ts +2 -0
  107. package/dist/db/job-listener-events.d.ts.map +1 -1
  108. package/dist/db/job-listener-events.js +1 -0
  109. package/dist/db/job-listener-events.js.map +1 -1
  110. package/dist/db/job-listeners.d.ts +2 -0
  111. package/dist/db/job-listeners.d.ts.map +1 -1
  112. package/dist/db/job-listeners.js +81 -21
  113. package/dist/db/job-listeners.js.map +1 -1
  114. package/dist/db/schema/job-executions.d.ts +3 -3
  115. package/dist/db/schema/job-executions.d.ts.map +1 -1
  116. package/dist/db/schema/job-executions.js +8 -4
  117. package/dist/db/schema/job-executions.js.map +1 -1
  118. package/dist/db/schema/job-listener-events.d.ts +20 -0
  119. package/dist/db/schema/job-listener-events.d.ts.map +1 -1
  120. package/dist/db/schema/job-listener-events.js +2 -0
  121. package/dist/db/schema/job-listener-events.js.map +1 -1
  122. package/dist/db/schema/step-attempts.js +2 -2
  123. package/dist/db/schema/step-attempts.js.map +1 -1
  124. package/dist/db/schema/steps.d.ts +4 -2
  125. package/dist/db/schema/steps.d.ts.map +1 -1
  126. package/dist/db/schema/steps.js +1 -1
  127. package/dist/db/schema/steps.js.map +1 -1
  128. package/dist/db/schema/workflow-run-attempts.d.ts +21 -2
  129. package/dist/db/schema/workflow-run-attempts.d.ts.map +1 -1
  130. package/dist/db/schema/workflow-run-attempts.js +2 -0
  131. package/dist/db/schema/workflow-run-attempts.js.map +1 -1
  132. package/dist/db/schema/workflow-run-counters.d.ts +43 -0
  133. package/dist/db/schema/workflow-run-counters.d.ts.map +1 -0
  134. package/dist/db/schema/workflow-run-counters.js +10 -0
  135. package/dist/db/schema/workflow-run-counters.js.map +1 -0
  136. package/dist/db/schema/workflow-runs.d.ts +54 -1
  137. package/dist/db/schema/workflow-runs.d.ts.map +1 -1
  138. package/dist/db/schema/workflow-runs.js +10 -2
  139. package/dist/db/schema/workflow-runs.js.map +1 -1
  140. package/dist/db/workflow-runs/job-executions.d.ts.map +1 -1
  141. package/dist/db/workflow-runs/job-executions.js +35 -14
  142. package/dist/db/workflow-runs/job-executions.js.map +1 -1
  143. package/dist/db/workflow-runs/jobs.d.ts +2 -0
  144. package/dist/db/workflow-runs/jobs.d.ts.map +1 -1
  145. package/dist/db/workflow-runs/jobs.js +9 -5
  146. package/dist/db/workflow-runs/jobs.js.map +1 -1
  147. package/dist/db/workflow-runs/queries.d.ts +51 -0
  148. package/dist/db/workflow-runs/queries.d.ts.map +1 -1
  149. package/dist/db/workflow-runs/queries.js +82 -2
  150. package/dist/db/workflow-runs/queries.js.map +1 -1
  151. package/dist/db/workflow-runs/run-create.d.ts +1 -0
  152. package/dist/db/workflow-runs/run-create.d.ts.map +1 -1
  153. package/dist/db/workflow-runs/run-create.js +159 -32
  154. package/dist/db/workflow-runs/run-create.js.map +1 -1
  155. package/dist/db/workflow-runs/run-rerun.d.ts.map +1 -1
  156. package/dist/db/workflow-runs/run-rerun.js +13 -5
  157. package/dist/db/workflow-runs/run-rerun.js.map +1 -1
  158. package/dist/db/workflow-runs/shared.d.ts +1 -0
  159. package/dist/db/workflow-runs/shared.d.ts.map +1 -1
  160. package/dist/db/workflow-runs/shared.js +2 -1
  161. package/dist/db/workflow-runs/shared.js.map +1 -1
  162. package/dist/db/workflow-runs/steps.js +3 -3
  163. package/dist/db/workflow-runs/steps.js.map +1 -1
  164. package/dist/db/workflow-runs.d.ts +4 -3
  165. package/dist/db/workflow-runs.d.ts.map +1 -1
  166. package/dist/db/workflow-runs.js +3 -2
  167. package/dist/db/workflow-runs.js.map +1 -1
  168. package/dist/metrics/instance.d.ts +1 -0
  169. package/dist/metrics/instance.d.ts.map +1 -1
  170. package/dist/metrics/instance.js +9 -0
  171. package/dist/metrics/instance.js.map +1 -1
  172. package/dist/presentation/dto/checkout-token.d.ts +1 -0
  173. package/dist/presentation/dto/checkout-token.d.ts.map +1 -1
  174. package/dist/presentation/dto/checkout-token.js +1 -0
  175. package/dist/presentation/dto/checkout-token.js.map +1 -1
  176. package/dist/presentation/dto/index.d.ts +1 -1
  177. package/dist/presentation/dto/index.d.ts.map +1 -1
  178. package/dist/presentation/dto/index.js +1 -1
  179. package/dist/presentation/dto/index.js.map +1 -1
  180. package/dist/presentation/dto/step.d.ts.map +1 -1
  181. package/dist/presentation/dto/step.js +2 -2
  182. package/dist/presentation/dto/step.js.map +1 -1
  183. package/dist/presentation/dto/workflow-run.d.ts +3 -1
  184. package/dist/presentation/dto/workflow-run.d.ts.map +1 -1
  185. package/dist/presentation/dto/workflow-run.js +34 -0
  186. package/dist/presentation/dto/workflow-run.js.map +1 -1
  187. package/dist/presentation/inter-module.d.ts.map +1 -1
  188. package/dist/presentation/inter-module.js +31 -3
  189. package/dist/presentation/inter-module.js.map +1 -1
  190. package/dist/presentation/routes/checkout-token.d.ts +1 -1
  191. package/dist/presentation/routes/checkout-token.d.ts.map +1 -1
  192. package/dist/presentation/routes/checkout-token.js +32 -20
  193. package/dist/presentation/routes/checkout-token.js.map +1 -1
  194. package/dist/presentation/routes/leased-step.d.ts +2 -0
  195. package/dist/presentation/routes/leased-step.d.ts.map +1 -1
  196. package/dist/presentation/routes/leased-step.js +2 -1
  197. package/dist/presentation/routes/leased-step.js.map +1 -1
  198. package/dist/presentation/routes/list-runs.d.ts.map +1 -1
  199. package/dist/presentation/routes/list-runs.js +9 -3
  200. package/dist/presentation/routes/list-runs.js.map +1 -1
  201. package/dist/presentation/routes/project-access.d.ts +1 -0
  202. package/dist/presentation/routes/project-access.d.ts.map +1 -1
  203. package/dist/presentation/routes/report-step.d.ts.map +1 -1
  204. package/dist/presentation/routes/report-step.js +9 -2
  205. package/dist/presentation/routes/report-step.js.map +1 -1
  206. package/dist/presentation/routes/require-accessible-run.d.ts.map +1 -1
  207. package/dist/presentation/routes/require-accessible-run.js +1 -1
  208. package/dist/presentation/routes/require-accessible-run.js.map +1 -1
  209. package/dist/presentation/subscribers/on-job-steps-settled.js +1 -1
  210. package/dist/presentation/subscribers/on-job-steps-settled.js.map +1 -1
  211. package/dist/presentation/subscribers/on-runner-job-claimed.d.ts.map +1 -1
  212. package/dist/presentation/subscribers/on-runner-job-claimed.js +21 -0
  213. package/dist/presentation/subscribers/on-runner-job-claimed.js.map +1 -1
  214. package/dist/temporal/activities/index.d.ts.map +1 -1
  215. package/dist/temporal/activities/index.js +2 -1
  216. package/dist/temporal/activities/index.js.map +1 -1
  217. package/dist/temporal/activities/orchestration-activities.d.ts +1 -0
  218. package/dist/temporal/activities/orchestration-activities.d.ts.map +1 -1
  219. package/dist/temporal/activities/orchestration-activities.js.map +1 -1
  220. package/dist/temporal/constants.d.ts +1 -0
  221. package/dist/temporal/constants.d.ts.map +1 -1
  222. package/dist/temporal/constants.js +1 -0
  223. package/dist/temporal/constants.js.map +1 -1
  224. package/dist/temporal/index.d.ts +1 -1
  225. package/dist/temporal/index.d.ts.map +1 -1
  226. package/dist/temporal/index.js +1 -1
  227. package/dist/temporal/index.js.map +1 -1
  228. package/dist/temporal/workflows/index.bundle.js +82 -43
  229. package/dist/temporal/workflows/index.d.ts +1 -1
  230. package/dist/temporal/workflows/index.d.ts.map +1 -1
  231. package/dist/temporal/workflows/index.js +1 -1
  232. package/dist/temporal/workflows/index.js.map +1 -1
  233. package/dist/temporal/workflows/job-execution-orchestration.d.ts +5 -0
  234. package/dist/temporal/workflows/job-execution-orchestration.d.ts.map +1 -1
  235. package/dist/temporal/workflows/job-execution-orchestration.js +77 -43
  236. package/dist/temporal/workflows/job-execution-orchestration.js.map +1 -1
  237. package/dist/temporal/workflows/test-env.d.ts +5 -1
  238. package/dist/temporal/workflows/test-env.d.ts.map +1 -1
  239. package/dist/temporal/workflows/test-env.js +32 -11
  240. package/dist/temporal/workflows/test-env.js.map +1 -1
  241. package/dist/tsconfig.test.tsbuildinfo +1 -1
  242. package/drizzle/0000_initial.sql +14 -2
  243. package/drizzle/0001_windy_sunfire.sql +1 -0
  244. package/drizzle/meta/0000_snapshot.json +93 -1
  245. package/drizzle/meta/0001_snapshot.json +1711 -0
  246. package/drizzle/meta/_journal.json +2 -2
  247. package/package.json +21 -21
  248. package/src/core/agent-defaults.ts +2 -1
  249. package/src/core/checkout.test.ts +378 -67
  250. package/src/core/checkout.ts +142 -59
  251. package/src/core/entities/job-execution.test.ts +21 -0
  252. package/src/core/entities/job-execution.ts +24 -0
  253. package/src/core/entities/job-listener-event.ts +3 -0
  254. package/src/core/entities/step.ts +15 -3
  255. package/src/core/entities/workflow-run-attempt.ts +1 -0
  256. package/src/core/entities/workflow-run.ts +16 -0
  257. package/src/core/errors.ts +21 -7
  258. package/src/core/job-execution.ts +27 -4
  259. package/src/core/job-transition/decide-job-activation.test.ts +4 -0
  260. package/src/core/job-transition/decide-job-activation.ts +2 -0
  261. package/src/core/job-transition/derive-job-success.test.ts +12 -0
  262. package/src/core/job-transition/derive-job-success.ts +6 -9
  263. package/src/core/listener-execution-materialization.test.ts +2 -0
  264. package/src/core/listener-execution-materialization.ts +57 -11
  265. package/src/core/resolve-trigger-reference.test.ts +160 -0
  266. package/src/core/resolve-trigger-reference.ts +53 -0
  267. package/src/core/run-workflow.ts +2 -0
  268. package/src/core/step-config/agent.ts +29 -12
  269. package/src/core/step-config/assemble-run-context.test.ts +149 -6
  270. package/src/core/step-config/assemble-run-context.ts +87 -25
  271. package/src/core/step-config/complete-step-dispatch-config.test.ts +125 -2
  272. package/src/core/step-config/complete-step-dispatch-config.ts +83 -1
  273. package/src/core/step-config/index.ts +7 -0
  274. package/src/core/step-config/materialize-job-execution-steps.test.ts +250 -1
  275. package/src/core/step-config/materialize-job-execution-steps.ts +57 -10
  276. package/src/core/step-config/materialize-workflow-model.test.ts +212 -4
  277. package/src/core/step-config/materialize-workflow-model.ts +33 -28
  278. package/src/core/step-config/resolve-job-execution-name.test.ts +37 -15
  279. package/src/core/step-config/resolve-job-execution-name.ts +30 -15
  280. package/src/core/step-config/resolve-step-config.ts +175 -10
  281. package/src/core/step-config/resolve-workflow-run-name.test.ts +115 -0
  282. package/src/core/step-config/resolve-workflow-run-name.ts +108 -0
  283. package/src/core/step-transition/decide-step-transition.ts +2 -2
  284. package/src/core/step-transition/evaluate-gate.test.ts +8 -0
  285. package/src/core/step-transition/evaluate-gate.ts +8 -1
  286. package/src/core/workflow-run-creation.test.ts +7 -4
  287. package/src/core/workflow-run-creation.ts +13 -7
  288. package/src/db/db.ts +2 -0
  289. package/src/db/index.ts +6 -0
  290. package/src/db/job-listener-events.test.ts +19 -0
  291. package/src/db/job-listener-events.ts +3 -0
  292. package/src/db/job-listeners.test.ts +187 -5
  293. package/src/db/job-listeners.ts +122 -30
  294. package/src/db/schema/job-executions.ts +12 -5
  295. package/src/db/schema/job-listener-events.ts +3 -0
  296. package/src/db/schema/step-attempts.ts +2 -2
  297. package/src/db/schema/steps.ts +2 -1
  298. package/src/db/schema/workflow-run-attempts.ts +2 -0
  299. package/src/db/schema/workflow-run-counters.ts +13 -0
  300. package/src/db/schema/workflow-runs.ts +11 -2
  301. package/src/db/workflow-runs/job-executions.ts +37 -15
  302. package/src/db/workflow-runs/jobs.ts +17 -4
  303. package/src/db/workflow-runs/queries.test.ts +206 -0
  304. package/src/db/workflow-runs/queries.ts +146 -2
  305. package/src/db/workflow-runs/run-create.test.ts +606 -8
  306. package/src/db/workflow-runs/run-create.ts +185 -40
  307. package/src/db/workflow-runs/run-rerun.test.ts +61 -2
  308. package/src/db/workflow-runs/run-rerun.ts +15 -5
  309. package/src/db/workflow-runs/shared.ts +2 -0
  310. package/src/db/workflow-runs/steps.ts +3 -3
  311. package/src/db/workflow-runs.ts +7 -0
  312. package/src/metrics/instance.ts +14 -0
  313. package/src/presentation/dto/checkout-token.test.ts +19 -9
  314. package/src/presentation/dto/checkout-token.ts +2 -1
  315. package/src/presentation/dto/index.ts +1 -1
  316. package/src/presentation/dto/job.test.ts +9 -0
  317. package/src/presentation/dto/step.test.ts +12 -0
  318. package/src/presentation/dto/step.ts +5 -2
  319. package/src/presentation/dto/workflow-run.ts +44 -2
  320. package/src/presentation/inter-module.test.ts +165 -0
  321. package/src/presentation/inter-module.ts +38 -4
  322. package/src/presentation/routes/cancel-run.test.ts +1 -1
  323. package/src/presentation/routes/checkout-token.test.ts +357 -142
  324. package/src/presentation/routes/checkout-token.ts +56 -26
  325. package/src/presentation/routes/get-run-aggregates.test.ts +1 -1
  326. package/src/presentation/routes/get-run.test.ts +29 -1
  327. package/src/presentation/routes/get-step-secrets.test.ts +7 -2
  328. package/src/presentation/routes/leased-step.ts +9 -1
  329. package/src/presentation/routes/list-run-attempts.test.ts +1 -1
  330. package/src/presentation/routes/list-runs.test.ts +58 -1
  331. package/src/presentation/routes/list-runs.ts +8 -3
  332. package/src/presentation/routes/report-step.test.ts +25 -0
  333. package/src/presentation/routes/report-step.ts +10 -2
  334. package/src/presentation/routes/require-accessible-run.ts +4 -1
  335. package/src/presentation/routes/rerun-run.test.ts +1 -1
  336. package/src/presentation/subscribers/on-job-steps-settled.ts +1 -1
  337. package/src/presentation/subscribers/on-runner-job-claimed.test.ts +49 -0
  338. package/src/presentation/subscribers/on-runner-job-claimed.ts +22 -0
  339. package/src/temporal/activities/index.ts +1 -0
  340. package/src/temporal/activities/orchestration-activities.ts +1 -0
  341. package/src/temporal/constants.ts +1 -0
  342. package/src/temporal/index.ts +1 -0
  343. package/src/temporal/workflows/index.ts +1 -0
  344. package/src/temporal/workflows/job-execution-orchestration.test.ts +142 -6
  345. package/src/temporal/workflows/job-execution-orchestration.ts +99 -50
  346. package/src/temporal/workflows/run-orchestration.test.ts +1 -1
  347. package/src/temporal/workflows/test-env.ts +50 -13
  348. package/test/factories/project.ts +2 -0
  349. package/test/factories/workflow-model.ts +80 -26
  350. package/test/factories/workflow-run.ts +4 -1
  351. package/test/fixtures/agent-inter-module.ts +2 -1
  352. package/test/fixtures/job-with-steps.ts +1 -1
  353. package/tsconfig.build.tsbuildinfo +1 -1
  354. package/drizzle/0001_agent_tool_materialization.sql +0 -1
@@ -1,4 +1,5 @@
1
1
  import type { JobListenerEvent } from '#core/entities/job-listener-event.js';
2
+ import type { WorkflowRunTriggerReference } from '#core/entities/workflow-run.js';
2
3
  export declare const jobListenerEventDispositionEnum: import("drizzle-orm/pg-core").PgEnum<["fire", "resolve"]>;
3
4
  export declare const jobListenerEvents: import("drizzle-orm/pg-core").PgTableWithColumns<{
4
5
  name: "job_listener_events";
@@ -123,6 +124,25 @@ export declare const jobListenerEvents: import("drizzle-orm/pg-core").PgTableWit
123
124
  identity: undefined;
124
125
  generated: undefined;
125
126
  }, {}, {}>;
127
+ triggerReference: import("drizzle-orm/pg-core").PgColumn<{
128
+ name: "trigger_reference";
129
+ tableName: "job_listener_events";
130
+ dataType: "json";
131
+ columnType: "PgJsonb";
132
+ data: WorkflowRunTriggerReference;
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: WorkflowRunTriggerReference;
145
+ }>;
126
146
  payload: import("drizzle-orm/pg-core").PgColumn<{
127
147
  name: "payload";
128
148
  tableName: "job_listener_events";
@@ -1 +1 @@
1
- {"version":3,"file":"job-listener-events.d.ts","sourceRoot":"","sources":["../../../src/db/schema/job-listener-events.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,sCAAsC,CAAC;AAK3E,eAAO,MAAM,+BAA+B,2DAG1C,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0B7B,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,OAAO,iBAAiB,CAAC,YAAY,CAAC;AACvE,MAAM,MAAM,wBAAwB,GAAG,OAAO,iBAAiB,CAAC,YAAY,CAAC;AAE7E,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,kBAAkB,GAAG,gBAAgB,CAc5E"}
1
+ {"version":3,"file":"job-listener-events.d.ts","sourceRoot":"","sources":["../../../src/db/schema/job-listener-events.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,sCAAsC,CAAC;AAC3E,OAAO,KAAK,EAAC,2BAA2B,EAAC,MAAM,gCAAgC,CAAC;AAKhF,eAAO,MAAM,+BAA+B,2DAG1C,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2B7B,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,OAAO,iBAAiB,CAAC,YAAY,CAAC;AACvE,MAAM,MAAM,wBAAwB,GAAG,OAAO,iBAAiB,CAAC,YAAY,CAAC;AAE7E,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,kBAAkB,GAAG,gBAAgB,CAe5E"}
@@ -17,6 +17,7 @@ export const jobListenerEvents = pgTable('job_listener_events', {
17
17
  deliveryId: text('delivery_id').notNull(),
18
18
  source: text('source').notNull(),
19
19
  event: text('event').notNull(),
20
+ triggerReference: jsonb('trigger_reference').$type(),
20
21
  payload: jsonb('payload').notNull(),
21
22
  receivedAt: timestamp('received_at', {
22
23
  withTimezone: true
@@ -40,6 +41,7 @@ export function toJobListenerEvent(row) {
40
41
  deliveryId: row.deliveryId,
41
42
  source: row.source,
42
43
  event: row.event,
44
+ triggerReference: row.triggerReference ?? null,
43
45
  payload: row.payload,
44
46
  receivedAt: row.receivedAt,
45
47
  consumedByExecutionId: row.consumedByExecutionId,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/db/schema/job-listener-events.ts"],"sourcesContent":["import {uuidv7PrimaryKey} from '@shipfox/node-drizzle';\nimport {index, jsonb, pgEnum, text, timestamp, uniqueIndex, uuid} from 'drizzle-orm/pg-core';\nimport type {JobListenerEvent} from '#core/entities/job-listener-event.js';\nimport {pgTable} from './common.js';\nimport {jobExecutions} from './job-executions.js';\nimport {jobs} from './jobs.js';\n\nexport const jobListenerEventDispositionEnum = pgEnum('workflows_job_listener_event_disposition', [\n 'fire',\n 'resolve',\n]);\n\nexport const jobListenerEvents = pgTable(\n 'job_listener_events',\n {\n id: uuidv7PrimaryKey(),\n jobId: uuid('job_id')\n .notNull()\n .references(() => jobs.id, {onDelete: 'cascade'}),\n disposition: jobListenerEventDispositionEnum('disposition').notNull(),\n eventRef: text('event_ref').notNull(),\n deliveryId: text('delivery_id').notNull(),\n source: text('source').notNull(),\n event: text('event').notNull(),\n payload: jsonb('payload').notNull(),\n receivedAt: timestamp('received_at', {withTimezone: true}).notNull(),\n consumedByExecutionId: uuid('consumed_by_execution_id').references(() => jobExecutions.id, {\n onDelete: 'set null',\n }),\n createdAt: timestamp('created_at', {withTimezone: true}).notNull().defaultNow(),\n },\n (table) => [\n uniqueIndex('workflows_job_listener_events_job_event_ref_unique').on(\n table.jobId,\n table.eventRef,\n ),\n index('workflows_job_listener_events_job_received_idx').on(table.jobId, table.receivedAt),\n ],\n);\n\nexport type JobListenerEventDb = typeof jobListenerEvents.$inferSelect;\nexport type JobListenerEventCreateDb = typeof jobListenerEvents.$inferInsert;\n\nexport function toJobListenerEvent(row: JobListenerEventDb): JobListenerEvent {\n return {\n id: row.id,\n jobId: row.jobId,\n disposition: row.disposition,\n eventRef: row.eventRef,\n deliveryId: row.deliveryId,\n source: row.source,\n event: row.event,\n payload: row.payload,\n receivedAt: row.receivedAt,\n consumedByExecutionId: row.consumedByExecutionId,\n createdAt: row.createdAt,\n };\n}\n"],"names":["uuidv7PrimaryKey","index","jsonb","pgEnum","text","timestamp","uniqueIndex","uuid","pgTable","jobExecutions","jobs","jobListenerEventDispositionEnum","jobListenerEvents","id","jobId","notNull","references","onDelete","disposition","eventRef","deliveryId","source","event","payload","receivedAt","withTimezone","consumedByExecutionId","createdAt","defaultNow","table","on","toJobListenerEvent","row"],"mappings":"AAAA,SAAQA,gBAAgB,QAAO,wBAAwB;AACvD,SAAQC,KAAK,EAAEC,KAAK,EAAEC,MAAM,EAAEC,IAAI,EAAEC,SAAS,EAAEC,WAAW,EAAEC,IAAI,QAAO,sBAAsB;AAE7F,SAAQC,OAAO,QAAO,cAAc;AACpC,SAAQC,aAAa,QAAO,sBAAsB;AAClD,SAAQC,IAAI,QAAO,YAAY;AAE/B,OAAO,MAAMC,kCAAkCR,OAAO,4CAA4C;IAChG;IACA;CACD,EAAE;AAEH,OAAO,MAAMS,oBAAoBJ,QAC/B,uBACA;IACEK,IAAIb;IACJc,OAAOP,KAAK,UACTQ,OAAO,GACPC,UAAU,CAAC,IAAMN,KAAKG,EAAE,EAAE;QAACI,UAAU;IAAS;IACjDC,aAAaP,gCAAgC,eAAeI,OAAO;IACnEI,UAAUf,KAAK,aAAaW,OAAO;IACnCK,YAAYhB,KAAK,eAAeW,OAAO;IACvCM,QAAQjB,KAAK,UAAUW,OAAO;IAC9BO,OAAOlB,KAAK,SAASW,OAAO;IAC5BQ,SAASrB,MAAM,WAAWa,OAAO;IACjCS,YAAYnB,UAAU,eAAe;QAACoB,cAAc;IAAI,GAAGV,OAAO;IAClEW,uBAAuBnB,KAAK,4BAA4BS,UAAU,CAAC,IAAMP,cAAcI,EAAE,EAAE;QACzFI,UAAU;IACZ;IACAU,WAAWtB,UAAU,cAAc;QAACoB,cAAc;IAAI,GAAGV,OAAO,GAAGa,UAAU;AAC/E,GACA,CAACC,QAAU;QACTvB,YAAY,sDAAsDwB,EAAE,CAClED,MAAMf,KAAK,EACXe,MAAMV,QAAQ;QAEhBlB,MAAM,kDAAkD6B,EAAE,CAACD,MAAMf,KAAK,EAAEe,MAAML,UAAU;KACzF,EACD;AAKF,OAAO,SAASO,mBAAmBC,GAAuB;IACxD,OAAO;QACLnB,IAAImB,IAAInB,EAAE;QACVC,OAAOkB,IAAIlB,KAAK;QAChBI,aAAac,IAAId,WAAW;QAC5BC,UAAUa,IAAIb,QAAQ;QACtBC,YAAYY,IAAIZ,UAAU;QAC1BC,QAAQW,IAAIX,MAAM;QAClBC,OAAOU,IAAIV,KAAK;QAChBC,SAASS,IAAIT,OAAO;QACpBC,YAAYQ,IAAIR,UAAU;QAC1BE,uBAAuBM,IAAIN,qBAAqB;QAChDC,WAAWK,IAAIL,SAAS;IAC1B;AACF"}
1
+ {"version":3,"sources":["../../../src/db/schema/job-listener-events.ts"],"sourcesContent":["import {uuidv7PrimaryKey} from '@shipfox/node-drizzle';\nimport {index, jsonb, pgEnum, text, timestamp, uniqueIndex, uuid} from 'drizzle-orm/pg-core';\nimport type {JobListenerEvent} from '#core/entities/job-listener-event.js';\nimport type {WorkflowRunTriggerReference} from '#core/entities/workflow-run.js';\nimport {pgTable} from './common.js';\nimport {jobExecutions} from './job-executions.js';\nimport {jobs} from './jobs.js';\n\nexport const jobListenerEventDispositionEnum = pgEnum('workflows_job_listener_event_disposition', [\n 'fire',\n 'resolve',\n]);\n\nexport const jobListenerEvents = pgTable(\n 'job_listener_events',\n {\n id: uuidv7PrimaryKey(),\n jobId: uuid('job_id')\n .notNull()\n .references(() => jobs.id, {onDelete: 'cascade'}),\n disposition: jobListenerEventDispositionEnum('disposition').notNull(),\n eventRef: text('event_ref').notNull(),\n deliveryId: text('delivery_id').notNull(),\n source: text('source').notNull(),\n event: text('event').notNull(),\n triggerReference: jsonb('trigger_reference').$type<WorkflowRunTriggerReference>(),\n payload: jsonb('payload').notNull(),\n receivedAt: timestamp('received_at', {withTimezone: true}).notNull(),\n consumedByExecutionId: uuid('consumed_by_execution_id').references(() => jobExecutions.id, {\n onDelete: 'set null',\n }),\n createdAt: timestamp('created_at', {withTimezone: true}).notNull().defaultNow(),\n },\n (table) => [\n uniqueIndex('workflows_job_listener_events_job_event_ref_unique').on(\n table.jobId,\n table.eventRef,\n ),\n index('workflows_job_listener_events_job_received_idx').on(table.jobId, table.receivedAt),\n ],\n);\n\nexport type JobListenerEventDb = typeof jobListenerEvents.$inferSelect;\nexport type JobListenerEventCreateDb = typeof jobListenerEvents.$inferInsert;\n\nexport function toJobListenerEvent(row: JobListenerEventDb): JobListenerEvent {\n return {\n id: row.id,\n jobId: row.jobId,\n disposition: row.disposition,\n eventRef: row.eventRef,\n deliveryId: row.deliveryId,\n source: row.source,\n event: row.event,\n triggerReference: row.triggerReference ?? null,\n payload: row.payload,\n receivedAt: row.receivedAt,\n consumedByExecutionId: row.consumedByExecutionId,\n createdAt: row.createdAt,\n };\n}\n"],"names":["uuidv7PrimaryKey","index","jsonb","pgEnum","text","timestamp","uniqueIndex","uuid","pgTable","jobExecutions","jobs","jobListenerEventDispositionEnum","jobListenerEvents","id","jobId","notNull","references","onDelete","disposition","eventRef","deliveryId","source","event","triggerReference","$type","payload","receivedAt","withTimezone","consumedByExecutionId","createdAt","defaultNow","table","on","toJobListenerEvent","row"],"mappings":"AAAA,SAAQA,gBAAgB,QAAO,wBAAwB;AACvD,SAAQC,KAAK,EAAEC,KAAK,EAAEC,MAAM,EAAEC,IAAI,EAAEC,SAAS,EAAEC,WAAW,EAAEC,IAAI,QAAO,sBAAsB;AAG7F,SAAQC,OAAO,QAAO,cAAc;AACpC,SAAQC,aAAa,QAAO,sBAAsB;AAClD,SAAQC,IAAI,QAAO,YAAY;AAE/B,OAAO,MAAMC,kCAAkCR,OAAO,4CAA4C;IAChG;IACA;CACD,EAAE;AAEH,OAAO,MAAMS,oBAAoBJ,QAC/B,uBACA;IACEK,IAAIb;IACJc,OAAO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6
6
  // Append-only execution history. One row per dispatched attempt of a step,
7
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.
8
+ // the fast current projection; this table is the audit trail. The unique
9
+ // (step_id, attempt) constraint is the idempotency anchor.
10
10
  export const stepAttempts = pgTable('step_attempts', {
11
11
  id: uuidv7PrimaryKey(),
12
12
  stepId: uuid('step_id').notNull().references(()=>steps.id, {
@@ -1 +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":"AAAA,SAAQA,gBAAgB,QAAO,wBAAwB;AACvD,SAAQC,GAAG,QAAO,cAAc;AAChC,SACEC,KAAK,EACLC,UAAU,EACVC,OAAO,EACPC,KAAK,EACLC,IAAI,EACJC,SAAS,EACTC,MAAM,EACNC,IAAI,QACC,sBAAsB;AAO7B,SAAQC,OAAO,QAAO,cAAc;AACpC,SAAQC,cAAc,EAAEC,KAAK,QAAO,aAAa;AAEjD,2EAA2E;AAC3E,iFAAiF;AACjF,2EAA2E;AAC3E,iEAAiE;AACjE,OAAO,MAAMC,eAAeH,QAC1B,iBACA;IACEI,IAAId;IACJe,QAAQN,KAAK,WACVO,OAAO,GACPC,UAAU,CAAC,IAAML,MAAME,EAAE,EAAE;QAACI,UAAU;IAAS;IAClDC,gBAAgBV,KAAK,oBAAoBO,OAAO;IAChDI,SAAShB,QAAQ,WAAWY,OAAO;IACnCK,gBAAgBjB,QAAQ,mBAAmBY,OAAO;IAClD,6EAA6E;IAC7E,yBAAyB;IACzBM,QAAQX,eAAe,UAAUK,OAAO;IACxCO,QAAQlB,MAAM,UAAUmB,KAAK;IAC7BC,iBAAiBpB,MAAM,oBAAoBmB,KAAK;IAChDE,QAAQrB,MAAM,UAAUmB,KAAK;IAC7BG,UAAUrB,KAAK;IACfsB,OAAOvB,MAAM,SAASmB,KAAK;IAC3BK,UAAUzB,QAAQ;IAClB0B,YAAYxB,KAAK,eAAekB,KAAK;IACrCO,YAAY1B,MAAM,eAAemB,KAAK;IACtCQ,iBAAiB1B,KAAK;IACtB2B,WAAW1B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iB,IAAIjB,QAAQ,IAAI;QAC1BC,OAAO,AAACgB,IAAIhB,KAAK,IAAgC;QACjDC,UAAUe,IAAIf,QAAQ,IAAI;QAC1BC,YAAYc,IAAId,UAAU,IAAI;QAC9BC,YAAY,AAACa,IAAIb,UAAU,IAAgC;QAC3DC,iBAAiBY,IAAIZ,eAAe,IAAI;QACxCC,WAAWW,IAAIX,SAAS;QACxBG,YAAYQ,IAAIR,UAAU,IAAI;QAC9BC,WAAWO,IAAIP,SAAS;IAC1B;AACF"}
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. The unique\n// (step_id, attempt) constraint is 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":"AAAA,SAAQA,gBAAgB,QAAO,wBAAwB;AACvD,SAAQC,GAAG,QAAO,cAAc;AAChC,SACEC,KAAK,EACLC,UAAU,EACVC,OAAO,EACPC,KAAK,EACLC,IAAI,EACJC,SAAS,EACTC,MAAM,EACNC,IAAI,QACC,sBAAsB;AAO7B,SAAQC,OAAO,QAAO,cAAc;AACpC,SAAQC,cAAc,EAAEC,KAAK,QAAO,aAAa;AAEjD,2EAA2E;AAC3E,iFAAiF;AACjF,yEAAyE;AACzE,2DAA2D;AAC3D,OAAO,MAAMC,eAAeH,QAC1B,iBACA;IACEI,IAAId;IACJe,QAAQN,KAAK,WACVO,OAAO,GACPC,UAAU,CAAC,IAAML,MAAME,EAAE,EAAE;QAACI,UAAU;IAAS;IAClDC,gBAAgBV,KAAK,oBAAoBO,OAAO;IAChDI,SAAShB,QAAQ,WAAWY,OAAO;IACnCK,gBAAgBjB,QAAQ,mBAAmBY,OAAO;IAClD,6EAA6E;IAC7E,yBAAyB;IACzBM,QAAQX,eAAe,UAAUK,OAAO;IACxCO,QAAQlB,MAAM,UAAUmB,KAAK;IAC7BC,iBAAiBpB,MAAM,oBAAoBmB,KAAK;IAChDE,QAAQrB,MAAM,UAAUmB,KAAK;IAC7BG,UAAUrB,KAAK;IACfsB,OAAOvB,MAAM,SAASmB,KAAK;IAC3BK,UAAUzB,QAAQ;IAClB0B,YAAYxB,KAAK,eAAekB,KAAK;IACrCO,YAAY1B,MAAM,eAAemB,KAAK;IACtCQ,iBAAiB1B,KAAK;IACtB2B,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C,UAAUiB,IAAIjB,QAAQ,IAAI;QAC1BC,OAAO,AAACgB,IAAIhB,KAAK,IAAgC;QACjDC,UAAUe,IAAIf,QAAQ,IAAI;QAC1BC,YAAYc,IAAId,UAAU,IAAI;QAC9BC,YAAY,AAACa,IAAIb,UAAU,IAAgC;QAC3DC,iBAAiBY,IAAIZ,eAAe,IAAI;QACxCC,WAAWW,IAAIX,SAAS;QACxBG,YAAYQ,IAAIR,UAAU,IAAI;QAC9BC,WAAWO,IAAIP,SAAS;IAC1B;AACF"}
@@ -151,7 +151,7 @@ export declare const steps: import("drizzle-orm/pg-core").PgTableWithColumns<{
151
151
  tableName: "steps";
152
152
  dataType: "string";
153
153
  columnType: "PgText";
154
- data: string;
154
+ data: "setup" | "run" | "agent" | "checkout";
155
155
  driverParam: string;
156
156
  notNull: true;
157
157
  hasDefault: false;
@@ -162,7 +162,9 @@ export declare const steps: import("drizzle-orm/pg-core").PgTableWithColumns<{
162
162
  baseColumn: never;
163
163
  identity: undefined;
164
164
  generated: undefined;
165
- }, {}, {}>;
165
+ }, {}, {
166
+ $type: "setup" | "run" | "agent" | "checkout";
167
+ }>;
166
168
  config: import("drizzle-orm/pg-core").PgColumn<{
167
169
  name: "config";
168
170
  tableName: "steps";
@@ -1 +1 @@
1
- {"version":3,"file":"steps.d.ts","sourceRoot":"","sources":["../../../src/db/schema/steps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,qBAAqB,CAAC;AAe5D,OAAO,EACL,KAAK,6BAA6B,EAElC,KAAK,IAAI,EACT,KAAK,sBAAsB,EAE5B,MAAM,wBAAwB,CAAC;AAIhC,eAAO,MAAM,cAAc,6GAOzB,CAAC;AAEH,eAAO,MAAM,oBAAoB,4GAA8D,CAAC;AAEhG,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;EAmCjB,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG,OAAO,KAAK,CAAC,YAAY,CAAC;AAC/C,MAAM,MAAM,YAAY,GAAG,OAAO,KAAK,CAAC,YAAY,CAAC;AAErD,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAsBxC"}
@@ -22,7 +22,7 @@ export const steps = pgTable('steps', {
22
22
  status: stepStatusEnum('status').notNull().default('pending'),
23
23
  statusReason: stepStatusReasonEnum('status_reason'),
24
24
  evaluationTrace: jsonb('evaluation_trace').$type(),
25
- type: text('type').notNull(),
25
+ type: text('type').notNull().$type(),
26
26
  config: jsonb('config').notNull().$type(),
27
27
  condition: jsonb('condition').$type(),
28
28
  configPlan: jsonb('config_plan').$type(),
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/db/schema/steps.ts"],"sourcesContent":["import type {WorkflowExpression} from '@shipfox/expression';\nimport {uuidv7PrimaryKey} from '@shipfox/node-drizzle';\nimport {sql} from 'drizzle-orm';\nimport {\n check,\n foreignKey,\n index,\n integer,\n jsonb,\n pgEnum,\n text,\n timestamp,\n uniqueIndex,\n uuid,\n} from 'drizzle-orm/pg-core';\nimport {\n type PersistedEvaluationTraceEntry,\n STEP_STATUS_REASONS,\n type Step,\n type StepConfigDispatchPlan,\n toStepStatusReason,\n} from '#core/entities/step.js';\nimport {pgTable} from './common.js';\nimport {jobExecutions} from './job-executions.js';\n\nexport const stepStatusEnum = pgEnum('workflows_step_status', [\n 'pending',\n 'running',\n 'succeeded',\n 'failed',\n 'cancelled',\n 'skipped',\n]);\n\nexport const stepStatusReasonEnum = pgEnum('workflows_step_status_reason', STEP_STATUS_REASONS);\n\nexport const steps = pgTable(\n 'steps',\n {\n id: uuidv7PrimaryKey(),\n jobExecutionId: uuid('job_execution_id').notNull(),\n key: text('key'),\n name: text('name').notNull(),\n sourceLocation: jsonb('source_location').$type<Step['sourceLocation']>(),\n status: stepStatusEnum('status').notNull().default('pending'),\n statusReason: stepStatusReasonEnum('status_reason'),\n evaluationTrace: jsonb('evaluation_trace').$type<readonly PersistedEvaluationTraceEntry[]>(),\n type: text('type').notNull(),\n config: jsonb('config').notNull().$type<Record<string, unknown>>(),\n condition: jsonb('condition').$type<WorkflowExpression>(),\n configPlan: jsonb('config_plan').$type<StepConfigDispatchPlan>(),\n authoredConfig: jsonb('authored_config').$type<Record<string, unknown>>(),\n error: jsonb('error').$type<Record<string, unknown>>(),\n position: integer('position').notNull(),\n version: integer('version').notNull().default(1),\n // Execution-attempt identity, distinct from the optimistic `version` counter.\n // Starts at 1 and is bumped only on durable rewind.\n currentAttempt: integer('current_attempt').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_steps_job_execution_id_idx').on(table.jobExecutionId),\n uniqueIndex('workflows_steps_id_job_execution_id_uq').on(table.id, table.jobExecutionId),\n check('workflows_steps_current_attempt_positive_ck', sql`${table.currentAttempt} > 0`),\n foreignKey({\n name: 'workflows_steps_job_execution_id_workflows_job_executions_id_fk',\n columns: [table.jobExecutionId],\n foreignColumns: [jobExecutions.id],\n }).onDelete('cascade'),\n ],\n);\n\nexport type StepDb = typeof steps.$inferSelect;\nexport type StepCreateDb = typeof steps.$inferInsert;\n\nexport function toStep(row: StepDb): Step {\n return {\n id: row.id,\n jobExecutionId: row.jobExecutionId,\n key: row.key,\n name: row.name,\n sourceLocation: row.sourceLocation ?? null,\n status: row.status,\n statusReason: toStepStatusReason(row.statusReason),\n evaluationTrace: row.evaluationTrace ?? null,\n type: row.type,\n config: row.config as Record<string, unknown>,\n condition: (row.condition as WorkflowExpression) ?? null,\n configPlan: row.configPlan ?? null,\n authoredConfig: (row.authoredConfig as Record<string, unknown>) ?? null,\n error: (row.error as Record<string, unknown>) ?? null,\n position: row.position,\n version: row.version,\n currentAttempt: row.currentAttempt,\n createdAt: row.createdAt,\n updatedAt: row.updatedAt,\n };\n}\n"],"names":["uuidv7PrimaryKey","sql","check","foreignKey","index","integer","jsonb","pgEnum","text","timestamp","uniqueIndex","uuid","STEP_STATUS_REASONS","toStepStatusReason","pgTable","jobExecutions","stepStatusEnum","stepStatusReasonEnum","steps","id","jobExecutionId","notNull","key","name","sourceLocation","$type","status","default","statusReason","evaluationTrace","type","config","condition","configPlan","authoredConfig","error","position","version","currentAttempt","createdAt","withTimezone","defaultNow","updatedAt","table","on","columns","foreignColumns","onDelete","toStep","row"],"mappings":"AACA,SAAQA,gBAAgB,QAAO,wBAAwB;AACvD,SAAQC,GAAG,QAAO,cAAc;AAChC,SACEC,KAAK,EACLC,UAAU,EACVC,KAAK,EACLC,OAAO,EACPC,KAAK,EACLC,MAAM,EACNC,IAAI,EACJC,SAAS,EACTC,WAAW,EACXC,IAAI,QACC,sBAAsB;AAC7B,SAEEC,mBAAmB,EAGnBC,kBAAkB,QACb,yBAAyB;AAChC,SAAQC,OAAO,QAAO,cAAc;AACpC,SAAQC,aAAa,QAAO,sBAAsB;AAElD,OAAO,MAAMC,iBAAiBT,OAAO,yBAAyB;IAC5D;IACA;IACA;IACA;IACA;IACA;CACD,EAAE;AAEH,OAAO,MAAMU,uBAAuBV,OAAO,gCAAgCK,qBAAqB;AAEhG,OAAO,MAAMM,QAAQJ,QACnB,SACA;IACEK,IAAInB;IACJoB,gBAAgBT,KAAK,oBAAoBU,OAAO;IAChDC,KAAKd,KAAK;IACVe,MAAMf,KAAK,QAAQa,OAAO;IAC1BG,gBAAgBlB,MAAM,mBAAmBmB,KAAK;IAC9CC,QAAQV,eAAe,UAAUK,OAAO,GAAGM,OAAO,CAAC;IACnDC,cAAcX,qBAAqB;IACnCY,iBAAiBvB,MAAM,oBAAoBmB,KAAK;IAChDK,MAAMtB,KAAK,QAAQa,OAAO;IAC1BU,QAAQzB,MAAM,UAAUe,OAAO,GAAGI,KAAK;IACvCO,WAAW1B,MAAM,aAAamB,KAAK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,IAA2B;QACpDC,YAAYgB,IAAIhB,UAAU,IAAI;QAC9BC,gBAAgB,AAACe,IAAIf,cAAc,IAAgC;QACnEC,OAAO,AAACc,IAAId,KAAK,IAAgC;QACjDC,UAAUa,IAAIb,QAAQ;QACtBC,SAASY,IAAIZ,OAAO;QACpBC,gBAAgBW,IAAIX,cAAc;QAClCC,WAAWU,IAAIV,SAAS;QACxBG,WAAWO,IAAIP,SAAS;IAC1B;AACF"}
1
+ {"version":3,"sources":["../../../src/db/schema/steps.ts"],"sourcesContent":["import type {WorkflowExpression} from '@shipfox/expression';\nimport {uuidv7PrimaryKey} from '@shipfox/node-drizzle';\nimport {sql} from 'drizzle-orm';\nimport {\n check,\n foreignKey,\n index,\n integer,\n jsonb,\n pgEnum,\n text,\n timestamp,\n uniqueIndex,\n uuid,\n} from 'drizzle-orm/pg-core';\nimport {\n type PersistedEvaluationTraceEntry,\n STEP_STATUS_REASONS,\n type Step,\n type StepConfigDispatchPlan,\n type StepType,\n toStepStatusReason,\n} from '#core/entities/step.js';\nimport {pgTable} from './common.js';\nimport {jobExecutions} from './job-executions.js';\n\nexport const stepStatusEnum = pgEnum('workflows_step_status', [\n 'pending',\n 'running',\n 'succeeded',\n 'failed',\n 'cancelled',\n 'skipped',\n]);\n\nexport const stepStatusReasonEnum = pgEnum('workflows_step_status_reason', STEP_STATUS_REASONS);\n\nexport const steps = pgTable(\n 'steps',\n {\n id: uuidv7PrimaryKey(),\n jobExecutionId: uuid('job_execution_id').notNull(),\n key: text('key'),\n name: text('name').notNull(),\n sourceLocation: jsonb('source_location').$type<Step['sourceLocation']>(),\n status: stepStatusEnum('status').notNull().default('pending'),\n statusReason: stepStatusReasonEnum('status_reason'),\n evaluationTrace: jsonb('evaluation_trace').$type<readonly PersistedEvaluationTraceEntry[]>(),\n type: text('type').notNull().$type<StepType>(),\n config: jsonb('config').notNull().$type<Record<string, unknown>>(),\n condition: jsonb('condition').$type<WorkflowExpression>(),\n configPlan: jsonb('config_plan').$type<StepConfigDispatchPlan>(),\n authoredConfig: jsonb('authored_config').$type<Record<string, unknown>>(),\n error: jsonb('error').$type<Record<string, unknown>>(),\n position: integer('position').notNull(),\n version: integer('version').notNull().default(1),\n // Execution-attempt identity, distinct from the optimistic `version` counter.\n // Starts at 1 and is bumped only on durable rewind.\n currentAttempt: integer('current_attempt').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_steps_job_execution_id_idx').on(table.jobExecutionId),\n uniqueIndex('workflows_steps_id_job_execution_id_uq').on(table.id, table.jobExecutionId),\n check('workflows_steps_current_attempt_positive_ck', sql`${table.currentAttempt} > 0`),\n foreignKey({\n name: 'workflows_steps_job_execution_id_workflows_job_executions_id_fk',\n columns: [table.jobExecutionId],\n foreignColumns: [jobExecutions.id],\n }).onDelete('cascade'),\n ],\n);\n\nexport type StepDb = typeof steps.$inferSelect;\nexport type StepCreateDb = typeof steps.$inferInsert;\n\nexport function toStep(row: StepDb): Step {\n return {\n id: row.id,\n jobExecutionId: row.jobExecutionId,\n key: row.key,\n name: row.name,\n sourceLocation: row.sourceLocation ?? null,\n status: row.status,\n statusReason: toStepStatusReason(row.statusReason),\n evaluationTrace: row.evaluationTrace ?? null,\n type: row.type,\n config: row.config as Record<string, unknown>,\n condition: (row.condition as WorkflowExpression) ?? null,\n configPlan: row.configPlan ?? null,\n authoredConfig: (row.authoredConfig as Record<string, unknown>) ?? null,\n error: (row.error as Record<string, unknown>) ?? null,\n position: row.position,\n version: row.version,\n currentAttempt: row.currentAttempt,\n createdAt: row.createdAt,\n updatedAt: row.updatedAt,\n };\n}\n"],"names":["uuidv7PrimaryKey","sql","check","foreignKey","index","integer","jsonb","pgEnum","text","timestamp","uniqueIndex","uuid","STEP_STATUS_REASONS","toStepStatusReason","pgTable","jobExecutions","stepStatusEnum","stepStatusReasonEnum","steps","id","jobExecutionId","notNull","key","name","sourceLocation","$type","status","default","statusReason","evaluationTrace","type","config","condition","configPlan","authoredConfig","error","position","version","currentAttempt","createdAt","withTimezone","defaultNow","updatedAt","table","on","columns","foreignColumns","onDelete","toStep","row"],"mappings":"AACA,SAAQA,gBAAgB,QAAO,wBAAwB;AACvD,SAAQC,GAAG,QAAO,cAAc;AAChC,SACEC,KAAK,EACLC,UAAU,EACVC,KAAK,EACLC,OAAO,EACPC,KAAK,EACLC,MAAM,EACNC,IAAI,EACJC,SAAS,EACTC,WAAW,EACXC,IAAI,QACC,sBAAsB;AAC7B,SAEEC,mBAAmB,EAInBC,kBAAkB,QACb,yBAAyB;AAChC,SAAQC,OAAO,QAAO,cAAc;AACpC,SAAQC,aAAa,QAAO,sBAAsB;AAElD,OAAO,MAAMC,iBAAiBT,OAAO,yBAAyB;IAC5D;IACA;IACA;IACA;IACA;IACA;CACD,EAAE;AAEH,OAAO,MAAMU,uBAAuBV,OAAO,gCAAgCK,qBAAqB;AAEhG,OAAO,MAAMM,QAAQJ,QACnB,SACA;IACEK,IAAInB;IACJoB,gBAAgBT,KAAK,oBAAoBU,OAAO;IAChDC,KAAKd,KAAK;IACVe,MAAMf,KAAK,QAAQa,OAAO;IAC1BG,gBAAgBlB,MAAM,mBAAmBmB,KAAK;IAC9CC,QAAQV,eAAe,UAAUK,OAAO,GAAGM,OAAO,CAAC;IACnDC,cAAcX,qBAAqB;IACnCY,iBAAiBvB,MAAM,oBAAoBmB,KAAK;IAChDK,MAAMtB,KAAK,QAAQa,OAAO,GAAGI,KAAK;IAClCM,QAAQzB,MAAM,UAAUe,OAAO,GAAGI,KAAK;IACvCO,WAAW1B,MAAM,aAAamB,KAAK;IACnCQ,YAAY3B,MAAM,eAAemB,KAAK;IACtCS,gBAAgB5B,MAAM,mBAAmBmB,KAAK;IAC9CU,OAAO7B,MAAM,SAASmB,KAAK;IAC3BW,UAAU/B,QAAQ,YAAYgB,OAAO;IACrCgB,SAAShC,QAAQ,WAAWgB,OAAO,GAAGM,OAA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AAIX,cAAc;QAClCC,WAAWU,IAAIV,SAAS;QACxBG,WAAWO,IAAIP,SAAS;IAC1B;AACF"}
@@ -113,7 +113,7 @@ export declare const workflowRunAttempts: import("drizzle-orm/pg-core").PgTableW
113
113
  dataType: "json";
114
114
  columnType: "PgJsonb";
115
115
  data: WorkflowModel | {
116
- version: 1;
116
+ version: 2;
117
117
  model: WorkflowModel;
118
118
  };
119
119
  driverParam: unknown;
@@ -128,10 +128,29 @@ export declare const workflowRunAttempts: import("drizzle-orm/pg-core").PgTableW
128
128
  generated: undefined;
129
129
  }, {}, {
130
130
  $type: WorkflowModel | {
131
- version: 1;
131
+ version: 2;
132
132
  model: WorkflowModel;
133
133
  };
134
134
  }>;
135
+ vars: import("drizzle-orm/pg-core").PgColumn<{
136
+ name: "vars";
137
+ tableName: "workflow_run_attempts";
138
+ dataType: "json";
139
+ columnType: "PgJsonb";
140
+ data: Record<string, string>;
141
+ driverParam: unknown;
142
+ notNull: false;
143
+ hasDefault: false;
144
+ isPrimaryKey: false;
145
+ isAutoincrement: false;
146
+ hasRuntimeDefault: false;
147
+ enumValues: undefined;
148
+ baseColumn: never;
149
+ identity: undefined;
150
+ generated: undefined;
151
+ }, {}, {
152
+ $type: Record<string, string>;
153
+ }>;
135
154
  agentToolMaterialization: import("drizzle-orm/pg-core").PgColumn<{
136
155
  name: "agent_tool_materialization";
137
156
  tableName: "workflow_run_attempts";
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-run-attempts.d.ts","sourceRoot":"","sources":["../../../src/db/schema/workflow-run-attempts.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,aAAa,EAEnB,MAAM,8BAA8B,CAAC;AAItC,OAAO,KAAK,EAAC,gCAAgC,EAAC,MAAM,sBAAsB,CAAC;AAC3E,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,wCAAwC,CAAC;AAI/E,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AC,GAAG,EAAE,oBAAoB,GAAG,kBAAkB,CAiBlF"}
@@ -14,6 +14,7 @@ export const workflowRunAttempts = pgTable('workflow_run_attempts', {
14
14
  rerunMode: workflowRunRerunModeEnum('rerun_mode'),
15
15
  rerunByUserId: uuid('rerun_by_user_id'),
16
16
  model: jsonb('model').$type(),
17
+ vars: jsonb('vars').$type(),
17
18
  agentToolMaterialization: jsonb('agent_tool_materialization').$type(),
18
19
  version: integer('version').notNull().default(1),
19
20
  createdAt: timestamp('created_at', {
@@ -42,6 +43,7 @@ export function toWorkflowRunAttempt(row) {
42
43
  rerunMode: row.rerunMode ?? null,
43
44
  rerunByUserId: row.rerunByUserId,
44
45
  model: row.model === null ? null : readPersistedWorkflowModel(row.model),
46
+ vars: row.vars ?? null,
45
47
  agentToolMaterialization: row.agentToolMaterialization ?? null,
46
48
  version: row.version,
47
49
  createdAt: row.createdAt,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/db/schema/workflow-run-attempts.ts"],"sourcesContent":["import {\n readPersistedWorkflowModel,\n type WorkflowModel,\n type WorkflowModelSnapshot,\n} from '@shipfox/api-definitions-dto';\nimport {uuidv7PrimaryKey} from '@shipfox/node-drizzle';\nimport {sql} from 'drizzle-orm';\nimport {check, integer, jsonb, timestamp, uniqueIndex, uuid} from 'drizzle-orm/pg-core';\nimport type {AgentToolMaterializationSnapshot} from '#core/agent-tools.js';\nimport type {WorkflowRunAttempt} from '#core/entities/workflow-run-attempt.js';\nimport {pgTable} from './common.js';\nimport {workflowRunRerunModeEnum, workflowRunStatusEnum, workflowRuns} from './workflow-runs.js';\n\nexport const workflowRunAttempts = pgTable(\n 'workflow_run_attempts',\n {\n id: uuidv7PrimaryKey(),\n workflowRunId: uuid('workflow_run_id')\n .notNull()\n .references(() => workflowRuns.id, {onDelete: 'cascade'}),\n attempt: integer('attempt').notNull(),\n status: workflowRunStatusEnum('status').notNull().default('pending'),\n rerunMode: workflowRunRerunModeEnum('rerun_mode'),\n rerunByUserId: uuid('rerun_by_user_id'),\n model: jsonb('model').$type<WorkflowModel | WorkflowModelSnapshot>(),\n agentToolMaterialization: jsonb(\n 'agent_tool_materialization',\n ).$type<AgentToolMaterializationSnapshot>(),\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 startedAt: timestamp('started_at', {withTimezone: true}),\n finishedAt: timestamp('finished_at', {withTimezone: true}),\n },\n (table) => [\n uniqueIndex('workflows_wra_workflow_run_attempt_unique').on(table.workflowRunId, table.attempt),\n check('workflows_wra_attempt_positive_ck', sql`${table.attempt} > 0`),\n uniqueIndex('workflows_wra_one_active_attempt_unique')\n .on(table.workflowRunId)\n .where(sql`${table.status} in ('pending', 'running')`),\n ],\n);\n\nexport type WorkflowRunAttemptDb = typeof workflowRunAttempts.$inferSelect;\nexport type WorkflowRunAttemptCreateDb = typeof workflowRunAttempts.$inferInsert;\n\nexport function toWorkflowRunAttempt(row: WorkflowRunAttemptDb): WorkflowRunAttempt {\n return {\n id: row.id,\n workflowRunId: row.workflowRunId,\n attempt: row.attempt,\n status: row.status,\n rerunMode: row.rerunMode ?? null,\n rerunByUserId: row.rerunByUserId,\n model: row.model === null ? null : readPersistedWorkflowModel(row.model),\n agentToolMaterialization: row.agentToolMaterialization ?? null,\n version: row.version,\n createdAt: row.createdAt,\n updatedAt: row.updatedAt,\n startedAt: row.startedAt,\n finishedAt: row.finishedAt,\n };\n}\n"],"names":["readPersistedWorkflowModel","uuidv7PrimaryKey","sql","check","integer","jsonb","timestamp","uniqueIndex","uuid","pgTable","workflowRunRerunModeEnum","workflowRunStatusEnum","workflowRuns","workflowRunAttempts","id","workflowRunId","notNull","references","onDelete","attempt","status","default","rerunMode","rerunByUserId","model","$type","agentToolMaterialization","version","createdAt","withTimezone","defaultNow","updatedAt","startedAt","finishedAt","table","on","where","toWorkflowRunAttempt","row"],"mappings":"AAAA,SACEA,0BAA0B,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CAAC;KACxD,EACD;AAKF,OAAO,SAASiB,qBAAqBC,GAAyB;IAC5D,OAAO;QACLxB,IAAIwB,IAAIxB,EAAE;QACVC,eAAeuB,IAAIvB,aAAa;QAChCI,SAASmB,IAAInB,OAAO;QACpBC,QAAQkB,IAAIlB,MAAM;QAClBE,WAAWgB,IAAIhB,SAAS,IAAI;QAC5BC,eAAee,IAAIf,aAAa;QAChCC,OAAOc,IAAId,KAAK,KAAK,OAAO,OAAOxB,2BAA2BsC,IAAId,KAAK;QACvEE,0BAA0BY,IAAIZ,wBAAwB,IAAI;QAC1DC,SAASW,IAAIX,OAAO;QACpBC,WAAWU,IAAIV,SAAS;QACxBG,WAAWO,IAAIP,SAAS;QACxBC,WAAWM,IAAIN,SAAS;QACxBC,YAAYK,IAAIL,UAAU;IAC5B;AACF"}
1
+ {"version":3,"sources":["../../../src/db/schema/workflow-run-attempts.ts"],"sourcesContent":["import {\n readPersistedWorkflowModel,\n type WorkflowModel,\n type WorkflowModelSnapshot,\n} from '@shipfox/api-definitions-dto';\nimport {uuidv7PrimaryKey} from '@shipfox/node-drizzle';\nimport {sql} from 'drizzle-orm';\nimport {check, integer, jsonb, timestamp, uniqueIndex, uuid} from 'drizzle-orm/pg-core';\nimport type {AgentToolMaterializationSnapshot} from '#core/agent-tools.js';\nimport type {WorkflowRunAttempt} from '#core/entities/workflow-run-attempt.js';\nimport {pgTable} from './common.js';\nimport {workflowRunRerunModeEnum, workflowRunStatusEnum, workflowRuns} from './workflow-runs.js';\n\nexport const workflowRunAttempts = pgTable(\n 'workflow_run_attempts',\n {\n id: uuidv7PrimaryKey(),\n workflowRunId: uuid('workflow_run_id')\n .notNull()\n .references(() => workflowRuns.id, {onDelete: 'cascade'}),\n attempt: integer('attempt').notNull(),\n status: workflowRunStatusEnum('status').notNull().default('pending'),\n rerunMode: workflowRunRerunModeEnum('rerun_mode'),\n rerunByUserId: uuid('rerun_by_user_id'),\n model: jsonb('model').$type<WorkflowModel | WorkflowModelSnapshot>(),\n vars: jsonb('vars').$type<Record<string, string>>(),\n agentToolMaterialization: jsonb(\n 'agent_tool_materialization',\n ).$type<AgentToolMaterializationSnapshot>(),\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 startedAt: timestamp('started_at', {withTimezone: true}),\n finishedAt: timestamp('finished_at', {withTimezone: true}),\n },\n (table) => [\n uniqueIndex('workflows_wra_workflow_run_attempt_unique').on(table.workflowRunId, table.attempt),\n check('workflows_wra_attempt_positive_ck', sql`${table.attempt} > 0`),\n uniqueIndex('workflows_wra_one_active_attempt_unique')\n .on(table.workflowRunId)\n .where(sql`${table.status} in ('pending', 'running')`),\n ],\n);\n\nexport type WorkflowRunAttemptDb = typeof workflowRunAttempts.$inferSelect;\nexport type WorkflowRunAttemptCreateDb = typeof workflowRunAttempts.$inferInsert;\n\nexport function toWorkflowRunAttempt(row: WorkflowRunAttemptDb): WorkflowRunAttempt {\n return {\n id: row.id,\n workflowRunId: row.workflowRunId,\n attempt: row.attempt,\n status: row.status,\n rerunMode: row.rerunMode ?? null,\n rerunByUserId: row.rerunByUserId,\n model: row.model === null ? null : readPersistedWorkflowModel(row.model),\n vars: row.vars ?? null,\n agentToolMaterialization: row.agentToolMaterialization ?? null,\n version: row.version,\n createdAt: row.createdAt,\n updatedAt: row.updatedAt,\n startedAt: row.startedAt,\n finishedAt: row.finishedAt,\n };\n}\n"],"names":["readPersistedWorkflowModel","uuidv7PrimaryKey","sql","check","integer","jsonb","timestamp","uniqueIndex","uuid","pgTable","workflowRunRerunModeEnum","workflowRunStatusEnum","workflowRuns","workflowRunAttempts","id","workflowRunId","notNull","references","onDelete","attempt","status","default","rerunMode","rerunByUserId","model","$type","vars","agentToolMaterialization","version","createdAt","withTimezone","defaultNow","updatedAt","startedAt","finishedAt","table","on","where","toWorkflowRunAttempt","row"],"mappings":"AAAA,SACEA,0BAA0B,QAGrB,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EiC,MAAMf,MAAM,CAAC,0BAA0B,CAAC;KACxD,EACD;AAKF,OAAO,SAASkB,qBAAqBC,GAAyB;IAC5D,OAAO;QACLzB,IAAIyB,IAAIzB,EAAE;QACVC,eAAewB,IAAIxB,aAAa;QAChCI,SAASoB,IAAIpB,OAAO;QACpBC,QAAQmB,IAAInB,MAAM;QAClBE,WAAWiB,IAAIjB,SAAS,IAAI;QAC5BC,eAAegB,IAAIhB,aAAa;QAChCC,OAAOe,IAAIf,KAAK,KAAK,OAAO,OAAOxB,2BAA2BuC,IAAIf,KAAK;QACvEE,MAAMa,IAAIb,IAAI,IAAI;QAClBC,0BAA0BY,IAAIZ,wBAAwB,IAAI;QAC1DC,SAASW,IAAIX,OAAO;QACpBC,WAAWU,IAAIV,SAAS;QACxBG,WAAWO,IAAIP,SAAS;QACxBC,WAAWM,IAAIN,SAAS;QACxBC,YAAYK,IAAIL,UAAU;IAC5B;AACF"}
@@ -0,0 +1,43 @@
1
+ export declare const workflowRunCounters: import("drizzle-orm/pg-core").PgTableWithColumns<{
2
+ name: "workflow_run_counters";
3
+ schema: undefined;
4
+ columns: {
5
+ definitionId: import("drizzle-orm/pg-core").PgColumn<{
6
+ name: "definition_id";
7
+ tableName: "workflow_run_counters";
8
+ dataType: "string";
9
+ columnType: "PgUUID";
10
+ data: string;
11
+ driverParam: string;
12
+ notNull: true;
13
+ hasDefault: false;
14
+ isPrimaryKey: false;
15
+ isAutoincrement: false;
16
+ hasRuntimeDefault: false;
17
+ enumValues: undefined;
18
+ baseColumn: never;
19
+ identity: undefined;
20
+ generated: undefined;
21
+ }, {}, {}>;
22
+ nextNumber: import("drizzle-orm/pg-core").PgColumn<{
23
+ name: "next_number";
24
+ tableName: "workflow_run_counters";
25
+ dataType: "number";
26
+ columnType: "PgInteger";
27
+ data: number;
28
+ driverParam: string | number;
29
+ notNull: true;
30
+ hasDefault: false;
31
+ isPrimaryKey: false;
32
+ isAutoincrement: false;
33
+ hasRuntimeDefault: false;
34
+ enumValues: undefined;
35
+ baseColumn: never;
36
+ identity: undefined;
37
+ generated: undefined;
38
+ }, {}, {}>;
39
+ };
40
+ dialect: "pg";
41
+ }>;
42
+ export type WorkflowRunCounterDb = typeof workflowRunCounters.$inferSelect;
43
+ //# sourceMappingURL=workflow-run-counters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-run-counters.d.ts","sourceRoot":"","sources":["../../../src/db/schema/workflow-run-counters.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAO/B,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,OAAO,mBAAmB,CAAC,YAAY,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { integer, uniqueIndex, uuid } from 'drizzle-orm/pg-core';
2
+ import { pgTable } from './common.js';
3
+ export const workflowRunCounters = pgTable('workflow_run_counters', {
4
+ definitionId: uuid('definition_id').notNull(),
5
+ nextNumber: integer('next_number').notNull()
6
+ }, (table)=>[
7
+ uniqueIndex('workflows_wrrc_definition_id_unique').on(table.definitionId)
8
+ ]);
9
+
10
+ //# sourceMappingURL=workflow-run-counters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/db/schema/workflow-run-counters.ts"],"sourcesContent":["import {integer, uniqueIndex, uuid} from 'drizzle-orm/pg-core';\nimport {pgTable} from './common.js';\n\nexport const workflowRunCounters = pgTable(\n 'workflow_run_counters',\n {\n definitionId: uuid('definition_id').notNull(),\n nextNumber: integer('next_number').notNull(),\n },\n (table) => [uniqueIndex('workflows_wrrc_definition_id_unique').on(table.definitionId)],\n);\n\nexport type WorkflowRunCounterDb = typeof workflowRunCounters.$inferSelect;\n"],"names":["integer","uniqueIndex","uuid","pgTable","workflowRunCounters","definitionId","notNull","nextNumber","table","on"],"mappings":"AAAA,SAAQA,OAAO,EAAEC,WAAW,EAAEC,IAAI,QAAO,sBAAsB;AAC/D,SAAQC,OAAO,QAAO,cAAc;AAEpC,OAAO,MAAMC,sBAAsBD,QACjC,yBACA;IACEE,cAAcH,KAAK,iBAAiBI,OAAO;IAC3CC,YAAYP,QAAQ,eAAeM,OAAO;AAC5C,GACA,CAACE,QAAU;QAACP,YAAY,uCAAuCQ,EAAE,CAACD,MAAMH,YAAY;KAAE,EACtF"}
@@ -1,4 +1,4 @@
1
- import type { TriggerPayload, WorkflowRun, WorkflowSourceSnapshot } from '#core/entities/workflow-run.js';
1
+ import type { TriggerPayload, WorkflowRun, WorkflowRunTriggerReference, WorkflowSourceSnapshot } from '#core/entities/workflow-run.js';
2
2
  export declare const workflowRunStatusEnum: import("drizzle-orm/pg-core").PgEnum<["pending", "running", "succeeded", "failed", "cancelled"]>;
3
3
  export declare const workflowRunRerunModeEnum: import("drizzle-orm/pg-core").PgEnum<["all", "failed"]>;
4
4
  export declare const workflowRuns: import("drizzle-orm/pg-core").PgTableWithColumns<{
@@ -73,6 +73,23 @@ export declare const workflowRuns: import("drizzle-orm/pg-core").PgTableWithColu
73
73
  identity: undefined;
74
74
  generated: undefined;
75
75
  }, {}, {}>;
76
+ number: import("drizzle-orm/pg-core").PgColumn<{
77
+ name: "number";
78
+ tableName: "workflow_runs";
79
+ dataType: "number";
80
+ columnType: "PgInteger";
81
+ data: number;
82
+ driverParam: string | number;
83
+ notNull: true;
84
+ hasDefault: false;
85
+ isPrimaryKey: false;
86
+ isAutoincrement: false;
87
+ hasRuntimeDefault: false;
88
+ enumValues: undefined;
89
+ baseColumn: never;
90
+ identity: undefined;
91
+ generated: undefined;
92
+ }, {}, {}>;
76
93
  name: import("drizzle-orm/pg-core").PgColumn<{
77
94
  name: "name";
78
95
  tableName: "workflow_runs";
@@ -80,6 +97,23 @@ export declare const workflowRuns: import("drizzle-orm/pg-core").PgTableWithColu
80
97
  columnType: "PgText";
81
98
  data: string;
82
99
  driverParam: string;
100
+ notNull: false;
101
+ hasDefault: false;
102
+ isPrimaryKey: false;
103
+ isAutoincrement: false;
104
+ hasRuntimeDefault: false;
105
+ enumValues: [string, ...string[]];
106
+ baseColumn: never;
107
+ identity: undefined;
108
+ generated: undefined;
109
+ }, {}, {}>;
110
+ workflowName: import("drizzle-orm/pg-core").PgColumn<{
111
+ name: "workflow_name";
112
+ tableName: "workflow_runs";
113
+ dataType: "string";
114
+ columnType: "PgText";
115
+ data: string;
116
+ driverParam: string;
83
117
  notNull: true;
84
118
  hasDefault: false;
85
119
  isPrimaryKey: false;
@@ -194,6 +228,25 @@ export declare const workflowRuns: import("drizzle-orm/pg-core").PgTableWithColu
194
228
  }, {}, {
195
229
  $type: TriggerPayload;
196
230
  }>;
231
+ triggerReference: import("drizzle-orm/pg-core").PgColumn<{
232
+ name: "trigger_reference";
233
+ tableName: "workflow_runs";
234
+ dataType: "json";
235
+ columnType: "PgJsonb";
236
+ data: WorkflowRunTriggerReference;
237
+ driverParam: unknown;
238
+ notNull: false;
239
+ hasDefault: false;
240
+ isPrimaryKey: false;
241
+ isAutoincrement: false;
242
+ hasRuntimeDefault: false;
243
+ enumValues: undefined;
244
+ baseColumn: never;
245
+ identity: undefined;
246
+ generated: undefined;
247
+ }, {}, {
248
+ $type: WorkflowRunTriggerReference;
249
+ }>;
197
250
  inputs: import("drizzle-orm/pg-core").PgColumn<{
198
251
  name: "inputs";
199
252
  tableName: "workflow_runs";
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-runs.d.ts","sourceRoot":"","sources":["../../../src/db/schema/workflow-runs.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,sBAAsB,EACvB,MAAM,gCAAgC,CAAC;AAGxC,eAAO,MAAM,qBAAqB,kGAMhC,CAAC;AAEH,eAAO,MAAM,wBAAwB,yDAAoD,CAAC;AAE1F,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuDxB,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,CA2B7D"}
@@ -19,13 +19,16 @@ export const workflowRuns = pgTable('workflow_runs', {
19
19
  workspaceId: uuid('workspace_id').notNull(),
20
20
  projectId: uuid('project_id').notNull(),
21
21
  definitionId: uuid('definition_id').notNull(),
22
- name: text('name').notNull(),
22
+ number: integer('number').notNull(),
23
+ name: text('name'),
24
+ workflowName: text('workflow_name').notNull(),
23
25
  status: workflowRunStatusEnum('status').notNull().default('pending'),
24
26
  currentAttempt: integer('current_attempt').notNull().default(1),
25
27
  triggerProvider: text('trigger_provider'),
26
28
  triggerSource: text('trigger_source').notNull(),
27
29
  triggerEvent: text('trigger_event').notNull(),
28
30
  triggerPayload: jsonb('trigger_payload').notNull().$type(),
31
+ triggerReference: jsonb('trigger_reference').$type(),
29
32
  inputs: jsonb('inputs').$type(),
30
33
  sourceSnapshot: jsonb('source_snapshot').$type(),
31
34
  triggerIdempotencyKey: text('trigger_idempotency_key'),
@@ -47,6 +50,7 @@ export const workflowRuns = pgTable('workflow_runs', {
47
50
  })
48
51
  }, (table)=>[
49
52
  uniqueIndex('workflows_wr_trigger_idempotency_key_unique').on(table.triggerIdempotencyKey),
53
+ uniqueIndex('workflows_wr_definition_number_unique').on(table.definitionId, table.number),
50
54
  index('workflows_wr_project_created_id_idx').on(table.projectId, table.createdAt, table.id),
51
55
  index('workflows_wr_project_status_created_id_idx').on(table.projectId, table.status, table.createdAt, table.id),
52
56
  index('workflows_wr_project_definition_created_id_idx').on(table.projectId, table.definitionId, table.createdAt, table.id),
@@ -63,13 +67,17 @@ export function toWorkflowRun(row) {
63
67
  workspaceId: row.workspaceId,
64
68
  projectId: row.projectId,
65
69
  definitionId: row.definitionId,
66
- name: row.name,
70
+ number: row.number,
71
+ name: row.name ?? row.workflowName,
72
+ workflowName: row.workflowName,
73
+ nameOverride: row.name,
67
74
  status: row.status,
68
75
  currentAttempt: row.currentAttempt,
69
76
  triggerProvider: row.triggerProvider,
70
77
  triggerSource: row.triggerSource,
71
78
  triggerEvent: row.triggerEvent,
72
79
  triggerPayload: row.triggerPayload,
80
+ triggerReference: row.triggerReference ?? null,
73
81
  inputs: row.inputs ?? null,
74
82
  sourceSnapshot: row.sourceSnapshot ?? null,
75
83
  triggerIdempotencyKey: row.triggerIdempotencyKey,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/db/schema/workflow-runs.ts"],"sourcesContent":["import {DEFAULT_RUN_TIMEOUT_MS} from '@shipfox/api-definitions-dto';\nimport {uuidv7PrimaryKey} from '@shipfox/node-drizzle';\nimport {sql} from 'drizzle-orm';\nimport {\n bigint,\n check,\n index,\n integer,\n jsonb,\n pgEnum,\n text,\n timestamp,\n uniqueIndex,\n uuid,\n} from 'drizzle-orm/pg-core';\nimport type {\n TriggerPayload,\n WorkflowRun,\n WorkflowSourceSnapshot,\n} from '#core/entities/workflow-run.js';\nimport {pgTable} from './common.js';\n\nexport const workflowRunStatusEnum = pgEnum('workflows_run_status', [\n 'pending',\n 'running',\n 'succeeded',\n 'failed',\n 'cancelled',\n]);\n\nexport const workflowRunRerunModeEnum = pgEnum('workflows_rerun_mode', ['all', 'failed']);\n\nexport const workflowRuns = pgTable(\n 'workflow_runs',\n {\n id: uuidv7PrimaryKey(),\n workspaceId: uuid('workspace_id').notNull(),\n projectId: uuid('project_id').notNull(),\n definitionId: uuid('definition_id').notNull(),\n name: text('name').notNull(),\n status: workflowRunStatusEnum('status').notNull().default('pending'),\n currentAttempt: integer('current_attempt').notNull().default(1),\n triggerProvider: text('trigger_provider'),\n triggerSource: text('trigger_source').notNull(),\n triggerEvent: text('trigger_event').notNull(),\n triggerPayload: jsonb('trigger_payload').notNull().$type<TriggerPayload>(),\n inputs: jsonb('inputs').$type<Record<string, unknown>>(),\n sourceSnapshot: jsonb('source_snapshot').$type<WorkflowSourceSnapshot>(),\n triggerIdempotencyKey: text('trigger_idempotency_key'),\n timeoutMs: bigint('timeout_ms', {mode: 'number'}).notNull().default(DEFAULT_RUN_TIMEOUT_MS),\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 startedAt: timestamp('started_at', {withTimezone: true}),\n finishedAt: timestamp('finished_at', {withTimezone: true}),\n },\n (table) => [\n uniqueIndex('workflows_wr_trigger_idempotency_key_unique').on(table.triggerIdempotencyKey),\n index('workflows_wr_project_created_id_idx').on(table.projectId, table.createdAt, table.id),\n index('workflows_wr_project_status_created_id_idx').on(\n table.projectId,\n table.status,\n table.createdAt,\n table.id,\n ),\n index('workflows_wr_project_definition_created_id_idx').on(\n table.projectId,\n table.definitionId,\n table.createdAt,\n table.id,\n ),\n index('workflows_wr_project_trigger_created_id_idx').on(\n table.projectId,\n table.triggerSource,\n table.createdAt,\n table.id,\n ),\n // Partial index backing the running-runs depth gauge, which counts on every\n // Prometheus scrape. Indexes only active rows so the count stays cheap as the\n // historical table grows.\n index('workflows_wr_running_idx').on(table.status).where(sql`${table.status} = 'running'`),\n check('workflows_wr_current_attempt_positive_ck', sql`${table.currentAttempt} > 0`),\n ],\n);\n\nexport type WorkflowRunDb = typeof workflowRuns.$inferSelect;\nexport type WorkflowRunCreateDb = typeof workflowRuns.$inferInsert;\n\nexport function toWorkflowRun(row: WorkflowRunDb): WorkflowRun {\n return {\n id: row.id,\n workspaceId: row.workspaceId,\n projectId: row.projectId,\n definitionId: row.definitionId,\n name: row.name,\n status: row.status,\n currentAttempt: row.currentAttempt,\n triggerProvider: row.triggerProvider,\n triggerSource: row.triggerSource,\n triggerEvent: row.triggerEvent,\n triggerPayload: row.triggerPayload as TriggerPayload,\n inputs: row.inputs ?? null,\n sourceSnapshot: row.sourceSnapshot ?? null,\n triggerIdempotencyKey: row.triggerIdempotencyKey,\n timeoutMs: row.timeoutMs,\n version: row.version,\n createdAt: row.createdAt,\n updatedAt: row.updatedAt,\n startedAt: row.startedAt,\n finishedAt: row.finishedAt,\n };\n}\n"],"names":["DEFAULT_RUN_TIMEOUT_MS","uuidv7PrimaryKey","sql","bigint","check","index","integer","jsonb","pgEnum","text","timestamp","uniqueIndex","uuid","pgTable","workflowRunStatusEnum","workflowRunRerunModeEnum","workflowRuns","id","workspaceId","notNull","projectId","definitionId","name","status","default","currentAttempt","triggerProvider","triggerSource","triggerEvent","triggerPayload","$type","inputs","sourceSnapshot","triggerIdempotencyKey","timeoutMs","mode","version","createdAt","withTimezone","defaultNow","updatedAt","startedAt","finishedAt","table","on","where","toWorkflowRun","row"],"mappings":"AAAA,SAAQA,sBAAsB,QAAO,+BAA+B;AACpE,SAAQC,gBAAgB,QAAO,wBAAwB;AACvD,SAAQC,GAAG,QAAO,cAAc;AAChC,SACEC,MAAM,EACNC,KAAK,EACLC,KAAK,EACLC,OAAO,EACPC,KAAK,EACLC,MAAM,EACNC,IAAI,EACJC,SAAS,EACTC,WAAW,EACXC,IAAI,QACC,sBAAsB;AAM7B,SAAQC,OAAO,QAAO,cAAc;AAEpC,OAAO,MAAMC,wBAAwBN,OAAO,wBAAwB;IAClE;IACA;IACA;IACA;IACA;CACD,EAAE;AAEH,OAAO,MAAMO,2BAA2BP,OAAO,wBAAwB;IAAC;IAAO;CAAS,EAAE;AAE1F,OAAO,MAAMQ,eAAeH,QAC1B,iBACA;IACEI,IAAIhB;IACJiB,aAAaN,KAAK,gBAAgBO,OAAO;IACzCC,WAAWR,KAAK,cAAcO,OAAO;IACrCE,cAAcT,KAAK,iBAAiBO,OAAO;IAC3CG,MAAMb,KAAK,QAAQU,OAAO;IAC1BI,QAAQT,sBAAsB,UAAUK,OAAO,GAAGK,OAAO,CAAC;IAC1DC,gBAAgBnB,Q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AC5E,8EAA8E;QAC9E,0BAA0B;QAC1BZ,MAAM,4BAA4BuC,EAAE,CAACD,MAAMpB,MAAM,EAAEsB,KAAK,CAAC3C,GAAG,CAAC,EAAEyC,MAAMpB,MAAM,CAAC,YAAY,CAAC;QACzFnB,MAAM,4CAA4CF,GAAG,CAAC,EAAEyC,MAAMlB,cAAc,CAAC,IAAI,CAAC;KACnF,EACD;AAKF,OAAO,SAASqB,cAAcC,GAAkB;IAC9C,OAAO;QACL9B,IAAI8B,IAAI9B,EAAE;QACVC,aAAa6B,IAAI7B,WAAW;QAC5BE,WAAW2B,IAAI3B,SAAS;QACxBC,cAAc0B,IAAI1B,YAAY;QAC9BC,MAAMyB,IAAIzB,IAAI;QACdC,QAAQwB,IAAIxB,MAAM;QAClBE,gBAAgBsB,IAAItB,cAAc;QAClCC,iBAAiBqB,IAAIrB,eAAe;QACpCC,eAAeoB,IAAIpB,aAAa;QAChCC,cAAcmB,IAAInB,YAAY;QAC9BC,gBAAgBkB,IAAIlB,cAAc;QAClCE,QAAQgB,IAAIhB,MAAM,IAAI;QACtBC,gBAAgBe,IAAIf,cAAc,IAAI;QACtCC,uBAAuBc,IAAId,qBAAqB;QAChDC,WAAWa,IAAIb,SAAS;QACxBE,SAASW,IAAIX,OAAO;QACpBC,WAAWU,IAAIV,SAAS;QACxBG,WAAWO,IAAIP,SAAS;QACxBC,WAAWM,IAAIN,SAAS;QACxBC,YAAYK,IAAIL,UAAU;IAC5B;AACF"}
1
+ {"version":3,"sources":["../../../src/db/schema/workflow-runs.ts"],"sourcesContent":["import {DEFAULT_RUN_TIMEOUT_MS} from '@shipfox/api-definitions-dto';\nimport {uuidv7PrimaryKey} from '@shipfox/node-drizzle';\nimport {sql} from 'drizzle-orm';\nimport {\n bigint,\n check,\n index,\n integer,\n jsonb,\n pgEnum,\n text,\n timestamp,\n uniqueIndex,\n uuid,\n} from 'drizzle-orm/pg-core';\nimport type {\n TriggerPayload,\n WorkflowRun,\n WorkflowRunTriggerReference,\n WorkflowSourceSnapshot,\n} from '#core/entities/workflow-run.js';\nimport {pgTable} from './common.js';\n\nexport const workflowRunStatusEnum = pgEnum('workflows_run_status', [\n 'pending',\n 'running',\n 'succeeded',\n 'failed',\n 'cancelled',\n]);\n\nexport const workflowRunRerunModeEnum = pgEnum('workflows_rerun_mode', ['all', 'failed']);\n\nexport const workflowRuns = pgTable(\n 'workflow_runs',\n {\n id: uuidv7PrimaryKey(),\n workspaceId: uuid('workspace_id').notNull(),\n projectId: uuid('project_id').notNull(),\n definitionId: uuid('definition_id').notNull(),\n number: integer('number').notNull(),\n name: text('name'),\n workflowName: text('workflow_name').notNull(),\n status: workflowRunStatusEnum('status').notNull().default('pending'),\n currentAttempt: integer('current_attempt').notNull().default(1),\n triggerProvider: text('trigger_provider'),\n triggerSource: text('trigger_source').notNull(),\n triggerEvent: text('trigger_event').notNull(),\n triggerPayload: jsonb('trigger_payload').notNull().$type<TriggerPayload>(),\n triggerReference: jsonb('trigger_reference').$type<WorkflowRunTriggerReference>(),\n inputs: jsonb('inputs').$type<Record<string, unknown>>(),\n sourceSnapshot: jsonb('source_snapshot').$type<WorkflowSourceSnapshot>(),\n triggerIdempotencyKey: text('trigger_idempotency_key'),\n timeoutMs: bigint('timeout_ms', {mode: 'number'}).notNull().default(DEFAULT_RUN_TIMEOUT_MS),\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 startedAt: timestamp('started_at', {withTimezone: true}),\n finishedAt: timestamp('finished_at', {withTimezone: true}),\n },\n (table) => [\n uniqueIndex('workflows_wr_trigger_idempotency_key_unique').on(table.triggerIdempotencyKey),\n uniqueIndex('workflows_wr_definition_number_unique').on(table.definitionId, table.number),\n index('workflows_wr_project_created_id_idx').on(table.projectId, table.createdAt, table.id),\n index('workflows_wr_project_status_created_id_idx').on(\n table.projectId,\n table.status,\n table.createdAt,\n table.id,\n ),\n index('workflows_wr_project_definition_created_id_idx').on(\n table.projectId,\n table.definitionId,\n table.createdAt,\n table.id,\n ),\n index('workflows_wr_project_trigger_created_id_idx').on(\n table.projectId,\n table.triggerSource,\n table.createdAt,\n table.id,\n ),\n // Partial index backing the running-runs depth gauge, which counts on every\n // Prometheus scrape. Indexes only active rows so the count stays cheap as the\n // historical table grows.\n index('workflows_wr_running_idx').on(table.status).where(sql`${table.status} = 'running'`),\n check('workflows_wr_current_attempt_positive_ck', sql`${table.currentAttempt} > 0`),\n ],\n);\n\nexport type WorkflowRunDb = typeof workflowRuns.$inferSelect;\nexport type WorkflowRunCreateDb = typeof workflowRuns.$inferInsert;\n\nexport function toWorkflowRun(row: WorkflowRunDb): WorkflowRun {\n return {\n id: row.id,\n workspaceId: row.workspaceId,\n projectId: row.projectId,\n definitionId: row.definitionId,\n number: row.number,\n name: row.name ?? row.workflowName,\n workflowName: row.workflowName,\n nameOverride: row.name,\n status: row.status,\n currentAttempt: row.currentAttempt,\n triggerProvider: row.triggerProvider,\n triggerSource: row.triggerSource,\n triggerEvent: row.triggerEvent,\n triggerPayload: row.triggerPayload as TriggerPayload,\n triggerReference: row.triggerReference ?? null,\n inputs: row.inputs ?? null,\n sourceSnapshot: row.sourceSnapshot ?? null,\n triggerIdempotencyKey: row.triggerIdempotencyKey,\n timeoutMs: row.timeoutMs,\n version: row.version,\n createdAt: row.createdAt,\n updatedAt: row.updatedAt,\n startedAt: row.startedAt,\n finishedAt: row.finishedAt,\n };\n}\n"],"names":["DEFAULT_RUN_TIMEOUT_MS","uuidv7PrimaryKey","sql","bigint","check","index","integer","jsonb","pgEnum","text","timestamp","uniqueIndex","uuid","pgTable","workflowRunStatusEnum","workflowRunRerunModeEnum","workflowRuns","id","workspaceId","notNull","projectId","definitionId","number","name","workflowName","status","default","currentAttempt","triggerProvider","triggerSource","triggerEvent","triggerPayload","$type","triggerReference","inputs","sourceSnapshot","triggerIdempotencyKey","timeoutMs","mode","version","createdAt","withTimezone","defaultNow","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