@shipfox/api-definitions-dto 12.2.0 → 14.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +28 -0
- package/dist/events.d.ts +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/inter-module.d.ts +109 -0
- package/dist/inter-module.d.ts.map +1 -1
- package/dist/inter-module.js +92 -0
- package/dist/inter-module.js.map +1 -1
- package/dist/schemas/dto.d.ts +21 -5
- package/dist/schemas/dto.d.ts.map +1 -1
- package/dist/schemas/dto.js +10 -4
- 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/schemas/trigger.d.ts +1 -1
- package/dist/schemas/trigger.js +1 -1
- package/dist/schemas/trigger.js.map +1 -1
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/dist/workflow-model.d.ts +2 -2
- package/dist/workflow-model.d.ts.map +1 -1
- package/dist/workflow-model.js.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +4 -3
- package/src/inter-module.test.ts +87 -0
- package/src/inter-module.ts +61 -0
- package/src/schemas/dto.test.ts +62 -0
- package/src/schemas/dto.ts +11 -4
- package/src/schemas/index.ts +4 -3
- package/src/schemas/trigger.ts +1 -1
- package/src/workflow-model.ts +2 -2
- package/tsconfig.build.tsbuildinfo +1 -1
package/dist/workflow-model.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ export interface WorkflowModelTrigger {
|
|
|
49
49
|
readonly id: string;
|
|
50
50
|
readonly key: string;
|
|
51
51
|
readonly source: string;
|
|
52
|
-
readonly event
|
|
52
|
+
readonly event?: string;
|
|
53
53
|
readonly inputs?: Readonly<Record<string, unknown>>;
|
|
54
54
|
readonly filter?: string;
|
|
55
55
|
readonly config?: Readonly<Record<string, unknown>>;
|
|
@@ -86,7 +86,7 @@ export interface WorkflowModelJobListening {
|
|
|
86
86
|
}
|
|
87
87
|
export interface WorkflowModelListeningTrigger {
|
|
88
88
|
readonly source: string;
|
|
89
|
-
readonly event
|
|
89
|
+
readonly event?: string;
|
|
90
90
|
readonly inputs?: Readonly<Record<string, unknown>>;
|
|
91
91
|
readonly filter?: string;
|
|
92
92
|
}
|
|
@@ -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,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,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,CAAC,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wBAAgB,0BAA0B,CACxC,KAAK,EAAE,aAAa,GAAG,qBAAqB,GAC3C,aAAa,CAIf"}
|
|
@@ -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 {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
|
|
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": "14.0.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": "2.1
|
|
26
|
+
"@shipfox/expression": "2.2.1",
|
|
27
27
|
"@shipfox/inter-module": "0.2.3",
|
|
28
|
-
"@shipfox/workflow-document": "3.0
|
|
28
|
+
"@shipfox/workflow-document": "3.1.0"
|
|
29
29
|
},
|
|
30
30
|
"imports": {
|
|
31
31
|
"#*": "./dist/*"
|
package/src/index.ts
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
export {
|
|
2
2
|
type CreateDefinitionBodyDto,
|
|
3
3
|
createDefinitionBodySchema,
|
|
4
|
+
DEFINITION_SYNC_DIAGNOSTIC_FILE_PATH_MAX_LENGTH,
|
|
5
|
+
DEFINITION_SYNC_DIAGNOSTICS_MAX_COUNT,
|
|
4
6
|
DEFINITION_SYNC_WARNING_CODE_MAX_LENGTH,
|
|
5
7
|
DEFINITION_SYNC_WARNING_MESSAGE_MAX_LENGTH,
|
|
6
8
|
DEFINITION_SYNC_WARNING_PATH_MAX_LENGTH,
|
|
7
|
-
DEFINITION_SYNC_WARNINGS_MAX_COUNT,
|
|
8
9
|
type DefinitionDto,
|
|
9
10
|
type DefinitionListQueryDto,
|
|
10
11
|
type DefinitionListResponseDto,
|
|
11
12
|
type DefinitionResponseDto,
|
|
12
13
|
type DefinitionSyncSummaryDto,
|
|
14
|
+
type DefinitionValidationDiagnosticDto,
|
|
13
15
|
type DefinitionValidationErrorDto,
|
|
14
|
-
type DefinitionValidationWarningDto,
|
|
15
16
|
definitionDtoSchema,
|
|
16
17
|
definitionListQuerySchema,
|
|
17
18
|
definitionListResponseSchema,
|
|
18
19
|
definitionResponseSchema,
|
|
19
20
|
definitionSyncSummarySchema,
|
|
21
|
+
definitionValidationDiagnosticSchema,
|
|
20
22
|
definitionValidationErrorSchema,
|
|
21
|
-
definitionValidationWarningSchema,
|
|
22
23
|
type TriggerDto,
|
|
23
24
|
} from '#schemas/index.js';
|
|
24
25
|
export {
|
package/src/inter-module.test.ts
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import {definitionsInterModuleContract} from './inter-module.js';
|
|
2
2
|
import {readPersistedWorkflowModel} from './workflow-model.js';
|
|
3
3
|
|
|
4
|
+
const PROJECT_ID = '00000000-0000-4000-8000-000000000001';
|
|
5
|
+
const WORKFLOW_ID = '00000000-0000-4000-8000-000000000002';
|
|
6
|
+
const REF = 'refs/heads/main';
|
|
7
|
+
const CONFIG_PATH = '.shipfox/workflows/ci.yml';
|
|
8
|
+
const COMMIT = 'a1b2c3d4e5f6a7b8c9d0a1b2c3d4e5f6a7b8c9d0';
|
|
9
|
+
const MODEL = {version: 2 as const, model: {kind: 'workflow'}};
|
|
10
|
+
|
|
4
11
|
describe('definitionsInterModuleContract', () => {
|
|
5
12
|
test('exposes a versioned workflow snapshot', () => {
|
|
6
13
|
const result = definitionsInterModuleContract.methods.getDefinitionForWorkflowRun.output.parse({
|
|
7
14
|
definition: {
|
|
8
15
|
id: '00000000-0000-4000-8000-000000000001',
|
|
16
|
+
workflowId: '00000000-0000-4000-8000-000000000003',
|
|
9
17
|
projectId: '00000000-0000-4000-8000-000000000002',
|
|
10
18
|
name: 'Deploy',
|
|
11
19
|
model: {version: 2, model: {kind: 'workflow'}},
|
|
@@ -14,6 +22,7 @@ describe('definitionsInterModuleContract', () => {
|
|
|
14
22
|
});
|
|
15
23
|
|
|
16
24
|
expect(result.definition?.model.version).toBe(2);
|
|
25
|
+
expect(result.definition?.workflowId).toBe('00000000-0000-4000-8000-000000000003');
|
|
17
26
|
});
|
|
18
27
|
|
|
19
28
|
test('rejects an unknown persisted snapshot version', () => {
|
|
@@ -21,4 +30,82 @@ describe('definitionsInterModuleContract', () => {
|
|
|
21
30
|
readPersistedWorkflowModel({version: 1, model: {kind: 'workflow'}} as never),
|
|
22
31
|
).toThrow();
|
|
23
32
|
});
|
|
33
|
+
|
|
34
|
+
test('parses at-ref inputs and outputs', () => {
|
|
35
|
+
const resolve = definitionsInterModuleContract.methods.resolveDefinitionAtRef;
|
|
36
|
+
const list = definitionsInterModuleContract.methods.listDefinitionsAtRef;
|
|
37
|
+
|
|
38
|
+
expect(
|
|
39
|
+
resolve.input.parse({
|
|
40
|
+
projectId: PROJECT_ID,
|
|
41
|
+
ref: REF,
|
|
42
|
+
configPath: CONFIG_PATH,
|
|
43
|
+
expectedCommit: COMMIT,
|
|
44
|
+
}),
|
|
45
|
+
).toEqual({
|
|
46
|
+
projectId: PROJECT_ID,
|
|
47
|
+
ref: REF,
|
|
48
|
+
configPath: CONFIG_PATH,
|
|
49
|
+
expectedCommit: COMMIT,
|
|
50
|
+
});
|
|
51
|
+
expect(list.input.parse({projectId: PROJECT_ID, ref: REF})).toEqual({
|
|
52
|
+
projectId: PROJECT_ID,
|
|
53
|
+
ref: REF,
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
expect(
|
|
57
|
+
resolve.output.parse({
|
|
58
|
+
workflow: {id: WORKFLOW_ID, configPath: CONFIG_PATH},
|
|
59
|
+
commit: COMMIT,
|
|
60
|
+
model: MODEL,
|
|
61
|
+
sourceSnapshot: {content: 'name: CI', format: 'yaml'},
|
|
62
|
+
triggers: {manual: {source: 'manual', event: 'fire'}},
|
|
63
|
+
warnings: [{code: 'warning', message: 'Use a pinned runner', path: 'runner'}],
|
|
64
|
+
}),
|
|
65
|
+
).toMatchObject({workflow: {id: WORKFLOW_ID}, commit: COMMIT});
|
|
66
|
+
expect(
|
|
67
|
+
list.output.parse({
|
|
68
|
+
commit: COMMIT,
|
|
69
|
+
files: [
|
|
70
|
+
{
|
|
71
|
+
configPath: CONFIG_PATH,
|
|
72
|
+
name: 'CI',
|
|
73
|
+
valid: true,
|
|
74
|
+
errors: [],
|
|
75
|
+
warnings: [{code: 'warning', message: 'Use a pinned runner'}],
|
|
76
|
+
triggers: {manual: {source: 'manual', event: 'fire'}},
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
}),
|
|
80
|
+
).toMatchObject({commit: COMMIT, files: [{configPath: CONFIG_PATH, valid: true}]});
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
test.each([
|
|
84
|
+
['project-not-found', {projectId: PROJECT_ID}],
|
|
85
|
+
['ref-not-found', {ref: REF}],
|
|
86
|
+
['ref-invalid', {ref: REF}],
|
|
87
|
+
['ref-moved', {ref: REF, expectedCommit: COMMIT}],
|
|
88
|
+
['file-not-found', {ref: REF, configPath: CONFIG_PATH}],
|
|
89
|
+
['content-too-large', {configPath: CONFIG_PATH}],
|
|
90
|
+
['invalid-definition', {errors: [{message: 'Invalid YAML', path: 'jobs'}]}],
|
|
91
|
+
['source-unavailable', {}],
|
|
92
|
+
] as const)('defines the %s resolution error', (code, details) => {
|
|
93
|
+
const method = definitionsInterModuleContract.methods.resolveDefinitionAtRef;
|
|
94
|
+
const schema = method.errors[code as keyof typeof method.errors];
|
|
95
|
+
|
|
96
|
+
expect(schema.parse(details)).toEqual(details);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
test.each([
|
|
100
|
+
['project-not-found', {projectId: PROJECT_ID}],
|
|
101
|
+
['ref-not-found', {ref: REF}],
|
|
102
|
+
['ref-invalid', {ref: REF}],
|
|
103
|
+
['too-many-files', {}],
|
|
104
|
+
['source-unavailable', {}],
|
|
105
|
+
] as const)('defines the %s listing error', (code, details) => {
|
|
106
|
+
const method = definitionsInterModuleContract.methods.listDefinitionsAtRef;
|
|
107
|
+
const schema = method.errors[code as keyof typeof method.errors];
|
|
108
|
+
|
|
109
|
+
expect(schema.parse(details)).toEqual(details);
|
|
110
|
+
});
|
|
24
111
|
});
|
package/src/inter-module.ts
CHANGED
|
@@ -1,15 +1,58 @@
|
|
|
1
1
|
import {defineInterModuleContract, type InterModuleClient} from '@shipfox/inter-module';
|
|
2
2
|
import {z} from 'zod';
|
|
3
|
+
import {definitionValidationErrorSchema} from '#schemas/dto.js';
|
|
4
|
+
import {triggerDtoSchema} from '#schemas/trigger.js';
|
|
3
5
|
import {workflowModelSnapshotSchema} from './workflow-model.js';
|
|
4
6
|
|
|
5
7
|
const idSchema = z.string().uuid();
|
|
8
|
+
const refSchema = z.string().min(1);
|
|
9
|
+
const configPathSchema = z.string().min(1);
|
|
6
10
|
const definitionSnapshotSchema = z.object({
|
|
7
11
|
id: idSchema,
|
|
12
|
+
workflowId: idSchema,
|
|
8
13
|
projectId: idSchema,
|
|
9
14
|
name: z.string(),
|
|
10
15
|
model: workflowModelSnapshotSchema,
|
|
11
16
|
sourceSnapshot: z.object({content: z.string(), format: z.literal('yaml')}).nullable(),
|
|
12
17
|
});
|
|
18
|
+
const validationWarningSchema = z.object({
|
|
19
|
+
code: z.string(),
|
|
20
|
+
message: z.string(),
|
|
21
|
+
path: z.string().optional(),
|
|
22
|
+
});
|
|
23
|
+
const refResolutionErrors = {
|
|
24
|
+
'project-not-found': z.object({projectId: idSchema}),
|
|
25
|
+
'ref-not-found': z.object({ref: refSchema}),
|
|
26
|
+
'ref-invalid': z.object({ref: refSchema}),
|
|
27
|
+
'ref-moved': z.object({ref: refSchema, expectedCommit: z.string()}),
|
|
28
|
+
'file-not-found': z.object({ref: refSchema, configPath: configPathSchema}),
|
|
29
|
+
'content-too-large': z.object({configPath: configPathSchema}),
|
|
30
|
+
'invalid-definition': z.object({errors: z.array(definitionValidationErrorSchema)}),
|
|
31
|
+
'source-unavailable': z.object({}),
|
|
32
|
+
};
|
|
33
|
+
const refListingErrors = {
|
|
34
|
+
'project-not-found': z.object({projectId: idSchema}),
|
|
35
|
+
'ref-not-found': z.object({ref: refSchema}),
|
|
36
|
+
'ref-invalid': z.object({ref: refSchema}),
|
|
37
|
+
'too-many-files': z.object({}),
|
|
38
|
+
'source-unavailable': z.object({}),
|
|
39
|
+
};
|
|
40
|
+
const resolvedDefinitionAtRefSchema = z.object({
|
|
41
|
+
workflow: z.object({id: idSchema, configPath: configPathSchema}),
|
|
42
|
+
commit: z.string(),
|
|
43
|
+
model: workflowModelSnapshotSchema,
|
|
44
|
+
sourceSnapshot: z.object({content: z.string(), format: z.literal('yaml')}),
|
|
45
|
+
triggers: z.record(z.string(), triggerDtoSchema),
|
|
46
|
+
warnings: z.array(validationWarningSchema),
|
|
47
|
+
});
|
|
48
|
+
const definitionAtRefFileSchema = z.object({
|
|
49
|
+
configPath: configPathSchema,
|
|
50
|
+
name: z.string().nullable(),
|
|
51
|
+
valid: z.boolean(),
|
|
52
|
+
errors: z.array(definitionValidationErrorSchema),
|
|
53
|
+
warnings: z.array(validationWarningSchema),
|
|
54
|
+
triggers: z.record(z.string(), triggerDtoSchema),
|
|
55
|
+
});
|
|
13
56
|
|
|
14
57
|
export const definitionsInterModuleContract = defineInterModuleContract({
|
|
15
58
|
module: 'definitions',
|
|
@@ -18,6 +61,24 @@ export const definitionsInterModuleContract = defineInterModuleContract({
|
|
|
18
61
|
input: z.object({definitionId: idSchema}),
|
|
19
62
|
output: z.object({definition: definitionSnapshotSchema.nullable()}),
|
|
20
63
|
},
|
|
64
|
+
resolveDefinitionAtRef: {
|
|
65
|
+
input: z.object({
|
|
66
|
+
projectId: idSchema,
|
|
67
|
+
ref: refSchema,
|
|
68
|
+
configPath: configPathSchema,
|
|
69
|
+
expectedCommit: z.string().optional(),
|
|
70
|
+
}),
|
|
71
|
+
output: resolvedDefinitionAtRefSchema,
|
|
72
|
+
errors: refResolutionErrors,
|
|
73
|
+
},
|
|
74
|
+
listDefinitionsAtRef: {
|
|
75
|
+
input: z.object({projectId: idSchema, ref: refSchema}),
|
|
76
|
+
output: z.object({
|
|
77
|
+
commit: z.string(),
|
|
78
|
+
files: z.array(definitionAtRefFileSchema),
|
|
79
|
+
}),
|
|
80
|
+
errors: refListingErrors,
|
|
81
|
+
},
|
|
21
82
|
},
|
|
22
83
|
});
|
|
23
84
|
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import {definitionSyncSummarySchema} from './dto.js';
|
|
2
|
+
|
|
3
|
+
describe('definitionSyncSummarySchema', () => {
|
|
4
|
+
test('round trips diagnostics with mixed severities', () => {
|
|
5
|
+
const input = {
|
|
6
|
+
ref: 'main',
|
|
7
|
+
status: 'succeeded',
|
|
8
|
+
last_sync_at: '2026-05-07T01:00:00.000Z',
|
|
9
|
+
started_at: '2026-05-07T00:59:55.000Z',
|
|
10
|
+
finished_at: '2026-05-07T01:00:00.000Z',
|
|
11
|
+
last_error_code: null,
|
|
12
|
+
last_error_message: null,
|
|
13
|
+
diagnostics: [
|
|
14
|
+
{
|
|
15
|
+
code: 'invalid-trigger-event',
|
|
16
|
+
message: 'Trigger event is never delivered.',
|
|
17
|
+
path: 'triggers.on_deploy',
|
|
18
|
+
file_path: '.shipfox/workflows/deploy.yml',
|
|
19
|
+
severity: 'error',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
code: 're-evaluating-command',
|
|
23
|
+
message: 'Workflow data is re-executed as shell code.',
|
|
24
|
+
path: 'jobs.build.steps.0.run',
|
|
25
|
+
severity: 'warning',
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
expect(definitionSyncSummarySchema.parse(input)).toEqual(input);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
test('round trips diagnostics without a path', () => {
|
|
34
|
+
const input = {
|
|
35
|
+
ref: 'main',
|
|
36
|
+
status: 'succeeded',
|
|
37
|
+
last_sync_at: '2026-05-07T01:00:00.000Z',
|
|
38
|
+
started_at: '2026-05-07T00:59:55.000Z',
|
|
39
|
+
finished_at: '2026-05-07T01:00:00.000Z',
|
|
40
|
+
last_error_code: null,
|
|
41
|
+
last_error_message: null,
|
|
42
|
+
diagnostics: [{code: 'warning-code', message: 'Warning without a path', severity: 'warning'}],
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
expect(definitionSyncSummarySchema.parse(input)).toEqual(input);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test('rejects diagnostics without severity', () => {
|
|
49
|
+
expect(() =>
|
|
50
|
+
definitionSyncSummarySchema.parse({
|
|
51
|
+
ref: 'main',
|
|
52
|
+
status: 'succeeded',
|
|
53
|
+
last_sync_at: '2026-05-07T01:00:00.000Z',
|
|
54
|
+
started_at: null,
|
|
55
|
+
finished_at: null,
|
|
56
|
+
last_error_code: null,
|
|
57
|
+
last_error_message: null,
|
|
58
|
+
diagnostics: [{code: 'warning-code', message: 'Missing severity'}],
|
|
59
|
+
}),
|
|
60
|
+
).toThrow();
|
|
61
|
+
});
|
|
62
|
+
});
|
package/src/schemas/dto.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {z} from 'zod';
|
|
2
2
|
|
|
3
|
-
export const
|
|
3
|
+
export const DEFINITION_SYNC_DIAGNOSTICS_MAX_COUNT = 100;
|
|
4
4
|
export const DEFINITION_SYNC_WARNING_CODE_MAX_LENGTH = 128;
|
|
5
5
|
export const DEFINITION_SYNC_WARNING_MESSAGE_MAX_LENGTH = 2048;
|
|
6
6
|
export const DEFINITION_SYNC_WARNING_PATH_MAX_LENGTH = 512;
|
|
7
|
+
export const DEFINITION_SYNC_DIAGNOSTIC_FILE_PATH_MAX_LENGTH = 512;
|
|
7
8
|
|
|
8
9
|
export const createDefinitionBodySchema = z
|
|
9
10
|
.object({
|
|
@@ -75,13 +76,17 @@ export const definitionValidationErrorSchema = z.object({
|
|
|
75
76
|
|
|
76
77
|
export type DefinitionValidationErrorDto = z.infer<typeof definitionValidationErrorSchema>;
|
|
77
78
|
|
|
78
|
-
export const
|
|
79
|
+
export const definitionValidationDiagnosticSchema = z.object({
|
|
79
80
|
code: z.string().max(DEFINITION_SYNC_WARNING_CODE_MAX_LENGTH),
|
|
80
81
|
message: z.string().max(DEFINITION_SYNC_WARNING_MESSAGE_MAX_LENGTH),
|
|
81
82
|
path: z.string().max(DEFINITION_SYNC_WARNING_PATH_MAX_LENGTH).optional(),
|
|
83
|
+
file_path: z.string().max(DEFINITION_SYNC_DIAGNOSTIC_FILE_PATH_MAX_LENGTH).optional(),
|
|
84
|
+
severity: z.enum(['error', 'warning']),
|
|
82
85
|
});
|
|
83
86
|
|
|
84
|
-
export type
|
|
87
|
+
export type DefinitionValidationDiagnosticDto = z.infer<
|
|
88
|
+
typeof definitionValidationDiagnosticSchema
|
|
89
|
+
>;
|
|
85
90
|
|
|
86
91
|
export const definitionListQuerySchema = z.object({
|
|
87
92
|
project_id: z.string().uuid(),
|
|
@@ -115,7 +120,9 @@ export const definitionSyncSummarySchema = z.object({
|
|
|
115
120
|
])
|
|
116
121
|
.nullable(),
|
|
117
122
|
last_error_message: z.string().nullable(),
|
|
118
|
-
|
|
123
|
+
diagnostics: z
|
|
124
|
+
.array(definitionValidationDiagnosticSchema)
|
|
125
|
+
.max(DEFINITION_SYNC_DIAGNOSTICS_MAX_COUNT),
|
|
119
126
|
});
|
|
120
127
|
|
|
121
128
|
export type DefinitionSyncSummaryDto = z.infer<typeof definitionSyncSummarySchema>;
|
package/src/schemas/index.ts
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
export {
|
|
2
2
|
type CreateDefinitionBodyDto,
|
|
3
3
|
createDefinitionBodySchema,
|
|
4
|
+
DEFINITION_SYNC_DIAGNOSTIC_FILE_PATH_MAX_LENGTH,
|
|
5
|
+
DEFINITION_SYNC_DIAGNOSTICS_MAX_COUNT,
|
|
4
6
|
DEFINITION_SYNC_WARNING_CODE_MAX_LENGTH,
|
|
5
7
|
DEFINITION_SYNC_WARNING_MESSAGE_MAX_LENGTH,
|
|
6
8
|
DEFINITION_SYNC_WARNING_PATH_MAX_LENGTH,
|
|
7
|
-
DEFINITION_SYNC_WARNINGS_MAX_COUNT,
|
|
8
9
|
type DefinitionDto,
|
|
9
10
|
type DefinitionListQueryDto,
|
|
10
11
|
type DefinitionListResponseDto,
|
|
11
12
|
type DefinitionResponseDto,
|
|
12
13
|
type DefinitionSyncSummaryDto,
|
|
14
|
+
type DefinitionValidationDiagnosticDto,
|
|
13
15
|
type DefinitionValidationErrorDto,
|
|
14
|
-
type DefinitionValidationWarningDto,
|
|
15
16
|
definitionDtoSchema,
|
|
16
17
|
definitionListQuerySchema,
|
|
17
18
|
definitionListResponseSchema,
|
|
18
19
|
definitionResponseSchema,
|
|
19
20
|
definitionSyncSummarySchema,
|
|
21
|
+
definitionValidationDiagnosticSchema,
|
|
20
22
|
definitionValidationErrorSchema,
|
|
21
|
-
definitionValidationWarningSchema,
|
|
22
23
|
} from './dto.js';
|
|
23
24
|
export type {TriggerDto} from './trigger.js';
|
package/src/schemas/trigger.ts
CHANGED
|
@@ -2,7 +2,7 @@ import {z} from 'zod';
|
|
|
2
2
|
|
|
3
3
|
export const triggerDtoSchema = z.object({
|
|
4
4
|
source: z.string(),
|
|
5
|
-
event: z.string(),
|
|
5
|
+
event: z.string().optional(),
|
|
6
6
|
with: z.record(z.string(), z.unknown()).optional(),
|
|
7
7
|
filter: z.string().optional(),
|
|
8
8
|
config: z.record(z.string(), z.unknown()).optional(),
|
package/src/workflow-model.ts
CHANGED
|
@@ -75,7 +75,7 @@ export interface WorkflowModelTrigger {
|
|
|
75
75
|
readonly id: string;
|
|
76
76
|
readonly key: string;
|
|
77
77
|
readonly source: string;
|
|
78
|
-
readonly event
|
|
78
|
+
readonly event?: string;
|
|
79
79
|
readonly inputs?: Readonly<Record<string, unknown>>;
|
|
80
80
|
readonly filter?: string;
|
|
81
81
|
readonly config?: Readonly<Record<string, unknown>>;
|
|
@@ -112,7 +112,7 @@ export interface WorkflowModelJobListening {
|
|
|
112
112
|
}
|
|
113
113
|
export interface WorkflowModelListeningTrigger {
|
|
114
114
|
readonly source: string;
|
|
115
|
-
readonly event
|
|
115
|
+
readonly event?: string;
|
|
116
116
|
readonly inputs?: Readonly<Record<string, unknown>>;
|
|
117
117
|
readonly filter?: string;
|
|
118
118
|
}
|