@shipfox/api-definitions 11.0.0 → 12.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +13 -12
- package/CHANGELOG.md +81 -0
- package/dist/core/entities/index.d.ts +1 -0
- package/dist/core/entities/index.d.ts.map +1 -1
- package/dist/core/entities/index.js +1 -0
- package/dist/core/entities/index.js.map +1 -1
- package/dist/core/entities/sync-state.d.ts +4 -0
- package/dist/core/entities/sync-state.d.ts.map +1 -1
- package/dist/core/entities/sync-state.js +10 -0
- package/dist/core/entities/sync-state.js.map +1 -1
- package/dist/core/entities/validation-warning.d.ts +6 -0
- package/dist/core/entities/validation-warning.d.ts.map +1 -0
- package/dist/core/entities/validation-warning.js +3 -0
- package/dist/core/entities/validation-warning.js.map +1 -0
- package/dist/core/parse-definition.d.ts +9 -7
- package/dist/core/parse-definition.d.ts.map +1 -1
- package/dist/core/parse-definition.js +14 -2
- package/dist/core/parse-definition.js.map +1 -1
- package/dist/core/sync-definitions.d.ts +2 -0
- package/dist/core/sync-definitions.d.ts.map +1 -1
- package/dist/core/sync-definitions.js +6 -5
- package/dist/core/sync-definitions.js.map +1 -1
- package/dist/core/validate-definition.d.ts +9 -5
- package/dist/core/validate-definition.d.ts.map +1 -1
- package/dist/core/validate-definition.js +23 -2
- package/dist/core/validate-definition.js.map +1 -1
- package/dist/core/workflow-model/index.d.ts +1 -1
- package/dist/core/workflow-model/index.d.ts.map +1 -1
- package/dist/core/workflow-model/index.js.map +1 -1
- package/dist/core/workflow-model/invalid-workflow-model-error.d.ts +3 -1
- package/dist/core/workflow-model/invalid-workflow-model-error.d.ts.map +1 -1
- package/dist/core/workflow-model/invalid-workflow-model-error.js.map +1 -1
- package/dist/core/workflow-model/normalize-if-condition.d.ts +0 -1
- package/dist/core/workflow-model/normalize-if-condition.d.ts.map +1 -1
- package/dist/core/workflow-model/normalize-if-condition.js +0 -1
- package/dist/core/workflow-model/normalize-if-condition.js.map +1 -1
- package/dist/core/workflow-model/normalize-job-checkout.d.ts +15 -3
- package/dist/core/workflow-model/normalize-job-checkout.d.ts.map +1 -1
- package/dist/core/workflow-model/normalize-job-checkout.js +83 -4
- package/dist/core/workflow-model/normalize-job-checkout.js.map +1 -1
- package/dist/core/workflow-model/normalize-job-listening.js +0 -1
- package/dist/core/workflow-model/normalize-job-listening.js.map +1 -1
- package/dist/core/workflow-model/normalize-job-success.d.ts.map +1 -1
- package/dist/core/workflow-model/normalize-job-success.js +0 -1
- package/dist/core/workflow-model/normalize-job-success.js.map +1 -1
- package/dist/core/workflow-model/normalize-jobs.d.ts.map +1 -1
- package/dist/core/workflow-model/normalize-jobs.js +310 -45
- package/dist/core/workflow-model/normalize-jobs.js.map +1 -1
- package/dist/core/workflow-model/normalize-step-gate.js +0 -1
- package/dist/core/workflow-model/normalize-step-gate.js.map +1 -1
- package/dist/core/workflow-model/normalize-triggers.d.ts.map +1 -1
- package/dist/core/workflow-model/normalize-triggers.js +0 -1
- package/dist/core/workflow-model/normalize-triggers.js.map +1 -1
- package/dist/core/workflow-model/normalize-workflow-document.d.ts +3 -0
- package/dist/core/workflow-model/normalize-workflow-document.d.ts.map +1 -1
- package/dist/core/workflow-model/normalize-workflow-document.js +34 -4
- package/dist/core/workflow-model/normalize-workflow-document.js.map +1 -1
- package/dist/core/workflow-model/parse-interpolation-field.d.ts +1 -1
- package/dist/core/workflow-model/parse-interpolation-field.d.ts.map +1 -1
- package/dist/core/workflow-model/parse-interpolation-field.js +27 -57
- package/dist/core/workflow-model/parse-interpolation-field.js.map +1 -1
- package/dist/core/workflow-model/validate-literal-name.d.ts +12 -0
- package/dist/core/workflow-model/validate-literal-name.d.ts.map +1 -0
- package/dist/core/workflow-model/validate-literal-name.js +36 -0
- package/dist/core/workflow-model/validate-literal-name.js.map +1 -0
- package/dist/core/workflow-model/validate-predicate-expression.d.ts +1 -2
- package/dist/core/workflow-model/validate-predicate-expression.d.ts.map +1 -1
- package/dist/core/workflow-model/validate-predicate-expression.js +31 -90
- package/dist/core/workflow-model/validate-predicate-expression.js.map +1 -1
- package/dist/core/workflow-model/validation-issue.d.ts +2 -1
- package/dist/core/workflow-model/validation-issue.d.ts.map +1 -1
- package/dist/core/workflow-model/validation-issue.js +8 -2
- package/dist/core/workflow-model/validation-issue.js.map +1 -1
- package/dist/core/workflow-model/workflow-field-label.d.ts.map +1 -1
- package/dist/core/workflow-model/workflow-field-label.js +16 -2
- package/dist/core/workflow-model/workflow-field-label.js.map +1 -1
- package/dist/db/db.d.ts +38 -0
- package/dist/db/db.d.ts.map +1 -1
- package/dist/db/schema/sync-states.d.ts +19 -0
- package/dist/db/schema/sync-states.d.ts.map +1 -1
- package/dist/db/schema/sync-states.js +3 -1
- package/dist/db/schema/sync-states.js.map +1 -1
- package/dist/db/sync-states.d.ts +2 -1
- package/dist/db/sync-states.d.ts.map +1 -1
- package/dist/db/sync-states.js +4 -0
- package/dist/db/sync-states.js.map +1 -1
- package/dist/presentation/dto/definition.d.ts.map +1 -1
- package/dist/presentation/dto/definition.js +2 -1
- package/dist/presentation/dto/definition.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/presentation/routes/validate-definition.d.ts.map +1 -1
- package/dist/presentation/routes/validate-definition.js +5 -3
- package/dist/presentation/routes/validate-definition.js.map +1 -1
- package/dist/temporal/activities/sync-activities.d.ts +6 -2
- package/dist/temporal/activities/sync-activities.d.ts.map +1 -1
- package/dist/temporal/activities/sync-activities.js +8 -1
- package/dist/temporal/activities/sync-activities.js.map +1 -1
- package/dist/temporal/workflows/definition-sync.js +4 -1
- package/dist/temporal/workflows/definition-sync.js.map +1 -1
- package/dist/temporal/workflows/index.bundle.js +9029 -3
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/drizzle/0002_lumpy_ben_parker.sql +1 -0
- package/drizzle/meta/0002_snapshot.json +534 -0
- package/drizzle/meta/_journal.json +7 -0
- package/package.json +14 -14
- package/src/core/entities/index.ts +1 -0
- package/src/core/entities/sync-state.ts +23 -0
- package/src/core/entities/validation-warning.ts +5 -0
- package/src/core/parse-definition-warnings.test.ts +33 -0
- package/src/core/parse-definition.test.ts +7 -1
- package/src/core/parse-definition.ts +28 -10
- package/src/core/sync-definitions.test.ts +39 -0
- package/src/core/sync-definitions.ts +14 -4
- package/src/core/validate-definition.test.ts +128 -0
- package/src/core/validate-definition.ts +39 -8
- package/src/core/workflow-model/README.md +2 -2
- package/src/core/workflow-model/index.ts +1 -0
- package/src/core/workflow-model/invalid-workflow-model-error.ts +8 -2
- package/src/core/workflow-model/normalize-if-condition.ts +0 -2
- package/src/core/workflow-model/normalize-job-checkout.ts +105 -8
- package/src/core/workflow-model/normalize-job-listening.ts +0 -1
- package/src/core/workflow-model/normalize-job-success.ts +0 -1
- package/src/core/workflow-model/normalize-jobs.ts +330 -49
- package/src/core/workflow-model/normalize-step-gate.ts +0 -1
- package/src/core/workflow-model/normalize-triggers.ts +0 -1
- package/src/core/workflow-model/normalize-workflow-document.test.ts +732 -185
- package/src/core/workflow-model/normalize-workflow-document.ts +29 -4
- package/src/core/workflow-model/parse-interpolation-field.ts +50 -79
- package/src/core/workflow-model/validate-literal-name.ts +64 -0
- package/src/core/workflow-model/validate-predicate-expression.test.ts +153 -15
- package/src/core/workflow-model/validate-predicate-expression.ts +52 -120
- package/src/core/workflow-model/validation-issue.ts +4 -0
- package/src/core/workflow-model/workflow-field-label.ts +16 -2
- package/src/core/workflow-yaml/README.md +2 -2
- package/src/db/schema/sync-states.ts +4 -1
- package/src/db/sync-states.test.ts +57 -0
- package/src/db/sync-states.ts +6 -0
- package/src/presentation/dto/definition.ts +1 -0
- package/src/presentation/routes/list-definitions.test.ts +1 -0
- package/src/presentation/routes/validate-definition.test.ts +1 -0
- package/src/presentation/routes/validate-definition.ts +7 -1
- package/src/temporal/activities/sync-activities.test.ts +16 -0
- package/src/temporal/activities/sync-activities.ts +18 -3
- package/src/temporal/workflows/definition-sync.ts +1 -1
- package/test/agent-validation-catalog.ts +17 -0
- package/test/fixtures/valid-listening-job.yml +2 -1
- package/tsconfig.build.tsbuildinfo +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
$ shipfox-swc && shipfox-temporal-bundle dist/temporal/workflows/index.js
|
|
2
|
-
Successfully compiled:
|
|
3
|
-
2026-
|
|
4
|
-
orphan modules
|
|
2
|
+
Successfully compiled: 74 files with swc (337.6ms)
|
|
3
|
+
2026-08-04T08:17:09.285Z [INFO] asset workflow-bundle-db3e4e474e0c4d6a3553.js 4.01 MiB [emitted] [immutable] (name: main)
|
|
4
|
+
orphan modules 322 KiB [orphan] 82 modules
|
|
5
5
|
runtime modules 1.13 KiB 5 modules
|
|
6
|
-
modules by path ../../../node_modules/.pnpm/
|
|
7
|
-
modules by path
|
|
8
|
-
modules by path
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
modules by path ../../../node_modules/.pnpm/ 1.21 MiB 214 modules
|
|
7
|
+
modules by path ../definitions-dto/dist/ 7.85 KiB
|
|
8
|
+
modules by path ../definitions-dto/dist/*.js 3.48 KiB 3 modules
|
|
9
|
+
modules by path ../definitions-dto/dist/schemas/*.js 4.37 KiB 3 modules
|
|
10
|
+
modules by path ./dist/ 5.46 KiB
|
|
11
|
+
modules by path ./dist/temporal/workflows/*.js 3.34 KiB 2 modules
|
|
11
12
|
./dist/temporal/workflows/index-autogenerated-entrypoint.cjs 936 bytes [built] [code generated]
|
|
12
|
-
./dist/core/entities/sync-state.js
|
|
13
|
+
./dist/core/entities/sync-state.js 1.2 KiB [built] [code generated]
|
|
13
14
|
optional modules 30 bytes [optional]
|
|
14
15
|
__temporal_custom_payload_converter (ignored) 15 bytes [optional] [built] [code generated]
|
|
15
16
|
__temporal_custom_failure_converter (ignored) 15 bytes [optional] [built] [code generated]
|
|
16
17
|
../../shared/node/temporal/dist/workflow-error-interceptor.js 1.21 KiB [built] [code generated]
|
|
17
|
-
webpack 5.107.2 compiled successfully in
|
|
18
|
-
2026-
|
|
19
|
-
/home/runner/work/shipfox/shipfox/libs/api/definitions/dist/temporal/workflows/index.js:
|
|
18
|
+
webpack 5.107.2 compiled successfully in 5689 ms
|
|
19
|
+
2026-08-04T08:17:09.294Z [INFO] Workflow bundle created { size: '4.01MB' }
|
|
20
|
+
/home/runner/work/shipfox/shipfox/libs/api/definitions/dist/temporal/workflows/index.js: 4207937 bytes
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,86 @@
|
|
|
1
1
|
# @shipfox/api-definitions
|
|
2
2
|
|
|
3
|
+
## 12.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 7c4116e: Align predicate property types with their runtime shapes, replace `run.run_name` with `run.workflow_name`, and remove `failed` from `executions` entries.
|
|
8
|
+
- adf07e7: Cut over workflow and job display names to literal-only `name` fields, with runtime interpolation supported through `run_name` and `execution_name`.
|
|
9
|
+
|
|
10
|
+
### Minor Changes
|
|
11
|
+
|
|
12
|
+
- ee2ce67: Accept a `${{ }}` interpolation in an agent step's `thinking` field. The schema
|
|
13
|
+
still offers the per-harness enum for editor completion, and the dispatcher
|
|
14
|
+
checks the resolved value against the harness levels. An unsupported
|
|
15
|
+
resolved level fails the step.
|
|
16
|
+
- 5d2c9cf: Carry checkout steps from workflow normalization through step materialization and surface their setup error category.
|
|
17
|
+
- 3d91d1d: Allow workflow context roots in interpolatable fields while preserving host and availability validation. Keep model and provider selection restricted to workflow-authored context so external payloads and step outputs cannot steer agent execution.
|
|
18
|
+
- 89f2c18: Expose non-fatal definition validation warnings from the `/validate` response without
|
|
19
|
+
preventing workflow synchronization. Persistence and surfacing for repo-synced definitions
|
|
20
|
+
remain a follow-up.
|
|
21
|
+
- 045895c: Remove the unused workflow context trust metadata and related public exports. Allow
|
|
22
|
+
external context in agent model and provider interpolations now that interpolation
|
|
23
|
+
fields no longer enforce source tiers.
|
|
24
|
+
- 9e1d599: Carry first-checkout intent through workflow normalization and step materialization for the upcoming runner checkout execution, including implicit-checkout suppression, checkout opt-out, and position-based primary checkout placement.
|
|
25
|
+
- 3f781ee: Add workflow run and job execution naming fields to the authoring, expression, and normalized definition contracts.
|
|
26
|
+
- 9fdd5e4: Persist definition validation warnings from repository syncs and surface them on the workflow page without changing sync success or run creation behavior.
|
|
27
|
+
- 35a42bd: Resolve run and agent step working directories against the runner job workspace.
|
|
28
|
+
- 032d316: Scope checkout credential minting to the currently running checkout step and return its fetch depth.
|
|
29
|
+
- c2a8e54: Normalize checkout target fields for step-dispatch resolution, reject unsupported job-level checkout fields, and keep the workflow model and runtime checkout contracts aligned.
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- 01c3dbc: Allow workflow variables in job, step, gate, and listener predicates while preserving the standard availability error for trigger filters.
|
|
34
|
+
- e95fdf4: Report an explicit model validation issue for checkout opt-out and checkout steps until their normalization and runtime support lands.
|
|
35
|
+
- 285fff2: Persist resolved workflow job execution names and handle dynamic naming failures consistently.
|
|
36
|
+
- 4d246d4: Align predicate validation and runtime evaluation with field-specific context contracts.
|
|
37
|
+
- 28daafe: Validate literal agent model and provider values during workflow authoring.
|
|
38
|
+
- 4444079: Warn when shell positions re-execute workflow-controlled values as code.
|
|
39
|
+
- Updated dependencies [ee2ce67]
|
|
40
|
+
- Updated dependencies [7c4116e]
|
|
41
|
+
- Updated dependencies [5d2c9cf]
|
|
42
|
+
- Updated dependencies [e95fdf4]
|
|
43
|
+
- Updated dependencies [3d91d1d]
|
|
44
|
+
- Updated dependencies [89f2c18]
|
|
45
|
+
- Updated dependencies [045895c]
|
|
46
|
+
- Updated dependencies [f78740d]
|
|
47
|
+
- Updated dependencies [9e1d599]
|
|
48
|
+
- Updated dependencies [dea1ffd]
|
|
49
|
+
- Updated dependencies [adf07e7]
|
|
50
|
+
- Updated dependencies [3f781ee]
|
|
51
|
+
- Updated dependencies [9fdd5e4]
|
|
52
|
+
- Updated dependencies [285fff2]
|
|
53
|
+
- Updated dependencies [4d246d4]
|
|
54
|
+
- Updated dependencies [4eb18b8]
|
|
55
|
+
- Updated dependencies [28daafe]
|
|
56
|
+
- Updated dependencies [f13e8bb]
|
|
57
|
+
- Updated dependencies [4444079]
|
|
58
|
+
- Updated dependencies [869a792]
|
|
59
|
+
- Updated dependencies [8cc5a36]
|
|
60
|
+
- Updated dependencies [35a42bd]
|
|
61
|
+
- Updated dependencies [d77baaa]
|
|
62
|
+
- Updated dependencies [41d558c]
|
|
63
|
+
- Updated dependencies [032d316]
|
|
64
|
+
- Updated dependencies [c2a8e54]
|
|
65
|
+
- Updated dependencies [54c820e]
|
|
66
|
+
- Updated dependencies [cb0abfa]
|
|
67
|
+
- Updated dependencies [ee2ce67]
|
|
68
|
+
- Updated dependencies [7f90b0c]
|
|
69
|
+
- @shipfox/workflow-document@3.0.0
|
|
70
|
+
- @shipfox/api-definitions-dto@12.0.0
|
|
71
|
+
- @shipfox/api-agent-dto@12.0.0
|
|
72
|
+
- @shipfox/expression@2.0.0
|
|
73
|
+
- @shipfox/inter-module@0.2.3
|
|
74
|
+
- @shipfox/node-fastify@0.4.1
|
|
75
|
+
- @shipfox/node-module@1.0.5
|
|
76
|
+
- @shipfox/api-projects-dto@12.0.0
|
|
77
|
+
- @shipfox/api-integration-core-dto@12.0.0
|
|
78
|
+
- @shipfox/node-postgres@0.5.0
|
|
79
|
+
- @shipfox/api-auth-context@12.0.0
|
|
80
|
+
- @shipfox/api-secrets-dto@12.0.0
|
|
81
|
+
- @shipfox/node-drizzle@0.3.5
|
|
82
|
+
- @shipfox/node-outbox@0.2.6
|
|
83
|
+
|
|
3
84
|
## 11.0.0
|
|
4
85
|
|
|
5
86
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/entities/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/entities/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/entities/index.ts"],"sourcesContent":["export * from './integration-context.js';\nexport * from './sync-state.js';\nexport * from './workflow-definition.js';\nexport * from './workflow-model.js';\n"],"names":[],"mappings":"AAAA,cAAc,2BAA2B;AACzC,cAAc,kBAAkB;AAChC,cAAc,2BAA2B;AACzC,cAAc,sBAAsB"}
|
|
1
|
+
{"version":3,"sources":["../../../src/core/entities/index.ts"],"sourcesContent":["export * from './integration-context.js';\nexport * from './sync-state.js';\nexport * from './validation-warning.js';\nexport * from './workflow-definition.js';\nexport * from './workflow-model.js';\n"],"names":[],"mappings":"AAAA,cAAc,2BAA2B;AACzC,cAAc,kBAAkB;AAChC,cAAc,0BAA0B;AACxC,cAAc,2BAA2B;AACzC,cAAc,sBAAsB"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import type { ValidationWarning } from './validation-warning.js';
|
|
1
2
|
export type DefinitionSyncStatus = 'pending' | 'syncing' | 'succeeded' | 'failed';
|
|
3
|
+
export type DefinitionSyncWarning = ValidationWarning;
|
|
4
|
+
export declare function limitDefinitionSyncWarnings(warnings: readonly DefinitionSyncWarning[]): DefinitionSyncWarning[];
|
|
2
5
|
export declare const DEFINITION_SYNC_ERROR_CODES: readonly ["no-workflow-files", "invalid-definition", "provider-repository-not-found", "provider-file-not-found", "provider-access-denied", "provider-rate-limited", "provider-timeout", "provider-unavailable", "provider-malformed-response", "content-too-large", "too-many-files", "connection-unavailable", "unknown"];
|
|
3
6
|
export type DefinitionSyncErrorCode = (typeof DEFINITION_SYNC_ERROR_CODES)[number];
|
|
4
7
|
export declare function isDefinitionSyncErrorCode(value: unknown): value is DefinitionSyncErrorCode;
|
|
@@ -11,6 +14,7 @@ export interface DefinitionSyncState {
|
|
|
11
14
|
status: DefinitionSyncStatus;
|
|
12
15
|
lastErrorCode: DefinitionSyncErrorCode | null;
|
|
13
16
|
lastErrorMessage: string | null;
|
|
17
|
+
warnings: DefinitionSyncWarning[];
|
|
14
18
|
startedAt: Date | null;
|
|
15
19
|
finishedAt: Date | null;
|
|
16
20
|
createdAt: Date;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-state.d.ts","sourceRoot":"","sources":["../../../src/core/entities/sync-state.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sync-state.d.ts","sourceRoot":"","sources":["../../../src/core/entities/sync-state.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,yBAAyB,CAAC;AAE/D,MAAM,MAAM,oBAAoB,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;AAElF,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,CAAC;AAEtD,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,SAAS,qBAAqB,EAAE,GACzC,qBAAqB,EAAE,CAQzB;AAED,eAAO,MAAM,2BAA2B,4TAc9B,CAAC;AAEX,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,2BAA2B,CAAC,CAAC,MAAM,CAAC,CAAC;AAEnF,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,uBAAuB,CAI1F;AAED,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,0BAA0B,EAAE,MAAM,CAAC;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,oBAAoB,CAAC;IAC7B,aAAa,EAAE,uBAAuB,GAAG,IAAI,CAAC;IAC9C,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,EAAE,qBAAqB,EAAE,CAAC;IAClC,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;IACvB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;IACxB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB"}
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
import { DEFINITION_SYNC_WARNING_CODE_MAX_LENGTH, DEFINITION_SYNC_WARNING_MESSAGE_MAX_LENGTH, DEFINITION_SYNC_WARNING_PATH_MAX_LENGTH, DEFINITION_SYNC_WARNINGS_MAX_COUNT } from '@shipfox/api-definitions-dto';
|
|
2
|
+
export function limitDefinitionSyncWarnings(warnings) {
|
|
3
|
+
return warnings.slice(0, DEFINITION_SYNC_WARNINGS_MAX_COUNT).map((warning)=>({
|
|
4
|
+
code: warning.code.slice(0, DEFINITION_SYNC_WARNING_CODE_MAX_LENGTH),
|
|
5
|
+
message: warning.message.slice(0, DEFINITION_SYNC_WARNING_MESSAGE_MAX_LENGTH),
|
|
6
|
+
...warning.path === undefined ? {} : {
|
|
7
|
+
path: warning.path.slice(0, DEFINITION_SYNC_WARNING_PATH_MAX_LENGTH)
|
|
8
|
+
}
|
|
9
|
+
}));
|
|
10
|
+
}
|
|
1
11
|
export const DEFINITION_SYNC_ERROR_CODES = [
|
|
2
12
|
'no-workflow-files',
|
|
3
13
|
'invalid-definition',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/entities/sync-state.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../../src/core/entities/sync-state.ts"],"sourcesContent":["import {\n DEFINITION_SYNC_WARNING_CODE_MAX_LENGTH,\n DEFINITION_SYNC_WARNING_MESSAGE_MAX_LENGTH,\n DEFINITION_SYNC_WARNING_PATH_MAX_LENGTH,\n DEFINITION_SYNC_WARNINGS_MAX_COUNT,\n} from '@shipfox/api-definitions-dto';\nimport type {ValidationWarning} from './validation-warning.js';\n\nexport type DefinitionSyncStatus = 'pending' | 'syncing' | 'succeeded' | 'failed';\n\nexport type DefinitionSyncWarning = ValidationWarning;\n\nexport function limitDefinitionSyncWarnings(\n warnings: readonly DefinitionSyncWarning[],\n): DefinitionSyncWarning[] {\n return warnings.slice(0, DEFINITION_SYNC_WARNINGS_MAX_COUNT).map((warning) => ({\n code: warning.code.slice(0, DEFINITION_SYNC_WARNING_CODE_MAX_LENGTH),\n message: warning.message.slice(0, DEFINITION_SYNC_WARNING_MESSAGE_MAX_LENGTH),\n ...(warning.path === undefined\n ? {}\n : {path: warning.path.slice(0, DEFINITION_SYNC_WARNING_PATH_MAX_LENGTH)}),\n }));\n}\n\nexport const DEFINITION_SYNC_ERROR_CODES = [\n 'no-workflow-files',\n 'invalid-definition',\n 'provider-repository-not-found',\n 'provider-file-not-found',\n 'provider-access-denied',\n 'provider-rate-limited',\n 'provider-timeout',\n 'provider-unavailable',\n 'provider-malformed-response',\n 'content-too-large',\n 'too-many-files',\n 'connection-unavailable',\n 'unknown',\n] as const;\n\nexport type DefinitionSyncErrorCode = (typeof DEFINITION_SYNC_ERROR_CODES)[number];\n\nexport function isDefinitionSyncErrorCode(value: unknown): value is DefinitionSyncErrorCode {\n return (\n typeof value === 'string' && (DEFINITION_SYNC_ERROR_CODES as readonly string[]).includes(value)\n );\n}\n\nexport interface DefinitionSyncState {\n id: string;\n projectId: string;\n sourceConnectionId: string;\n sourceExternalRepositoryId: string;\n ref: string;\n status: DefinitionSyncStatus;\n lastErrorCode: DefinitionSyncErrorCode | null;\n lastErrorMessage: string | null;\n warnings: DefinitionSyncWarning[];\n startedAt: Date | null;\n finishedAt: Date | null;\n createdAt: Date;\n updatedAt: Date;\n}\n"],"names":["DEFINITION_SYNC_WARNING_CODE_MAX_LENGTH","DEFINITION_SYNC_WARNING_MESSAGE_MAX_LENGTH","DEFINITION_SYNC_WARNING_PATH_MAX_LENGTH","DEFINITION_SYNC_WARNINGS_MAX_COUNT","limitDefinitionSyncWarnings","warnings","slice","map","warning","code","message","path","undefined","DEFINITION_SYNC_ERROR_CODES","isDefinitionSyncErrorCode","value","includes"],"mappings":"AAAA,SACEA,uCAAuC,EACvCC,0CAA0C,EAC1CC,uCAAuC,EACvCC,kCAAkC,QAC7B,+BAA+B;AAOtC,OAAO,SAASC,4BACdC,QAA0C;IAE1C,OAAOA,SAASC,KAAK,CAAC,GAAGH,oCAAoCI,GAAG,CAAC,CAACC,UAAa,CAAA;YAC7EC,MAAMD,QAAQC,IAAI,CAACH,KAAK,CAAC,GAAGN;YAC5BU,SAASF,QAAQE,OAAO,CAACJ,KAAK,CAAC,GAAGL;YAClC,GAAIO,QAAQG,IAAI,KAAKC,YACjB,CAAC,IACD;gBAACD,MAAMH,QAAQG,IAAI,CAACL,KAAK,CAAC,GAAGJ;YAAwC,CAAC;QAC5E,CAAA;AACF;AAEA,OAAO,MAAMW,8BAA8B;IACzC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAU;AAIX,OAAO,SAASC,0BAA0BC,KAAc;IACtD,OACE,OAAOA,UAAU,YAAY,AAACF,4BAAkDG,QAAQ,CAACD;AAE7F"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation-warning.d.ts","sourceRoot":"","sources":["../../../src/core/entities/validation-warning.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/core/entities/validation-warning.ts"],"sourcesContent":["export interface ValidationWarning {\n code: string;\n message: string;\n path?: string | undefined;\n}\n"],"names":[],"mappings":"AAAA,WAIC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { IntegrationValidationContext } from './entities/integration-context.js';
|
|
1
|
+
import type { ValidationWarning } from './entities/validation-warning.js';
|
|
3
2
|
import type { WorkflowDefinitionPayload } from './entities/workflow-definition.js';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
import { type DefinitionValidationOptions } from './validate-definition.js';
|
|
4
|
+
export interface ParsedDefinition extends WorkflowDefinitionPayload {
|
|
5
|
+
warnings: ValidationWarning[];
|
|
6
|
+
}
|
|
7
|
+
export type ParseDefinitionOptions = DefinitionValidationOptions;
|
|
8
|
+
export declare function parseDefinitionWithWarnings(yamlString: string, options: ParseDefinitionOptions): ParsedDefinition;
|
|
9
|
+
export declare function parseDefinition(yamlString: string, options: ParseDefinitionOptions): WorkflowDefinitionPayload;
|
|
10
|
+
export declare function stripDefinitionWarnings(parsed: ParsedDefinition): WorkflowDefinitionPayload;
|
|
9
11
|
//# sourceMappingURL=parse-definition.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-definition.d.ts","sourceRoot":"","sources":["../../src/core/parse-definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,
|
|
1
|
+
{"version":3,"file":"parse-definition.d.ts","sourceRoot":"","sources":["../../src/core/parse-definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,kCAAkC,CAAC;AACxE,OAAO,KAAK,EAAC,yBAAyB,EAAC,MAAM,mCAAmC,CAAC;AAEjF,OAAO,EAAC,KAAK,2BAA2B,EAAqB,MAAM,0BAA0B,CAAC;AAE9F,MAAM,WAAW,gBAAiB,SAAQ,yBAAyB;IACjE,QAAQ,EAAE,iBAAiB,EAAE,CAAC;CAC/B;AAED,MAAM,MAAM,sBAAsB,GAAG,2BAA2B,CAAC;AAEjE,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,sBAAsB,GAC9B,gBAAgB,CAelB;AAED,wBAAgB,eAAe,CAC7B,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,sBAAsB,GAC9B,yBAAyB,CAG3B;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,gBAAgB,GAAG,yBAAyB,CAM3F"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DefinitionParseError } from './errors.js';
|
|
2
2
|
import { validateDefinition } from './validate-definition.js';
|
|
3
|
-
export function
|
|
3
|
+
export function parseDefinitionWithWarnings(yamlString, options) {
|
|
4
4
|
const result = validateDefinition(yamlString, options);
|
|
5
5
|
if (!result.valid) {
|
|
6
6
|
throw new DefinitionParseError(result.errors[0]?.message ?? 'Invalid definition', result.errors);
|
|
@@ -10,7 +10,19 @@ export function parseDefinition(yamlString, options) {
|
|
|
10
10
|
sourceSnapshot: {
|
|
11
11
|
content: yamlString,
|
|
12
12
|
format: 'yaml'
|
|
13
|
-
}
|
|
13
|
+
},
|
|
14
|
+
warnings: result.warnings
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export function parseDefinition(yamlString, options) {
|
|
18
|
+
const parsed = parseDefinitionWithWarnings(yamlString, options);
|
|
19
|
+
return stripDefinitionWarnings(parsed);
|
|
20
|
+
}
|
|
21
|
+
export function stripDefinitionWarnings(parsed) {
|
|
22
|
+
return {
|
|
23
|
+
document: parsed.document,
|
|
24
|
+
model: parsed.model,
|
|
25
|
+
sourceSnapshot: parsed.sourceSnapshot ?? null
|
|
14
26
|
};
|
|
15
27
|
}
|
|
16
28
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/parse-definition.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../../src/core/parse-definition.ts"],"sourcesContent":["import type {ValidationWarning} from './entities/validation-warning.js';\nimport type {WorkflowDefinitionPayload} from './entities/workflow-definition.js';\nimport {DefinitionParseError} from './errors.js';\nimport {type DefinitionValidationOptions, validateDefinition} from './validate-definition.js';\n\nexport interface ParsedDefinition extends WorkflowDefinitionPayload {\n warnings: ValidationWarning[];\n}\n\nexport type ParseDefinitionOptions = DefinitionValidationOptions;\n\nexport function parseDefinitionWithWarnings(\n yamlString: string,\n options: ParseDefinitionOptions,\n): ParsedDefinition {\n const result = validateDefinition(yamlString, options);\n\n if (!result.valid) {\n throw new DefinitionParseError(\n result.errors[0]?.message ?? 'Invalid definition',\n result.errors,\n );\n }\n\n return {\n ...result.definition,\n sourceSnapshot: {content: yamlString, format: 'yaml'},\n warnings: result.warnings,\n };\n}\n\nexport function parseDefinition(\n yamlString: string,\n options: ParseDefinitionOptions,\n): WorkflowDefinitionPayload {\n const parsed = parseDefinitionWithWarnings(yamlString, options);\n return stripDefinitionWarnings(parsed);\n}\n\nexport function stripDefinitionWarnings(parsed: ParsedDefinition): WorkflowDefinitionPayload {\n return {\n document: parsed.document,\n model: parsed.model,\n sourceSnapshot: parsed.sourceSnapshot ?? null,\n };\n}\n"],"names":["DefinitionParseError","validateDefinition","parseDefinitionWithWarnings","yamlString","options","result","valid","errors","message","definition","sourceSnapshot","content","format","warnings","parseDefinition","parsed","stripDefinitionWarnings","document","model"],"mappings":"AAEA,SAAQA,oBAAoB,QAAO,cAAc;AACjD,SAA0CC,kBAAkB,QAAO,2BAA2B;AAQ9F,OAAO,SAASC,4BACdC,UAAkB,EAClBC,OAA+B;IAE/B,MAAMC,SAASJ,mBAAmBE,YAAYC;IAE9C,IAAI,CAACC,OAAOC,KAAK,EAAE;QACjB,MAAM,IAAIN,qBACRK,OAAOE,MAAM,CAAC,EAAE,EAAEC,WAAW,sBAC7BH,OAAOE,MAAM;IAEjB;IAEA,OAAO;QACL,GAAGF,OAAOI,UAAU;QACpBC,gBAAgB;YAACC,SAASR;YAAYS,QAAQ;QAAM;QACpDC,UAAUR,OAAOQ,QAAQ;IAC3B;AACF;AAEA,OAAO,SAASC,gBACdX,UAAkB,EAClBC,OAA+B;IAE/B,MAAMW,SAASb,4BAA4BC,YAAYC;IACvD,OAAOY,wBAAwBD;AACjC;AAEA,OAAO,SAASC,wBAAwBD,MAAwB;IAC9D,OAAO;QACLE,UAAUF,OAAOE,QAAQ;QACzBC,OAAOH,OAAOG,KAAK;QACnBR,gBAAgBK,OAAOL,cAAc,IAAI;IAC3C;AACF"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { AgentValidationCatalog } from '@shipfox/api-agent-dto/inter-module';
|
|
2
2
|
import type { IntegrationValidationContext } from './entities/integration-context.js';
|
|
3
3
|
import type { DefinitionSyncErrorCode } from './entities/sync-state.js';
|
|
4
|
+
import type { ValidationWarning } from './entities/validation-warning.js';
|
|
4
5
|
import type { WorkflowDefinitionPayload } from './entities/workflow-definition.js';
|
|
5
6
|
import type { DefinitionsSourceControl } from './integrations.js';
|
|
6
7
|
export declare const DEFAULT_WORKFLOW_PATH = ".shipfox/workflows/";
|
|
@@ -30,6 +31,7 @@ export interface ParsedWorkflow {
|
|
|
30
31
|
name: string;
|
|
31
32
|
definition: WorkflowDefinitionPayload;
|
|
32
33
|
contentHash: string;
|
|
34
|
+
warnings: ValidationWarning[];
|
|
33
35
|
}
|
|
34
36
|
export interface FetchAndParseWorkflowsParams extends SyncSourceContext {
|
|
35
37
|
ref: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-definitions.d.ts","sourceRoot":"","sources":["../../src/core/sync-definitions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,qCAAqC,CAAC;AAIhF,OAAO,KAAK,EAAC,4BAA4B,EAAC,MAAM,mCAAmC,CAAC;AACpF,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,0BAA0B,CAAC;AACtE,OAAO,KAAK,EAAC,yBAAyB,EAAC,MAAM,mCAAmC,CAAC;AAGjF,OAAO,KAAK,EAAC,wBAAw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AC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAClD,sBAAsB,EAAE,sBAAsB,CAAC;IAC/C,gCAAgC,CAAC,EAAE,CAAC,MAAM,OAAO,CAAC,4BAA4B,CAAC,CAAC,GAAG,SAAS,CAAC;CAC9F;AAED,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,4BAA4B,GACnC,OAAO,CAAC,cAAc,EAAE,CAAC,CAkD3B;AAqCD,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,uBAAuB,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,yBAAyB,CA+B7E"}
|
|
@@ -4,7 +4,7 @@ import { isInterModuleKnownError } from '@shipfox/inter-module';
|
|
|
4
4
|
import { boundedMap } from '@shipfox/node-module';
|
|
5
5
|
import { DefinitionParseError, DefinitionSyncPermanentError } from './errors.js';
|
|
6
6
|
import { hasAgentStepIntegrations } from './has-agent-step-integrations.js';
|
|
7
|
-
import {
|
|
7
|
+
import { parseDefinitionWithWarnings, stripDefinitionWarnings } from './parse-definition.js';
|
|
8
8
|
export const DEFAULT_WORKFLOW_PATH = '.shipfox/workflows/';
|
|
9
9
|
export const MAX_WORKFLOW_FILES = 100;
|
|
10
10
|
export const MAX_WORKFLOW_FILE_BYTES = 1_000_000;
|
|
@@ -78,9 +78,9 @@ export async function fetchAndParseWorkflows(params) {
|
|
|
78
78
|
}
|
|
79
79
|
function parseWorkflowSnapshot(params) {
|
|
80
80
|
try {
|
|
81
|
-
const definition = params.integrationValidationContext === undefined ?
|
|
81
|
+
const definition = params.integrationValidationContext === undefined ? parseDefinitionWithWarnings(params.content, {
|
|
82
82
|
agentValidationCatalog: params.agentValidationCatalog
|
|
83
|
-
}) :
|
|
83
|
+
}) : parseDefinitionWithWarnings(params.content, {
|
|
84
84
|
agentValidationCatalog: params.agentValidationCatalog,
|
|
85
85
|
integrationValidationContext: params.integrationValidationContext
|
|
86
86
|
});
|
|
@@ -88,8 +88,9 @@ function parseWorkflowSnapshot(params) {
|
|
|
88
88
|
return {
|
|
89
89
|
path: params.path,
|
|
90
90
|
name: definition.document.name,
|
|
91
|
-
definition,
|
|
92
|
-
contentHash
|
|
91
|
+
definition: stripDefinitionWarnings(definition),
|
|
92
|
+
contentHash,
|
|
93
|
+
warnings: definition.warnings
|
|
93
94
|
};
|
|
94
95
|
} catch (error) {
|
|
95
96
|
if (error instanceof DefinitionParseError) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/sync-definitions.ts"],"sourcesContent":["import {createHash} from 'node:crypto';\nimport type {AgentValidationCatalog} from '@shipfox/api-agent-dto/inter-module';\nimport {integrationsInterModuleContract} from '@shipfox/api-integration-core-dto/inter-module';\nimport {isInterModuleKnownError} from '@shipfox/inter-module';\nimport {boundedMap} from '@shipfox/node-module';\nimport type {IntegrationValidationContext} from './entities/integration-context.js';\nimport type {DefinitionSyncErrorCode} from './entities/sync-state.js';\nimport type {WorkflowDefinitionPayload} from './entities/workflow-definition.js';\nimport {DefinitionParseError, DefinitionSyncPermanentError} from './errors.js';\nimport {hasAgentStepIntegrations} from './has-agent-step-integrations.js';\nimport type {DefinitionsSourceControl} from './integrations.js';\nimport {parseDefinition} from './parse-definition.js';\n\nexport const DEFAULT_WORKFLOW_PATH = '.shipfox/workflows/';\nexport const MAX_WORKFLOW_FILES = 100;\nexport const MAX_WORKFLOW_FILE_BYTES = 1_000_000;\nexport const FILE_FETCH_CONCURRENCY = 4;\nexport const UNRESOLVED_SYNC_REF = '__unresolved__';\n\nexport interface SyncSourceContext {\n workspaceId: string;\n sourceConnectionId: string;\n sourceExternalRepositoryId: string;\n sourceControl: DefinitionsSourceControl;\n}\n\nexport interface ResolvedSyncSource {\n ref: string;\n}\n\nexport async function resolveSyncSource(params: SyncSourceContext): Promise<ResolvedSyncSource> {\n const source = await params.sourceControl.resolveRepository({\n workspaceId: params.workspaceId,\n connectionId: params.sourceConnectionId,\n externalRepositoryId: params.sourceExternalRepositoryId,\n });\n return {ref: source.repository.defaultBranch};\n}\n\nexport interface DiscoverWorkflowFilesParams extends SyncSourceContext {\n ref: string;\n workflowPath?: string | undefined;\n}\n\nexport async function discoverWorkflowFiles(\n params: DiscoverWorkflowFilesParams,\n): Promise<{paths: string[]}> {\n const workflowPath = params.workflowPath ?? DEFAULT_WORKFLOW_PATH;\n const page = await params.sourceControl.listFiles({\n workspaceId: params.workspaceId,\n connectionId: params.sourceConnectionId,\n externalRepositoryId: params.sourceExternalRepositoryId,\n ref: params.ref,\n prefix: workflowPath,\n limit: MAX_WORKFLOW_FILES,\n });\n if (page.nextCursor) {\n throw new DefinitionSyncPermanentError(\n 'too-many-files',\n `More than ${MAX_WORKFLOW_FILES} workflow files were found`,\n );\n }\n\n const paths = page.files\n .filter((file) => file.path.endsWith('.yml') || file.path.endsWith('.yaml'))\n .map((file) => file.path);\n if (paths.length === 0) {\n throw new DefinitionSyncPermanentError(\n 'no-workflow-files',\n `No workflow files were found under ${workflowPath}`,\n );\n }\n\n return {paths};\n}\n\nexport interface ParsedWorkflow {\n path: string;\n name: string;\n definition: WorkflowDefinitionPayload;\n contentHash: string;\n}\n\nexport interface FetchAndParseWorkflowsParams extends SyncSourceContext {\n ref: string;\n paths: string[];\n onProgress?: ((path: string) => void) | undefined;\n agentValidationCatalog: AgentValidationCatalog;\n loadIntegrationValidationContext?: (() => Promise<IntegrationValidationContext>) | undefined;\n}\n\nexport async function fetchAndParseWorkflows(\n params: FetchAndParseWorkflowsParams,\n): Promise<ParsedWorkflow[]> {\n const parsed = await boundedMap(\n params.paths,\n FILE_FETCH_CONCURRENCY,\n async (path) => {\n params.onProgress?.(path);\n\n const snapshot = await params.sourceControl.fetchFile({\n workspaceId: params.workspaceId,\n connectionId: params.sourceConnectionId,\n externalRepositoryId: params.sourceExternalRepositoryId,\n ref: params.ref,\n path,\n });\n\n if (Buffer.byteLength(snapshot.content, 'utf8') > MAX_WORKFLOW_FILE_BYTES) {\n throw new DefinitionSyncPermanentError(\n 'content-too-large',\n `Workflow file is larger than ${MAX_WORKFLOW_FILE_BYTES} bytes: ${snapshot.path}`,\n );\n }\n\n return {\n ...parseWorkflowSnapshot({\n path: snapshot.path,\n content: snapshot.content,\n agentValidationCatalog: params.agentValidationCatalog,\n }),\n rawContent: snapshot.content,\n };\n },\n {stopOnError: true},\n );\n\n if (\n !params.loadIntegrationValidationContext ||\n !parsed.some((entry) => hasAgentStepIntegrations(entry.definition.document))\n ) {\n return parsed.map(({rawContent: _rawContent, ...entry}) => entry);\n }\n\n const integrationValidationContext = await params.loadIntegrationValidationContext();\n return parsed.map((entry) =>\n parseWorkflowSnapshot({\n path: entry.path,\n content: entry.rawContent,\n agentValidationCatalog: params.agentValidationCatalog,\n integrationValidationContext,\n }),\n );\n}\n\nfunction parseWorkflowSnapshot(params: {\n path: string;\n content: string;\n integrationValidationContext?: IntegrationValidationContext | undefined;\n agentValidationCatalog: AgentValidationCatalog;\n}): ParsedWorkflow {\n try {\n const definition =\n params.integrationValidationContext === undefined\n ? parseDefinition(params.content, {agentValidationCatalog: params.agentValidationCatalog})\n : parseDefinition(params.content, {\n agentValidationCatalog: params.agentValidationCatalog,\n integrationValidationContext: params.integrationValidationContext,\n });\n const contentHash = sha256Hex(params.content);\n return {path: params.path, name: definition.document.name, definition, contentHash};\n } catch (error) {\n if (error instanceof DefinitionParseError) {\n throw new DefinitionSyncPermanentError(\n 'invalid-definition',\n `Invalid workflow definition at ${params.path}: ${error.message}`,\n );\n }\n throw error;\n }\n}\n\nexport interface SyncFailureClassification {\n code: DefinitionSyncErrorCode;\n message: string;\n retryable: boolean;\n}\n\nexport function classifySyncFailure(error: unknown): SyncFailureClassification {\n if (error instanceof DefinitionSyncPermanentError) {\n return {code: error.code, message: error.message, retryable: false};\n }\n const methods = [\n integrationsInterModuleContract.methods.resolveSourceRepository,\n integrationsInterModuleContract.methods.listSourceFiles,\n integrationsInterModuleContract.methods.fetchSourceFile,\n ] as const;\n for (const method of methods) {\n if (!isInterModuleKnownError(method, error)) continue;\n if (\n error.code === 'connection-not-found' ||\n error.code === 'connection-inactive' ||\n error.code === 'connection-workspace-mismatch'\n ) {\n return {code: 'connection-unavailable', message: error.message, retryable: false};\n }\n if (error.code === 'provider-failure') {\n return {\n code: providerErrorCode(error.details.reason),\n message: error.message,\n retryable: isProviderReasonRetryable(error.details.reason),\n };\n }\n }\n return {\n code: 'unknown',\n message: error instanceof Error ? error.message : String(error),\n retryable: true,\n };\n}\n\nfunction isProviderReasonRetryable(reason: string): boolean {\n return reason === 'rate-limited' || reason === 'timeout' || reason === 'provider-unavailable';\n}\n\nfunction providerErrorCode(reason: string): DefinitionSyncErrorCode {\n if (reason === 'repository-not-found') return 'provider-repository-not-found';\n if (reason === 'file-not-found') return 'provider-file-not-found';\n if (reason === 'access-denied') return 'provider-access-denied';\n if (reason === 'rate-limited') return 'provider-rate-limited';\n if (reason === 'timeout') return 'provider-timeout';\n if (reason === 'provider-unavailable') return 'provider-unavailable';\n if (reason === 'malformed-provider-response') return 'provider-malformed-response';\n if (reason === 'content-too-large') return 'content-too-large';\n if (reason === 'too-many-files') return 'too-many-files';\n return 'unknown';\n}\n\nfunction sha256Hex(content: string): string {\n return createHash('sha256').update(content, 'utf8').digest('hex');\n}\n"],"names":["createHash","integrationsInterModuleContract","isInterModuleKnownError","boundedMap","DefinitionParseError","DefinitionSyncPermanentError","hasAgentStepIntegrations","parseDefinition","DEFAULT_WORKFLOW_PATH","MAX_WORKFLOW_FILES","MAX_WORKFLOW_FILE_BYTES","FILE_FETCH_CONCURRENCY","UNRESOLVED_SYNC_REF","resolveSyncSource","params","source","sourceControl","resolveRepository","workspaceId","connectionId","sourceConnectionId","externalRepositoryId","sourceExternalRepositoryId","ref","repository","defaultBranch","discoverWorkflowFiles","workflowPath","page","listFiles","prefix","limit","nextCursor","paths","files","filter","file","path","endsWith","map","length","fetchAndParseWorkflows","parsed","onProgress","snapshot","fetchFile","Buffer","byteLength","content","parseWorkflowSnapshot","agentValidationCatalog","rawContent","stopOnError","loadIntegrationValidationContext","some","entry","definition","document","_rawContent","integrationValidationContext","undefined","contentHash","sha256Hex","name","error","message","classifySyncFailure","code","retryable","methods","resolveSourceRepository","listSourceFiles","fetchSourceFile","method","providerErrorCode","details","reason","isProviderReasonRetryable","Error","String","update","digest"],"mappings":"AAAA,SAAQA,UAAU,QAAO,cAAc;AAEvC,SAAQC,+BAA+B,QAAO,iDAAiD;AAC/F,SAAQC,uBAAuB,QAAO,wBAAwB;AAC9D,SAAQC,UAAU,QAAO,uBAAuB;AAIhD,SAAQC,oBAAoB,EAAEC,4BAA4B,QAAO,cAAc;AAC/E,SAAQC,wBAAwB,QAAO,mCAAmC;AAE1E,SAAQC,eAAe,QAAO,wBAAwB;AAEtD,OAAO,MAAMC,wBAAwB,sBAAsB;AAC3D,OAAO,MAAMC,qBAAqB,IAAI;AACtC,OAAO,MAAMC,0BAA0B,UAAU;AACjD,OAAO,MAAMC,yBAAyB,EAAE;AACxC,OAAO,MAAMC,sBAAsB,iBAAiB;AAapD,OAAO,eAAeC,kBAAkBC,MAAyB;IAC/D,MAAMC,SAAS,MAAMD,OAAOE,aAAa,CAACC,iBAAiB,CAAC;QAC1DC,aAAaJ,OAAOI,WAAW;QAC/BC,cAAcL,OAAOM,kBAAkB;QACvCC,sBAAsBP,OAAOQ,0BAA0B;IACzD;IACA,OAAO;QAACC,KAAKR,OAAOS,UAAU,CAACC,aAAa;IAAA;AAC9C;AAOA,OAAO,eAAeC,sBACpBZ,MAAmC;IAEnC,MAAMa,eAAeb,OAAOa,YAAY,IAAInB;IAC5C,MAAMoB,OAAO,MAAMd,OAAOE,aAAa,CAACa,SAAS,CAAC;QAChDX,aAAaJ,OAAOI,WAAW;QAC/BC,cAAcL,OAAOM,kBAAkB;QACvCC,sBAAsBP,OAAOQ,0BAA0B;QACvDC,KAAKT,OAAOS,G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ACE,eAAe;QACvDtE,gCAAgCoE,OAAO,CAACG,eAAe;KACxD;IACD,KAAK,MAAMC,UAAUJ,QAAS;QAC5B,IAAI,CAACnE,wBAAwBuE,QAAQT,QAAQ;QAC7C,IACEA,MAAMG,IAAI,KAAK,0BACfH,MAAMG,IAAI,KAAK,yBACfH,MAAMG,IAAI,KAAK,iCACf;YACA,OAAO;gBAACA,MAAM;gBAA0BF,SAASD,MAAMC,OAAO;gBAAEG,WAAW;YAAK;QAClF;QACA,IAAIJ,MAAMG,IAAI,KAAK,oBAAoB;YACrC,OAAO;gBACLA,MAAMO,kBAAkBV,MAAMW,OAAO,CAACC,MAAM;gBAC5CX,SAASD,MAAMC,OAAO;gBACtBG,WAAWS,0BAA0Bb,MAAMW,OAAO,CAACC,MAAM;YAC3D;QACF;IACF;IACA,OAAO;QACLT,MAAM;QACNF,SAASD,iBAAiBc,QAAQd,MAAMC,OAAO,GAAGc,OAAOf;QACzDI,WAAW;IACb;AACF;AAEA,SAASS,0BAA0BD,MAAc;IAC/C,OAAOA,WAAW,kBAAkBA,WAAW,aAAaA,WAAW;AACzE;AAEA,SAASF,kBAAkBE,MAAc;IACvC,IAAIA,WAAW,wBAAwB,OAAO;IAC9C,IAAIA,WAAW,kBAAkB,OAAO;IACxC,IAAIA,WAAW,iBAAiB,OAAO;IACvC,IAAIA,WAAW,gBAAgB,OAAO;IACtC,IAAIA,WAAW,WAAW,OAAO;IACjC,IAAIA,WAAW,wBAAwB,OAAO;IAC9C,IAAIA,WAAW,+BAA+B,OAAO;IACrD,IAAIA,WAAW,qBAAqB,OAAO;IAC3C,IAAIA,WAAW,kBAAkB,OAAO;IACxC,OAAO;AACT;AAEA,SAASd,UAAUd,OAAe;IAChC,OAAOhD,WAAW,UAAUgF,MAAM,CAAChC,SAAS,QAAQiC,MAAM,CAAC;AAC7D"}
|
|
1
|
+
{"version":3,"sources":["../../src/core/sync-definitions.ts"],"sourcesContent":["import {createHash} from 'node:crypto';\nimport type {AgentValidationCatalog} from '@shipfox/api-agent-dto/inter-module';\nimport {integrationsInterModuleContract} from '@shipfox/api-integration-core-dto/inter-module';\nimport {isInterModuleKnownError} from '@shipfox/inter-module';\nimport {boundedMap} from '@shipfox/node-module';\nimport type {IntegrationValidationContext} from './entities/integration-context.js';\nimport type {DefinitionSyncErrorCode} from './entities/sync-state.js';\nimport type {ValidationWarning} from './entities/validation-warning.js';\nimport type {WorkflowDefinitionPayload} from './entities/workflow-definition.js';\nimport {DefinitionParseError, DefinitionSyncPermanentError} from './errors.js';\nimport {hasAgentStepIntegrations} from './has-agent-step-integrations.js';\nimport type {DefinitionsSourceControl} from './integrations.js';\nimport {parseDefinitionWithWarnings, stripDefinitionWarnings} from './parse-definition.js';\n\nexport const DEFAULT_WORKFLOW_PATH = '.shipfox/workflows/';\nexport const MAX_WORKFLOW_FILES = 100;\nexport const MAX_WORKFLOW_FILE_BYTES = 1_000_000;\nexport const FILE_FETCH_CONCURRENCY = 4;\nexport const UNRESOLVED_SYNC_REF = '__unresolved__';\n\nexport interface SyncSourceContext {\n workspaceId: string;\n sourceConnectionId: string;\n sourceExternalRepositoryId: string;\n sourceControl: DefinitionsSourceControl;\n}\n\nexport interface ResolvedSyncSource {\n ref: string;\n}\n\nexport async function resolveSyncSource(params: SyncSourceContext): Promise<ResolvedSyncSource> {\n const source = await params.sourceControl.resolveRepository({\n workspaceId: params.workspaceId,\n connectionId: params.sourceConnectionId,\n externalRepositoryId: params.sourceExternalRepositoryId,\n });\n return {ref: source.repository.defaultBranch};\n}\n\nexport interface DiscoverWorkflowFilesParams extends SyncSourceContext {\n ref: string;\n workflowPath?: string | undefined;\n}\n\nexport async function discoverWorkflowFiles(\n params: DiscoverWorkflowFilesParams,\n): Promise<{paths: string[]}> {\n const workflowPath = params.workflowPath ?? DEFAULT_WORKFLOW_PATH;\n const page = await params.sourceControl.listFiles({\n workspaceId: params.workspaceId,\n connectionId: params.sourceConnectionId,\n externalRepositoryId: params.sourceExternalRepositoryId,\n ref: params.ref,\n prefix: workflowPath,\n limit: MAX_WORKFLOW_FILES,\n });\n if (page.nextCursor) {\n throw new DefinitionSyncPermanentError(\n 'too-many-files',\n `More than ${MAX_WORKFLOW_FILES} workflow files were found`,\n );\n }\n\n const paths = page.files\n .filter((file) => file.path.endsWith('.yml') || file.path.endsWith('.yaml'))\n .map((file) => file.path);\n if (paths.length === 0) {\n throw new DefinitionSyncPermanentError(\n 'no-workflow-files',\n `No workflow files were found under ${workflowPath}`,\n );\n }\n\n return {paths};\n}\n\nexport interface ParsedWorkflow {\n path: string;\n name: string;\n definition: WorkflowDefinitionPayload;\n contentHash: string;\n warnings: ValidationWarning[];\n}\n\nexport interface FetchAndParseWorkflowsParams extends SyncSourceContext {\n ref: string;\n paths: string[];\n onProgress?: ((path: string) => void) | undefined;\n agentValidationCatalog: AgentValidationCatalog;\n loadIntegrationValidationContext?: (() => Promise<IntegrationValidationContext>) | undefined;\n}\n\nexport async function fetchAndParseWorkflows(\n params: FetchAndParseWorkflowsParams,\n): Promise<ParsedWorkflow[]> {\n const parsed = await boundedMap(\n params.paths,\n FILE_FETCH_CONCURRENCY,\n async (path) => {\n params.onProgress?.(path);\n\n const snapshot = await params.sourceControl.fetchFile({\n workspaceId: params.workspaceId,\n connectionId: params.sourceConnectionId,\n externalRepositoryId: params.sourceExternalRepositoryId,\n ref: params.ref,\n path,\n });\n\n if (Buffer.byteLength(snapshot.content, 'utf8') > MAX_WORKFLOW_FILE_BYTES) {\n throw new DefinitionSyncPermanentError(\n 'content-too-large',\n `Workflow file is larger than ${MAX_WORKFLOW_FILE_BYTES} bytes: ${snapshot.path}`,\n );\n }\n\n return {\n ...parseWorkflowSnapshot({\n path: snapshot.path,\n content: snapshot.content,\n agentValidationCatalog: params.agentValidationCatalog,\n }),\n rawContent: snapshot.content,\n };\n },\n {stopOnError: true},\n );\n\n if (\n !params.loadIntegrationValidationContext ||\n !parsed.some((entry) => hasAgentStepIntegrations(entry.definition.document))\n ) {\n return parsed.map(({rawContent: _rawContent, ...entry}) => entry);\n }\n\n const integrationValidationContext = await params.loadIntegrationValidationContext();\n return parsed.map((entry) =>\n parseWorkflowSnapshot({\n path: entry.path,\n content: entry.rawContent,\n agentValidationCatalog: params.agentValidationCatalog,\n integrationValidationContext,\n }),\n );\n}\n\nfunction parseWorkflowSnapshot(params: {\n path: string;\n content: string;\n integrationValidationContext?: IntegrationValidationContext | undefined;\n agentValidationCatalog: AgentValidationCatalog;\n}): ParsedWorkflow {\n try {\n const definition =\n params.integrationValidationContext === undefined\n ? parseDefinitionWithWarnings(params.content, {\n agentValidationCatalog: params.agentValidationCatalog,\n })\n : parseDefinitionWithWarnings(params.content, {\n agentValidationCatalog: params.agentValidationCatalog,\n integrationValidationContext: params.integrationValidationContext,\n });\n const contentHash = sha256Hex(params.content);\n return {\n path: params.path,\n name: definition.document.name,\n definition: stripDefinitionWarnings(definition),\n contentHash,\n warnings: definition.warnings,\n };\n } catch (error) {\n if (error instanceof DefinitionParseError) {\n throw new DefinitionSyncPermanentError(\n 'invalid-definition',\n `Invalid workflow definition at ${params.path}: ${error.message}`,\n );\n }\n throw error;\n }\n}\n\nexport interface SyncFailureClassification {\n code: DefinitionSyncErrorCode;\n message: string;\n retryable: boolean;\n}\n\nexport function classifySyncFailure(error: unknown): SyncFailureClassification {\n if (error instanceof DefinitionSyncPermanentError) {\n return {code: error.code, message: error.message, retryable: false};\n }\n const methods = [\n integrationsInterModuleContract.methods.resolveSourceRepository,\n integrationsInterModuleContract.methods.listSourceFiles,\n integrationsInterModuleContract.methods.fetchSourceFile,\n ] as const;\n for (const method of methods) {\n if (!isInterModuleKnownError(method, error)) continue;\n if (\n error.code === 'connection-not-found' ||\n error.code === 'connection-inactive' ||\n error.code === 'connection-workspace-mismatch'\n ) {\n return {code: 'connection-unavailable', message: error.message, retryable: false};\n }\n if (error.code === 'provider-failure') {\n return {\n code: providerErrorCode(error.details.reason),\n message: error.message,\n retryable: isProviderReasonRetryable(error.details.reason),\n };\n }\n }\n return {\n code: 'unknown',\n message: error instanceof Error ? error.message : String(error),\n retryable: true,\n };\n}\n\nfunction isProviderReasonRetryable(reason: string): boolean {\n return reason === 'rate-limited' || reason === 'timeout' || reason === 'provider-unavailable';\n}\n\nfunction providerErrorCode(reason: string): DefinitionSyncErrorCode {\n if (reason === 'repository-not-found') return 'provider-repository-not-found';\n if (reason === 'file-not-found') return 'provider-file-not-found';\n if (reason === 'access-denied') return 'provider-access-denied';\n if (reason === 'rate-limited') return 'provider-rate-limited';\n if (reason === 'timeout') return 'provider-timeout';\n if (reason === 'provider-unavailable') return 'provider-unavailable';\n if (reason === 'malformed-provider-response') return 'provider-malformed-response';\n if (reason === 'content-too-large') return 'content-too-large';\n if (reason === 'too-many-files') return 'too-many-files';\n return 'unknown';\n}\n\nfunction sha256Hex(content: string): string {\n return createHash('sha256').update(content, 'utf8').digest('hex');\n}\n"],"names":["createHash","integrationsInterModuleContract","isInterModuleKnownError","boundedMap","DefinitionParseError","DefinitionSyncPermanentError","hasAgentStepIntegrations","parseDefinitionWithWarnings","stripDefinitionWarnings","DEFAULT_WORKFLOW_PATH","MAX_WORKFLOW_FILES","MAX_WORKFLOW_FILE_BYTES","FILE_FETCH_CONCURRENCY","UNRESOLVED_SYNC_REF","resolveSyncSource","params","source","sourceControl","resolveRepository","workspaceId","connectionId","sourceConnectionId","externalRepositoryId","sourceExternalRepositoryId","ref","repository","defaultBranch","discoverWorkflowFiles","workflowPath","page","listFiles","prefix","limit","nextCursor","paths","files","filter","file","path","endsWith","map","length","fetchAndParseWorkflows","parsed","onProgress","snapshot","fetchFile","Buffer","byteLength","content","parseWorkflowSnapshot","agentValidationCatalog","rawContent","stopOnError","loadIntegrationValidationContext","some","entry","definition","document","_rawContent","integrationValidationContext","undefined","contentHash","sha256Hex","name","warnings","error","message","classifySyncFailure","code","retryable","methods","resolveSourceRepository","listSourceFiles","fetchSourceFile","method","providerErrorCode","details","reason","isProviderReasonRetryable","Error","String","update","digest"],"mappings":"AAAA,SAAQA,UAAU,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A,OAAO;gBAACA,MAAM;gBAA0BF,SAASD,MAAMC,OAAO;gBAAEG,WAAW;YAAK;QAClF;QACA,IAAIJ,MAAMG,IAAI,KAAK,oBAAoB;YACrC,OAAO;gBACLA,MAAMO,kBAAkBV,MAAMW,OAAO,CAACC,MAAM;gBAC5CX,SAASD,MAAMC,OAAO;gBACtBG,WAAWS,0BAA0Bb,MAAMW,OAAO,CAACC,MAAM;YAC3D;QACF;IACF;IACA,OAAO;QACLT,MAAM;QACNF,SAASD,iBAAiBc,QAAQd,MAAMC,OAAO,GAAGc,OAAOf;QACzDI,WAAW;IACb;AACF;AAEA,SAASS,0BAA0BD,MAAc;IAC/C,OAAOA,WAAW,kBAAkBA,WAAW,aAAaA,WAAW;AACzE;AAEA,SAASF,kBAAkBE,MAAc;IACvC,IAAIA,WAAW,wBAAwB,OAAO;IAC9C,IAAIA,WAAW,kBAAkB,OAAO;IACxC,IAAIA,WAAW,iBAAiB,OAAO;IACvC,IAAIA,WAAW,gBAAgB,OAAO;IACtC,IAAIA,WAAW,WAAW,OAAO;IACjC,IAAIA,WAAW,wBAAwB,OAAO;IAC9C,IAAIA,WAAW,+BAA+B,OAAO;IACrD,IAAIA,WAAW,qBAAqB,OAAO;IAC3C,IAAIA,WAAW,kBAAkB,OAAO;IACxC,OAAO;AACT;AAEA,SAASf,UAAUd,OAAe;IAChC,OAAOjD,WAAW,UAAUkF,MAAM,CAACjC,SAAS,QAAQkC,MAAM,CAAC;AAC7D"}
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import type { AgentValidationCatalog } from '@shipfox/api-agent-dto/inter-module';
|
|
2
2
|
import type { IntegrationValidationContext } from './entities/integration-context.js';
|
|
3
|
+
import type { ValidationWarning } from './entities/validation-warning.js';
|
|
3
4
|
import type { WorkflowDefinitionPayload } from './entities/workflow-definition.js';
|
|
4
5
|
export type ValidationError = {
|
|
5
6
|
message: string;
|
|
6
7
|
path?: string | undefined;
|
|
7
8
|
};
|
|
9
|
+
export type { ValidationWarning } from './entities/validation-warning.js';
|
|
10
|
+
export interface DefinitionValidationOptions {
|
|
11
|
+
defaultRunnerLabels?: readonly string[];
|
|
12
|
+
agentValidationCatalog: AgentValidationCatalog;
|
|
13
|
+
integrationValidationContext?: IntegrationValidationContext;
|
|
14
|
+
}
|
|
8
15
|
export type ValidationResult = {
|
|
9
16
|
valid: true;
|
|
10
17
|
definition: WorkflowDefinitionPayload;
|
|
18
|
+
warnings: ValidationWarning[];
|
|
11
19
|
} | {
|
|
12
20
|
valid: false;
|
|
13
21
|
errors: ValidationError[];
|
|
14
22
|
};
|
|
15
|
-
export declare function validateDefinition(yamlContent: string, options:
|
|
16
|
-
defaultRunnerLabels?: readonly string[];
|
|
17
|
-
agentValidationCatalog: AgentValidationCatalog;
|
|
18
|
-
integrationValidationContext?: IntegrationValidationContext;
|
|
19
|
-
}): ValidationResult;
|
|
23
|
+
export declare function validateDefinition(yamlContent: string, options: DefinitionValidationOptions): ValidationResult;
|
|
20
24
|
//# sourceMappingURL=validate-definition.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-definition.d.ts","sourceRoot":"","sources":["../../src/core/validate-definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,qCAAqC,CAAC;AAGhF,OAAO,KAAK,EAAC,4BAA4B,EAAC,MAAM,mCAAmC,CAAC;AACpF,OAAO,KAAK,EAAC,yBAAyB,EAAC,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"validate-definition.d.ts","sourceRoot":"","sources":["../../src/core/validate-definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,qCAAqC,CAAC;AAGhF,OAAO,KAAK,EAAC,4BAA4B,EAAC,MAAM,mCAAmC,CAAC;AACpF,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,kCAAkC,CAAC;AACxE,OAAO,KAAK,EAAC,yBAAyB,EAAC,MAAM,mCAAmC,CAAC;AAQjF,MAAM,MAAM,eAAe,GAAG;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAC,CAAC;AAC3E,YAAY,EAAC,iBAAiB,EAAC,MAAM,kCAAkC,CAAC;AAExE,MAAM,WAAW,2BAA2B;IAC1C,mBAAmB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,sBAAsB,EAAE,sBAAsB,CAAC;IAC/C,4BAA4B,CAAC,EAAE,4BAA4B,CAAC;CAC7D;AAED,MAAM,MAAM,gBAAgB,GACxB;IAAC,KAAK,EAAE,IAAI,CAAC;IAAC,UAAU,EAAE,yBAAyB,CAAC;IAAC,QAAQ,EAAE,iBAAiB,EAAE,CAAA;CAAC,GACnF;IAAC,KAAK,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,eAAe,EAAE,CAAA;CAAC,CAAC;AAE9C,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,2BAA2B,GACnC,gBAAgB,CAelB"}
|
|
@@ -5,18 +5,21 @@ import { InvalidWorkflowYamlError, parseWorkflowYamlWithLocations } from './work
|
|
|
5
5
|
export function validateDefinition(yamlContent, options) {
|
|
6
6
|
try {
|
|
7
7
|
const { document, stepSourceLocations } = parseWorkflowYamlWithLocations(yamlContent);
|
|
8
|
+
const warnings = [];
|
|
8
9
|
const model = normalizeWorkflowDocument(document, {
|
|
9
10
|
defaultRunnerLabels: options.defaultRunnerLabels ?? definitionDefaultRunnerLabels,
|
|
10
11
|
agentValidationCatalog: options.agentValidationCatalog,
|
|
11
12
|
integrationValidationContext: options.integrationValidationContext,
|
|
12
|
-
stepSourceLocations
|
|
13
|
+
stepSourceLocations,
|
|
14
|
+
warnings
|
|
13
15
|
});
|
|
14
16
|
return {
|
|
15
17
|
valid: true,
|
|
16
18
|
definition: {
|
|
17
19
|
document,
|
|
18
20
|
model
|
|
19
|
-
}
|
|
21
|
+
},
|
|
22
|
+
warnings: validationWarningsFor(warnings)
|
|
20
23
|
};
|
|
21
24
|
} catch (error) {
|
|
22
25
|
return {
|
|
@@ -25,6 +28,13 @@ export function validateDefinition(yamlContent, options) {
|
|
|
25
28
|
};
|
|
26
29
|
}
|
|
27
30
|
}
|
|
31
|
+
function validationWarningsFor(issues) {
|
|
32
|
+
return issues.map((issue)=>validationWarning({
|
|
33
|
+
code: issue.code,
|
|
34
|
+
message: issue.message,
|
|
35
|
+
path: issue.path.join('.') || undefined
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
28
38
|
function validationErrorsFor(error) {
|
|
29
39
|
if (error instanceof InvalidWorkflowYamlError) {
|
|
30
40
|
return [
|
|
@@ -57,5 +67,16 @@ function validationError(params) {
|
|
|
57
67
|
path: params.path
|
|
58
68
|
};
|
|
59
69
|
}
|
|
70
|
+
function validationWarning(params) {
|
|
71
|
+
if (params.path === undefined) return {
|
|
72
|
+
code: params.code,
|
|
73
|
+
message: params.message
|
|
74
|
+
};
|
|
75
|
+
return {
|
|
76
|
+
code: params.code,
|
|
77
|
+
message: params.message,
|
|
78
|
+
path: params.path
|
|
79
|
+
};
|
|
80
|
+
}
|
|
60
81
|
|
|
61
82
|
//# sourceMappingURL=validate-definition.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/validate-definition.ts"],"sourcesContent":["import type {AgentValidationCatalog} from '@shipfox/api-agent-dto/inter-module';\nimport {InvalidWorkflowDocumentError} from '@shipfox/workflow-document';\nimport {definitionDefaultRunnerLabels} from '../config.js';\nimport type {IntegrationValidationContext} from './entities/integration-context.js';\nimport type {WorkflowDefinitionPayload} from './entities/workflow-definition.js';\nimport {InvalidWorkflowModelError
|
|
1
|
+
{"version":3,"sources":["../../src/core/validate-definition.ts"],"sourcesContent":["import type {AgentValidationCatalog} from '@shipfox/api-agent-dto/inter-module';\nimport {InvalidWorkflowDocumentError} from '@shipfox/workflow-document';\nimport {definitionDefaultRunnerLabels} from '../config.js';\nimport type {IntegrationValidationContext} from './entities/integration-context.js';\nimport type {ValidationWarning} from './entities/validation-warning.js';\nimport type {WorkflowDefinitionPayload} from './entities/workflow-definition.js';\nimport {\n InvalidWorkflowModelError,\n normalizeWorkflowDocument,\n type WorkflowModelValidationIssue,\n} from './workflow-model/index.js';\nimport {InvalidWorkflowYamlError, parseWorkflowYamlWithLocations} from './workflow-yaml/index.js';\n\nexport type ValidationError = {message: string; path?: string | undefined};\nexport type {ValidationWarning} from './entities/validation-warning.js';\n\nexport interface DefinitionValidationOptions {\n defaultRunnerLabels?: readonly string[];\n agentValidationCatalog: AgentValidationCatalog;\n integrationValidationContext?: IntegrationValidationContext;\n}\n\nexport type ValidationResult =\n | {valid: true; definition: WorkflowDefinitionPayload; warnings: ValidationWarning[]}\n | {valid: false; errors: ValidationError[]};\n\nexport function validateDefinition(\n yamlContent: string,\n options: DefinitionValidationOptions,\n): ValidationResult {\n try {\n const {document, stepSourceLocations} = parseWorkflowYamlWithLocations(yamlContent);\n const warnings: WorkflowModelValidationIssue[] = [];\n const model = normalizeWorkflowDocument(document, {\n defaultRunnerLabels: options.defaultRunnerLabels ?? definitionDefaultRunnerLabels,\n agentValidationCatalog: options.agentValidationCatalog,\n integrationValidationContext: options.integrationValidationContext,\n stepSourceLocations,\n warnings,\n });\n return {valid: true, definition: {document, model}, warnings: validationWarningsFor(warnings)};\n } catch (error) {\n return {valid: false, errors: validationErrorsFor(error)};\n }\n}\n\nfunction validationWarningsFor(\n issues: readonly WorkflowModelValidationIssue[],\n): ValidationWarning[] {\n return issues.map((issue) =>\n validationWarning({\n code: issue.code,\n message: issue.message,\n path: issue.path.join('.') || undefined,\n }),\n );\n}\n\nfunction validationErrorsFor(error: unknown): ValidationError[] {\n if (error instanceof InvalidWorkflowYamlError) {\n return [\n validationError({\n message: error.message,\n path:\n error.location === undefined\n ? undefined\n : `${error.location.line}:${error.location.column}`,\n }),\n ];\n }\n\n if (error instanceof InvalidWorkflowDocumentError) {\n return error.validationError.issues.map((issue) =>\n validationError({\n message: issue.message,\n path: issue.path.join('.') || undefined,\n }),\n );\n }\n\n if (error instanceof InvalidWorkflowModelError) {\n return error.issues.map((issue) =>\n validationError({message: issue.message, path: issue.path.join('.')}),\n );\n }\n\n throw error;\n}\n\nfunction validationError(params: {message: string; path?: string | undefined}): ValidationError {\n if (params.path === undefined) return {message: params.message};\n return {message: params.message, path: params.path};\n}\n\nfunction validationWarning(params: {\n code: string;\n message: string;\n path?: string | undefined;\n}): ValidationWarning {\n if (params.path === undefined) return {code: params.code, message: params.message};\n return {code: params.code, message: params.message, path: params.path};\n}\n"],"names":["InvalidWorkflowDocumentError","definitionDefaultRunnerLabels","InvalidWorkflowModelError","normalizeWorkflowDocument","InvalidWorkflowYamlError","parseWorkflowYamlWithLocations","validateDefinition","yamlContent","options","document","stepSourceLocations","warnings","model","defaultRunnerLabels","agentValidationCatalog","integrationValidationContext","valid","definition","validationWarningsFor","error","errors","validationErrorsFor","issues","map","issue","validationWarning","code","message","path","join","undefined","validationError","location","line","column","params"],"mappings":"AACA,SAAQA,4BAA4B,QAAO,6BAA6B;AACxE,SAAQC,6BAA6B,QAAO,eAAe;AAI3D,SACEC,yBAAyB,EACzBC,yBAAyB,QAEpB,4BAA4B;AACnC,SAAQC,wBAAwB,EAAEC,8BAA8B,QAAO,2BAA2B;AAelG,OAAO,SAASC,mBACdC,WAAmB,EACnBC,OAAoC;IAEpC,IAAI;QACF,MAAM,EAACC,QAAQ,EAAEC,mBAAmB,EAAC,GAAGL,+BAA+BE;QACvE,MAAMI,WAA2C,EAAE;QACnD,MAAMC,QAAQT,0BAA0BM,UAAU;YAChDI,qBAAqBL,QAAQK,mBAAmB,IAAIZ;YACpDa,wBAAwBN,QAAQM,sBAAsB;YACtDC,8BAA8BP,QAAQO,4BAA4B;YAClEL;YACAC;QACF;QACA,OAAO;YAACK,OAAO;YAAMC,YAAY;gBAACR;gBAAUG;YAAK;YAAGD,UAAUO,sBAAsBP;Q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W,OAAO;QAACJ,MAAMS,OAAOT,IAAI;QAAEC,SAASQ,OAAOR,OAAO;IAAA;IACjF,OAAO;QAACD,MAAMS,OAAOT,IAAI;QAAEC,SAASQ,OAAOR,OAAO;QAAEC,MAAMO,OAAOP,IAAI;IAAA;AACvE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { DEFAULT_RUN_TIMEOUT_MS } from './constants.js';
|
|
2
|
-
export { InvalidWorkflowModelError, invalidWorkflowModelErrorCode, type WorkflowModelValidationIssue, type WorkflowModelValidationIssueCode, type WorkflowModelValidationIssuePathSegment, } from './invalid-workflow-model-error.js';
|
|
2
|
+
export { InvalidWorkflowModelError, invalidWorkflowModelErrorCode, type WorkflowModelValidationIssue, type WorkflowModelValidationIssueCode, type WorkflowModelValidationIssuePathSegment, type WorkflowModelValidationIssueSeverity, } from './invalid-workflow-model-error.js';
|
|
3
3
|
export { normalizeWorkflowDocument } from './normalize-workflow-document.js';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/workflow-model/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,sBAAsB,EAAC,MAAM,gBAAgB,CAAC;AACtD,OAAO,EACL,yBAAyB,EACzB,6BAA6B,EAC7B,KAAK,4BAA4B,EACjC,KAAK,gCAAgC,EACrC,KAAK,uCAAuC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/workflow-model/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,sBAAsB,EAAC,MAAM,gBAAgB,CAAC;AACtD,OAAO,EACL,yBAAyB,EACzB,6BAA6B,EAC7B,KAAK,4BAA4B,EACjC,KAAK,gCAAgC,EACrC,KAAK,uCAAuC,EAC5C,KAAK,oCAAoC,GAC1C,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAC,yBAAyB,EAAC,MAAM,kCAAkC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/workflow-model/index.ts"],"sourcesContent":["export {DEFAULT_RUN_TIMEOUT_MS} from './constants.js';\nexport {\n InvalidWorkflowModelError,\n invalidWorkflowModelErrorCode,\n type WorkflowModelValidationIssue,\n type WorkflowModelValidationIssueCode,\n type WorkflowModelValidationIssuePathSegment,\n} from './invalid-workflow-model-error.js';\nexport {normalizeWorkflowDocument} from './normalize-workflow-document.js';\n"],"names":["DEFAULT_RUN_TIMEOUT_MS","InvalidWorkflowModelError","invalidWorkflowModelErrorCode","normalizeWorkflowDocument"],"mappings":"AAAA,SAAQA,sBAAsB,QAAO,iBAAiB;AACtD,SACEC,yBAAyB,EACzBC,6BAA6B,
|
|
1
|
+
{"version":3,"sources":["../../../src/core/workflow-model/index.ts"],"sourcesContent":["export {DEFAULT_RUN_TIMEOUT_MS} from './constants.js';\nexport {\n InvalidWorkflowModelError,\n invalidWorkflowModelErrorCode,\n type WorkflowModelValidationIssue,\n type WorkflowModelValidationIssueCode,\n type WorkflowModelValidationIssuePathSegment,\n type WorkflowModelValidationIssueSeverity,\n} from './invalid-workflow-model-error.js';\nexport {normalizeWorkflowDocument} from './normalize-workflow-document.js';\n"],"names":["DEFAULT_RUN_TIMEOUT_MS","InvalidWorkflowModelError","invalidWorkflowModelErrorCode","normalizeWorkflowDocument"],"mappings":"AAAA,SAAQA,sBAAsB,QAAO,iBAAiB;AACtD,SACEC,yBAAyB,EACzBC,6BAA6B,QAKxB,oCAAoC;AAC3C,SAAQC,yBAAyB,QAAO,mCAAmC"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
export declare const invalidWorkflowModelErrorCode = "invalid-workflow-model";
|
|
2
|
-
export type WorkflowModelValidationIssueCode = 'context-unavailable-at-fill-site' | 'context-unavailable-at-predicate-site' | 'computed-context-key' | 'duplicate-job-id' | 'duplicate-step-id' | 'duplicate-trigger-id' | 'harness-provider-incompatible' | 'harness-thinking-incompatible' | 'harness-tool-incompatible' | 'integration-connection-not-capable' | 'integration-connection-not-found' | 'integration-write-not-allowed' | 'invalid-cron-event' | 'invalid-cron-schedule' | 'invalid-cron-timezone' | 'invalid-provider' | 'invalid-trigger-filter' | 'invalid-interpolation-expression' | 'invalid-interpolation-template' | 'invalid-duration' | 'invalid-listener-filter' | 'invalid-job-if' | 'invalid-job-output' | 'invalid-job-success' | 'invalid-output-schema' | 'invalid-runner-label' | 'invalid-step-gate-restart-from' | 'invalid-step-gate-success' | 'invalid-step-if' | 'job-dependency-cycle' | 'listening-job-missing-resolution-source' | 'listening-timeout-exceeds-run-timeout' | 'missing-harness-for-tools' | 'missing-connection-for-integration' | 'missing-job-needs-edge' | 'missing-cron-schedule' | 'missing-runner-label' | 'multiple-manual-triggers' | 'runner-context-not-bare' | 'runner-context-in-field' | 'runner-context-in-server-predicate' | 'self-job-dependency' | 'too-many-runner-labels' | 'unknown-secret-store' | 'unknown-interpolation-context' | 'unknown-integration-method' | 'unknown-integration-tool' | 'unknown-job-dependency' | 'untrusted-
|
|
2
|
+
export type WorkflowModelValidationIssueCode = 'context-unavailable-at-fill-site' | 'dynamic-name-self-reference' | 'context-unavailable-at-predicate-site' | 'computed-context-key' | 'checkout-target-invalid' | 'duplicate-job-id' | 'duplicate-step-id' | 'duplicate-trigger-id' | 'harness-provider-incompatible' | 'harness-thinking-incompatible' | 'harness-tool-incompatible' | 'integration-connection-not-capable' | 'integration-connection-not-found' | 'integration-write-not-allowed' | 'invalid-cron-event' | 'invalid-cron-schedule' | 'invalid-cron-timezone' | 'invalid-provider' | 'invalid-trigger-filter' | 'invalid-interpolation-expression' | 'invalid-interpolation-template' | 'invalid-duration' | 'invalid-listener-filter' | 'invalid-model' | 'invalid-job-if' | 'invalid-job-output' | 'invalid-job-success' | 'invalid-output-schema' | 'invalid-runner-label' | 'invalid-step-gate-restart-from' | 'invalid-step-gate-success' | 'invalid-step-if' | 'job-dependency-cycle' | 'listening-job-missing-resolution-source' | 'listening-timeout-exceeds-run-timeout' | 'missing-harness-for-tools' | 'missing-connection-for-integration' | 'missing-job-needs-edge' | 'missing-cron-schedule' | 'missing-runner-label' | 'multiple-manual-triggers' | 'runner-context-not-bare' | 'runner-context-in-field' | 'runner-context-in-server-predicate' | 're-evaluating-command' | 'self-job-dependency' | 'too-many-runner-labels' | 'unknown-secret-store' | 'unknown-interpolation-context' | 'unknown-integration-method' | 'unknown-integration-tool' | 'unknown-job-dependency' | 'untrusted-agent-selection-context';
|
|
3
3
|
export type WorkflowModelValidationIssuePathSegment = string | number;
|
|
4
|
+
export type WorkflowModelValidationIssueSeverity = 'error' | 'warning';
|
|
4
5
|
export interface WorkflowModelValidationIssue {
|
|
5
6
|
readonly code: WorkflowModelValidationIssueCode;
|
|
6
7
|
readonly message: string;
|
|
7
8
|
readonly path: readonly WorkflowModelValidationIssuePathSegment[];
|
|
8
9
|
readonly details?: Readonly<Record<string, unknown>>;
|
|
10
|
+
readonly severity?: WorkflowModelValidationIssueSeverity;
|
|
9
11
|
}
|
|
10
12
|
export declare class InvalidWorkflowModelError extends Error {
|
|
11
13
|
readonly issues: readonly WorkflowModelValidationIssue[];
|