@shipfox/api-workflows-dto 12.3.0 → 12.5.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 +6 -0
- package/dist/events.d.ts +6 -0
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +2 -1
- package/dist/events.js.map +1 -1
- package/dist/schemas/job.d.ts +4 -0
- package/dist/schemas/job.d.ts.map +1 -1
- package/dist/schemas/job.js +3 -1
- package/dist/schemas/job.js.map +1 -1
- package/dist/schemas/workflow-run-detail.d.ts +8 -0
- package/dist/schemas/workflow-run-detail.d.ts.map +1 -1
- package/dist/schemas/workflow-run-detail.js +1 -0
- package/dist/schemas/workflow-run-detail.js.map +1 -1
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/events.test.ts +39 -0
- package/src/events.ts +1 -0
- package/src/schemas/job.test.ts +13 -0
- package/src/schemas/job.ts +2 -0
- package/src/schemas/workflow-run-detail.ts +1 -0
- package/tsconfig.build.tsbuildinfo +1 -1
package/package.json
CHANGED
package/src/events.test.ts
CHANGED
|
@@ -139,6 +139,45 @@ describe('workflowsJobTerminatedSchema', () => {
|
|
|
139
139
|
expect(result).toEqual(input);
|
|
140
140
|
});
|
|
141
141
|
|
|
142
|
+
it('accepts a string status reason message', () => {
|
|
143
|
+
const input = {
|
|
144
|
+
...validJobTerminated,
|
|
145
|
+
status: 'failed',
|
|
146
|
+
statusReason: 'output_too_large',
|
|
147
|
+
statusReasonMessage: 'Job output exceeded the configured size limit.',
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const result = workflowsJobTerminatedSchema.parse(input);
|
|
151
|
+
|
|
152
|
+
expect(result).toEqual(input);
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
it('accepts a null status reason message', () => {
|
|
156
|
+
const input = {
|
|
157
|
+
...validJobTerminated,
|
|
158
|
+
status: 'failed',
|
|
159
|
+
statusReason: 'unknown',
|
|
160
|
+
statusReasonMessage: null,
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
const result = workflowsJobTerminatedSchema.parse(input);
|
|
164
|
+
|
|
165
|
+
expect(result).toEqual(input);
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
it('rejects a non-string status reason message', () => {
|
|
169
|
+
const input = {
|
|
170
|
+
...validJobTerminated,
|
|
171
|
+
status: 'failed',
|
|
172
|
+
statusReason: 'output_too_large',
|
|
173
|
+
statusReasonMessage: 413,
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
const parse = () => workflowsJobTerminatedSchema.parse(input);
|
|
177
|
+
|
|
178
|
+
expect(parse).toThrow();
|
|
179
|
+
});
|
|
180
|
+
|
|
142
181
|
it('strips unknown keys (tolerant of forward-compatible producer additions)', () => {
|
|
143
182
|
const input = {...validJobTerminated, addedLater: 'ignored'};
|
|
144
183
|
|
package/src/events.ts
CHANGED
|
@@ -147,6 +147,7 @@ export const workflowsJobTerminatedSchema = z.object({
|
|
|
147
147
|
workflowRunAttemptId: nonEmptyStringSchema,
|
|
148
148
|
status: jobTerminalStatusSchema,
|
|
149
149
|
statusReason: jobStatusReasonSchema.nullable(),
|
|
150
|
+
statusReasonMessage: z.string().nullable().optional(),
|
|
150
151
|
});
|
|
151
152
|
export type WorkflowsJobTerminatedEventDto = z.infer<typeof workflowsJobTerminatedSchema>;
|
|
152
153
|
|
package/src/schemas/job.test.ts
CHANGED
|
@@ -42,4 +42,17 @@ describe('job DTO schema', () => {
|
|
|
42
42
|
|
|
43
43
|
expect(result.status_reason).toBe(statusReason);
|
|
44
44
|
});
|
|
45
|
+
|
|
46
|
+
it.each([
|
|
47
|
+
'output_too_large',
|
|
48
|
+
'output_invalid',
|
|
49
|
+
] as const)('accepts job failure reason "%s"', (statusReason) => {
|
|
50
|
+
const result = jobDtoSchema.parse({
|
|
51
|
+
...baseJob,
|
|
52
|
+
status: 'failed',
|
|
53
|
+
status_reason: statusReason,
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
expect(result.status_reason).toBe(statusReason);
|
|
57
|
+
});
|
|
45
58
|
});
|
package/src/schemas/job.ts
CHANGED
|
@@ -20,6 +20,7 @@ export const jobExecutionDtoSchema = z.object({
|
|
|
20
20
|
name: z.string(),
|
|
21
21
|
status: jobExecutionStatusSchema,
|
|
22
22
|
status_reason: z.string().nullable(),
|
|
23
|
+
status_reason_message: z.string().nullable().optional(),
|
|
23
24
|
runner: z.array(z.string()).nullable(),
|
|
24
25
|
trigger_events: z.array(workflowExecutionEventSchema).default([]),
|
|
25
26
|
outputs: z.record(z.string(), z.unknown()).nullable(),
|