@shipfox/api-definitions 5.0.0 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +4 -4
- package/CHANGELOG.md +36 -0
- package/dist/core/entities/workflow-definition.d.ts +2 -5
- package/dist/core/entities/workflow-definition.d.ts.map +1 -1
- package/dist/core/entities/workflow-definition.js.map +1 -1
- package/dist/core/entities/workflow-model.d.ts +1 -137
- package/dist/core/entities/workflow-model.d.ts.map +1 -1
- package/dist/core/entities/workflow-model.js.map +1 -1
- package/dist/core/integrations.d.ts +25 -0
- package/dist/core/integrations.d.ts.map +1 -0
- package/dist/core/integrations.js +30 -0
- package/dist/core/integrations.js.map +1 -0
- package/dist/core/sync-definitions.d.ts +2 -2
- package/dist/core/sync-definitions.d.ts.map +1 -1
- package/dist/core/sync-definitions.js +23 -14
- package/dist/core/sync-definitions.js.map +1 -1
- package/dist/core/workflow-model/constants.d.ts +1 -1
- package/dist/core/workflow-model/constants.d.ts.map +1 -1
- package/dist/core/workflow-model/constants.js +1 -1
- package/dist/core/workflow-model/constants.js.map +1 -1
- package/dist/core/workflow-model/normalize-job-checkout.d.ts +2 -2
- package/dist/core/workflow-model/normalize-job-checkout.d.ts.map +1 -1
- package/dist/core/workflow-model/normalize-job-checkout.js +2 -6
- package/dist/core/workflow-model/normalize-job-checkout.js.map +1 -1
- package/dist/core/workflow-model/normalize-job-success.d.ts +2 -1
- package/dist/core/workflow-model/normalize-job-success.d.ts.map +1 -1
- package/dist/core/workflow-model/normalize-job-success.js +2 -1
- package/dist/core/workflow-model/normalize-job-success.js.map +1 -1
- package/dist/db/db.d.ts +2 -2
- package/dist/db/schema/sync-states.d.ts +1 -1
- package/dist/index.d.ts +5 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -11
- package/dist/index.js.map +1 -1
- package/dist/presentation/index.d.ts +1 -1
- package/dist/presentation/index.d.ts.map +1 -1
- package/dist/presentation/index.js +1 -1
- package/dist/presentation/index.js.map +1 -1
- package/dist/presentation/inter-module.d.ts +4 -0
- package/dist/presentation/inter-module.d.ts.map +1 -0
- package/dist/presentation/inter-module.js +25 -0
- package/dist/presentation/inter-module.js.map +1 -0
- package/dist/presentation/routes/create-definition.d.ts +5 -6
- package/dist/presentation/routes/create-definition.d.ts.map +1 -1
- package/dist/presentation/routes/create-definition.js +7 -19
- package/dist/presentation/routes/create-definition.js.map +1 -1
- package/dist/presentation/routes/get-definition.d.ts +2 -1
- package/dist/presentation/routes/get-definition.d.ts.map +1 -1
- package/dist/presentation/routes/get-definition.js +26 -35
- package/dist/presentation/routes/get-definition.js.map +1 -1
- package/dist/presentation/routes/index.d.ts +1 -2
- package/dist/presentation/routes/index.d.ts.map +1 -1
- package/dist/presentation/routes/index.js +5 -6
- package/dist/presentation/routes/index.js.map +1 -1
- package/dist/presentation/routes/list-definitions.d.ts +2 -1
- package/dist/presentation/routes/list-definitions.d.ts.map +1 -1
- package/dist/presentation/routes/list-definitions.js +36 -45
- package/dist/presentation/routes/list-definitions.js.map +1 -1
- package/dist/presentation/routes/project-access.d.ts +10 -0
- package/dist/presentation/routes/project-access.d.ts.map +1 -0
- package/dist/presentation/routes/project-access.js +17 -0
- package/dist/presentation/routes/project-access.js.map +1 -0
- package/dist/temporal/activities/sync-activities.d.ts +3 -9
- package/dist/temporal/activities/sync-activities.d.ts.map +1 -1
- package/dist/temporal/activities/sync-activities.js +6 -10
- package/dist/temporal/activities/sync-activities.js.map +1 -1
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +16 -14
- package/src/core/entities/workflow-definition.ts +3 -6
- package/src/core/entities/workflow-model.ts +1 -162
- package/src/core/integrations.ts +39 -0
- package/src/core/sync-definitions.test.ts +19 -17
- package/src/core/sync-definitions.ts +26 -20
- package/src/core/workflow-model/constants.ts +1 -1
- package/src/core/workflow-model/normalize-job-checkout.ts +2 -5
- package/src/core/workflow-model/normalize-job-success.ts +2 -1
- package/src/db/definitions.test.ts +68 -7
- package/src/index.ts +12 -31
- package/src/presentation/index.ts +1 -1
- package/src/presentation/inter-module.ts +25 -0
- package/src/presentation/routes/create-definition.test.ts +59 -63
- package/src/presentation/routes/create-definition.ts +15 -34
- package/src/presentation/routes/get-definition.test.ts +14 -8
- package/src/presentation/routes/get-definition.ts +25 -28
- package/src/presentation/routes/index.test.ts +8 -1
- package/src/presentation/routes/index.ts +5 -7
- package/src/presentation/routes/list-definitions.test.ts +8 -7
- package/src/presentation/routes/list-definitions.ts +33 -36
- package/src/presentation/routes/project-access.ts +16 -0
- package/src/temporal/activities/sync-activities.test.ts +9 -6
- package/src/temporal/activities/sync-activities.ts +14 -29
- 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-07-
|
|
2
|
+
Successfully compiled: 72 files with swc (669.81ms)
|
|
3
|
+
2026-07-21T08:11:36.825Z [INFO] asset workflow-bundle-5046e0cf40917a545f36.js 1.46 MiB [emitted] [immutable] (name: main)
|
|
4
4
|
runtime modules 670 bytes 3 modules
|
|
5
5
|
modules by path ../../../node_modules/.pnpm/ 424 KiB
|
|
6
6
|
modules by path ../../../node_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporal...(truncated) 155 KiB 34 modules
|
|
@@ -16,6 +16,6 @@ modules by path ./dist/ 4.33 KiB
|
|
|
16
16
|
optional modules 30 bytes [optional]
|
|
17
17
|
__temporal_custom_payload_converter (ignored) 15 bytes [optional] [built] [code generated]
|
|
18
18
|
__temporal_custom_failure_converter (ignored) 15 bytes [optional] [built] [code generated]
|
|
19
|
-
webpack 5.107.2 compiled successfully in
|
|
20
|
-
2026-07-
|
|
19
|
+
webpack 5.107.2 compiled successfully in 4575 ms
|
|
20
|
+
2026-07-21T08:11:36.846Z [INFO] Workflow bundle created { size: '1.46MB' }
|
|
21
21
|
/home/runner/work/shipfox/shipfox/libs/api/definitions/dist/temporal/workflows/index.js: 1528210 bytes
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# @shipfox/api-definitions
|
|
2
2
|
|
|
3
|
+
## 6.0.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- a8f0545: Adds the versioned Definitions workflow snapshot contract and registered presentation.
|
|
8
|
+
- 0bb82a4: Adds the Agent and Integrations inter-module APIs, moving Workflows agent configuration, runtime credential resolution, and integration consumers behind producer-owned clients.
|
|
9
|
+
- f73da5d: Enforces bounded API context imports and routes inter-module consumers through producer contracts.
|
|
10
|
+
- Updated dependencies [a8f0545]
|
|
11
|
+
- Updated dependencies [0bb82a4]
|
|
12
|
+
- Updated dependencies [54ce48b]
|
|
13
|
+
- Updated dependencies [f4bc2eb]
|
|
14
|
+
- Updated dependencies [c0162b0]
|
|
15
|
+
- Updated dependencies [7ac43a4]
|
|
16
|
+
- Updated dependencies [f262539]
|
|
17
|
+
- Updated dependencies [a01e917]
|
|
18
|
+
- Updated dependencies [3bb4e26]
|
|
19
|
+
- Updated dependencies [a42b575]
|
|
20
|
+
- Updated dependencies [8bdc149]
|
|
21
|
+
- Updated dependencies [3810996]
|
|
22
|
+
- Updated dependencies [b00ed29]
|
|
23
|
+
- Updated dependencies [8aa7cd3]
|
|
24
|
+
- Updated dependencies [81f9544]
|
|
25
|
+
- Updated dependencies [4604a06]
|
|
26
|
+
- @shipfox/api-definitions-dto@6.0.0
|
|
27
|
+
- @shipfox/api-agent-dto@6.0.0
|
|
28
|
+
- @shipfox/api-integration-core-dto@6.0.0
|
|
29
|
+
- @shipfox/node-module@0.4.0
|
|
30
|
+
- @shipfox/node-temporal@0.3.2
|
|
31
|
+
- @shipfox/node-drizzle@0.3.2
|
|
32
|
+
- @shipfox/node-outbox@0.2.4
|
|
33
|
+
- @shipfox/api-secrets-dto@6.0.0
|
|
34
|
+
- @shipfox/api-auth-context@6.0.0
|
|
35
|
+
- @shipfox/node-fastify@0.2.4
|
|
36
|
+
- @shipfox/inter-module@0.2.0
|
|
37
|
+
- @shipfox/api-projects-dto@6.0.0
|
|
38
|
+
|
|
3
39
|
## 5.0.0
|
|
4
40
|
|
|
5
41
|
### Patch Changes
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
+
import type { WorkflowModel, WorkflowSourceSnapshot } from '@shipfox/api-definitions-dto';
|
|
1
2
|
import type { WorkflowDocument } from '@shipfox/workflow-document';
|
|
2
|
-
|
|
3
|
+
export type { WorkflowSourceSnapshot };
|
|
3
4
|
export type WorkflowSpec = WorkflowDocument;
|
|
4
|
-
export interface WorkflowSourceSnapshot {
|
|
5
|
-
content: string;
|
|
6
|
-
format: 'yaml';
|
|
7
|
-
}
|
|
8
5
|
export interface WorkflowDefinitionPayload {
|
|
9
6
|
document: WorkflowDocument;
|
|
10
7
|
model: WorkflowModel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-definition.d.ts","sourceRoot":"","sources":["../../../src/core/entities/workflow-definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,
|
|
1
|
+
{"version":3,"file":"workflow-definition.d.ts","sourceRoot":"","sources":["../../../src/core/entities/workflow-definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAE,sBAAsB,EAAC,MAAM,8BAA8B,CAAC;AACxF,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,4BAA4B,CAAC;AAEjE,YAAY,EAAC,sBAAsB,EAAC,CAAC;AAErC,MAAM,MAAM,YAAY,GAAG,gBAAgB,CAAC;AAE5C,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,KAAK,EAAE,aAAa,CAAC;IACrB,cAAc,CAAC,EAAE,sBAAsB,GAAG,IAAI,CAAC;CAChD;AAED,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,MAAM,EAAE,QAAQ,GAAG,KAAK,CAAC;IACzB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,UAAU,EAAE,YAAY,CAAC;IACzB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,KAAK,EAAE,aAAa,CAAC;IACrB,cAAc,EAAE,sBAAsB,GAAG,IAAI,CAAC;IAC9C,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;CACxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/entities/workflow-definition.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../../../src/core/entities/workflow-definition.ts"],"sourcesContent":["import type {WorkflowModel, WorkflowSourceSnapshot} from '@shipfox/api-definitions-dto';\nimport type {WorkflowDocument} from '@shipfox/workflow-document';\n\nexport type {WorkflowSourceSnapshot};\n\nexport type WorkflowSpec = WorkflowDocument;\n\nexport interface WorkflowDefinitionPayload {\n document: WorkflowDocument;\n model: WorkflowModel;\n sourceSnapshot?: WorkflowSourceSnapshot | null;\n}\n\nexport interface WorkflowDefinition {\n id: string;\n projectId: string;\n configPath: string | null;\n source: 'manual' | 'vcs';\n sha: string | null;\n ref: string | null;\n name: string;\n /**\n * Compatibility alias for packages that still consume the authoring document\n * before they migrate to `document`/`model`.\n */\n definition: WorkflowSpec;\n document: WorkflowDocument;\n model: WorkflowModel;\n sourceSnapshot: WorkflowSourceSnapshot | null;\n contentHash: string | null;\n fetchedAt: Date;\n createdAt: Date;\n updatedAt: Date;\n deletedAt: Date | null;\n}\n"],"names":[],"mappings":"AAaA,WAqBC"}
|
|
@@ -1,138 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import type { AgentThinking, Harness } from '@shipfox/workflow-document';
|
|
3
|
-
export type WorkflowFieldTemplate = readonly ResolvedFieldSegment[];
|
|
4
|
-
export type WorkflowEnvTemplates = Readonly<Record<string, WorkflowFieldTemplate>>;
|
|
5
|
-
export type WorkflowOutputTemplates = Readonly<Record<string, WorkflowFieldTemplate>>;
|
|
6
|
-
export interface WorkflowModel {
|
|
7
|
-
readonly kind: 'workflow';
|
|
8
|
-
readonly name: string;
|
|
9
|
-
readonly env?: Readonly<Record<string, string>>;
|
|
10
|
-
readonly templates?: {
|
|
11
|
-
readonly env?: WorkflowEnvTemplates;
|
|
12
|
-
};
|
|
13
|
-
readonly triggers: readonly WorkflowModelTrigger[];
|
|
14
|
-
readonly jobs: readonly WorkflowModelJob[];
|
|
15
|
-
readonly dependencies: readonly WorkflowModelDependency[];
|
|
16
|
-
}
|
|
17
|
-
export interface WorkflowModelTrigger {
|
|
18
|
-
readonly id: string;
|
|
19
|
-
readonly key: string;
|
|
20
|
-
readonly source: string;
|
|
21
|
-
readonly event: string;
|
|
22
|
-
readonly inputs?: Readonly<Record<string, unknown>>;
|
|
23
|
-
readonly filter?: string;
|
|
24
|
-
readonly config?: Readonly<Record<string, unknown>>;
|
|
25
|
-
}
|
|
26
|
-
export interface WorkflowModelJob {
|
|
27
|
-
readonly id: string;
|
|
28
|
-
readonly key: string;
|
|
29
|
-
readonly mode: WorkflowModelJobMode;
|
|
30
|
-
readonly runner: readonly string[];
|
|
31
|
-
readonly runnerTemplates?: readonly WorkflowFieldTemplate[];
|
|
32
|
-
readonly checkout: WorkflowModelJobCheckout;
|
|
33
|
-
readonly if?: WorkflowExpression;
|
|
34
|
-
readonly success?: string;
|
|
35
|
-
readonly outputs?: WorkflowOutputTemplates;
|
|
36
|
-
readonly outputTypes?: Readonly<Record<string, ExpressionType>>;
|
|
37
|
-
readonly executionTimeoutMs?: number;
|
|
38
|
-
readonly listening?: WorkflowModelJobListening;
|
|
39
|
-
readonly name?: WorkflowFieldTemplate;
|
|
40
|
-
readonly env?: Readonly<Record<string, string>>;
|
|
41
|
-
readonly templates?: {
|
|
42
|
-
readonly env?: WorkflowEnvTemplates;
|
|
43
|
-
};
|
|
44
|
-
readonly dependencies: readonly string[];
|
|
45
|
-
readonly steps: readonly WorkflowModelStep[];
|
|
46
|
-
}
|
|
47
|
-
export type WorkflowModelJobMode = 'one_shot' | 'listening';
|
|
48
|
-
export interface WorkflowModelJobListening {
|
|
49
|
-
readonly on: readonly WorkflowModelListeningTrigger[];
|
|
50
|
-
readonly until?: readonly WorkflowModelListeningTrigger[];
|
|
51
|
-
readonly timeoutMs?: number;
|
|
52
|
-
readonly maxExecutions?: number;
|
|
53
|
-
readonly batch?: WorkflowModelListeningBatch;
|
|
54
|
-
readonly onResolve: 'finish' | 'cancel';
|
|
55
|
-
}
|
|
56
|
-
export interface WorkflowModelListeningTrigger {
|
|
57
|
-
readonly source: string;
|
|
58
|
-
readonly event: string;
|
|
59
|
-
readonly inputs?: Readonly<Record<string, unknown>>;
|
|
60
|
-
readonly filter?: string;
|
|
61
|
-
}
|
|
62
|
-
export interface WorkflowModelListeningBatch {
|
|
63
|
-
readonly debounceMs?: number;
|
|
64
|
-
readonly maxSize?: number;
|
|
65
|
-
readonly maxWaitMs?: number;
|
|
66
|
-
}
|
|
67
|
-
export interface WorkflowModelJobCheckout {
|
|
68
|
-
readonly permissions: {
|
|
69
|
-
readonly contents: 'read' | 'write';
|
|
70
|
-
};
|
|
71
|
-
readonly persistCredentials: boolean;
|
|
72
|
-
}
|
|
73
|
-
export type WorkflowModelStep = WorkflowModelRunStep | WorkflowModelAgentStep;
|
|
74
|
-
interface WorkflowModelStepBase {
|
|
75
|
-
readonly id: string;
|
|
76
|
-
readonly key?: string;
|
|
77
|
-
readonly if?: WorkflowExpression;
|
|
78
|
-
readonly name?: string;
|
|
79
|
-
readonly outputs?: OutputDeclarations;
|
|
80
|
-
readonly gate?: WorkflowModelStepGate;
|
|
81
|
-
readonly sourceLocation?: WorkflowSourceLocation;
|
|
82
|
-
}
|
|
83
|
-
export interface WorkflowModelRunStep extends WorkflowModelStepBase {
|
|
84
|
-
readonly kind: 'run';
|
|
85
|
-
readonly command: WorkflowModelRunCommand;
|
|
86
|
-
readonly env?: Readonly<Record<string, string>>;
|
|
87
|
-
readonly templates?: {
|
|
88
|
-
readonly command?: WorkflowFieldTemplate;
|
|
89
|
-
readonly name?: WorkflowFieldTemplate;
|
|
90
|
-
readonly env?: WorkflowEnvTemplates;
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
export interface WorkflowModelAgentStep extends WorkflowModelStepBase {
|
|
94
|
-
readonly kind: 'agent';
|
|
95
|
-
readonly harness?: Harness;
|
|
96
|
-
readonly model?: string;
|
|
97
|
-
readonly provider?: string;
|
|
98
|
-
readonly thinking?: AgentThinking;
|
|
99
|
-
readonly tools?: readonly string[];
|
|
100
|
-
readonly integrations?: readonly WorkflowModelStepIntegration[];
|
|
101
|
-
readonly prompt: string;
|
|
102
|
-
readonly templates?: {
|
|
103
|
-
readonly prompt?: WorkflowFieldTemplate;
|
|
104
|
-
readonly model?: WorkflowFieldTemplate;
|
|
105
|
-
readonly provider?: WorkflowFieldTemplate;
|
|
106
|
-
readonly name?: WorkflowFieldTemplate;
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
export interface WorkflowModelStepIntegration {
|
|
110
|
-
readonly connection?: string;
|
|
111
|
-
readonly include: readonly string[];
|
|
112
|
-
readonly exclude?: readonly string[];
|
|
113
|
-
readonly allowWrite: boolean;
|
|
114
|
-
}
|
|
115
|
-
export interface WorkflowSourceLocation {
|
|
116
|
-
readonly startLine: number;
|
|
117
|
-
readonly endLine: number;
|
|
118
|
-
}
|
|
119
|
-
export type WorkflowStepSourceLocationMap = ReadonlyMap<string, ReadonlyMap<number, WorkflowSourceLocation>>;
|
|
120
|
-
export interface WorkflowModelRunCommand {
|
|
121
|
-
readonly kind: 'shell';
|
|
122
|
-
readonly value: string;
|
|
123
|
-
}
|
|
124
|
-
export interface WorkflowModelStepGate {
|
|
125
|
-
readonly success?: WorkflowExpression;
|
|
126
|
-
readonly onFailure?: WorkflowModelStepFailureAction;
|
|
127
|
-
}
|
|
128
|
-
export interface WorkflowModelStepFailureAction {
|
|
129
|
-
readonly restartFrom: string;
|
|
130
|
-
readonly feedback?: string;
|
|
131
|
-
readonly feedbackTemplate?: WorkflowFieldTemplate;
|
|
132
|
-
}
|
|
133
|
-
export interface WorkflowModelDependency {
|
|
134
|
-
readonly from: string;
|
|
135
|
-
readonly to: string;
|
|
136
|
-
}
|
|
137
|
-
export {};
|
|
1
|
+
export type * from '@shipfox/api-definitions-dto';
|
|
138
2
|
//# sourceMappingURL=workflow-model.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-model.d.ts","sourceRoot":"","sources":["../../../src/core/entities/workflow-model.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"workflow-model.d.ts","sourceRoot":"","sources":["../../../src/core/entities/workflow-model.ts"],"names":[],"mappings":"AAAA,mBAAmB,8BAA8B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/entities/workflow-model.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../../src/core/entities/workflow-model.ts"],"sourcesContent":["export type * from '@shipfox/api-definitions-dto';\n"],"names":[],"mappings":"AAAA,WAAkD"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type IntegrationsModuleClient, integrationsInterModuleContract } from '@shipfox/api-integration-core-dto';
|
|
2
|
+
export type DefinitionsSourceControl = {
|
|
3
|
+
resolveRepository: IntegrationsModuleClient['resolveSourceRepository'];
|
|
4
|
+
listFiles: IntegrationsModuleClient['listSourceFiles'];
|
|
5
|
+
fetchFile: IntegrationsModuleClient['fetchSourceFile'];
|
|
6
|
+
};
|
|
7
|
+
export declare function createDefinitionsSourceControl(integrations: IntegrationsModuleClient): DefinitionsSourceControl;
|
|
8
|
+
export declare function loadIntegrationValidationContext(integrations: IntegrationsModuleClient, workspaceId: string, defaultConnectionId: string): Promise<{
|
|
9
|
+
agentToolSelectionCatalogs: Map<string, {
|
|
10
|
+
selectors: {
|
|
11
|
+
token: string;
|
|
12
|
+
kind: "family" | "family_wildcard" | "method" | "standalone";
|
|
13
|
+
sensitivity: "read" | "write";
|
|
14
|
+
sensitive: boolean;
|
|
15
|
+
}[];
|
|
16
|
+
}>;
|
|
17
|
+
workspaceConnectionSnapshot: Map<string, {
|
|
18
|
+
id: string;
|
|
19
|
+
provider: string;
|
|
20
|
+
capabilities: ("source_control" | "agent_tools")[];
|
|
21
|
+
}>;
|
|
22
|
+
defaultConnectionSlug: string | undefined;
|
|
23
|
+
}>;
|
|
24
|
+
export { integrationsInterModuleContract };
|
|
25
|
+
//# sourceMappingURL=integrations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integrations.d.ts","sourceRoot":"","sources":["../../src/core/integrations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,wBAAwB,EAC7B,+BAA+B,EAChC,MAAM,mCAAmC,CAAC;AAE3C,MAAM,MAAM,wBAAwB,GAAG;IACrC,iBAAiB,EAAE,wBAAwB,CAAC,yBAAyB,CAAC,CAAC;IACvE,SAAS,EAAE,wBAAwB,CAAC,iBAAiB,CAAC,CAAC;IACvD,SAAS,EAAE,wBAAwB,CAAC,iBAAiB,CAAC,CAAC;CACxD,CAAC;AAEF,wBAAgB,8BAA8B,CAC5C,YAAY,EAAE,wBAAwB,GACrC,wBAAwB,CAM1B;AAED,wBAAsB,gCAAgC,CACpD,YAAY,EAAE,wBAAwB,EACtC,WAAW,EAAE,MAAM,EACnB,mBAAmB,EAAE,MAAM;;;;;;;;;;;;;;;GAY5B;AAED,OAAO,EAAC,+BAA+B,EAAC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { integrationsInterModuleContract } from '@shipfox/api-integration-core-dto';
|
|
2
|
+
export function createDefinitionsSourceControl(integrations) {
|
|
3
|
+
return {
|
|
4
|
+
resolveRepository: integrations.resolveSourceRepository,
|
|
5
|
+
listFiles: integrations.listSourceFiles,
|
|
6
|
+
fetchFile: integrations.fetchSourceFile
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export async function loadIntegrationValidationContext(integrations, workspaceId, defaultConnectionId) {
|
|
10
|
+
const context = await integrations.getAgentToolsContext({
|
|
11
|
+
workspaceId,
|
|
12
|
+
defaultConnectionId
|
|
13
|
+
});
|
|
14
|
+
return {
|
|
15
|
+
agentToolSelectionCatalogs: new Map(context.selectionCatalogs.map(({ provider, selectors })=>[
|
|
16
|
+
provider,
|
|
17
|
+
{
|
|
18
|
+
selectors
|
|
19
|
+
}
|
|
20
|
+
])),
|
|
21
|
+
workspaceConnectionSnapshot: new Map(context.workspaceConnections.map(({ slug, ...connection })=>[
|
|
22
|
+
slug,
|
|
23
|
+
connection
|
|
24
|
+
])),
|
|
25
|
+
defaultConnectionSlug: context.defaultConnection?.slug
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export { integrationsInterModuleContract };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=integrations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/integrations.ts"],"sourcesContent":["import {\n type IntegrationsModuleClient,\n integrationsInterModuleContract,\n} from '@shipfox/api-integration-core-dto';\n\nexport type DefinitionsSourceControl = {\n resolveRepository: IntegrationsModuleClient['resolveSourceRepository'];\n listFiles: IntegrationsModuleClient['listSourceFiles'];\n fetchFile: IntegrationsModuleClient['fetchSourceFile'];\n};\n\nexport function createDefinitionsSourceControl(\n integrations: IntegrationsModuleClient,\n): DefinitionsSourceControl {\n return {\n resolveRepository: integrations.resolveSourceRepository,\n listFiles: integrations.listSourceFiles,\n fetchFile: integrations.fetchSourceFile,\n };\n}\n\nexport async function loadIntegrationValidationContext(\n integrations: IntegrationsModuleClient,\n workspaceId: string,\n defaultConnectionId: string,\n) {\n const context = await integrations.getAgentToolsContext({workspaceId, defaultConnectionId});\n return {\n agentToolSelectionCatalogs: new Map(\n context.selectionCatalogs.map(({provider, selectors}) => [provider, {selectors}]),\n ),\n workspaceConnectionSnapshot: new Map(\n context.workspaceConnections.map(({slug, ...connection}) => [slug, connection]),\n ),\n defaultConnectionSlug: context.defaultConnection?.slug,\n };\n}\n\nexport {integrationsInterModuleContract};\n"],"names":["integrationsInterModuleContract","createDefinitionsSourceControl","integrations","resolveRepository","resolveSourceRepository","listFiles","listSourceFiles","fetchFile","fetchSourceFile","loadIntegrationValidationContext","workspaceId","defaultConnectionId","context","getAgentToolsContext","agentToolSelectionCatalogs","Map","selectionCatalogs","map","provider","selectors","workspaceConnectionSnapshot","workspaceConnections","slug","connection","defaultConnectionSlug","defaultConnection"],"mappings":"AAAA,SAEEA,+BAA+B,QAC1B,oCAAoC;AAQ3C,OAAO,SAASC,+BACdC,YAAsC;IAEtC,OAAO;QACLC,mBAAmBD,aAAaE,uBAAuB;QACvDC,WAAWH,aAAaI,eAAe;QACvCC,WAAWL,aAAaM,eAAe;IACzC;AACF;AAEA,OAAO,eAAeC,iCACpBP,YAAsC,EACtCQ,WAAmB,EACnBC,mBAA2B;IAE3B,MAAMC,UAAU,MAAMV,aAAaW,oBAAoB,CAAC;QAACH;QAAaC;IAAmB;IACzF,OAAO;QACLG,4BAA4B,IAAIC,IAC9BH,QAAQI,iBAAiB,CAACC,GAAG,CAAC,CAAC,EAACC,QAAQ,EAAEC,SAAS,EAAC,GAAK;gBAACD;gBAAU;oBAACC;gBAAS;aAAE;QAElFC,6BAA6B,IAAIL,IAC/BH,QAAQS,oBAAoB,CAACJ,GAAG,CAAC,CAAC,EAACK,IAAI,EAAE,GAAGC,YAAW,GAAK;gBAACD;gBAAMC;aAAW;QAEhFC,uBAAuBZ,QAAQa,iBAAiB,EAAEH;IACpD;AACF;AAEA,SAAQtB,+BAA+B,GAAE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type IntegrationSourceControlService } from '@shipfox/api-integration-core';
|
|
2
1
|
import type { IntegrationValidationContext } from './entities/integration-context.js';
|
|
3
2
|
import type { DefinitionSyncErrorCode } from './entities/sync-state.js';
|
|
4
3
|
import type { WorkflowDefinitionPayload } from './entities/workflow-definition.js';
|
|
4
|
+
import type { DefinitionsSourceControl } from './integrations.js';
|
|
5
5
|
export declare const WORKFLOW_PREFIX = ".shipfox/workflows/";
|
|
6
6
|
export declare const MAX_WORKFLOW_FILES = 100;
|
|
7
7
|
export declare const FILE_FETCH_CONCURRENCY = 4;
|
|
@@ -10,7 +10,7 @@ export interface SyncSourceContext {
|
|
|
10
10
|
workspaceId: string;
|
|
11
11
|
sourceConnectionId: string;
|
|
12
12
|
sourceExternalRepositoryId: string;
|
|
13
|
-
sourceControl:
|
|
13
|
+
sourceControl: DefinitionsSourceControl;
|
|
14
14
|
}
|
|
15
15
|
export interface ResolvedSyncSource {
|
|
16
16
|
ref: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-definitions.d.ts","sourceRoot":"","sources":["../../src/core/sync-definitions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sync-definitions.d.ts","sourceRoot":"","sources":["../../src/core/sync-definitions.ts"],"names":[],"mappings":"AAOA,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,wBAAwB,EAAC,MAAM,mBAAmB,CAAC;AAGhE,eAAO,MAAM,eAAe,wBAAwB,C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C9B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,yBAAyB,CA+B7E"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
|
-
import {
|
|
2
|
+
import { integrationsInterModuleContract, MAX_REPOSITORY_FILE_BYTES } from '@shipfox/api-integration-core-dto';
|
|
3
|
+
import { isInterModuleKnownError } from '@shipfox/inter-module';
|
|
3
4
|
import { boundedMap } from '@shipfox/node-module';
|
|
4
5
|
import { DefinitionParseError, DefinitionSyncPermanentError } from './errors.js';
|
|
5
6
|
import { hasAgentStepIntegrations } from './has-agent-step-integrations.js';
|
|
@@ -98,19 +99,27 @@ export function classifySyncFailure(error) {
|
|
|
98
99
|
retryable: false
|
|
99
100
|
};
|
|
100
101
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
102
|
+
const methods = [
|
|
103
|
+
integrationsInterModuleContract.methods.resolveSourceRepository,
|
|
104
|
+
integrationsInterModuleContract.methods.listSourceFiles,
|
|
105
|
+
integrationsInterModuleContract.methods.fetchSourceFile
|
|
106
|
+
];
|
|
107
|
+
for (const method of methods){
|
|
108
|
+
if (!isInterModuleKnownError(method, error)) continue;
|
|
109
|
+
if (error.code === 'connection-not-found' || error.code === 'connection-inactive' || error.code === 'connection-workspace-mismatch') {
|
|
110
|
+
return {
|
|
111
|
+
code: 'connection-unavailable',
|
|
112
|
+
message: error.message,
|
|
113
|
+
retryable: false
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
if (error.code === 'provider-failure') {
|
|
117
|
+
return {
|
|
118
|
+
code: providerErrorCode(error.details.reason),
|
|
119
|
+
message: error.message,
|
|
120
|
+
retryable: isProviderReasonRetryable(error.details.reason)
|
|
121
|
+
};
|
|
122
|
+
}
|
|
114
123
|
}
|
|
115
124
|
return {
|
|
116
125
|
code: 'unknown',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/sync-definitions.ts"],"sourcesContent":["import {createHash} from 'node:crypto';\nimport {\n IntegrationConnectionInactiveError,\n IntegrationConnectionNotFoundError,\n IntegrationConnectionWorkspaceMismatchError,\n IntegrationProviderError,\n type IntegrationSourceControlService,\n MAX_REPOSITORY_FILE_BYTES,\n} from '@shipfox/api-integration-core';\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 {parseDefinition} from './parse-definition.js';\n\nexport const WORKFLOW_PREFIX = '.shipfox/workflows/';\nexport const MAX_WORKFLOW_FILES = 100;\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: IntegrationSourceControlService;\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}\n\nexport async function discoverWorkflowFiles(\n params: DiscoverWorkflowFilesParams,\n): Promise<{paths: string[]}> {\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: WORKFLOW_PREFIX,\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 ${WORKFLOW_PREFIX}`,\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 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_REPOSITORY_FILE_BYTES) {\n throw new DefinitionSyncPermanentError(\n 'content-too-large',\n `Workflow file is larger than ${MAX_REPOSITORY_FILE_BYTES} bytes: ${snapshot.path}`,\n );\n }\n\n return {\n ...parseWorkflowSnapshot({path: snapshot.path, content: snapshot.content}),\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 integrationValidationContext,\n }),\n );\n}\n\nfunction parseWorkflowSnapshot(params: {\n path: string;\n content: string;\n integrationValidationContext?: IntegrationValidationContext | undefined;\n}): ParsedWorkflow {\n try {\n const definition =\n params.integrationValidationContext === undefined\n ? parseDefinition(params.content)\n : parseDefinition(params.content, {\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 if (\n error instanceof IntegrationConnectionNotFoundError ||\n error instanceof IntegrationConnectionInactiveError ||\n error instanceof IntegrationConnectionWorkspaceMismatchError\n ) {\n return {code: 'connection-unavailable', message: error.message, retryable: false};\n }\n if (error instanceof IntegrationProviderError) {\n return {\n code: providerErrorCode(error.reason),\n message: error.message,\n retryable: isProviderReasonRetryable(error.reason),\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","IntegrationConnectionInactiveError","IntegrationConnectionNotFoundError","IntegrationConnectionWorkspaceMismatchError","IntegrationProviderError","MAX_REPOSITORY_FILE_BYTES","boundedMap","DefinitionParseError","DefinitionSyncPermanentError","hasAgentStepIntegrations","parseDefinition","WORKFLOW_PREFIX","MAX_WORKFLOW_FILES","FILE_FETCH_CONCURRENCY","UNRESOLVED_SYNC_REF","resolveSyncSource","params","source","sourceControl","resolveRepository","workspaceId","connectionId","sourceConnectionId","externalRepositoryId","sourceExternalRepositoryId","ref","repository","defaultBranch","discoverWorkflowFiles","page","listFiles","prefix","limit","nextCursor","paths","files","filter","file","path","endsWith","map","length","fetchAndParseWorkflows","parsed","onProgress","snapshot","fetchFile","Buffer","byteLength","content","parseWorkflowSnapshot","rawContent","stopOnError","loadIntegrationValidationContext","some","entry","definition","document","_rawContent","integrationValidationContext","undefined","contentHash","sha256Hex","name","error","message","classifySyncFailure","code","retryable","providerErrorCode","reason","isProviderReasonRetryable","Error","String","update","digest"],"mappings":"AAAA,SAAQA,UAAU,QAAO,cAAc;AACvC,SACEC,kCAAkC,EAClCC,kCAAkC,EAClCC,2CAA2C,EAC3CC,wBAAwB,EAExBC,yBAAyB,QACpB,gCAAgC;AACvC,SAAQC,UAAU,QAAO,uBAAuB;AAIhD,SAAQC,oBAAoB,EAAEC,4BAA4B,QAAO,cAAc;AAC/E,SAAQC,wBAAwB,QAAO,mCAAmC;AAC1E,SAAQC,eAAe,QAAO,wBAAwB;AAEtD,OAAO,MAAMC,kBAAkB,sBAAsB;AACrD,OAAO,MAAMC,qBAAqB,IAAI;AACtC,OAAO,MAAMC,yBAAyB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7D"}
|
|
1
|
+
{"version":3,"sources":["../../src/core/sync-definitions.ts"],"sourcesContent":["import {createHash} from 'node:crypto';\nimport {\n integrationsInterModuleContract,\n MAX_REPOSITORY_FILE_BYTES,\n} from '@shipfox/api-integration-core-dto';\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 WORKFLOW_PREFIX = '.shipfox/workflows/';\nexport const MAX_WORKFLOW_FILES = 100;\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}\n\nexport async function discoverWorkflowFiles(\n params: DiscoverWorkflowFilesParams,\n): Promise<{paths: string[]}> {\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: WORKFLOW_PREFIX,\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 ${WORKFLOW_PREFIX}`,\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 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_REPOSITORY_FILE_BYTES) {\n throw new DefinitionSyncPermanentError(\n 'content-too-large',\n `Workflow file is larger than ${MAX_REPOSITORY_FILE_BYTES} bytes: ${snapshot.path}`,\n );\n }\n\n return {\n ...parseWorkflowSnapshot({path: snapshot.path, content: snapshot.content}),\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 integrationValidationContext,\n }),\n );\n}\n\nfunction parseWorkflowSnapshot(params: {\n path: string;\n content: string;\n integrationValidationContext?: IntegrationValidationContext | undefined;\n}): ParsedWorkflow {\n try {\n const definition =\n params.integrationValidationContext === undefined\n ? parseDefinition(params.content)\n : parseDefinition(params.content, {\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","MAX_REPOSITORY_FILE_BYTES","isInterModuleKnownError","boundedMap","DefinitionParseError","DefinitionSyncPermanentError","hasAgentStepIntegrations","parseDefinition","WORKFLOW_PREFIX","MAX_WORKFLOW_FILES","FILE_FETCH_CONCURRENCY","UNRESOLVED_SYNC_REF","resolveSyncSource","params","source","sourceControl","resolveRepository","workspaceId","connectionId","sourceConnectionId","externalRepositoryId","sourceExternalRepositoryId","ref","repository","defaultBranch","discoverWorkflowFiles","page","listFiles","prefix","limit","nextCursor","paths","files","filter","file","path","endsWith","map","length","fetchAndParseWorkflows","parsed","onProgress","snapshot","fetchFile","Buffer","byteLength","content","parseWorkflowSnapshot","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;AACvC,SACEC,+BAA+B,EAC/BC,yBAAyB,QACpB,oCAAoC;AAC3C,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,kBAAkB,sBAAsB;AACrD,OAAO,MAAMC,qBAAqB,IAAI;AACtC,OAAO,MAAMC,yBAAyB,EAAE;AACxC,OAAO,MAAMC,s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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,UAAUb,OAAe;IAChC,OAAO/C,WAAW,UAAU8E,MAAM,CAAC/B,SAAS,QAAQgC,MAAM,CAAC;AAC7D"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { DEFAULT_RUN_TIMEOUT_MS } from '@shipfox/api-definitions-dto';
|
|
2
2
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/core/workflow-model/constants.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/core/workflow-model/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,sBAAsB,EAAC,MAAM,8BAA8B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/workflow-model/constants.ts"],"sourcesContent":["export
|
|
1
|
+
{"version":3,"sources":["../../../src/core/workflow-model/constants.ts"],"sourcesContent":["export {DEFAULT_RUN_TIMEOUT_MS} from '@shipfox/api-definitions-dto';\n"],"names":["DEFAULT_RUN_TIMEOUT_MS"],"mappings":"AAAA,SAAQA,sBAAsB,QAAO,+BAA+B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { DEFAULT_JOB_CHECKOUT, type WorkflowModelJobCheckout } from '@shipfox/api-definitions-dto';
|
|
1
2
|
import type { WorkflowDocumentJobCheckout } from '@shipfox/workflow-document';
|
|
2
|
-
|
|
3
|
-
export declare const DEFAULT_JOB_CHECKOUT: WorkflowModelJobCheckout;
|
|
3
|
+
export { DEFAULT_JOB_CHECKOUT };
|
|
4
4
|
export declare function normalizeJobCheckout(checkout: WorkflowDocumentJobCheckout | undefined): WorkflowModelJobCheckout;
|
|
5
5
|
//# sourceMappingURL=normalize-job-checkout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-job-checkout.d.ts","sourceRoot":"","sources":["../../../src/core/workflow-model/normalize-job-checkout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"normalize-job-checkout.d.ts","sourceRoot":"","sources":["../../../src/core/workflow-model/normalize-job-checkout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAE,KAAK,wBAAwB,EAAC,MAAM,8BAA8B,CAAC;AACjG,OAAO,KAAK,EAAC,2BAA2B,EAAC,MAAM,4BAA4B,CAAC;AAE5E,OAAO,EAAC,oBAAoB,EAAC,CAAC;AAE9B,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,2BAA2B,GAAG,SAAS,GAChD,wBAAwB,CAQ1B"}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
contents: 'read'
|
|
4
|
-
},
|
|
5
|
-
persistCredentials: true
|
|
6
|
-
};
|
|
1
|
+
import { DEFAULT_JOB_CHECKOUT } from '@shipfox/api-definitions-dto';
|
|
2
|
+
export { DEFAULT_JOB_CHECKOUT };
|
|
7
3
|
export function normalizeJobCheckout(checkout) {
|
|
8
4
|
return {
|
|
9
5
|
permissions: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/workflow-model/normalize-job-checkout.ts"],"sourcesContent":["import type
|
|
1
|
+
{"version":3,"sources":["../../../src/core/workflow-model/normalize-job-checkout.ts"],"sourcesContent":["import {DEFAULT_JOB_CHECKOUT, type WorkflowModelJobCheckout} from '@shipfox/api-definitions-dto';\nimport type {WorkflowDocumentJobCheckout} from '@shipfox/workflow-document';\n\nexport {DEFAULT_JOB_CHECKOUT};\n\nexport function normalizeJobCheckout(\n checkout: WorkflowDocumentJobCheckout | undefined,\n): WorkflowModelJobCheckout {\n return {\n permissions: {\n contents: checkout?.permissions?.contents ?? DEFAULT_JOB_CHECKOUT.permissions.contents,\n },\n persistCredentials:\n checkout?.['persist-credentials'] ?? DEFAULT_JOB_CHECKOUT.persistCredentials,\n };\n}\n"],"names":["DEFAULT_JOB_CHECKOUT","normalizeJobCheckout","checkout","permissions","contents","persistCredentials"],"mappings":"AAAA,SAAQA,oBAAoB,QAAsC,+BAA+B;AAGjG,SAAQA,oBAAoB,GAAE;AAE9B,OAAO,SAASC,qBACdC,QAAiD;IAEjD,OAAO;QACLC,aAAa;YACXC,UAAUF,UAAUC,aAAaC,YAAYJ,qBAAqBG,WAAW,CAACC,QAAQ;QACxF;QACAC,oBACEH,UAAU,CAAC,sBAAsB,IAAIF,qBAAqBK,kBAAkB;IAChF;AACF"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { DEFAULT_JOB_SUCCESS } from '@shipfox/api-definitions-dto';
|
|
1
2
|
import type { ExpressionTypeEnvironment } from '@shipfox/expression';
|
|
2
3
|
import type { WorkflowModelValidationIssue } from './invalid-workflow-model-error.js';
|
|
3
|
-
export
|
|
4
|
+
export { DEFAULT_JOB_SUCCESS };
|
|
4
5
|
export declare function normalizeJobSuccess(params: {
|
|
5
6
|
source: string | undefined;
|
|
6
7
|
sourceName: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-job-success.d.ts","sourceRoot":"","sources":["../../../src/core/workflow-model/normalize-job-success.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,yBAAyB,EAAC,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EAAC,4BAA4B,EAAC,MAAM,mCAAmC,CAAC;AAGpF,
|
|
1
|
+
{"version":3,"file":"normalize-job-success.d.ts","sourceRoot":"","sources":["../../../src/core/workflow-model/normalize-job-success.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,8BAA8B,CAAC;AACjE,OAAO,KAAK,EAAC,yBAAyB,EAAC,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EAAC,4BAA4B,EAAC,MAAM,mCAAmC,CAAC;AAGpF,OAAO,EAAC,mBAAmB,EAAC,CAAC;AAE7B,wBAAgB,mBAAmB,CAAC,MAAM,EAAE;IAC1C,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,4BAA4B,EAAE,CAAC;IACvC,oBAAoB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC1C,WAAW,CAAC,EAAE,yBAAyB,GAAG,SAAS,CAAC;CACrD,GAAG,MAAM,GAAG,SAAS,CAerB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { DEFAULT_JOB_SUCCESS } from '@shipfox/api-definitions-dto';
|
|
1
2
|
import { validatePredicateExpression } from './validate-predicate-expression.js';
|
|
2
|
-
export
|
|
3
|
+
export { DEFAULT_JOB_SUCCESS };
|
|
3
4
|
export function normalizeJobSuccess(params) {
|
|
4
5
|
if (params.source === undefined) return undefined;
|
|
5
6
|
const expression = validatePredicateExpression({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/workflow-model/normalize-job-success.ts"],"sourcesContent":["import type {ExpressionTypeEnvironment} from '@shipfox/expression';\nimport type {WorkflowModelValidationIssue} from './invalid-workflow-model-error.js';\nimport {validatePredicateExpression} from './validate-predicate-expression.js';\n\nexport
|
|
1
|
+
{"version":3,"sources":["../../../src/core/workflow-model/normalize-job-success.ts"],"sourcesContent":["import {DEFAULT_JOB_SUCCESS} from '@shipfox/api-definitions-dto';\nimport type {ExpressionTypeEnvironment} from '@shipfox/expression';\nimport type {WorkflowModelValidationIssue} from './invalid-workflow-model-error.js';\nimport {validatePredicateExpression} from './validate-predicate-expression.js';\n\nexport {DEFAULT_JOB_SUCCESS};\n\nexport function normalizeJobSuccess(params: {\n source: string | undefined;\n sourceName: string;\n issues: WorkflowModelValidationIssue[];\n allowedJobReferences: ReadonlySet<string>;\n typeOverlay?: ExpressionTypeEnvironment | undefined;\n}): string | undefined {\n if (params.source === undefined) return undefined;\n\n const expression = validatePredicateExpression({\n field: 'job.success',\n source: params.source,\n site: 'job-resolution',\n path: ['jobs', params.sourceName, 'success'],\n invalidCode: 'invalid-job-success',\n invalidMessage: 'Job success must be a valid CEL boolean expression.',\n issues: params.issues,\n allowedJobReferences: params.allowedJobReferences,\n typeOverlay: params.typeOverlay,\n });\n return expression?.source;\n}\n"],"names":["DEFAULT_JOB_SUCCESS","validatePredicateExpression","normalizeJobSuccess","params","source","undefined","expression","field","site","path","sourceName","invalidCode","invalidMessage","issues","allowedJobReferences","typeOverlay"],"mappings":"AAAA,SAAQA,mBAAmB,QAAO,+BAA+B;AAGjE,SAAQC,2BAA2B,QAAO,qCAAqC;AAE/E,SAAQD,mBAAmB,GAAE;AAE7B,OAAO,SAASE,oBAAoBC,MAMnC;IACC,IAAIA,OAAOC,MAAM,KAAKC,WAAW,OAAOA;IAExC,MAAMC,aAAaL,4BAA4B;QAC7CM,OAAO;QACPH,QAAQD,OAAOC,MAAM;QACrBI,MAAM;QACNC,MAAM;YAAC;YAAQN,OAAOO,UAAU;YAAE;SAAU;QAC5CC,aAAa;QACbC,gBAAgB;QAChBC,QAAQV,OAAOU,MAAM;QACrBC,sBAAsBX,OAAOW,oBAAoB;QACjDC,aAAaZ,OAAOY,WAAW;IACjC;IACA,OAAOT,YAAYF;AACrB"}
|
package/dist/db/db.d.ts
CHANGED
|
@@ -535,7 +535,7 @@ export declare const schema: {
|
|
|
535
535
|
tableName: "sync_states";
|
|
536
536
|
dataType: "string";
|
|
537
537
|
columnType: "PgEnumColumn";
|
|
538
|
-
data: "no-workflow-files" | "invalid-definition" | "provider-repository-not-found" | "provider-file-not-found" | "provider-access-denied" | "provider-rate-limited" | "provider-timeout" | "provider-
|
|
538
|
+
data: "unknown" | "provider-unavailable" | "no-workflow-files" | "invalid-definition" | "provider-repository-not-found" | "provider-file-not-found" | "provider-access-denied" | "provider-rate-limited" | "provider-timeout" | "provider-malformed-response" | "content-too-large" | "too-many-files" | "connection-unavailable";
|
|
539
539
|
driverParam: string;
|
|
540
540
|
notNull: false;
|
|
541
541
|
hasDefault: false;
|
|
@@ -1172,7 +1172,7 @@ export declare function db(): NodePgDatabase<{
|
|
|
1172
1172
|
tableName: "sync_states";
|
|
1173
1173
|
dataType: "string";
|
|
1174
1174
|
columnType: "PgEnumColumn";
|
|
1175
|
-
data: "no-workflow-files" | "invalid-definition" | "provider-repository-not-found" | "provider-file-not-found" | "provider-access-denied" | "provider-rate-limited" | "provider-timeout" | "provider-
|
|
1175
|
+
data: "unknown" | "provider-unavailable" | "no-workflow-files" | "invalid-definition" | "provider-repository-not-found" | "provider-file-not-found" | "provider-access-denied" | "provider-rate-limited" | "provider-timeout" | "provider-malformed-response" | "content-too-large" | "too-many-files" | "connection-unavailable";
|
|
1176
1176
|
driverParam: string;
|
|
1177
1177
|
notNull: false;
|
|
1178
1178
|
hasDefault: false;
|
|
@@ -112,7 +112,7 @@ export declare const definitionSyncStates: import("drizzle-orm/pg-core").PgTable
|
|
|
112
112
|
tableName: "sync_states";
|
|
113
113
|
dataType: "string";
|
|
114
114
|
columnType: "PgEnumColumn";
|
|
115
|
-
data: "no-workflow-files" | "invalid-definition" | "provider-repository-not-found" | "provider-file-not-found" | "provider-access-denied" | "provider-rate-limited" | "provider-timeout" | "provider-
|
|
115
|
+
data: "unknown" | "provider-unavailable" | "no-workflow-files" | "invalid-definition" | "provider-repository-not-found" | "provider-file-not-found" | "provider-access-denied" | "provider-rate-limited" | "provider-timeout" | "provider-malformed-response" | "content-too-large" | "too-many-files" | "connection-unavailable";
|
|
116
116
|
driverParam: string;
|
|
117
117
|
notNull: false;
|
|
118
118
|
hasDefault: false;
|