@shipfox/api-definitions-dto 11.0.0 → 12.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +55 -0
- package/dist/events.d.ts +3 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/inter-module.d.ts +5 -5
- package/dist/inter-module.d.ts.map +1 -1
- package/dist/schemas/dto.d.ts +38 -18
- package/dist/schemas/dto.d.ts.map +1 -1
- package/dist/schemas/dto.js +11 -1
- package/dist/schemas/dto.js.map +1 -1
- package/dist/schemas/index.d.ts +1 -1
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +1 -1
- package/dist/schemas/index.js.map +1 -1
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/dist/workflow-model.d.ts +42 -7
- package/dist/workflow-model.d.ts.map +1 -1
- package/dist/workflow-model.js +25 -3
- package/dist/workflow-model.js.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +7 -0
- package/src/inter-module.test.ts +3 -3
- package/src/schemas/dto.ts +14 -0
- package/src/schemas/index.ts +6 -0
- package/src/workflow-model.ts +63 -9
- package/tsconfig.build.tsbuildinfo +1 -1
package/dist/workflow-model.d.ts
CHANGED
|
@@ -1,13 +1,33 @@
|
|
|
1
1
|
import type { ExpressionType, OutputDeclarations, ResolvedFieldSegment, WorkflowExpression } from '@shipfox/expression';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Harness } from '@shipfox/workflow-document';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
export declare const DEFAULT_RUN_TIMEOUT_MS: number;
|
|
5
5
|
export declare const DEFAULT_JOB_SUCCESS = "!executions.exists(e, e.status == 'failed')";
|
|
6
|
-
export interface
|
|
6
|
+
export interface WorkflowModelCheckoutTemplates {
|
|
7
|
+
readonly project?: WorkflowFieldTemplate;
|
|
8
|
+
readonly connection?: WorkflowFieldTemplate;
|
|
9
|
+
readonly repository?: WorkflowFieldTemplate;
|
|
10
|
+
readonly ref?: WorkflowFieldTemplate;
|
|
11
|
+
readonly path?: WorkflowFieldTemplate;
|
|
12
|
+
}
|
|
13
|
+
export type WorkflowModelCheckoutTargetKey = keyof WorkflowModelCheckoutTemplates;
|
|
14
|
+
export declare const WORKFLOW_MODEL_CHECKOUT_TARGET_FIELDS: readonly [readonly ["project", "checkout.project"], readonly ["connection", "checkout.connection"], readonly ["repository", "checkout.repository"], readonly ["ref", "checkout.ref"], readonly ["path", "checkout.path"]];
|
|
15
|
+
export interface WorkflowModelCheckout {
|
|
16
|
+
readonly project?: string;
|
|
17
|
+
readonly connection?: string;
|
|
18
|
+
readonly repository?: string;
|
|
19
|
+
readonly ref?: string;
|
|
20
|
+
readonly fetchDepth: number;
|
|
21
|
+
readonly path?: string;
|
|
7
22
|
readonly permissions: {
|
|
8
23
|
readonly contents: 'read' | 'write';
|
|
9
24
|
};
|
|
10
25
|
readonly persistCredentials: boolean;
|
|
26
|
+
readonly force?: boolean;
|
|
27
|
+
readonly templates?: WorkflowModelCheckoutTemplates;
|
|
28
|
+
}
|
|
29
|
+
export type WorkflowModelJobCheckout = Pick<WorkflowModelCheckout, 'permissions' | 'persistCredentials'>;
|
|
30
|
+
export interface WorkflowModelStepCheckout extends WorkflowModelCheckout {
|
|
11
31
|
}
|
|
12
32
|
export declare const DEFAULT_JOB_CHECKOUT: WorkflowModelJobCheckout;
|
|
13
33
|
export type WorkflowFieldTemplate = readonly ResolvedFieldSegment[];
|
|
@@ -16,6 +36,7 @@ export type WorkflowOutputTemplates = Readonly<Record<string, WorkflowFieldTempl
|
|
|
16
36
|
export interface WorkflowModel {
|
|
17
37
|
readonly kind: 'workflow';
|
|
18
38
|
readonly name: string;
|
|
39
|
+
readonly runName?: WorkflowFieldTemplate;
|
|
19
40
|
readonly env?: Readonly<Record<string, string>>;
|
|
20
41
|
readonly templates?: {
|
|
21
42
|
readonly env?: WorkflowEnvTemplates;
|
|
@@ -39,14 +60,15 @@ export interface WorkflowModelJob {
|
|
|
39
60
|
readonly mode: 'one_shot' | 'listening';
|
|
40
61
|
readonly runner: readonly string[];
|
|
41
62
|
readonly runnerTemplates?: readonly WorkflowFieldTemplate[];
|
|
42
|
-
readonly checkout: WorkflowModelJobCheckout;
|
|
63
|
+
readonly checkout: WorkflowModelJobCheckout | false;
|
|
43
64
|
readonly if?: WorkflowExpression;
|
|
44
65
|
readonly success?: string;
|
|
45
66
|
readonly outputs?: WorkflowOutputTemplates;
|
|
46
67
|
readonly outputTypes?: Readonly<Record<string, ExpressionType>>;
|
|
47
68
|
readonly executionTimeoutMs?: number;
|
|
48
69
|
readonly listening?: WorkflowModelJobListening;
|
|
49
|
-
readonly name?:
|
|
70
|
+
readonly name?: string;
|
|
71
|
+
readonly executionName?: WorkflowFieldTemplate;
|
|
50
72
|
readonly env?: Readonly<Record<string, string>>;
|
|
51
73
|
readonly templates?: {
|
|
52
74
|
readonly env?: WorkflowEnvTemplates;
|
|
@@ -73,12 +95,13 @@ export interface WorkflowModelListeningBatch {
|
|
|
73
95
|
readonly maxSize?: number;
|
|
74
96
|
readonly maxWaitMs?: number;
|
|
75
97
|
}
|
|
76
|
-
export type WorkflowModelStep = WorkflowModelRunStep | WorkflowModelAgentStep;
|
|
98
|
+
export type WorkflowModelStep = WorkflowModelRunStep | WorkflowModelAgentStep | WorkflowModelCheckoutStep;
|
|
77
99
|
interface WorkflowModelStepBase {
|
|
78
100
|
readonly id: string;
|
|
79
101
|
readonly key?: string;
|
|
80
102
|
readonly if?: WorkflowExpression;
|
|
81
103
|
readonly name?: string;
|
|
104
|
+
readonly workingDirectory?: string;
|
|
82
105
|
readonly outputs?: OutputDeclarations;
|
|
83
106
|
readonly gate?: WorkflowModelStepGate;
|
|
84
107
|
readonly sourceLocation?: WorkflowSourceLocation;
|
|
@@ -93,6 +116,7 @@ export interface WorkflowModelRunStep extends WorkflowModelStepBase {
|
|
|
93
116
|
readonly templates?: {
|
|
94
117
|
readonly command?: WorkflowFieldTemplate;
|
|
95
118
|
readonly name?: WorkflowFieldTemplate;
|
|
119
|
+
readonly workingDirectory?: WorkflowFieldTemplate;
|
|
96
120
|
readonly env?: WorkflowEnvTemplates;
|
|
97
121
|
};
|
|
98
122
|
}
|
|
@@ -101,7 +125,8 @@ export interface WorkflowModelAgentStep extends WorkflowModelStepBase {
|
|
|
101
125
|
readonly harness?: Harness;
|
|
102
126
|
readonly model?: string;
|
|
103
127
|
readonly provider?: string;
|
|
104
|
-
|
|
128
|
+
/** An authored level, or a template source resolved when the step dispatches. */
|
|
129
|
+
readonly thinking?: string;
|
|
105
130
|
readonly tools?: readonly string[];
|
|
106
131
|
readonly integrations?: readonly WorkflowModelStepIntegration[];
|
|
107
132
|
readonly prompt: string;
|
|
@@ -109,6 +134,16 @@ export interface WorkflowModelAgentStep extends WorkflowModelStepBase {
|
|
|
109
134
|
readonly prompt?: WorkflowFieldTemplate;
|
|
110
135
|
readonly model?: WorkflowFieldTemplate;
|
|
111
136
|
readonly provider?: WorkflowFieldTemplate;
|
|
137
|
+
readonly thinking?: WorkflowFieldTemplate;
|
|
138
|
+
readonly workingDirectory?: WorkflowFieldTemplate;
|
|
139
|
+
readonly name?: WorkflowFieldTemplate;
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
export interface WorkflowModelCheckoutStep extends WorkflowModelStepBase {
|
|
143
|
+
readonly kind: 'checkout';
|
|
144
|
+
readonly checkout: WorkflowModelStepCheckout;
|
|
145
|
+
readonly templates?: {
|
|
146
|
+
readonly workingDirectory?: WorkflowFieldTemplate;
|
|
112
147
|
readonly name?: WorkflowFieldTemplate;
|
|
113
148
|
};
|
|
114
149
|
}
|
|
@@ -141,7 +176,7 @@ export interface WorkflowSourceSnapshot {
|
|
|
141
176
|
readonly format: 'yaml';
|
|
142
177
|
}
|
|
143
178
|
export declare const workflowModelSnapshotSchema: z.ZodObject<{
|
|
144
|
-
version: z.ZodLiteral<
|
|
179
|
+
version: z.ZodLiteral<2>;
|
|
145
180
|
model: z.ZodCustom<WorkflowModel, WorkflowModel>;
|
|
146
181
|
}, z.core.$strip>;
|
|
147
182
|
export type WorkflowModelSnapshot = z.infer<typeof workflowModelSnapshotSchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-model.d.ts","sourceRoot":"","sources":["../src/workflow-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAC,
|
|
1
|
+
{"version":3,"file":"workflow-model.d.ts","sourceRoot":"","sources":["../src/workflow-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,eAAO,MAAM,sBAAsB,QAA2B,CAAC;AAC/D,eAAO,MAAM,mBAAmB,gDAAgD,CAAC;AAEjF,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,OAAO,CAAC,EAAE,qBAAqB,CAAC;IACzC,QAAQ,CAAC,UAAU,CAAC,EAAE,qBAAqB,CAAC;IAC5C,QAAQ,CAAC,UAAU,CAAC,EAAE,qBAAqB,CAAC;IAC5C,QAAQ,CAAC,GAAG,CAAC,EAAE,qBAAqB,CAAC;IACrC,QAAQ,CAAC,IAAI,CAAC,EAAE,qBAAqB,CAAC;CACvC;AAED,MAAM,MAAM,8BAA8B,GAAG,MAAM,8BAA8B,CAAC;AAElF,eAAO,MAAM,qCAAqC,2NAS9C,CAAC;AAEL,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,OAAO,CAAC,EAAE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a,CAKxF;AAED,sGAAsG;AACtG,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,aAAa,GAAG,qBAAqB,GAC3C,aAAa,CAIf"}
|
package/dist/workflow-model.js
CHANGED
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export const DEFAULT_RUN_TIMEOUT_MS = 30 * 24 * 60 * 60 * 1000;
|
|
3
3
|
export const DEFAULT_JOB_SUCCESS = "!executions.exists(e, e.status == 'failed')";
|
|
4
|
+
export const WORKFLOW_MODEL_CHECKOUT_TARGET_FIELDS = [
|
|
5
|
+
[
|
|
6
|
+
'project',
|
|
7
|
+
'checkout.project'
|
|
8
|
+
],
|
|
9
|
+
[
|
|
10
|
+
'connection',
|
|
11
|
+
'checkout.connection'
|
|
12
|
+
],
|
|
13
|
+
[
|
|
14
|
+
'repository',
|
|
15
|
+
'checkout.repository'
|
|
16
|
+
],
|
|
17
|
+
[
|
|
18
|
+
'ref',
|
|
19
|
+
'checkout.ref'
|
|
20
|
+
],
|
|
21
|
+
[
|
|
22
|
+
'path',
|
|
23
|
+
'checkout.path'
|
|
24
|
+
]
|
|
25
|
+
];
|
|
4
26
|
export const DEFAULT_JOB_CHECKOUT = {
|
|
5
27
|
permissions: {
|
|
6
28
|
contents: 'read'
|
|
@@ -11,18 +33,18 @@ const workflowModelSchema = z.custom((value)=>typeof value === 'object' && value
|
|
|
11
33
|
message: 'Expected a normalized workflow model'
|
|
12
34
|
});
|
|
13
35
|
export const workflowModelSnapshotSchema = z.object({
|
|
14
|
-
version: z.literal(
|
|
36
|
+
version: z.literal(2),
|
|
15
37
|
model: workflowModelSchema
|
|
16
38
|
});
|
|
17
39
|
export function createWorkflowModelSnapshot(model) {
|
|
18
40
|
return {
|
|
19
|
-
version:
|
|
41
|
+
version: 2,
|
|
20
42
|
model
|
|
21
43
|
};
|
|
22
44
|
}
|
|
23
45
|
export function workflowModelFromSnapshot(snapshot) {
|
|
24
46
|
switch(snapshot.version){
|
|
25
|
-
case
|
|
47
|
+
case 2:
|
|
26
48
|
return snapshot.model;
|
|
27
49
|
}
|
|
28
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/workflow-model.ts"],"sourcesContent":["import type {\n ExpressionType,\n OutputDeclarations,\n ResolvedFieldSegment,\n WorkflowExpression,\n} from '@shipfox/expression';\nimport type {
|
|
1
|
+
{"version":3,"sources":["../src/workflow-model.ts"],"sourcesContent":["import type {\n ExpressionType,\n OutputDeclarations,\n ResolvedFieldSegment,\n WorkflowExpression,\n} from '@shipfox/expression';\nimport type {Harness} from '@shipfox/workflow-document';\nimport {z} from 'zod';\n\nexport const DEFAULT_RUN_TIMEOUT_MS = 30 * 24 * 60 * 60 * 1000;\nexport const DEFAULT_JOB_SUCCESS = \"!executions.exists(e, e.status == 'failed')\";\n\nexport interface WorkflowModelCheckoutTemplates {\n readonly project?: WorkflowFieldTemplate;\n readonly connection?: WorkflowFieldTemplate;\n readonly repository?: WorkflowFieldTemplate;\n readonly ref?: WorkflowFieldTemplate;\n readonly path?: WorkflowFieldTemplate;\n}\n\nexport type WorkflowModelCheckoutTargetKey = keyof WorkflowModelCheckoutTemplates;\n\nexport const WORKFLOW_MODEL_CHECKOUT_TARGET_FIELDS = [\n ['project', 'checkout.project'],\n ['connection', 'checkout.connection'],\n ['repository', 'checkout.repository'],\n ['ref', 'checkout.ref'],\n ['path', 'checkout.path'],\n] as const satisfies readonly (readonly [\n WorkflowModelCheckoutTargetKey,\n `checkout.${WorkflowModelCheckoutTargetKey}`,\n])[];\n\nexport interface WorkflowModelCheckout {\n readonly project?: string;\n readonly connection?: string;\n readonly repository?: string;\n readonly ref?: string;\n readonly fetchDepth: number;\n readonly path?: string;\n readonly permissions: {readonly contents: 'read' | 'write'};\n readonly persistCredentials: boolean;\n readonly force?: boolean;\n readonly templates?: WorkflowModelCheckoutTemplates;\n}\n\nexport type WorkflowModelJobCheckout = Pick<\n WorkflowModelCheckout,\n 'permissions' | 'persistCredentials'\n>;\n\nexport interface WorkflowModelStepCheckout extends WorkflowModelCheckout {}\n\nexport const DEFAULT_JOB_CHECKOUT: WorkflowModelJobCheckout = {\n permissions: {contents: 'read'},\n persistCredentials: true,\n};\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 runName?: WorkflowFieldTemplate;\n readonly env?: Readonly<Record<string, string>>;\n readonly templates?: {readonly env?: WorkflowEnvTemplates};\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: 'one_shot' | 'listening';\n readonly runner: readonly string[];\n readonly runnerTemplates?: readonly WorkflowFieldTemplate[];\n readonly checkout: WorkflowModelJobCheckout | false;\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?: string;\n readonly executionName?: WorkflowFieldTemplate;\n readonly env?: Readonly<Record<string, string>>;\n readonly templates?: {readonly env?: WorkflowEnvTemplates};\n readonly dependencies: readonly string[];\n readonly steps: readonly WorkflowModelStep[];\n}\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}\nexport interface WorkflowModelListeningTrigger {\n readonly source: string;\n readonly event: string;\n readonly inputs?: Readonly<Record<string, unknown>>;\n readonly filter?: string;\n}\nexport interface WorkflowModelListeningBatch {\n readonly debounceMs?: number;\n readonly maxSize?: number;\n readonly maxWaitMs?: number;\n}\nexport type WorkflowModelStep =\n | WorkflowModelRunStep\n | WorkflowModelAgentStep\n | WorkflowModelCheckoutStep;\ninterface WorkflowModelStepBase {\n readonly id: string;\n readonly key?: string;\n readonly if?: WorkflowExpression;\n readonly name?: string;\n readonly workingDirectory?: string;\n readonly outputs?: OutputDeclarations;\n readonly gate?: WorkflowModelStepGate;\n readonly sourceLocation?: WorkflowSourceLocation;\n}\nexport interface WorkflowModelRunStep extends WorkflowModelStepBase {\n readonly kind: 'run';\n readonly command: {readonly kind: 'shell'; readonly value: string};\n readonly env?: Readonly<Record<string, string>>;\n readonly templates?: {\n readonly command?: WorkflowFieldTemplate;\n readonly name?: WorkflowFieldTemplate;\n readonly workingDirectory?: WorkflowFieldTemplate;\n readonly env?: WorkflowEnvTemplates;\n };\n}\nexport interface WorkflowModelAgentStep extends WorkflowModelStepBase {\n readonly kind: 'agent';\n readonly harness?: Harness;\n readonly model?: string;\n readonly provider?: string;\n /** An authored level, or a template source resolved when the step dispatches. */\n readonly thinking?: string;\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 thinking?: WorkflowFieldTemplate;\n readonly workingDirectory?: WorkflowFieldTemplate;\n readonly name?: WorkflowFieldTemplate;\n };\n}\nexport interface WorkflowModelCheckoutStep extends WorkflowModelStepBase {\n readonly kind: 'checkout';\n readonly checkout: WorkflowModelStepCheckout;\n readonly templates?: {\n readonly workingDirectory?: WorkflowFieldTemplate;\n readonly name?: WorkflowFieldTemplate;\n };\n}\nexport interface WorkflowModelStepIntegration {\n readonly connection?: string;\n readonly include: readonly string[];\n readonly exclude?: readonly string[];\n readonly allowWrite: boolean;\n}\nexport interface WorkflowSourceLocation {\n readonly startLine: number;\n readonly endLine: number;\n}\nexport type WorkflowStepSourceLocationMap = ReadonlyMap<\n string,\n ReadonlyMap<number, WorkflowSourceLocation>\n>;\nexport interface WorkflowModelStepGate {\n readonly success?: WorkflowExpression;\n readonly onFailure?: WorkflowModelStepFailureAction;\n}\nexport interface WorkflowModelStepFailureAction {\n readonly restartFrom: string;\n readonly feedback?: string;\n readonly feedbackTemplate?: WorkflowFieldTemplate;\n}\nexport interface WorkflowModelDependency {\n readonly from: string;\n readonly to: string;\n}\nexport interface WorkflowSourceSnapshot {\n readonly content: string;\n readonly format: 'yaml';\n}\n\nconst workflowModelSchema = z.custom<WorkflowModel>(\n (value) =>\n typeof value === 'object' &&\n value !== null &&\n !Array.isArray(value) &&\n (value as {kind?: unknown}).kind === 'workflow',\n {message: 'Expected a normalized workflow model'},\n);\n\nexport const workflowModelSnapshotSchema = z.object({\n version: z.literal(2),\n model: workflowModelSchema,\n});\nexport type WorkflowModelSnapshot = z.infer<typeof workflowModelSnapshotSchema>;\n\nexport function createWorkflowModelSnapshot(model: WorkflowModel): WorkflowModelSnapshot {\n return {version: 2, model};\n}\n\nexport function workflowModelFromSnapshot(snapshot: WorkflowModelSnapshot): WorkflowModel {\n switch (snapshot.version) {\n case 2:\n return snapshot.model;\n }\n}\n\n/** Reads both current snapshots and the unversioned attempt rows written before snapshots existed. */\nexport function readPersistedWorkflowModel(\n value: WorkflowModel | WorkflowModelSnapshot,\n): WorkflowModel {\n if ('version' in value)\n return workflowModelFromSnapshot(workflowModelSnapshotSchema.parse(value));\n return workflowModelSchema.parse(value);\n}\n"],"names":["z","DEFAULT_RUN_TIMEOUT_MS","DEFAULT_JOB_SUCCESS","WORKFLOW_MODEL_CHECKOUT_TARGET_FIELDS","DEFAULT_JOB_CHECKOUT","permissions","contents","persistCredentials","workflowModelSchema","custom","value","Array","isArray","kind","message","workflowModelSnapshotSchema","object","version","literal","model","createWorkflowModelSnapshot","workflowModelFromSnapshot","snapshot","readPersistedWorkflowModel","parse"],"mappings":"AAOA,SAAQA,CAAC,QAAO,MAAM;AAEtB,OAAO,MAAMC,yBAAyB,KAAK,KAAK,KAAK,KAAK,KAAK;AAC/D,OAAO,MAAMC,sBAAsB,8CAA8C;AAYjF,OAAO,MAAMC,wCAAwC;IACnD;QAAC;QAAW;KAAmB;IAC/B;QAAC;QAAc;KAAsB;IACrC;QAAC;QAAc;KAAsB;IACrC;QAAC;QAAO;KAAe;IACvB;QAAC;QAAQ;KAAgB;CAC1B,CAGI;AAsBL,OAAO,MAAMC,uBAAiD;IAC5DC,aAAa;QAACC,UAAU;IAAM;IAC9BC,oBAAoB;AACtB,EAAE;AAuJF,MAAMC,sBAAsBR,EAAES,MAAM,CAClC,CAACC,QACC,OAAOA,UAAU,YACjBA,UAAU,QACV,CAACC,MAAMC,OAAO,CAACF,UACf,AAACA,MAA2BG,IAAI,KAAK,YACvC;IAACC,SAAS;AAAsC;AAGlD,OAAO,MAAMC,8BAA8Bf,EAAEgB,MAAM,CAAC;IAClDC,SAASjB,EAAEkB,OAAO,CAAC;IACnBC,OAAOX;AACT,GAAG;AAGH,OAAO,SAASY,4BAA4BD,KAAoB;IAC9D,OAAO;QAACF,SAAS;QAAGE;IAAK;AAC3B;AAEA,OAAO,SAASE,0BAA0BC,QAA+B;IACvE,OAAQA,SAASL,OAAO;QACtB,KAAK;YACH,OAAOK,SAASH,KAAK;IACzB;AACF;AAEA,oGAAoG,GACpG,OAAO,SAASI,2BACdb,KAA4C;IAE5C,IAAI,aAAaA,OACf,OAAOW,0BAA0BN,4BAA4BS,KAAK,CAACd;IACrE,OAAOF,oBAAoBgB,KAAK,CAACd;AACnC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shipfox/api-definitions-dto",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "12.2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/ShipfoxHQ/shipfox.git",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"zod": "^4.4.3",
|
|
26
|
-
"@shipfox/expression": "
|
|
27
|
-
"@shipfox/inter-module": "0.2.
|
|
28
|
-
"@shipfox/workflow-document": "
|
|
26
|
+
"@shipfox/expression": "2.1.0",
|
|
27
|
+
"@shipfox/inter-module": "0.2.3",
|
|
28
|
+
"@shipfox/workflow-document": "3.0.1"
|
|
29
29
|
},
|
|
30
30
|
"imports": {
|
|
31
31
|
"#*": "./dist/*"
|
package/src/index.ts
CHANGED
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
export {
|
|
2
2
|
type CreateDefinitionBodyDto,
|
|
3
3
|
createDefinitionBodySchema,
|
|
4
|
+
DEFINITION_SYNC_WARNING_CODE_MAX_LENGTH,
|
|
5
|
+
DEFINITION_SYNC_WARNING_MESSAGE_MAX_LENGTH,
|
|
6
|
+
DEFINITION_SYNC_WARNING_PATH_MAX_LENGTH,
|
|
7
|
+
DEFINITION_SYNC_WARNINGS_MAX_COUNT,
|
|
4
8
|
type DefinitionDto,
|
|
5
9
|
type DefinitionListQueryDto,
|
|
6
10
|
type DefinitionListResponseDto,
|
|
7
11
|
type DefinitionResponseDto,
|
|
8
12
|
type DefinitionSyncSummaryDto,
|
|
9
13
|
type DefinitionValidationErrorDto,
|
|
14
|
+
type DefinitionValidationWarningDto,
|
|
10
15
|
definitionDtoSchema,
|
|
11
16
|
definitionListQuerySchema,
|
|
12
17
|
definitionListResponseSchema,
|
|
13
18
|
definitionResponseSchema,
|
|
14
19
|
definitionSyncSummarySchema,
|
|
15
20
|
definitionValidationErrorSchema,
|
|
21
|
+
definitionValidationWarningSchema,
|
|
16
22
|
type TriggerDto,
|
|
17
23
|
} from '#schemas/index.js';
|
|
18
24
|
export {
|
|
@@ -35,6 +41,7 @@ export {
|
|
|
35
41
|
DEFAULT_JOB_SUCCESS,
|
|
36
42
|
DEFAULT_RUN_TIMEOUT_MS,
|
|
37
43
|
readPersistedWorkflowModel,
|
|
44
|
+
WORKFLOW_MODEL_CHECKOUT_TARGET_FIELDS,
|
|
38
45
|
workflowModelFromSnapshot,
|
|
39
46
|
workflowModelSnapshotSchema,
|
|
40
47
|
} from './workflow-model.js';
|
package/src/inter-module.test.ts
CHANGED
|
@@ -8,17 +8,17 @@ describe('definitionsInterModuleContract', () => {
|
|
|
8
8
|
id: '00000000-0000-4000-8000-000000000001',
|
|
9
9
|
projectId: '00000000-0000-4000-8000-000000000002',
|
|
10
10
|
name: 'Deploy',
|
|
11
|
-
model: {version:
|
|
11
|
+
model: {version: 2, model: {kind: 'workflow'}},
|
|
12
12
|
sourceSnapshot: null,
|
|
13
13
|
},
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
-
expect(result.definition?.model.version).toBe(
|
|
16
|
+
expect(result.definition?.model.version).toBe(2);
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
test('rejects an unknown persisted snapshot version', () => {
|
|
20
20
|
expect(() =>
|
|
21
|
-
readPersistedWorkflowModel({version:
|
|
21
|
+
readPersistedWorkflowModel({version: 1, model: {kind: 'workflow'}} as never),
|
|
22
22
|
).toThrow();
|
|
23
23
|
});
|
|
24
24
|
});
|
package/src/schemas/dto.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import {z} from 'zod';
|
|
2
2
|
|
|
3
|
+
export const DEFINITION_SYNC_WARNINGS_MAX_COUNT = 100;
|
|
4
|
+
export const DEFINITION_SYNC_WARNING_CODE_MAX_LENGTH = 128;
|
|
5
|
+
export const DEFINITION_SYNC_WARNING_MESSAGE_MAX_LENGTH = 2048;
|
|
6
|
+
export const DEFINITION_SYNC_WARNING_PATH_MAX_LENGTH = 512;
|
|
7
|
+
|
|
3
8
|
export const createDefinitionBodySchema = z
|
|
4
9
|
.object({
|
|
5
10
|
project_id: z.string().uuid(),
|
|
@@ -70,6 +75,14 @@ export const definitionValidationErrorSchema = z.object({
|
|
|
70
75
|
|
|
71
76
|
export type DefinitionValidationErrorDto = z.infer<typeof definitionValidationErrorSchema>;
|
|
72
77
|
|
|
78
|
+
export const definitionValidationWarningSchema = z.object({
|
|
79
|
+
code: z.string().max(DEFINITION_SYNC_WARNING_CODE_MAX_LENGTH),
|
|
80
|
+
message: z.string().max(DEFINITION_SYNC_WARNING_MESSAGE_MAX_LENGTH),
|
|
81
|
+
path: z.string().max(DEFINITION_SYNC_WARNING_PATH_MAX_LENGTH).optional(),
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
export type DefinitionValidationWarningDto = z.infer<typeof definitionValidationWarningSchema>;
|
|
85
|
+
|
|
73
86
|
export const definitionListQuerySchema = z.object({
|
|
74
87
|
project_id: z.string().uuid(),
|
|
75
88
|
limit: z.coerce.number().int().min(1).max(100).default(50),
|
|
@@ -102,6 +115,7 @@ export const definitionSyncSummarySchema = z.object({
|
|
|
102
115
|
])
|
|
103
116
|
.nullable(),
|
|
104
117
|
last_error_message: z.string().nullable(),
|
|
118
|
+
warnings: z.array(definitionValidationWarningSchema).max(DEFINITION_SYNC_WARNINGS_MAX_COUNT),
|
|
105
119
|
});
|
|
106
120
|
|
|
107
121
|
export type DefinitionSyncSummaryDto = z.infer<typeof definitionSyncSummarySchema>;
|
package/src/schemas/index.ts
CHANGED
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
export {
|
|
2
2
|
type CreateDefinitionBodyDto,
|
|
3
3
|
createDefinitionBodySchema,
|
|
4
|
+
DEFINITION_SYNC_WARNING_CODE_MAX_LENGTH,
|
|
5
|
+
DEFINITION_SYNC_WARNING_MESSAGE_MAX_LENGTH,
|
|
6
|
+
DEFINITION_SYNC_WARNING_PATH_MAX_LENGTH,
|
|
7
|
+
DEFINITION_SYNC_WARNINGS_MAX_COUNT,
|
|
4
8
|
type DefinitionDto,
|
|
5
9
|
type DefinitionListQueryDto,
|
|
6
10
|
type DefinitionListResponseDto,
|
|
7
11
|
type DefinitionResponseDto,
|
|
8
12
|
type DefinitionSyncSummaryDto,
|
|
9
13
|
type DefinitionValidationErrorDto,
|
|
14
|
+
type DefinitionValidationWarningDto,
|
|
10
15
|
definitionDtoSchema,
|
|
11
16
|
definitionListQuerySchema,
|
|
12
17
|
definitionListResponseSchema,
|
|
13
18
|
definitionResponseSchema,
|
|
14
19
|
definitionSyncSummarySchema,
|
|
15
20
|
definitionValidationErrorSchema,
|
|
21
|
+
definitionValidationWarningSchema,
|
|
16
22
|
} from './dto.js';
|
|
17
23
|
export type {TriggerDto} from './trigger.js';
|
package/src/workflow-model.ts
CHANGED
|
@@ -4,17 +4,53 @@ import type {
|
|
|
4
4
|
ResolvedFieldSegment,
|
|
5
5
|
WorkflowExpression,
|
|
6
6
|
} from '@shipfox/expression';
|
|
7
|
-
import type {
|
|
7
|
+
import type {Harness} from '@shipfox/workflow-document';
|
|
8
8
|
import {z} from 'zod';
|
|
9
9
|
|
|
10
10
|
export const DEFAULT_RUN_TIMEOUT_MS = 30 * 24 * 60 * 60 * 1000;
|
|
11
11
|
export const DEFAULT_JOB_SUCCESS = "!executions.exists(e, e.status == 'failed')";
|
|
12
12
|
|
|
13
|
-
export interface
|
|
13
|
+
export interface WorkflowModelCheckoutTemplates {
|
|
14
|
+
readonly project?: WorkflowFieldTemplate;
|
|
15
|
+
readonly connection?: WorkflowFieldTemplate;
|
|
16
|
+
readonly repository?: WorkflowFieldTemplate;
|
|
17
|
+
readonly ref?: WorkflowFieldTemplate;
|
|
18
|
+
readonly path?: WorkflowFieldTemplate;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type WorkflowModelCheckoutTargetKey = keyof WorkflowModelCheckoutTemplates;
|
|
22
|
+
|
|
23
|
+
export const WORKFLOW_MODEL_CHECKOUT_TARGET_FIELDS = [
|
|
24
|
+
['project', 'checkout.project'],
|
|
25
|
+
['connection', 'checkout.connection'],
|
|
26
|
+
['repository', 'checkout.repository'],
|
|
27
|
+
['ref', 'checkout.ref'],
|
|
28
|
+
['path', 'checkout.path'],
|
|
29
|
+
] as const satisfies readonly (readonly [
|
|
30
|
+
WorkflowModelCheckoutTargetKey,
|
|
31
|
+
`checkout.${WorkflowModelCheckoutTargetKey}`,
|
|
32
|
+
])[];
|
|
33
|
+
|
|
34
|
+
export interface WorkflowModelCheckout {
|
|
35
|
+
readonly project?: string;
|
|
36
|
+
readonly connection?: string;
|
|
37
|
+
readonly repository?: string;
|
|
38
|
+
readonly ref?: string;
|
|
39
|
+
readonly fetchDepth: number;
|
|
40
|
+
readonly path?: string;
|
|
14
41
|
readonly permissions: {readonly contents: 'read' | 'write'};
|
|
15
42
|
readonly persistCredentials: boolean;
|
|
43
|
+
readonly force?: boolean;
|
|
44
|
+
readonly templates?: WorkflowModelCheckoutTemplates;
|
|
16
45
|
}
|
|
17
46
|
|
|
47
|
+
export type WorkflowModelJobCheckout = Pick<
|
|
48
|
+
WorkflowModelCheckout,
|
|
49
|
+
'permissions' | 'persistCredentials'
|
|
50
|
+
>;
|
|
51
|
+
|
|
52
|
+
export interface WorkflowModelStepCheckout extends WorkflowModelCheckout {}
|
|
53
|
+
|
|
18
54
|
export const DEFAULT_JOB_CHECKOUT: WorkflowModelJobCheckout = {
|
|
19
55
|
permissions: {contents: 'read'},
|
|
20
56
|
persistCredentials: true,
|
|
@@ -27,6 +63,7 @@ export type WorkflowOutputTemplates = Readonly<Record<string, WorkflowFieldTempl
|
|
|
27
63
|
export interface WorkflowModel {
|
|
28
64
|
readonly kind: 'workflow';
|
|
29
65
|
readonly name: string;
|
|
66
|
+
readonly runName?: WorkflowFieldTemplate;
|
|
30
67
|
readonly env?: Readonly<Record<string, string>>;
|
|
31
68
|
readonly templates?: {readonly env?: WorkflowEnvTemplates};
|
|
32
69
|
readonly triggers: readonly WorkflowModelTrigger[];
|
|
@@ -50,14 +87,15 @@ export interface WorkflowModelJob {
|
|
|
50
87
|
readonly mode: 'one_shot' | 'listening';
|
|
51
88
|
readonly runner: readonly string[];
|
|
52
89
|
readonly runnerTemplates?: readonly WorkflowFieldTemplate[];
|
|
53
|
-
readonly checkout: WorkflowModelJobCheckout;
|
|
90
|
+
readonly checkout: WorkflowModelJobCheckout | false;
|
|
54
91
|
readonly if?: WorkflowExpression;
|
|
55
92
|
readonly success?: string;
|
|
56
93
|
readonly outputs?: WorkflowOutputTemplates;
|
|
57
94
|
readonly outputTypes?: Readonly<Record<string, ExpressionType>>;
|
|
58
95
|
readonly executionTimeoutMs?: number;
|
|
59
96
|
readonly listening?: WorkflowModelJobListening;
|
|
60
|
-
readonly name?:
|
|
97
|
+
readonly name?: string;
|
|
98
|
+
readonly executionName?: WorkflowFieldTemplate;
|
|
61
99
|
readonly env?: Readonly<Record<string, string>>;
|
|
62
100
|
readonly templates?: {readonly env?: WorkflowEnvTemplates};
|
|
63
101
|
readonly dependencies: readonly string[];
|
|
@@ -83,12 +121,16 @@ export interface WorkflowModelListeningBatch {
|
|
|
83
121
|
readonly maxSize?: number;
|
|
84
122
|
readonly maxWaitMs?: number;
|
|
85
123
|
}
|
|
86
|
-
export type WorkflowModelStep =
|
|
124
|
+
export type WorkflowModelStep =
|
|
125
|
+
| WorkflowModelRunStep
|
|
126
|
+
| WorkflowModelAgentStep
|
|
127
|
+
| WorkflowModelCheckoutStep;
|
|
87
128
|
interface WorkflowModelStepBase {
|
|
88
129
|
readonly id: string;
|
|
89
130
|
readonly key?: string;
|
|
90
131
|
readonly if?: WorkflowExpression;
|
|
91
132
|
readonly name?: string;
|
|
133
|
+
readonly workingDirectory?: string;
|
|
92
134
|
readonly outputs?: OutputDeclarations;
|
|
93
135
|
readonly gate?: WorkflowModelStepGate;
|
|
94
136
|
readonly sourceLocation?: WorkflowSourceLocation;
|
|
@@ -100,6 +142,7 @@ export interface WorkflowModelRunStep extends WorkflowModelStepBase {
|
|
|
100
142
|
readonly templates?: {
|
|
101
143
|
readonly command?: WorkflowFieldTemplate;
|
|
102
144
|
readonly name?: WorkflowFieldTemplate;
|
|
145
|
+
readonly workingDirectory?: WorkflowFieldTemplate;
|
|
103
146
|
readonly env?: WorkflowEnvTemplates;
|
|
104
147
|
};
|
|
105
148
|
}
|
|
@@ -108,7 +151,8 @@ export interface WorkflowModelAgentStep extends WorkflowModelStepBase {
|
|
|
108
151
|
readonly harness?: Harness;
|
|
109
152
|
readonly model?: string;
|
|
110
153
|
readonly provider?: string;
|
|
111
|
-
|
|
154
|
+
/** An authored level, or a template source resolved when the step dispatches. */
|
|
155
|
+
readonly thinking?: string;
|
|
112
156
|
readonly tools?: readonly string[];
|
|
113
157
|
readonly integrations?: readonly WorkflowModelStepIntegration[];
|
|
114
158
|
readonly prompt: string;
|
|
@@ -116,6 +160,16 @@ export interface WorkflowModelAgentStep extends WorkflowModelStepBase {
|
|
|
116
160
|
readonly prompt?: WorkflowFieldTemplate;
|
|
117
161
|
readonly model?: WorkflowFieldTemplate;
|
|
118
162
|
readonly provider?: WorkflowFieldTemplate;
|
|
163
|
+
readonly thinking?: WorkflowFieldTemplate;
|
|
164
|
+
readonly workingDirectory?: WorkflowFieldTemplate;
|
|
165
|
+
readonly name?: WorkflowFieldTemplate;
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
export interface WorkflowModelCheckoutStep extends WorkflowModelStepBase {
|
|
169
|
+
readonly kind: 'checkout';
|
|
170
|
+
readonly checkout: WorkflowModelStepCheckout;
|
|
171
|
+
readonly templates?: {
|
|
172
|
+
readonly workingDirectory?: WorkflowFieldTemplate;
|
|
119
173
|
readonly name?: WorkflowFieldTemplate;
|
|
120
174
|
};
|
|
121
175
|
}
|
|
@@ -161,18 +215,18 @@ const workflowModelSchema = z.custom<WorkflowModel>(
|
|
|
161
215
|
);
|
|
162
216
|
|
|
163
217
|
export const workflowModelSnapshotSchema = z.object({
|
|
164
|
-
version: z.literal(
|
|
218
|
+
version: z.literal(2),
|
|
165
219
|
model: workflowModelSchema,
|
|
166
220
|
});
|
|
167
221
|
export type WorkflowModelSnapshot = z.infer<typeof workflowModelSnapshotSchema>;
|
|
168
222
|
|
|
169
223
|
export function createWorkflowModelSnapshot(model: WorkflowModel): WorkflowModelSnapshot {
|
|
170
|
-
return {version:
|
|
224
|
+
return {version: 2, model};
|
|
171
225
|
}
|
|
172
226
|
|
|
173
227
|
export function workflowModelFromSnapshot(snapshot: WorkflowModelSnapshot): WorkflowModel {
|
|
174
228
|
switch (snapshot.version) {
|
|
175
|
-
case
|
|
229
|
+
case 2:
|
|
176
230
|
return snapshot.model;
|
|
177
231
|
}
|
|
178
232
|
}
|