@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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shipfox/api-workflows-dto",
3
3
  "license": "MIT",
4
- "version": "12.3.0",
4
+ "version": "12.5.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/ShipfoxHQ/shipfox.git",
@@ -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
 
@@ -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
  });
@@ -26,8 +26,10 @@ export const jobStatusReasonSchema = z.enum([
26
26
  'run_cancelled',
27
27
  'timed_out',
28
28
  'runner_lost',
29
+ 'output_too_large',
29
30
  'step_failed',
30
31
  'unknown',
32
+ 'output_invalid',
31
33
  ]);
32
34
 
33
35
  export const jobDtoSchema = z.object({
@@ -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(),