@shipfox/api-workflows 13.1.0 → 14.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 (76) hide show
  1. package/.turbo/turbo-build.log +4 -4
  2. package/CHANGELOG.md +31 -0
  3. package/README.md +12 -5
  4. package/dist/core/checkout.d.ts +4 -2
  5. package/dist/core/checkout.d.ts.map +1 -1
  6. package/dist/core/checkout.js +7 -2
  7. package/dist/core/checkout.js.map +1 -1
  8. package/dist/core/entities/job.d.ts +1 -1
  9. package/dist/core/entities/job.d.ts.map +1 -1
  10. package/dist/core/entities/job.js.map +1 -1
  11. package/dist/core/entities/workflow-run.d.ts +23 -4
  12. package/dist/core/entities/workflow-run.d.ts.map +1 -1
  13. package/dist/core/entities/workflow-run.js.map +1 -1
  14. package/dist/core/run-workflow.js +1 -1
  15. package/dist/core/run-workflow.js.map +1 -1
  16. package/dist/db/db.d.ts +72 -0
  17. package/dist/db/db.d.ts.map +1 -1
  18. package/dist/db/schema/workflow-runs.d.ts +45 -1
  19. package/dist/db/schema/workflow-runs.d.ts.map +1 -1
  20. package/dist/db/schema/workflow-runs.js +42 -1
  21. package/dist/db/schema/workflow-runs.js.map +1 -1
  22. package/dist/db/workflow-runs/jobs.d.ts +3 -1
  23. package/dist/db/workflow-runs/jobs.d.ts.map +1 -1
  24. package/dist/db/workflow-runs/jobs.js +12 -3
  25. package/dist/db/workflow-runs/jobs.js.map +1 -1
  26. package/dist/db/workflow-runs/queries.d.ts +3 -2
  27. package/dist/db/workflow-runs/queries.d.ts.map +1 -1
  28. package/dist/db/workflow-runs/queries.js +3 -0
  29. package/dist/db/workflow-runs/queries.js.map +1 -1
  30. package/dist/presentation/dto/workflow-run.d.ts.map +1 -1
  31. package/dist/presentation/dto/workflow-run.js +14 -0
  32. package/dist/presentation/dto/workflow-run.js.map +1 -1
  33. package/dist/presentation/routes/checkout-token.d.ts.map +1 -1
  34. package/dist/presentation/routes/checkout-token.js +2 -1
  35. package/dist/presentation/routes/checkout-token.js.map +1 -1
  36. package/dist/presentation/routes/get-run-aggregates.d.ts.map +1 -1
  37. package/dist/presentation/routes/get-run-aggregates.js +2 -1
  38. package/dist/presentation/routes/get-run-aggregates.js.map +1 -1
  39. package/dist/presentation/routes/leased-step.d.ts +3 -1
  40. package/dist/presentation/routes/leased-step.d.ts.map +1 -1
  41. package/dist/presentation/routes/leased-step.js +2 -1
  42. package/dist/presentation/routes/leased-step.js.map +1 -1
  43. package/dist/presentation/routes/list-runs.d.ts.map +1 -1
  44. package/dist/presentation/routes/list-runs.js +2 -1
  45. package/dist/presentation/routes/list-runs.js.map +1 -1
  46. package/dist/presentation/routes/project-access.d.ts +1 -0
  47. package/dist/presentation/routes/project-access.d.ts.map +1 -1
  48. package/dist/tsconfig.test.tsbuildinfo +1 -1
  49. package/drizzle/0004_dev_run_origin.sql +12 -0
  50. package/drizzle/meta/0004_snapshot.json +1773 -0
  51. package/drizzle/meta/_journal.json +7 -0
  52. package/package.json +10 -10
  53. package/src/core/checkout.test.ts +198 -1
  54. package/src/core/checkout.ts +18 -5
  55. package/src/core/entities/job.ts +1 -1
  56. package/src/core/entities/workflow-run.ts +22 -4
  57. package/src/core/job-transition/decide-job-activation.test.ts +2 -0
  58. package/src/core/run-workflow.test.ts +50 -1
  59. package/src/core/run-workflow.ts +1 -1
  60. package/src/core/workflow-run-creation.test.ts +2 -0
  61. package/src/db/job-listeners.test.ts +17 -0
  62. package/src/db/schema/workflow-runs.ts +58 -0
  63. package/src/db/workflow-runs/jobs.ts +17 -3
  64. package/src/db/workflow-runs/queries.ts +6 -1
  65. package/src/db/workflow-runs/run-create.test.ts +39 -0
  66. package/src/presentation/dto/workflow-run.ts +23 -1
  67. package/src/presentation/routes/checkout-token.test.ts +45 -0
  68. package/src/presentation/routes/checkout-token.ts +2 -1
  69. package/src/presentation/routes/get-run-aggregates.test.ts +56 -0
  70. package/src/presentation/routes/get-run-aggregates.ts +2 -0
  71. package/src/presentation/routes/get-step-secrets.test.ts +1 -0
  72. package/src/presentation/routes/leased-step.ts +7 -1
  73. package/src/presentation/routes/list-runs.test.ts +152 -0
  74. package/src/presentation/routes/list-runs.ts +2 -0
  75. package/test/factories/workflow-run.ts +2 -0
  76. package/tsconfig.build.tsbuildinfo +1 -1
@@ -1,6 +1,6 @@
1
1
  $ shipfox-swc && shipfox-temporal-bundle dist/temporal/workflows/index.js
2
- Successfully compiled: 123 files with swc (957.89ms)
3
- 2026-08-23T10:00:22.113Z [INFO] asset workflow-bundle-4d88ac6c229f6c77759a.js 3.31 MiB [emitted] [immutable] (name: main)
2
+ Successfully compiled: 123 files with swc (693.7ms)
3
+ 2026-08-23T20:26:54.178Z [INFO] asset workflow-bundle-4d88ac6c229f6c77759a.js 3.31 MiB [emitted] [immutable] (name: main)
4
4
  orphan modules 33.5 KiB [orphan] 21 modules
5
5
  runtime modules 1.13 KiB 5 modules
6
6
  modules by path ../../../node_modules/.pnpm/ 970 KiB 196 modules
@@ -16,6 +16,6 @@ optional modules 30 bytes [optional]
16
16
  __temporal_custom_payload_converter (ignored) 15 bytes [optional] [built] [code generated]
17
17
  __temporal_custom_failure_converter (ignored) 15 bytes [optional] [built] [code generated]
18
18
  ../../shared/node/temporal/dist/workflow-error-interceptor.js 1.21 KiB [built] [code generated]
19
- webpack 5.107.2 compiled successfully in 6768 ms
20
- 2026-08-23T10:00:22.146Z [INFO] Workflow bundle created { size: '3.31MB' }
19
+ webpack 5.107.2 compiled successfully in 6661 ms
20
+ 2026-08-23T20:26:54.197Z [INFO] Workflow bundle created { size: '3.31MB' }
21
21
  /home/runner/work/shipfox/shipfox/libs/api/workflows/dist/temporal/workflows/index.js: 3469609 bytes
package/CHANGELOG.md CHANGED
@@ -1,5 +1,36 @@
1
1
  # @shipfox/api-workflows
2
2
 
3
+ ## 14.0.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 4f30864: Trigger `event` is now optional end to end. An omitted event subscribes to every event from its source. Explicit events continue to work unchanged. Built-in manual and scheduled triggers use `fire` and `tick`, respectively.
8
+ - b766ee3: Adds `origin` and `dev_source` to workflow runs, with an `origin` facet on the run list and aggregates endpoints. Existing runs read as `synced`. Dev runs check out their pinned source commit by default, while same-project replay event commits retain precedence.
9
+
10
+ ### Patch Changes
11
+
12
+ - 110e8dd: Numbers workflow runs by the workflow lineage id, so runs of one workflow file share a single numbering sequence across definition revisions.
13
+ - 5e87483: Validates workflow run provenance (origin and dev_source) at the API boundary; database constraints now only enforce the origin/source relationship.
14
+ - Updated dependencies [c0fc35b]
15
+ - Updated dependencies [f7b3db8]
16
+ - Updated dependencies [69a92c4]
17
+ - Updated dependencies [09924ca]
18
+ - Updated dependencies [4f30864]
19
+ - Updated dependencies [18e9bad]
20
+ - Updated dependencies [a4df8d9]
21
+ - Updated dependencies [aeaa0de]
22
+ - Updated dependencies [c44641f]
23
+ - Updated dependencies [1b71a66]
24
+ - Updated dependencies [b766ee3]
25
+ - @shipfox/api-definitions-dto@14.0.0
26
+ - @shipfox/api-runners-dto@14.0.0
27
+ - @shipfox/api-agent-dto@14.0.0
28
+ - @shipfox/workflow-document@3.1.0
29
+ - @shipfox/api-workflows-dto@14.0.0
30
+ - @shipfox/api-integration-core-dto@14.0.0
31
+ - @shipfox/api-projects-dto@14.0.0
32
+ - @shipfox/expression@2.2.1
33
+
3
34
  ## 13.1.0
4
35
 
5
36
  ### Patch Changes
package/README.md CHANGED
@@ -65,11 +65,18 @@ display label and workflow expression value.
65
65
 
66
66
  ## Behavior Notes
67
67
 
68
- Run numbers are sequential within one workflow definition, start at `1`, and
69
- are unique for `(definition_id, number)`. The Workflows module allocates the
70
- number with a per-definition counter inside the run-creation transaction. It
71
- resolves trigger idempotency before allocation, so a duplicate delivery returns
72
- the original run without consuming another number.
68
+ Run numbers are sequential within one workflow lineage, start at `1`, and are
69
+ unique for `(definition_id, number)`. `workflow_runs.definition_id` carries the
70
+ workflow lineage id: a stable identity per `(project_id, config_path)` shared by
71
+ every definition row of one workflow file. Pathless manual definitions share one
72
+ project-scoped lineage because they have no config path. Runs of a file keep one
73
+ numbering sequence before and after the file merges. The column keeps its v1 name;
74
+ a rename is a separate cleanup. Legacy definition rows are reconciled when read
75
+ or synchronized; the schema migration only adds nullable lineage storage. The
76
+ Workflows module allocates the number with a per-lineage counter inside the
77
+ run-creation transaction. It resolves trigger
78
+ idempotency before allocation, so a duplicate delivery returns the original run
79
+ without consuming another number.
73
80
 
74
81
  Gaps are acceptable because the number is a label and monotonicity matters more
75
82
  than density. Counter rows stay after a definition is removed, and reruns create
@@ -1,12 +1,14 @@
1
1
  import type { IntegrationsModuleClient } from '@shipfox/api-integration-core-dto/inter-module';
2
2
  import type { ProjectsModuleClient } from '@shipfox/api-projects-dto/inter-module';
3
3
  import type { Step } from '#core/entities/step.js';
4
- import type { WorkflowRunTriggerReference } from '#core/entities/workflow-run.js';
5
- export declare function createStepCheckoutSpec({ step, workspaceId, projectId, triggerReference, integrations, projects, }: {
4
+ import type { WorkflowRunOriginState, WorkflowRunTriggerReference } from '#core/entities/workflow-run.js';
5
+ export declare function createStepCheckoutSpec({ step, workspaceId, projectId, triggerReference, run, integrations, projects, }: {
6
6
  step: Step;
7
7
  workspaceId: string;
8
8
  projectId: string;
9
9
  triggerReference?: WorkflowRunTriggerReference | null | undefined;
10
+ /** The run's origin state; a dev run checks out its dev commit by default. */
11
+ run: WorkflowRunOriginState;
10
12
  integrations: IntegrationsModuleClient;
11
13
  projects: ProjectsModuleClient;
12
14
  }): Promise<{
@@ -1 +1 @@
1
- {"version":3,"file":"checkout.d.ts","sourceRoot":"","sources":["../../src/core/checkout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,gDAAgD,CAAC;AAC7F,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,wCAAwC,CAAC;AAGjF,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,wBAAwB,CAAC;AACjD,OAAO,KAAK,EAAC,2BAA2B,EAAC,MAAM,gCAA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AE,IAAI,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,2BAA2B,GAAG,IAAI,GAAG,SAAS,CAAC;IAClE,8EAA8E;IAC9E,GAAG,EAAE,sBAAsB,CAAC;IAC5B,YAAY,EAAE,wBAAwB,CAAC;IACvC,QAAQ,EAAE,oBAAoB,CAAC;CAChC,GAAG,OAAO,CAAC;IACV,IAAI,EAAE;QACJ,aAAa,EAAE,MAAM,CAAC;QACtB,GAAG,EAAE,MAAM,CAAC;QACZ,WAAW,CAAC,EAAE;YAAC,QAAQ,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAC;YAAC,SAAS,EAAE,IAAI,CAAA;SAAC,CAAC;QACjE,SAAS,CAAC,EAAE;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAC,CAAC;KAC3C,CAAC;IACF,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,EAAE,OAAO,CAAC;CAC7B,CAAC,CA2DD"}
@@ -26,7 +26,7 @@ const checkoutConfigSchema = z.object({
26
26
  });
27
27
  }
28
28
  });
29
- export async function createStepCheckoutSpec({ step, workspaceId, projectId, triggerReference, integrations, projects }) {
29
+ export async function createStepCheckoutSpec({ step, workspaceId, projectId, triggerReference, run, integrations, projects }) {
30
30
  const checkout = parseCheckoutConfig(step);
31
31
  const { project: defaultProject } = await projects.getProjectById({
32
32
  projectId
@@ -52,7 +52,12 @@ export async function createStepCheckoutSpec({ step, workspaceId, projectId, tri
52
52
  },
53
53
  target
54
54
  });
55
- const ref = checkout.ref ?? (triggerReference?.project?.id === resolvedTarget.projectId ? triggerReference.commit ?? undefined : undefined);
55
+ // Explicit step refs win, followed by same-project event commits (including
56
+ // replays), then the pinned dev commit for the run's own project. Other targets
57
+ // intentionally use the provider default branch.
58
+ const triggerCommitRef = triggerReference?.project?.id === resolvedTarget.projectId ? triggerReference.commit ?? undefined : undefined;
59
+ const devCommitRef = run.origin === 'dev' && resolvedTarget.projectId === projectId ? run.devSource.commit : undefined;
60
+ const ref = checkout.ref ?? triggerCommitRef ?? devCommitRef;
56
61
  const response = await integrations.createCheckoutSpec({
57
62
  workspaceId,
58
63
  connectionId: resolvedTarget.connectionId,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/checkout.ts"],"sourcesContent":["import type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto/inter-module';\nimport type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';\nimport {checkoutTargetValidationIssues} from '@shipfox/workflow-document';\nimport {z} from 'zod';\nimport type {Step} from '#core/entities/step.js';\nimport type {WorkflowRunTriggerReference} from '#core/entities/workflow-run.js';\nimport {CheckoutConfigInvalidError, CheckoutIntentUnresolvedError} from './errors.js';\n\nconst checkoutConfigSchema = z\n .object({\n project: z.string().uuid().optional(),\n connection: z.string().min(1).optional(),\n repository: z.string().min(1).optional(),\n ref: z.string().min(1).optional(),\n fetch_depth: z.number().int().nonnegative().optional(),\n permissions: z.object({contents: z.enum(['read', 'write'])}).optional(),\n persist_credentials: z.boolean().optional(),\n })\n .superRefine((checkout, context) => {\n for (const validationIssue of checkoutTargetValidationIssues(checkout)) {\n const message =\n validationIssue.kind === 'project-with-connection'\n ? 'Checkout project cannot be combined with a connection.'\n : validationIssue.kind === 'project-with-repository'\n ? 'Checkout project cannot be combined with a repository.'\n : 'Checkout connection requires a repository.';\n context.addIssue({\n code: 'custom',\n path: [validationIssue.path],\n message,\n });\n }\n });\n\ntype CheckoutConfig = z.infer<typeof checkoutConfigSchema>;\n\nexport async function createStepCheckoutSpec({\n step,\n workspaceId,\n projectId,\n triggerReference,\n integrations,\n projects,\n}: {\n step: Step;\n workspaceId: string;\n projectId: string;\n triggerReference?: WorkflowRunTriggerReference | null | undefined;\n integrations: IntegrationsModuleClient;\n projects: ProjectsModuleClient;\n}): Promise<{\n spec: {\n repositoryUrl: string;\n ref: string;\n credentials?: {username: string; token: string; expiresAt: Date};\n gitAuthor?: {name: string; email: string};\n };\n fetchDepth: number;\n persistCredentials: boolean;\n}> {\n const checkout = parseCheckoutConfig(step);\n const {project: defaultProject} = await projects.getProjectById({projectId});\n if (defaultProject === null || defaultProject === undefined) {\n throw new CheckoutIntentUnresolvedError({kind: 'project', value: projectId});\n }\n\n const target = await checkoutTarget({\n checkout,\n defaultProjectId: projectId,\n defaultConnectionId: defaultProject.sourceConnectionId,\n integrations,\n workspaceId,\n });\n const resolvedTarget = await projects.resolveCheckoutTarget({\n workspaceId,\n defaults: {\n connectionId: defaultProject.sourceConnectionId,\n owner: defaultOwner(defaultProject.sourceRepositoryOwner, checkout.repository),\n },\n target,\n });\n const ref =\n checkout.ref ??\n (triggerReference?.project?.id === resolvedTarget.projectId\n ? (triggerReference.commit ?? undefined)\n : undefined);\n const response = await integrations.createCheckoutSpec({\n workspaceId,\n connectionId: resolvedTarget.connectionId,\n externalRepositoryId: resolvedTarget.externalRepositoryId,\n ...(ref === undefined ? {} : {ref}),\n permissions: checkout.permissions ?? {contents: 'read'},\n });\n\n return {\n spec: {\n repositoryUrl: response.repositoryUrl,\n ref: response.ref,\n ...(response.credentials\n ? {\n credentials: {\n ...response.credentials,\n expiresAt: new Date(response.credentials.expiresAt),\n },\n }\n : {}),\n ...(response.gitAuthor === undefined ? {} : {gitAuthor: response.gitAuthor}),\n },\n fetchDepth: checkout.fetch_depth ?? 1,\n persistCredentials: checkout.persist_credentials ?? true,\n };\n}\n\nfunction parseCheckoutConfig(step: Step): CheckoutConfig {\n const result = checkoutConfigSchema.safeParse(step.config.checkout);\n if (!result.success) {\n throw new CheckoutConfigInvalidError(step.id);\n }\n return result.data;\n}\n\nasync function checkoutTarget(params: {\n checkout: CheckoutConfig;\n defaultProjectId: string;\n defaultConnectionId: string;\n integrations: IntegrationsModuleClient;\n workspaceId: string;\n}) {\n const {checkout} = params;\n if (checkout.project !== undefined) return {project: checkout.project};\n if (checkout.repository !== undefined) {\n const connection =\n checkout.connection === undefined\n ? undefined\n : await resolveConnectionId({\n integrations: params.integrations,\n workspaceId: params.workspaceId,\n defaultConnectionId: params.defaultConnectionId,\n slug: checkout.connection,\n });\n return {\n ...(connection === undefined ? {} : {connection}),\n repository: checkout.repository,\n };\n }\n return {project: params.defaultProjectId};\n}\n\nasync function resolveConnectionId(params: {\n integrations: IntegrationsModuleClient;\n workspaceId: string;\n defaultConnectionId: string;\n slug: string;\n}): Promise<string> {\n const connection = await params.integrations.resolveConnection({\n workspaceId: params.workspaceId,\n slug: params.slug,\n });\n if (connection === null) {\n throw new CheckoutIntentUnresolvedError({kind: 'connection', value: params.slug});\n }\n return connection.id;\n}\n\nfunction defaultOwner(\n projectOwner: string | null | undefined,\n repository: string | undefined,\n): string {\n if (projectOwner) return projectOwner;\n const separator = repository?.indexOf('/') ?? -1;\n if (separator > 0 && repository !== undefined) return repository.slice(0, separator);\n return 'unknown';\n}\n"],"names":["checkoutTargetValidationIssues","z","CheckoutConfigInvalidError","CheckoutIntentUnresolvedError","checkoutConfigSchema","object","project","string","uuid","optional","connection","min","repository","ref","fetch_depth","number","int","nonnegative","permissions","contents","enum","persist_credentials","boolean","superRefine","checkout","context","validationIssue","message","kind","addIssue","code","path","createStepCheckoutSpec","step","workspaceId","projectId","triggerReference","integrations","projects","parseCheckoutConfig","defaultProject","getProjectById","undefined","value","target","checkoutTarget","defaultProjectId","defaultConnectionId","sourceConnectionId","resolvedTarget","resolveCheckoutTarget","defaults","connectionId","owner","defaultOwner","sourceRepositoryOwner","id","commit","response","createCheckoutSpec","externalRepositoryId","spec","repositoryUrl","credentials","expiresAt","Date","gitAuthor","fetchDepth","persistCredentials","result","safeParse","config","success","data","params","resolveConnectionId","slug","resolveConnection","projectOwner","separator","indexOf","slice"],"mappings":"AAEA,SAAQA,8BAA8B,QAAO,6BAA6B;AAC1E,SAAQC,CAAC,QAAO,MAAM;AAGtB,SAAQC,0BAA0B,EAAEC,6BAA6B,QAAO,cAAc;AAEtF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AM,EAAClD,QAAQ,EAAC,GAAGkD;IACnB,IAAIlD,SAASlB,OAAO,KAAKoC,WAAW,OAAO;QAACpC,SAASkB,SAASlB,OAAO;IAAA;IACrE,IAAIkB,SAASZ,UAAU,KAAK8B,WAAW;QACrC,MAAMhC,aACJc,SAASd,UAAU,KAAKgC,YACpBA,YACA,MAAMiC,oBAAoB;YACxBtC,cAAcqC,OAAOrC,YAAY;YACjCH,aAAawC,OAAOxC,WAAW;YAC/Ba,qBAAqB2B,OAAO3B,mBAAmB;YAC/C6B,MAAMpD,SAASd,UAAU;QAC3B;QACN,OAAO;YACL,GAAIA,eAAegC,YAAY,CAAC,IAAI;gBAAChC;YAAU,CAAC;YAChDE,YAAYY,SAASZ,UAAU;QACjC;IACF;IACA,OAAO;QAACN,SAASoE,OAAO5B,gBAAgB;IAAA;AAC1C;AAEA,eAAe6B,oBAAoBD,MAKlC;IACC,MAAMhE,aAAa,MAAMgE,OAAOrC,YAAY,CAACwC,iBAAiB,CAAC;QAC7D3C,aAAawC,OAAOxC,WAAW;QAC/B0C,MAAMF,OAAOE,IAAI;IACnB;IACA,IAAIlE,eAAe,MAAM;QACvB,MAAM,IAAIP,8BAA8B;YAACyB,MAAM;YAAce,OAAO+B,OAAOE,IAAI;QAAA;IACjF;IACA,OAAOlE,WAAW8C,EAAE;AACtB;AAEA,SAASF,aACPwB,YAAuC,EACvClE,UAA8B;IAE9B,IAAIkE,cAAc,OAAOA;IACzB,MAAMC,YAAYnE,YAAYoE,QAAQ,QAAQ,CAAC;IAC/C,IAAID,YAAY,KAAKnE,eAAe8B,WAAW,OAAO9B,WAAWqE,KAAK,CAAC,GAAGF;IAC1E,OAAO;AACT"}
1
+ {"version":3,"sources":["../../src/core/checkout.ts"],"sourcesContent":["import type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto/inter-module';\nimport type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';\nimport {checkoutTargetValidationIssues} from '@shipfox/workflow-document';\nimport {z} from 'zod';\nimport type {Step} from '#core/entities/step.js';\nimport type {\n WorkflowRunOriginState,\n WorkflowRunTriggerReference,\n} from '#core/entities/workflow-run.js';\nimport {CheckoutConfigInvalidError, CheckoutIntentUnresolvedError} from './errors.js';\n\nconst checkoutConfigSchema = z\n .object({\n project: z.string().uuid().optional(),\n connection: z.string().min(1).optional(),\n repository: z.string().min(1).optional(),\n ref: z.string().min(1).optional(),\n fetch_depth: z.number().int().nonnegative().optional(),\n permissions: z.object({contents: z.enum(['read', 'write'])}).optional(),\n persist_credentials: z.boolean().optional(),\n })\n .superRefine((checkout, context) => {\n for (const validationIssue of checkoutTargetValidationIssues(checkout)) {\n const message =\n validationIssue.kind === 'project-with-connection'\n ? 'Checkout project cannot be combined with a connection.'\n : validationIssue.kind === 'project-with-repository'\n ? 'Checkout project cannot be combined with a repository.'\n : 'Checkout connection requires a repository.';\n context.addIssue({\n code: 'custom',\n path: [validationIssue.path],\n message,\n });\n }\n });\n\ntype CheckoutConfig = z.infer<typeof checkoutConfigSchema>;\n\nexport async function createStepCheckoutSpec({\n step,\n workspaceId,\n projectId,\n triggerReference,\n run,\n integrations,\n projects,\n}: {\n step: Step;\n workspaceId: string;\n projectId: string;\n triggerReference?: WorkflowRunTriggerReference | null | undefined;\n /** The run's origin state; a dev run checks out its dev commit by default. */\n run: WorkflowRunOriginState;\n integrations: IntegrationsModuleClient;\n projects: ProjectsModuleClient;\n}): Promise<{\n spec: {\n repositoryUrl: string;\n ref: string;\n credentials?: {username: string; token: string; expiresAt: Date};\n gitAuthor?: {name: string; email: string};\n };\n fetchDepth: number;\n persistCredentials: boolean;\n}> {\n const checkout = parseCheckoutConfig(step);\n const {project: defaultProject} = await projects.getProjectById({projectId});\n if (defaultProject === null || defaultProject === undefined) {\n throw new CheckoutIntentUnresolvedError({kind: 'project', value: projectId});\n }\n\n const target = await checkoutTarget({\n checkout,\n defaultProjectId: projectId,\n defaultConnectionId: defaultProject.sourceConnectionId,\n integrations,\n workspaceId,\n });\n const resolvedTarget = await projects.resolveCheckoutTarget({\n workspaceId,\n defaults: {\n connectionId: defaultProject.sourceConnectionId,\n owner: defaultOwner(defaultProject.sourceRepositoryOwner, checkout.repository),\n },\n target,\n });\n // Explicit step refs win, followed by same-project event commits (including\n // replays), then the pinned dev commit for the run's own project. Other targets\n // intentionally use the provider default branch.\n const triggerCommitRef =\n triggerReference?.project?.id === resolvedTarget.projectId\n ? (triggerReference.commit ?? undefined)\n : undefined;\n const devCommitRef =\n run.origin === 'dev' && resolvedTarget.projectId === projectId\n ? run.devSource.commit\n : undefined;\n const ref = checkout.ref ?? triggerCommitRef ?? devCommitRef;\n const response = await integrations.createCheckoutSpec({\n workspaceId,\n connectionId: resolvedTarget.connectionId,\n externalRepositoryId: resolvedTarget.externalRepositoryId,\n ...(ref === undefined ? {} : {ref}),\n permissions: checkout.permissions ?? {contents: 'read'},\n });\n\n return {\n spec: {\n repositoryUrl: response.repositoryUrl,\n ref: response.ref,\n ...(response.credentials\n ? {\n credentials: {\n ...response.credentials,\n expiresAt: new Date(response.credentials.expiresAt),\n },\n }\n : {}),\n ...(response.gitAuthor === undefined ? {} : {gitAuthor: response.gitAuthor}),\n },\n fetchDepth: checkout.fetch_depth ?? 1,\n persistCredentials: checkout.persist_credentials ?? true,\n };\n}\n\nfunction parseCheckoutConfig(step: Step): CheckoutConfig {\n const result = checkoutConfigSchema.safeParse(step.config.checkout);\n if (!result.success) {\n throw new CheckoutConfigInvalidError(step.id);\n }\n return result.data;\n}\n\nasync function checkoutTarget(params: {\n checkout: CheckoutConfig;\n defaultProjectId: string;\n defaultConnectionId: string;\n integrations: IntegrationsModuleClient;\n workspaceId: string;\n}) {\n const {checkout} = params;\n if (checkout.project !== undefined) return {project: checkout.project};\n if (checkout.repository !== undefined) {\n const connection =\n checkout.connection === undefined\n ? undefined\n : await resolveConnectionId({\n integrations: params.integrations,\n workspaceId: params.workspaceId,\n defaultConnectionId: params.defaultConnectionId,\n slug: checkout.connection,\n });\n return {\n ...(connection === undefined ? {} : {connection}),\n repository: checkout.repository,\n };\n }\n return {project: params.defaultProjectId};\n}\n\nasync function resolveConnectionId(params: {\n integrations: IntegrationsModuleClient;\n workspaceId: string;\n defaultConnectionId: string;\n slug: string;\n}): Promise<string> {\n const connection = await params.integrations.resolveConnection({\n workspaceId: params.workspaceId,\n slug: params.slug,\n });\n if (connection === null) {\n throw new CheckoutIntentUnresolvedError({kind: 'connection', value: params.slug});\n }\n return connection.id;\n}\n\nfunction defaultOwner(\n projectOwner: string | null | undefined,\n repository: string | undefined,\n): string {\n if (projectOwner) return projectOwner;\n const separator = repository?.indexOf('/') ?? -1;\n if (separator > 0 && repository !== undefined) return repository.slice(0, separator);\n return 'unknown';\n}\n"],"names":["checkoutTargetValidationIssues","z","CheckoutConfigInvalidError","CheckoutIntentUnresolvedError","checkoutConfigSchema","object","project","string","uuid","optional","connection","min","repository","ref","fetch_depth","number","int","nonnegative","permissions","contents","enum","persist_credentials","boolean","superRefine","checkout","context","validationIssue","message","kind","addIssue","code","path","createStepCheckoutSpec","step","workspaceId","projectId","triggerReference","run","integrations","projects","parseCheckoutConfig","defaultProject","getProjectById","undefined","value","target","checkoutTarget","defaultProjectId","defaultConnectionId","sourceConnectionId","resolvedTarget","resolveCheckoutTarget","defaults","connectionId","owner","defaultOwner","sourceRepositoryOwner","triggerCommitRef","id","commit","devCommitRef","origin","devSource","response","createCheckoutSpec","externalRepositoryId","spec","repositoryUrl","credentials","expiresAt","Date","gitAuthor","fetchDepth","persistCredentials","result","safeParse","config","success","data","params","resolveConnectionId","slug","resolveConnection","projectOwner","separator","indexOf","slice"],"mappings":"AAEA,SAAQA,8BAA8B,QAAO,6BAA6B;AAC1E,SAAQC,CAAC,QAAO,MAAM;AAMtB,SAAQC,0BAA0B,EAAEC,6BAA6B,QAAO,cAAc;AAEtF,MAAMC,uBAAuBH,EAC1BI,MAAM,CAAC;IACNC,SAASL,EAAEM,MAAM,GAAGC,IAAI,GAAGC,QAAQ;IACnCC,YAAYT,EA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AAE;IAC9C;IACA,OAAOgB,OAAOI,IAAI;AACpB;AAEA,eAAehC,eAAeiC,MAM7B;IACC,MAAM,EAACvD,QAAQ,EAAC,GAAGuD;IACnB,IAAIvD,SAASlB,OAAO,KAAKqC,WAAW,OAAO;QAACrC,SAASkB,SAASlB,OAAO;IAAA;IACrE,IAAIkB,SAASZ,UAAU,KAAK+B,WAAW;QACrC,MAAMjC,aACJc,SAASd,UAAU,KAAKiC,YACpBA,YACA,MAAMqC,oBAAoB;YACxB1C,cAAcyC,OAAOzC,YAAY;YACjCJ,aAAa6C,OAAO7C,WAAW;YAC/Bc,qBAAqB+B,OAAO/B,mBAAmB;YAC/CiC,MAAMzD,SAASd,UAAU;QAC3B;QACN,OAAO;YACL,GAAIA,eAAeiC,YAAY,CAAC,IAAI;gBAACjC;YAAU,CAAC;YAChDE,YAAYY,SAASZ,UAAU;QACjC;IACF;IACA,OAAO;QAACN,SAASyE,OAAOhC,gBAAgB;IAAA;AAC1C;AAEA,eAAeiC,oBAAoBD,MAKlC;IACC,MAAMrE,aAAa,MAAMqE,OAAOzC,YAAY,CAAC4C,iBAAiB,CAAC;QAC7DhD,aAAa6C,OAAO7C,WAAW;QAC/B+C,MAAMF,OAAOE,IAAI;IACnB;IACA,IAAIvE,eAAe,MAAM;QACvB,MAAM,IAAIP,8BAA8B;YAACyB,MAAM;YAAcgB,OAAOmC,OAAOE,IAAI;QAAA;IACjF;IACA,OAAOvE,WAAWgD,EAAE;AACtB;AAEA,SAASH,aACP4B,YAAuC,EACvCvE,UAA8B;IAE9B,IAAIuE,cAAc,OAAOA;IACzB,MAAMC,YAAYxE,YAAYyE,QAAQ,QAAQ,CAAC;IAC/C,IAAID,YAAY,KAAKxE,eAAe+B,WAAW,OAAO/B,WAAW0E,KAAK,CAAC,GAAGF;IAC1E,OAAO;AACT"}
@@ -44,7 +44,7 @@ export interface Job {
44
44
  }
45
45
  export interface JobListeningTrigger {
46
46
  readonly source: string;
47
- readonly event: string;
47
+ readonly event?: string;
48
48
  readonly inputs?: Readonly<Record<string, unknown>>;
49
49
  readonly filter?: string;
50
50
  }
@@ -1 +1 @@
1
- {"version":3,"file":"job.d.ts","sourceRoot":"","sources":["../../../src/core/entities/job.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,6BAA6B,EAAC,MAAM,WAAW,CAAC;AAE7D,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,GAAG,SAAS,CAAC;AAEjG,MAAM,MAAM,OAAO,GAAG,UAAU,GAAG,WAAW,CAAC;AAE/C,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,WAAW,GAAG,UAAU,CAAC;AAEnE,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,SAAS,GAAG,gBAAgB,GAAG,WAAW,CAAC;AAEpF,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE;QACX,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;KAC5B,CAAC;IACF,kBAAkB,EAAE,OAAO,CAAC;CAC7B;AAED,eAAO,MAAM,kBAAkB,YAC7B,0BAA0B,EAC1B,iBAAiB,EACjB,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,SAAS,EACT,gBAAgB,CACR,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAIlE,MAAM,WAAW,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,oBAAoB,EAAE,MAAM,CAAC;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,MAAM,EAAE,SAAS,CAAC;IAClB,YAAY,EAAE,eAAe,GAAG,IAAI,CAAC;IACrC,WAAW,EAAE,OAA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AC;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACpD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,MAAM,iBAAiB,GAAG,OAAO,CACrC,SAAS,EACT,WAAW,GAAG,QAAQ,GAAG,WAAW,GAAG,SAAS,CACjD,CAAC;AAIF,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,IAAI,iBAAiB,CAE5E;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,eAAe,GAAG,IAAI,CAK9E"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/core/entities/job.ts"],"sourcesContent":["import type {PersistedEvaluationTraceEntry} from './step.js';\n\nexport type JobStatus = 'pending' | 'running' | 'succeeded' | 'failed' | 'cancelled' | 'skipped';\n\nexport type JobMode = 'one_shot' | 'listening';\n\nexport type ListenerStatus = 'inactive' | 'listening' | 'resolved';\n\nexport type ResolutionReason = 'until' | 'timeout' | 'max_executions' | 'cancelled';\n\nexport interface JobCheckout {\n permissions: {\n contents: 'read' | 'write';\n };\n persistCredentials: boolean;\n}\n\nexport const JOB_STATUS_REASONS = [\n 'dependency_not_completed',\n 'condition_false',\n 'default_gate_rejected',\n 'condition_rejected',\n 'condition_errored',\n 'user_cancelled',\n 'run_cancelled',\n 'timed_out',\n 'runner_lost',\n 'output_too_large',\n 'step_failed',\n 'unknown',\n 'output_invalid',\n] as const;\n\nexport type JobStatusReason = (typeof JOB_STATUS_REASONS)[number];\n\nconst JOB_STATUS_REASON_SET = new Set<JobStatusReason>(JOB_STATUS_REASONS);\n\nexport interface Job {\n id: string;\n workflowRunAttemptId: string;\n key: string;\n mode: JobMode;\n name: string | null;\n status: JobStatus;\n statusReason: JobStatusReason | null;\n carriedOver: boolean;\n checkout: JobCheckout;\n success?: string | null;\n evaluationTrace?: readonly PersistedEvaluationTraceEntry[] | null;\n executionTimeoutMs?: number | null;\n listeningTimeoutMs: number | null;\n maxExecutions: number | null;\n onResolve: 'finish' | 'cancel' | null;\n batchDebounceMs: number | null;\n batchMaxSize: number | null;\n batchMaxWaitMs: number | null;\n listenerStatus: ListenerStatus;\n resolutionReason: ResolutionReason | null;\n listeningOn: JobListeningTrigger[] | null;\n listeningUntil: JobListeningTrigger[] | null;\n outputs: Record<string, unknown> | null;\n dependencies: string[];\n runner: string[] | null;\n position: number;\n version: number;\n createdAt: Date;\n updatedAt: Date;\n}\n\nexport interface JobListeningTrigger {\n readonly source: string;\n readonly event: string;\n readonly inputs?: Readonly<Record<string, unknown>>;\n readonly filter?: string;\n}\n\nexport type TerminalJobStatus = Extract<\n JobStatus,\n 'succeeded' | 'failed' | 'cancelled' | 'skipped'\n>;\n\nconst TERMINAL_JOB_STATUSES = new Set<JobStatus>(['succeeded', 'failed', 'cancelled', 'skipped']);\n\nexport function isJobTerminal(status: JobStatus): status is TerminalJobStatus {\n return TERMINAL_JOB_STATUSES.has(status);\n}\n\nexport function toJobStatusReason(value: string | null): JobStatusReason | null {\n if (value === null) return null;\n return JOB_STATUS_REASON_SET.has(value as JobStatusReason)\n ? (value as JobStatusReason)\n : 'unknown';\n}\n"],"names":["JOB_STATUS_REASONS","JOB_STATUS_REASON_SET","Set","TERMINAL_JOB_STATUSES","isJobTerminal","status","has","toJobStatusReason","value"],"mappings":"AAiBA,OAAO,MAAMA,qBAAqB;IAChC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAU;AAIX,MAAMC,wBAAwB,IAAIC,IAAqBF;AA8CvD,MAAMG,wBAAwB,IAAID,IAAe;IAAC;IAAa;IAAU;IAAa;CAAU;AAEhG,OAAO,SAASE,cAAcC,MAAiB;IAC7C,OAAOF,sBAAsBG,GAAG,CAACD;AACnC;AAEA,OAAO,SAASE,kBAAkBC,KAAoB;IACpD,IAAIA,UAAU,MAAM,OAAO;IAC3B,OAAOP,sBAAsBK,GAAG,CAACE,SAC5BA,QACD;AACN"}
1
+ {"version":3,"sources":["../../../src/core/entities/job.ts"],"sourcesContent":["import type {PersistedEvaluationTraceEntry} from './step.js';\n\nexport type JobStatus = 'pending' | 'running' | 'succeeded' | 'failed' | 'cancelled' | 'skipped';\n\nexport type JobMode = 'one_shot' | 'listening';\n\nexport type ListenerStatus = 'inactive' | 'listening' | 'resolved';\n\nexport type ResolutionReason = 'until' | 'timeout' | 'max_executions' | 'cancelled';\n\nexport interface JobCheckout {\n permissions: {\n contents: 'read' | 'write';\n };\n persistCredentials: boolean;\n}\n\nexport const JOB_STATUS_REASONS = [\n 'dependency_not_completed',\n 'condition_false',\n 'default_gate_rejected',\n 'condition_rejected',\n 'condition_errored',\n 'user_cancelled',\n 'run_cancelled',\n 'timed_out',\n 'runner_lost',\n 'output_too_large',\n 'step_failed',\n 'unknown',\n 'output_invalid',\n] as const;\n\nexport type JobStatusReason = (typeof JOB_STATUS_REASONS)[number];\n\nconst JOB_STATUS_REASON_SET = new Set<JobStatusReason>(JOB_STATUS_REASONS);\n\nexport interface Job {\n id: string;\n workflowRunAttemptId: string;\n key: string;\n mode: JobMode;\n name: string | null;\n status: JobStatus;\n statusReason: JobStatusReason | null;\n carriedOver: boolean;\n checkout: JobCheckout;\n success?: string | null;\n evaluationTrace?: readonly PersistedEvaluationTraceEntry[] | null;\n executionTimeoutMs?: number | null;\n listeningTimeoutMs: number | null;\n maxExecutions: number | null;\n onResolve: 'finish' | 'cancel' | null;\n batchDebounceMs: number | null;\n batchMaxSize: number | null;\n batchMaxWaitMs: number | null;\n listenerStatus: ListenerStatus;\n resolutionReason: ResolutionReason | null;\n listeningOn: JobListeningTrigger[] | null;\n listeningUntil: JobListeningTrigger[] | null;\n outputs: Record<string, unknown> | null;\n dependencies: string[];\n runner: string[] | null;\n position: number;\n version: number;\n createdAt: Date;\n updatedAt: Date;\n}\n\nexport interface JobListeningTrigger {\n readonly source: string;\n readonly event?: string;\n readonly inputs?: Readonly<Record<string, unknown>>;\n readonly filter?: string;\n}\n\nexport type TerminalJobStatus = Extract<\n JobStatus,\n 'succeeded' | 'failed' | 'cancelled' | 'skipped'\n>;\n\nconst TERMINAL_JOB_STATUSES = new Set<JobStatus>(['succeeded', 'failed', 'cancelled', 'skipped']);\n\nexport function isJobTerminal(status: JobStatus): status is TerminalJobStatus {\n return TERMINAL_JOB_STATUSES.has(status);\n}\n\nexport function toJobStatusReason(value: string | null): JobStatusReason | null {\n if (value === null) return null;\n return JOB_STATUS_REASON_SET.has(value as JobStatusReason)\n ? (value as JobStatusReason)\n : 'unknown';\n}\n"],"names":["JOB_STATUS_REASONS","JOB_STATUS_REASON_SET","Set","TERMINAL_JOB_STATUSES","isJobTerminal","status","has","toJobStatusReason","value"],"mappings":"AAiBA,OAAO,MAAMA,qBAAqB;IAChC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAU;AAIX,MAAMC,wBAAwB,IAAIC,IAAqBF;AA8CvD,MAAMG,wBAAwB,IAAID,IAAe;IAAC;IAAa;IAAU;IAAa;CAAU;AAEhG,OAAO,SAASE,cAAcC,MAAiB;IAC7C,OAAOF,sBAAsBG,GAAG,CAACD;AACnC;AAEA,OAAO,SAASE,kBAAkBC,KAAoB;IACpD,IAAIA,UAAU,MAAM,OAAO;IAC3B,OAAOP,sBAAsBK,GAAG,CAACE,SAC5BA,QACD;AACN"}
@@ -3,6 +3,25 @@ import type { JobExecution } from './job-execution.js';
3
3
  import type { Step, StepAttempt } from './step.js';
4
4
  import type { WorkflowRunAttempt } from './workflow-run-attempt.js';
5
5
  export type WorkflowRunStatus = 'pending' | 'running' | 'succeeded' | 'failed' | 'cancelled';
6
+ export type WorkflowRunOrigin = 'synced' | 'dev';
7
+ /**
8
+ * Why a dev run was created: the ref and pinned commit the definition came from, the
9
+ * file that ran, the user who started it, and the journaled event it replays when any.
10
+ */
11
+ export interface WorkflowRunDevSource {
12
+ ref: string;
13
+ commit: string;
14
+ configPath: string;
15
+ initiatedByUserId: string;
16
+ replayOfEventId: string | null;
17
+ }
18
+ export type WorkflowRunOriginState = {
19
+ origin: 'synced';
20
+ devSource: null;
21
+ } | {
22
+ origin: 'dev';
23
+ devSource: WorkflowRunDevSource;
24
+ };
6
25
  export type TerminalWorkflowRunStatus = Extract<WorkflowRunStatus, 'succeeded' | 'failed' | 'cancelled'>;
7
26
  export declare function isWorkflowRunTerminal(status: WorkflowRunStatus): status is TerminalWorkflowRunStatus;
8
27
  export interface WorkflowRunTriggerReference {
@@ -36,7 +55,7 @@ export type TriggerPayload = {
36
55
  deliveryId: string;
37
56
  data: unknown;
38
57
  };
39
- export interface WorkflowRun {
58
+ export type WorkflowRun = WorkflowRunOriginState & {
40
59
  id: string;
41
60
  workspaceId: string;
42
61
  projectId: string;
@@ -65,7 +84,7 @@ export interface WorkflowRun {
65
84
  updatedAt: Date;
66
85
  startedAt: Date | null;
67
86
  finishedAt: Date | null;
68
- }
87
+ };
69
88
  export interface StepDetail extends Step {
70
89
  attempts: StepAttempt[];
71
90
  }
@@ -75,12 +94,12 @@ export interface JobExecutionDetail extends JobExecution {
75
94
  export interface WorkflowJobDetail extends Job {
76
95
  jobExecutions: JobExecutionDetail[];
77
96
  }
78
- export interface WorkflowRunDetail extends WorkflowRun {
97
+ export type WorkflowRunDetail = WorkflowRun & {
79
98
  runAttempt: WorkflowRunAttempt;
80
99
  latestAttempt: number;
81
100
  jobs: WorkflowJobDetail[];
82
101
  /** Whether any job execution of this attempt reached its runner, decided here so the detail
83
102
  * and the list cannot answer it differently. */
84
103
  hasStartedJobExecution: boolean;
85
- }
104
+ };
86
105
  //# sourceMappingURL=workflow-run.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-run.d.ts","sourceRoot":"","sources":["../../../src/core/entities/workflow-run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,UAAU,CAAC;AACl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AC;CACjC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/core/entities/workflow-run.ts"],"sourcesContent":["import type {Job} from './job.js';\nimport type {JobExecution} from './job-execution.js';\nimport type {Step, StepAttempt} from './step.js';\nimport type {WorkflowRunAttempt} from './workflow-run-attempt.js';\n\nexport type WorkflowRunStatus = 'pending' | 'running' | 'succeeded' | 'failed' | 'cancelled';\n\nexport type TerminalWorkflowRunStatus = Extract<\n WorkflowRunStatus,\n 'succeeded' | 'failed' | 'cancelled'\n>;\n\nconst TERMINAL_WORKFLOW_RUN_STATUSES = new Set<WorkflowRunStatus>([\n 'succeeded',\n 'failed',\n 'cancelled',\n]);\n\nexport function isWorkflowRunTerminal(\n status: WorkflowRunStatus,\n): status is TerminalWorkflowRunStatus {\n return TERMINAL_WORKFLOW_RUN_STATUSES.has(status);\n}\n\nexport interface WorkflowRunTriggerReference {\n project: {id: string} | null;\n repository: string | null;\n ref: string | null;\n commit: string | null;\n actor: string | null;\n}\n\nexport interface WorkflowSourceSnapshot {\n content: string;\n format: 'yaml';\n}\n\nexport type TriggerPayload =\n | {\n source: 'manual';\n provider?: 'manual' | undefined;\n event: 'fire';\n subscriptionId: string;\n userId: string;\n }\n | {\n source: 'cron';\n provider?: 'cron' | undefined;\n event: 'tick';\n scheduleId: string;\n }\n // Integration sources (github, gitlab, sentry, …) flow through opaquely: the\n // run records what fired it and carries the raw event payload, without the\n // triggers module having to know each source's shape.\n | {\n source: string;\n provider?: string | undefined;\n event: string;\n deliveryId: string;\n data: unknown;\n };\n\nexport interface WorkflowRun {\n id: string;\n workspaceId: string;\n projectId: string;\n definitionId: string;\n number: number;\n /** Effective runtime name: the resolved override, or workflowName when absent. */\n name: string;\n /** Static workflow-name snapshot preserved from the definition at creation. */\n workflowName: string;\n /** Nullable resolved override retained for rerun fidelity. */\n nameOverride: string | null;\n status: WorkflowRunStatus;\n currentAttempt: number;\n triggerProvider: string | null;\n triggerSource: string;\n triggerEvent: string;\n triggerPayload: TriggerPayload;\n /** Provider-neutral trigger facts captured at run creation, when available. */\n triggerReference?: WorkflowRunTriggerReference | null | undefined;\n inputs: Record<string, unknown> | null;\n sourceSnapshot: WorkflowSourceSnapshot | null;\n triggerIdempotencyKey: string | null;\n timeoutMs: number;\n version: number;\n createdAt: Date;\n updatedAt: Date;\n startedAt: Date | null;\n finishedAt: Date | null;\n}\n\nexport interface StepDetail extends Step {\n attempts: StepAttempt[];\n}\n\nexport interface JobExecutionDetail extends JobExecution {\n steps: StepDetail[];\n}\n\nexport interface WorkflowJobDetail extends Job {\n jobExecutions: JobExecutionDetail[];\n}\n\nexport interface WorkflowRunDetail extends WorkflowRun {\n runAttempt: WorkflowRunAttempt;\n latestAttempt: number;\n jobs: WorkflowJobDetail[];\n /** Whether any job execution of this attempt reached its runner, decided here so the detail\n * and the list cannot answer it differently. */\n hasStartedJobExecution: boolean;\n}\n"],"names":["TERMINAL_WORKFLOW_RUN_STATUSES","Set","isWorkflowRunTerminal","status","has"],"mappings":"AAYA,MAAMA,iCAAiC,IAAIC,IAAuB;IAChE;IACA;IACA;CACD;AAED,OAAO,SAASC,sBACdC,MAAyB;IAEzB,OAAOH,+BAA+BI,GAAG,CAACD;AAC5C"}
1
+ {"version":3,"sources":["../../../src/core/entities/workflow-run.ts"],"sourcesContent":["import type {Job} from './job.js';\nimport type {JobExecution} from './job-execution.js';\nimport type {Step, StepAttempt} from './step.js';\nimport type {WorkflowRunAttempt} from './workflow-run-attempt.js';\n\nexport type WorkflowRunStatus = 'pending' | 'running' | 'succeeded' | 'failed' | 'cancelled';\n\nexport type WorkflowRunOrigin = 'synced' | 'dev';\n\n/**\n * Why a dev run was created: the ref and pinned commit the definition came from, the\n * file that ran, the user who started it, and the journaled event it replays when any.\n */\nexport interface WorkflowRunDevSource {\n ref: string;\n commit: string;\n configPath: string;\n initiatedByUserId: string;\n replayOfEventId: string | null;\n}\n\nexport type WorkflowRunOriginState =\n | {origin: 'synced'; devSource: null}\n | {origin: 'dev'; devSource: WorkflowRunDevSource};\n\nexport type TerminalWorkflowRunStatus = Extract<\n WorkflowRunStatus,\n 'succeeded' | 'failed' | 'cancelled'\n>;\n\nconst TERMINAL_WORKFLOW_RUN_STATUSES = new Set<WorkflowRunStatus>([\n 'succeeded',\n 'failed',\n 'cancelled',\n]);\n\nexport function isWorkflowRunTerminal(\n status: WorkflowRunStatus,\n): status is TerminalWorkflowRunStatus {\n return TERMINAL_WORKFLOW_RUN_STATUSES.has(status);\n}\n\nexport interface WorkflowRunTriggerReference {\n project: {id: string} | null;\n repository: string | null;\n ref: string | null;\n commit: string | null;\n actor: string | null;\n}\n\nexport interface WorkflowSourceSnapshot {\n content: string;\n format: 'yaml';\n}\n\nexport type TriggerPayload =\n | {\n source: 'manual';\n provider?: 'manual' | undefined;\n event: 'fire';\n subscriptionId: string;\n userId: string;\n }\n | {\n source: 'cron';\n provider?: 'cron' | undefined;\n event: 'tick';\n scheduleId: string;\n }\n // Integration sources (github, gitlab, sentry, …) flow through opaquely: the\n // run records what fired it and carries the raw event payload, without the\n // triggers module having to know each source's shape.\n | {\n source: string;\n provider?: string | undefined;\n event: string;\n deliveryId: string;\n data: unknown;\n };\n\nexport type WorkflowRun = WorkflowRunOriginState & {\n id: string;\n workspaceId: string;\n projectId: string;\n definitionId: string;\n number: number;\n /** Effective runtime name: the resolved override, or workflowName when absent. */\n name: string;\n /** Static workflow-name snapshot preserved from the definition at creation. */\n workflowName: string;\n /** Nullable resolved override retained for rerun fidelity. */\n nameOverride: string | null;\n status: WorkflowRunStatus;\n currentAttempt: number;\n triggerProvider: string | null;\n triggerSource: string;\n triggerEvent: string;\n triggerPayload: TriggerPayload;\n /** Provider-neutral trigger facts captured at run creation, when available. */\n triggerReference?: WorkflowRunTriggerReference | null | undefined;\n inputs: Record<string, unknown> | null;\n sourceSnapshot: WorkflowSourceSnapshot | null;\n triggerIdempotencyKey: string | null;\n timeoutMs: number;\n version: number;\n createdAt: Date;\n updatedAt: Date;\n startedAt: Date | null;\n finishedAt: Date | null;\n};\n\nexport interface StepDetail extends Step {\n attempts: StepAttempt[];\n}\n\nexport interface JobExecutionDetail extends JobExecution {\n steps: StepDetail[];\n}\n\nexport interface WorkflowJobDetail extends Job {\n jobExecutions: JobExecutionDetail[];\n}\n\nexport type WorkflowRunDetail = WorkflowRun & {\n runAttempt: WorkflowRunAttempt;\n latestAttempt: number;\n jobs: WorkflowJobDetail[];\n /** Whether any job execution of this attempt reached its runner, decided here so the detail\n * and the list cannot answer it differently. */\n hasStartedJobExecution: boolean;\n};\n"],"names":["TERMINAL_WORKFLOW_RUN_STATUSES","Set","isWorkflowRunTerminal","status","has"],"mappings":"AA8BA,MAAMA,iCAAiC,IAAIC,IAAuB;IAChE;IACA;IACA;CACD;AAED,OAAO,SAASC,sBACdC,MAAyB;IAEzB,OAAOH,+BAA+BI,GAAG,CAACD;AAC5C"}
@@ -16,7 +16,7 @@ export async function runWorkflow(definitions, params, options = {}) {
16
16
  return createWorkflowRun({
17
17
  workspaceId: params.workspaceId,
18
18
  projectId: params.projectId,
19
- definitionId: definition.id,
19
+ definitionId: definition.workflowId,
20
20
  name: definition.name,
21
21
  model,
22
22
  triggerPayload: params.triggerPayload,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/run-workflow.ts"],"sourcesContent":["import type {AgentInterModuleClient} from '@shipfox/api-agent-dto/inter-module';\nimport {workflowModelFromSnapshot} from '@shipfox/api-definitions-dto';\nimport type {DefinitionsInterModuleClient} from '@shipfox/api-definitions-dto/inter-module';\nimport type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto/inter-module';\nimport type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';\nimport type {SecretsInterModuleClient} from '@shipfox/api-secrets-dto/inter-module';\nimport {createWorkflowRun} from '#db/workflow-runs.js';\nimport {createAgentDefaultsResolver} from './agent-defaults.js';\nimport type {TriggerPayload, WorkflowRun} from './entities/workflow-run.js';\nimport {DefinitionNotFoundError, ProjectMismatchError} from './errors.js';\nimport {modelHasAgentStep} from './step-config/materialize-workflow-model.js';\n\nexport interface RunWorkflowParams {\n workspaceId: string;\n projectId: string;\n definitionId: string;\n triggerPayload: TriggerPayload;\n triggerConnectionId?: string | undefined;\n inputs?: Record<string, unknown> | undefined;\n triggerIdempotencyKey?: string | undefined;\n integrations?: IntegrationsModuleClient | undefined;\n projects?: ProjectsModuleClient | undefined;\n}\n\nexport async function runWorkflow(\n definitions: DefinitionsInterModuleClient,\n params: RunWorkflowParams & {agent: AgentInterModuleClient},\n options: {secrets?: Pick<SecretsInterModuleClient, 'getVariablesByNamespace'>} = {},\n): Promise<WorkflowRun> {\n const {definition} = await definitions.getDefinitionForWorkflowRun({\n definitionId: params.definitionId,\n });\n if (!definition) throw new DefinitionNotFoundError(params.definitionId);\n\n if (definition.projectId !== params.projectId) {\n throw new ProjectMismatchError(definition.projectId, params.projectId);\n }\n const model = workflowModelFromSnapshot(definition.model);\n const resolveAgentDefaults = createAgentDefaultsResolver(\n params.agent,\n modelHasAgentStep(model) ? params.workspaceId : null,\n );\n\n return createWorkflowRun({\n workspaceId: params.workspaceId,\n projectId: params.projectId,\n definitionId: definition.id,\n name: definition.name,\n model,\n triggerPayload: params.triggerPayload,\n triggerConnectionId: params.triggerConnectionId,\n inputs: params.inputs,\n sourceSnapshot: definition.sourceSnapshot,\n triggerIdempotencyKey: params.triggerIdempotencyKey,\n resolveAgentDefaults,\n secrets: options.secrets,\n integrations: params.integrations,\n projects: params.projects,\n });\n}\n"],"names":["workflowModelFromSnapshot","createWorkflowRun","createAgentDefaultsResolver","DefinitionNotFoundError","ProjectMismatchError","modelHasAgentStep","runWorkflow","definitions","params","options","definition","getDefinitionForWorkflowRun","definitionId","projectId","model","resolveAgentDefaults","agent","workspaceId","id","name","triggerPayload","triggerConnectionId","inputs","sourceSnapshot","triggerIdempotencyKey","secrets","integrations","projects"],"mappings":"AACA,SAAQA,yBAAyB,QAAO,+BAA+B;AAKvE,SAAQC,iBAAiB,QAAO,uBAAuB;AACvD,SAAQC,2BAA2B,QAAO,sBAAsB;AAEhE,SAAQC,uBAAuB,EAAEC,oBAAoB,QAAO,cAAc;AAC1E,SAAQC,iBAAiB,QAAO,8CAA8C;AAc9E,OAAO,eAAeC,YACpBC,WAAyC,EACzCC,MAA2D,EAC3DC,UAAiF,CAAC,CAAC;IAEnF,MAAM,EAACC,UAAU,EAAC,GAAG,MAAMH,YAAYI,2BAA2B,CAAC;QACjEC,cAAcJ,OAAOI,YAAY;IACnC;IACA,IAAI,CAACF,YAAY,MAAM,IAAIP,wBAAwBK,OAAOI,YAAY;IAEtE,IAAIF,WAAWG,SAAS,KAAKL,OAAOK,SAAS,EAAE;QAC7C,MAAM,IAAIT,qBAAqBM,WAAWG,SAAS,EAAEL,OAAOK,SAAS;IACvE;IACA,MAAMC,QAAQd,0BAA0BU,WAAWI,KAAK;IACxD,MAAMC,uBAAuBb,4BAC3BM,OAAOQ,KAAK,EACZX,kBAAkBS,SAASN,OAAOS,WAAW,GAAG;IAGlD,OAAOhB,kBAAkB;QACvBgB,aAAaT,OAAOS,WAAW;QAC/BJ,WAAWL,OAAOK,SAAS;QAC3BD,cAAcF,WAAWQ,EAAE;QAC3BC,MAAMT,WAAWS,IAAI;QACrBL;QACAM,gBAAgBZ,OAAOY,cAAc;QACrCC,qBAAqBb,OAAOa,mBAAmB;QAC/CC,QAAQd,OAAOc,MAAM;QACrBC,gBAAgBb,WAAWa,cAAc;QACzCC,uBAAuBhB,OAAOgB,qBAAqB;QACnDT;QACAU,SAAShB,QAAQgB,OAAO;QACxBC,cAAclB,OAAOkB,YAAY;QACjCC,UAAUnB,OAAOmB,QAAQ;IAC3B;AACF"}
1
+ {"version":3,"sources":["../../src/core/run-workflow.ts"],"sourcesContent":["import type {AgentInterModuleClient} from '@shipfox/api-agent-dto/inter-module';\nimport {workflowModelFromSnapshot} from '@shipfox/api-definitions-dto';\nimport type {DefinitionsInterModuleClient} from '@shipfox/api-definitions-dto/inter-module';\nimport type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto/inter-module';\nimport type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';\nimport type {SecretsInterModuleClient} from '@shipfox/api-secrets-dto/inter-module';\nimport {createWorkflowRun} from '#db/workflow-runs.js';\nimport {createAgentDefaultsResolver} from './agent-defaults.js';\nimport type {TriggerPayload, WorkflowRun} from './entities/workflow-run.js';\nimport {DefinitionNotFoundError, ProjectMismatchError} from './errors.js';\nimport {modelHasAgentStep} from './step-config/materialize-workflow-model.js';\n\nexport interface RunWorkflowParams {\n workspaceId: string;\n projectId: string;\n definitionId: string;\n triggerPayload: TriggerPayload;\n triggerConnectionId?: string | undefined;\n inputs?: Record<string, unknown> | undefined;\n triggerIdempotencyKey?: string | undefined;\n integrations?: IntegrationsModuleClient | undefined;\n projects?: ProjectsModuleClient | undefined;\n}\n\nexport async function runWorkflow(\n definitions: DefinitionsInterModuleClient,\n params: RunWorkflowParams & {agent: AgentInterModuleClient},\n options: {secrets?: Pick<SecretsInterModuleClient, 'getVariablesByNamespace'>} = {},\n): Promise<WorkflowRun> {\n const {definition} = await definitions.getDefinitionForWorkflowRun({\n definitionId: params.definitionId,\n });\n if (!definition) throw new DefinitionNotFoundError(params.definitionId);\n\n if (definition.projectId !== params.projectId) {\n throw new ProjectMismatchError(definition.projectId, params.projectId);\n }\n const model = workflowModelFromSnapshot(definition.model);\n const resolveAgentDefaults = createAgentDefaultsResolver(\n params.agent,\n modelHasAgentStep(model) ? params.workspaceId : null,\n );\n\n return createWorkflowRun({\n workspaceId: params.workspaceId,\n projectId: params.projectId,\n definitionId: definition.workflowId,\n name: definition.name,\n model,\n triggerPayload: params.triggerPayload,\n triggerConnectionId: params.triggerConnectionId,\n inputs: params.inputs,\n sourceSnapshot: definition.sourceSnapshot,\n triggerIdempotencyKey: params.triggerIdempotencyKey,\n resolveAgentDefaults,\n secrets: options.secrets,\n integrations: params.integrations,\n projects: params.projects,\n });\n}\n"],"names":["workflowModelFromSnapshot","createWorkflowRun","createAgentDefaultsResolver","DefinitionNotFoundError","ProjectMismatchError","modelHasAgentStep","runWorkflow","definitions","params","options","definition","getDefinitionForWorkflowRun","definitionId","projectId","model","resolveAgentDefaults","agent","workspaceId","workflowId","name","triggerPayload","triggerConnectionId","inputs","sourceSnapshot","triggerIdempotencyKey","secrets","integrations","projects"],"mappings":"AACA,SAAQA,yBAAyB,QAAO,+BAA+B;AAKvE,SAAQC,iBAAiB,QAAO,uBAAuB;AACvD,SAAQC,2BAA2B,QAAO,sBAAsB;AAEhE,SAAQC,uBAAuB,EAAEC,oBAAoB,QAAO,cAAc;AAC1E,SAAQC,iBAAiB,QAAO,8CAA8C;AAc9E,OAAO,eAAeC,YACpBC,WAAyC,EACzCC,MAA2D,EAC3DC,UAAiF,CAAC,CAAC;IAEnF,MAAM,EAACC,UAAU,EAAC,GAAG,MAAMH,YAAYI,2BAA2B,CAAC;QACjEC,cAAcJ,OAAOI,YAAY;IACnC;IACA,IAAI,CAACF,YAAY,MAAM,IAAIP,wBAAwBK,OAAOI,YAAY;IAEtE,IAAIF,WAAWG,SAAS,KAAKL,OAAOK,SAAS,EAAE;QAC7C,MAAM,IAAIT,qBAAqBM,WAAWG,SAAS,EAAEL,OAAOK,SAAS;IACvE;IACA,MAAMC,QAAQd,0BAA0BU,WAAWI,KAAK;IACxD,MAAMC,uBAAuBb,4BAC3BM,OAAOQ,KAAK,EACZX,kBAAkBS,SAASN,OAAOS,WAAW,GAAG;IAGlD,OAAOhB,kBAAkB;QACvBgB,aAAaT,OAAOS,WAAW;QAC/BJ,WAAWL,OAAOK,SAAS;QAC3BD,cAAcF,WAAWQ,UAAU;QACnCC,MAAMT,WAAWS,IAAI;QACrBL;QACAM,gBAAgBZ,OAAOY,cAAc;QACrCC,qBAAqBb,OAAOa,mBAAmB;QAC/CC,QAAQd,OAAOc,MAAM;QACrBC,gBAAgBb,WAAWa,cAAc;QACzCC,uBAAuBhB,OAAOgB,qBAAqB;QACnDT;QACAU,SAAShB,QAAQgB,OAAO;QACxBC,cAAclB,OAAOkB,YAAY;QACjCC,UAAUnB,OAAOmB,QAAQ;IAC3B;AACF"}
package/dist/db/db.d.ts CHANGED
@@ -140,6 +140,42 @@ export declare const schema: {
140
140
  identity: undefined;
141
141
  generated: undefined;
142
142
  }, {}, {}>;
143
+ origin: import("drizzle-orm/pg-core").PgColumn<{
144
+ name: "origin";
145
+ tableName: "workflow_runs";
146
+ dataType: "string";
147
+ columnType: "PgText";
148
+ data: string;
149
+ driverParam: string;
150
+ notNull: true;
151
+ hasDefault: true;
152
+ isPrimaryKey: false;
153
+ isAutoincrement: false;
154
+ hasRuntimeDefault: false;
155
+ enumValues: [string, ...string[]];
156
+ baseColumn: never;
157
+ identity: undefined;
158
+ generated: undefined;
159
+ }, {}, {}>;
160
+ devSource: import("drizzle-orm/pg-core").PgColumn<{
161
+ name: "dev_source";
162
+ tableName: "workflow_runs";
163
+ dataType: "json";
164
+ columnType: "PgJsonb";
165
+ data: import("./schema/workflow-runs.js").WorkflowRunDevSourceDb;
166
+ driverParam: unknown;
167
+ notNull: false;
168
+ hasDefault: false;
169
+ isPrimaryKey: false;
170
+ isAutoincrement: false;
171
+ hasRuntimeDefault: false;
172
+ enumValues: undefined;
173
+ baseColumn: never;
174
+ identity: undefined;
175
+ generated: undefined;
176
+ }, {}, {
177
+ $type: import("./schema/workflow-runs.js").WorkflowRunDevSourceDb;
178
+ }>;
143
179
  currentAttempt: import("drizzle-orm/pg-core").PgColumn<{
144
180
  name: "current_attempt";
145
181
  tableName: "workflow_runs";
@@ -2774,6 +2810,42 @@ export declare function db(): NodePgDatabase<{
2774
2810
  identity: undefined;
2775
2811
  generated: undefined;
2776
2812
  }, {}, {}>;
2813
+ origin: import("drizzle-orm/pg-core").PgColumn<{
2814
+ name: "origin";
2815
+ tableName: "workflow_runs";
2816
+ dataType: "string";
2817
+ columnType: "PgText";
2818
+ data: string;
2819
+ driverParam: string;
2820
+ notNull: true;
2821
+ hasDefault: true;
2822
+ isPrimaryKey: false;
2823
+ isAutoincrement: false;
2824
+ hasRuntimeDefault: false;
2825
+ enumValues: [string, ...string[]];
2826
+ baseColumn: never;
2827
+ identity: undefined;
2828
+ generated: undefined;
2829
+ }, {}, {}>;
2830
+ devSource: import("drizzle-orm/pg-core").PgColumn<{
2831
+ name: "dev_source";
2832
+ tableName: "workflow_runs";
2833
+ dataType: "json";
2834
+ columnType: "PgJsonb";
2835
+ data: import("./schema/workflow-runs.js").WorkflowRunDevSourceDb;
2836
+ driverParam: unknown;
2837
+ notNull: false;
2838
+ hasDefault: false;
2839
+ isPrimaryKey: false;
2840
+ isAutoincrement: false;
2841
+ hasRuntimeDefault: false;
2842
+ enumValues: undefined;
2843
+ baseColumn: never;
2844
+ identity: undefined;
2845
+ generated: undefined;
2846
+ }, {}, {
2847
+ $type: import("./schema/workflow-runs.js").WorkflowRunDevSourceDb;
2848
+ }>;
2777
2849
  currentAttempt: import("drizzle-orm/pg-core").PgColumn<{
2778
2850
  name: "current_attempt";
2779
2851
  tableName: "workflow_runs";
@@ -1 +1 @@
1
- {"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../src/db/db.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,cAAc,EAAC,MAAM,uBAAuB,CAAC;AAYnE,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAGjB;AAED,wBAAgB,OAAO,IAAI,IAAI,CAE9B;AAED,MAAM,MAAM,EAAE,GAAG,UAAU,CAAC,UAAU,CAAC,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAI5F,wBAAgB,eAAe,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAEzE"}
@@ -1,6 +1,13 @@
1
- import type { TriggerPayload, WorkflowRun, WorkflowRunTriggerReference, WorkflowSourceSnapshot } from '#core/entities/workflow-run.js';
1
+ import type { TriggerPayload, WorkflowRun, WorkflowRunOriginState, 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
+ export interface WorkflowRunDevSourceDb {
5
+ ref: string;
6
+ commit: string;
7
+ config_path: string;
8
+ initiated_by_user_id: string;
9
+ replay_of_event_id: string | null;
10
+ }
4
11
  export declare const workflowRuns: import("drizzle-orm/pg-core").PgTableWithColumns<{
5
12
  name: "workflow_runs";
6
13
  schema: undefined;
@@ -141,6 +148,42 @@ export declare const workflowRuns: import("drizzle-orm/pg-core").PgTableWithColu
141
148
  identity: undefined;
142
149
  generated: undefined;
143
150
  }, {}, {}>;
151
+ origin: import("drizzle-orm/pg-core").PgColumn<{
152
+ name: "origin";
153
+ tableName: "workflow_runs";
154
+ dataType: "string";
155
+ columnType: "PgText";
156
+ data: string;
157
+ driverParam: string;
158
+ notNull: true;
159
+ hasDefault: true;
160
+ isPrimaryKey: false;
161
+ isAutoincrement: false;
162
+ hasRuntimeDefault: false;
163
+ enumValues: [string, ...string[]];
164
+ baseColumn: never;
165
+ identity: undefined;
166
+ generated: undefined;
167
+ }, {}, {}>;
168
+ devSource: import("drizzle-orm/pg-core").PgColumn<{
169
+ name: "dev_source";
170
+ tableName: "workflow_runs";
171
+ dataType: "json";
172
+ columnType: "PgJsonb";
173
+ data: WorkflowRunDevSourceDb;
174
+ driverParam: unknown;
175
+ notNull: false;
176
+ hasDefault: false;
177
+ isPrimaryKey: false;
178
+ isAutoincrement: false;
179
+ hasRuntimeDefault: false;
180
+ enumValues: undefined;
181
+ baseColumn: never;
182
+ identity: undefined;
183
+ generated: undefined;
184
+ }, {}, {
185
+ $type: WorkflowRunDevSourceDb;
186
+ }>;
144
187
  currentAttempt: import("drizzle-orm/pg-core").PgColumn<{
145
188
  name: "current_attempt";
146
189
  tableName: "workflow_runs";
@@ -410,4 +453,5 @@ export declare const workflowRuns: import("drizzle-orm/pg-core").PgTableWithColu
410
453
  export type WorkflowRunDb = typeof workflowRuns.$inferSelect;
411
454
  export type WorkflowRunCreateDb = typeof workflowRuns.$inferInsert;
412
455
  export declare function toWorkflowRun(row: WorkflowRunDb): WorkflowRun;
456
+ export declare function toWorkflowRunOriginState(row: Pick<WorkflowRunDb, 'origin' | 'devSource'>): WorkflowRunOriginState;
413
457
  //# sourceMappingURL=workflow-runs.d.ts.map
@@ -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,2BAA2B,EAC3B,sBAAsB,EACvB,MAAM,gCAAgC,CAAC;AAGxC,eAAO,MAAM,qBAAqB,kGAMhC,CAAC;AAEH,eAAO,MAAM,wBAAwB,yDAAoD,CAAC;AAE1F,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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"}
1
+ {"version":3,"file":"workflow-runs.d.ts","sourceRoot":"","sources":["../../../src/db/schema/workflow-runs.ts"],"names":[],"mappings":"AAeA,OAA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