@shipfox/client-workflows 0.2.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 (327) hide show
  1. package/.storybook/main.ts +1 -0
  2. package/.storybook/preview.css +10 -0
  3. package/.storybook/preview.tsx +97 -0
  4. package/.swcrc +42 -0
  5. package/.turbo/turbo-build.log +2 -0
  6. package/.turbo/turbo-type$colon$emit.log +1 -0
  7. package/.turbo/turbo-type.log +1 -0
  8. package/CHANGELOG.md +162 -0
  9. package/LICENSE +21 -0
  10. package/dist/components/identifier/identifier.d.ts +6 -0
  11. package/dist/components/identifier/identifier.d.ts.map +1 -0
  12. package/dist/components/identifier/identifier.js +144 -0
  13. package/dist/components/identifier/identifier.js.map +1 -0
  14. package/dist/components/identifier/index.d.ts +2 -0
  15. package/dist/components/identifier/index.d.ts.map +1 -0
  16. package/dist/components/identifier/index.js +3 -0
  17. package/dist/components/identifier/index.js.map +1 -0
  18. package/dist/components/job-graph/graph-model.d.ts +27 -0
  19. package/dist/components/job-graph/graph-model.d.ts.map +1 -0
  20. package/dist/components/job-graph/graph-model.js +107 -0
  21. package/dist/components/job-graph/graph-model.js.map +1 -0
  22. package/dist/components/job-graph/index.d.ts +3 -0
  23. package/dist/components/job-graph/index.d.ts.map +1 -0
  24. package/dist/components/job-graph/index.js +3 -0
  25. package/dist/components/job-graph/index.js.map +1 -0
  26. package/dist/components/job-graph/job-duration-format.d.ts +4 -0
  27. package/dist/components/job-graph/job-duration-format.d.ts.map +1 -0
  28. package/dist/components/job-graph/job-duration-format.js +41 -0
  29. package/dist/components/job-graph/job-duration-format.js.map +1 -0
  30. package/dist/components/job-graph/job-duration-label.d.ts +5 -0
  31. package/dist/components/job-graph/job-duration-label.d.ts.map +1 -0
  32. package/dist/components/job-graph/job-duration-label.js +33 -0
  33. package/dist/components/job-graph/job-duration-label.js.map +1 -0
  34. package/dist/components/job-graph/job-graph-content.d.ts +9 -0
  35. package/dist/components/job-graph/job-graph-content.d.ts.map +1 -0
  36. package/dist/components/job-graph/job-graph-content.js +181 -0
  37. package/dist/components/job-graph/job-graph-content.js.map +1 -0
  38. package/dist/components/job-graph/job-graph-view.d.ts +11 -0
  39. package/dist/components/job-graph/job-graph-view.d.ts.map +1 -0
  40. package/dist/components/job-graph/job-graph-view.js +24 -0
  41. package/dist/components/job-graph/job-graph-view.js.map +1 -0
  42. package/dist/components/job-graph/job-graph.d.ts +3 -0
  43. package/dist/components/job-graph/job-graph.d.ts.map +1 -0
  44. package/dist/components/job-graph/job-graph.js +21 -0
  45. package/dist/components/job-graph/job-graph.js.map +1 -0
  46. package/dist/components/job-graph/job-node.d.ts +16 -0
  47. package/dist/components/job-graph/job-node.d.ts.map +1 -0
  48. package/dist/components/job-graph/job-node.js +196 -0
  49. package/dist/components/job-graph/job-node.js.map +1 -0
  50. package/dist/components/job-graph/types.d.ts +9 -0
  51. package/dist/components/job-graph/types.d.ts.map +1 -0
  52. package/dist/components/job-graph/types.js +3 -0
  53. package/dist/components/job-graph/types.js.map +1 -0
  54. package/dist/components/step-list/index.d.ts +3 -0
  55. package/dist/components/step-list/index.d.ts.map +1 -0
  56. package/dist/components/step-list/index.js +3 -0
  57. package/dist/components/step-list/index.js.map +1 -0
  58. package/dist/components/step-list/step-list-model.d.ts +36 -0
  59. package/dist/components/step-list/step-list-model.d.ts.map +1 -0
  60. package/dist/components/step-list/step-list-model.js +135 -0
  61. package/dist/components/step-list/step-list-model.js.map +1 -0
  62. package/dist/components/step-list/step-list.d.ts +32 -0
  63. package/dist/components/step-list/step-list.d.ts.map +1 -0
  64. package/dist/components/step-list/step-list.js +409 -0
  65. package/dist/components/step-list/step-list.js.map +1 -0
  66. package/dist/components/workflow-run-duration-label.d.ts +8 -0
  67. package/dist/components/workflow-run-duration-label.d.ts.map +1 -0
  68. package/dist/components/workflow-run-duration-label.js +84 -0
  69. package/dist/components/workflow-run-duration-label.js.map +1 -0
  70. package/dist/components/workflow-run-list/index.d.ts +2 -0
  71. package/dist/components/workflow-run-list/index.d.ts.map +1 -0
  72. package/dist/components/workflow-run-list/index.js +3 -0
  73. package/dist/components/workflow-run-list/index.js.map +1 -0
  74. package/dist/components/workflow-run-list/run-display.d.ts +5 -0
  75. package/dist/components/workflow-run-list/run-display.d.ts.map +1 -0
  76. package/dist/components/workflow-run-list/run-display.js +19 -0
  77. package/dist/components/workflow-run-list/run-display.js.map +1 -0
  78. package/dist/components/workflow-run-list/types.d.ts +21 -0
  79. package/dist/components/workflow-run-list/types.d.ts.map +1 -0
  80. package/dist/components/workflow-run-list/types.js +3 -0
  81. package/dist/components/workflow-run-list/types.js.map +1 -0
  82. package/dist/components/workflow-run-list/workflow-run-list-content.d.ts +14 -0
  83. package/dist/components/workflow-run-list/workflow-run-list-content.d.ts.map +1 -0
  84. package/dist/components/workflow-run-list/workflow-run-list-content.js +37 -0
  85. package/dist/components/workflow-run-list/workflow-run-list-content.js.map +1 -0
  86. package/dist/components/workflow-run-list/workflow-run-list-header.d.ts +10 -0
  87. package/dist/components/workflow-run-list/workflow-run-list-header.d.ts.map +1 -0
  88. package/dist/components/workflow-run-list/workflow-run-list-header.js +55 -0
  89. package/dist/components/workflow-run-list/workflow-run-list-header.js.map +1 -0
  90. package/dist/components/workflow-run-list/workflow-run-list-states.d.ts +15 -0
  91. package/dist/components/workflow-run-list/workflow-run-list-states.d.ts.map +1 -0
  92. package/dist/components/workflow-run-list/workflow-run-list-states.js +103 -0
  93. package/dist/components/workflow-run-list/workflow-run-list-states.js.map +1 -0
  94. package/dist/components/workflow-run-list/workflow-run-list-view.d.ts +3 -0
  95. package/dist/components/workflow-run-list/workflow-run-list-view.d.ts.map +1 -0
  96. package/dist/components/workflow-run-list/workflow-run-list-view.js +46 -0
  97. package/dist/components/workflow-run-list/workflow-run-list-view.js.map +1 -0
  98. package/dist/components/workflow-run-list/workflow-run-list.d.ts +3 -0
  99. package/dist/components/workflow-run-list/workflow-run-list.d.ts.map +1 -0
  100. package/dist/components/workflow-run-list/workflow-run-list.js +20 -0
  101. package/dist/components/workflow-run-list/workflow-run-list.js.map +1 -0
  102. package/dist/components/workflow-run-list/workflow-run-row.d.ts +14 -0
  103. package/dist/components/workflow-run-list/workflow-run-row.d.ts.map +1 -0
  104. package/dist/components/workflow-run-list/workflow-run-row.js +172 -0
  105. package/dist/components/workflow-run-list/workflow-run-row.js.map +1 -0
  106. package/dist/components/workflow-run-summary/index.d.ts +2 -0
  107. package/dist/components/workflow-run-summary/index.d.ts.map +1 -0
  108. package/dist/components/workflow-run-summary/index.js +3 -0
  109. package/dist/components/workflow-run-summary/index.js.map +1 -0
  110. package/dist/components/workflow-run-summary/workflow-run-attempt-switcher.d.ts +9 -0
  111. package/dist/components/workflow-run-summary/workflow-run-attempt-switcher.d.ts.map +1 -0
  112. package/dist/components/workflow-run-summary/workflow-run-attempt-switcher.js +138 -0
  113. package/dist/components/workflow-run-summary/workflow-run-attempt-switcher.js.map +1 -0
  114. package/dist/components/workflow-run-summary/workflow-run-summary.d.ts +20 -0
  115. package/dist/components/workflow-run-summary/workflow-run-summary.d.ts.map +1 -0
  116. package/dist/components/workflow-run-summary/workflow-run-summary.js +252 -0
  117. package/dist/components/workflow-run-summary/workflow-run-summary.js.map +1 -0
  118. package/dist/components/workflow-run-view/agent-config-failure-callout.d.ts +7 -0
  119. package/dist/components/workflow-run-view/agent-config-failure-callout.d.ts.map +1 -0
  120. package/dist/components/workflow-run-view/agent-config-failure-callout.js +84 -0
  121. package/dist/components/workflow-run-view/agent-config-failure-callout.js.map +1 -0
  122. package/dist/components/workflow-run-view/index.d.ts +3 -0
  123. package/dist/components/workflow-run-view/index.d.ts.map +1 -0
  124. package/dist/components/workflow-run-view/index.js +4 -0
  125. package/dist/components/workflow-run-view/index.js.map +1 -0
  126. package/dist/components/workflow-run-view/job-card.d.ts +17 -0
  127. package/dist/components/workflow-run-view/job-card.d.ts.map +1 -0
  128. package/dist/components/workflow-run-view/job-card.js +476 -0
  129. package/dist/components/workflow-run-view/job-card.js.map +1 -0
  130. package/dist/components/workflow-run-view/job-execution-switcher.d.ts +10 -0
  131. package/dist/components/workflow-run-view/job-execution-switcher.d.ts.map +1 -0
  132. package/dist/components/workflow-run-view/job-execution-switcher.js +171 -0
  133. package/dist/components/workflow-run-view/job-execution-switcher.js.map +1 -0
  134. package/dist/components/workflow-run-view/job-execution-time-text.d.ts +6 -0
  135. package/dist/components/workflow-run-view/job-execution-time-text.d.ts.map +1 -0
  136. package/dist/components/workflow-run-view/job-execution-time-text.js +24 -0
  137. package/dist/components/workflow-run-view/job-execution-time-text.js.map +1 -0
  138. package/dist/components/workflow-run-view/step-attempt-log-panel.d.ts +9 -0
  139. package/dist/components/workflow-run-view/step-attempt-log-panel.d.ts.map +1 -0
  140. package/dist/components/workflow-run-view/step-attempt-log-panel.js +152 -0
  141. package/dist/components/workflow-run-view/step-attempt-log-panel.js.map +1 -0
  142. package/dist/components/workflow-run-view/workflow-run-selection.d.ts +14 -0
  143. package/dist/components/workflow-run-view/workflow-run-selection.d.ts.map +1 -0
  144. package/dist/components/workflow-run-view/workflow-run-selection.js +56 -0
  145. package/dist/components/workflow-run-view/workflow-run-selection.js.map +1 -0
  146. package/dist/components/workflow-run-view/workflow-run-states.d.ts +12 -0
  147. package/dist/components/workflow-run-view/workflow-run-states.d.ts.map +1 -0
  148. package/dist/components/workflow-run-view/workflow-run-states.js +91 -0
  149. package/dist/components/workflow-run-view/workflow-run-states.js.map +1 -0
  150. package/dist/components/workflow-run-view/workflow-run-view.d.ts +15 -0
  151. package/dist/components/workflow-run-view/workflow-run-view.d.ts.map +1 -0
  152. package/dist/components/workflow-run-view/workflow-run-view.js +285 -0
  153. package/dist/components/workflow-run-view/workflow-run-view.js.map +1 -0
  154. package/dist/components/workflow-source-panel/index.d.ts +2 -0
  155. package/dist/components/workflow-source-panel/index.d.ts.map +1 -0
  156. package/dist/components/workflow-source-panel/index.js +3 -0
  157. package/dist/components/workflow-source-panel/index.js.map +1 -0
  158. package/dist/components/workflow-source-panel/workflow-source-panel.d.ts +13 -0
  159. package/dist/components/workflow-source-panel/workflow-source-panel.d.ts.map +1 -0
  160. package/dist/components/workflow-source-panel/workflow-source-panel.js +91 -0
  161. package/dist/components/workflow-source-panel/workflow-source-panel.js.map +1 -0
  162. package/dist/components/workflow-status/status-visuals.d.ts +12 -0
  163. package/dist/components/workflow-status/status-visuals.d.ts.map +1 -0
  164. package/dist/components/workflow-status/status-visuals.js +54 -0
  165. package/dist/components/workflow-status/status-visuals.js.map +1 -0
  166. package/dist/components/workflow-status/workflow-status-icon.d.ts +22 -0
  167. package/dist/components/workflow-status/workflow-status-icon.d.ts.map +1 -0
  168. package/dist/components/workflow-status/workflow-status-icon.js +100 -0
  169. package/dist/components/workflow-status/workflow-status-icon.js.map +1 -0
  170. package/dist/core/entities/job-execution.d.ts +69 -0
  171. package/dist/core/entities/job-execution.d.ts.map +1 -0
  172. package/dist/core/entities/job-execution.js +83 -0
  173. package/dist/core/entities/job-execution.js.map +1 -0
  174. package/dist/core/entities/job.d.ts +56 -0
  175. package/dist/core/entities/job.d.ts.map +1 -0
  176. package/dist/core/entities/job.js +71 -0
  177. package/dist/core/entities/job.js.map +1 -0
  178. package/dist/core/entities/step-attempt.d.ts +49 -0
  179. package/dist/core/entities/step-attempt.d.ts.map +1 -0
  180. package/dist/core/entities/step-attempt.js +48 -0
  181. package/dist/core/entities/step-attempt.js.map +1 -0
  182. package/dist/core/entities/step.d.ts +41 -0
  183. package/dist/core/entities/step.d.ts.map +1 -0
  184. package/dist/core/entities/step.js +51 -0
  185. package/dist/core/entities/step.js.map +1 -0
  186. package/dist/core/entities/workflow-run-attempt.d.ts +44 -0
  187. package/dist/core/entities/workflow-run-attempt.d.ts.map +1 -0
  188. package/dist/core/entities/workflow-run-attempt.js +51 -0
  189. package/dist/core/entities/workflow-run-attempt.js.map +1 -0
  190. package/dist/core/entities/workflow-run.d.ts +61 -0
  191. package/dist/core/entities/workflow-run.d.ts.map +1 -0
  192. package/dist/core/entities/workflow-run.js +104 -0
  193. package/dist/core/entities/workflow-run.js.map +1 -0
  194. package/dist/core/workflow-run-url-state.d.ts +13 -0
  195. package/dist/core/workflow-run-url-state.d.ts.map +1 -0
  196. package/dist/core/workflow-run-url-state.js +43 -0
  197. package/dist/core/workflow-run-url-state.js.map +1 -0
  198. package/dist/core/workflow-run.d.ts +13 -0
  199. package/dist/core/workflow-run.d.ts.map +1 -0
  200. package/dist/core/workflow-run.js +8 -0
  201. package/dist/core/workflow-run.js.map +1 -0
  202. package/dist/env.d.js +2 -0
  203. package/dist/env.d.js.map +1 -0
  204. package/dist/feature.d.ts +20 -0
  205. package/dist/feature.d.ts.map +1 -0
  206. package/dist/feature.js +27 -0
  207. package/dist/feature.js.map +1 -0
  208. package/dist/hooks/api/workflow-runs.d.ts +109 -0
  209. package/dist/hooks/api/workflow-runs.d.ts.map +1 -0
  210. package/dist/hooks/api/workflow-runs.js +394 -0
  211. package/dist/hooks/api/workflow-runs.js.map +1 -0
  212. package/dist/index.d.ts +5 -0
  213. package/dist/index.d.ts.map +1 -0
  214. package/dist/index.js +5 -0
  215. package/dist/index.js.map +1 -0
  216. package/dist/pages/workflow-run-first-time-use.d.ts +6 -0
  217. package/dist/pages/workflow-run-first-time-use.d.ts.map +1 -0
  218. package/dist/pages/workflow-run-first-time-use.js +17 -0
  219. package/dist/pages/workflow-run-first-time-use.js.map +1 -0
  220. package/dist/pages/workflow-run-page.d.ts +8 -0
  221. package/dist/pages/workflow-run-page.d.ts.map +1 -0
  222. package/dist/pages/workflow-run-page.js +83 -0
  223. package/dist/pages/workflow-run-page.js.map +1 -0
  224. package/dist/routes/run-detail.d.ts +8 -0
  225. package/dist/routes/run-detail.d.ts.map +1 -0
  226. package/dist/routes/run-detail.js +21 -0
  227. package/dist/routes/run-detail.js.map +1 -0
  228. package/dist/routes/runs.d.ts +8 -0
  229. package/dist/routes/runs.d.ts.map +1 -0
  230. package/dist/routes/runs.js +20 -0
  231. package/dist/routes/runs.js.map +1 -0
  232. package/dist/tsconfig.test.tsbuildinfo +1 -0
  233. package/package.json +114 -0
  234. package/src/components/identifier/identifier.tsx +178 -0
  235. package/src/components/identifier/index.ts +1 -0
  236. package/src/components/job-graph/graph-model.test.ts +189 -0
  237. package/src/components/job-graph/graph-model.ts +178 -0
  238. package/src/components/job-graph/index.ts +2 -0
  239. package/src/components/job-graph/job-duration-format.ts +54 -0
  240. package/src/components/job-graph/job-duration-label.tsx +29 -0
  241. package/src/components/job-graph/job-graph-content.tsx +225 -0
  242. package/src/components/job-graph/job-graph-view.test.tsx +298 -0
  243. package/src/components/job-graph/job-graph-view.tsx +45 -0
  244. package/src/components/job-graph/job-graph.stories.tsx +182 -0
  245. package/src/components/job-graph/job-graph.tsx +24 -0
  246. package/src/components/job-graph/job-node.stories.tsx +364 -0
  247. package/src/components/job-graph/job-node.test.tsx +347 -0
  248. package/src/components/job-graph/job-node.tsx +202 -0
  249. package/src/components/job-graph/types.ts +9 -0
  250. package/src/components/step-list/index.ts +6 -0
  251. package/src/components/step-list/step-list-model.test.ts +369 -0
  252. package/src/components/step-list/step-list-model.ts +205 -0
  253. package/src/components/step-list/step-list.stories.tsx +419 -0
  254. package/src/components/step-list/step-list.test.tsx +566 -0
  255. package/src/components/step-list/step-list.tsx +494 -0
  256. package/src/components/workflow-run-duration-label.tsx +118 -0
  257. package/src/components/workflow-run-list/index.ts +1 -0
  258. package/src/components/workflow-run-list/run-display.test.ts +53 -0
  259. package/src/components/workflow-run-list/run-display.ts +22 -0
  260. package/src/components/workflow-run-list/types.ts +22 -0
  261. package/src/components/workflow-run-list/workflow-run-list-content.tsx +58 -0
  262. package/src/components/workflow-run-list/workflow-run-list-header.tsx +53 -0
  263. package/src/components/workflow-run-list/workflow-run-list-states.tsx +86 -0
  264. package/src/components/workflow-run-list/workflow-run-list-view.test.tsx +178 -0
  265. package/src/components/workflow-run-list/workflow-run-list-view.tsx +57 -0
  266. package/src/components/workflow-run-list/workflow-run-list.stories.tsx +111 -0
  267. package/src/components/workflow-run-list/workflow-run-list.tsx +29 -0
  268. package/src/components/workflow-run-list/workflow-run-row.tsx +176 -0
  269. package/src/components/workflow-run-summary/index.ts +1 -0
  270. package/src/components/workflow-run-summary/workflow-run-attempt-switcher.test.tsx +230 -0
  271. package/src/components/workflow-run-summary/workflow-run-attempt-switcher.tsx +146 -0
  272. package/src/components/workflow-run-summary/workflow-run-summary.stories.tsx +414 -0
  273. package/src/components/workflow-run-summary/workflow-run-summary.test.tsx +354 -0
  274. package/src/components/workflow-run-summary/workflow-run-summary.tsx +295 -0
  275. package/src/components/workflow-run-view/agent-config-failure-callout.stories.tsx +140 -0
  276. package/src/components/workflow-run-view/agent-config-failure-callout.tsx +93 -0
  277. package/src/components/workflow-run-view/index.ts +2 -0
  278. package/src/components/workflow-run-view/job-card.stories.tsx +788 -0
  279. package/src/components/workflow-run-view/job-card.tsx +566 -0
  280. package/src/components/workflow-run-view/job-execution-switcher.tsx +170 -0
  281. package/src/components/workflow-run-view/job-execution-time-text.tsx +34 -0
  282. package/src/components/workflow-run-view/step-attempt-log-panel.test.tsx +290 -0
  283. package/src/components/workflow-run-view/step-attempt-log-panel.tsx +152 -0
  284. package/src/components/workflow-run-view/workflow-run-selection.test.ts +280 -0
  285. package/src/components/workflow-run-view/workflow-run-selection.ts +89 -0
  286. package/src/components/workflow-run-view/workflow-run-states.tsx +70 -0
  287. package/src/components/workflow-run-view/workflow-run-view.test.tsx +1214 -0
  288. package/src/components/workflow-run-view/workflow-run-view.tsx +341 -0
  289. package/src/components/workflow-source-panel/index.ts +1 -0
  290. package/src/components/workflow-source-panel/workflow-source-panel.stories.tsx +110 -0
  291. package/src/components/workflow-source-panel/workflow-source-panel.test.tsx +96 -0
  292. package/src/components/workflow-source-panel/workflow-source-panel.tsx +136 -0
  293. package/src/components/workflow-status/status-visuals.test.ts +38 -0
  294. package/src/components/workflow-status/status-visuals.ts +36 -0
  295. package/src/components/workflow-status/workflow-status-icon.stories.tsx +90 -0
  296. package/src/components/workflow-status/workflow-status-icon.tsx +135 -0
  297. package/src/core/entities/job-execution.ts +139 -0
  298. package/src/core/entities/job.ts +149 -0
  299. package/src/core/entities/step-attempt.ts +89 -0
  300. package/src/core/entities/step.ts +105 -0
  301. package/src/core/entities/workflow-run-attempt.ts +87 -0
  302. package/src/core/entities/workflow-run.ts +183 -0
  303. package/src/core/workflow-run-url-state.ts +61 -0
  304. package/src/core/workflow-run.test.ts +640 -0
  305. package/src/core/workflow-run.ts +66 -0
  306. package/src/env.d.ts +8 -0
  307. package/src/feature.ts +26 -0
  308. package/src/hooks/api/workflow-runs.test.tsx +410 -0
  309. package/src/hooks/api/workflow-runs.ts +485 -0
  310. package/src/index.ts +45 -0
  311. package/src/page-harness-budget.test.ts +33 -0
  312. package/src/pages/workflow-run-first-time-use.tsx +17 -0
  313. package/src/pages/workflow-run-page.test.tsx +517 -0
  314. package/src/pages/workflow-run-page.tsx +89 -0
  315. package/src/routes/run-detail.tsx +15 -0
  316. package/src/routes/runs.tsx +11 -0
  317. package/test/fixtures/logs.ts +13 -0
  318. package/test/fixtures/workflow-run.ts +311 -0
  319. package/test/pages.tsx +79 -0
  320. package/test/render.tsx +40 -0
  321. package/test/setup.ts +3 -0
  322. package/tsconfig.build.json +9 -0
  323. package/tsconfig.build.tsbuildinfo +1 -0
  324. package/tsconfig.json +3 -0
  325. package/tsconfig.test.json +8 -0
  326. package/vercel.json +8 -0
  327. package/vitest.config.ts +70 -0
@@ -0,0 +1,51 @@
1
+ import { toStepAttempt } from './step-attempt.js';
2
+ export function toStep(dto) {
3
+ return {
4
+ id: dto.id,
5
+ jobExecutionId: dto.job_execution_id,
6
+ key: dto.key,
7
+ name: dto.name,
8
+ sourceLocation: dto.source_location ? toStepSourceLocation(dto.source_location) : null,
9
+ status: dto.status,
10
+ type: dto.type,
11
+ config: dto.config,
12
+ agentConfig: toAgentStepConfig(dto),
13
+ error: dto.error ? toStepError(dto.error) : null,
14
+ position: dto.position,
15
+ currentAttempt: dto.current_attempt,
16
+ createdAt: dto.created_at,
17
+ updatedAt: dto.updated_at,
18
+ attempts: dto.attempts.map((attempt)=>toStepAttempt(attempt, dto.job_execution_id))
19
+ };
20
+ }
21
+ function toStepSourceLocation(dto) {
22
+ return {
23
+ startLine: dto.start_line,
24
+ endLine: dto.end_line
25
+ };
26
+ }
27
+ function toStepError(dto) {
28
+ return {
29
+ message: dto.message,
30
+ exitCode: dto.exit_code ?? null,
31
+ signal: dto.signal,
32
+ reason: dto.reason,
33
+ agentConfigIssue: dto.agent_config_issue,
34
+ category: dto.category
35
+ };
36
+ }
37
+ function toAgentStepConfig(dto) {
38
+ if (dto.type !== 'agent') return null;
39
+ return {
40
+ provider: stringConfigValue(dto.config.provider),
41
+ model: stringConfigValue(dto.config.model),
42
+ thinking: stringConfigValue(dto.config.thinking)
43
+ };
44
+ }
45
+ function stringConfigValue(value) {
46
+ if (typeof value !== 'string') return null;
47
+ const trimmedValue = value.trim();
48
+ return trimmedValue ? trimmedValue : null;
49
+ }
50
+
51
+ //# sourceMappingURL=step.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/core/entities/step.ts"],"sourcesContent":["import type {\n AgentConfigIssueDto,\n StepErrorCategoryDto,\n StepErrorReasonDto,\n StepSourceLocationDto,\n WorkflowRunStepDetailDto,\n} from '@shipfox/api-workflows-dto';\nimport {type StepAttempt, toStepAttempt} from './step-attempt.js';\n\nexport type StepErrorReason = StepErrorReasonDto;\nexport type AgentConfigIssue = AgentConfigIssueDto;\nexport type StepErrorCategory = StepErrorCategoryDto;\n\nexport interface StepSourceLocation {\n startLine: number;\n endLine: number;\n}\n\nexport interface StepError {\n message: string;\n exitCode: number | null;\n signal: string | undefined;\n reason: StepErrorReason | undefined;\n agentConfigIssue: AgentConfigIssue | undefined;\n category: StepErrorCategory | undefined;\n}\n\nexport interface AgentStepConfig {\n provider: string | null;\n model: string | null;\n thinking: string | null;\n}\n\nexport interface Step {\n id: string;\n jobExecutionId: string;\n key: string | null;\n name: string;\n sourceLocation: StepSourceLocation | null;\n status: string;\n type: string;\n config: Record<string, unknown>;\n agentConfig: AgentStepConfig | null;\n error: StepError | null;\n position: number;\n currentAttempt: number;\n createdAt: string;\n updatedAt: string;\n attempts: StepAttempt[];\n}\n\nexport function toStep(dto: WorkflowRunStepDetailDto): Step {\n return {\n id: dto.id,\n jobExecutionId: dto.job_execution_id,\n key: dto.key,\n name: dto.name,\n sourceLocation: dto.source_location ? toStepSourceLocation(dto.source_location) : null,\n status: dto.status,\n type: dto.type,\n config: dto.config,\n agentConfig: toAgentStepConfig(dto),\n error: dto.error ? toStepError(dto.error) : null,\n position: dto.position,\n currentAttempt: dto.current_attempt,\n createdAt: dto.created_at,\n updatedAt: dto.updated_at,\n attempts: dto.attempts.map((attempt) => toStepAttempt(attempt, dto.job_execution_id)),\n };\n}\n\nfunction toStepSourceLocation(dto: StepSourceLocationDto): StepSourceLocation {\n return {\n startLine: dto.start_line,\n endLine: dto.end_line,\n };\n}\n\nfunction toStepError(dto: NonNullable<WorkflowRunStepDetailDto['error']>): StepError {\n return {\n message: dto.message,\n exitCode: dto.exit_code ?? null,\n signal: dto.signal,\n reason: dto.reason,\n agentConfigIssue: dto.agent_config_issue,\n category: dto.category,\n };\n}\n\nfunction toAgentStepConfig(dto: WorkflowRunStepDetailDto): AgentStepConfig | null {\n if (dto.type !== 'agent') return null;\n\n return {\n provider: stringConfigValue(dto.config.provider),\n model: stringConfigValue(dto.config.model),\n thinking: stringConfigValue(dto.config.thinking),\n };\n}\n\nfunction stringConfigValue(value: unknown): string | null {\n if (typeof value !== 'string') return null;\n\n const trimmedValue = value.trim();\n return trimmedValue ? trimmedValue : null;\n}\n"],"names":["toStepAttempt","toStep","dto","id","jobExecutionId","job_execution_id","key","name","sourceLocation","source_location","toStepSourceLocation","status","type","config","agentConfig","toAgentStepConfig","error","toStepError","position","currentAttempt","current_attempt","createdAt","created_at","updatedAt","updated_at","attempts","map","attempt","startLine","start_line","endLine","end_line","message","exitCode","exit_code","signal","reason","agentConfigIssue","agent_config_issue","category","provider","stringConfigValue","model","thinking","value","trimmedValue","trim"],"mappings":"AAOA,SAA0BA,aAAa,QAAO,oBAAoB;AA4ClE,OAAO,SAASC,OAAOC,GAA6B;IAClD,OAAO;QACLC,IAAID,IAAIC,EAAE;QACVC,gBAAgBF,IAAIG,gBAAgB;QACpCC,KAAKJ,IAAII,GAAG;QACZC,MAAML,IAAIK,IAAI;QACdC,gBAAgBN,IAAIO,eAAe,GAAGC,qBAAqBR,IAAIO,eAAe,IAAI;QAClFE,QAAQT,IAAIS,MAAM;QAClBC,MAAMV,IAAIU,IAAI;QACdC,QAAQX,IAAIW,MAAM;QAClBC,aAAaC,kBAAkBb;QAC/Bc,OAAOd,IAAIc,KAAK,GAAGC,YAAYf,IAAIc,KAAK,IAAI;QAC5CE,UAAUhB,IAAIgB,QAAQ;QACtBC,gBAAgBjB,IAAIkB,eAAe;QACnCC,WAAWnB,IAAIoB,UAAU;QACzBC,WAAWrB,IAAIsB,UAAU;QACzBC,UAAUvB,IAAIuB,QAAQ,CAACC,GAAG,CAAC,CAACC,UAAY3B,cAAc2B,SAASzB,IAAIG,gBAAgB;IACrF;AACF;AAEA,SAASK,qBAAqBR,GAA0B;IACtD,OAAO;QACL0B,WAAW1B,IAAI2B,UAAU;QACzBC,SAAS5B,IAAI6B,QAAQ;IACvB;AACF;AAEA,SAASd,YAAYf,GAAmD;IACtE,OAAO;QACL8B,SAAS9B,IAAI8B,OAAO;QACpBC,UAAU/B,IAAIgC,SAAS,IAAI;QAC3BC,QAAQjC,IAAIiC,MAAM;QAClBC,QAAQlC,IAAIkC,MAAM;QAClBC,kBAAkBnC,IAAIoC,kBAAkB;QACxCC,UAAUrC,IAAIqC,QAAQ;IACxB;AACF;AAEA,SAASxB,kBAAkBb,GAA6B;IACtD,IAAIA,IAAIU,IAAI,KAAK,SAAS,OAAO;IAEjC,OAAO;QACL4B,UAAUC,kBAAkBvC,IAAIW,MAAM,CAAC2B,QAAQ;QAC/CE,OAAOD,kBAAkBvC,IAAIW,MAAM,CAAC6B,KAAK;QACzCC,UAAUF,kBAAkBvC,IAAIW,MAAM,CAAC8B,QAAQ;IACjD;AACF;AAEA,SAASF,kBAAkBG,KAAc;IACvC,IAAI,OAAOA,UAAU,UAAU,OAAO;IAEtC,MAAMC,eAAeD,MAAME,IAAI;IAC/B,OAAOD,eAAeA,eAAe;AACvC"}
@@ -0,0 +1,44 @@
1
+ import type { WorkflowRunAttemptDto } from '@shipfox/api-workflows-dto';
2
+ import { type Duration } from 'date-fns';
3
+ import type { WorkflowRunStatus } from './workflow-run.js';
4
+ export type WorkflowRunAttemptDisplayDuration = {
5
+ state: 'fixed';
6
+ elapsed: Duration;
7
+ } | {
8
+ state: 'live';
9
+ fromIso: string;
10
+ };
11
+ interface WorkflowRunAttemptSummaryFields {
12
+ workflowRunId: string;
13
+ attempt: number;
14
+ status: WorkflowRunStatus;
15
+ createdAt: string;
16
+ startedAt: string | null;
17
+ finishedAt: string | null;
18
+ }
19
+ interface WorkflowRunAttemptFields extends WorkflowRunAttemptSummaryFields {
20
+ id: string;
21
+ rerunMode: 'all' | 'failed' | null;
22
+ }
23
+ export declare class WorkflowRunAttemptSummary {
24
+ workflowRunId: string;
25
+ attempt: number;
26
+ status: WorkflowRunStatus;
27
+ createdAt: string;
28
+ startedAt: string | null;
29
+ finishedAt: string | null;
30
+ constructor(fields: WorkflowRunAttemptSummaryFields);
31
+ get displayDuration(): WorkflowRunAttemptDisplayDuration | null;
32
+ }
33
+ export declare class WorkflowRunAttempt extends WorkflowRunAttemptSummary {
34
+ id: string;
35
+ rerunMode: 'all' | 'failed' | null;
36
+ constructor(fields: WorkflowRunAttemptFields);
37
+ }
38
+ export declare function toWorkflowRunAttempt(dto: WorkflowRunAttemptDto): WorkflowRunAttempt;
39
+ export declare function workflowRunAttemptDisplayDurationFromTimestamps({ startedAt, finishedAt, }: {
40
+ startedAt: string | null;
41
+ finishedAt: string | null;
42
+ }): WorkflowRunAttemptDisplayDuration | null;
43
+ export {};
44
+ //# sourceMappingURL=workflow-run-attempt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-run-attempt.d.ts","sourceRoot":"","sources":["../../../src/core/entities/workflow-run-attempt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAC,KAAK,QAAQ,EAAqB,MAAM,UAAU,CAAC;AAC3D,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AAEzD,MAAM,MAAM,iCAAiC,GACzC;IAAC,KAAK,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,QAAQ,CAAA;CAAC,GACnC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAC,CAAC;AAErC,UAAU,+BAA+B;IACvC,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,UAAU,wBAAyB,SAAQ,+BAA+B;IACxE,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,KAAK,GAAG,QAAQ,GAAG,IAAI,CAAC;CACpC;AAED,qBAAa,yBAAyB;IACpC,aAAa,EAAG,MAAM,CAAC;IACvB,OAAO,EAAG,MAAM,CAAC;IACjB,MAAM,EAAG,iBAAiB,CAAC;IAC3B,SAAS,EAAG,MAAM,CAAC;IACnB,SAAS,EAAG,MAAM,GAAG,IAAI,CAAC;IAC1B,UAAU,EAAG,MAAM,GAAG,IAAI,CAAC;gBAEf,MAAM,EAAE,+BAA+B;IAInD,IAAI,eAAe,IAAI,iCAAiC,GAAG,IAAI,CAE9D;CACF;AAED,qBAAa,kBAAmB,SAAQ,yBAAyB;IAC/D,EAAE,EAAG,MAAM,CAAC;IACZ,SAAS,EAAG,KAAK,GAAG,QAAQ,GAAG,IAAI,CAAC;gBAExB,MAAM,EAAE,wBAAwB;CAK7C;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,qBAAqB,GAAG,kBAAkB,CAWnF;AAED,wBAAgB,+CAA+C,CAAC,EAC9D,SAAS,EACT,UAAU,GACX,EAAE;IACD,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,GAAG,iCAAiC,GAAG,IAAI,CAM3C"}
@@ -0,0 +1,51 @@
1
+ import { intervalToDuration } from 'date-fns';
2
+ export class WorkflowRunAttemptSummary {
3
+ constructor(fields){
4
+ Object.assign(this, fields);
5
+ }
6
+ get displayDuration() {
7
+ return workflowRunAttemptDisplayDurationFromTimestamps(this);
8
+ }
9
+ }
10
+ export class WorkflowRunAttempt extends WorkflowRunAttemptSummary {
11
+ constructor(fields){
12
+ super(fields);
13
+ this.id = fields.id;
14
+ this.rerunMode = fields.rerunMode;
15
+ }
16
+ }
17
+ export function toWorkflowRunAttempt(dto) {
18
+ return new WorkflowRunAttempt({
19
+ id: dto.id,
20
+ workflowRunId: dto.workflow_run_id,
21
+ attempt: dto.attempt,
22
+ status: dto.status,
23
+ createdAt: dto.created_at,
24
+ startedAt: dto.started_at ?? null,
25
+ finishedAt: dto.finished_at ?? null,
26
+ rerunMode: dto.rerun_mode
27
+ });
28
+ }
29
+ export function workflowRunAttemptDisplayDurationFromTimestamps({ startedAt, finishedAt }) {
30
+ if (startedAt === null) return null;
31
+ if (finishedAt === null) return {
32
+ state: 'live',
33
+ fromIso: startedAt
34
+ };
35
+ const elapsed = durationBetween(startedAt, finishedAt);
36
+ return elapsed === null ? null : {
37
+ state: 'fixed',
38
+ elapsed
39
+ };
40
+ }
41
+ function durationBetween(from, to) {
42
+ const start = new Date(from);
43
+ const end = new Date(to);
44
+ if (!Number.isFinite(start.getTime()) || !Number.isFinite(end.getTime())) return null;
45
+ return intervalToDuration({
46
+ start,
47
+ end: end < start ? start : end
48
+ });
49
+ }
50
+
51
+ //# sourceMappingURL=workflow-run-attempt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/core/entities/workflow-run-attempt.ts"],"sourcesContent":["import type {WorkflowRunAttemptDto} from '@shipfox/api-workflows-dto';\nimport {type Duration, intervalToDuration} from 'date-fns';\nimport type {WorkflowRunStatus} from './workflow-run.js';\n\nexport type WorkflowRunAttemptDisplayDuration =\n | {state: 'fixed'; elapsed: Duration}\n | {state: 'live'; fromIso: string};\n\ninterface WorkflowRunAttemptSummaryFields {\n workflowRunId: string;\n attempt: number;\n status: WorkflowRunStatus;\n createdAt: string;\n startedAt: string | null;\n finishedAt: string | null;\n}\n\ninterface WorkflowRunAttemptFields extends WorkflowRunAttemptSummaryFields {\n id: string;\n rerunMode: 'all' | 'failed' | null;\n}\n\nexport class WorkflowRunAttemptSummary {\n workflowRunId!: string;\n attempt!: number;\n status!: WorkflowRunStatus;\n createdAt!: string;\n startedAt!: string | null;\n finishedAt!: string | null;\n\n constructor(fields: WorkflowRunAttemptSummaryFields) {\n Object.assign(this, fields);\n }\n\n get displayDuration(): WorkflowRunAttemptDisplayDuration | null {\n return workflowRunAttemptDisplayDurationFromTimestamps(this);\n }\n}\n\nexport class WorkflowRunAttempt extends WorkflowRunAttemptSummary {\n id!: string;\n rerunMode!: 'all' | 'failed' | null;\n\n constructor(fields: WorkflowRunAttemptFields) {\n super(fields);\n this.id = fields.id;\n this.rerunMode = fields.rerunMode;\n }\n}\n\nexport function toWorkflowRunAttempt(dto: WorkflowRunAttemptDto): WorkflowRunAttempt {\n return new WorkflowRunAttempt({\n id: dto.id,\n workflowRunId: dto.workflow_run_id,\n attempt: dto.attempt,\n status: dto.status,\n createdAt: dto.created_at,\n startedAt: dto.started_at ?? null,\n finishedAt: dto.finished_at ?? null,\n rerunMode: dto.rerun_mode,\n });\n}\n\nexport function workflowRunAttemptDisplayDurationFromTimestamps({\n startedAt,\n finishedAt,\n}: {\n startedAt: string | null;\n finishedAt: string | null;\n}): WorkflowRunAttemptDisplayDuration | null {\n if (startedAt === null) return null;\n if (finishedAt === null) return {state: 'live', fromIso: startedAt};\n\n const elapsed = durationBetween(startedAt, finishedAt);\n return elapsed === null ? null : {state: 'fixed', elapsed};\n}\n\nfunction durationBetween(from: string, to: string): Duration | null {\n const start = new Date(from);\n const end = new Date(to);\n if (!Number.isFinite(start.getTime()) || !Number.isFinite(end.getTime())) return null;\n\n return intervalToDuration({\n start,\n end: end < start ? start : end,\n });\n}\n"],"names":["intervalToDuration","WorkflowRunAttemptSummary","fields","Object","assign","displayDuration","workflowRunAttemptDisplayDurationFromTimestamps","WorkflowRunAttempt","id","rerunMode","toWorkflowRunAttempt","dto","workflowRunId","workflow_run_id","attempt","status","createdAt","created_at","startedAt","started_at","finishedAt","finished_at","rerun_mode","state","fromIso","elapsed","durationBetween","from","to","start","Date","end","Number","isFinite","getTime"],"mappings":"AACA,SAAuBA,kBAAkB,QAAO,WAAW;AAqB3D,OAAO,MAAMC;IAQX,YAAYC,MAAuC,CAAE;QACnDC,OAAOC,MAAM,CAAC,IAAI,EAAEF;IACtB;IAEA,IAAIG,kBAA4D;QAC9D,OAAOC,gDAAgD,IAAI;IAC7D;AACF;AAEA,OAAO,MAAMC,2BAA2BN;IAItC,YAAYC,MAAgC,CAAE;QAC5C,KAAK,CAACA;QACN,IAAI,CAACM,EAAE,GAAGN,OAAOM,EAAE;QACnB,IAAI,CAACC,SAAS,GAAGP,OAAOO,SAAS;IACnC;AACF;AAEA,OAAO,SAASC,qBAAqBC,GAA0B;IAC7D,OAAO,IAAIJ,mBAAmB;QAC5BC,IAAIG,IAAIH,EAAE;QACVI,eAAeD,IAAIE,eAAe;QAClCC,SAASH,IAAIG,OAAO;QACpBC,QAAQJ,IAAII,MAAM;QAClBC,WAAWL,IAAIM,UAAU;QACzBC,WAAWP,IAAIQ,UAAU,IAAI;QAC7BC,YAAYT,IAAIU,WAAW,IAAI;QAC/BZ,WAAWE,IAAIW,UAAU;IAC3B;AACF;AAEA,OAAO,SAAShB,gDAAgD,EAC9DY,SAAS,EACTE,UAAU,EAIX;IACC,IAAIF,cAAc,MAAM,OAAO;IAC/B,IAAIE,eAAe,MAAM,OAAO;QAACG,OAAO;QAAQC,SAASN;IAAS;IAElE,MAAMO,UAAUC,gBAAgBR,WAAWE;IAC3C,OAAOK,YAAY,OAAO,OAAO;QAACF,OAAO;QAASE;IAAO;AAC3D;AAEA,SAASC,gBAAgBC,IAAY,EAAEC,EAAU;IAC/C,MAAMC,QAAQ,IAAIC,KAAKH;IACvB,MAAMI,MAAM,IAAID,KAAKF;IACrB,IAAI,CAACI,OAAOC,QAAQ,CAACJ,MAAMK,OAAO,OAAO,CAACF,OAAOC,QAAQ,CAACF,IAAIG,OAAO,KAAK,OAAO;IAEjF,OAAOlC,mBAAmB;QACxB6B;QACAE,KAAKA,MAAMF,QAAQA,QAAQE;IAC7B;AACF"}
@@ -0,0 +1,61 @@
1
+ import type { WorkflowRunDetailResponseDto, WorkflowRunListResponseDto, WorkflowRunResponseDto, WorkflowRunStatusDto } from '@shipfox/api-workflows-dto';
2
+ import { type Job, WORKFLOW_JOB_STATUSES } from './job.js';
3
+ import { type WorkflowRunAttempt, WorkflowRunAttemptSummary } from './workflow-run-attempt.js';
4
+ export type WorkflowRunStatus = WorkflowRunStatusDto;
5
+ export type WorkflowStatus = WorkflowRunStatus | (typeof WORKFLOW_JOB_STATUSES)[number];
6
+ export declare const WORKFLOW_RUN_STATUSES: readonly ["pending", "running", "succeeded", "failed", "cancelled"];
7
+ export declare const TERMINAL_WORKFLOW_RUN_STATUSES: readonly ["succeeded", "failed", "cancelled"];
8
+ export interface WorkflowSourceSnapshot {
9
+ content: string;
10
+ format: 'yaml';
11
+ }
12
+ export interface WorkflowRun {
13
+ id: string;
14
+ projectId: string;
15
+ definitionId: string;
16
+ name: string;
17
+ currentAttempt: number;
18
+ triggerProvider: string | null;
19
+ triggerSource: string;
20
+ triggerEvent: string;
21
+ triggerDisplayLabel: string;
22
+ triggerLabel: string;
23
+ triggerPayload: Record<string, unknown>;
24
+ inputs: Record<string, unknown> | null;
25
+ sourceSnapshot: WorkflowSourceSnapshot | null;
26
+ createdAt: string;
27
+ updatedAt: string;
28
+ shortId: string;
29
+ isTemporary: boolean;
30
+ }
31
+ export interface WorkflowRunListItem extends WorkflowRun {
32
+ status: WorkflowRunStatus;
33
+ latestAttempt: number;
34
+ runAttempt: WorkflowRunAttemptSummary;
35
+ }
36
+ export interface WorkflowRunDetail extends WorkflowRun {
37
+ latestAttempt: number;
38
+ runAttempt: WorkflowRunAttempt;
39
+ jobs: Job[];
40
+ }
41
+ export interface WorkflowRunListPage {
42
+ runs: WorkflowRunListItem[];
43
+ nextCursor: string | null;
44
+ filteredTotalCount: number | null;
45
+ }
46
+ export declare function workflowRunShortId(id: string): string;
47
+ export declare function workflowRunTriggerLabel({ triggerSource, triggerEvent, }: {
48
+ triggerSource: string;
49
+ triggerEvent: string;
50
+ }): string;
51
+ export declare function workflowRunTriggerDisplayLabel({ triggerSource, triggerEvent, }: {
52
+ triggerSource: string;
53
+ triggerEvent: string;
54
+ }): string;
55
+ export declare function isWorkflowRunTerminal(status: WorkflowRunStatus): boolean;
56
+ export declare function isWorkflowStatus(status: string): status is WorkflowStatus;
57
+ export declare function toWorkflowRun(dto: WorkflowRunResponseDto): WorkflowRun;
58
+ export declare function toWorkflowRunListItem(dto: WorkflowRunResponseDto): WorkflowRunListItem;
59
+ export declare function toWorkflowRunDetail(dto: WorkflowRunDetailResponseDto): WorkflowRunDetail;
60
+ export declare function toWorkflowRunListPage(dto: WorkflowRunListResponseDto): WorkflowRunListPage;
61
+ //# sourceMappingURL=workflow-run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-run.d.ts","sourceRoot":"","sources":["../../../src/core/entities/workflow-run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,4BAA4B,EAC5B,0BAA0B,EAC1B,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAC,KAAK,GAAG,EAAS,qBAAqB,EAAC,MAAM,UAAU,CAAC;AAChE,OAAO,EAEL,KAAK,kBAAkB,EACvB,yBAAyB,EAC1B,MAAM,2BAA2B,CAAC;AAEnC,MAAM,MAAM,iBAAiB,GAAG,oBAAoB,CAAC;AACrD,MAAM,MAAM,cAAc,GAAG,iBAAiB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAExF,eAAO,MAAM,qBAAqB,qEAMe,CAAC;AAElD,eAAO,MAAM,8BAA8B,+CAIM,CAAC;AAQlD,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACvC,cAAc,EAAE,sBAAsB,GAAG,IAAI,CAAC;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACtD,MAAM,EAAE,iBAAiB,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,yBAAyB,CAAC;CACvC;AAED,MAAM,WAAW,iBAAkB,SAAQ,WAAW;IACpD,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,kBAAkB,CAAC;IAC/B,IAAI,EAAE,GAAG,EAAE,CAAC;CACb;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,mBAAmB,EAAE,CAAC;IAC5B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC;AAED,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,wBAAgB,uBAAuB,CAAC,EACtC,aAAa,EACb,YAAY,GACb,EAAE;IACD,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;CACtB,GAAG,MAAM,CAET;AAED,wBAAgB,8BAA8B,CAAC,EAC7C,aAAa,EACb,YAAY,GACb,EAAE;IACD,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;CACtB,GAAG,MAAM,CAET;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAExE;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,IAAI,cAAc,CAEzE;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,sBAAsB,GAAG,WAAW,CA6BtE;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,sBAAsB,GAAG,mBAAmB,CActF;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,4BAA4B,GAAG,iBAAiB,CAOxF;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,0BAA0B,GAAG,mBAAmB,CAM1F"}
@@ -0,0 +1,104 @@
1
+ import { toJob, WORKFLOW_JOB_STATUSES } from './job.js';
2
+ import { toWorkflowRunAttempt, WorkflowRunAttemptSummary } from './workflow-run-attempt.js';
3
+ export const WORKFLOW_RUN_STATUSES = [
4
+ 'pending',
5
+ 'running',
6
+ 'succeeded',
7
+ 'failed',
8
+ 'cancelled'
9
+ ];
10
+ export const TERMINAL_WORKFLOW_RUN_STATUSES = [
11
+ 'succeeded',
12
+ 'failed',
13
+ 'cancelled'
14
+ ];
15
+ const WORKFLOW_STATUSES = new Set([
16
+ ...WORKFLOW_RUN_STATUSES,
17
+ ...WORKFLOW_JOB_STATUSES
18
+ ]);
19
+ const TERMINAL_WORKFLOW_RUN_STATUS_SET = new Set(TERMINAL_WORKFLOW_RUN_STATUSES);
20
+ export function workflowRunShortId(id) {
21
+ return id.length <= 8 ? id : id.slice(0, 8);
22
+ }
23
+ export function workflowRunTriggerLabel({ triggerSource, triggerEvent }) {
24
+ return [
25
+ triggerSource,
26
+ triggerEvent
27
+ ].filter(Boolean).join(' · ');
28
+ }
29
+ export function workflowRunTriggerDisplayLabel({ triggerSource, triggerEvent }) {
30
+ return triggerEvent || triggerSource;
31
+ }
32
+ export function isWorkflowRunTerminal(status) {
33
+ return TERMINAL_WORKFLOW_RUN_STATUS_SET.has(status);
34
+ }
35
+ export function isWorkflowStatus(status) {
36
+ return WORKFLOW_STATUSES.has(status);
37
+ }
38
+ export function toWorkflowRun(dto) {
39
+ const triggerLabel = workflowRunTriggerLabel({
40
+ triggerSource: dto.trigger_source,
41
+ triggerEvent: dto.trigger_event
42
+ });
43
+ const triggerDisplayLabel = workflowRunTriggerDisplayLabel({
44
+ triggerSource: dto.trigger_source,
45
+ triggerEvent: dto.trigger_event
46
+ });
47
+ return {
48
+ id: dto.id,
49
+ projectId: dto.project_id,
50
+ definitionId: dto.definition_id,
51
+ name: dto.name,
52
+ currentAttempt: dto.current_attempt,
53
+ triggerProvider: dto.trigger_provider,
54
+ triggerSource: dto.trigger_source,
55
+ triggerEvent: dto.trigger_event,
56
+ triggerDisplayLabel,
57
+ triggerLabel,
58
+ triggerPayload: dto.trigger_payload,
59
+ inputs: dto.inputs ?? null,
60
+ sourceSnapshot: dto.source_snapshot ? toWorkflowSourceSnapshot(dto.source_snapshot) : null,
61
+ createdAt: dto.created_at,
62
+ updatedAt: dto.updated_at,
63
+ shortId: workflowRunShortId(dto.id),
64
+ isTemporary: dto.id.startsWith('temp-')
65
+ };
66
+ }
67
+ export function toWorkflowRunListItem(dto) {
68
+ return {
69
+ ...toWorkflowRun(dto),
70
+ status: dto.status,
71
+ latestAttempt: dto.latest_attempt,
72
+ runAttempt: new WorkflowRunAttemptSummary({
73
+ workflowRunId: dto.id,
74
+ attempt: dto.current_attempt,
75
+ status: dto.status,
76
+ createdAt: dto.created_at,
77
+ startedAt: dto.started_at ?? null,
78
+ finishedAt: dto.finished_at ?? null
79
+ })
80
+ };
81
+ }
82
+ export function toWorkflowRunDetail(dto) {
83
+ return {
84
+ ...toWorkflowRun(dto),
85
+ latestAttempt: dto.latest_attempt,
86
+ runAttempt: toWorkflowRunAttempt(dto.run_attempt),
87
+ jobs: dto.jobs.map(toJob)
88
+ };
89
+ }
90
+ export function toWorkflowRunListPage(dto) {
91
+ return {
92
+ runs: dto.runs.map(toWorkflowRunListItem),
93
+ nextCursor: dto.next_cursor,
94
+ filteredTotalCount: dto.filtered_total_count
95
+ };
96
+ }
97
+ function toWorkflowSourceSnapshot(dto) {
98
+ return {
99
+ content: dto.content,
100
+ format: dto.format
101
+ };
102
+ }
103
+
104
+ //# sourceMappingURL=workflow-run.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/core/entities/workflow-run.ts"],"sourcesContent":["import type {\n WorkflowRunDetailResponseDto,\n WorkflowRunListResponseDto,\n WorkflowRunResponseDto,\n WorkflowRunStatusDto,\n} from '@shipfox/api-workflows-dto';\nimport {type Job, toJob, WORKFLOW_JOB_STATUSES} from './job.js';\nimport {\n toWorkflowRunAttempt,\n type WorkflowRunAttempt,\n WorkflowRunAttemptSummary,\n} from './workflow-run-attempt.js';\n\nexport type WorkflowRunStatus = WorkflowRunStatusDto;\nexport type WorkflowStatus = WorkflowRunStatus | (typeof WORKFLOW_JOB_STATUSES)[number];\n\nexport const WORKFLOW_RUN_STATUSES = [\n 'pending',\n 'running',\n 'succeeded',\n 'failed',\n 'cancelled',\n] as const satisfies readonly WorkflowRunStatus[];\n\nexport const TERMINAL_WORKFLOW_RUN_STATUSES = [\n 'succeeded',\n 'failed',\n 'cancelled',\n] as const satisfies readonly WorkflowRunStatus[];\n\nconst WORKFLOW_STATUSES = new Set<WorkflowStatus>([\n ...WORKFLOW_RUN_STATUSES,\n ...WORKFLOW_JOB_STATUSES,\n]);\nconst TERMINAL_WORKFLOW_RUN_STATUS_SET = new Set<WorkflowRunStatus>(TERMINAL_WORKFLOW_RUN_STATUSES);\n\nexport interface WorkflowSourceSnapshot {\n content: string;\n format: 'yaml';\n}\n\nexport interface WorkflowRun {\n id: string;\n projectId: string;\n definitionId: string;\n name: string;\n currentAttempt: number;\n triggerProvider: string | null;\n triggerSource: string;\n triggerEvent: string;\n triggerDisplayLabel: string;\n triggerLabel: string;\n triggerPayload: Record<string, unknown>;\n inputs: Record<string, unknown> | null;\n sourceSnapshot: WorkflowSourceSnapshot | null;\n createdAt: string;\n updatedAt: string;\n shortId: string;\n isTemporary: boolean;\n}\n\nexport interface WorkflowRunListItem extends WorkflowRun {\n status: WorkflowRunStatus;\n latestAttempt: number;\n runAttempt: WorkflowRunAttemptSummary;\n}\n\nexport interface WorkflowRunDetail extends WorkflowRun {\n latestAttempt: number;\n runAttempt: WorkflowRunAttempt;\n jobs: Job[];\n}\n\nexport interface WorkflowRunListPage {\n runs: WorkflowRunListItem[];\n nextCursor: string | null;\n filteredTotalCount: number | null;\n}\n\nexport function workflowRunShortId(id: string): string {\n return id.length <= 8 ? id : id.slice(0, 8);\n}\n\nexport function workflowRunTriggerLabel({\n triggerSource,\n triggerEvent,\n}: {\n triggerSource: string;\n triggerEvent: string;\n}): string {\n return [triggerSource, triggerEvent].filter(Boolean).join(' · ');\n}\n\nexport function workflowRunTriggerDisplayLabel({\n triggerSource,\n triggerEvent,\n}: {\n triggerSource: string;\n triggerEvent: string;\n}): string {\n return triggerEvent || triggerSource;\n}\n\nexport function isWorkflowRunTerminal(status: WorkflowRunStatus): boolean {\n return TERMINAL_WORKFLOW_RUN_STATUS_SET.has(status);\n}\n\nexport function isWorkflowStatus(status: string): status is WorkflowStatus {\n return WORKFLOW_STATUSES.has(status as WorkflowStatus);\n}\n\nexport function toWorkflowRun(dto: WorkflowRunResponseDto): WorkflowRun {\n const triggerLabel = workflowRunTriggerLabel({\n triggerSource: dto.trigger_source,\n triggerEvent: dto.trigger_event,\n });\n const triggerDisplayLabel = workflowRunTriggerDisplayLabel({\n triggerSource: dto.trigger_source,\n triggerEvent: dto.trigger_event,\n });\n\n return {\n id: dto.id,\n projectId: dto.project_id,\n definitionId: dto.definition_id,\n name: dto.name,\n currentAttempt: dto.current_attempt,\n triggerProvider: dto.trigger_provider,\n triggerSource: dto.trigger_source,\n triggerEvent: dto.trigger_event,\n triggerDisplayLabel,\n triggerLabel,\n triggerPayload: dto.trigger_payload,\n inputs: dto.inputs ?? null,\n sourceSnapshot: dto.source_snapshot ? toWorkflowSourceSnapshot(dto.source_snapshot) : null,\n createdAt: dto.created_at,\n updatedAt: dto.updated_at,\n shortId: workflowRunShortId(dto.id),\n isTemporary: dto.id.startsWith('temp-'),\n };\n}\n\nexport function toWorkflowRunListItem(dto: WorkflowRunResponseDto): WorkflowRunListItem {\n return {\n ...toWorkflowRun(dto),\n status: dto.status,\n latestAttempt: dto.latest_attempt,\n runAttempt: new WorkflowRunAttemptSummary({\n workflowRunId: dto.id,\n attempt: dto.current_attempt,\n status: dto.status,\n createdAt: dto.created_at,\n startedAt: dto.started_at ?? null,\n finishedAt: dto.finished_at ?? null,\n }),\n };\n}\n\nexport function toWorkflowRunDetail(dto: WorkflowRunDetailResponseDto): WorkflowRunDetail {\n return {\n ...toWorkflowRun(dto),\n latestAttempt: dto.latest_attempt,\n runAttempt: toWorkflowRunAttempt(dto.run_attempt),\n jobs: dto.jobs.map(toJob),\n };\n}\n\nexport function toWorkflowRunListPage(dto: WorkflowRunListResponseDto): WorkflowRunListPage {\n return {\n runs: dto.runs.map(toWorkflowRunListItem),\n nextCursor: dto.next_cursor,\n filteredTotalCount: dto.filtered_total_count,\n };\n}\n\nfunction toWorkflowSourceSnapshot(\n dto: NonNullable<WorkflowRunResponseDto['source_snapshot']>,\n): WorkflowSourceSnapshot {\n return {\n content: dto.content,\n format: dto.format,\n };\n}\n"],"names":["toJob","WORKFLOW_JOB_STATUSES","toWorkflowRunAttempt","WorkflowRunAttemptSummary","WORKFLOW_RUN_STATUSES","TERMINAL_WORKFLOW_RUN_STATUSES","WORKFLOW_STATUSES","Set","TERMINAL_WORKFLOW_RUN_STATUS_SET","workflowRunShortId","id","length","slice","workflowRunTriggerLabel","triggerSource","triggerEvent","filter","Boolean","join","workflowRunTriggerDisplayLabel","isWorkflowRunTerminal","status","has","isWorkflowStatus","toWorkflowRun","dto","triggerLabel","trigger_source","trigger_event","triggerDisplayLabel","projectId","project_id","definitionId","definition_id","name","currentAttempt","current_attempt","triggerProvider","trigger_provider","triggerPayload","trigger_payload","inputs","sourceSnapshot","source_snapshot","toWorkflowSourceSnapshot","createdAt","created_at","updatedAt","updated_at","shortId","isTemporary","startsWith","toWorkflowRunListItem","latestAttempt","latest_attempt","runAttempt","workflowRunId","attempt","startedAt","started_at","finishedAt","finished_at","toWorkflowRunDetail","run_attempt","jobs","map","toWorkflowRunListPage","runs","nextCursor","next_cursor","filteredTotalCount","filtered_total_count","content","format"],"mappings":"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"}
@@ -0,0 +1,13 @@
1
+ export interface WorkflowRunSelectionInput {
2
+ jobId?: string | undefined;
3
+ jobExecutionId?: string | undefined;
4
+ stepId?: string | undefined;
5
+ stepAttemptId?: string | undefined;
6
+ runAttempt?: number | undefined;
7
+ }
8
+ type WorkflowRunSearch = Record<string, unknown>;
9
+ export declare function workflowRunSelectionFromSearch(search: WorkflowRunSearch): WorkflowRunSelectionInput;
10
+ export declare function withWorkflowRunSelectionSearch<TSearch extends WorkflowRunSearch>(search: TSearch, selection: WorkflowRunSelectionInput): TSearch;
11
+ export declare function withoutWorkflowRunSelectionSearch<TSearch extends WorkflowRunSearch>(search: TSearch): TSearch;
12
+ export {};
13
+ //# sourceMappingURL=workflow-run-url-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-run-url-state.d.ts","sourceRoot":"","sources":["../../src/core/workflow-run-url-state.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,yBAAyB;IACxC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACjC;AAUD,KAAK,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEjD,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,iBAAiB,GACxB,yBAAyB,CAQ3B;AAED,wBAAgB,8BAA8B,CAAC,OAAO,SAAS,iBAAiB,EAC9E,MAAM,EAAE,OAAO,EACf,SAAS,EAAE,yBAAyB,GACnC,OAAO,CAQT;AAED,wBAAgB,iCAAiC,CAAC,OAAO,SAAS,iBAAiB,EACjF,MAAM,EAAE,OAAO,GACd,OAAO,CAMT"}
@@ -0,0 +1,43 @@
1
+ const WORKFLOW_RUN_URL_SELECTION_KEYS = [
2
+ 'job',
3
+ 'jobExecution',
4
+ 'step',
5
+ 'stepAttempt',
6
+ 'runAttempt'
7
+ ];
8
+ export function workflowRunSelectionFromSearch(search) {
9
+ return {
10
+ jobId: stringSearchParam(search.job),
11
+ jobExecutionId: stringSearchParam(search.jobExecution),
12
+ stepId: stringSearchParam(search.step),
13
+ stepAttemptId: stringSearchParam(search.stepAttempt),
14
+ runAttempt: positiveIntegerSearchParam(search.runAttempt)
15
+ };
16
+ }
17
+ export function withWorkflowRunSelectionSearch(search, selection) {
18
+ const nextSearch = withoutWorkflowRunSelectionSearch(search);
19
+ if (selection.jobId) nextSearch.job = selection.jobId;
20
+ if (selection.jobExecutionId) nextSearch.jobExecution = selection.jobExecutionId;
21
+ if (selection.stepId) nextSearch.step = selection.stepId;
22
+ if (selection.stepAttemptId) nextSearch.stepAttempt = selection.stepAttemptId;
23
+ if (selection.runAttempt) nextSearch.runAttempt = String(selection.runAttempt);
24
+ return nextSearch;
25
+ }
26
+ export function withoutWorkflowRunSelectionSearch(search) {
27
+ const nextSearch = {
28
+ ...search
29
+ };
30
+ for (const key of WORKFLOW_RUN_URL_SELECTION_KEYS){
31
+ delete nextSearch[key];
32
+ }
33
+ return nextSearch;
34
+ }
35
+ function stringSearchParam(value) {
36
+ return typeof value === 'string' && value.length > 0 ? value : undefined;
37
+ }
38
+ function positiveIntegerSearchParam(value) {
39
+ const raw = typeof value === 'string' ? Number(value) : value;
40
+ return typeof raw === 'number' && Number.isInteger(raw) && raw > 0 ? raw : undefined;
41
+ }
42
+
43
+ //# sourceMappingURL=workflow-run-url-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/core/workflow-run-url-state.ts"],"sourcesContent":["export interface WorkflowRunSelectionInput {\n jobId?: string | undefined;\n jobExecutionId?: string | undefined;\n stepId?: string | undefined;\n stepAttemptId?: string | undefined;\n runAttempt?: number | undefined;\n}\n\nconst WORKFLOW_RUN_URL_SELECTION_KEYS = [\n 'job',\n 'jobExecution',\n 'step',\n 'stepAttempt',\n 'runAttempt',\n] as const;\n\ntype WorkflowRunSearch = Record<string, unknown>;\n\nexport function workflowRunSelectionFromSearch(\n search: WorkflowRunSearch,\n): WorkflowRunSelectionInput {\n return {\n jobId: stringSearchParam(search.job),\n jobExecutionId: stringSearchParam(search.jobExecution),\n stepId: stringSearchParam(search.step),\n stepAttemptId: stringSearchParam(search.stepAttempt),\n runAttempt: positiveIntegerSearchParam(search.runAttempt),\n };\n}\n\nexport function withWorkflowRunSelectionSearch<TSearch extends WorkflowRunSearch>(\n search: TSearch,\n selection: WorkflowRunSelectionInput,\n): TSearch {\n const nextSearch: WorkflowRunSearch = withoutWorkflowRunSelectionSearch(search);\n if (selection.jobId) nextSearch.job = selection.jobId;\n if (selection.jobExecutionId) nextSearch.jobExecution = selection.jobExecutionId;\n if (selection.stepId) nextSearch.step = selection.stepId;\n if (selection.stepAttemptId) nextSearch.stepAttempt = selection.stepAttemptId;\n if (selection.runAttempt) nextSearch.runAttempt = String(selection.runAttempt);\n return nextSearch as TSearch;\n}\n\nexport function withoutWorkflowRunSelectionSearch<TSearch extends WorkflowRunSearch>(\n search: TSearch,\n): TSearch {\n const nextSearch: WorkflowRunSearch = {...search};\n for (const key of WORKFLOW_RUN_URL_SELECTION_KEYS) {\n delete nextSearch[key];\n }\n return nextSearch as TSearch;\n}\n\nfunction stringSearchParam(value: unknown): string | undefined {\n return typeof value === 'string' && value.length > 0 ? value : undefined;\n}\n\nfunction positiveIntegerSearchParam(value: unknown): number | undefined {\n const raw = typeof value === 'string' ? Number(value) : value;\n return typeof raw === 'number' && Number.isInteger(raw) && raw > 0 ? raw : undefined;\n}\n"],"names":["WORKFLOW_RUN_URL_SELECTION_KEYS","workflowRunSelectionFromSearch","search","jobId","stringSearchParam","job","jobExecutionId","jobExecution","stepId","step","stepAttemptId","stepAttempt","runAttempt","positiveIntegerSearchParam","withWorkflowRunSelectionSearch","selection","nextSearch","withoutWorkflowRunSelectionSearch","String","key","value","length","undefined","raw","Number","isInteger"],"mappings":"AAQA,MAAMA,kCAAkC;IACtC;IACA;IACA;IACA;IACA;CACD;AAID,OAAO,SAASC,+BACdC,MAAyB;IAEzB,OAAO;QACLC,OAAOC,kBAAkBF,OAAOG,GAAG;QACnCC,gBAAgBF,kBAAkBF,OAAOK,YAAY;QACrDC,QAAQJ,kBAAkBF,OAAOO,IAAI;QACrCC,eAAeN,kBAAkBF,OAAOS,WAAW;QACnDC,YAAYC,2BAA2BX,OAAOU,UAAU;IAC1D;AACF;AAEA,OAAO,SAASE,+BACdZ,MAAe,EACfa,SAAoC;IAEpC,MAAMC,aAAgCC,kCAAkCf;IACxE,IAAIa,UAAUZ,KAAK,EAAEa,WAAWX,GAAG,GAAGU,UAAUZ,KAAK;IACrD,IAAIY,UAAUT,cAAc,EAAEU,WAAWT,YAAY,GAAGQ,UAAUT,cAAc;IAChF,IAAIS,UAAUP,MAAM,EAAEQ,WAAWP,IAAI,GAAGM,UAAUP,MAAM;IACxD,IAAIO,UAAUL,aAAa,EAAEM,WAAWL,WAAW,GAAGI,UAAUL,aAAa;IAC7E,IAAIK,UAAUH,UAAU,EAAEI,WAAWJ,UAAU,GAAGM,OAAOH,UAAUH,UAAU;IAC7E,OAAOI;AACT;AAEA,OAAO,SAASC,kCACdf,MAAe;IAEf,MAAMc,aAAgC;QAAC,GAAGd,MAAM;IAAA;IAChD,KAAK,MAAMiB,OAAOnB,gCAAiC;QACjD,OAAOgB,UAAU,CAACG,IAAI;IACxB;IACA,OAAOH;AACT;AAEA,SAASZ,kBAAkBgB,KAAc;IACvC,OAAO,OAAOA,UAAU,YAAYA,MAAMC,MAAM,GAAG,IAAID,QAAQE;AACjE;AAEA,SAAST,2BAA2BO,KAAc;IAChD,MAAMG,MAAM,OAAOH,UAAU,WAAWI,OAAOJ,SAASA;IACxD,OAAO,OAAOG,QAAQ,YAAYC,OAAOC,SAAS,CAACF,QAAQA,MAAM,IAAIA,MAAMD;AAC7E"}
@@ -0,0 +1,13 @@
1
+ export type { JobDisplayDuration, JobMode, JobStatus, JobStatusReason, ListenerStatus, ResolutionReason, } from './entities/job.js';
2
+ export { defaultJobExecution, isTerminalJobStatus, Job, resolveJobExecution, TERMINAL_WORKFLOW_JOB_STATUSES, toJob, WORKFLOW_JOB_STATUSES, } from './entities/job.js';
3
+ export type { JobExecutionDisplayDuration, JobExecutionStatus, JobExecutionTime, } from './entities/job-execution.js';
4
+ export { JobExecution, toJobExecution } from './entities/job-execution.js';
5
+ export type { AgentConfigIssue, AgentStepConfig, Step, StepError, StepErrorCategory, StepErrorReason, StepSourceLocation, } from './entities/step.js';
6
+ export { toStep } from './entities/step.js';
7
+ export type { StepAttemptDisplayDuration, StepGateResult, } from './entities/step-attempt.js';
8
+ export { StepAttempt, toStepAttempt } from './entities/step-attempt.js';
9
+ export type { WorkflowRun, WorkflowRunDetail, WorkflowRunListItem, WorkflowRunListPage, WorkflowRunStatus, WorkflowSourceSnapshot, WorkflowStatus, } from './entities/workflow-run.js';
10
+ export { isWorkflowRunTerminal, isWorkflowStatus, TERMINAL_WORKFLOW_RUN_STATUSES, toWorkflowRun, toWorkflowRunDetail, toWorkflowRunListItem, toWorkflowRunListPage, WORKFLOW_RUN_STATUSES, workflowRunShortId, workflowRunTriggerDisplayLabel, workflowRunTriggerLabel, } from './entities/workflow-run.js';
11
+ export type { WorkflowRunAttemptDisplayDuration } from './entities/workflow-run-attempt.js';
12
+ export { toWorkflowRunAttempt, WorkflowRunAttempt, WorkflowRunAttemptSummary, } from './entities/workflow-run-attempt.js';
13
+ //# sourceMappingURL=workflow-run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-run.d.ts","sourceRoot":"","sources":["../../src/core/workflow-run.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,kBAAkB,EAClB,OAAO,EACP,SAAS,EACT,eAAe,EACf,cAAc,EACd,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,GAAG,EACH,mBAAmB,EACnB,8BAA8B,EAC9B,KAAK,EACL,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,2BAA2B,EAC3B,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAC,YAAY,EAAE,cAAc,EAAC,MAAM,6BAA6B,CAAC;AACzE,YAAY,EACV,gBAAgB,EAChB,eAAe,EACf,IAAI,EACJ,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,kBAAkB,GACnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAC,MAAM,EAAC,MAAM,oBAAoB,CAAC;AAC1C,YAAY,EACV,0BAA0B,EAC1B,cAAc,GACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAC,WAAW,EAAE,aAAa,EAAC,MAAM,4BAA4B,CAAC;AACtE,YAAY,EACV,WAAW,EACX,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,sBAAsB,EACtB,cAAc,GACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,8BAA8B,EAC9B,aAAa,EACb,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,8BAA8B,EAC9B,uBAAuB,GACxB,MAAM,4BAA4B,CAAC;AACpC,YAAY,EAAC,iCAAiC,EAAC,MAAM,oCAAoC,CAAC;AAC1F,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,yBAAyB,GAC1B,MAAM,oCAAoC,CAAC"}
@@ -0,0 +1,8 @@
1
+ export { defaultJobExecution, isTerminalJobStatus, Job, resolveJobExecution, TERMINAL_WORKFLOW_JOB_STATUSES, toJob, WORKFLOW_JOB_STATUSES } from './entities/job.js';
2
+ export { JobExecution, toJobExecution } from './entities/job-execution.js';
3
+ export { toStep } from './entities/step.js';
4
+ export { StepAttempt, toStepAttempt } from './entities/step-attempt.js';
5
+ export { isWorkflowRunTerminal, isWorkflowStatus, TERMINAL_WORKFLOW_RUN_STATUSES, toWorkflowRun, toWorkflowRunDetail, toWorkflowRunListItem, toWorkflowRunListPage, WORKFLOW_RUN_STATUSES, workflowRunShortId, workflowRunTriggerDisplayLabel, workflowRunTriggerLabel } from './entities/workflow-run.js';
6
+ export { toWorkflowRunAttempt, WorkflowRunAttempt, WorkflowRunAttemptSummary } from './entities/workflow-run-attempt.js';
7
+
8
+ //# sourceMappingURL=workflow-run.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/core/workflow-run.ts"],"sourcesContent":["export type {\n JobDisplayDuration,\n JobMode,\n JobStatus,\n JobStatusReason,\n ListenerStatus,\n ResolutionReason,\n} from './entities/job.js';\nexport {\n defaultJobExecution,\n isTerminalJobStatus,\n Job,\n resolveJobExecution,\n TERMINAL_WORKFLOW_JOB_STATUSES,\n toJob,\n WORKFLOW_JOB_STATUSES,\n} from './entities/job.js';\nexport type {\n JobExecutionDisplayDuration,\n JobExecutionStatus,\n JobExecutionTime,\n} from './entities/job-execution.js';\nexport {JobExecution, toJobExecution} from './entities/job-execution.js';\nexport type {\n AgentConfigIssue,\n AgentStepConfig,\n Step,\n StepError,\n StepErrorCategory,\n StepErrorReason,\n StepSourceLocation,\n} from './entities/step.js';\nexport {toStep} from './entities/step.js';\nexport type {\n StepAttemptDisplayDuration,\n StepGateResult,\n} from './entities/step-attempt.js';\nexport {StepAttempt, toStepAttempt} from './entities/step-attempt.js';\nexport type {\n WorkflowRun,\n WorkflowRunDetail,\n WorkflowRunListItem,\n WorkflowRunListPage,\n WorkflowRunStatus,\n WorkflowSourceSnapshot,\n WorkflowStatus,\n} from './entities/workflow-run.js';\nexport {\n isWorkflowRunTerminal,\n isWorkflowStatus,\n TERMINAL_WORKFLOW_RUN_STATUSES,\n toWorkflowRun,\n toWorkflowRunDetail,\n toWorkflowRunListItem,\n toWorkflowRunListPage,\n WORKFLOW_RUN_STATUSES,\n workflowRunShortId,\n workflowRunTriggerDisplayLabel,\n workflowRunTriggerLabel,\n} from './entities/workflow-run.js';\nexport type {WorkflowRunAttemptDisplayDuration} from './entities/workflow-run-attempt.js';\nexport {\n toWorkflowRunAttempt,\n WorkflowRunAttempt,\n WorkflowRunAttemptSummary,\n} from './entities/workflow-run-attempt.js';\n"],"names":["defaultJobExecution","isTerminalJobStatus","Job","resolveJobExecution","TERMINAL_WORKFLOW_JOB_STATUSES","toJob","WORKFLOW_JOB_STATUSES","JobExecution","toJobExecution","toStep","StepAttempt","toStepAttempt","isWorkflowRunTerminal","isWorkflowStatus","TERMINAL_WORKFLOW_RUN_STATUSES","toWorkflowRun","toWorkflowRunDetail","toWorkflowRunListItem","toWorkflowRunListPage","WORKFLOW_RUN_STATUSES","workflowRunShortId","workflowRunTriggerDisplayLabel","workflowRunTriggerLabel","toWorkflowRunAttempt","WorkflowRunAttempt","WorkflowRunAttemptSummary"],"mappings":"AAQA,SACEA,mBAAmB,EACnBC,mBAAmB,EACnBC,GAAG,EACHC,mBAAmB,EACnBC,8BAA8B,EAC9BC,KAAK,EACLC,qBAAqB,QAChB,oBAAoB;AAM3B,SAAQC,YAAY,EAAEC,cAAc,QAAO,8BAA8B;AAUzE,SAAQC,MAAM,QAAO,qBAAqB;AAK1C,SAAQC,WAAW,EAAEC,aAAa,QAAO,6BAA6B;AAUtE,SACEC,qBAAqB,EACrBC,gBAAgB,EAChBC,8BAA8B,EAC9BC,aAAa,EACbC,mBAAmB,EACnBC,qBAAqB,EACrBC,qBAAqB,EACrBC,qBAAqB,EACrBC,kBAAkB,EAClBC,8BAA8B,EAC9BC,uBAAuB,QAClB,6BAA6B;AAEpC,SACEC,oBAAoB,EACpBC,kBAAkB,EAClBC,yBAAyB,QACpB,qCAAqC"}
package/dist/env.d.js ADDED
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=env.d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/env.d.ts"],"names":[],"mappings":""}
@@ -0,0 +1,20 @@
1
+ export declare const workflowsFeature: {
2
+ readonly id: "shipfox.workflows";
3
+ readonly routes: readonly [{
4
+ readonly path: "/workspaces/$wid/projects/$pid/runs";
5
+ readonly parent: "projectLayout";
6
+ readonly impl: "@shipfox/client-workflows/routes/runs";
7
+ }, {
8
+ readonly path: "/workspaces/$wid/projects/$pid/runs/$workflowRunId";
9
+ readonly parent: "projectLayout";
10
+ readonly impl: "@shipfox/client-workflows/routes/run-detail";
11
+ }];
12
+ readonly navigation: readonly [{
13
+ readonly id: "nav.runs";
14
+ readonly scope: "project";
15
+ readonly label: "Runs";
16
+ readonly to: "/workspaces/$wid/projects/$pid/runs";
17
+ readonly order: 100;
18
+ }];
19
+ };
20
+ //# sourceMappingURL=feature.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feature.d.ts","sourceRoot":"","sources":["../src/feature.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;CAuB3B,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { defineClientFeature } from '@shipfox/client-shell';
2
+ export const workflowsFeature = defineClientFeature({
3
+ id: 'shipfox.workflows',
4
+ routes: [
5
+ {
6
+ path: '/workspaces/$wid/projects/$pid/runs',
7
+ parent: 'projectLayout',
8
+ impl: '@shipfox/client-workflows/routes/runs'
9
+ },
10
+ {
11
+ path: '/workspaces/$wid/projects/$pid/runs/$workflowRunId',
12
+ parent: 'projectLayout',
13
+ impl: '@shipfox/client-workflows/routes/run-detail'
14
+ }
15
+ ],
16
+ navigation: [
17
+ {
18
+ id: 'nav.runs',
19
+ scope: 'project',
20
+ label: 'Runs',
21
+ to: '/workspaces/$wid/projects/$pid/runs',
22
+ order: 100
23
+ }
24
+ ]
25
+ });
26
+
27
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/feature.ts"],"sourcesContent":["import {defineClientFeature} from '@shipfox/client-shell';\n\nexport const workflowsFeature = defineClientFeature({\n id: 'shipfox.workflows',\n routes: [\n {\n path: '/workspaces/$wid/projects/$pid/runs',\n parent: 'projectLayout',\n impl: '@shipfox/client-workflows/routes/runs',\n },\n {\n path: '/workspaces/$wid/projects/$pid/runs/$workflowRunId',\n parent: 'projectLayout',\n impl: '@shipfox/client-workflows/routes/run-detail',\n },\n ],\n navigation: [\n {\n id: 'nav.runs',\n scope: 'project',\n label: 'Runs',\n to: '/workspaces/$wid/projects/$pid/runs',\n order: 100,\n },\n ],\n});\n"],"names":["defineClientFeature","workflowsFeature","id","routes","path","parent","impl","navigation","scope","label","to","order"],"mappings":"AAAA,SAAQA,mBAAmB,QAAO,wBAAwB;AAE1D,OAAO,MAAMC,mBAAmBD,oBAAoB;IAClDE,IAAI;IACJC,QAAQ;QACN;YACEC,MAAM;YACNC,QAAQ;YACRC,MAAM;QACR;QACA;YACEF,MAAM;YACNC,QAAQ;YACRC,MAAM;QACR;KACD;IACDC,YAAY;QACV;YACEL,IAAI;YACJM,OAAO;YACPC,OAAO;YACPC,IAAI;YACJC,OAAO;QACT;KACD;AACH,GAAG"}