@shipfox/api-agent-access-dto 20.2.0 → 21.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.
@@ -0,0 +1,915 @@
1
+ import { z } from 'zod';
2
+ export const AGENT_ACCESS_DEFAULT_PAGE_LIMIT = 50;
3
+ export const AGENT_ACCESS_PAGE_LIMIT_MAX = 100;
4
+ export const AGENT_ACCESS_RESPONSE_MAX_BYTES = 128 * 1024;
5
+ export const AGENT_ACCESS_TEXT_MAX_BYTES = 512;
6
+ export const AGENT_ACCESS_CONNECTION_NAME_MAX_BYTES = 256;
7
+ export const AGENT_ACCESS_DIAGNOSTIC_CODE_MAX_BYTES = 128;
8
+ export const AGENT_ACCESS_DIAGNOSTIC_MESSAGE_MAX_BYTES = 512;
9
+ export const AGENT_ACCESS_DIAGNOSTIC_PATH_MAX_BYTES = 512;
10
+ export const AGENT_ACCESS_DIAGNOSTIC_MAX_ITEMS = 10;
11
+ export const AGENT_ACCESS_ANNOTATION_BODY_MAX_BYTES = 8 * 1024;
12
+ const idSchema = z.string().uuid();
13
+ const dateTimeSchema = z.string().datetime();
14
+ const utf8Encoder = new TextEncoder();
15
+ const utf8CappedString = (maxBytes)=>z.string().max(maxBytes).refine((value)=>utf8Encoder.encode(value).byteLength <= maxBytes, {
16
+ message: `String must contain at most ${maxBytes} UTF-8 bytes`
17
+ });
18
+ const pageInputFields = {
19
+ limit: z.number().int().min(1).max(AGENT_ACCESS_PAGE_LIMIT_MAX).default(AGENT_ACCESS_DEFAULT_PAGE_LIMIT),
20
+ cursor: z.string().min(1).optional()
21
+ };
22
+ const cappedInputTextSchema = utf8CappedString(AGENT_ACCESS_TEXT_MAX_BYTES);
23
+ export const listProjectsInputSchema = z.object(pageInputFields).strict();
24
+ export const listWorkflowDefinitionsInputSchema = z.object({
25
+ project_id: idSchema,
26
+ ...pageInputFields
27
+ }).strict();
28
+ const workflowRunStatusSchema = z.enum([
29
+ 'pending',
30
+ 'running',
31
+ 'succeeded',
32
+ 'failed',
33
+ 'cancelled'
34
+ ]);
35
+ const workflowRunOriginSchema = z.enum([
36
+ 'synced',
37
+ 'dev'
38
+ ]);
39
+ const AGENT_ACCESS_ATTEMPT_MAX = 2_147_483_647;
40
+ const WORKFLOW_RUN_DATE_WINDOW_MAX_MS = 365 * 24 * 60 * 60 * 1000;
41
+ export const listWorkflowRunsInputSchema = z.object({
42
+ project_id: idSchema,
43
+ status: workflowRunStatusSchema.optional(),
44
+ definition_id: idSchema.optional(),
45
+ origin: workflowRunOriginSchema.optional(),
46
+ trigger_source: cappedInputTextSchema.optional(),
47
+ created_from: dateTimeSchema.optional(),
48
+ created_to: dateTimeSchema.optional(),
49
+ ...pageInputFields
50
+ }).superRefine((value, context)=>{
51
+ if (value.created_from !== undefined && value.created_to !== undefined && new Date(value.created_from) > new Date(value.created_to)) {
52
+ context.addIssue({
53
+ code: 'custom',
54
+ path: [
55
+ 'created_from'
56
+ ],
57
+ message: 'created_from must be before or equal to created_to'
58
+ });
59
+ } else if (value.created_from !== undefined && value.created_to !== undefined && new Date(value.created_to).getTime() - new Date(value.created_from).getTime() > WORKFLOW_RUN_DATE_WINDOW_MAX_MS) {
60
+ context.addIssue({
61
+ code: 'custom',
62
+ path: [
63
+ 'created_to'
64
+ ],
65
+ message: 'created date window must be 365 days or less'
66
+ });
67
+ }
68
+ }).strict();
69
+ export const getRunAnnotationsInputSchema = z.object({
70
+ run_id: idSchema,
71
+ attempt: z.number().int().min(1).max(AGENT_ACCESS_ATTEMPT_MAX).optional(),
72
+ job_execution_id: idSchema.optional(),
73
+ ...pageInputFields
74
+ }).strict();
75
+ const triggerEventOriginSchema = z.enum([
76
+ 'integration',
77
+ 'manual',
78
+ 'cron',
79
+ 'dev'
80
+ ]);
81
+ const triggerEventOutcomeSchema = z.enum([
82
+ 'received',
83
+ 'routed',
84
+ 'discarded',
85
+ 'failed',
86
+ 'errored'
87
+ ]);
88
+ export const listTriggerEventsInputSchema = z.object({
89
+ source: z.array(cappedInputTextSchema).optional(),
90
+ event: z.array(cappedInputTextSchema).optional(),
91
+ origin: z.array(triggerEventOriginSchema).optional(),
92
+ outcome: z.array(triggerEventOutcomeSchema).optional(),
93
+ replayable: z.literal(true).optional(),
94
+ from: dateTimeSchema.optional(),
95
+ to: dateTimeSchema.optional(),
96
+ ...pageInputFields
97
+ }).superRefine((value, context)=>{
98
+ if (value.from !== undefined && value.to !== undefined && new Date(value.from) > new Date(value.to)) {
99
+ context.addIssue({
100
+ code: 'custom',
101
+ path: [
102
+ 'from'
103
+ ],
104
+ message: 'from must be before or equal to to'
105
+ });
106
+ }
107
+ }).strict();
108
+ const dateTime = {
109
+ type: 'string',
110
+ format: 'date-time'
111
+ };
112
+ const pageInputJsonProperties = {
113
+ limit: {
114
+ type: 'integer',
115
+ minimum: 1,
116
+ maximum: AGENT_ACCESS_PAGE_LIMIT_MAX,
117
+ default: AGENT_ACCESS_DEFAULT_PAGE_LIMIT
118
+ },
119
+ cursor: {
120
+ type: 'string',
121
+ minLength: 1
122
+ }
123
+ };
124
+ export const listProjectsInputJsonSchema = {
125
+ type: 'object',
126
+ properties: pageInputJsonProperties,
127
+ additionalProperties: false
128
+ };
129
+ export const listWorkflowDefinitionsInputJsonSchema = {
130
+ type: 'object',
131
+ properties: {
132
+ project_id: {
133
+ type: 'string',
134
+ format: 'uuid'
135
+ },
136
+ ...pageInputJsonProperties
137
+ },
138
+ required: [
139
+ 'project_id'
140
+ ],
141
+ additionalProperties: false
142
+ };
143
+ export const listWorkflowRunsInputJsonSchema = {
144
+ type: 'object',
145
+ properties: {
146
+ project_id: {
147
+ type: 'string',
148
+ format: 'uuid'
149
+ },
150
+ status: {
151
+ type: 'string',
152
+ enum: [
153
+ 'pending',
154
+ 'running',
155
+ 'succeeded',
156
+ 'failed',
157
+ 'cancelled'
158
+ ]
159
+ },
160
+ definition_id: {
161
+ type: 'string',
162
+ format: 'uuid'
163
+ },
164
+ origin: {
165
+ type: 'string',
166
+ enum: [
167
+ 'synced',
168
+ 'dev'
169
+ ]
170
+ },
171
+ trigger_source: {
172
+ type: 'string',
173
+ maxLength: AGENT_ACCESS_TEXT_MAX_BYTES
174
+ },
175
+ created_from: dateTime,
176
+ created_to: dateTime,
177
+ ...pageInputJsonProperties
178
+ },
179
+ required: [
180
+ 'project_id'
181
+ ],
182
+ additionalProperties: false
183
+ };
184
+ export const getRunAnnotationsInputJsonSchema = {
185
+ type: 'object',
186
+ properties: {
187
+ run_id: {
188
+ type: 'string',
189
+ format: 'uuid'
190
+ },
191
+ attempt: {
192
+ type: 'integer',
193
+ minimum: 1,
194
+ maximum: AGENT_ACCESS_ATTEMPT_MAX
195
+ },
196
+ job_execution_id: {
197
+ type: 'string',
198
+ format: 'uuid'
199
+ },
200
+ ...pageInputJsonProperties
201
+ },
202
+ required: [
203
+ 'run_id'
204
+ ],
205
+ additionalProperties: false
206
+ };
207
+ export const listTriggerEventsInputJsonSchema = {
208
+ type: 'object',
209
+ properties: {
210
+ source: {
211
+ type: 'array',
212
+ items: {
213
+ type: 'string',
214
+ maxLength: AGENT_ACCESS_TEXT_MAX_BYTES
215
+ }
216
+ },
217
+ event: {
218
+ type: 'array',
219
+ items: {
220
+ type: 'string',
221
+ maxLength: AGENT_ACCESS_TEXT_MAX_BYTES
222
+ }
223
+ },
224
+ origin: {
225
+ type: 'array',
226
+ items: {
227
+ type: 'string',
228
+ enum: [
229
+ 'integration',
230
+ 'manual',
231
+ 'cron',
232
+ 'dev'
233
+ ]
234
+ }
235
+ },
236
+ outcome: {
237
+ type: 'array',
238
+ items: {
239
+ type: 'string',
240
+ enum: [
241
+ 'received',
242
+ 'routed',
243
+ 'discarded',
244
+ 'failed',
245
+ 'errored'
246
+ ]
247
+ }
248
+ },
249
+ replayable: {
250
+ const: true
251
+ },
252
+ from: dateTime,
253
+ to: dateTime,
254
+ ...pageInputJsonProperties
255
+ },
256
+ additionalProperties: false
257
+ };
258
+ const projectResultItemSchema = z.object({
259
+ id: idSchema,
260
+ name: utf8CappedString(AGENT_ACCESS_TEXT_MAX_BYTES),
261
+ slug: utf8CappedString(AGENT_ACCESS_TEXT_MAX_BYTES),
262
+ created_at: dateTimeSchema,
263
+ updated_at: dateTimeSchema
264
+ }).strict();
265
+ export const listProjectsResultSchema = z.object({
266
+ projects: z.array(projectResultItemSchema),
267
+ next_cursor: z.string().nullable()
268
+ }).strict();
269
+ const definitionDiagnosticSchema = z.object({
270
+ severity: z.enum([
271
+ 'error',
272
+ 'warning'
273
+ ]),
274
+ code: utf8CappedString(AGENT_ACCESS_DIAGNOSTIC_CODE_MAX_BYTES),
275
+ message: utf8CappedString(AGENT_ACCESS_DIAGNOSTIC_MESSAGE_MAX_BYTES),
276
+ path: utf8CappedString(AGENT_ACCESS_DIAGNOSTIC_PATH_MAX_BYTES).optional(),
277
+ file_path: utf8CappedString(AGENT_ACCESS_DIAGNOSTIC_PATH_MAX_BYTES).optional()
278
+ }).strict();
279
+ const definitionSyncErrorCodes = [
280
+ 'no-workflow-files',
281
+ 'invalid-definition',
282
+ 'provider-repository-not-found',
283
+ 'provider-file-not-found',
284
+ 'provider-access-denied',
285
+ 'provider-rate-limited',
286
+ 'provider-timeout',
287
+ 'provider-unavailable',
288
+ 'provider-malformed-response',
289
+ 'content-too-large',
290
+ 'too-many-files',
291
+ 'connection-unavailable',
292
+ 'unknown'
293
+ ];
294
+ const definitionSyncErrorCodeSchema = z.enum(definitionSyncErrorCodes);
295
+ const definitionDiagnosticsSummarySchema = z.object({
296
+ error_count: z.number().int().nonnegative(),
297
+ warning_count: z.number().int().nonnegative(),
298
+ items: z.array(definitionDiagnosticSchema).max(AGENT_ACCESS_DIAGNOSTIC_MAX_ITEMS)
299
+ }).strict();
300
+ const definitionSyncSchema = z.object({
301
+ ref: utf8CappedString(AGENT_ACCESS_TEXT_MAX_BYTES).nullable(),
302
+ status: z.enum([
303
+ 'pending',
304
+ 'syncing',
305
+ 'succeeded',
306
+ 'failed'
307
+ ]),
308
+ last_sync_at: dateTimeSchema,
309
+ started_at: dateTimeSchema.nullable(),
310
+ finished_at: dateTimeSchema.nullable(),
311
+ last_error_code: definitionSyncErrorCodeSchema.nullable(),
312
+ last_error_message: utf8CappedString(AGENT_ACCESS_TEXT_MAX_BYTES).nullable(),
313
+ diagnostics: definitionDiagnosticsSummarySchema
314
+ }).strict();
315
+ const definitionResultItemSchema = z.object({
316
+ id: idSchema,
317
+ project_id: idSchema,
318
+ name: utf8CappedString(AGENT_ACCESS_TEXT_MAX_BYTES),
319
+ config_path: utf8CappedString(AGENT_ACCESS_TEXT_MAX_BYTES).nullable(),
320
+ source: z.enum([
321
+ 'manual',
322
+ 'vcs'
323
+ ]),
324
+ ref: utf8CappedString(AGENT_ACCESS_TEXT_MAX_BYTES).nullable(),
325
+ sha: utf8CappedString(AGENT_ACCESS_TEXT_MAX_BYTES).nullable()
326
+ }).strict();
327
+ export const listWorkflowDefinitionsResultSchema = z.object({
328
+ definitions: z.array(definitionResultItemSchema),
329
+ sync: definitionSyncSchema.nullable(),
330
+ next_cursor: z.string().nullable()
331
+ }).strict();
332
+ const runDevSourceSchema = z.object({
333
+ ref: utf8CappedString(AGENT_ACCESS_TEXT_MAX_BYTES),
334
+ commit: utf8CappedString(AGENT_ACCESS_TEXT_MAX_BYTES),
335
+ config_path: utf8CappedString(AGENT_ACCESS_TEXT_MAX_BYTES),
336
+ initiated_by_user_id: idSchema,
337
+ replay_of_event_id: idSchema.nullable()
338
+ }).strict();
339
+ const runTriggerReferenceSchema = z.object({
340
+ repository: utf8CappedString(AGENT_ACCESS_TEXT_MAX_BYTES).nullable(),
341
+ ref: utf8CappedString(AGENT_ACCESS_TEXT_MAX_BYTES).nullable(),
342
+ commit: utf8CappedString(AGENT_ACCESS_TEXT_MAX_BYTES).nullable(),
343
+ actor: utf8CappedString(AGENT_ACCESS_TEXT_MAX_BYTES).nullable()
344
+ }).strict();
345
+ const jobStatusCountSchema = z.object({
346
+ status: z.enum([
347
+ 'pending',
348
+ 'running',
349
+ 'succeeded',
350
+ 'failed',
351
+ 'cancelled',
352
+ 'skipped'
353
+ ]),
354
+ count: z.number().int().positive()
355
+ }).strict();
356
+ const runResultItemSchema = z.object({
357
+ id: idSchema,
358
+ project_id: idSchema,
359
+ definition_id: idSchema,
360
+ number: z.number().int().positive(),
361
+ name: utf8CappedString(AGENT_ACCESS_TEXT_MAX_BYTES),
362
+ workflow_name: utf8CappedString(AGENT_ACCESS_TEXT_MAX_BYTES),
363
+ status: z.enum([
364
+ 'pending',
365
+ 'running',
366
+ 'succeeded',
367
+ 'failed',
368
+ 'cancelled'
369
+ ]),
370
+ origin: z.enum([
371
+ 'synced',
372
+ 'dev'
373
+ ]),
374
+ dev_source: runDevSourceSchema.nullable(),
375
+ current_attempt: z.number().int().positive(),
376
+ latest_attempt: z.number().int().positive(),
377
+ trigger_provider: utf8CappedString(AGENT_ACCESS_TEXT_MAX_BYTES).nullable(),
378
+ trigger_source: utf8CappedString(AGENT_ACCESS_TEXT_MAX_BYTES),
379
+ trigger_event: utf8CappedString(AGENT_ACCESS_TEXT_MAX_BYTES),
380
+ trigger_reference: runTriggerReferenceSchema.nullable(),
381
+ job_status_counts: z.array(jobStatusCountSchema),
382
+ has_started_job_execution: z.boolean(),
383
+ created_at: dateTimeSchema,
384
+ updated_at: dateTimeSchema,
385
+ started_at: dateTimeSchema.nullable(),
386
+ finished_at: dateTimeSchema.nullable()
387
+ }).strict();
388
+ export const listWorkflowRunsResultSchema = z.object({
389
+ runs: z.array(runResultItemSchema),
390
+ next_cursor: z.string().nullable(),
391
+ filtered_total_count: z.number().int().nonnegative().nullable()
392
+ }).strict();
393
+ const annotationResultItemSchema = z.object({
394
+ id: idSchema,
395
+ origin_step_id: idSchema,
396
+ origin_step_attempt: z.number().int().min(1),
397
+ job_execution_id: idSchema,
398
+ sequence: z.number().int().min(1),
399
+ created_at: dateTimeSchema,
400
+ body: utf8CappedString(AGENT_ACCESS_ANNOTATION_BODY_MAX_BYTES),
401
+ body_truncated: z.literal(true).optional(),
402
+ body_total_bytes: z.number().int().nonnegative().optional()
403
+ }).strict();
404
+ export const getRunAnnotationsResultSchema = z.object({
405
+ annotations: z.array(annotationResultItemSchema),
406
+ next_cursor: z.string().nullable()
407
+ }).strict();
408
+ const triggerEventResultItemSchema = z.object({
409
+ id: idSchema,
410
+ origin: z.enum([
411
+ 'integration',
412
+ 'manual',
413
+ 'cron',
414
+ 'dev'
415
+ ]),
416
+ provider: utf8CappedString(AGENT_ACCESS_TEXT_MAX_BYTES).nullable(),
417
+ source: utf8CappedString(AGENT_ACCESS_TEXT_MAX_BYTES),
418
+ event: utf8CappedString(AGENT_ACCESS_TEXT_MAX_BYTES),
419
+ outcome: z.enum([
420
+ 'received',
421
+ 'routed',
422
+ 'discarded',
423
+ 'failed',
424
+ 'errored'
425
+ ]),
426
+ matched_count: z.number().int().nonnegative(),
427
+ connection_id: idSchema.nullable(),
428
+ connection_name: utf8CappedString(AGENT_ACCESS_CONNECTION_NAME_MAX_BYTES).nullable(),
429
+ replay_of_event_id: idSchema.nullable(),
430
+ received_at: dateTimeSchema,
431
+ processed_at: dateTimeSchema.nullable()
432
+ }).strict();
433
+ export const listTriggerEventsResultSchema = z.object({
434
+ trigger_events: z.array(triggerEventResultItemSchema),
435
+ next_cursor: z.string().nullable()
436
+ }).strict();
437
+ const uuid = {
438
+ type: 'string',
439
+ format: 'uuid'
440
+ };
441
+ const cappedText = {
442
+ type: 'string',
443
+ maxLength: AGENT_ACCESS_TEXT_MAX_BYTES
444
+ };
445
+ const diagnostic = {
446
+ type: 'object',
447
+ properties: {
448
+ severity: {
449
+ type: 'string',
450
+ enum: [
451
+ 'error',
452
+ 'warning'
453
+ ]
454
+ },
455
+ code: {
456
+ type: 'string',
457
+ maxLength: AGENT_ACCESS_DIAGNOSTIC_CODE_MAX_BYTES
458
+ },
459
+ message: {
460
+ type: 'string',
461
+ maxLength: AGENT_ACCESS_DIAGNOSTIC_MESSAGE_MAX_BYTES
462
+ },
463
+ path: {
464
+ type: 'string',
465
+ maxLength: AGENT_ACCESS_DIAGNOSTIC_PATH_MAX_BYTES
466
+ },
467
+ file_path: {
468
+ type: 'string',
469
+ maxLength: AGENT_ACCESS_DIAGNOSTIC_PATH_MAX_BYTES
470
+ }
471
+ },
472
+ required: [
473
+ 'severity',
474
+ 'code',
475
+ 'message'
476
+ ],
477
+ additionalProperties: false
478
+ };
479
+ const nullable = (schema)=>({
480
+ anyOf: [
481
+ schema,
482
+ {
483
+ type: 'null'
484
+ }
485
+ ]
486
+ });
487
+ const projectResultJsonSchema = {
488
+ type: 'object',
489
+ properties: {
490
+ id: uuid,
491
+ name: cappedText,
492
+ slug: cappedText,
493
+ created_at: dateTime,
494
+ updated_at: dateTime
495
+ },
496
+ required: [
497
+ 'id',
498
+ 'name',
499
+ 'slug',
500
+ 'created_at',
501
+ 'updated_at'
502
+ ],
503
+ additionalProperties: false
504
+ };
505
+ export const listProjectsResultJsonSchema = {
506
+ type: 'object',
507
+ properties: {
508
+ projects: {
509
+ type: 'array',
510
+ items: projectResultJsonSchema
511
+ },
512
+ next_cursor: nullable({
513
+ type: 'string'
514
+ })
515
+ },
516
+ required: [
517
+ 'projects',
518
+ 'next_cursor'
519
+ ],
520
+ additionalProperties: false
521
+ };
522
+ const definitionResultJsonSchema = {
523
+ type: 'object',
524
+ properties: {
525
+ id: uuid,
526
+ project_id: uuid,
527
+ name: cappedText,
528
+ config_path: nullable(cappedText),
529
+ source: {
530
+ type: 'string',
531
+ enum: [
532
+ 'manual',
533
+ 'vcs'
534
+ ]
535
+ },
536
+ ref: nullable(cappedText),
537
+ sha: nullable(cappedText)
538
+ },
539
+ required: [
540
+ 'id',
541
+ 'project_id',
542
+ 'name',
543
+ 'config_path',
544
+ 'source',
545
+ 'ref',
546
+ 'sha'
547
+ ],
548
+ additionalProperties: false
549
+ };
550
+ const definitionSyncJsonSchema = {
551
+ type: 'object',
552
+ properties: {
553
+ ref: nullable(cappedText),
554
+ status: {
555
+ type: 'string',
556
+ enum: [
557
+ 'pending',
558
+ 'syncing',
559
+ 'succeeded',
560
+ 'failed'
561
+ ]
562
+ },
563
+ last_sync_at: dateTime,
564
+ started_at: nullable(dateTime),
565
+ finished_at: nullable(dateTime),
566
+ last_error_code: nullable({
567
+ type: 'string',
568
+ enum: definitionSyncErrorCodes
569
+ }),
570
+ last_error_message: nullable(cappedText),
571
+ diagnostics: {
572
+ type: 'object',
573
+ properties: {
574
+ error_count: {
575
+ type: 'integer',
576
+ minimum: 0
577
+ },
578
+ warning_count: {
579
+ type: 'integer',
580
+ minimum: 0
581
+ },
582
+ items: {
583
+ type: 'array',
584
+ maxItems: AGENT_ACCESS_DIAGNOSTIC_MAX_ITEMS,
585
+ items: diagnostic
586
+ }
587
+ },
588
+ required: [
589
+ 'error_count',
590
+ 'warning_count',
591
+ 'items'
592
+ ],
593
+ additionalProperties: false
594
+ }
595
+ },
596
+ required: [
597
+ 'ref',
598
+ 'status',
599
+ 'last_sync_at',
600
+ 'started_at',
601
+ 'finished_at',
602
+ 'last_error_code',
603
+ 'last_error_message',
604
+ 'diagnostics'
605
+ ],
606
+ additionalProperties: false
607
+ };
608
+ export const listWorkflowDefinitionsResultJsonSchema = {
609
+ type: 'object',
610
+ properties: {
611
+ definitions: {
612
+ type: 'array',
613
+ items: definitionResultJsonSchema
614
+ },
615
+ sync: nullable(definitionSyncJsonSchema),
616
+ next_cursor: nullable({
617
+ type: 'string'
618
+ })
619
+ },
620
+ required: [
621
+ 'definitions',
622
+ 'sync',
623
+ 'next_cursor'
624
+ ],
625
+ additionalProperties: false
626
+ };
627
+ const runDevSourceJsonSchema = {
628
+ type: 'object',
629
+ properties: {
630
+ ref: cappedText,
631
+ commit: cappedText,
632
+ config_path: cappedText,
633
+ initiated_by_user_id: uuid,
634
+ replay_of_event_id: nullable(uuid)
635
+ },
636
+ required: [
637
+ 'ref',
638
+ 'commit',
639
+ 'config_path',
640
+ 'initiated_by_user_id',
641
+ 'replay_of_event_id'
642
+ ],
643
+ additionalProperties: false
644
+ };
645
+ const runTriggerReferenceJsonSchema = {
646
+ type: 'object',
647
+ properties: {
648
+ repository: nullable(cappedText),
649
+ ref: nullable(cappedText),
650
+ commit: nullable(cappedText),
651
+ actor: nullable(cappedText)
652
+ },
653
+ required: [
654
+ 'repository',
655
+ 'ref',
656
+ 'commit',
657
+ 'actor'
658
+ ],
659
+ additionalProperties: false
660
+ };
661
+ const jobStatusCountJsonSchema = {
662
+ type: 'object',
663
+ properties: {
664
+ status: {
665
+ type: 'string',
666
+ enum: [
667
+ 'pending',
668
+ 'running',
669
+ 'succeeded',
670
+ 'failed',
671
+ 'cancelled',
672
+ 'skipped'
673
+ ]
674
+ },
675
+ count: {
676
+ type: 'integer',
677
+ minimum: 1
678
+ }
679
+ },
680
+ required: [
681
+ 'status',
682
+ 'count'
683
+ ],
684
+ additionalProperties: false
685
+ };
686
+ const runResultJsonSchema = {
687
+ type: 'object',
688
+ properties: {
689
+ id: uuid,
690
+ project_id: uuid,
691
+ definition_id: uuid,
692
+ number: {
693
+ type: 'integer',
694
+ minimum: 1
695
+ },
696
+ name: cappedText,
697
+ workflow_name: cappedText,
698
+ status: {
699
+ type: 'string',
700
+ enum: [
701
+ 'pending',
702
+ 'running',
703
+ 'succeeded',
704
+ 'failed',
705
+ 'cancelled'
706
+ ]
707
+ },
708
+ origin: {
709
+ type: 'string',
710
+ enum: [
711
+ 'synced',
712
+ 'dev'
713
+ ]
714
+ },
715
+ dev_source: nullable(runDevSourceJsonSchema),
716
+ current_attempt: {
717
+ type: 'integer',
718
+ minimum: 1
719
+ },
720
+ latest_attempt: {
721
+ type: 'integer',
722
+ minimum: 1
723
+ },
724
+ trigger_provider: nullable(cappedText),
725
+ trigger_source: cappedText,
726
+ trigger_event: cappedText,
727
+ trigger_reference: nullable(runTriggerReferenceJsonSchema),
728
+ job_status_counts: {
729
+ type: 'array',
730
+ items: jobStatusCountJsonSchema
731
+ },
732
+ has_started_job_execution: {
733
+ type: 'boolean'
734
+ },
735
+ created_at: dateTime,
736
+ updated_at: dateTime,
737
+ started_at: nullable(dateTime),
738
+ finished_at: nullable(dateTime)
739
+ },
740
+ required: [
741
+ 'id',
742
+ 'project_id',
743
+ 'definition_id',
744
+ 'number',
745
+ 'name',
746
+ 'workflow_name',
747
+ 'status',
748
+ 'origin',
749
+ 'dev_source',
750
+ 'current_attempt',
751
+ 'latest_attempt',
752
+ 'trigger_provider',
753
+ 'trigger_source',
754
+ 'trigger_event',
755
+ 'trigger_reference',
756
+ 'job_status_counts',
757
+ 'has_started_job_execution',
758
+ 'created_at',
759
+ 'updated_at',
760
+ 'started_at',
761
+ 'finished_at'
762
+ ],
763
+ additionalProperties: false
764
+ };
765
+ export const listWorkflowRunsResultJsonSchema = {
766
+ type: 'object',
767
+ properties: {
768
+ runs: {
769
+ type: 'array',
770
+ items: runResultJsonSchema
771
+ },
772
+ next_cursor: nullable({
773
+ type: 'string'
774
+ }),
775
+ filtered_total_count: nullable({
776
+ type: 'integer',
777
+ minimum: 0
778
+ })
779
+ },
780
+ required: [
781
+ 'runs',
782
+ 'next_cursor',
783
+ 'filtered_total_count'
784
+ ],
785
+ additionalProperties: false
786
+ };
787
+ const annotationResultJsonSchema = {
788
+ type: 'object',
789
+ properties: {
790
+ id: uuid,
791
+ origin_step_id: uuid,
792
+ origin_step_attempt: {
793
+ type: 'integer',
794
+ minimum: 1
795
+ },
796
+ job_execution_id: uuid,
797
+ sequence: {
798
+ type: 'integer',
799
+ minimum: 1
800
+ },
801
+ created_at: dateTime,
802
+ body: {
803
+ type: 'string',
804
+ maxLength: AGENT_ACCESS_ANNOTATION_BODY_MAX_BYTES
805
+ },
806
+ body_truncated: {
807
+ const: true
808
+ },
809
+ body_total_bytes: {
810
+ type: 'integer',
811
+ minimum: 0
812
+ }
813
+ },
814
+ required: [
815
+ 'id',
816
+ 'origin_step_id',
817
+ 'origin_step_attempt',
818
+ 'job_execution_id',
819
+ 'sequence',
820
+ 'created_at',
821
+ 'body'
822
+ ],
823
+ additionalProperties: false
824
+ };
825
+ export const getRunAnnotationsResultJsonSchema = {
826
+ type: 'object',
827
+ properties: {
828
+ annotations: {
829
+ type: 'array',
830
+ items: annotationResultJsonSchema
831
+ },
832
+ next_cursor: nullable({
833
+ type: 'string'
834
+ })
835
+ },
836
+ required: [
837
+ 'annotations',
838
+ 'next_cursor'
839
+ ],
840
+ additionalProperties: false
841
+ };
842
+ const triggerEventResultJsonSchema = {
843
+ type: 'object',
844
+ properties: {
845
+ id: uuid,
846
+ origin: {
847
+ type: 'string',
848
+ enum: [
849
+ 'integration',
850
+ 'manual',
851
+ 'cron',
852
+ 'dev'
853
+ ]
854
+ },
855
+ provider: nullable(cappedText),
856
+ source: cappedText,
857
+ event: cappedText,
858
+ outcome: {
859
+ type: 'string',
860
+ enum: [
861
+ 'received',
862
+ 'routed',
863
+ 'discarded',
864
+ 'failed',
865
+ 'errored'
866
+ ]
867
+ },
868
+ matched_count: {
869
+ type: 'integer',
870
+ minimum: 0
871
+ },
872
+ connection_id: nullable(uuid),
873
+ connection_name: nullable({
874
+ type: 'string',
875
+ maxLength: AGENT_ACCESS_CONNECTION_NAME_MAX_BYTES
876
+ }),
877
+ replay_of_event_id: nullable(uuid),
878
+ received_at: dateTime,
879
+ processed_at: nullable(dateTime)
880
+ },
881
+ required: [
882
+ 'id',
883
+ 'origin',
884
+ 'provider',
885
+ 'source',
886
+ 'event',
887
+ 'outcome',
888
+ 'matched_count',
889
+ 'connection_id',
890
+ 'connection_name',
891
+ 'replay_of_event_id',
892
+ 'received_at',
893
+ 'processed_at'
894
+ ],
895
+ additionalProperties: false
896
+ };
897
+ export const listTriggerEventsResultJsonSchema = {
898
+ type: 'object',
899
+ properties: {
900
+ trigger_events: {
901
+ type: 'array',
902
+ items: triggerEventResultJsonSchema
903
+ },
904
+ next_cursor: nullable({
905
+ type: 'string'
906
+ })
907
+ },
908
+ required: [
909
+ 'trigger_events',
910
+ 'next_cursor'
911
+ ],
912
+ additionalProperties: false
913
+ };
914
+
915
+ //# sourceMappingURL=paged-tools.js.map