@shipfox/api-workflows 13.1.0 → 15.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.
- package/.turbo/turbo-build.log +4 -4
- package/CHANGELOG.md +61 -0
- package/README.md +12 -5
- package/dist/core/checkout.d.ts +4 -2
- package/dist/core/checkout.d.ts.map +1 -1
- package/dist/core/checkout.js +7 -2
- package/dist/core/checkout.js.map +1 -1
- package/dist/core/entities/job.d.ts +1 -1
- package/dist/core/entities/job.d.ts.map +1 -1
- package/dist/core/entities/job.js.map +1 -1
- package/dist/core/entities/workflow-run.d.ts +25 -6
- package/dist/core/entities/workflow-run.d.ts.map +1 -1
- package/dist/core/entities/workflow-run.js.map +1 -1
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/run-workflow.d.ts +26 -1
- package/dist/core/run-workflow.d.ts.map +1 -1
- package/dist/core/run-workflow.js +27 -1
- package/dist/core/run-workflow.js.map +1 -1
- package/dist/db/db.d.ts +72 -0
- package/dist/db/db.d.ts.map +1 -1
- package/dist/db/schema/workflow-runs.d.ts +45 -1
- package/dist/db/schema/workflow-runs.d.ts.map +1 -1
- package/dist/db/schema/workflow-runs.js +42 -1
- package/dist/db/schema/workflow-runs.js.map +1 -1
- package/dist/db/workflow-runs/jobs.d.ts +3 -1
- package/dist/db/workflow-runs/jobs.d.ts.map +1 -1
- package/dist/db/workflow-runs/jobs.js +12 -3
- package/dist/db/workflow-runs/jobs.js.map +1 -1
- package/dist/db/workflow-runs/queries.d.ts +3 -2
- package/dist/db/workflow-runs/queries.d.ts.map +1 -1
- package/dist/db/workflow-runs/queries.js +3 -0
- package/dist/db/workflow-runs/queries.js.map +1 -1
- package/dist/db/workflow-runs/run-create.d.ts +4 -1
- package/dist/db/workflow-runs/run-create.d.ts.map +1 -1
- package/dist/db/workflow-runs/run-create.js +14 -1
- package/dist/db/workflow-runs/run-create.js.map +1 -1
- package/dist/presentation/dto/workflow-run.d.ts.map +1 -1
- package/dist/presentation/dto/workflow-run.js +14 -0
- package/dist/presentation/dto/workflow-run.js.map +1 -1
- package/dist/presentation/inter-module.d.ts +1 -0
- package/dist/presentation/inter-module.d.ts.map +1 -1
- package/dist/presentation/inter-module.js +41 -4
- package/dist/presentation/inter-module.js.map +1 -1
- package/dist/presentation/routes/checkout-token.d.ts.map +1 -1
- package/dist/presentation/routes/checkout-token.js +2 -1
- package/dist/presentation/routes/checkout-token.js.map +1 -1
- package/dist/presentation/routes/get-run-aggregates.d.ts.map +1 -1
- package/dist/presentation/routes/get-run-aggregates.js +2 -1
- package/dist/presentation/routes/get-run-aggregates.js.map +1 -1
- package/dist/presentation/routes/leased-step.d.ts +3 -1
- package/dist/presentation/routes/leased-step.d.ts.map +1 -1
- package/dist/presentation/routes/leased-step.js +2 -1
- package/dist/presentation/routes/leased-step.js.map +1 -1
- package/dist/presentation/routes/list-runs.d.ts.map +1 -1
- package/dist/presentation/routes/list-runs.js +2 -1
- package/dist/presentation/routes/list-runs.js.map +1 -1
- package/dist/presentation/routes/project-access.d.ts +1 -0
- package/dist/presentation/routes/project-access.d.ts.map +1 -1
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/drizzle/0004_dev_run_origin.sql +12 -0
- package/drizzle/meta/0004_snapshot.json +1773 -0
- package/drizzle/meta/_journal.json +7 -0
- package/package.json +16 -16
- package/src/core/checkout.test.ts +198 -1
- package/src/core/checkout.ts +18 -5
- package/src/core/entities/job.ts +1 -1
- package/src/core/entities/workflow-run.ts +26 -6
- package/src/core/index.ts +2 -2
- package/src/core/job-transition/decide-job-activation.test.ts +2 -0
- package/src/core/run-workflow.test.ts +151 -3
- package/src/core/run-workflow.ts +59 -3
- package/src/core/workflow-run-creation.test.ts +2 -0
- package/src/db/job-listeners.test.ts +17 -0
- package/src/db/schema/workflow-runs.ts +58 -0
- package/src/db/workflow-runs/jobs.ts +17 -3
- package/src/db/workflow-runs/queries.ts +6 -1
- package/src/db/workflow-runs/run-create.test.ts +87 -0
- package/src/db/workflow-runs/run-create.ts +23 -1
- package/src/presentation/dto/workflow-run.ts +23 -1
- package/src/presentation/inter-module.test.ts +131 -1
- package/src/presentation/inter-module.ts +48 -3
- package/src/presentation/routes/checkout-token.test.ts +45 -0
- package/src/presentation/routes/checkout-token.ts +2 -1
- package/src/presentation/routes/get-run-aggregates.test.ts +56 -0
- package/src/presentation/routes/get-run-aggregates.ts +2 -0
- package/src/presentation/routes/get-step-secrets.test.ts +1 -0
- package/src/presentation/routes/leased-step.ts +7 -1
- package/src/presentation/routes/list-runs.test.ts +152 -0
- package/src/presentation/routes/list-runs.ts +2 -0
- package/test/factories/workflow-run.ts +2 -0
- package/tsconfig.build.tsbuildinfo +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
$ shipfox-swc && shipfox-temporal-bundle dist/temporal/workflows/index.js
|
|
2
|
-
Successfully compiled: 123 files with swc (
|
|
3
|
-
2026-08-
|
|
2
|
+
Successfully compiled: 123 files with swc (636.77ms)
|
|
3
|
+
2026-08-24T12:31:39.373Z [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
|
|
20
|
-
2026-08-
|
|
19
|
+
webpack 5.107.2 compiled successfully in 5437 ms
|
|
20
|
+
2026-08-24T12:31:39.386Z [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,66 @@
|
|
|
1
1
|
# @shipfox/api-workflows
|
|
2
2
|
|
|
3
|
+
## 15.0.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- af095a4: Adds the `startDevRun` inter-module method that creates a workflow run from an inline model and snapshot with `origin: 'dev'` and dev provenance, numbered by the workflow lineage id. Manual `subscriptionId` and cron `scheduleId` trigger payload fields become optional so a dev trigger can fire without a subscription row.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [a7804a8]
|
|
12
|
+
- Updated dependencies [af095a4]
|
|
13
|
+
- Updated dependencies [07410fe]
|
|
14
|
+
- Updated dependencies [989eb11]
|
|
15
|
+
- Updated dependencies [b7d522a]
|
|
16
|
+
- Updated dependencies [050b796]
|
|
17
|
+
- Updated dependencies [0b6addb]
|
|
18
|
+
- @shipfox/api-definitions-dto@15.0.0
|
|
19
|
+
- @shipfox/api-workflows-dto@15.0.0
|
|
20
|
+
- @shipfox/api-agent-dto@15.0.0
|
|
21
|
+
- @shipfox/expression@2.3.0
|
|
22
|
+
- @shipfox/workflow-document@3.2.0
|
|
23
|
+
- @shipfox/api-integration-core-dto@15.0.0
|
|
24
|
+
- @shipfox/node-opentelemetry@0.6.5
|
|
25
|
+
- @shipfox/api-auth-dto@15.0.0
|
|
26
|
+
- @shipfox/api-projects-dto@15.0.0
|
|
27
|
+
- @shipfox/api-workspaces-dto@15.0.0
|
|
28
|
+
- @shipfox/node-fastify@0.4.3
|
|
29
|
+
- @shipfox/node-module@1.0.7
|
|
30
|
+
- @shipfox/node-temporal@0.4.6
|
|
31
|
+
- @shipfox/api-auth-context@15.0.0
|
|
32
|
+
|
|
33
|
+
## 14.0.0
|
|
34
|
+
|
|
35
|
+
### Minor Changes
|
|
36
|
+
|
|
37
|
+
- 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.
|
|
38
|
+
- 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.
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- 110e8dd: Numbers workflow runs by the workflow lineage id, so runs of one workflow file share a single numbering sequence across definition revisions.
|
|
43
|
+
- 5e87483: Validates workflow run provenance (origin and dev_source) at the API boundary; database constraints now only enforce the origin/source relationship.
|
|
44
|
+
- Updated dependencies [c0fc35b]
|
|
45
|
+
- Updated dependencies [f7b3db8]
|
|
46
|
+
- Updated dependencies [69a92c4]
|
|
47
|
+
- Updated dependencies [09924ca]
|
|
48
|
+
- Updated dependencies [4f30864]
|
|
49
|
+
- Updated dependencies [18e9bad]
|
|
50
|
+
- Updated dependencies [a4df8d9]
|
|
51
|
+
- Updated dependencies [aeaa0de]
|
|
52
|
+
- Updated dependencies [c44641f]
|
|
53
|
+
- Updated dependencies [1b71a66]
|
|
54
|
+
- Updated dependencies [b766ee3]
|
|
55
|
+
- @shipfox/api-definitions-dto@14.0.0
|
|
56
|
+
- @shipfox/api-runners-dto@14.0.0
|
|
57
|
+
- @shipfox/api-agent-dto@14.0.0
|
|
58
|
+
- @shipfox/workflow-document@3.1.0
|
|
59
|
+
- @shipfox/api-workflows-dto@14.0.0
|
|
60
|
+
- @shipfox/api-integration-core-dto@14.0.0
|
|
61
|
+
- @shipfox/api-projects-dto@14.0.0
|
|
62
|
+
- @shipfox/expression@2.2.1
|
|
63
|
+
|
|
3
64
|
## 13.1.0
|
|
4
65
|
|
|
5
66
|
### 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
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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
|
package/dist/core/checkout.d.ts
CHANGED
|
@@ -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,
|
|
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,EACV,sBAAsB,EACtB,2BAA2B,EAC5B,MAAM,gCAAgC,CAAC;AA+BxC,wBAAsB,sBAAsB,CAAC,EAC3C,IAAI,EACJ,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,GAAG,EACH,YAAY,EACZ,QAAQ,GACT,EAAE;IACD,IAAI,EAAE,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"}
|
package/dist/core/checkout.js
CHANGED
|
@@ -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
|
-
|
|
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,MAAMC,uBAAuBH,EAC1BI,MAAM,CAAC;IACNC,SAASL,EAAEM,MAAM,GAAGC,IAAI,GAAGC,QAAQ;IACnCC,YAAYT,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O;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,EAAEM,MAAM,GAAGI,GAAG,CAAC,GAAGF,QAAQ;IACtCG,YAAYX,EAAEM,MAAM,GAAGI,GAAG,CAAC,GAAGF,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CAAC;IAC/B,gBAAgB,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC1C,WAAW,EAAE,mBAAmB,EAAE,GAAG,IAAI,CAAC;IAC1C,cAAc,EAAE,mBAAmB,EAAE,GAAG,IAAI,CAAC;IAC7C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACxC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;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
|
|
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 {
|
|
@@ -22,13 +41,13 @@ export type TriggerPayload = {
|
|
|
22
41
|
source: 'manual';
|
|
23
42
|
provider?: 'manual' | undefined;
|
|
24
43
|
event: 'fire';
|
|
25
|
-
subscriptionId
|
|
44
|
+
subscriptionId?: string | undefined;
|
|
26
45
|
userId: string;
|
|
27
46
|
} | {
|
|
28
47
|
source: 'cron';
|
|
29
48
|
provider?: 'cron' | undefined;
|
|
30
49
|
event: 'tick';
|
|
31
|
-
scheduleId
|
|
50
|
+
scheduleId?: string | undefined;
|
|
32
51
|
} | {
|
|
33
52
|
source: string;
|
|
34
53
|
provider?: string | undefined;
|
|
@@ -36,7 +55,7 @@ export type TriggerPayload = {
|
|
|
36
55
|
deliveryId: string;
|
|
37
56
|
data: unknown;
|
|
38
57
|
};
|
|
39
|
-
export
|
|
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
|
|
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;AAClC,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAC,IAAI,EAAE,WAAW,EAAC,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,2BAA2B,CAAC;AAElE,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;AAE7F,MAAM,MAAM,yBAAyB,GAAG,OAAO,CAC7C,iBAAiB,EACjB,WAAW,GAAG,QAAQ,GAAG,WAAW,CACrC,CAAC;AAQF,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,iBAAiB,GACxB,MAAM,IAAI,yBAAyB,CAErC;AAED,MAAM,WAAW,2BAA2B;IAC1C,OAAO,EAAE;QAAC,EAAE,EAAE,MAAM,CAAA;KAAC,GAAG,IAAI,CAAC;IAC7B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,MAA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":["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
|
|
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 // A dev trigger has no subscription row, so the id is optional here.\n subscriptionId?: string | undefined;\n userId: string;\n }\n | {\n source: 'cron';\n provider?: 'cron' | undefined;\n event: 'tick';\n // A dev trigger has no schedule row, so the id is optional here.\n scheduleId?: string | undefined;\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"}
|
package/dist/core/index.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ export { AgentConfigUnresolvableError, AgentIntegrationMaterializationError, Def
|
|
|
6
6
|
export type { NextStep, RecordStepResultOutcome, RecordStepResultParams } from './job-execution.js';
|
|
7
7
|
export { nextStepForJob, recordStepResult } from './job-execution.js';
|
|
8
8
|
export { type DecideJobActivationInput, type DeriveJobSuccessResult, decideJobActivation, deriveJobExecutionOutputs, deriveJobSuccess, type JobActivationDecision, } from './job-transition/index.js';
|
|
9
|
-
export type { RunWorkflowParams } from './run-workflow.js';
|
|
10
|
-
export { runWorkflow } from './run-workflow.js';
|
|
9
|
+
export type { RunDevWorkflowParams, RunWorkflowParams } from './run-workflow.js';
|
|
10
|
+
export { runDevWorkflow, runWorkflow } from './run-workflow.js';
|
|
11
11
|
export { type MaterializedWorkflowJob, type MaterializedWorkflowStep, materializeWorkflowModel, modelHasAgentStep, } from './step-config/index.js';
|
|
12
12
|
export { deriveInitialJobExecutionPlan, deriveJobExecutionRunner, materializeWorkflowRunJobs, } from './workflow-run-creation.js';
|
|
13
13
|
export { type ScheduleRuntimeDagInput, scheduleRuntimeDag, } from './workflow-scheduling/index.js';
|
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAC,GAAG,EAAE,SAAS,EAAC,MAAM,mBAAmB,CAAC;AACtD,YAAY,EACV,gBAAgB,EAChB,2BAA2B,GAC5B,MAAM,kCAAkC,CAAC;AAC1C,YAAY,EAAC,IAAI,EAAE,UAAU,EAAC,MAAM,oBAAoB,CAAC;AACzD,YAAY,EACV,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,4BAA4B,EAC5B,oCAAoC,EACpC,uBAAuB,EACvB,8BAA8B,EAC9B,2BAA2B,EAC3B,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,8BAA8B,GAC/B,MAAM,aAAa,CAAC;AACrB,YAAY,EAAC,QAAQ,EAAE,uBAAuB,EAAE,sBAAsB,EAAC,MAAM,oBAAoB,CAAC;AAClG,OAAO,EAAC,cAAc,EAAE,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AACpE,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,mBAAmB,EACnB,yBAAyB,EACzB,gBAAgB,EAChB,KAAK,qBAAqB,GAC3B,MAAM,2BAA2B,CAAC;AACnC,YAAY,EAAC,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAC,GAAG,EAAE,SAAS,EAAC,MAAM,mBAAmB,CAAC;AACtD,YAAY,EACV,gBAAgB,EAChB,2BAA2B,GAC5B,MAAM,kCAAkC,CAAC;AAC1C,YAAY,EAAC,IAAI,EAAE,UAAU,EAAC,MAAM,oBAAoB,CAAC;AACzD,YAAY,EACV,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,4BAA4B,EAC5B,oCAAoC,EACpC,uBAAuB,EACvB,8BAA8B,EAC9B,2BAA2B,EAC3B,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,8BAA8B,GAC/B,MAAM,aAAa,CAAC;AACrB,YAAY,EAAC,QAAQ,EAAE,uBAAuB,EAAE,sBAAsB,EAAC,MAAM,oBAAoB,CAAC;AAClG,OAAO,EAAC,cAAc,EAAE,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AACpE,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,mBAAmB,EACnB,yBAAyB,EACzB,gBAAgB,EAChB,KAAK,qBAAqB,GAC3B,MAAM,2BAA2B,CAAC;AACnC,YAAY,EAAC,oBAAoB,EAAE,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAAC,cAAc,EAAE,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,6BAA6B,EAC7B,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,KAAK,uBAAuB,EAC5B,kBAAkB,GACnB,MAAM,gCAAgC,CAAC"}
|
package/dist/core/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { AgentConfigUnresolvableError, AgentIntegrationMaterializationError, DefinitionNotFoundError, InterpolationUnresolvableError, isPermanentRunWorkflowError, JobNotFoundError, NoFailedJobsError, ProjectMismatchError, RunNotTerminalError, SourceRunNotFoundError, StepNotFoundError, StepNotRunningError, WorkflowRunNotCancellableError } from './errors.js';
|
|
2
2
|
export { nextStepForJob, recordStepResult } from './job-execution.js';
|
|
3
3
|
export { decideJobActivation, deriveJobExecutionOutputs, deriveJobSuccess } from './job-transition/index.js';
|
|
4
|
-
export { runWorkflow } from './run-workflow.js';
|
|
4
|
+
export { runDevWorkflow, runWorkflow } from './run-workflow.js';
|
|
5
5
|
export { materializeWorkflowModel, modelHasAgentStep } from './step-config/index.js';
|
|
6
6
|
export { deriveInitialJobExecutionPlan, deriveJobExecutionRunner, materializeWorkflowRunJobs } from './workflow-run-creation.js';
|
|
7
7
|
export { scheduleRuntimeDag } from './workflow-scheduling/index.js';
|
package/dist/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/index.ts"],"sourcesContent":["export type {Job, JobStatus} from './entities/job.js';\nexport type {\n JobListenerEvent,\n JobListenerEventDisposition,\n} from './entities/job-listener-event.js';\nexport type {Step, StepStatus} from './entities/step.js';\nexport type {\n TriggerPayload,\n WorkflowRun,\n WorkflowRunStatus,\n WorkflowSourceSnapshot,\n} from './entities/workflow-run.js';\nexport {\n AgentConfigUnresolvableError,\n AgentIntegrationMaterializationError,\n DefinitionNotFoundError,\n InterpolationUnresolvableError,\n isPermanentRunWorkflowError,\n JobNotFoundError,\n NoFailedJobsError,\n ProjectMismatchError,\n RunNotTerminalError,\n SourceRunNotFoundError,\n StepNotFoundError,\n StepNotRunningError,\n WorkflowRunNotCancellableError,\n} from './errors.js';\nexport type {NextStep, RecordStepResultOutcome, RecordStepResultParams} from './job-execution.js';\nexport {nextStepForJob, recordStepResult} from './job-execution.js';\nexport {\n type DecideJobActivationInput,\n type DeriveJobSuccessResult,\n decideJobActivation,\n deriveJobExecutionOutputs,\n deriveJobSuccess,\n type JobActivationDecision,\n} from './job-transition/index.js';\nexport type {RunWorkflowParams} from './run-workflow.js';\nexport {runWorkflow} from './run-workflow.js';\nexport {\n type MaterializedWorkflowJob,\n type MaterializedWorkflowStep,\n materializeWorkflowModel,\n modelHasAgentStep,\n} from './step-config/index.js';\nexport {\n deriveInitialJobExecutionPlan,\n deriveJobExecutionRunner,\n materializeWorkflowRunJobs,\n} from './workflow-run-creation.js';\nexport {\n type ScheduleRuntimeDagInput,\n scheduleRuntimeDag,\n} from './workflow-scheduling/index.js';\n"],"names":["AgentConfigUnresolvableError","AgentIntegrationMaterializationError","DefinitionNotFoundError","InterpolationUnresolvableError","isPermanentRunWorkflowError","JobNotFoundError","NoFailedJobsError","ProjectMismatchError","RunNotTerminalError","SourceRunNotFoundError","StepNotFoundError","StepNotRunningError","WorkflowRunNotCancellableError","nextStepForJob","recordStepResult","decideJobActivation","deriveJobExecutionOutputs","deriveJobSuccess","runWorkflow","materializeWorkflowModel","modelHasAgentStep","deriveInitialJobExecutionPlan","deriveJobExecutionRunner","materializeWorkflowRunJobs","scheduleRuntimeDag"],"mappings":"AAYA,SACEA,4BAA4B,EAC5BC,oCAAoC,EACpCC,uBAAuB,EACvBC,8BAA8B,EAC9BC,2BAA2B,EAC3BC,gBAAgB,EAChBC,iBAAiB,EACjBC,oBAAoB,EACpBC,mBAAmB,EACnBC,sBAAsB,EACtBC,iBAAiB,EACjBC,mBAAmB,EACnBC,8BAA8B,QACzB,cAAc;AAErB,SAAQC,cAAc,EAAEC,gBAAgB,QAAO,qBAAqB;AACpE,SAGEC,mBAAmB,EACnBC,yBAAyB,EACzBC,gBAAgB,QAEX,4BAA4B;AAEnC,SAAQC,WAAW,QAAO,oBAAoB;
|
|
1
|
+
{"version":3,"sources":["../../src/core/index.ts"],"sourcesContent":["export type {Job, JobStatus} from './entities/job.js';\nexport type {\n JobListenerEvent,\n JobListenerEventDisposition,\n} from './entities/job-listener-event.js';\nexport type {Step, StepStatus} from './entities/step.js';\nexport type {\n TriggerPayload,\n WorkflowRun,\n WorkflowRunStatus,\n WorkflowSourceSnapshot,\n} from './entities/workflow-run.js';\nexport {\n AgentConfigUnresolvableError,\n AgentIntegrationMaterializationError,\n DefinitionNotFoundError,\n InterpolationUnresolvableError,\n isPermanentRunWorkflowError,\n JobNotFoundError,\n NoFailedJobsError,\n ProjectMismatchError,\n RunNotTerminalError,\n SourceRunNotFoundError,\n StepNotFoundError,\n StepNotRunningError,\n WorkflowRunNotCancellableError,\n} from './errors.js';\nexport type {NextStep, RecordStepResultOutcome, RecordStepResultParams} from './job-execution.js';\nexport {nextStepForJob, recordStepResult} from './job-execution.js';\nexport {\n type DecideJobActivationInput,\n type DeriveJobSuccessResult,\n decideJobActivation,\n deriveJobExecutionOutputs,\n deriveJobSuccess,\n type JobActivationDecision,\n} from './job-transition/index.js';\nexport type {RunDevWorkflowParams, RunWorkflowParams} from './run-workflow.js';\nexport {runDevWorkflow, runWorkflow} from './run-workflow.js';\nexport {\n type MaterializedWorkflowJob,\n type MaterializedWorkflowStep,\n materializeWorkflowModel,\n modelHasAgentStep,\n} from './step-config/index.js';\nexport {\n deriveInitialJobExecutionPlan,\n deriveJobExecutionRunner,\n materializeWorkflowRunJobs,\n} from './workflow-run-creation.js';\nexport {\n type ScheduleRuntimeDagInput,\n scheduleRuntimeDag,\n} from './workflow-scheduling/index.js';\n"],"names":["AgentConfigUnresolvableError","AgentIntegrationMaterializationError","DefinitionNotFoundError","InterpolationUnresolvableError","isPermanentRunWorkflowError","JobNotFoundError","NoFailedJobsError","ProjectMismatchError","RunNotTerminalError","SourceRunNotFoundError","StepNotFoundError","StepNotRunningError","WorkflowRunNotCancellableError","nextStepForJob","recordStepResult","decideJobActivation","deriveJobExecutionOutputs","deriveJobSuccess","runDevWorkflow","runWorkflow","materializeWorkflowModel","modelHasAgentStep","deriveInitialJobExecutionPlan","deriveJobExecutionRunner","materializeWorkflowRunJobs","scheduleRuntimeDag"],"mappings":"AAYA,SACEA,4BAA4B,EAC5BC,oCAAoC,EACpCC,uBAAuB,EACvBC,8BAA8B,EAC9BC,2BAA2B,EAC3BC,gBAAgB,EAChBC,iBAAiB,EACjBC,oBAAoB,EACpBC,mBAAmB,EACnBC,sBAAsB,EACtBC,iBAAiB,EACjBC,mBAAmB,EACnBC,8BAA8B,QACzB,cAAc;AAErB,SAAQC,cAAc,EAAEC,gBAAgB,QAAO,qBAAqB;AACpE,SAGEC,mBAAmB,EACnBC,yBAAyB,EACzBC,gBAAgB,QAEX,4BAA4B;AAEnC,SAAQC,cAAc,EAAEC,WAAW,QAAO,oBAAoB;AAC9D,SAGEC,wBAAwB,EACxBC,iBAAiB,QACZ,yBAAyB;AAChC,SACEC,6BAA6B,EAC7BC,wBAAwB,EACxBC,0BAA0B,QACrB,6BAA6B;AACpC,SAEEC,kBAAkB,QACb,iCAAiC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { AgentInterModuleClient } from '@shipfox/api-agent-dto/inter-module';
|
|
2
|
+
import { type WorkflowModelSnapshot } from '@shipfox/api-definitions-dto';
|
|
2
3
|
import type { DefinitionsInterModuleClient } from '@shipfox/api-definitions-dto/inter-module';
|
|
3
4
|
import type { IntegrationsModuleClient } from '@shipfox/api-integration-core-dto/inter-module';
|
|
4
5
|
import type { ProjectsModuleClient } from '@shipfox/api-projects-dto/inter-module';
|
|
5
6
|
import type { SecretsInterModuleClient } from '@shipfox/api-secrets-dto/inter-module';
|
|
6
|
-
import type { TriggerPayload, WorkflowRun } from './entities/workflow-run.js';
|
|
7
|
+
import type { TriggerPayload, WorkflowRun, WorkflowRunDevSource, WorkflowSourceSnapshot } from './entities/workflow-run.js';
|
|
7
8
|
export interface RunWorkflowParams {
|
|
8
9
|
workspaceId: string;
|
|
9
10
|
projectId: string;
|
|
@@ -20,4 +21,28 @@ export declare function runWorkflow(definitions: DefinitionsInterModuleClient, p
|
|
|
20
21
|
}, options?: {
|
|
21
22
|
secrets?: Pick<SecretsInterModuleClient, 'getVariablesByNamespace'>;
|
|
22
23
|
}): Promise<WorkflowRun>;
|
|
24
|
+
export interface RunDevWorkflowParams {
|
|
25
|
+
workspaceId: string;
|
|
26
|
+
projectId: string;
|
|
27
|
+
/** Workflow lineage id, becomes the run's definition_id. */
|
|
28
|
+
workflowId: string;
|
|
29
|
+
model: WorkflowModelSnapshot;
|
|
30
|
+
sourceSnapshot: WorkflowSourceSnapshot;
|
|
31
|
+
devSource: WorkflowRunDevSource;
|
|
32
|
+
triggerPayload: TriggerPayload;
|
|
33
|
+
triggerConnectionId?: string | undefined;
|
|
34
|
+
inputs?: Record<string, unknown> | undefined;
|
|
35
|
+
integrations?: IntegrationsModuleClient | undefined;
|
|
36
|
+
projects?: ProjectsModuleClient | undefined;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Creates a dev run from an inline model and snapshot. Unlike
|
|
40
|
+
* trigger-originated runs, dev runs do not carry an idempotency key because
|
|
41
|
+
* each call represents a distinct intent. The lineage id is used as the run's
|
|
42
|
+
* definition_id so dev runs share the workflow numbering sequence before and
|
|
43
|
+
* after the file merges.
|
|
44
|
+
*/
|
|
45
|
+
export declare function runDevWorkflow(agent: AgentInterModuleClient, params: RunDevWorkflowParams, options?: {
|
|
46
|
+
secrets?: Pick<SecretsInterModuleClient, 'getVariablesByNamespace'>;
|
|
47
|
+
}): Promise<WorkflowRun>;
|
|
23
48
|
//# sourceMappingURL=run-workflow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-workflow.d.ts","sourceRoot":"","sources":["../../src/core/run-workflow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"run-workflow.d.ts","sourceRoot":"","sources":["../../src/core/run-workflow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,qCAAqC,CAAC;AAChF,OAAO,EAAC,KAAK,qBAAqB,EAA4B,MAAM,8BAA8B,CAAC;AACnG,OAAO,KAAK,EAAC,4BAA4B,EAAC,MAAM,2CAA2C,CAAC;AAC5F,OAAO,KA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,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IAC7C,YAAY,CAAC,EAAE,wBAAwB,GAAG,SAAS,CAAC;IACpD,QAAQ,CAAC,EAAE,oBAAoB,GAAG,SAAS,CAAC;CAC7C;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,sBAAsB,EAC7B,MAAM,EAAE,oBAAoB,EAC5B,OAAO,GAAE;IAAC,OAAO,CAAC,EAAE,IAAI,CAAC,wBAAwB,EAAE,yBAAyB,CAAC,CAAA;CAAM,GAClF,OAAO,CAAC,WAAW,CAAC,CAuBtB"}
|
|
@@ -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.
|
|
19
|
+
definitionId: definition.workflowId,
|
|
20
20
|
name: definition.name,
|
|
21
21
|
model,
|
|
22
22
|
triggerPayload: params.triggerPayload,
|
|
@@ -30,5 +30,31 @@ export async function runWorkflow(definitions, params, options = {}) {
|
|
|
30
30
|
projects: params.projects
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Creates a dev run from an inline model and snapshot. Unlike
|
|
35
|
+
* trigger-originated runs, dev runs do not carry an idempotency key because
|
|
36
|
+
* each call represents a distinct intent. The lineage id is used as the run's
|
|
37
|
+
* definition_id so dev runs share the workflow numbering sequence before and
|
|
38
|
+
* after the file merges.
|
|
39
|
+
*/ export function runDevWorkflow(agent, params, options = {}) {
|
|
40
|
+
const model = workflowModelFromSnapshot(params.model);
|
|
41
|
+
const resolveAgentDefaults = createAgentDefaultsResolver(agent, modelHasAgentStep(model) ? params.workspaceId : null);
|
|
42
|
+
return createWorkflowRun({
|
|
43
|
+
workspaceId: params.workspaceId,
|
|
44
|
+
projectId: params.projectId,
|
|
45
|
+
definitionId: params.workflowId,
|
|
46
|
+
model,
|
|
47
|
+
triggerPayload: params.triggerPayload,
|
|
48
|
+
triggerConnectionId: params.triggerConnectionId,
|
|
49
|
+
inputs: params.inputs,
|
|
50
|
+
sourceSnapshot: params.sourceSnapshot,
|
|
51
|
+
origin: 'dev',
|
|
52
|
+
devSource: params.devSource,
|
|
53
|
+
resolveAgentDefaults,
|
|
54
|
+
secrets: options.secrets,
|
|
55
|
+
integrations: params.integrations,
|
|
56
|
+
projects: params.projects
|
|
57
|
+
});
|
|
58
|
+
}
|
|
33
59
|
|
|
34
60
|
//# sourceMappingURL=run-workflow.js.map
|
|
@@ -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
|
|
1
|
+
{"version":3,"sources":["../../src/core/run-workflow.ts"],"sourcesContent":["import type {AgentInterModuleClient} from '@shipfox/api-agent-dto/inter-module';\nimport {type WorkflowModelSnapshot, 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 {\n TriggerPayload,\n WorkflowRun,\n WorkflowRunDevSource,\n WorkflowSourceSnapshot,\n} 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\nexport interface RunDevWorkflowParams {\n workspaceId: string;\n projectId: string;\n /** Workflow lineage id, becomes the run's definition_id. */\n workflowId: string;\n model: WorkflowModelSnapshot;\n sourceSnapshot: WorkflowSourceSnapshot;\n devSource: WorkflowRunDevSource;\n triggerPayload: TriggerPayload;\n triggerConnectionId?: string | undefined;\n inputs?: Record<string, unknown> | undefined;\n integrations?: IntegrationsModuleClient | undefined;\n projects?: ProjectsModuleClient | undefined;\n}\n\n/**\n * Creates a dev run from an inline model and snapshot. Unlike\n * trigger-originated runs, dev runs do not carry an idempotency key because\n * each call represents a distinct intent. The lineage id is used as the run's\n * definition_id so dev runs share the workflow numbering sequence before and\n * after the file merges.\n */\nexport function runDevWorkflow(\n agent: AgentInterModuleClient,\n params: RunDevWorkflowParams,\n options: {secrets?: Pick<SecretsInterModuleClient, 'getVariablesByNamespace'>} = {},\n): Promise<WorkflowRun> {\n const model = workflowModelFromSnapshot(params.model);\n const resolveAgentDefaults = createAgentDefaultsResolver(\n agent,\n modelHasAgentStep(model) ? params.workspaceId : null,\n );\n\n return createWorkflowRun({\n workspaceId: params.workspaceId,\n projectId: params.projectId,\n definitionId: params.workflowId,\n model,\n triggerPayload: params.triggerPayload,\n triggerConnectionId: params.triggerConnectionId,\n inputs: params.inputs,\n sourceSnapshot: params.sourceSnapshot,\n origin: 'dev',\n devSource: params.devSource,\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","runDevWorkflow","origin","devSource"],"mappings":"AACA,SAAoCA,yBAAyB,QAAO,+BAA+B;AAKnG,SAAQC,iBAAiB,QAAO,uBAAuB;AACvD,SAAQC,2BAA2B,QAAO,sBAAsB;AAOhE,SAAQC,uBAAuB,EAAEC,oBAAoB,QAAO,cAAc;AAC1E,SAAQC,iBAAiB,QAAO,8CAA8C;A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