@shipfox/api-workflows 12.1.0 → 12.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +4 -4
- package/CHANGELOG.md +29 -0
- package/dist/core/entities/job.d.ts +1 -1
- package/dist/core/entities/job.d.ts.map +1 -1
- package/dist/core/entities/step.d.ts +2 -2
- package/dist/core/entities/step.d.ts.map +1 -1
- package/dist/core/errors.d.ts +16 -0
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +18 -0
- package/dist/core/errors.js.map +1 -1
- package/dist/core/step-config/assemble-run-context.d.ts +15 -5
- package/dist/core/step-config/assemble-run-context.d.ts.map +1 -1
- package/dist/core/step-config/assemble-run-context.js +77 -27
- package/dist/core/step-config/assemble-run-context.js.map +1 -1
- package/dist/core/step-config/fields.d.ts +5 -0
- package/dist/core/step-config/fields.d.ts.map +1 -1
- package/dist/core/step-config/fields.js +21 -3
- package/dist/core/step-config/fields.js.map +1 -1
- package/dist/core/step-config/index.d.ts +1 -1
- package/dist/core/step-config/index.d.ts.map +1 -1
- package/dist/core/step-config/index.js +1 -1
- package/dist/core/step-config/index.js.map +1 -1
- package/dist/core/step-config/job-output-limits.d.ts +11 -0
- package/dist/core/step-config/job-output-limits.d.ts.map +1 -0
- package/dist/core/step-config/job-output-limits.js +88 -0
- package/dist/core/step-config/job-output-limits.js.map +1 -0
- package/dist/core/step-config/materialize-workflow-model.d.ts +1 -1
- package/dist/core/step-config/materialize-workflow-model.d.ts.map +1 -1
- package/dist/core/step-config/materialize-workflow-model.js +41 -14
- package/dist/core/step-config/materialize-workflow-model.js.map +1 -1
- package/dist/db/db.d.ts +50 -50
- package/dist/db/job-listeners.d.ts.map +1 -1
- package/dist/db/job-listeners.js +6 -5
- package/dist/db/job-listeners.js.map +1 -1
- package/dist/db/schema/job-executions.d.ts +3 -3
- package/dist/db/schema/job-listener-events.d.ts +1 -1
- package/dist/db/schema/jobs.d.ts +7 -7
- package/dist/db/schema/outbox.d.ts +1 -1
- package/dist/db/schema/step-attempts.d.ts +2 -2
- package/dist/db/schema/steps.d.ts +5 -5
- package/dist/db/schema/workflow-run-attempts.d.ts +3 -3
- package/dist/db/schema/workflow-run-counters.d.ts +1 -1
- package/dist/db/schema/workflow-runs.d.ts +2 -2
- package/dist/db/workflow-runs/job-executions.d.ts.map +1 -1
- package/dist/db/workflow-runs/job-executions.js +4 -2
- package/dist/db/workflow-runs/job-executions.js.map +1 -1
- package/dist/db/workflow-runs/jobs.d.ts.map +1 -1
- package/dist/db/workflow-runs/jobs.js +29 -3
- package/dist/db/workflow-runs/jobs.js.map +1 -1
- package/dist/presentation/routes/project-access.d.ts +1 -1
- package/dist/temporal/activities/index.d.ts +1 -1
- package/dist/temporal/activities/index.d.ts.map +1 -1
- package/dist/temporal/activities/orchestration-activities.d.ts +1 -1
- package/dist/temporal/activities/orchestration-activities.d.ts.map +1 -1
- package/dist/temporal/workflows/test-env.d.ts +2 -2
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +16 -16
- package/src/core/errors.ts +35 -0
- package/src/core/step-config/assemble-run-context.test.ts +232 -20
- package/src/core/step-config/assemble-run-context.ts +126 -28
- package/src/core/step-config/fields.ts +42 -3
- package/src/core/step-config/index.ts +2 -0
- package/src/core/step-config/job-output-limits.ts +130 -0
- package/src/core/step-config/materialize-workflow-model.test.ts +306 -1
- package/src/core/step-config/materialize-workflow-model.ts +60 -15
- package/src/db/job-listeners.ts +14 -3
- package/src/db/workflow-runs/job-executions.test.ts +207 -1
- package/src/db/workflow-runs/job-executions.ts +15 -2
- package/src/db/workflow-runs/jobs.test.ts +49 -0
- package/src/db/workflow-runs/jobs.ts +46 -6
- package/src/db/workflow-runs/run-create.test.ts +56 -0
- package/test/factories/workflow-model.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:
|
|
3
|
-
2026-08-
|
|
2
|
+
Successfully compiled: 120 files with swc (542.19ms)
|
|
3
|
+
2026-08-06T13:12:44.796Z [INFO] asset workflow-bundle-a5487a6112facdf4dd9d.js 3.32 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 8564 ms
|
|
20
|
+
2026-08-06T13:12:44.808Z [INFO] Workflow bundle created { size: '3.32MB' }
|
|
21
21
|
/home/runner/work/shipfox/shipfox/libs/api/workflows/dist/temporal/workflows/index.js: 3476109 bytes
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# @shipfox/api-workflows
|
|
2
2
|
|
|
3
|
+
## 12.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- ce0984d: Preserve structured values when jobs map typed step outputs, normalize them for JSON persistence, and bound materialized job output sizes and entry counts.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 214b8f2: Expose execution and run numeric fields as CEL integers, preserve zero-based execution indices,
|
|
12
|
+
and keep listener filter snapshots aligned with live CEL values after persistence.
|
|
13
|
+
- Updated dependencies [78b771c]
|
|
14
|
+
- Updated dependencies [7901a60]
|
|
15
|
+
- Updated dependencies [df2ed79]
|
|
16
|
+
- Updated dependencies [ce0984d]
|
|
17
|
+
- @shipfox/api-runners-dto@12.2.0
|
|
18
|
+
- @shipfox/api-integration-core-dto@12.2.0
|
|
19
|
+
- @shipfox/api-projects-dto@12.2.0
|
|
20
|
+
- @shipfox/runner-labels@0.2.0
|
|
21
|
+
- @shipfox/expression@2.1.0
|
|
22
|
+
- @shipfox/api-workflows-dto@12.2.0
|
|
23
|
+
- @shipfox/workflow-document@3.0.1
|
|
24
|
+
- @shipfox/node-opentelemetry@0.6.4
|
|
25
|
+
- @shipfox/api-definitions-dto@12.2.0
|
|
26
|
+
- @shipfox/api-agent-dto@12.2.0
|
|
27
|
+
- @shipfox/node-fastify@0.4.2
|
|
28
|
+
- @shipfox/node-module@1.0.6
|
|
29
|
+
- @shipfox/node-temporal@0.4.5
|
|
30
|
+
- @shipfox/api-auth-context@12.2.0
|
|
31
|
+
|
|
3
32
|
## 12.1.0
|
|
4
33
|
|
|
5
34
|
### Patch Changes
|
|
@@ -9,7 +9,7 @@ export interface JobCheckout {
|
|
|
9
9
|
};
|
|
10
10
|
persistCredentials: boolean;
|
|
11
11
|
}
|
|
12
|
-
export declare const JOB_STATUS_REASONS: readonly [
|
|
12
|
+
export declare const JOB_STATUS_REASONS: readonly ['dependency_not_completed', 'condition_false', 'default_gate_rejected', 'condition_rejected', 'condition_errored', 'user_cancelled', 'run_cancelled', 'timed_out', 'runner_lost', 'step_failed', 'unknown'];
|
|
13
13
|
export type JobStatusReason = (typeof JOB_STATUS_REASONS)[number];
|
|
14
14
|
export interface Job {
|
|
15
15
|
id: string;
|
|
@@ -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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,EAAE,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,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"}
|
|
@@ -3,9 +3,9 @@ import type { EvaluationTraceEntry, EvaluationTraceLimitEntry, ResolvedField, Wo
|
|
|
3
3
|
import type { Harness } from '@shipfox/workflow-document';
|
|
4
4
|
import type { InterpolationUnresolvableField } from '../errors.js';
|
|
5
5
|
export type StepStatus = 'pending' | 'running' | 'succeeded' | 'failed' | 'cancelled' | 'skipped';
|
|
6
|
-
export declare const STEP_TYPES: readonly [
|
|
6
|
+
export declare const STEP_TYPES: readonly ['setup', 'run', 'agent', 'checkout'];
|
|
7
7
|
export type StepType = (typeof STEP_TYPES)[number];
|
|
8
|
-
export declare const STEP_STATUS_REASONS: readonly [
|
|
8
|
+
export declare const STEP_STATUS_REASONS: readonly ['default_gate_rejected', 'condition_rejected', 'condition_errored'];
|
|
9
9
|
export type StepStatusReason = (typeof STEP_STATUS_REASONS)[number];
|
|
10
10
|
export declare function toStepStatusReason(value: string | null): StepStatusReason | null;
|
|
11
11
|
export type StepAttemptLogOutcome = 'drained' | 'abandoned';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../../src/core/entities/step.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kCAAkC,EAClC,qCAAqC,EACtC,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EACV,oBAAoB,EACpB,yBAAyB,EACzB,aAAa,EACb,kBAAkB,EACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,4BAA4B,CAAC;AACxD,OAAO,KAAK,EAAC,8BAA8B,EAAC,MAAM,cAAc,CAAC;AAEjE,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,GAAG,SAAS,CAAC;AAElG,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../../src/core/entities/step.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kCAAkC,EAClC,qCAAqC,EACtC,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EACV,oBAAoB,EACpB,yBAAyB,EACzB,aAAa,EACb,kBAAkB,EACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,4BAA4B,CAAC;AACxD,OAAO,KAAK,EAAC,8BAA8B,EAAC,MAAM,cAAc,CAAC;AAEjE,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,GAAG,SAAS,CAAC;AAElG,eAAO,MAAM,UAAU,YAAI,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,CAAU,CAAC;AAEzE,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AAEnD,eAAO,MAAM,mBAAmB,YAC9B,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,CACX,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO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AAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACvC,eAAe,EAAE,SAAS,6BAA6B,EAAE,GAAG,IAAI,CAAC;IACjE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACvC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACtC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC3C,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,UAAU,EAAE,qBAAqB,GAAG,IAAI,CAAC;IACzC,SAAS,EAAE,IAAI,CAAC;IAChB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;IACxB,SAAS,EAAE,IAAI,CAAC;CACjB"}
|
package/dist/core/errors.d.ts
CHANGED
|
@@ -52,6 +52,22 @@ export declare class InvalidJobRunnerLabelsError extends Error {
|
|
|
52
52
|
readonly labels: readonly string[];
|
|
53
53
|
constructor(labels: readonly string[]);
|
|
54
54
|
}
|
|
55
|
+
export declare class JobOutputTooLargeError extends Error {
|
|
56
|
+
readonly outputKey: string;
|
|
57
|
+
readonly limitBytes: number;
|
|
58
|
+
readonly scope: 'value' | 'total';
|
|
59
|
+
constructor(outputKey: string, limitBytes: number, scope: 'value' | 'total');
|
|
60
|
+
}
|
|
61
|
+
export declare class JobOutputTooManyEntriesError extends Error {
|
|
62
|
+
readonly entryCount: number;
|
|
63
|
+
readonly limitEntries: number;
|
|
64
|
+
constructor(entryCount: number, limitEntries: number);
|
|
65
|
+
}
|
|
66
|
+
export declare class JobOutputNotJsonSafeError extends Error {
|
|
67
|
+
readonly outputKey: string;
|
|
68
|
+
readonly reason: string;
|
|
69
|
+
constructor(outputKey: string, reason: string);
|
|
70
|
+
}
|
|
55
71
|
export declare class JobNotActiveError extends Error {
|
|
56
72
|
readonly jobId: string;
|
|
57
73
|
readonly status: JobStatus;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,4BAA4B,CAAC;AAElE,qBAAa,uBAAwB,SAAQ,KAAK;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,4BAA4B,CAAC;AAElE,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,YAAY,YAAY,EAAE,MAAM,EAG/B;CACF;AAED,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,YAAY,mBAAmB,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAKhE;CACF;AAED,qBAAa,uBAAwB,SAAQ,KAAK;IACpC,QAAQ,CAAC,WAAW,EAAE,MAAM;IAAxC,YAAqB,WAAW,EAAE,MAAM,EAGvC;CACF;AAED,qBAAa,qBAAsB,SAAQ,KAAK;IAClC,QAAQ,CAAC,WAAW,EAAE,MAAM;IAAxC,YAAqB,WAAW,EAAE,MAAM,EAGvC;CACF;AAED,qBAAa,sBAAuB,SAAQ,KAAK;IACnC,QAAQ,CAAC,WAAW,EAAE,MAAM;IAAxC,YAAqB,WAAW,EAAE,MAAM,EAGvC;CACF;AAED,qBAAa,4BAA6B,SAAQ,KAAK;IAEnD,QAAQ,CAAC,YAA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EAGhC;CACF;AAGD,qBAAa,6BAA8B,SAAQ,KAAK;IACtD,YAAY,MAAM,EAAE;QAAC,IAAI,EAAE,SAAS,GAAG,YAAY,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,EAGlE;CACF;AAED,qBAAa,0BAA2B,SAAQ,KAAK;IACvC,QAAQ,CAAC,MAAM,EAAE,MAAM;IAAnC,YAAqB,MAAM,EAAE,MAAM,EAGlC;CACF;AAED,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,YAAY,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAGxC;CACF;AAED,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,YAAY,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAGxC;CACF;AAKD,qBAAa,qBAAsB,SAAQ,KAAK;IAE5C,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM;IACtB,QAAQ,CAAC,eAAe,EAAE,MAAM;IAChC,QAAQ,CAAC,cAAc,EAAE,MAAM;IAJjC,YACW,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,eAAe,EAAE,MAAM,EACvB,cAAc,EAAE,MAAM,EAMhC;CACF"}
|
package/dist/core/errors.js
CHANGED
|
@@ -75,6 +75,24 @@ export class InvalidJobRunnerLabelsError extends Error {
|
|
|
75
75
|
this.name = 'InvalidJobRunnerLabelsError';
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
+
export class JobOutputTooLargeError extends Error {
|
|
79
|
+
constructor(outputKey, limitBytes, scope){
|
|
80
|
+
super(scope === 'total' ? `Job outputs exceed the ${limitBytes}-byte total limit (at "${outputKey}")` : `Job output "${outputKey}" exceeds the ${limitBytes}-byte size limit`), this.outputKey = outputKey, this.limitBytes = limitBytes, this.scope = scope;
|
|
81
|
+
this.name = 'JobOutputTooLargeError';
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
export class JobOutputTooManyEntriesError extends Error {
|
|
85
|
+
constructor(entryCount, limitEntries){
|
|
86
|
+
super(`Job outputs cannot define more than ${limitEntries} entries (found ${entryCount})`), this.entryCount = entryCount, this.limitEntries = limitEntries;
|
|
87
|
+
this.name = 'JobOutputTooManyEntriesError';
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
export class JobOutputNotJsonSafeError extends Error {
|
|
91
|
+
constructor(outputKey, reason){
|
|
92
|
+
super(`Job output "${outputKey}" cannot be persisted as JSON: ${reason}`), this.outputKey = outputKey, this.reason = reason;
|
|
93
|
+
this.name = 'JobOutputNotJsonSafeError';
|
|
94
|
+
}
|
|
95
|
+
}
|
|
78
96
|
// The job named by a lease is terminal, so it must not exchange its lease for
|
|
79
97
|
// fresh checkout credentials. Server state is the final gate, not the token.
|
|
80
98
|
export class JobNotActiveError extends Error {
|
package/dist/core/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/errors.ts"],"sourcesContent":["import type {JobStatus} from './entities/job.js';\nimport type {WorkflowRunStatus} from './entities/workflow-run.js';\n\nexport class DefinitionNotFoundError extends Error {\n constructor(definitionId: string) {\n super(`Definition not found: ${definitionId}`);\n this.name = 'DefinitionNotFoundError';\n }\n}\n\nexport class ProjectMismatchError extends Error {\n constructor(definitionProjectId: string, requestProjectId: string) {\n super(\n `Definition belongs to project ${definitionProjectId}, but request targets project ${requestProjectId}`,\n );\n this.name = 'ProjectMismatchError';\n }\n}\n\nexport class WorkspaceSuspendedError extends Error {\n constructor(readonly workspaceId: string) {\n super(`Workspace is suspended: ${workspaceId}`);\n this.name = 'WorkspaceSuspendedError';\n }\n}\n\nexport class WorkspaceDeletedError extends Error {\n constructor(readonly workspaceId: string) {\n super(`Workspace is deleted: ${workspaceId}`);\n this.name = 'WorkspaceDeletedError';\n }\n}\n\nexport class WorkspaceNotFoundError extends Error {\n constructor(readonly workspaceId: string) {\n super(`Workspace not found: ${workspaceId}`);\n this.name = 'WorkspaceNotFoundError';\n }\n}\n\nexport class AgentConfigUnresolvableError extends Error {\n constructor(\n readonly definitionId: string,\n options?: ErrorOptions | undefined,\n ) {\n super(`Agent configuration cannot be resolved for definition ${definitionId}`, options);\n this.name = 'AgentConfigUnresolvableError';\n }\n}\n\nexport class AgentIntegrationMaterializationError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'AgentIntegrationMaterializationError';\n }\n}\n\nexport type InterpolationUnresolvableField =\n | 'run'\n | 'env'\n | 'agent.prompt'\n | 'agent.model'\n | 'agent.provider'\n | 'agent.thinking'\n | 'job.runner'\n | 'job.outputs'\n | 'job.execution_name'\n | 'workflow.run_name'\n | 'step.name'\n | 'step.working_directory'\n | 'step.feedback'\n | 'checkout.project'\n | 'checkout.connection'\n | 'checkout.repository'\n | 'checkout.ref'\n | 'checkout.path';\n\nexport class InterpolationUnresolvableError extends Error {\n readonly field: InterpolationUnresolvableField;\n readonly source: string;\n readonly envKey?: string;\n\n constructor(\n readonly definitionId: string,\n params: {\n readonly field: InterpolationUnresolvableField;\n readonly source: string;\n readonly envKey?: string;\n readonly cause?: unknown;\n },\n ) {\n super(interpolationUnresolvableMessage(definitionId, params), {cause: params.cause});\n this.name = 'InterpolationUnresolvableError';\n this.field = params.field;\n this.source = params.source;\n if (params.envKey !== undefined) this.envKey = params.envKey;\n }\n}\n\nfunction interpolationUnresolvableMessage(\n definitionId: string,\n params: {\n readonly field: InterpolationUnresolvableField;\n readonly source: string;\n readonly envKey?: string;\n },\n): string {\n const envSuffix = params.envKey === undefined ? '' : ` (${params.envKey})`;\n return `Workflow interpolation cannot be resolved for definition ${definitionId}: ${params.field}${envSuffix} uses \\`${params.source}\\`. Use has(x) ? x : '' for optional references.`;\n}\n\n/**\n * True when a `runWorkflow` failure can never succeed on retry: the definition is gone or\n * the subscription points at the wrong project. Callers (e.g. the trigger dispatcher) use this\n * to skip a permanently-broken target instead of retrying it forever. Every other failure is\n * treated as transient so at-least-once delivery can converge.\n */\nexport function isPermanentRunWorkflowError(error: unknown): boolean {\n return (\n error instanceof DefinitionNotFoundError ||\n error instanceof ProjectMismatchError ||\n error instanceof AgentConfigUnresolvableError ||\n error instanceof AgentIntegrationMaterializationError ||\n error instanceof InterpolationUnresolvableError ||\n error instanceof InvalidJobRunnerLabelsError\n );\n}\n\nexport class JobNotFoundError extends Error {\n constructor(jobId: string) {\n super(`Job not found or has no steps: ${jobId}`);\n this.name = 'JobNotFoundError';\n }\n}\n\nexport class InvalidJobRunnerLabelsError extends Error {\n constructor(readonly labels: readonly string[]) {\n super(`Job runner labels are invalid: ${labels.join(', ')}`);\n this.name = 'InvalidJobRunnerLabelsError';\n }\n}\n\n// The job named by a lease is terminal, so it must not exchange its lease for\n// fresh checkout credentials. Server state is the final gate, not the token.\nexport class JobNotActiveError extends Error {\n constructor(\n readonly jobId: string,\n readonly status: JobStatus,\n ) {\n super(`Job ${jobId} is ${status} and cannot mint checkout credentials`);\n this.name = 'JobNotActiveError';\n }\n}\n\nexport class WorkflowRunNotFoundError extends Error {\n constructor(workflowRunId: string) {\n super(`Workflow run not found: ${workflowRunId}`);\n this.name = 'WorkflowRunNotFoundError';\n }\n}\n\nexport class WorkflowRunNotCancellableError extends Error {\n constructor(\n readonly workflowRunId: string,\n readonly status: WorkflowRunStatus,\n ) {\n super(`Workflow run ${workflowRunId} is ${status} and cannot be cancelled`);\n this.name = 'WorkflowRunNotCancellableError';\n }\n}\n\nexport class SourceRunNotFoundError extends Error {\n constructor(workflowRunId: string) {\n super(`Source workflow run not found: ${workflowRunId}`);\n this.name = 'SourceRunNotFoundError';\n }\n}\n\nexport class RunNotTerminalError extends Error {\n constructor(workflowRunId: string) {\n super(`Workflow run is not terminal: ${workflowRunId}`);\n this.name = 'RunNotTerminalError';\n }\n}\n\nexport class NoFailedJobsError extends Error {\n constructor(workflowRunId: string) {\n super(`Workflow run has no failed or cancelled jobs to re-run: ${workflowRunId}`);\n this.name = 'NoFailedJobsError';\n }\n}\n\n// The checkout target cannot be resolved, so there is nothing to check out.\nexport class CheckoutIntentUnresolvedError extends Error {\n constructor(target: {kind: 'project' | 'connection'; value: string}) {\n super(`Checkout intent unresolved: ${target.kind} ${target.value} not found`);\n this.name = 'CheckoutIntentUnresolvedError';\n }\n}\n\nexport class CheckoutConfigInvalidError extends Error {\n constructor(readonly stepId: string) {\n super(`Checkout config is invalid for step ${stepId}`);\n this.name = 'CheckoutConfigInvalidError';\n }\n}\n\nexport class StepNotFoundError extends Error {\n constructor(stepId: string, jobId: string) {\n super(`Step ${stepId} not found in job ${jobId}`);\n this.name = 'StepNotFoundError';\n }\n}\n\nexport class StepNotRunningError extends Error {\n constructor(stepId: string, jobId: string) {\n super(`Step ${stepId} in job ${jobId} is not running and cannot accept a result`);\n this.name = 'StepNotRunningError';\n }\n}\n\n// A report whose attempt is ahead of the step's current attempt. The host\n// allocates attempt numbers, so a runner can never report one it was not\n// dispatched: this is a protocol error, not an idempotent no-op.\nexport class StepAttemptAheadError extends Error {\n constructor(\n readonly stepId: string,\n readonly jobId: string,\n readonly reportedAttempt: number,\n readonly currentAttempt: number,\n ) {\n super(\n `Step ${stepId} in job ${jobId} reported attempt ${reportedAttempt} ahead of current attempt ${currentAttempt}`,\n );\n this.name = 'StepAttemptAheadError';\n }\n}\n"],"names":["DefinitionNotFoundError","Error","definitionId","name","ProjectMismatchError","definitionProjectId","requestProjectId","WorkspaceSuspendedError","workspaceId","WorkspaceDeletedError","WorkspaceNotFoundError","AgentConfigUnresolvableError","options","AgentIntegrationMaterializationError","message","InterpolationUnresolvableError","params","interpolationUnresolvableMessage","cause","field","source","envKey","undefined","envSuffix","isPermanentRunWorkflowError","error","InvalidJobRunnerLabelsError","JobNotFoundError","jobId","labels","join","JobNotActiveError","status","WorkflowRunNotFoundError","workflowRunId","WorkflowRunNotCancellableError","SourceRunNotFoundError","RunNotTerminalError","NoFailedJobsError","CheckoutIntentUnresolvedError","target","kind","value","CheckoutConfigInvalidError","stepId","StepNotFoundError","StepNotRunningError","StepAttemptAheadError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C,EAAEA,QAAQ,QADlCA,SAAAA;QAEnB,IAAI,CAACzC,IAAI,GAAG;IACd;AACF;AAEA,OAAO,MAAM0C,0BAA0B5C;IACrC,YAAY2C,MAAc,EAAEhB,KAAa,CAAE;QACzC,KAAK,CAAC,CAAC,KAAK,EAAEgB,OAAO,kBAAkB,EAAEhB,OAAO;QAChD,IAAI,CAACzB,IAAI,GAAG;IACd;AACF;AAEA,OAAO,MAAM2C,4BAA4B7C;IACvC,YAAY2C,MAAc,EAAEhB,KAAa,CAAE;QACzC,KAAK,CAAC,CAAC,KAAK,EAAEgB,OAAO,QAAQ,EAAEhB,MAAM,0CAA0C,CAAC;QAChF,IAAI,CAACzB,IAAI,GAAG;IACd;AACF;AAEA,0EAA0E;AAC1E,yEAAyE;AACzE,iEAAiE;AACjE,OAAO,MAAM4C,8BAA8B9C;IACzC,YACE,AAAS2C,MAAc,EACvB,AAAShB,KAAa,EACtB,AAASoB,eAAuB,EAChC,AAASC,cAAsB,CAC/B;QACA,KAAK,CACH,CAAC,KAAK,EAAEL,OAAO,QAAQ,EAAEhB,MAAM,kBAAkB,EAAEoB,gBAAgB,0BAA0B,EAAEC,gBAAgB,QANxGL,SAAAA,aACAhB,QAAAA,YACAoB,kBAAAA,sBACAC,iBAAAA;QAKT,IAAI,CAAC9C,IAAI,GAAG;IACd;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../src/core/errors.ts"],"sourcesContent":["import type {JobStatus} from './entities/job.js';\nimport type {WorkflowRunStatus} from './entities/workflow-run.js';\n\nexport class DefinitionNotFoundError extends Error {\n constructor(definitionId: string) {\n super(`Definition not found: ${definitionId}`);\n this.name = 'DefinitionNotFoundError';\n }\n}\n\nexport class ProjectMismatchError extends Error {\n constructor(definitionProjectId: string, requestProjectId: string) {\n super(\n `Definition belongs to project ${definitionProjectId}, but request targets project ${requestProjectId}`,\n );\n this.name = 'ProjectMismatchError';\n }\n}\n\nexport class WorkspaceSuspendedError extends Error {\n constructor(readonly workspaceId: string) {\n super(`Workspace is suspended: ${workspaceId}`);\n this.name = 'WorkspaceSuspendedError';\n }\n}\n\nexport class WorkspaceDeletedError extends Error {\n constructor(readonly workspaceId: string) {\n super(`Workspace is deleted: ${workspaceId}`);\n this.name = 'WorkspaceDeletedError';\n }\n}\n\nexport class WorkspaceNotFoundError extends Error {\n constructor(readonly workspaceId: string) {\n super(`Workspace not found: ${workspaceId}`);\n this.name = 'WorkspaceNotFoundError';\n }\n}\n\nexport class AgentConfigUnresolvableError extends Error {\n constructor(\n readonly definitionId: string,\n options?: ErrorOptions | undefined,\n ) {\n super(`Agent configuration cannot be resolved for definition ${definitionId}`, options);\n this.name = 'AgentConfigUnresolvableError';\n }\n}\n\nexport class AgentIntegrationMaterializationError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'AgentIntegrationMaterializationError';\n }\n}\n\nexport type InterpolationUnresolvableField =\n | 'run'\n | 'env'\n | 'agent.prompt'\n | 'agent.model'\n | 'agent.provider'\n | 'agent.thinking'\n | 'job.runner'\n | 'job.outputs'\n | 'job.execution_name'\n | 'workflow.run_name'\n | 'step.name'\n | 'step.working_directory'\n | 'step.feedback'\n | 'checkout.project'\n | 'checkout.connection'\n | 'checkout.repository'\n | 'checkout.ref'\n | 'checkout.path';\n\nexport class InterpolationUnresolvableError extends Error {\n readonly field: InterpolationUnresolvableField;\n readonly source: string;\n readonly envKey?: string;\n\n constructor(\n readonly definitionId: string,\n params: {\n readonly field: InterpolationUnresolvableField;\n readonly source: string;\n readonly envKey?: string;\n readonly cause?: unknown;\n },\n ) {\n super(interpolationUnresolvableMessage(definitionId, params), {cause: params.cause});\n this.name = 'InterpolationUnresolvableError';\n this.field = params.field;\n this.source = params.source;\n if (params.envKey !== undefined) this.envKey = params.envKey;\n }\n}\n\nfunction interpolationUnresolvableMessage(\n definitionId: string,\n params: {\n readonly field: InterpolationUnresolvableField;\n readonly source: string;\n readonly envKey?: string;\n },\n): string {\n const envSuffix = params.envKey === undefined ? '' : ` (${params.envKey})`;\n return `Workflow interpolation cannot be resolved for definition ${definitionId}: ${params.field}${envSuffix} uses \\`${params.source}\\`. Use has(x) ? x : '' for optional references.`;\n}\n\n/**\n * True when a `runWorkflow` failure can never succeed on retry: the definition is gone or\n * the subscription points at the wrong project. Callers (e.g. the trigger dispatcher) use this\n * to skip a permanently-broken target instead of retrying it forever. Every other failure is\n * treated as transient so at-least-once delivery can converge.\n */\nexport function isPermanentRunWorkflowError(error: unknown): boolean {\n return (\n error instanceof DefinitionNotFoundError ||\n error instanceof ProjectMismatchError ||\n error instanceof AgentConfigUnresolvableError ||\n error instanceof AgentIntegrationMaterializationError ||\n error instanceof InterpolationUnresolvableError ||\n error instanceof InvalidJobRunnerLabelsError\n );\n}\n\nexport class JobNotFoundError extends Error {\n constructor(jobId: string) {\n super(`Job not found or has no steps: ${jobId}`);\n this.name = 'JobNotFoundError';\n }\n}\n\nexport class InvalidJobRunnerLabelsError extends Error {\n constructor(readonly labels: readonly string[]) {\n super(`Job runner labels are invalid: ${labels.join(', ')}`);\n this.name = 'InvalidJobRunnerLabelsError';\n }\n}\n\nexport class JobOutputTooLargeError extends Error {\n constructor(\n readonly outputKey: string,\n readonly limitBytes: number,\n readonly scope: 'value' | 'total',\n ) {\n super(\n scope === 'total'\n ? `Job outputs exceed the ${limitBytes}-byte total limit (at \"${outputKey}\")`\n : `Job output \"${outputKey}\" exceeds the ${limitBytes}-byte size limit`,\n );\n this.name = 'JobOutputTooLargeError';\n }\n}\n\nexport class JobOutputTooManyEntriesError extends Error {\n constructor(\n readonly entryCount: number,\n readonly limitEntries: number,\n ) {\n super(`Job outputs cannot define more than ${limitEntries} entries (found ${entryCount})`);\n this.name = 'JobOutputTooManyEntriesError';\n }\n}\n\nexport class JobOutputNotJsonSafeError extends Error {\n constructor(\n readonly outputKey: string,\n readonly reason: string,\n ) {\n super(`Job output \"${outputKey}\" cannot be persisted as JSON: ${reason}`);\n this.name = 'JobOutputNotJsonSafeError';\n }\n}\n\n// The job named by a lease is terminal, so it must not exchange its lease for\n// fresh checkout credentials. Server state is the final gate, not the token.\nexport class JobNotActiveError extends Error {\n constructor(\n readonly jobId: string,\n readonly status: JobStatus,\n ) {\n super(`Job ${jobId} is ${status} and cannot mint checkout credentials`);\n this.name = 'JobNotActiveError';\n }\n}\n\nexport class WorkflowRunNotFoundError extends Error {\n constructor(workflowRunId: string) {\n super(`Workflow run not found: ${workflowRunId}`);\n this.name = 'WorkflowRunNotFoundError';\n }\n}\n\nexport class WorkflowRunNotCancellableError extends Error {\n constructor(\n readonly workflowRunId: string,\n readonly status: WorkflowRunStatus,\n ) {\n super(`Workflow run ${workflowRunId} is ${status} and cannot be cancelled`);\n this.name = 'WorkflowRunNotCancellableError';\n }\n}\n\nexport class SourceRunNotFoundError extends Error {\n constructor(workflowRunId: string) {\n super(`Source workflow run not found: ${workflowRunId}`);\n this.name = 'SourceRunNotFoundError';\n }\n}\n\nexport class RunNotTerminalError extends Error {\n constructor(workflowRunId: string) {\n super(`Workflow run is not terminal: ${workflowRunId}`);\n this.name = 'RunNotTerminalError';\n }\n}\n\nexport class NoFailedJobsError extends Error {\n constructor(workflowRunId: string) {\n super(`Workflow run has no failed or cancelled jobs to re-run: ${workflowRunId}`);\n this.name = 'NoFailedJobsError';\n }\n}\n\n// The checkout target cannot be resolved, so there is nothing to check out.\nexport class CheckoutIntentUnresolvedError extends Error {\n constructor(target: {kind: 'project' | 'connection'; value: string}) {\n super(`Checkout intent unresolved: ${target.kind} ${target.value} not found`);\n this.name = 'CheckoutIntentUnresolvedError';\n }\n}\n\nexport class CheckoutConfigInvalidError extends Error {\n constructor(readonly stepId: string) {\n super(`Checkout config is invalid for step ${stepId}`);\n this.name = 'CheckoutConfigInvalidError';\n }\n}\n\nexport class StepNotFoundError extends Error {\n constructor(stepId: string, jobId: string) {\n super(`Step ${stepId} not found in job ${jobId}`);\n this.name = 'StepNotFoundError';\n }\n}\n\nexport class StepNotRunningError extends Error {\n constructor(stepId: string, jobId: string) {\n super(`Step ${stepId} in job ${jobId} is not running and cannot accept a result`);\n this.name = 'StepNotRunningError';\n }\n}\n\n// A report whose attempt is ahead of the step's current attempt. The host\n// allocates attempt numbers, so a runner can never report one it was not\n// dispatched: this is a protocol error, not an idempotent no-op.\nexport class StepAttemptAheadError extends Error {\n constructor(\n readonly stepId: string,\n readonly jobId: string,\n readonly reportedAttempt: number,\n readonly currentAttempt: number,\n ) {\n super(\n `Step ${stepId} in job ${jobId} reported attempt ${reportedAttempt} ahead of current attempt ${currentAttempt}`,\n );\n this.name = 'StepAttemptAheadError';\n }\n}\n"],"names":["DefinitionNotFoundError","Error","definitionId","name","ProjectMismatchError","definitionProjectId","requestProjectId","WorkspaceSuspendedError","workspaceId","WorkspaceDeletedError","WorkspaceNotFoundError","AgentConfigUnresolvableError","options","AgentIntegrationMaterializationError","message","InterpolationUnresolvableError","params","interpolationUnresolvableMessage","cause","field","source","envKey","undefined","envSuffix","isPermanentRunWorkflowError","error","InvalidJobRunnerLabelsError","JobNotFoundError","jobId","labels","join","JobOutputTooLargeError","outputKey","limitBytes","scope","JobOutputTooManyEntriesError","entryCount","limitEntries","JobOutputNotJsonSafeError","reason","JobNotActiveError","status","WorkflowRunNotFoundError","workflowRunId","WorkflowRunNotCancellableError","SourceRunNotFoundError","RunNotTerminalError","NoFailedJobsError","CheckoutIntentUnresolvedError","target","kind","value","CheckoutConfigInvalidError","stepId","StepNotFoundError","StepNotRunningError","StepAttemptAheadError","reportedAttempt","currentAttempt"],"mappings":"AAGA,OAAO,MAAMA,gCAAgCC;IAC3C,YAAYC,YAAoB,CAAE;QAChC,KAAK,CAAC,CAAC,sBAAsB,EAAEA,cAAc;QAC7C,IAAI,CAACC,IAAI,GAAG;IACd;AACF;AAEA,OAAO,MAAMC,6BAA6BH;IACxC,YAAYI,mBAA2B,EAAEC,gBAAwB,CAAE;QACjE,KAAK,CACH,CAAC,8BAA8B,EAAED,oBAAoB,8BAA8B,EAAEC,kBAAkB;QAEzG,IAAI,CAACH,IAAI,GAAG;I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KT,IAAI,CAACvD,IAAI,GAAG;IACd;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type WorkflowExpressionEvaluationContext, type WorkflowPredicateContextRoot } from '@shipfox/expression';
|
|
1
|
+
import { type ExpressionType, type WorkflowExpressionEvaluationContext, type WorkflowPredicateContextRoot } from '@shipfox/expression';
|
|
2
2
|
import type { Job, JobListeningTrigger } from '#core/entities/job.js';
|
|
3
3
|
import type { JobExecution } from '#core/entities/job-execution.js';
|
|
4
4
|
import type { Step, StepAttempt, StepStatus } from '#core/entities/step.js';
|
|
@@ -6,8 +6,13 @@ import type { TriggerPayload, WorkflowRun, WorkflowRunTriggerReference } from '#
|
|
|
6
6
|
import type { WorkflowEvaluationContext } from './workflow-evaluation-context.js';
|
|
7
7
|
export interface JobContextInput {
|
|
8
8
|
readonly job: Pick<Job, 'key' | 'status' | 'outputs'>;
|
|
9
|
+
readonly outputTypes?: Readonly<Record<string, ExpressionType>>;
|
|
9
10
|
readonly executions: readonly JobExecution[];
|
|
10
11
|
}
|
|
12
|
+
export interface AssembleJobsContextOptions {
|
|
13
|
+
readonly skipTypedOutputRehydration?: boolean;
|
|
14
|
+
readonly skipCelNativeRehydration?: boolean;
|
|
15
|
+
}
|
|
11
16
|
export interface AssembleWorkflowRunContextParams {
|
|
12
17
|
readonly run: Pick<WorkflowRun, 'id' | 'number' | 'name' | 'workflowName' | 'definitionId' | 'projectId' | 'workspaceId' | 'createdAt'> & {
|
|
13
18
|
readonly triggerReference?: WorkflowRunTriggerReference | null | undefined;
|
|
@@ -16,7 +21,9 @@ export interface AssembleWorkflowRunContextParams {
|
|
|
16
21
|
readonly inputs?: Record<string, unknown> | null | undefined;
|
|
17
22
|
readonly vars?: Record<string, string> | undefined;
|
|
18
23
|
}
|
|
19
|
-
|
|
24
|
+
interface AssembleContextOptions extends AssembleJobsContextOptions {
|
|
25
|
+
}
|
|
26
|
+
export declare function assembleWorkflowRunContext(params: AssembleWorkflowRunContextParams, options?: AssembleContextOptions): WorkflowExpressionEvaluationContext;
|
|
20
27
|
export declare function assembleCreationContext(params: AssembleWorkflowRunContextParams): WorkflowEvaluationContext;
|
|
21
28
|
export interface AssembleExecutionCreationContextParams extends AssembleWorkflowRunContextParams {
|
|
22
29
|
readonly job: Pick<Job, 'id' | 'key' | 'name'>;
|
|
@@ -32,8 +39,8 @@ export declare function assembleExecutionCreationContext(params: AssembleExecuti
|
|
|
32
39
|
* Keeps job-success predicate values aligned with the registry's `executions`
|
|
33
40
|
* type environment.
|
|
34
41
|
*/
|
|
35
|
-
export declare function assembleExecutionsContext(executions: readonly JobExecution[]): WorkflowExpressionEvaluationContext;
|
|
36
|
-
export declare function assembleJobsContext(jobs: readonly JobContextInput[]): WorkflowExpressionEvaluationContext & {
|
|
42
|
+
export declare function assembleExecutionsContext(executions: readonly JobExecution[], outputTypes?: Readonly<Record<string, ExpressionType>>, options?: AssembleContextOptions): WorkflowExpressionEvaluationContext;
|
|
43
|
+
export declare function assembleJobsContext(jobs: readonly JobContextInput[], options?: AssembleJobsContextOptions): WorkflowExpressionEvaluationContext & {
|
|
37
44
|
readonly jobs: Record<string, unknown>;
|
|
38
45
|
};
|
|
39
46
|
export interface AssembleJobActivationContextParams extends AssembleWorkflowRunContextParams {
|
|
@@ -53,6 +60,7 @@ export interface ListenerSnapshotPlan {
|
|
|
53
60
|
readonly roots: ReadonlySet<ListenerSnapshotRoot>;
|
|
54
61
|
readonly jobKeys: ReadonlySet<string>;
|
|
55
62
|
}
|
|
63
|
+
export type ListenerFilterOutputTypes = Record<string, Record<string, ExpressionType>>;
|
|
56
64
|
export declare function planListenerFilterSnapshots(params: {
|
|
57
65
|
readonly on: readonly JobListeningTrigger[];
|
|
58
66
|
readonly until: readonly JobListeningTrigger[] | null;
|
|
@@ -68,8 +76,10 @@ export declare function assembleListenerSnapshotContext(params: {
|
|
|
68
76
|
}): WorkflowExpressionEvaluationContext;
|
|
69
77
|
export type ListenerTriggerWithSnapshot = JobListeningTrigger & {
|
|
70
78
|
readonly filter_snapshot?: Record<string, unknown>;
|
|
79
|
+
readonly filter_output_types?: ListenerFilterOutputTypes;
|
|
71
80
|
};
|
|
72
|
-
export declare function applyListenerFilterSnapshots(plans: readonly MatcherSnapshotPlan[], context: WorkflowExpressionEvaluationContext): ListenerTriggerWithSnapshot[];
|
|
81
|
+
export declare function applyListenerFilterSnapshots(plans: readonly MatcherSnapshotPlan[], context: WorkflowExpressionEvaluationContext, outputTypes?: ListenerFilterOutputTypes): ListenerTriggerWithSnapshot[];
|
|
82
|
+
export declare function listenerFilterOutputTypesForJobs(jobs: readonly JobContextInput[]): ListenerFilterOutputTypes;
|
|
73
83
|
export declare function assembleStepDispatchContext(params: {
|
|
74
84
|
readonly steps: readonly Step[];
|
|
75
85
|
readonly attempts: readonly StepAttempt[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assemble-run-context.d.ts","sourceRoot":"","sources":["../../../src/core/step-config/assemble-run-context.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"assemble-run-context.d.ts","sourceRoot":"","sources":["../../../src/core/step-config/assemble-run-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EAInB,KAAK,mCAAmC,EACxC,KAAK,4BAA4B,EAClC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAC,GAAG,EAAE,mBAAmB,EAAC,MAAM,uBAAuB,CAAC;AACpE,OAAO,KAAK,EAAC,YAAY,EAAyB,MAAM,iCAAiC,CAAC;AAC1F,OAAO,KAAK,EAAC,IAAI,EAAE,WAAW,EAAE,UAAU,EAAC,MAAM,wBAAwB,CAAC;AAC1E,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,2BAA2B,EAC5B,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAC,yBAAyB,EAAC,MAAM,kCAAkC,CAAC;AAEhF,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,GAAG,E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
|
2
|
-
export function assembleWorkflowRunContext(params) {
|
|
1
|
+
import { analyzeContextRootKeyAccess, extractExactContextRoots, getWorkflowPredicateContextRoots, rehydrateJsonExpressionRecord } from '@shipfox/expression';
|
|
2
|
+
export function assembleWorkflowRunContext(params, options = {}) {
|
|
3
3
|
const triggerReference = params.run.triggerReference;
|
|
4
4
|
return {
|
|
5
5
|
workflow: {
|
|
@@ -8,7 +8,7 @@ export function assembleWorkflowRunContext(params) {
|
|
|
8
8
|
},
|
|
9
9
|
run: {
|
|
10
10
|
id: params.run.id,
|
|
11
|
-
number: params.run.number,
|
|
11
|
+
number: options.skipCelNativeRehydration === true ? params.run.number : BigInt(params.run.number),
|
|
12
12
|
name: params.run.name,
|
|
13
13
|
project_id: params.run.projectId,
|
|
14
14
|
workspace_id: params.run.workspaceId,
|
|
@@ -78,27 +78,42 @@ export function assembleExecutionCreationContext(params) {
|
|
|
78
78
|
/**
|
|
79
79
|
* Keeps job-success predicate values aligned with the registry's `executions`
|
|
80
80
|
* type environment.
|
|
81
|
-
*/ export function assembleExecutionsContext(executions) {
|
|
81
|
+
*/ export function assembleExecutionsContext(executions, outputTypes, options = {}) {
|
|
82
82
|
return {
|
|
83
|
-
executions: executions.map((execution, index)=>assembleExecutionContext(execution, index))
|
|
83
|
+
executions: executions.map((execution, index)=>assembleExecutionContext(execution, index, outputTypes, options))
|
|
84
84
|
};
|
|
85
85
|
}
|
|
86
|
-
function assembleExecutionContext(execution, index) {
|
|
86
|
+
function assembleExecutionContext(execution, index, outputTypes, options = {}) {
|
|
87
|
+
const skipCelNativeRehydration = options.skipCelNativeRehydration === true;
|
|
87
88
|
return {
|
|
88
|
-
index,
|
|
89
|
+
index: skipCelNativeRehydration ? index : BigInt(index),
|
|
89
90
|
name: execution.name,
|
|
90
91
|
status: execution.status,
|
|
91
92
|
started_at: execution.startedAt,
|
|
92
93
|
finished_at: execution.finishedAt,
|
|
93
|
-
events: execution.triggerEvents,
|
|
94
|
-
outputs: execution.outputs ?? {}
|
|
94
|
+
events: skipCelNativeRehydration ? execution.triggerEvents : execution.triggerEvents.map(assembleExecutionEventContext),
|
|
95
|
+
outputs: options.skipTypedOutputRehydration === true ? execution.outputs ?? {} : rehydrateJsonExpressionRecord(execution.outputs, outputTypes)
|
|
95
96
|
};
|
|
96
97
|
}
|
|
97
|
-
|
|
98
|
+
function assembleExecutionEventContext(event) {
|
|
99
|
+
const receivedAt = new Date(event.received_at);
|
|
100
|
+
/**
|
|
101
|
+
* An unparseable stored timestamp would become an `Invalid Date`, which compares
|
|
102
|
+
* false against every CEL `timestamp` and throws on `toISOString` during template
|
|
103
|
+
* resolution. Keeping the raw value fails loudly as a type mismatch instead.
|
|
104
|
+
*/ if (Number.isNaN(receivedAt.getTime())) return {
|
|
105
|
+
...event
|
|
106
|
+
};
|
|
107
|
+
return {
|
|
108
|
+
...event,
|
|
109
|
+
received_at: receivedAt
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
export function assembleJobsContext(jobs, options = {}) {
|
|
98
113
|
return {
|
|
99
114
|
jobs: Object.fromEntries(jobs.map((input)=>[
|
|
100
115
|
input.job.key,
|
|
101
|
-
assembleJobContext(input)
|
|
116
|
+
assembleJobContext(input, options)
|
|
102
117
|
]))
|
|
103
118
|
};
|
|
104
119
|
}
|
|
@@ -108,7 +123,7 @@ export function assembleJobActivationContext(params) {
|
|
|
108
123
|
values: {
|
|
109
124
|
...assembleWorkflowRunContext(params),
|
|
110
125
|
...assembleJobsContext(params.jobs),
|
|
111
|
-
needs: params.jobs.map(assembleJobContext),
|
|
126
|
+
needs: params.jobs.map((input)=>assembleJobContext(input, {})),
|
|
112
127
|
vars: params.vars ?? {}
|
|
113
128
|
}
|
|
114
129
|
};
|
|
@@ -168,6 +183,8 @@ export function assembleListenerSnapshotContext(params) {
|
|
|
168
183
|
triggerPayload: params.triggerPayload,
|
|
169
184
|
inputs: params.inputs,
|
|
170
185
|
vars: params.vars
|
|
186
|
+
}, {
|
|
187
|
+
skipCelNativeRehydration: true
|
|
171
188
|
});
|
|
172
189
|
if (params.plan.roots.has('workflow')) context.workflow = runContext.workflow;
|
|
173
190
|
if (params.plan.roots.has('run')) context.run = runContext.run;
|
|
@@ -193,20 +210,58 @@ export function assembleListenerSnapshotContext(params) {
|
|
|
193
210
|
return context;
|
|
194
211
|
}
|
|
195
212
|
function requestedJobsContext(dependencyJobs, jobKeys) {
|
|
196
|
-
|
|
213
|
+
// Listener snapshots cross a JSON outbox boundary; their type metadata is persisted separately.
|
|
214
|
+
const options = {
|
|
215
|
+
skipCelNativeRehydration: true,
|
|
216
|
+
skipTypedOutputRehydration: true
|
|
217
|
+
};
|
|
218
|
+
if (jobKeys.size === 0) {
|
|
219
|
+
return assembleJobsContext(dependencyJobs, options).jobs;
|
|
220
|
+
}
|
|
197
221
|
const filtered = dependencyJobs.filter(({ job })=>jobKeys.has(job.key));
|
|
198
|
-
return assembleJobsContext(filtered).jobs;
|
|
222
|
+
return assembleJobsContext(filtered, options).jobs;
|
|
199
223
|
}
|
|
200
|
-
export function applyListenerFilterSnapshots(plans, context) {
|
|
224
|
+
export function applyListenerFilterSnapshots(plans, context, outputTypes) {
|
|
201
225
|
return plans.map((plan)=>{
|
|
202
226
|
const filterSnapshot = filterSnapshotForPlan(plan, context);
|
|
203
227
|
if (filterSnapshot === undefined) return plan.matcher;
|
|
228
|
+
const filterOutputTypes = filterOutputTypesForPlan(plan, context, outputTypes);
|
|
204
229
|
return {
|
|
205
230
|
...plan.matcher,
|
|
206
|
-
filter_snapshot: filterSnapshot
|
|
231
|
+
filter_snapshot: filterSnapshot,
|
|
232
|
+
...filterOutputTypes === undefined ? {} : {
|
|
233
|
+
filter_output_types: filterOutputTypes
|
|
234
|
+
}
|
|
207
235
|
};
|
|
208
236
|
});
|
|
209
237
|
}
|
|
238
|
+
export function listenerFilterOutputTypesForJobs(jobs) {
|
|
239
|
+
return Object.fromEntries(jobs.flatMap(({ job, outputTypes })=>outputTypes === undefined ? [] : [
|
|
240
|
+
[
|
|
241
|
+
job.key,
|
|
242
|
+
{
|
|
243
|
+
...outputTypes
|
|
244
|
+
}
|
|
245
|
+
]
|
|
246
|
+
]));
|
|
247
|
+
}
|
|
248
|
+
function filterOutputTypesForPlan(plan, context, outputTypes) {
|
|
249
|
+
if (outputTypes === undefined || !plan.roots.has('jobs')) return undefined;
|
|
250
|
+
const jobsSnapshot = jobsSnapshotForPlan(plan, context);
|
|
251
|
+
if (jobsSnapshot === undefined) return undefined;
|
|
252
|
+
const entries = Object.keys(jobsSnapshot).flatMap((jobKey)=>{
|
|
253
|
+
const types = outputTypes[jobKey];
|
|
254
|
+
return types === undefined ? [] : [
|
|
255
|
+
[
|
|
256
|
+
jobKey,
|
|
257
|
+
{
|
|
258
|
+
...types
|
|
259
|
+
}
|
|
260
|
+
]
|
|
261
|
+
];
|
|
262
|
+
});
|
|
263
|
+
return entries.length === 0 ? undefined : Object.fromEntries(entries);
|
|
264
|
+
}
|
|
210
265
|
function filterSnapshotForPlan(plan, context) {
|
|
211
266
|
const snapshot = {};
|
|
212
267
|
for (const root of plan.roots){
|
|
@@ -237,12 +292,13 @@ function jobsSnapshotForPlan(plan, context) {
|
|
|
237
292
|
] : []));
|
|
238
293
|
return snapshot;
|
|
239
294
|
}
|
|
240
|
-
function assembleJobContext({ job, executions }) {
|
|
295
|
+
function assembleJobContext({ job, outputTypes, executions }, options) {
|
|
296
|
+
const outputs = options.skipTypedOutputRehydration === true ? job.outputs ?? {} : rehydrateJsonExpressionRecord(job.outputs, outputTypes);
|
|
241
297
|
return {
|
|
242
298
|
key: job.key,
|
|
243
299
|
status: job.status,
|
|
244
|
-
outputs
|
|
245
|
-
executions: assembleExecutionsContext(executions).executions
|
|
300
|
+
outputs,
|
|
301
|
+
executions: assembleExecutionsContext(executions, options.skipTypedOutputRehydration === true ? undefined : outputTypes, options).executions
|
|
246
302
|
};
|
|
247
303
|
}
|
|
248
304
|
function assembleStepsContext(params) {
|
|
@@ -300,14 +356,8 @@ export function assembleStepDispatchContext(params) {
|
|
|
300
356
|
...assembleJobsContext(params.jobs ?? []),
|
|
301
357
|
...params.jobExecution === undefined ? {} : {
|
|
302
358
|
execution: {
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
status: params.jobExecution.status,
|
|
306
|
-
failed: stepAttemptContext.stepsFailed,
|
|
307
|
-
started_at: params.jobExecution.startedAt,
|
|
308
|
-
finished_at: params.jobExecution.finishedAt,
|
|
309
|
-
events: params.jobExecution.triggerEvents,
|
|
310
|
-
outputs: params.jobExecution.outputs ?? {}
|
|
359
|
+
...assembleExecutionContext(params.jobExecution, params.jobExecution.sequence - 1),
|
|
360
|
+
failed: stepAttemptContext.stepsFailed
|
|
311
361
|
}
|
|
312
362
|
},
|
|
313
363
|
...targetStep === undefined ? {} : {
|