@trigger.dev/core 0.0.0-isomorphic-sdk-20230918150523 → 0.0.0-prerelease-20230922185725

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