@trigger.dev/core 2.1.3 → 2.1.4

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/dist/index.js CHANGED
@@ -73,6 +73,7 @@ __export(src_exports, {
73
73
  FetchRetryStrategySchema: () => FetchRetryStrategySchema,
74
74
  GetEventSchema: () => GetEventSchema,
75
75
  GetRunSchema: () => GetRunSchema,
76
+ GetRunStatusesSchema: () => GetRunStatusesSchema,
76
77
  GetRunsSchema: () => GetRunsSchema,
77
78
  HandleTriggerSourceSchema: () => HandleTriggerSourceSchema,
78
79
  HttpSourceRequestHeadersSchema: () => HttpSourceRequestHeadersSchema,
@@ -86,6 +87,7 @@ __export(src_exports, {
86
87
  IntervalMetadataSchema: () => IntervalMetadataSchema,
87
88
  IntervalOptionsSchema: () => IntervalOptionsSchema,
88
89
  JobMetadataSchema: () => JobMetadataSchema,
90
+ JobRunStatusRecordSchema: () => JobRunStatusRecordSchema,
89
91
  LogMessageSchema: () => LogMessageSchema,
90
92
  Logger: () => Logger,
91
93
  MISSING_CONNECTION_NOTIFICATION: () => MISSING_CONNECTION_NOTIFICATION,
@@ -126,10 +128,12 @@ __export(src_exports, {
126
128
  RunJobBodySchema: () => RunJobBodySchema,
127
129
  RunJobCanceledWithTaskSchema: () => RunJobCanceledWithTaskSchema,
128
130
  RunJobErrorSchema: () => RunJobErrorSchema,
131
+ RunJobInvalidPayloadErrorSchema: () => RunJobInvalidPayloadErrorSchema,
129
132
  RunJobResponseSchema: () => RunJobResponseSchema,
130
133
  RunJobResumeWithTaskSchema: () => RunJobResumeWithTaskSchema,
131
134
  RunJobRetryWithTaskSchema: () => RunJobRetryWithTaskSchema,
132
135
  RunJobSuccessSchema: () => RunJobSuccessSchema,
136
+ RunJobUnresolvedAuthErrorSchema: () => RunJobUnresolvedAuthErrorSchema,
133
137
  RunSourceContextSchema: () => RunSourceContextSchema,
134
138
  RunStatusSchema: () => RunStatusSchema,
135
139
  RunTaskBodyInputSchema: () => RunTaskBodyInputSchema,
@@ -141,12 +145,16 @@ __export(src_exports, {
141
145
  ScheduleMetadataSchema: () => ScheduleMetadataSchema,
142
146
  ScheduledPayloadSchema: () => ScheduledPayloadSchema,
143
147
  ScheduledTriggerMetadataSchema: () => ScheduledTriggerMetadataSchema,
148
+ SchemaErrorSchema: () => SchemaErrorSchema,
144
149
  SendEventBodySchema: () => SendEventBodySchema,
145
150
  SendEventOptionsSchema: () => SendEventOptionsSchema,
146
151
  SerializableJsonSchema: () => SerializableJsonSchema,
147
152
  ServerTaskSchema: () => ServerTaskSchema,
148
153
  SourceMetadataV2Schema: () => SourceMetadataV2Schema,
149
154
  StaticTriggerMetadataSchema: () => StaticTriggerMetadataSchema,
155
+ StatusHistorySchema: () => StatusHistorySchema,
156
+ StatusUpdateSchema: () => StatusUpdateSchema,
157
+ StatusUpdateStateSchema: () => StatusUpdateStateSchema,
150
158
  StyleSchema: () => StyleSchema,
151
159
  TaskSchema: () => TaskSchema,
152
160
  TaskStatusSchema: () => TaskStatusSchema,
@@ -319,7 +327,7 @@ __name(prettyPrintBytes, "prettyPrintBytes");
319
327
 
320
328
  // src/schemas/api.ts
321
329
  var import_ulid = require("ulid");
322
- var import_zod9 = require("zod");
330
+ var import_zod11 = require("zod");
323
331
 
324
332
  // src/schemas/addMissingVersionField.ts
325
333
  function addMissingVersionField(val) {
@@ -340,6 +348,10 @@ var ErrorWithStackSchema = import_zod.z.object({
340
348
  name: import_zod.z.string().optional(),
341
349
  stack: import_zod.z.string().optional()
342
350
  });
351
+ var SchemaErrorSchema = import_zod.z.object({
352
+ path: import_zod.z.array(import_zod.z.string()),
353
+ message: import_zod.z.string()
354
+ });
343
355
 
344
356
  // src/schemas/eventFilter.ts
345
357
  var import_zod2 = require("zod");
@@ -422,7 +434,8 @@ var EventRuleSchema = import_zod2.z.object({
422
434
  var import_zod3 = require("zod");
423
435
  var ConnectionAuthSchema = import_zod3.z.object({
424
436
  type: import_zod3.z.enum([
425
- "oauth2"
437
+ "oauth2",
438
+ "apiKey"
426
439
  ]),
427
440
  accessToken: import_zod3.z.string(),
428
441
  scopes: import_zod3.z.array(import_zod3.z.string()).optional(),
@@ -438,7 +451,8 @@ var IntegrationConfigSchema = import_zod3.z.object({
438
451
  metadata: IntegrationMetadataSchema,
439
452
  authSource: import_zod3.z.enum([
440
453
  "HOSTED",
441
- "LOCAL"
454
+ "LOCAL",
455
+ "RESOLVER"
442
456
  ])
443
457
  });
444
458
 
@@ -511,6 +525,8 @@ var CronOptionsSchema = import_zod6.z.object({
511
525
  var CronMetadataSchema = import_zod6.z.object({
512
526
  type: import_zod6.z.literal("cron"),
513
527
  options: CronOptionsSchema,
528
+ /** An optional Account ID to associate with runs triggered by this interval */
529
+ accountId: import_zod6.z.string().optional(),
514
530
  metadata: import_zod6.z.any()
515
531
  });
516
532
  var IntervalMetadataSchema = import_zod6.z.object({
@@ -518,6 +534,8 @@ var IntervalMetadataSchema = import_zod6.z.object({
518
534
  type: import_zod6.z.literal("interval"),
519
535
  /** An object containing options about the interval. */
520
536
  options: IntervalOptionsSchema,
537
+ /** An optional Account ID to associate with runs triggered by this interval */
538
+ accountId: import_zod6.z.string().optional(),
521
539
  /** Any additional metadata about the schedule. */
522
540
  metadata: import_zod6.z.any()
523
541
  });
@@ -616,456 +634,577 @@ var TriggerMetadataSchema = import_zod8.z.discriminatedUnion("type", [
616
634
  ScheduledTriggerMetadataSchema
617
635
  ]);
618
636
 
637
+ // src/schemas/runs.ts
638
+ var import_zod10 = require("zod");
639
+
640
+ // src/schemas/statuses.ts
641
+ var import_zod9 = require("zod");
642
+ var StatusUpdateStateSchema = import_zod9.z.union([
643
+ import_zod9.z.literal("loading"),
644
+ import_zod9.z.literal("success"),
645
+ import_zod9.z.literal("failure")
646
+ ]);
647
+ var StatusUpdateDataSchema = import_zod9.z.record(SerializableJsonSchema);
648
+ var StatusUpdateSchema = import_zod9.z.object({
649
+ label: import_zod9.z.string().optional(),
650
+ state: StatusUpdateStateSchema.optional(),
651
+ data: StatusUpdateDataSchema.optional()
652
+ });
653
+ var InitalStatusUpdateSchema = StatusUpdateSchema.required({
654
+ label: true
655
+ });
656
+ var StatusHistorySchema = import_zod9.z.array(StatusUpdateSchema);
657
+ var JobRunStatusRecordSchema = InitalStatusUpdateSchema.extend({
658
+ key: import_zod9.z.string(),
659
+ history: StatusHistorySchema
660
+ });
661
+
662
+ // src/schemas/runs.ts
663
+ var RunStatusSchema = import_zod10.z.union([
664
+ import_zod10.z.literal("PENDING"),
665
+ import_zod10.z.literal("QUEUED"),
666
+ import_zod10.z.literal("WAITING_ON_CONNECTIONS"),
667
+ import_zod10.z.literal("PREPROCESSING"),
668
+ import_zod10.z.literal("STARTED"),
669
+ import_zod10.z.literal("SUCCESS"),
670
+ import_zod10.z.literal("FAILURE"),
671
+ import_zod10.z.literal("TIMED_OUT"),
672
+ import_zod10.z.literal("ABORTED"),
673
+ import_zod10.z.literal("CANCELED"),
674
+ import_zod10.z.literal("UNRESOLVED_AUTH"),
675
+ import_zod10.z.literal("INVALID_PAYLOAD")
676
+ ]);
677
+ var RunTaskSchema = import_zod10.z.object({
678
+ /** The Task id */
679
+ id: import_zod10.z.string(),
680
+ /** The key that you defined when creating the Task, the first param in any task. */
681
+ displayKey: import_zod10.z.string().nullable(),
682
+ /** The Task status */
683
+ status: TaskStatusSchema,
684
+ /** The name of the Task */
685
+ name: import_zod10.z.string(),
686
+ /** The icon of the Task, a string.
687
+ * For integrations, this will be a lowercase name of the company.
688
+ * Can be used with the [@trigger.dev/companyicons](https://www.npmjs.com/package/@trigger.dev/companyicons) package to display an svg. */
689
+ icon: import_zod10.z.string().nullable(),
690
+ /** When the task started */
691
+ startedAt: import_zod10.z.coerce.date().nullable(),
692
+ /** When the task completed */
693
+ completedAt: import_zod10.z.coerce.date().nullable()
694
+ });
695
+ var RunTaskWithSubtasksSchema = RunTaskSchema.extend({
696
+ subtasks: import_zod10.z.lazy(() => RunTaskWithSubtasksSchema.array()).optional()
697
+ });
698
+ var GetRunOptionsSchema = import_zod10.z.object({
699
+ /** Return subtasks, which appear in a `subtasks` array on a task. @default false */
700
+ subtasks: import_zod10.z.boolean().optional(),
701
+ /** You can use this to get more tasks, if there are more than are returned in a single batch @default undefined */
702
+ cursor: import_zod10.z.string().optional(),
703
+ /** How many tasks you want to return in one go, max 50. @default 20 */
704
+ take: import_zod10.z.number().optional()
705
+ });
706
+ var GetRunOptionsWithTaskDetailsSchema = GetRunOptionsSchema.extend({
707
+ /** If `true`, it returns the `params` and `output` of all tasks. @default false */
708
+ taskdetails: import_zod10.z.boolean().optional()
709
+ });
710
+ var RunSchema = import_zod10.z.object({
711
+ /** The Run id */
712
+ id: import_zod10.z.string(),
713
+ /** The Run status */
714
+ status: RunStatusSchema,
715
+ /** When the run started */
716
+ startedAt: import_zod10.z.coerce.date().nullable(),
717
+ /** When the run was last updated */
718
+ updatedAt: import_zod10.z.coerce.date().nullable(),
719
+ /** When the run was completed */
720
+ completedAt: import_zod10.z.coerce.date().nullable()
721
+ });
722
+ var GetRunSchema = RunSchema.extend({
723
+ /** The output of the run */
724
+ output: import_zod10.z.any().optional(),
725
+ /** The tasks from the run */
726
+ tasks: import_zod10.z.array(RunTaskWithSubtasksSchema),
727
+ /** Any status updates that were published from the run */
728
+ statuses: import_zod10.z.array(JobRunStatusRecordSchema).default([]),
729
+ /** If there are more tasks, you can use this to get them */
730
+ nextCursor: import_zod10.z.string().optional()
731
+ });
732
+ var GetRunsOptionsSchema = import_zod10.z.object({
733
+ /** You can use this to get more tasks, if there are more than are returned in a single batch @default undefined */
734
+ cursor: import_zod10.z.string().optional(),
735
+ /** How many runs you want to return in one go, max 50. @default 20 */
736
+ take: import_zod10.z.number().optional()
737
+ });
738
+ var GetRunsSchema = import_zod10.z.object({
739
+ /** The runs from the query */
740
+ runs: RunSchema.array(),
741
+ /** If there are more runs, you can use this to get them */
742
+ nextCursor: import_zod10.z.string().optional()
743
+ });
744
+
619
745
  // src/schemas/api.ts
620
- var UpdateTriggerSourceBodyV1Schema = import_zod9.z.object({
621
- registeredEvents: import_zod9.z.array(import_zod9.z.string()),
622
- secret: import_zod9.z.string().optional(),
746
+ var UpdateTriggerSourceBodyV1Schema = import_zod11.z.object({
747
+ registeredEvents: import_zod11.z.array(import_zod11.z.string()),
748
+ secret: import_zod11.z.string().optional(),
623
749
  data: SerializableJsonSchema.optional()
624
750
  });
625
- var UpdateTriggerSourceBodyV2Schema = import_zod9.z.object({
626
- secret: import_zod9.z.string().optional(),
751
+ var UpdateTriggerSourceBodyV2Schema = import_zod11.z.object({
752
+ secret: import_zod11.z.string().optional(),
627
753
  data: SerializableJsonSchema.optional(),
628
- options: import_zod9.z.object({
629
- event: import_zod9.z.array(import_zod9.z.string())
630
- }).and(import_zod9.z.record(import_zod9.z.string(), import_zod9.z.array(import_zod9.z.string())).optional())
754
+ options: import_zod11.z.object({
755
+ event: import_zod11.z.array(import_zod11.z.string())
756
+ }).and(import_zod11.z.record(import_zod11.z.string(), import_zod11.z.array(import_zod11.z.string())).optional())
631
757
  });
632
- var RegisterHTTPTriggerSourceBodySchema = import_zod9.z.object({
633
- type: import_zod9.z.literal("HTTP"),
634
- url: import_zod9.z.string().url()
758
+ var RegisterHTTPTriggerSourceBodySchema = import_zod11.z.object({
759
+ type: import_zod11.z.literal("HTTP"),
760
+ url: import_zod11.z.string().url()
635
761
  });
636
- var RegisterSMTPTriggerSourceBodySchema = import_zod9.z.object({
637
- type: import_zod9.z.literal("SMTP")
762
+ var RegisterSMTPTriggerSourceBodySchema = import_zod11.z.object({
763
+ type: import_zod11.z.literal("SMTP")
638
764
  });
639
- var RegisterSQSTriggerSourceBodySchema = import_zod9.z.object({
640
- type: import_zod9.z.literal("SQS")
765
+ var RegisterSQSTriggerSourceBodySchema = import_zod11.z.object({
766
+ type: import_zod11.z.literal("SQS")
641
767
  });
642
- var RegisterSourceChannelBodySchema = import_zod9.z.discriminatedUnion("type", [
768
+ var RegisterSourceChannelBodySchema = import_zod11.z.discriminatedUnion("type", [
643
769
  RegisterHTTPTriggerSourceBodySchema,
644
770
  RegisterSMTPTriggerSourceBodySchema,
645
771
  RegisterSQSTriggerSourceBodySchema
646
772
  ]);
647
773
  var REGISTER_SOURCE_EVENT_V1 = "dev.trigger.source.register";
648
774
  var REGISTER_SOURCE_EVENT_V2 = "dev.trigger.source.register.v2";
649
- var RegisterTriggerSourceSchema = import_zod9.z.object({
650
- key: import_zod9.z.string(),
651
- params: import_zod9.z.any(),
652
- active: import_zod9.z.boolean(),
653
- secret: import_zod9.z.string(),
775
+ var RegisterTriggerSourceSchema = import_zod11.z.object({
776
+ key: import_zod11.z.string(),
777
+ params: import_zod11.z.any(),
778
+ active: import_zod11.z.boolean(),
779
+ secret: import_zod11.z.string(),
654
780
  data: DeserializedJsonSchema.optional(),
655
781
  channel: RegisterSourceChannelBodySchema,
656
- clientId: import_zod9.z.string().optional()
782
+ clientId: import_zod11.z.string().optional()
657
783
  });
658
- var SourceEventOptionSchema = import_zod9.z.object({
659
- name: import_zod9.z.string(),
660
- value: import_zod9.z.string()
784
+ var SourceEventOptionSchema = import_zod11.z.object({
785
+ name: import_zod11.z.string(),
786
+ value: import_zod11.z.string()
661
787
  });
662
- var RegisterSourceEventSchemaV1 = import_zod9.z.object({
788
+ var RegisterSourceEventSchemaV1 = import_zod11.z.object({
663
789
  /** The id of the source */
664
- id: import_zod9.z.string(),
790
+ id: import_zod11.z.string(),
665
791
  source: RegisterTriggerSourceSchema,
666
- events: import_zod9.z.array(import_zod9.z.string()),
667
- missingEvents: import_zod9.z.array(import_zod9.z.string()),
668
- orphanedEvents: import_zod9.z.array(import_zod9.z.string()),
669
- dynamicTriggerId: import_zod9.z.string().optional()
792
+ events: import_zod11.z.array(import_zod11.z.string()),
793
+ missingEvents: import_zod11.z.array(import_zod11.z.string()),
794
+ orphanedEvents: import_zod11.z.array(import_zod11.z.string()),
795
+ dynamicTriggerId: import_zod11.z.string().optional()
670
796
  });
671
- var RegisteredOptionsDiffSchema = import_zod9.z.object({
672
- desired: import_zod9.z.array(import_zod9.z.string()),
673
- missing: import_zod9.z.array(import_zod9.z.string()),
674
- orphaned: import_zod9.z.array(import_zod9.z.string())
797
+ var RegisteredOptionsDiffSchema = import_zod11.z.object({
798
+ desired: import_zod11.z.array(import_zod11.z.string()),
799
+ missing: import_zod11.z.array(import_zod11.z.string()),
800
+ orphaned: import_zod11.z.array(import_zod11.z.string())
675
801
  });
676
- var RegisterSourceEventOptionsSchema = import_zod9.z.object({
802
+ var RegisterSourceEventOptionsSchema = import_zod11.z.object({
677
803
  event: RegisteredOptionsDiffSchema
678
- }).and(import_zod9.z.record(import_zod9.z.string(), RegisteredOptionsDiffSchema));
679
- var RegisterSourceEventSchemaV2 = import_zod9.z.object({
804
+ }).and(import_zod11.z.record(import_zod11.z.string(), RegisteredOptionsDiffSchema));
805
+ var RegisterSourceEventSchemaV2 = import_zod11.z.object({
680
806
  /** The id of the source */
681
- id: import_zod9.z.string(),
807
+ id: import_zod11.z.string(),
682
808
  source: RegisterTriggerSourceSchema,
683
809
  options: RegisterSourceEventOptionsSchema,
684
- dynamicTriggerId: import_zod9.z.string().optional()
810
+ dynamicTriggerId: import_zod11.z.string().optional()
685
811
  });
686
- var TriggerSourceSchema = import_zod9.z.object({
687
- id: import_zod9.z.string(),
688
- key: import_zod9.z.string()
812
+ var TriggerSourceSchema = import_zod11.z.object({
813
+ id: import_zod11.z.string(),
814
+ key: import_zod11.z.string()
689
815
  });
690
816
  var HttpSourceResponseMetadataSchema = DeserializedJsonSchema;
691
- var HandleTriggerSourceSchema = import_zod9.z.object({
692
- key: import_zod9.z.string(),
693
- secret: import_zod9.z.string(),
694
- data: import_zod9.z.any(),
695
- params: import_zod9.z.any(),
817
+ var HandleTriggerSourceSchema = import_zod11.z.object({
818
+ key: import_zod11.z.string(),
819
+ secret: import_zod11.z.string(),
820
+ data: import_zod11.z.any(),
821
+ params: import_zod11.z.any(),
696
822
  auth: ConnectionAuthSchema.optional(),
697
823
  metadata: HttpSourceResponseMetadataSchema.optional()
698
824
  });
699
- var HttpSourceRequestSchema = import_zod9.z.object({
700
- url: import_zod9.z.string().url(),
701
- method: import_zod9.z.string(),
702
- headers: import_zod9.z.record(import_zod9.z.string()),
703
- rawBody: import_zod9.z.instanceof(Buffer).optional().nullable()
704
- });
705
- var HttpSourceRequestHeadersSchema = import_zod9.z.object({
706
- "x-ts-key": import_zod9.z.string(),
707
- "x-ts-dynamic-id": import_zod9.z.string().optional(),
708
- "x-ts-secret": import_zod9.z.string(),
709
- "x-ts-data": import_zod9.z.string().transform((s) => JSON.parse(s)),
710
- "x-ts-params": import_zod9.z.string().transform((s) => JSON.parse(s)),
711
- "x-ts-http-url": import_zod9.z.string(),
712
- "x-ts-http-method": import_zod9.z.string(),
713
- "x-ts-http-headers": import_zod9.z.string().transform((s) => import_zod9.z.record(import_zod9.z.string()).parse(JSON.parse(s))),
714
- "x-ts-auth": import_zod9.z.string().optional().transform((s) => {
825
+ var HttpSourceRequestSchema = import_zod11.z.object({
826
+ url: import_zod11.z.string().url(),
827
+ method: import_zod11.z.string(),
828
+ headers: import_zod11.z.record(import_zod11.z.string()),
829
+ rawBody: import_zod11.z.instanceof(Buffer).optional().nullable()
830
+ });
831
+ var HttpSourceRequestHeadersSchema = import_zod11.z.object({
832
+ "x-ts-key": import_zod11.z.string(),
833
+ "x-ts-dynamic-id": import_zod11.z.string().optional(),
834
+ "x-ts-secret": import_zod11.z.string(),
835
+ "x-ts-data": import_zod11.z.string().transform((s) => JSON.parse(s)),
836
+ "x-ts-params": import_zod11.z.string().transform((s) => JSON.parse(s)),
837
+ "x-ts-http-url": import_zod11.z.string(),
838
+ "x-ts-http-method": import_zod11.z.string(),
839
+ "x-ts-http-headers": import_zod11.z.string().transform((s) => import_zod11.z.record(import_zod11.z.string()).parse(JSON.parse(s))),
840
+ "x-ts-auth": import_zod11.z.string().optional().transform((s) => {
715
841
  if (s === void 0)
716
842
  return;
717
843
  const json = JSON.parse(s);
718
844
  return ConnectionAuthSchema.parse(json);
719
845
  }),
720
- "x-ts-metadata": import_zod9.z.string().optional().transform((s) => {
846
+ "x-ts-metadata": import_zod11.z.string().optional().transform((s) => {
721
847
  if (s === void 0)
722
848
  return;
723
849
  const json = JSON.parse(s);
724
850
  return DeserializedJsonSchema.parse(json);
725
851
  })
726
852
  });
727
- var PongSuccessResponseSchema = import_zod9.z.object({
728
- ok: import_zod9.z.literal(true)
853
+ var PongSuccessResponseSchema = import_zod11.z.object({
854
+ ok: import_zod11.z.literal(true)
729
855
  });
730
- var PongErrorResponseSchema = import_zod9.z.object({
731
- ok: import_zod9.z.literal(false),
732
- error: import_zod9.z.string()
856
+ var PongErrorResponseSchema = import_zod11.z.object({
857
+ ok: import_zod11.z.literal(false),
858
+ error: import_zod11.z.string()
733
859
  });
734
- var PongResponseSchema = import_zod9.z.discriminatedUnion("ok", [
860
+ var PongResponseSchema = import_zod11.z.discriminatedUnion("ok", [
735
861
  PongSuccessResponseSchema,
736
862
  PongErrorResponseSchema
737
863
  ]);
738
- var ValidateSuccessResponseSchema = import_zod9.z.object({
739
- ok: import_zod9.z.literal(true),
740
- endpointId: import_zod9.z.string()
864
+ var ValidateSuccessResponseSchema = import_zod11.z.object({
865
+ ok: import_zod11.z.literal(true),
866
+ endpointId: import_zod11.z.string()
741
867
  });
742
- var ValidateErrorResponseSchema = import_zod9.z.object({
743
- ok: import_zod9.z.literal(false),
744
- error: import_zod9.z.string()
868
+ var ValidateErrorResponseSchema = import_zod11.z.object({
869
+ ok: import_zod11.z.literal(false),
870
+ error: import_zod11.z.string()
745
871
  });
746
- var ValidateResponseSchema = import_zod9.z.discriminatedUnion("ok", [
872
+ var ValidateResponseSchema = import_zod11.z.discriminatedUnion("ok", [
747
873
  ValidateSuccessResponseSchema,
748
874
  ValidateErrorResponseSchema
749
875
  ]);
750
- var QueueOptionsSchema = import_zod9.z.object({
751
- name: import_zod9.z.string(),
752
- maxConcurrent: import_zod9.z.number().optional()
753
- });
754
- var JobMetadataSchema = import_zod9.z.object({
755
- id: import_zod9.z.string(),
756
- name: import_zod9.z.string(),
757
- version: import_zod9.z.string(),
876
+ var QueueOptionsSchema = import_zod11.z.object({
877
+ name: import_zod11.z.string(),
878
+ maxConcurrent: import_zod11.z.number().optional()
879
+ });
880
+ var JobMetadataSchema = import_zod11.z.object({
881
+ id: import_zod11.z.string(),
882
+ name: import_zod11.z.string(),
883
+ version: import_zod11.z.string(),
758
884
  event: EventSpecificationSchema,
759
885
  trigger: TriggerMetadataSchema,
760
- integrations: import_zod9.z.record(IntegrationConfigSchema),
761
- internal: import_zod9.z.boolean().default(false),
762
- enabled: import_zod9.z.boolean(),
763
- startPosition: import_zod9.z.enum([
886
+ integrations: import_zod11.z.record(IntegrationConfigSchema),
887
+ internal: import_zod11.z.boolean().default(false),
888
+ enabled: import_zod11.z.boolean(),
889
+ startPosition: import_zod11.z.enum([
764
890
  "initial",
765
891
  "latest"
766
892
  ]),
767
- preprocessRuns: import_zod9.z.boolean()
893
+ preprocessRuns: import_zod11.z.boolean()
768
894
  });
769
- var SourceMetadataV1Schema = import_zod9.z.object({
770
- version: import_zod9.z.literal("1"),
771
- channel: import_zod9.z.enum([
895
+ var SourceMetadataV1Schema = import_zod11.z.object({
896
+ version: import_zod11.z.literal("1"),
897
+ channel: import_zod11.z.enum([
772
898
  "HTTP",
773
899
  "SQS",
774
900
  "SMTP"
775
901
  ]),
776
902
  integration: IntegrationConfigSchema,
777
- key: import_zod9.z.string(),
778
- params: import_zod9.z.any(),
779
- events: import_zod9.z.array(import_zod9.z.string()),
780
- registerSourceJob: import_zod9.z.object({
781
- id: import_zod9.z.string(),
782
- version: import_zod9.z.string()
903
+ key: import_zod11.z.string(),
904
+ params: import_zod11.z.any(),
905
+ events: import_zod11.z.array(import_zod11.z.string()),
906
+ registerSourceJob: import_zod11.z.object({
907
+ id: import_zod11.z.string(),
908
+ version: import_zod11.z.string()
783
909
  }).optional()
784
910
  });
785
- var SourceMetadataV2Schema = import_zod9.z.object({
786
- version: import_zod9.z.literal("2"),
787
- channel: import_zod9.z.enum([
911
+ var SourceMetadataV2Schema = import_zod11.z.object({
912
+ version: import_zod11.z.literal("2"),
913
+ channel: import_zod11.z.enum([
788
914
  "HTTP",
789
915
  "SQS",
790
916
  "SMTP"
791
917
  ]),
792
918
  integration: IntegrationConfigSchema,
793
- key: import_zod9.z.string(),
794
- params: import_zod9.z.any(),
795
- options: import_zod9.z.record(import_zod9.z.array(import_zod9.z.string())),
796
- registerSourceJob: import_zod9.z.object({
797
- id: import_zod9.z.string(),
798
- version: import_zod9.z.string()
919
+ key: import_zod11.z.string(),
920
+ params: import_zod11.z.any(),
921
+ options: import_zod11.z.record(import_zod11.z.array(import_zod11.z.string())),
922
+ registerSourceJob: import_zod11.z.object({
923
+ id: import_zod11.z.string(),
924
+ version: import_zod11.z.string()
799
925
  }).optional()
800
926
  });
801
- var SourceMetadataSchema = import_zod9.z.preprocess(addMissingVersionField, import_zod9.z.discriminatedUnion("version", [
927
+ var SourceMetadataSchema = import_zod11.z.preprocess(addMissingVersionField, import_zod11.z.discriminatedUnion("version", [
802
928
  SourceMetadataV1Schema,
803
929
  SourceMetadataV2Schema
804
930
  ]));
805
- var DynamicTriggerEndpointMetadataSchema = import_zod9.z.object({
806
- id: import_zod9.z.string(),
807
- jobs: import_zod9.z.array(JobMetadataSchema.pick({
931
+ var DynamicTriggerEndpointMetadataSchema = import_zod11.z.object({
932
+ id: import_zod11.z.string(),
933
+ jobs: import_zod11.z.array(JobMetadataSchema.pick({
808
934
  id: true,
809
935
  version: true
810
936
  })),
811
- registerSourceJob: import_zod9.z.object({
812
- id: import_zod9.z.string(),
813
- version: import_zod9.z.string()
937
+ registerSourceJob: import_zod11.z.object({
938
+ id: import_zod11.z.string(),
939
+ version: import_zod11.z.string()
814
940
  }).optional()
815
941
  });
816
- var IndexEndpointResponseSchema = import_zod9.z.object({
817
- jobs: import_zod9.z.array(JobMetadataSchema),
818
- sources: import_zod9.z.array(SourceMetadataSchema),
819
- dynamicTriggers: import_zod9.z.array(DynamicTriggerEndpointMetadataSchema),
820
- dynamicSchedules: import_zod9.z.array(RegisterDynamicSchedulePayloadSchema)
942
+ var IndexEndpointResponseSchema = import_zod11.z.object({
943
+ jobs: import_zod11.z.array(JobMetadataSchema),
944
+ sources: import_zod11.z.array(SourceMetadataSchema),
945
+ dynamicTriggers: import_zod11.z.array(DynamicTriggerEndpointMetadataSchema),
946
+ dynamicSchedules: import_zod11.z.array(RegisterDynamicSchedulePayloadSchema)
821
947
  });
822
- var RawEventSchema = import_zod9.z.object({
948
+ var RawEventSchema = import_zod11.z.object({
823
949
  /** The `name` property must exactly match any subscriptions you want to
824
950
  trigger. */
825
- name: import_zod9.z.string(),
951
+ name: import_zod11.z.string(),
826
952
  /** The `payload` property will be sent to any matching Jobs and will appear
827
953
  as the `payload` param of the `run()` function. You can leave this
828
954
  parameter out if you just want to trigger a Job without any input data. */
829
- payload: import_zod9.z.any(),
955
+ payload: import_zod11.z.any(),
830
956
  /** The optional `context` property will be sent to any matching Jobs and will
831
957
  be passed through as the `context.event.context` param of the `run()`
832
958
  function. This is optional but can be useful if you want to pass through
833
959
  some additional context to the Job. */
834
- context: import_zod9.z.any().optional(),
960
+ context: import_zod11.z.any().optional(),
835
961
  /** The `id` property uniquely identify this particular event. If unset it
836
962
  will be set automatically using `ulid`. */
837
- id: import_zod9.z.string().default(() => (0, import_ulid.ulid)()),
963
+ id: import_zod11.z.string().default(() => (0, import_ulid.ulid)()),
838
964
  /** This is optional, it defaults to the current timestamp. Usually you would
839
965
  only set this if you have a timestamp that you wish to pass through, e.g.
840
966
  you receive a timestamp from a service and you want the same timestamp to
841
967
  be used in your Job. */
842
- timestamp: import_zod9.z.coerce.date().optional(),
968
+ timestamp: import_zod11.z.coerce.date().optional(),
843
969
  /** This is optional, it defaults to "trigger.dev". It can be useful to set
844
970
  this as you can filter events using this in the `eventTrigger()`. */
845
- source: import_zod9.z.string().optional()
971
+ source: import_zod11.z.string().optional()
846
972
  });
847
- var ApiEventLogSchema = import_zod9.z.object({
973
+ var ApiEventLogSchema = import_zod11.z.object({
848
974
  /** The `id` of the event that was sent.
849
975
  */
850
- id: import_zod9.z.string(),
976
+ id: import_zod11.z.string(),
851
977
  /** The `name` of the event that was sent. */
852
- name: import_zod9.z.string(),
978
+ name: import_zod11.z.string(),
853
979
  /** The `payload` of the event that was sent */
854
980
  payload: DeserializedJsonSchema,
855
981
  /** The `context` of the event that was sent. Is `undefined` if no context was
856
982
  set when sending the event. */
857
983
  context: DeserializedJsonSchema.optional().nullable(),
858
984
  /** The `timestamp` of the event that was sent */
859
- timestamp: import_zod9.z.coerce.date(),
985
+ timestamp: import_zod11.z.coerce.date(),
860
986
  /** The timestamp when the event will be delivered to any matching Jobs. Is
861
987
  `undefined` if `deliverAt` or `deliverAfter` wasn't set when sending the
862
988
  event. */
863
- deliverAt: import_zod9.z.coerce.date().optional().nullable(),
989
+ deliverAt: import_zod11.z.coerce.date().optional().nullable(),
864
990
  /** The timestamp when the event was delivered. Is `undefined` if `deliverAt`
865
991
  or `deliverAfter` were set when sending the event. */
866
- deliveredAt: import_zod9.z.coerce.date().optional().nullable(),
992
+ deliveredAt: import_zod11.z.coerce.date().optional().nullable(),
867
993
  /** The timestamp when the event was cancelled. Is `undefined` if the event
868
994
  * wasn't cancelled. */
869
- cancelledAt: import_zod9.z.coerce.date().optional().nullable()
995
+ cancelledAt: import_zod11.z.coerce.date().optional().nullable()
870
996
  });
871
- var SendEventOptionsSchema = import_zod9.z.object({
997
+ var SendEventOptionsSchema = import_zod11.z.object({
872
998
  /** An optional Date when you want the event to trigger Jobs. The event will
873
999
  be sent to the platform immediately but won't be acted upon until the
874
1000
  specified time. */
875
- deliverAt: import_zod9.z.coerce.date().optional(),
1001
+ deliverAt: import_zod11.z.coerce.date().optional(),
876
1002
  /** An optional number of seconds you want to wait for the event to trigger
877
1003
  any relevant Jobs. The event will be sent to the platform immediately but
878
1004
  won't be delivered until after the elapsed number of seconds. */
879
- deliverAfter: import_zod9.z.number().int().optional(),
1005
+ deliverAfter: import_zod11.z.number().int().optional(),
880
1006
  /** This optional param will be used by Trigger.dev Connect, which
881
1007
  is coming soon. */
882
- accountId: import_zod9.z.string().optional()
1008
+ accountId: import_zod11.z.string().optional()
883
1009
  });
884
- var SendEventBodySchema = import_zod9.z.object({
1010
+ var SendEventBodySchema = import_zod11.z.object({
885
1011
  event: RawEventSchema,
886
1012
  options: SendEventOptionsSchema.optional()
887
1013
  });
888
- var DeliverEventResponseSchema = import_zod9.z.object({
889
- deliveredAt: import_zod9.z.string().datetime()
1014
+ var DeliverEventResponseSchema = import_zod11.z.object({
1015
+ deliveredAt: import_zod11.z.string().datetime()
890
1016
  });
891
- var RuntimeEnvironmentTypeSchema = import_zod9.z.enum([
1017
+ var RuntimeEnvironmentTypeSchema = import_zod11.z.enum([
892
1018
  "PRODUCTION",
893
1019
  "STAGING",
894
1020
  "DEVELOPMENT",
895
1021
  "PREVIEW"
896
1022
  ]);
897
- var RunSourceContextSchema = import_zod9.z.object({
898
- id: import_zod9.z.string(),
899
- metadata: import_zod9.z.any()
1023
+ var RunSourceContextSchema = import_zod11.z.object({
1024
+ id: import_zod11.z.string(),
1025
+ metadata: import_zod11.z.any()
900
1026
  });
901
- var RunJobBodySchema = import_zod9.z.object({
1027
+ var RunJobBodySchema = import_zod11.z.object({
902
1028
  event: ApiEventLogSchema,
903
- job: import_zod9.z.object({
904
- id: import_zod9.z.string(),
905
- version: import_zod9.z.string()
1029
+ job: import_zod11.z.object({
1030
+ id: import_zod11.z.string(),
1031
+ version: import_zod11.z.string()
906
1032
  }),
907
- run: import_zod9.z.object({
908
- id: import_zod9.z.string(),
909
- isTest: import_zod9.z.boolean(),
910
- isRetry: import_zod9.z.boolean().default(false),
911
- startedAt: import_zod9.z.coerce.date()
1033
+ run: import_zod11.z.object({
1034
+ id: import_zod11.z.string(),
1035
+ isTest: import_zod11.z.boolean(),
1036
+ isRetry: import_zod11.z.boolean().default(false),
1037
+ startedAt: import_zod11.z.coerce.date()
912
1038
  }),
913
- environment: import_zod9.z.object({
914
- id: import_zod9.z.string(),
915
- slug: import_zod9.z.string(),
1039
+ environment: import_zod11.z.object({
1040
+ id: import_zod11.z.string(),
1041
+ slug: import_zod11.z.string(),
916
1042
  type: RuntimeEnvironmentTypeSchema
917
1043
  }),
918
- organization: import_zod9.z.object({
919
- id: import_zod9.z.string(),
920
- title: import_zod9.z.string(),
921
- slug: import_zod9.z.string()
1044
+ organization: import_zod11.z.object({
1045
+ id: import_zod11.z.string(),
1046
+ title: import_zod11.z.string(),
1047
+ slug: import_zod11.z.string()
922
1048
  }),
923
- account: import_zod9.z.object({
924
- id: import_zod9.z.string(),
925
- metadata: import_zod9.z.any()
1049
+ account: import_zod11.z.object({
1050
+ id: import_zod11.z.string(),
1051
+ metadata: import_zod11.z.any()
926
1052
  }).optional(),
927
1053
  source: RunSourceContextSchema.optional(),
928
- tasks: import_zod9.z.array(CachedTaskSchema).optional(),
929
- connections: import_zod9.z.record(ConnectionAuthSchema).optional()
1054
+ tasks: import_zod11.z.array(CachedTaskSchema).optional(),
1055
+ connections: import_zod11.z.record(ConnectionAuthSchema).optional()
930
1056
  });
931
- var RunJobErrorSchema = import_zod9.z.object({
932
- status: import_zod9.z.literal("ERROR"),
1057
+ var RunJobErrorSchema = import_zod11.z.object({
1058
+ status: import_zod11.z.literal("ERROR"),
933
1059
  error: ErrorWithStackSchema,
934
1060
  task: TaskSchema.optional()
935
1061
  });
936
- var RunJobResumeWithTaskSchema = import_zod9.z.object({
937
- status: import_zod9.z.literal("RESUME_WITH_TASK"),
1062
+ var RunJobInvalidPayloadErrorSchema = import_zod11.z.object({
1063
+ status: import_zod11.z.literal("INVALID_PAYLOAD"),
1064
+ errors: import_zod11.z.array(SchemaErrorSchema)
1065
+ });
1066
+ var RunJobUnresolvedAuthErrorSchema = import_zod11.z.object({
1067
+ status: import_zod11.z.literal("UNRESOLVED_AUTH_ERROR"),
1068
+ issues: import_zod11.z.record(import_zod11.z.object({
1069
+ id: import_zod11.z.string(),
1070
+ error: import_zod11.z.string()
1071
+ }))
1072
+ });
1073
+ var RunJobResumeWithTaskSchema = import_zod11.z.object({
1074
+ status: import_zod11.z.literal("RESUME_WITH_TASK"),
938
1075
  task: TaskSchema
939
1076
  });
940
- var RunJobRetryWithTaskSchema = import_zod9.z.object({
941
- status: import_zod9.z.literal("RETRY_WITH_TASK"),
1077
+ var RunJobRetryWithTaskSchema = import_zod11.z.object({
1078
+ status: import_zod11.z.literal("RETRY_WITH_TASK"),
942
1079
  task: TaskSchema,
943
1080
  error: ErrorWithStackSchema,
944
- retryAt: import_zod9.z.coerce.date()
1081
+ retryAt: import_zod11.z.coerce.date()
945
1082
  });
946
- var RunJobCanceledWithTaskSchema = import_zod9.z.object({
947
- status: import_zod9.z.literal("CANCELED"),
1083
+ var RunJobCanceledWithTaskSchema = import_zod11.z.object({
1084
+ status: import_zod11.z.literal("CANCELED"),
948
1085
  task: TaskSchema
949
1086
  });
950
- var RunJobSuccessSchema = import_zod9.z.object({
951
- status: import_zod9.z.literal("SUCCESS"),
1087
+ var RunJobSuccessSchema = import_zod11.z.object({
1088
+ status: import_zod11.z.literal("SUCCESS"),
952
1089
  output: DeserializedJsonSchema.optional()
953
1090
  });
954
- var RunJobResponseSchema = import_zod9.z.discriminatedUnion("status", [
1091
+ var RunJobResponseSchema = import_zod11.z.discriminatedUnion("status", [
955
1092
  RunJobErrorSchema,
1093
+ RunJobUnresolvedAuthErrorSchema,
1094
+ RunJobInvalidPayloadErrorSchema,
956
1095
  RunJobResumeWithTaskSchema,
957
1096
  RunJobRetryWithTaskSchema,
958
1097
  RunJobCanceledWithTaskSchema,
959
1098
  RunJobSuccessSchema
960
1099
  ]);
961
- var PreprocessRunBodySchema = import_zod9.z.object({
1100
+ var PreprocessRunBodySchema = import_zod11.z.object({
962
1101
  event: ApiEventLogSchema,
963
- job: import_zod9.z.object({
964
- id: import_zod9.z.string(),
965
- version: import_zod9.z.string()
1102
+ job: import_zod11.z.object({
1103
+ id: import_zod11.z.string(),
1104
+ version: import_zod11.z.string()
966
1105
  }),
967
- run: import_zod9.z.object({
968
- id: import_zod9.z.string(),
969
- isTest: import_zod9.z.boolean()
1106
+ run: import_zod11.z.object({
1107
+ id: import_zod11.z.string(),
1108
+ isTest: import_zod11.z.boolean()
970
1109
  }),
971
- environment: import_zod9.z.object({
972
- id: import_zod9.z.string(),
973
- slug: import_zod9.z.string(),
1110
+ environment: import_zod11.z.object({
1111
+ id: import_zod11.z.string(),
1112
+ slug: import_zod11.z.string(),
974
1113
  type: RuntimeEnvironmentTypeSchema
975
1114
  }),
976
- organization: import_zod9.z.object({
977
- id: import_zod9.z.string(),
978
- title: import_zod9.z.string(),
979
- slug: import_zod9.z.string()
1115
+ organization: import_zod11.z.object({
1116
+ id: import_zod11.z.string(),
1117
+ title: import_zod11.z.string(),
1118
+ slug: import_zod11.z.string()
980
1119
  }),
981
- account: import_zod9.z.object({
982
- id: import_zod9.z.string(),
983
- metadata: import_zod9.z.any()
1120
+ account: import_zod11.z.object({
1121
+ id: import_zod11.z.string(),
1122
+ metadata: import_zod11.z.any()
984
1123
  }).optional()
985
1124
  });
986
- var PreprocessRunResponseSchema = import_zod9.z.object({
987
- abort: import_zod9.z.boolean(),
988
- properties: import_zod9.z.array(DisplayPropertySchema).optional()
1125
+ var PreprocessRunResponseSchema = import_zod11.z.object({
1126
+ abort: import_zod11.z.boolean(),
1127
+ properties: import_zod11.z.array(DisplayPropertySchema).optional()
989
1128
  });
990
- var CreateRunResponseOkSchema = import_zod9.z.object({
991
- ok: import_zod9.z.literal(true),
992
- data: import_zod9.z.object({
993
- id: import_zod9.z.string()
1129
+ var CreateRunResponseOkSchema = import_zod11.z.object({
1130
+ ok: import_zod11.z.literal(true),
1131
+ data: import_zod11.z.object({
1132
+ id: import_zod11.z.string()
994
1133
  })
995
1134
  });
996
- var CreateRunResponseErrorSchema = import_zod9.z.object({
997
- ok: import_zod9.z.literal(false),
998
- error: import_zod9.z.string()
1135
+ var CreateRunResponseErrorSchema = import_zod11.z.object({
1136
+ ok: import_zod11.z.literal(false),
1137
+ error: import_zod11.z.string()
999
1138
  });
1000
- var CreateRunResponseBodySchema = import_zod9.z.discriminatedUnion("ok", [
1139
+ var CreateRunResponseBodySchema = import_zod11.z.discriminatedUnion("ok", [
1001
1140
  CreateRunResponseOkSchema,
1002
1141
  CreateRunResponseErrorSchema
1003
1142
  ]);
1004
- var RedactStringSchema = import_zod9.z.object({
1005
- __redactedString: import_zod9.z.literal(true),
1006
- strings: import_zod9.z.array(import_zod9.z.string()),
1007
- interpolations: import_zod9.z.array(import_zod9.z.string())
1143
+ var RedactStringSchema = import_zod11.z.object({
1144
+ __redactedString: import_zod11.z.literal(true),
1145
+ strings: import_zod11.z.array(import_zod11.z.string()),
1146
+ interpolations: import_zod11.z.array(import_zod11.z.string())
1008
1147
  });
1009
- var LogMessageSchema = import_zod9.z.object({
1010
- level: import_zod9.z.enum([
1148
+ var LogMessageSchema = import_zod11.z.object({
1149
+ level: import_zod11.z.enum([
1011
1150
  "DEBUG",
1012
1151
  "INFO",
1013
1152
  "WARN",
1014
1153
  "ERROR"
1015
1154
  ]),
1016
- message: import_zod9.z.string(),
1155
+ message: import_zod11.z.string(),
1017
1156
  data: SerializableJsonSchema.optional()
1018
1157
  });
1019
- var RedactSchema = import_zod9.z.object({
1020
- paths: import_zod9.z.array(import_zod9.z.string())
1158
+ var RedactSchema = import_zod11.z.object({
1159
+ paths: import_zod11.z.array(import_zod11.z.string())
1021
1160
  });
1022
- var RetryOptionsSchema = import_zod9.z.object({
1161
+ var RetryOptionsSchema = import_zod11.z.object({
1023
1162
  /** The maximum number of times to retry the request. */
1024
- limit: import_zod9.z.number().optional(),
1163
+ limit: import_zod11.z.number().optional(),
1025
1164
  /** The exponential factor to use when calculating the next retry time. */
1026
- factor: import_zod9.z.number().optional(),
1165
+ factor: import_zod11.z.number().optional(),
1027
1166
  /** The minimum amount of time to wait before retrying the request. */
1028
- minTimeoutInMs: import_zod9.z.number().optional(),
1167
+ minTimeoutInMs: import_zod11.z.number().optional(),
1029
1168
  /** The maximum amount of time to wait before retrying the request. */
1030
- maxTimeoutInMs: import_zod9.z.number().optional(),
1169
+ maxTimeoutInMs: import_zod11.z.number().optional(),
1031
1170
  /** Whether to randomize the retry time. */
1032
- randomize: import_zod9.z.boolean().optional()
1171
+ randomize: import_zod11.z.boolean().optional()
1033
1172
  });
1034
- var RunTaskOptionsSchema = import_zod9.z.object({
1173
+ var RunTaskOptionsSchema = import_zod11.z.object({
1035
1174
  /** The name of the Task is required. This is displayed on the Task in the logs. */
1036
- name: import_zod9.z.string().optional(),
1175
+ name: import_zod11.z.string().optional(),
1037
1176
  /** The Task will wait and only start at the specified Date */
1038
- delayUntil: import_zod9.z.coerce.date().optional(),
1177
+ delayUntil: import_zod11.z.coerce.date().optional(),
1039
1178
  /** Retry options */
1040
1179
  retry: RetryOptionsSchema.optional(),
1041
1180
  /** The icon for the Task, it will appear in the logs.
1042
1181
  * You can use the name of a company in lowercase, e.g. "github".
1043
1182
  * Or any icon name that [Font Awesome](https://fontawesome.com/icons) supports. */
1044
- icon: import_zod9.z.string().optional(),
1183
+ icon: import_zod11.z.string().optional(),
1045
1184
  /** The key for the Task that you want to appear in the logs */
1046
- displayKey: import_zod9.z.string().optional(),
1185
+ displayKey: import_zod11.z.string().optional(),
1047
1186
  /** A description of the Task */
1048
- description: import_zod9.z.string().optional(),
1187
+ description: import_zod11.z.string().optional(),
1049
1188
  /** Properties that are displayed in the logs */
1050
- properties: import_zod9.z.array(DisplayPropertySchema).optional(),
1189
+ properties: import_zod11.z.array(DisplayPropertySchema).optional(),
1051
1190
  /** The input params to the Task, will be displayed in the logs */
1052
- params: import_zod9.z.any(),
1191
+ params: import_zod11.z.any(),
1053
1192
  /** The style of the log entry. */
1054
1193
  style: StyleSchema.optional(),
1055
1194
  /** Allows you to link the Integration connection in the logs. This is handled automatically in integrations. */
1056
- connectionKey: import_zod9.z.string().optional(),
1195
+ connectionKey: import_zod11.z.string().optional(),
1057
1196
  /** An operation you want to perform on the Trigger.dev platform, current only "fetch" is supported. If you wish to `fetch` use [`io.backgroundFetch()`](https://trigger.dev/docs/sdk/io/backgroundfetch) instead. */
1058
- operation: import_zod9.z.enum([
1197
+ operation: import_zod11.z.enum([
1059
1198
  "fetch"
1060
1199
  ]).optional(),
1061
1200
  /** A No Operation means that the code won't be executed. This is used internally to implement features like [io.wait()](https://trigger.dev/docs/sdk/io/wait). */
1062
- noop: import_zod9.z.boolean().default(false),
1201
+ noop: import_zod11.z.boolean().default(false),
1063
1202
  redact: RedactSchema.optional(),
1064
1203
  trigger: TriggerMetadataSchema.optional()
1065
1204
  });
1066
1205
  var RunTaskBodyInputSchema = RunTaskOptionsSchema.extend({
1067
- idempotencyKey: import_zod9.z.string(),
1068
- parentId: import_zod9.z.string().optional()
1206
+ idempotencyKey: import_zod11.z.string(),
1207
+ parentId: import_zod11.z.string().optional()
1069
1208
  });
1070
1209
  var RunTaskBodyOutputSchema = RunTaskBodyInputSchema.extend({
1071
1210
  params: DeserializedJsonSchema.optional().nullable()
@@ -1077,270 +1216,197 @@ var CompleteTaskBodyInputSchema = RunTaskBodyInputSchema.pick({
1077
1216
  }).extend({
1078
1217
  output: SerializableJsonSchema.optional().transform((v) => v ? DeserializedJsonSchema.parse(JSON.parse(JSON.stringify(v))) : {})
1079
1218
  });
1080
- var FailTaskBodyInputSchema = import_zod9.z.object({
1219
+ var FailTaskBodyInputSchema = import_zod11.z.object({
1081
1220
  error: ErrorWithStackSchema
1082
1221
  });
1083
- var NormalizedRequestSchema = import_zod9.z.object({
1084
- headers: import_zod9.z.record(import_zod9.z.string()),
1085
- method: import_zod9.z.string(),
1086
- query: import_zod9.z.record(import_zod9.z.string()),
1087
- url: import_zod9.z.string(),
1088
- body: import_zod9.z.any()
1222
+ var NormalizedRequestSchema = import_zod11.z.object({
1223
+ headers: import_zod11.z.record(import_zod11.z.string()),
1224
+ method: import_zod11.z.string(),
1225
+ query: import_zod11.z.record(import_zod11.z.string()),
1226
+ url: import_zod11.z.string(),
1227
+ body: import_zod11.z.any()
1089
1228
  });
1090
- var NormalizedResponseSchema = import_zod9.z.object({
1091
- status: import_zod9.z.number(),
1092
- body: import_zod9.z.any(),
1093
- headers: import_zod9.z.record(import_zod9.z.string()).optional()
1229
+ var NormalizedResponseSchema = import_zod11.z.object({
1230
+ status: import_zod11.z.number(),
1231
+ body: import_zod11.z.any(),
1232
+ headers: import_zod11.z.record(import_zod11.z.string()).optional()
1094
1233
  });
1095
- var HttpSourceResponseSchema = import_zod9.z.object({
1234
+ var HttpSourceResponseSchema = import_zod11.z.object({
1096
1235
  response: NormalizedResponseSchema,
1097
- events: import_zod9.z.array(RawEventSchema),
1236
+ events: import_zod11.z.array(RawEventSchema),
1098
1237
  metadata: HttpSourceResponseMetadataSchema.optional()
1099
1238
  });
1100
- var RegisterTriggerBodySchemaV1 = import_zod9.z.object({
1239
+ var RegisterTriggerBodySchemaV1 = import_zod11.z.object({
1101
1240
  rule: EventRuleSchema,
1102
1241
  source: SourceMetadataV1Schema
1103
1242
  });
1104
- var RegisterTriggerBodySchemaV2 = import_zod9.z.object({
1243
+ var RegisterTriggerBodySchemaV2 = import_zod11.z.object({
1105
1244
  rule: EventRuleSchema,
1106
- source: SourceMetadataV2Schema
1245
+ source: SourceMetadataV2Schema,
1246
+ accountId: import_zod11.z.string().optional()
1107
1247
  });
1108
- var InitializeTriggerBodySchema = import_zod9.z.object({
1109
- id: import_zod9.z.string(),
1110
- params: import_zod9.z.any(),
1111
- accountId: import_zod9.z.string().optional(),
1112
- metadata: import_zod9.z.any().optional()
1248
+ var InitializeTriggerBodySchema = import_zod11.z.object({
1249
+ id: import_zod11.z.string(),
1250
+ params: import_zod11.z.any(),
1251
+ accountId: import_zod11.z.string().optional(),
1252
+ metadata: import_zod11.z.any().optional()
1113
1253
  });
1114
- var RegisterCommonScheduleBodySchema = import_zod9.z.object({
1254
+ var RegisterCommonScheduleBodySchema = import_zod11.z.object({
1115
1255
  /** A unique id for the schedule. This is used to identify and unregister the schedule later. */
1116
- id: import_zod9.z.string(),
1256
+ id: import_zod11.z.string(),
1117
1257
  /** Any additional metadata about the schedule. */
1118
- metadata: import_zod9.z.any(),
1119
- /** This will be used by the Trigger.dev Connect feature, which is coming soon. */
1120
- accountId: import_zod9.z.string().optional()
1258
+ metadata: import_zod11.z.any(),
1259
+ /** An optional Account ID to associate with runs triggered by this schedule */
1260
+ accountId: import_zod11.z.string().optional()
1121
1261
  });
1122
1262
  var RegisterIntervalScheduleBodySchema = RegisterCommonScheduleBodySchema.merge(IntervalMetadataSchema);
1123
1263
  var InitializeCronScheduleBodySchema = RegisterCommonScheduleBodySchema.merge(CronMetadataSchema);
1124
- var RegisterScheduleBodySchema = import_zod9.z.discriminatedUnion("type", [
1264
+ var RegisterScheduleBodySchema = import_zod11.z.discriminatedUnion("type", [
1125
1265
  RegisterIntervalScheduleBodySchema,
1126
1266
  InitializeCronScheduleBodySchema
1127
1267
  ]);
1128
- var RegisterScheduleResponseBodySchema = import_zod9.z.object({
1129
- id: import_zod9.z.string(),
1268
+ var RegisterScheduleResponseBodySchema = import_zod11.z.object({
1269
+ id: import_zod11.z.string(),
1130
1270
  schedule: ScheduleMetadataSchema,
1131
- metadata: import_zod9.z.any(),
1132
- active: import_zod9.z.boolean()
1271
+ metadata: import_zod11.z.any(),
1272
+ active: import_zod11.z.boolean()
1133
1273
  });
1134
- var CreateExternalConnectionBodySchema = import_zod9.z.object({
1135
- accessToken: import_zod9.z.string(),
1136
- type: import_zod9.z.enum([
1274
+ var CreateExternalConnectionBodySchema = import_zod11.z.object({
1275
+ accessToken: import_zod11.z.string(),
1276
+ type: import_zod11.z.enum([
1137
1277
  "oauth2"
1138
1278
  ]),
1139
- scopes: import_zod9.z.array(import_zod9.z.string()).optional(),
1140
- metadata: import_zod9.z.any()
1279
+ scopes: import_zod11.z.array(import_zod11.z.string()).optional(),
1280
+ metadata: import_zod11.z.any()
1281
+ });
1282
+ var GetRunStatusesSchema = import_zod11.z.object({
1283
+ run: import_zod11.z.object({
1284
+ id: import_zod11.z.string(),
1285
+ status: RunStatusSchema,
1286
+ output: import_zod11.z.any().optional()
1287
+ }),
1288
+ statuses: import_zod11.z.array(JobRunStatusRecordSchema)
1141
1289
  });
1142
1290
 
1143
1291
  // src/schemas/notifications.ts
1144
- var import_zod10 = require("zod");
1292
+ var import_zod12 = require("zod");
1145
1293
  var MISSING_CONNECTION_NOTIFICATION = "dev.trigger.notifications.missingConnection";
1146
1294
  var MISSING_CONNECTION_RESOLVED_NOTIFICATION = "dev.trigger.notifications.missingConnectionResolved";
1147
- var CommonMissingConnectionNotificationPayloadSchema = import_zod10.z.object({
1148
- id: import_zod10.z.string(),
1149
- client: import_zod10.z.object({
1150
- id: import_zod10.z.string(),
1151
- title: import_zod10.z.string(),
1152
- scopes: import_zod10.z.array(import_zod10.z.string()),
1153
- createdAt: import_zod10.z.coerce.date(),
1154
- updatedAt: import_zod10.z.coerce.date()
1295
+ var CommonMissingConnectionNotificationPayloadSchema = import_zod12.z.object({
1296
+ id: import_zod12.z.string(),
1297
+ client: import_zod12.z.object({
1298
+ id: import_zod12.z.string(),
1299
+ title: import_zod12.z.string(),
1300
+ scopes: import_zod12.z.array(import_zod12.z.string()),
1301
+ createdAt: import_zod12.z.coerce.date(),
1302
+ updatedAt: import_zod12.z.coerce.date()
1155
1303
  }),
1156
- authorizationUrl: import_zod10.z.string()
1304
+ authorizationUrl: import_zod12.z.string()
1157
1305
  });
1158
1306
  var MissingDeveloperConnectionNotificationPayloadSchema = CommonMissingConnectionNotificationPayloadSchema.extend({
1159
- type: import_zod10.z.literal("DEVELOPER")
1307
+ type: import_zod12.z.literal("DEVELOPER")
1160
1308
  });
1161
1309
  var MissingExternalConnectionNotificationPayloadSchema = CommonMissingConnectionNotificationPayloadSchema.extend({
1162
- type: import_zod10.z.literal("EXTERNAL"),
1163
- account: import_zod10.z.object({
1164
- id: import_zod10.z.string(),
1165
- metadata: import_zod10.z.any()
1310
+ type: import_zod12.z.literal("EXTERNAL"),
1311
+ account: import_zod12.z.object({
1312
+ id: import_zod12.z.string(),
1313
+ metadata: import_zod12.z.any()
1166
1314
  })
1167
1315
  });
1168
- var MissingConnectionNotificationPayloadSchema = import_zod10.z.discriminatedUnion("type", [
1316
+ var MissingConnectionNotificationPayloadSchema = import_zod12.z.discriminatedUnion("type", [
1169
1317
  MissingDeveloperConnectionNotificationPayloadSchema,
1170
1318
  MissingExternalConnectionNotificationPayloadSchema
1171
1319
  ]);
1172
- var CommonMissingConnectionNotificationResolvedPayloadSchema = import_zod10.z.object({
1173
- id: import_zod10.z.string(),
1174
- client: import_zod10.z.object({
1175
- id: import_zod10.z.string(),
1176
- title: import_zod10.z.string(),
1177
- scopes: import_zod10.z.array(import_zod10.z.string()),
1178
- createdAt: import_zod10.z.coerce.date(),
1179
- updatedAt: import_zod10.z.coerce.date(),
1180
- integrationIdentifier: import_zod10.z.string(),
1181
- integrationAuthMethod: import_zod10.z.string()
1320
+ var CommonMissingConnectionNotificationResolvedPayloadSchema = import_zod12.z.object({
1321
+ id: import_zod12.z.string(),
1322
+ client: import_zod12.z.object({
1323
+ id: import_zod12.z.string(),
1324
+ title: import_zod12.z.string(),
1325
+ scopes: import_zod12.z.array(import_zod12.z.string()),
1326
+ createdAt: import_zod12.z.coerce.date(),
1327
+ updatedAt: import_zod12.z.coerce.date(),
1328
+ integrationIdentifier: import_zod12.z.string(),
1329
+ integrationAuthMethod: import_zod12.z.string()
1182
1330
  }),
1183
- expiresAt: import_zod10.z.coerce.date()
1331
+ expiresAt: import_zod12.z.coerce.date()
1184
1332
  });
1185
1333
  var MissingDeveloperConnectionResolvedNotificationPayloadSchema = CommonMissingConnectionNotificationResolvedPayloadSchema.extend({
1186
- type: import_zod10.z.literal("DEVELOPER")
1334
+ type: import_zod12.z.literal("DEVELOPER")
1187
1335
  });
1188
1336
  var MissingExternalConnectionResolvedNotificationPayloadSchema = CommonMissingConnectionNotificationResolvedPayloadSchema.extend({
1189
- type: import_zod10.z.literal("EXTERNAL"),
1190
- account: import_zod10.z.object({
1191
- id: import_zod10.z.string(),
1192
- metadata: import_zod10.z.any()
1337
+ type: import_zod12.z.literal("EXTERNAL"),
1338
+ account: import_zod12.z.object({
1339
+ id: import_zod12.z.string(),
1340
+ metadata: import_zod12.z.any()
1193
1341
  })
1194
1342
  });
1195
- var MissingConnectionResolvedNotificationPayloadSchema = import_zod10.z.discriminatedUnion("type", [
1343
+ var MissingConnectionResolvedNotificationPayloadSchema = import_zod12.z.discriminatedUnion("type", [
1196
1344
  MissingDeveloperConnectionResolvedNotificationPayloadSchema,
1197
1345
  MissingExternalConnectionResolvedNotificationPayloadSchema
1198
1346
  ]);
1199
1347
 
1200
1348
  // src/schemas/fetch.ts
1201
- var import_zod11 = require("zod");
1202
- var FetchRetryHeadersStrategySchema = import_zod11.z.object({
1349
+ var import_zod13 = require("zod");
1350
+ var FetchRetryHeadersStrategySchema = import_zod13.z.object({
1203
1351
  /** The `headers` strategy retries the request using info from the response headers. */
1204
- strategy: import_zod11.z.literal("headers"),
1352
+ strategy: import_zod13.z.literal("headers"),
1205
1353
  /** The header to use to determine the maximum number of times to retry the request. */
1206
- limitHeader: import_zod11.z.string(),
1354
+ limitHeader: import_zod13.z.string(),
1207
1355
  /** The header to use to determine the number of remaining retries. */
1208
- remainingHeader: import_zod11.z.string(),
1356
+ remainingHeader: import_zod13.z.string(),
1209
1357
  /** The header to use to determine the time when the number of remaining retries will be reset. */
1210
- resetHeader: import_zod11.z.string()
1358
+ resetHeader: import_zod13.z.string()
1211
1359
  });
1212
1360
  var FetchRetryBackoffStrategySchema = RetryOptionsSchema.extend({
1213
1361
  /** The `backoff` strategy retries the request with an exponential backoff. */
1214
- strategy: import_zod11.z.literal("backoff")
1362
+ strategy: import_zod13.z.literal("backoff")
1215
1363
  });
1216
- var FetchRetryStrategySchema = import_zod11.z.discriminatedUnion("strategy", [
1364
+ var FetchRetryStrategySchema = import_zod13.z.discriminatedUnion("strategy", [
1217
1365
  FetchRetryHeadersStrategySchema,
1218
1366
  FetchRetryBackoffStrategySchema
1219
1367
  ]);
1220
- var FetchRequestInitSchema = import_zod11.z.object({
1368
+ var FetchRequestInitSchema = import_zod13.z.object({
1221
1369
  /** The HTTP method to use for the request. */
1222
- method: import_zod11.z.string().optional(),
1370
+ method: import_zod13.z.string().optional(),
1223
1371
  /** Any headers to send with the request. Note that you can use [redactString](https://trigger.dev/docs/sdk/redactString) to prevent sensitive information from being stored (e.g. in the logs), like API keys and tokens. */
1224
- headers: import_zod11.z.record(import_zod11.z.union([
1225
- import_zod11.z.string(),
1372
+ headers: import_zod13.z.record(import_zod13.z.union([
1373
+ import_zod13.z.string(),
1226
1374
  RedactStringSchema
1227
1375
  ])).optional(),
1228
1376
  /** The body of the request. */
1229
- body: import_zod11.z.union([
1230
- import_zod11.z.string(),
1231
- import_zod11.z.instanceof(ArrayBuffer)
1377
+ body: import_zod13.z.union([
1378
+ import_zod13.z.string(),
1379
+ import_zod13.z.instanceof(ArrayBuffer)
1232
1380
  ]).optional()
1233
1381
  });
1234
- var FetchRetryOptionsSchema = import_zod11.z.record(FetchRetryStrategySchema);
1235
- var FetchOperationSchema = import_zod11.z.object({
1236
- url: import_zod11.z.string(),
1382
+ var FetchRetryOptionsSchema = import_zod13.z.record(FetchRetryStrategySchema);
1383
+ var FetchOperationSchema = import_zod13.z.object({
1384
+ url: import_zod13.z.string(),
1237
1385
  requestInit: FetchRequestInitSchema.optional(),
1238
- retry: import_zod11.z.record(FetchRetryStrategySchema).optional()
1239
- });
1240
-
1241
- // src/schemas/events.ts
1242
- var import_zod13 = require("zod");
1243
-
1244
- // src/schemas/runs.ts
1245
- var import_zod12 = require("zod");
1246
- var RunStatusSchema = import_zod12.z.union([
1247
- import_zod12.z.literal("PENDING"),
1248
- import_zod12.z.literal("QUEUED"),
1249
- import_zod12.z.literal("WAITING_ON_CONNECTIONS"),
1250
- import_zod12.z.literal("PREPROCESSING"),
1251
- import_zod12.z.literal("STARTED"),
1252
- import_zod12.z.literal("SUCCESS"),
1253
- import_zod12.z.literal("FAILURE"),
1254
- import_zod12.z.literal("TIMED_OUT"),
1255
- import_zod12.z.literal("ABORTED"),
1256
- import_zod12.z.literal("CANCELED")
1257
- ]);
1258
- var RunTaskSchema = import_zod12.z.object({
1259
- /** The Task id */
1260
- id: import_zod12.z.string(),
1261
- /** The key that you defined when creating the Task, the first param in any task. */
1262
- displayKey: import_zod12.z.string().nullable(),
1263
- /** The Task status */
1264
- status: TaskStatusSchema,
1265
- /** The name of the Task */
1266
- name: import_zod12.z.string(),
1267
- /** The icon of the Task, a string.
1268
- * For integrations, this will be a lowercase name of the company.
1269
- * Can be used with the [@trigger.dev/companyicons](https://www.npmjs.com/package/@trigger.dev/companyicons) package to display an svg. */
1270
- icon: import_zod12.z.string().nullable(),
1271
- /** When the task started */
1272
- startedAt: import_zod12.z.coerce.date().nullable(),
1273
- /** When the task completed */
1274
- completedAt: import_zod12.z.coerce.date().nullable()
1275
- });
1276
- var RunTaskWithSubtasksSchema = RunTaskSchema.extend({
1277
- subtasks: import_zod12.z.lazy(() => RunTaskWithSubtasksSchema.array()).optional()
1278
- });
1279
- var GetRunOptionsSchema = import_zod12.z.object({
1280
- /** Return subtasks, which appear in a `subtasks` array on a task. @default false */
1281
- subtasks: import_zod12.z.boolean().optional(),
1282
- /** You can use this to get more tasks, if there are more than are returned in a single batch @default undefined */
1283
- cursor: import_zod12.z.string().optional(),
1284
- /** How many tasks you want to return in one go, max 50. @default 20 */
1285
- take: import_zod12.z.number().optional()
1286
- });
1287
- var GetRunOptionsWithTaskDetailsSchema = GetRunOptionsSchema.extend({
1288
- /** If `true`, it returns the `params` and `output` of all tasks. @default false */
1289
- taskdetails: import_zod12.z.boolean().optional()
1290
- });
1291
- var RunSchema = import_zod12.z.object({
1292
- /** The Run id */
1293
- id: import_zod12.z.string(),
1294
- /** The Run status */
1295
- status: RunStatusSchema,
1296
- /** When the run started */
1297
- startedAt: import_zod12.z.coerce.date().nullable(),
1298
- /** When the run was last updated */
1299
- updatedAt: import_zod12.z.coerce.date().nullable(),
1300
- /** When the run was completed */
1301
- completedAt: import_zod12.z.coerce.date().nullable()
1302
- });
1303
- var GetRunSchema = RunSchema.extend({
1304
- /** The output of the run */
1305
- output: import_zod12.z.any().optional(),
1306
- /** The tasks from the run */
1307
- tasks: import_zod12.z.array(RunTaskWithSubtasksSchema),
1308
- /** If there are more tasks, you can use this to get them */
1309
- nextCursor: import_zod12.z.string().optional()
1310
- });
1311
- var GetRunsOptionsSchema = import_zod12.z.object({
1312
- /** You can use this to get more tasks, if there are more than are returned in a single batch @default undefined */
1313
- cursor: import_zod12.z.string().optional(),
1314
- /** How many runs you want to return in one go, max 50. @default 20 */
1315
- take: import_zod12.z.number().optional()
1316
- });
1317
- var GetRunsSchema = import_zod12.z.object({
1318
- /** The runs from the query */
1319
- runs: RunSchema.array(),
1320
- /** If there are more runs, you can use this to get them */
1321
- nextCursor: import_zod12.z.string().optional()
1386
+ retry: import_zod13.z.record(FetchRetryStrategySchema).optional()
1322
1387
  });
1323
1388
 
1324
1389
  // src/schemas/events.ts
1325
- var GetEventSchema = import_zod13.z.object({
1390
+ var import_zod14 = require("zod");
1391
+ var GetEventSchema = import_zod14.z.object({
1326
1392
  /** The event id */
1327
- id: import_zod13.z.string(),
1393
+ id: import_zod14.z.string(),
1328
1394
  /** The event name */
1329
- name: import_zod13.z.string(),
1395
+ name: import_zod14.z.string(),
1330
1396
  /** When the event was created */
1331
- createdAt: import_zod13.z.coerce.date(),
1397
+ createdAt: import_zod14.z.coerce.date(),
1332
1398
  /** When the event was last updated */
1333
- updatedAt: import_zod13.z.coerce.date(),
1399
+ updatedAt: import_zod14.z.coerce.date(),
1334
1400
  /** The runs that were triggered by the event */
1335
- runs: import_zod13.z.array(import_zod13.z.object({
1401
+ runs: import_zod14.z.array(import_zod14.z.object({
1336
1402
  /** The Run id */
1337
- id: import_zod13.z.string(),
1403
+ id: import_zod14.z.string(),
1338
1404
  /** The Run status */
1339
1405
  status: RunStatusSchema,
1340
1406
  /** When the run started */
1341
- startedAt: import_zod13.z.coerce.date().optional().nullable(),
1407
+ startedAt: import_zod14.z.coerce.date().optional().nullable(),
1342
1408
  /** When the run completed */
1343
- completedAt: import_zod13.z.coerce.date().optional().nullable()
1409
+ completedAt: import_zod14.z.coerce.date().optional().nullable()
1344
1410
  }))
1345
1411
  });
1346
1412