@shipfox/api-definitions 4.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.
Files changed (92) hide show
  1. package/.turbo/turbo-build.log +4 -4
  2. package/CHANGELOG.md +64 -0
  3. package/dist/core/entities/workflow-definition.d.ts +2 -5
  4. package/dist/core/entities/workflow-definition.d.ts.map +1 -1
  5. package/dist/core/entities/workflow-definition.js.map +1 -1
  6. package/dist/core/entities/workflow-model.d.ts +1 -137
  7. package/dist/core/entities/workflow-model.d.ts.map +1 -1
  8. package/dist/core/entities/workflow-model.js.map +1 -1
  9. package/dist/core/integrations.d.ts +25 -0
  10. package/dist/core/integrations.d.ts.map +1 -0
  11. package/dist/core/integrations.js +30 -0
  12. package/dist/core/integrations.js.map +1 -0
  13. package/dist/core/sync-definitions.d.ts +2 -2
  14. package/dist/core/sync-definitions.d.ts.map +1 -1
  15. package/dist/core/sync-definitions.js +23 -14
  16. package/dist/core/sync-definitions.js.map +1 -1
  17. package/dist/core/workflow-model/constants.d.ts +1 -1
  18. package/dist/core/workflow-model/constants.d.ts.map +1 -1
  19. package/dist/core/workflow-model/constants.js +1 -1
  20. package/dist/core/workflow-model/constants.js.map +1 -1
  21. package/dist/core/workflow-model/normalize-job-checkout.d.ts +2 -2
  22. package/dist/core/workflow-model/normalize-job-checkout.d.ts.map +1 -1
  23. package/dist/core/workflow-model/normalize-job-checkout.js +2 -6
  24. package/dist/core/workflow-model/normalize-job-checkout.js.map +1 -1
  25. package/dist/core/workflow-model/normalize-job-success.d.ts +2 -1
  26. package/dist/core/workflow-model/normalize-job-success.d.ts.map +1 -1
  27. package/dist/core/workflow-model/normalize-job-success.js +2 -1
  28. package/dist/core/workflow-model/normalize-job-success.js.map +1 -1
  29. package/dist/db/db.d.ts +2 -2
  30. package/dist/db/schema/sync-states.d.ts +1 -1
  31. package/dist/index.d.ts +5 -7
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +10 -11
  34. package/dist/index.js.map +1 -1
  35. package/dist/presentation/index.d.ts +1 -1
  36. package/dist/presentation/index.d.ts.map +1 -1
  37. package/dist/presentation/index.js +1 -1
  38. package/dist/presentation/index.js.map +1 -1
  39. package/dist/presentation/inter-module.d.ts +4 -0
  40. package/dist/presentation/inter-module.d.ts.map +1 -0
  41. package/dist/presentation/inter-module.js +25 -0
  42. package/dist/presentation/inter-module.js.map +1 -0
  43. package/dist/presentation/routes/create-definition.d.ts +5 -6
  44. package/dist/presentation/routes/create-definition.d.ts.map +1 -1
  45. package/dist/presentation/routes/create-definition.js +7 -19
  46. package/dist/presentation/routes/create-definition.js.map +1 -1
  47. package/dist/presentation/routes/get-definition.d.ts +2 -1
  48. package/dist/presentation/routes/get-definition.d.ts.map +1 -1
  49. package/dist/presentation/routes/get-definition.js +26 -35
  50. package/dist/presentation/routes/get-definition.js.map +1 -1
  51. package/dist/presentation/routes/index.d.ts +1 -2
  52. package/dist/presentation/routes/index.d.ts.map +1 -1
  53. package/dist/presentation/routes/index.js +5 -6
  54. package/dist/presentation/routes/index.js.map +1 -1
  55. package/dist/presentation/routes/list-definitions.d.ts +2 -1
  56. package/dist/presentation/routes/list-definitions.d.ts.map +1 -1
  57. package/dist/presentation/routes/list-definitions.js +36 -45
  58. package/dist/presentation/routes/list-definitions.js.map +1 -1
  59. package/dist/presentation/routes/project-access.d.ts +10 -0
  60. package/dist/presentation/routes/project-access.d.ts.map +1 -0
  61. package/dist/presentation/routes/project-access.js +17 -0
  62. package/dist/presentation/routes/project-access.js.map +1 -0
  63. package/dist/temporal/activities/sync-activities.d.ts +3 -9
  64. package/dist/temporal/activities/sync-activities.d.ts.map +1 -1
  65. package/dist/temporal/activities/sync-activities.js +6 -10
  66. package/dist/temporal/activities/sync-activities.js.map +1 -1
  67. package/dist/tsconfig.test.tsbuildinfo +1 -1
  68. package/package.json +30 -38
  69. package/src/core/entities/workflow-definition.ts +3 -6
  70. package/src/core/entities/workflow-model.ts +1 -162
  71. package/src/core/integrations.ts +39 -0
  72. package/src/core/sync-definitions.test.ts +19 -17
  73. package/src/core/sync-definitions.ts +26 -20
  74. package/src/core/workflow-model/constants.ts +1 -1
  75. package/src/core/workflow-model/normalize-job-checkout.ts +2 -5
  76. package/src/core/workflow-model/normalize-job-success.ts +2 -1
  77. package/src/db/definitions.test.ts +68 -7
  78. package/src/index.ts +12 -31
  79. package/src/presentation/index.ts +1 -1
  80. package/src/presentation/inter-module.ts +25 -0
  81. package/src/presentation/routes/create-definition.test.ts +59 -63
  82. package/src/presentation/routes/create-definition.ts +15 -34
  83. package/src/presentation/routes/get-definition.test.ts +14 -8
  84. package/src/presentation/routes/get-definition.ts +25 -28
  85. package/src/presentation/routes/index.test.ts +8 -1
  86. package/src/presentation/routes/index.ts +5 -7
  87. package/src/presentation/routes/list-definitions.test.ts +8 -7
  88. package/src/presentation/routes/list-definitions.ts +33 -36
  89. package/src/presentation/routes/project-access.ts +16 -0
  90. package/src/temporal/activities/sync-activities.test.ts +9 -6
  91. package/src/temporal/activities/sync-activities.ts +14 -29
  92. package/tsconfig.build.tsbuildinfo +1 -1
@@ -1,6 +1,6 @@
1
1
  $ shipfox-swc && shipfox-temporal-bundle dist/temporal/workflows/index.js
2
- Successfully compiled: 69 files with swc (190.84ms)
3
- 2026-07-19T08:15:21.206Z [INFO] asset workflow-bundle-5046e0cf40917a545f36.js 1.46 MiB [emitted] [immutable] (name: main)
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 852 ms
20
- 2026-07-19T08:15:21.208Z [INFO] Workflow bundle created { size: '1.46MB' }
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,69 @@
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
+
39
+ ## 5.0.0
40
+
41
+ ### Patch Changes
42
+
43
+ - bb037af: Resolves workspace packages from source during development while published consumers continue to use compiled output.
44
+ - Updated dependencies [2875241]
45
+ - Updated dependencies [bb037af]
46
+ - Updated dependencies [fb70438]
47
+ - @shipfox/api-integration-core@5.0.0
48
+ - @shipfox/api-integration-core-dto@5.0.0
49
+ - @shipfox/api-agent-dto@5.0.0
50
+ - @shipfox/api-auth-context@5.0.0
51
+ - @shipfox/api-definitions-dto@5.0.0
52
+ - @shipfox/api-projects@5.0.0
53
+ - @shipfox/api-projects-dto@5.0.0
54
+ - @shipfox/api-secrets-dto@5.0.0
55
+ - @shipfox/config@1.2.2
56
+ - @shipfox/expression@1.1.3
57
+ - @shipfox/node-drizzle@0.3.1
58
+ - @shipfox/node-fastify@0.2.3
59
+ - @shipfox/node-module@0.3.2
60
+ - @shipfox/node-opentelemetry@0.5.2
61
+ - @shipfox/node-outbox@0.2.3
62
+ - @shipfox/node-postgres@0.4.2
63
+ - @shipfox/node-temporal@0.3.1
64
+ - @shipfox/runner-labels@0.1.1
65
+ - @shipfox/workflow-document@2.1.1
66
+
3
67
  ## 4.0.0
4
68
 
5
69
  ### 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
- import type { WorkflowModel } from './workflow-model.js';
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,gBAAgB,EAAC,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAEvD,MAAM,MAAM,YAAY,GAAG,gBAAgB,CAAC;AAE5C,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,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
+ {"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 {WorkflowDocument} from '@shipfox/workflow-document';\nimport type {WorkflowModel} from './workflow-model.js';\n\nexport type WorkflowSpec = WorkflowDocument;\n\nexport interface WorkflowSourceSnapshot {\n content: string;\n format: 'yaml';\n}\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":"AAgBA,WAqBC"}
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
- import type { ExpressionType, OutputDeclarations, ResolvedFieldSegment, WorkflowExpression } from '@shipfox/expression';
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,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAC,aAAa,EAAE,OAAO,EAAC,MAAM,4BAA4B,CAAC;AAEvE,MAAM,MAAM,qBAAqB,GAAG,SAAS,oBAAoB,EAAE,CAAC;AACpE,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC,CAAC;AACnF,MAAM,MAAM,uBAAuB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC,CAAC;AAEtF,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAChD,QAAQ,CAAC,SAAS,CAAC,EAAE;QACnB,QAAQ,CAAC,GAAG,CAAC,EAAE,oBAAoB,CAAC;KACrC,CAAC;IACF,QAAQ,CAAC,QAAQ,EAAE,SAAS,oBAAoB,EAAE,CAAC;IACnD,QAAQ,CAAC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IACtC,QAAQ,CAAC,SAAS,CAAC,EAAE,8BAA8B,CAAC;CACrD;AAED,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,gBAAgB,CAAC,EAAE,qBAAqB,CAAC;CACnD;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB"}
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":["import type {\n ExpressionType,\n OutputDeclarations,\n ResolvedFieldSegment,\n WorkflowExpression,\n} from '@shipfox/expression';\nimport type {AgentThinking, Harness} from '@shipfox/workflow-document';\n\nexport type WorkflowFieldTemplate = readonly ResolvedFieldSegment[];\nexport type WorkflowEnvTemplates = Readonly<Record<string, WorkflowFieldTemplate>>;\nexport type WorkflowOutputTemplates = Readonly<Record<string, WorkflowFieldTemplate>>;\n\nexport interface WorkflowModel {\n readonly kind: 'workflow';\n readonly name: string;\n readonly env?: Readonly<Record<string, string>>;\n readonly templates?: {\n readonly env?: WorkflowEnvTemplates;\n };\n readonly triggers: readonly WorkflowModelTrigger[];\n readonly jobs: readonly WorkflowModelJob[];\n readonly dependencies: readonly WorkflowModelDependency[];\n}\n\nexport interface WorkflowModelTrigger {\n readonly id: string;\n readonly key: string;\n readonly source: string;\n readonly event: string;\n readonly inputs?: Readonly<Record<string, unknown>>;\n readonly filter?: string;\n readonly config?: Readonly<Record<string, unknown>>;\n}\n\nexport interface WorkflowModelJob {\n readonly id: string;\n readonly key: string;\n readonly mode: WorkflowModelJobMode;\n readonly runner: readonly string[];\n readonly runnerTemplates?: readonly WorkflowFieldTemplate[];\n readonly checkout: WorkflowModelJobCheckout;\n readonly if?: WorkflowExpression;\n readonly success?: string;\n readonly outputs?: WorkflowOutputTemplates;\n readonly outputTypes?: Readonly<Record<string, ExpressionType>>;\n readonly executionTimeoutMs?: number;\n readonly listening?: WorkflowModelJobListening;\n readonly name?: WorkflowFieldTemplate;\n readonly env?: Readonly<Record<string, string>>;\n readonly templates?: {\n readonly env?: WorkflowEnvTemplates;\n };\n readonly dependencies: readonly string[];\n readonly steps: readonly WorkflowModelStep[];\n}\n\nexport type WorkflowModelJobMode = 'one_shot' | 'listening';\n\nexport interface WorkflowModelJobListening {\n readonly on: readonly WorkflowModelListeningTrigger[];\n readonly until?: readonly WorkflowModelListeningTrigger[];\n readonly timeoutMs?: number;\n readonly maxExecutions?: number;\n readonly batch?: WorkflowModelListeningBatch;\n readonly onResolve: 'finish' | 'cancel';\n}\n\nexport interface WorkflowModelListeningTrigger {\n readonly source: string;\n readonly event: string;\n readonly inputs?: Readonly<Record<string, unknown>>;\n readonly filter?: string;\n}\n\nexport interface WorkflowModelListeningBatch {\n readonly debounceMs?: number;\n readonly maxSize?: number;\n readonly maxWaitMs?: number;\n}\n\nexport interface WorkflowModelJobCheckout {\n readonly permissions: {readonly contents: 'read' | 'write'};\n readonly persistCredentials: boolean;\n}\n\nexport type WorkflowModelStep = WorkflowModelRunStep | WorkflowModelAgentStep;\n\ninterface WorkflowModelStepBase {\n readonly id: string;\n readonly key?: string;\n readonly if?: WorkflowExpression;\n readonly name?: string;\n readonly outputs?: OutputDeclarations;\n readonly gate?: WorkflowModelStepGate;\n readonly sourceLocation?: WorkflowSourceLocation;\n}\n\nexport interface WorkflowModelRunStep extends WorkflowModelStepBase {\n readonly kind: 'run';\n readonly command: WorkflowModelRunCommand;\n readonly env?: Readonly<Record<string, string>>;\n readonly templates?: {\n readonly command?: WorkflowFieldTemplate;\n readonly name?: WorkflowFieldTemplate;\n readonly env?: WorkflowEnvTemplates;\n };\n}\n\nexport interface WorkflowModelAgentStep extends WorkflowModelStepBase {\n readonly kind: 'agent';\n readonly harness?: Harness;\n readonly model?: string;\n readonly provider?: string;\n readonly thinking?: AgentThinking;\n readonly tools?: readonly string[];\n readonly integrations?: readonly WorkflowModelStepIntegration[];\n readonly prompt: string;\n readonly templates?: {\n readonly prompt?: WorkflowFieldTemplate;\n readonly model?: WorkflowFieldTemplate;\n readonly provider?: WorkflowFieldTemplate;\n readonly name?: WorkflowFieldTemplate;\n };\n}\n\nexport interface WorkflowModelStepIntegration {\n readonly connection?: string;\n readonly include: readonly string[];\n readonly exclude?: readonly string[];\n readonly allowWrite: boolean;\n}\n\nexport interface WorkflowSourceLocation {\n readonly startLine: number;\n readonly endLine: number;\n}\n\nexport type WorkflowStepSourceLocationMap = ReadonlyMap<\n string,\n ReadonlyMap<number, WorkflowSourceLocation>\n>;\n\nexport interface WorkflowModelRunCommand {\n readonly kind: 'shell';\n readonly value: string;\n}\n\nexport interface WorkflowModelStepGate {\n readonly success?: WorkflowExpression;\n readonly onFailure?: WorkflowModelStepFailureAction;\n}\n\nexport interface WorkflowModelStepFailureAction {\n readonly restartFrom: string;\n readonly feedback?: string;\n readonly feedbackTemplate?: WorkflowFieldTemplate;\n}\n\nexport interface WorkflowModelDependency {\n readonly from: string;\n readonly to: string;\n}\n"],"names":[],"mappings":"AA8JA,WAGC"}
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: IntegrationSourceControlService;
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":"AACA,OAAO,EAKL,KAAK,+BAA+B,EAErC,MAAM,+BAA+B,CAAC;AAEvC,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;AAKjF,eAAO,MAAM,eAAe,wBAAwB,CAAC;AACrD,eAAO,MAAM,kBAAkB,MAAM,CAAC;AACtC,eAAO,MAAM,sBAAsB,IAAI,CAAC;AACxC,eAAO,MAAM,mBAAmB,mBAAmB,CAAC;AAEpD,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,0BAA0B,EAAE,MAAM,CAAC;IACnC,aAAa,EAAE,+BAA+B,CAAC;CAChD;AAED,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;CACb;AAED,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAO9F;AAED,MAAM,WAAW,2BAA4B,SAAQ,iBAAiB;IACpE,GAAG,EAAE,MAAM,CAAC;CACb;AAED,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,2BAA2B,GAClC,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAC,CAAC,CA2B5B;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,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rationConnectionNotFoundError, IntegrationConnectionWorkspaceMismatchError, IntegrationProviderError, MAX_REPOSITORY_FILE_BYTES } from '@shipfox/api-integration-core';
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
- if (error instanceof IntegrationConnectionNotFoundError || error instanceof IntegrationConnectionInactiveError || error instanceof IntegrationConnectionWorkspaceMismatchError) {
102
- return {
103
- code: 'connection-unavailable',
104
- message: error.message,
105
- retryable: false
106
- };
107
- }
108
- if (error instanceof IntegrationProviderError) {
109
- return {
110
- code: providerErrorCode(error.reason),
111
- message: error.message,
112
- retryable: isProviderReasonRetryable(error.reason)
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,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;QA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AAMC,OAAO;YAAEG,WAAW;QAAK;IACpE;IACA,IACEJ,iBAAiB9D,sCACjB8D,iBAAiB/D,sCACjB+D,iBAAiB7D,6CACjB;QACA,OAAO;YAACgE,MAAM;YAA0BF,SAASD,MAAMC,OAAO;YAAEG,WAAW;QAAK;IAClF;IACA,IAAIJ,iBAAiB5D,0BAA0B;QAC7C,OAAO;YACL+D,MAAME,kBAAkBL,MAAMM,MAAM;YACpCL,SAASD,MAAMC,OAAO;YACtBG,WAAWG,0BAA0BP,MAAMM,MAAM;QACnD;IACF;IACA,OAAO;QACLH,MAAM;QACNF,SAASD,iBAAiBQ,QAAQR,MAAMC,OAAO,GAAGQ,OAAOT;QACzDI,WAAW;IACb;AACF;AAEA,SAASG,0BAA0BD,MAAc;IAC/C,OAAOA,WAAW,kBAAkBA,WAAW,aAAaA,WAAW;AACzE;AAEA,SAASD,kBAAkBC,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,SAASR,UAAUb,OAAe;IAChC,OAAOjD,WAAW,UAAU0E,MAAM,CAACzB,SAAS,QAAQ0B,MAAM,CAAC;AAC7D"}
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,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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-1,2 +1,2 @@
1
- export declare const DEFAULT_RUN_TIMEOUT_MS: number;
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,eAAO,MAAM,sBAAsB,QAA2B,CAAC"}
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,3 +1,3 @@
1
- export const DEFAULT_RUN_TIMEOUT_MS = 30 * 24 * 60 * 60 * 1000;
1
+ export { DEFAULT_RUN_TIMEOUT_MS } from '@shipfox/api-definitions-dto';
2
2
 
3
3
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/core/workflow-model/constants.ts"],"sourcesContent":["export const DEFAULT_RUN_TIMEOUT_MS = 30 * 24 * 60 * 60 * 1000;\n"],"names":["DEFAULT_RUN_TIMEOUT_MS"],"mappings":"AAAA,OAAO,MAAMA,yBAAyB,KAAK,KAAK,KAAK,KAAK,KAAK"}
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
- import type { WorkflowModelJobCheckout } from '../entities/workflow-model.js';
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,EAAC,2BAA2B,EAAC,MAAM,4BAA4B,CAAC;AAC5E,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,+BAA+B,CAAC;AAE5E,eAAO,MAAM,oBAAoB,EAAE,wBAGlC,CAAC;AAEF,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,2BAA2B,GAAG,SAAS,GAChD,wBAAwB,CAQ1B"}
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
- export const DEFAULT_JOB_CHECKOUT = {
2
- permissions: {
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 {WorkflowDocumentJobCheckout} from '@shipfox/workflow-document';\nimport type {WorkflowModelJobCheckout} from '../entities/workflow-model.js';\n\nexport const DEFAULT_JOB_CHECKOUT: WorkflowModelJobCheckout = {\n permissions: {contents: 'read'},\n persistCredentials: true,\n};\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","permissions","contents","persistCredentials","normalizeJobCheckout","checkout"],"mappings":"AAGA,OAAO,MAAMA,uBAAiD;IAC5DC,aAAa;QAACC,UAAU;IAAM;IAC9BC,oBAAoB;AACtB,EAAE;AAEF,OAAO,SAASC,qBACdC,QAAiD;IAEjD,OAAO;QACLJ,aAAa;YACXC,UAAUG,UAAUJ,aAAaC,YAAYF,qBAAqBC,WAAW,CAACC,QAAQ;QACxF;QACAC,oBACEE,UAAU,CAAC,sBAAsB,IAAIL,qBAAqBG,kBAAkB;IAChF;AACF"}
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 declare const DEFAULT_JOB_SUCCESS = "!executions.exists(e, e.status == 'failed')";
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,eAAO,MAAM,mBAAmB,gDAAgD,CAAC;AAEjF,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
+ {"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 const DEFAULT_JOB_SUCCESS = "!executions.exists(e, e.status == 'failed')";
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 const DEFAULT_JOB_SUCCESS = \"!executions.exists(e, e.status == 'failed')\";\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":["validatePredicateExpression","DEFAULT_JOB_SUCCESS","normalizeJobSuccess","params","source","undefined","expression","field","site","path","sourceName","invalidCode","invalidMessage","issues","allowedJobReferences","typeOverlay"],"mappings":"AAEA,SAAQA,2BAA2B,QAAO,qCAAqC;AAE/E,OAAO,MAAMC,sBAAsB,8CAA8C;AAEjF,OAAO,SAASC,oBAAoBC,MAMnC;IACC,IAAIA,OAAOC,MAAM,KAAKC,WAAW,OAAOA;IAExC,MAAMC,aAAaN,4BAA4B;QAC7CO,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"}
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"}