@shipfox/api-workflows-dto 9.3.0 → 12.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 +46 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/inter-module.d.ts +53 -1
- package/dist/inter-module.d.ts.map +1 -1
- package/dist/inter-module.js +30 -2
- package/dist/inter-module.js.map +1 -1
- package/dist/schemas/checkout-token.d.ts +9 -0
- package/dist/schemas/checkout-token.d.ts.map +1 -1
- package/dist/schemas/checkout-token.js +7 -0
- package/dist/schemas/checkout-token.js.map +1 -1
- package/dist/schemas/index.d.ts +3 -3
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +3 -3
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/job-execution.d.ts +15 -0
- package/dist/schemas/job-execution.d.ts.map +1 -1
- package/dist/schemas/job-execution.js +7 -0
- package/dist/schemas/job-execution.js.map +1 -1
- package/dist/schemas/job-listening.d.ts +18 -0
- package/dist/schemas/job-listening.d.ts.map +1 -1
- package/dist/schemas/job-listening.js +6 -0
- package/dist/schemas/job-listening.js.map +1 -1
- package/dist/schemas/step.d.ts +3 -0
- package/dist/schemas/step.d.ts.map +1 -1
- package/dist/schemas/step.js +8 -6
- package/dist/schemas/step.js.map +1 -1
- package/dist/schemas/workflow-run-detail.d.ts +36 -0
- package/dist/schemas/workflow-run-detail.d.ts.map +1 -1
- package/dist/schemas/workflow-run.d.ts +155 -0
- package/dist/schemas/workflow-run.d.ts.map +1 -1
- package/dist/schemas/workflow-run.js +39 -1
- package/dist/schemas/workflow-run.js.map +1 -1
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/dist/working-directory.d.ts +9 -0
- package/dist/working-directory.d.ts.map +1 -0
- package/dist/working-directory.js +23 -0
- package/dist/working-directory.js.map +1 -0
- package/package.json +3 -3
- package/src/index.ts +16 -0
- package/src/inter-module.test.ts +17 -0
- package/src/inter-module.ts +27 -1
- package/src/schemas/checkout-token.test.ts +44 -2
- package/src/schemas/checkout-token.ts +13 -0
- package/src/schemas/index.ts +15 -0
- package/src/schemas/job-execution.test.ts +15 -0
- package/src/schemas/job-execution.ts +13 -0
- package/src/schemas/job-listening.test.ts +4 -0
- package/src/schemas/job-listening.ts +4 -0
- package/src/schemas/step.test.ts +13 -0
- package/src/schemas/step.ts +7 -5
- package/src/schemas/workflow-run.test.ts +106 -1
- package/src/schemas/workflow-run.ts +56 -1
- package/src/working-directory.ts +28 -0
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { jobStatusSchema } from './job.js';
|
|
2
3
|
export const workflowRunStatusSchema = z.enum([
|
|
3
4
|
'pending',
|
|
4
5
|
'running',
|
|
@@ -58,11 +59,22 @@ export const workflowSourceSnapshotSchema = z.object({
|
|
|
58
59
|
content: z.string(),
|
|
59
60
|
format: z.literal('yaml')
|
|
60
61
|
});
|
|
62
|
+
// Provider-neutral trigger facts captured at run creation. Every field is nullable because
|
|
63
|
+
// only source-control triggers resolve one at all, and a given payload may name a ref
|
|
64
|
+
// without naming an actor.
|
|
65
|
+
export const workflowRunTriggerReferenceSchema = z.object({
|
|
66
|
+
repository: z.string().nullable(),
|
|
67
|
+
ref: z.string().nullable(),
|
|
68
|
+
commit: z.string().nullable(),
|
|
69
|
+
actor: z.string().nullable()
|
|
70
|
+
});
|
|
61
71
|
export const workflowRunDtoSchema = z.object({
|
|
62
72
|
id: z.string().uuid(),
|
|
63
73
|
project_id: z.string().uuid(),
|
|
64
74
|
definition_id: z.string().uuid(),
|
|
75
|
+
number: z.number().int().positive(),
|
|
65
76
|
name: z.string(),
|
|
77
|
+
workflow_name: z.string(),
|
|
66
78
|
status: workflowRunStatusSchema,
|
|
67
79
|
current_attempt: z.number().int().positive(),
|
|
68
80
|
latest_attempt: z.number().int().positive(),
|
|
@@ -70,6 +82,7 @@ export const workflowRunDtoSchema = z.object({
|
|
|
70
82
|
trigger_source: z.string(),
|
|
71
83
|
trigger_event: z.string(),
|
|
72
84
|
trigger_payload: z.record(z.string(), z.unknown()),
|
|
85
|
+
trigger_reference: workflowRunTriggerReferenceSchema.nullable(),
|
|
73
86
|
inputs: z.record(z.string(), z.unknown()).nullable(),
|
|
74
87
|
source_snapshot: workflowSourceSnapshotSchema.nullable(),
|
|
75
88
|
created_at: z.string(),
|
|
@@ -91,8 +104,33 @@ export const workflowRunResponseSchema = workflowRunDtoSchema;
|
|
|
91
104
|
export const workflowRunAttemptsResponseSchema = z.object({
|
|
92
105
|
attempts: z.array(workflowRunAttemptDtoSchema)
|
|
93
106
|
});
|
|
107
|
+
// The run list renders a status glyph per job so a failing run can be read without being
|
|
108
|
+
// opened, which needs the current attempt's jobs in graph order but none of their steps.
|
|
109
|
+
export const workflowRunJobSummaryDtoSchema = z.object({
|
|
110
|
+
id: z.string().uuid(),
|
|
111
|
+
key: z.string(),
|
|
112
|
+
name: z.string().nullable(),
|
|
113
|
+
status: jobStatusSchema,
|
|
114
|
+
position: z.number().int().nonnegative()
|
|
115
|
+
});
|
|
116
|
+
/**
|
|
117
|
+
* How many jobs a run list row carries in graph order.
|
|
118
|
+
*
|
|
119
|
+
* A workflow has no job limit, and the list is polled while runs are active, so the row
|
|
120
|
+
* cannot carry every job of every run on the page. This bound is the API's, deliberately set
|
|
121
|
+
* above what any current surface draws: a client is free to show fewer without a server
|
|
122
|
+
* change, and `job_status_counts` still describes the jobs beyond it.
|
|
123
|
+
*/ export const WORKFLOW_RUN_JOB_PREVIEW_LIMIT = 16;
|
|
124
|
+
/** One status and how many of the run's jobs hold it, counted over all of them. */ export const workflowRunJobStatusCountDtoSchema = z.object({
|
|
125
|
+
status: jobStatusSchema,
|
|
126
|
+
count: z.number().int().positive()
|
|
127
|
+
});
|
|
128
|
+
export const workflowRunListItemSchema = workflowRunResponseSchema.extend({
|
|
129
|
+
/** Up to `WORKFLOW_RUN_JOB_PREVIEW_LIMIT` jobs in graph order, not the whole set. */ jobs: z.array(workflowRunJobSummaryDtoSchema).max(WORKFLOW_RUN_JOB_PREVIEW_LIMIT),
|
|
130
|
+
/** Counted over every job of the attempt, including those past the preview. */ job_status_counts: z.array(workflowRunJobStatusCountDtoSchema)
|
|
131
|
+
});
|
|
94
132
|
export const workflowRunListResponseSchema = z.object({
|
|
95
|
-
runs: z.array(
|
|
133
|
+
runs: z.array(workflowRunListItemSchema),
|
|
96
134
|
next_cursor: z.string().nullable(),
|
|
97
135
|
filtered_total_count: z.number().int().nonnegative().nullable()
|
|
98
136
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/schemas/workflow-run.ts"],"sourcesContent":["import {z} from 'zod';\n\nexport const workflowRunStatusSchema = z.enum([\n 'pending',\n 'running',\n 'succeeded',\n 'failed',\n 'cancelled',\n]);\n\nexport type WorkflowRunStatusDto = z.infer<typeof workflowRunStatusSchema>;\n\nexport const workflowRunRerunModeSchema = z.enum(['all', 'failed']);\n\nexport type WorkflowRunRerunModeDto = z.infer<typeof workflowRunRerunModeSchema>;\n\nexport const rerunWorkflowRunBodySchema = z.object({\n mode: workflowRunRerunModeSchema,\n});\n\nexport type RerunWorkflowRunBodyDto = z.infer<typeof rerunWorkflowRunBodySchema>;\n\nconst isoDateTimeSchema = z.string().datetime();\nconst runListQueryBaseSchema = z.object({\n project_id: z.string().uuid(),\n limit: z.coerce.number().int().min(1).max(100).default(50),\n cursor: z.string().optional(),\n status: workflowRunStatusSchema.optional(),\n definition_id: z.string().uuid().optional(),\n trigger_source: z.string().optional(),\n created_from: isoDateTimeSchema.optional(),\n created_to: isoDateTimeSchema.optional(),\n});\n\nfunction validateDateWindow(\n value: {created_from?: string | undefined; created_to?: string | undefined},\n ctx: z.RefinementCtx,\n) {\n if (!value.created_from || !value.created_to) return;\n const from = new Date(value.created_from);\n const to = new Date(value.created_to);\n if (from > to) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'created_from must be before or equal to created_to',\n path: ['created_from'],\n });\n return;\n }\n\n const maxWindowMs = 365 * 24 * 60 * 60 * 1000;\n if (to.getTime() - from.getTime() > maxWindowMs) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'created date window must be 365 days or less',\n path: ['created_to'],\n });\n }\n}\n\nexport const workflowRunListQuerySchema = runListQueryBaseSchema.superRefine(validateDateWindow);\n\nexport type WorkflowRunListQueryDto = z.infer<typeof workflowRunListQuerySchema>;\n\nexport const workflowRunAggregatesQuerySchema = runListQueryBaseSchema\n .omit({limit: true, cursor: true})\n .superRefine(validateDateWindow);\n\nexport type WorkflowRunAggregatesQueryDto = z.infer<typeof workflowRunAggregatesQuerySchema>;\n\nexport const workflowSourceSnapshotSchema = z.object({\n content: z.string(),\n format: z.literal('yaml'),\n});\n\nexport type WorkflowSourceSnapshotDto = z.infer<typeof workflowSourceSnapshotSchema>;\n\nexport const workflowRunDtoSchema = z.object({\n id: z.string().uuid(),\n project_id: z.string().uuid(),\n definition_id: z.string().uuid(),\n name: z.string(),\n status: workflowRunStatusSchema,\n current_attempt: z.number().int().positive(),\n latest_attempt: z.number().int().positive(),\n trigger_provider: z.string().nullable(),\n trigger_source: z.string(),\n trigger_event: z.string(),\n trigger_payload: z.record(z.string(), z.unknown()),\n inputs: z.record(z.string(), z.unknown()).nullable(),\n source_snapshot: workflowSourceSnapshotSchema.nullable(),\n created_at: z.string(),\n updated_at: z.string(),\n started_at: z.string().nullable(),\n finished_at: z.string().nullable(),\n});\n\nexport type WorkflowRunDto = z.infer<typeof workflowRunDtoSchema>;\n\nexport const workflowRunAttemptDtoSchema = z.object({\n id: z.string().uuid(),\n workflow_run_id: z.string().uuid(),\n attempt: z.number().int().positive(),\n status: workflowRunStatusSchema,\n created_at: z.string(),\n started_at: z.string().nullable(),\n finished_at: z.string().nullable(),\n rerun_mode: workflowRunRerunModeSchema.nullable(),\n});\n\nexport type WorkflowRunAttemptDto = z.infer<typeof workflowRunAttemptDtoSchema>;\n\nexport const workflowRunResponseSchema = workflowRunDtoSchema;\n\nexport type WorkflowRunResponseDto = z.infer<typeof workflowRunResponseSchema>;\n\nexport const workflowRunAttemptsResponseSchema = z.object({\n attempts: z.array(workflowRunAttemptDtoSchema),\n});\n\nexport type WorkflowRunAttemptsResponseDto = z.infer<typeof workflowRunAttemptsResponseSchema>;\n\nexport const workflowRunListResponseSchema = z.object({\n runs: z.array(workflowRunResponseSchema),\n next_cursor: z.string().nullable(),\n filtered_total_count: z.number().int().nonnegative().nullable(),\n});\n\nexport type WorkflowRunListResponseDto = z.infer<typeof workflowRunListResponseSchema>;\n\nconst aggregateBucketSchema = z.object({\n value: z.string(),\n count: z.number().int().nonnegative(),\n});\n\nexport const workflowRunAggregatesResponseSchema = z.object({\n status: z.array(\n z.object({value: workflowRunStatusSchema, count: z.number().int().nonnegative()}),\n ),\n trigger_source: z.array(aggregateBucketSchema),\n workflow: z.array(aggregateBucketSchema),\n});\n\nexport type WorkflowRunAggregatesResponseDto = z.infer<typeof workflowRunAggregatesResponseSchema>;\n"],"names":["z","workflowRunStatusSchema","enum","workflowRunRerunModeSchema","rerunWorkflowRunBodySchema","object","mode","isoDateTimeSchema","string","datetime","runListQueryBaseSchema","project_id","uuid","limit","coerce","number","int","min","max","default","cursor","optional","status","definition_id","trigger_source","created_from","created_to","validateDateWindow","value","ctx","from","Date","to","addIssue","code","ZodIssueCode","custom","message","path","maxWindowMs","getTime","workflowRunListQuerySchema","superRefine","workflowRunAggregatesQuerySchema","omit","workflowSourceSnapshotSchema","content","format","literal","workflowRunDtoSchema","id","name","current_attempt","positive","latest_attempt","trigger_provider","nullable","trigger_event","trigger_payload","record","unknown","inputs","source_snapshot","created_at","updated_at","started_at","finished_at","workflowRunAttemptDtoSchema","workflow_run_id","attempt","rerun_mode","workflowRunResponseSchema","workflowRunAttemptsResponseSchema","attempts","array","workflowRunListResponseSchema","runs","next_cursor","filtered_total_count","nonnegative","aggregateBucketSchema","count","workflowRunAggregatesResponseSchema","workflow"],"mappings":"AAAA,SAAQA,CAAC,QAAO,MAAM;AAEtB,OAAO,MAAMC,0BAA0BD,EAAEE,IAAI,CAAC;IAC5C;IACA;IACA;IACA;IACA;CACD,EAAE;AAIH,OAAO,MAAMC,6BAA6BH,EAAEE,IAAI,CAAC;IAAC;IAAO;CAAS,EAAE;AAIpE,OAAO,MAAME,6BAA6BJ,EAAEK,MAAM,CAAC;IACjDC,MAAMH;AACR,GAAG;AAIH,MAAMI,oBAAoBP,EAAEQ,MAAM,GAAGC,QAAQ;AAC7C,MAAMC,yBAAyBV,EAAEK,MAAM,CAAC;IACtCM,YAAYX,EAAEQ,MAAM,GAAGI,IAAI;IAC3BC,OAAOb,EAAEc,MAAM,CAACC,MAAM,GAAGC,GAAG,GAAGC,GAAG,CAAC,GAAGC,GAAG,CAAC,KAAKC,OAAO,CAAC;IACvDC,QAAQpB,EAAEQ,MAAM,GAAGa,QAAQ;IAC3BC,QAAQrB,wBAAwBoB,QAAQ;IACxCE,eAAevB,EAAEQ,MAAM,GAAGI,IAAI,GAAGS,QAAQ;IACzCG,gBAAgBxB,EAAEQ,MAAM,GAAGa,QAAQ;IACnCI,cAAclB,kBAAkBc,QAAQ;IACxCK,YAAYnB,kBAAkBc,QAAQ;AACxC;AAEA,SAASM,mBACPC,KAA2E,EAC3EC,GAAoB;IAEpB,IAAI,CAACD,MAAMH,YAAY,IAAI,CAACG,MAAMF,UAAU,EAAE;IAC9C,MAAMI,OAAO,IAAIC,KAAKH,MAAMH,YAAY;IACxC,MAAMO,KAAK,IAAID,KAAKH,MAAMF,UAAU;IACpC,IAAII,OAAOE,IAAI;QACbH,IAAII,QAAQ,CAAC;YACXC,MAAMlC,EAAEmC,YAAY,CAACC,MAAM;YAC3BC,SAAS;YACTC,MAAM;gBAAC;aAAe;QACxB;QACA;IACF;IAEA,MAAMC,cAAc,MAA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BG,UAAUnF,EAAE0E,KAAK,CAACM;AACpB,GAAG"}
|
|
1
|
+
{"version":3,"sources":["../../src/schemas/workflow-run.ts"],"sourcesContent":["import {z} from 'zod';\nimport {jobStatusSchema} from './job.js';\n\nexport const workflowRunStatusSchema = z.enum([\n 'pending',\n 'running',\n 'succeeded',\n 'failed',\n 'cancelled',\n]);\n\nexport type WorkflowRunStatusDto = z.infer<typeof workflowRunStatusSchema>;\n\nexport const workflowRunRerunModeSchema = z.enum(['all', 'failed']);\n\nexport type WorkflowRunRerunModeDto = z.infer<typeof workflowRunRerunModeSchema>;\n\nexport const rerunWorkflowRunBodySchema = z.object({\n mode: workflowRunRerunModeSchema,\n});\n\nexport type RerunWorkflowRunBodyDto = z.infer<typeof rerunWorkflowRunBodySchema>;\n\nconst isoDateTimeSchema = z.string().datetime();\nconst runListQueryBaseSchema = z.object({\n project_id: z.string().uuid(),\n limit: z.coerce.number().int().min(1).max(100).default(50),\n cursor: z.string().optional(),\n status: workflowRunStatusSchema.optional(),\n definition_id: z.string().uuid().optional(),\n trigger_source: z.string().optional(),\n created_from: isoDateTimeSchema.optional(),\n created_to: isoDateTimeSchema.optional(),\n});\n\nfunction validateDateWindow(\n value: {created_from?: string | undefined; created_to?: string | undefined},\n ctx: z.RefinementCtx,\n) {\n if (!value.created_from || !value.created_to) return;\n const from = new Date(value.created_from);\n const to = new Date(value.created_to);\n if (from > to) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'created_from must be before or equal to created_to',\n path: ['created_from'],\n });\n return;\n }\n\n const maxWindowMs = 365 * 24 * 60 * 60 * 1000;\n if (to.getTime() - from.getTime() > maxWindowMs) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'created date window must be 365 days or less',\n path: ['created_to'],\n });\n }\n}\n\nexport const workflowRunListQuerySchema = runListQueryBaseSchema.superRefine(validateDateWindow);\n\nexport type WorkflowRunListQueryDto = z.infer<typeof workflowRunListQuerySchema>;\n\nexport const workflowRunAggregatesQuerySchema = runListQueryBaseSchema\n .omit({limit: true, cursor: true})\n .superRefine(validateDateWindow);\n\nexport type WorkflowRunAggregatesQueryDto = z.infer<typeof workflowRunAggregatesQuerySchema>;\n\nexport const workflowSourceSnapshotSchema = z.object({\n content: z.string(),\n format: z.literal('yaml'),\n});\n\nexport type WorkflowSourceSnapshotDto = z.infer<typeof workflowSourceSnapshotSchema>;\n\n// Provider-neutral trigger facts captured at run creation. Every field is nullable because\n// only source-control triggers resolve one at all, and a given payload may name a ref\n// without naming an actor.\nexport const workflowRunTriggerReferenceSchema = z.object({\n repository: z.string().nullable(),\n ref: z.string().nullable(),\n commit: z.string().nullable(),\n actor: z.string().nullable(),\n});\n\nexport type WorkflowRunTriggerReferenceDto = z.infer<typeof workflowRunTriggerReferenceSchema>;\n\nexport const workflowRunDtoSchema = z.object({\n id: z.string().uuid(),\n project_id: z.string().uuid(),\n definition_id: z.string().uuid(),\n number: z.number().int().positive(),\n name: z.string(),\n workflow_name: z.string(),\n status: workflowRunStatusSchema,\n current_attempt: z.number().int().positive(),\n latest_attempt: z.number().int().positive(),\n trigger_provider: z.string().nullable(),\n trigger_source: z.string(),\n trigger_event: z.string(),\n trigger_payload: z.record(z.string(), z.unknown()),\n trigger_reference: workflowRunTriggerReferenceSchema.nullable(),\n inputs: z.record(z.string(), z.unknown()).nullable(),\n source_snapshot: workflowSourceSnapshotSchema.nullable(),\n created_at: z.string(),\n updated_at: z.string(),\n started_at: z.string().nullable(),\n finished_at: z.string().nullable(),\n});\n\nexport type WorkflowRunDto = z.infer<typeof workflowRunDtoSchema>;\n\nexport const workflowRunAttemptDtoSchema = z.object({\n id: z.string().uuid(),\n workflow_run_id: z.string().uuid(),\n attempt: z.number().int().positive(),\n status: workflowRunStatusSchema,\n created_at: z.string(),\n started_at: z.string().nullable(),\n finished_at: z.string().nullable(),\n rerun_mode: workflowRunRerunModeSchema.nullable(),\n});\n\nexport type WorkflowRunAttemptDto = z.infer<typeof workflowRunAttemptDtoSchema>;\n\nexport const workflowRunResponseSchema = workflowRunDtoSchema;\n\nexport type WorkflowRunResponseDto = z.infer<typeof workflowRunResponseSchema>;\n\nexport const workflowRunAttemptsResponseSchema = z.object({\n attempts: z.array(workflowRunAttemptDtoSchema),\n});\n\nexport type WorkflowRunAttemptsResponseDto = z.infer<typeof workflowRunAttemptsResponseSchema>;\n\n// The run list renders a status glyph per job so a failing run can be read without being\n// opened, which needs the current attempt's jobs in graph order but none of their steps.\nexport const workflowRunJobSummaryDtoSchema = z.object({\n id: z.string().uuid(),\n key: z.string(),\n name: z.string().nullable(),\n status: jobStatusSchema,\n position: z.number().int().nonnegative(),\n});\n\nexport type WorkflowRunJobSummaryDto = z.infer<typeof workflowRunJobSummaryDtoSchema>;\n\n/**\n * How many jobs a run list row carries in graph order.\n *\n * A workflow has no job limit, and the list is polled while runs are active, so the row\n * cannot carry every job of every run on the page. This bound is the API's, deliberately set\n * above what any current surface draws: a client is free to show fewer without a server\n * change, and `job_status_counts` still describes the jobs beyond it.\n */\nexport const WORKFLOW_RUN_JOB_PREVIEW_LIMIT = 16;\n\n/** One status and how many of the run's jobs hold it, counted over all of them. */\nexport const workflowRunJobStatusCountDtoSchema = z.object({\n status: jobStatusSchema,\n count: z.number().int().positive(),\n});\n\nexport type WorkflowRunJobStatusCountDto = z.infer<typeof workflowRunJobStatusCountDtoSchema>;\n\nexport const workflowRunListItemSchema = workflowRunResponseSchema.extend({\n /** Up to `WORKFLOW_RUN_JOB_PREVIEW_LIMIT` jobs in graph order, not the whole set. */\n jobs: z.array(workflowRunJobSummaryDtoSchema).max(WORKFLOW_RUN_JOB_PREVIEW_LIMIT),\n /** Counted over every job of the attempt, including those past the preview. */\n job_status_counts: z.array(workflowRunJobStatusCountDtoSchema),\n});\n\nexport type WorkflowRunListItemDto = z.infer<typeof workflowRunListItemSchema>;\n\nexport const workflowRunListResponseSchema = z.object({\n runs: z.array(workflowRunListItemSchema),\n next_cursor: z.string().nullable(),\n filtered_total_count: z.number().int().nonnegative().nullable(),\n});\n\nexport type WorkflowRunListResponseDto = z.infer<typeof workflowRunListResponseSchema>;\n\nconst aggregateBucketSchema = z.object({\n value: z.string(),\n count: z.number().int().nonnegative(),\n});\n\nexport const workflowRunAggregatesResponseSchema = z.object({\n status: z.array(\n z.object({value: workflowRunStatusSchema, count: z.number().int().nonnegative()}),\n ),\n trigger_source: z.array(aggregateBucketSchema),\n workflow: z.array(aggregateBucketSchema),\n});\n\nexport type WorkflowRunAggregatesResponseDto = z.infer<typeof workflowRunAggregatesResponseSchema>;\n"],"names":["z","jobStatusSchema","workflowRunStatusSchema","enum","workflowRunRerunModeSchema","rerunWorkflowRunBodySchema","object","mode","isoDateTimeSchema","string","datetime","runListQueryBaseSchema","project_id","uuid","limit","coerce","number","int","min","max","default","cursor","optional","status","definition_id","trigger_source","created_from","created_to","validateDateWindow","value","ctx","from","Date","to","addIssue","code","ZodIssueCode","custom","message","path","maxWindowMs","getTime","workflowRunListQuerySchema","superRefine","workflowRunAggregatesQuerySchema","omit","workflowSourceSnapshotSchema","content","format","literal","workflowRunTriggerReferenceSchema","repository","nullable","ref","commit","actor","workflowRunDtoSchema","id","positive","name","workflow_name","current_attempt","latest_attempt","trigger_provider","trigger_event","trigger_payload","record","unknown","trigger_reference","inputs","source_snapshot","created_at","updated_at","started_at","finished_at","workflowRunAttemptDtoSchema","workflow_run_id","attempt","rerun_mode","workflowRunResponseSchema","workflowRunAttemptsResponseSchema","attempts","array","workflowRunJobSummaryDtoSchema","key","position","nonnegative","WORKFLOW_RUN_JOB_PREVIEW_LIMIT","workflowRunJobStatusCountDtoSchema","count","workflowRunListItemSchema","extend","jobs","job_status_counts","workflowRunListResponseSchema","runs","next_cursor","filtered_total_count","aggregateBucketSchema","workflowRunAggregatesResponseSchema","workflow"],"mappings":"AAAA,SAAQA,CAAC,QAAO,MAAM;AACtB,SAAQC,eAAe,QAAO,WAAW;AAEzC,OAAO,MAAMC,0BAA0BF,EAAEG,IAAI,CAAC;IAC5C;IACA;I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