@trigger.dev/core 0.0.0-background-tasks-20230906212613 → 0.0.0-buffer-import-20231031135043

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
@@ -43,9 +43,11 @@ var __privateMethod = (obj, member, method) => {
43
43
  // src/index.ts
44
44
  var src_exports = {};
45
45
  __export(src_exports, {
46
+ API_VERSIONS: () => API_VERSIONS,
46
47
  ApiEventLogSchema: () => ApiEventLogSchema,
47
- BackgroundTaskMetadataSchema: () => BackgroundTaskMetadataSchema,
48
+ AutoYieldConfigSchema: () => AutoYieldConfigSchema,
48
49
  CachedTaskSchema: () => CachedTaskSchema,
50
+ CancelRunsForEventSchema: () => CancelRunsForEventSchema,
49
51
  CommonMissingConnectionNotificationPayloadSchema: () => CommonMissingConnectionNotificationPayloadSchema,
50
52
  CommonMissingConnectionNotificationResolvedPayloadSchema: () => CommonMissingConnectionNotificationResolvedPayloadSchema,
51
53
  CompleteTaskBodyInputSchema: () => CompleteTaskBodyInputSchema,
@@ -55,12 +57,13 @@ __export(src_exports, {
55
57
  CronMetadataSchema: () => CronMetadataSchema,
56
58
  CronOptionsSchema: () => CronOptionsSchema,
57
59
  DeliverEventResponseSchema: () => DeliverEventResponseSchema,
58
- DeployBackgroundTaskRequestBodySchema: () => DeployBackgroundTaskRequestBodySchema,
59
60
  DeserializedJsonSchema: () => DeserializedJsonSchema,
60
61
  DisplayPropertiesSchema: () => DisplayPropertiesSchema,
61
62
  DisplayPropertySchema: () => DisplayPropertySchema,
62
63
  DynamicTriggerEndpointMetadataSchema: () => DynamicTriggerEndpointMetadataSchema,
63
64
  DynamicTriggerMetadataSchema: () => DynamicTriggerMetadataSchema,
65
+ EndpointHeadersSchema: () => EndpointHeadersSchema,
66
+ EndpointIndexErrorSchema: () => EndpointIndexErrorSchema,
64
67
  ErrorWithStackSchema: () => ErrorWithStackSchema,
65
68
  EventExampleSchema: () => EventExampleSchema,
66
69
  EventFilterSchema: () => EventFilterSchema,
@@ -73,8 +76,10 @@ __export(src_exports, {
73
76
  FetchRetryHeadersStrategySchema: () => FetchRetryHeadersStrategySchema,
74
77
  FetchRetryOptionsSchema: () => FetchRetryOptionsSchema,
75
78
  FetchRetryStrategySchema: () => FetchRetryStrategySchema,
79
+ GetEndpointIndexResponseSchema: () => GetEndpointIndexResponseSchema,
76
80
  GetEventSchema: () => GetEventSchema,
77
81
  GetRunSchema: () => GetRunSchema,
82
+ GetRunStatusesSchema: () => GetRunStatusesSchema,
78
83
  GetRunsSchema: () => GetRunsSchema,
79
84
  HandleTriggerSourceSchema: () => HandleTriggerSourceSchema,
80
85
  HttpSourceRequestHeadersSchema: () => HttpSourceRequestHeadersSchema,
@@ -88,6 +93,7 @@ __export(src_exports, {
88
93
  IntervalMetadataSchema: () => IntervalMetadataSchema,
89
94
  IntervalOptionsSchema: () => IntervalOptionsSchema,
90
95
  JobMetadataSchema: () => JobMetadataSchema,
96
+ JobRunStatusRecordSchema: () => JobRunStatusRecordSchema,
91
97
  LogMessageSchema: () => LogMessageSchema,
92
98
  Logger: () => Logger,
93
99
  MISSING_CONNECTION_NOTIFICATION: () => MISSING_CONNECTION_NOTIFICATION,
@@ -100,6 +106,7 @@ __export(src_exports, {
100
106
  MissingExternalConnectionResolvedNotificationPayloadSchema: () => MissingExternalConnectionResolvedNotificationPayloadSchema,
101
107
  NormalizedRequestSchema: () => NormalizedRequestSchema,
102
108
  NormalizedResponseSchema: () => NormalizedResponseSchema,
109
+ PLATFORM_FEATURES: () => PLATFORM_FEATURES,
103
110
  PongErrorResponseSchema: () => PongErrorResponseSchema,
104
111
  PongResponseSchema: () => PongResponseSchema,
105
112
  PongSuccessResponseSchema: () => PongSuccessResponseSchema,
@@ -125,30 +132,40 @@ __export(src_exports, {
125
132
  RegisterTriggerBodySchemaV2: () => RegisterTriggerBodySchemaV2,
126
133
  RegisterTriggerSourceSchema: () => RegisterTriggerSourceSchema,
127
134
  RetryOptionsSchema: () => RetryOptionsSchema,
135
+ RunJobAutoYieldExecutionErrorSchema: () => RunJobAutoYieldExecutionErrorSchema,
136
+ RunJobAutoYieldWithCompletedTaskExecutionErrorSchema: () => RunJobAutoYieldWithCompletedTaskExecutionErrorSchema,
128
137
  RunJobBodySchema: () => RunJobBodySchema,
129
138
  RunJobCanceledWithTaskSchema: () => RunJobCanceledWithTaskSchema,
130
139
  RunJobErrorSchema: () => RunJobErrorSchema,
140
+ RunJobInvalidPayloadErrorSchema: () => RunJobInvalidPayloadErrorSchema,
131
141
  RunJobResponseSchema: () => RunJobResponseSchema,
132
142
  RunJobResumeWithTaskSchema: () => RunJobResumeWithTaskSchema,
133
143
  RunJobRetryWithTaskSchema: () => RunJobRetryWithTaskSchema,
134
144
  RunJobSuccessSchema: () => RunJobSuccessSchema,
145
+ RunJobUnresolvedAuthErrorSchema: () => RunJobUnresolvedAuthErrorSchema,
146
+ RunJobYieldExecutionErrorSchema: () => RunJobYieldExecutionErrorSchema,
135
147
  RunSourceContextSchema: () => RunSourceContextSchema,
136
148
  RunStatusSchema: () => RunStatusSchema,
137
149
  RunTaskBodyInputSchema: () => RunTaskBodyInputSchema,
138
150
  RunTaskBodyOutputSchema: () => RunTaskBodyOutputSchema,
139
151
  RunTaskOptionsSchema: () => RunTaskOptionsSchema,
152
+ RunTaskResponseWithCachedTasksBodySchema: () => RunTaskResponseWithCachedTasksBodySchema,
140
153
  RunTaskSchema: () => RunTaskSchema,
141
154
  RuntimeEnvironmentTypeSchema: () => RuntimeEnvironmentTypeSchema,
142
155
  SCHEDULED_EVENT: () => SCHEDULED_EVENT,
143
156
  ScheduleMetadataSchema: () => ScheduleMetadataSchema,
144
157
  ScheduledPayloadSchema: () => ScheduledPayloadSchema,
145
158
  ScheduledTriggerMetadataSchema: () => ScheduledTriggerMetadataSchema,
159
+ SchemaErrorSchema: () => SchemaErrorSchema,
146
160
  SendEventBodySchema: () => SendEventBodySchema,
147
161
  SendEventOptionsSchema: () => SendEventOptionsSchema,
148
162
  SerializableJsonSchema: () => SerializableJsonSchema,
149
163
  ServerTaskSchema: () => ServerTaskSchema,
150
164
  SourceMetadataV2Schema: () => SourceMetadataV2Schema,
151
165
  StaticTriggerMetadataSchema: () => StaticTriggerMetadataSchema,
166
+ StatusHistorySchema: () => StatusHistorySchema,
167
+ StatusUpdateSchema: () => StatusUpdateSchema,
168
+ StatusUpdateStateSchema: () => StatusUpdateStateSchema,
152
169
  StyleSchema: () => StyleSchema,
153
170
  TaskSchema: () => TaskSchema,
154
171
  TaskStatusSchema: () => TaskStatusSchema,
@@ -166,7 +183,9 @@ __export(src_exports, {
166
183
  currentTimestampSeconds: () => currentTimestampSeconds,
167
184
  deepMergeFilters: () => deepMergeFilters,
168
185
  eventFilterMatches: () => eventFilterMatches,
186
+ parseEndpointIndexStats: () => parseEndpointIndexStats,
169
187
  replacements: () => replacements,
188
+ supportsFeature: () => supportsFeature,
170
189
  urlWithSearchParams: () => urlWithSearchParams
171
190
  });
172
191
  module.exports = __toCommonJS(src_exports);
@@ -321,7 +340,7 @@ __name(prettyPrintBytes, "prettyPrintBytes");
321
340
 
322
341
  // src/schemas/api.ts
323
342
  var import_ulid = require("ulid");
324
- var import_zod9 = require("zod");
343
+ var import_zod11 = require("zod");
325
344
 
326
345
  // src/schemas/addMissingVersionField.ts
327
346
  function addMissingVersionField(val) {
@@ -342,6 +361,10 @@ var ErrorWithStackSchema = import_zod.z.object({
342
361
  name: import_zod.z.string().optional(),
343
362
  stack: import_zod.z.string().optional()
344
363
  });
364
+ var SchemaErrorSchema = import_zod.z.object({
365
+ path: import_zod.z.array(import_zod.z.string()),
366
+ message: import_zod.z.string()
367
+ });
345
368
 
346
369
  // src/schemas/eventFilter.ts
347
370
  var import_zod2 = require("zod");
@@ -424,7 +447,8 @@ var EventRuleSchema = import_zod2.z.object({
424
447
  var import_zod3 = require("zod");
425
448
  var ConnectionAuthSchema = import_zod3.z.object({
426
449
  type: import_zod3.z.enum([
427
- "oauth2"
450
+ "oauth2",
451
+ "apiKey"
428
452
  ]),
429
453
  accessToken: import_zod3.z.string(),
430
454
  scopes: import_zod3.z.array(import_zod3.z.string()).optional(),
@@ -440,7 +464,8 @@ var IntegrationConfigSchema = import_zod3.z.object({
440
464
  metadata: IntegrationMetadataSchema,
441
465
  authSource: import_zod3.z.enum([
442
466
  "HOSTED",
443
- "LOCAL"
467
+ "LOCAL",
468
+ "RESOLVER"
444
469
  ])
445
470
  });
446
471
 
@@ -501,8 +526,8 @@ var ScheduledPayloadSchema = import_zod6.z.object({
501
526
  lastTimestamp: import_zod6.z.coerce.date().optional()
502
527
  });
503
528
  var IntervalOptionsSchema = import_zod6.z.object({
504
- /** The number of seconds for the interval. Min = 60, Max = 86400 (1 day) */
505
- seconds: import_zod6.z.number().int().positive().min(60).max(86400)
529
+ /** The number of seconds for the interval. Min = 60, Max = 2_592_000 (30 days) */
530
+ seconds: import_zod6.z.number().int().positive().min(60).max(2592e3)
506
531
  });
507
532
  var CronOptionsSchema = import_zod6.z.object({
508
533
  /** A CRON expression that defines the schedule. A useful tool when writing CRON
@@ -513,6 +538,8 @@ var CronOptionsSchema = import_zod6.z.object({
513
538
  var CronMetadataSchema = import_zod6.z.object({
514
539
  type: import_zod6.z.literal("cron"),
515
540
  options: CronOptionsSchema,
541
+ /** An optional Account ID to associate with runs triggered by this interval */
542
+ accountId: import_zod6.z.string().optional(),
516
543
  metadata: import_zod6.z.any()
517
544
  });
518
545
  var IntervalMetadataSchema = import_zod6.z.object({
@@ -520,6 +547,8 @@ var IntervalMetadataSchema = import_zod6.z.object({
520
547
  type: import_zod6.z.literal("interval"),
521
548
  /** An object containing options about the interval. */
522
549
  options: IntervalOptionsSchema,
550
+ /** An optional Account ID to associate with runs triggered by this interval */
551
+ accountId: import_zod6.z.string().optional(),
523
552
  /** Any additional metadata about the schedule. */
524
553
  metadata: import_zod6.z.any()
525
554
  });
@@ -562,11 +591,13 @@ var TaskSchema = import_zod7.z.object({
562
591
  error: import_zod7.z.string().optional().nullable(),
563
592
  parentId: import_zod7.z.string().optional().nullable(),
564
593
  style: StyleSchema.optional().nullable(),
565
- operation: import_zod7.z.string().optional().nullable()
594
+ operation: import_zod7.z.string().optional().nullable(),
595
+ callbackUrl: import_zod7.z.string().optional().nullable()
566
596
  });
567
597
  var ServerTaskSchema = TaskSchema.extend({
568
598
  idempotencyKey: import_zod7.z.string(),
569
- attempts: import_zod7.z.number()
599
+ attempts: import_zod7.z.number(),
600
+ forceYield: import_zod7.z.boolean().optional().nullable()
570
601
  });
571
602
  var CachedTaskSchema = import_zod7.z.object({
572
603
  id: import_zod7.z.string(),
@@ -618,470 +649,684 @@ var TriggerMetadataSchema = import_zod8.z.discriminatedUnion("type", [
618
649
  ScheduledTriggerMetadataSchema
619
650
  ]);
620
651
 
652
+ // src/schemas/runs.ts
653
+ var import_zod10 = require("zod");
654
+
655
+ // src/schemas/statuses.ts
656
+ var import_zod9 = require("zod");
657
+ var StatusUpdateStateSchema = import_zod9.z.union([
658
+ import_zod9.z.literal("loading"),
659
+ import_zod9.z.literal("success"),
660
+ import_zod9.z.literal("failure")
661
+ ]);
662
+ var StatusUpdateDataSchema = import_zod9.z.record(SerializableJsonSchema);
663
+ var StatusUpdateSchema = import_zod9.z.object({
664
+ label: import_zod9.z.string().optional(),
665
+ state: StatusUpdateStateSchema.optional(),
666
+ data: StatusUpdateDataSchema.optional()
667
+ });
668
+ var InitalStatusUpdateSchema = StatusUpdateSchema.required({
669
+ label: true
670
+ });
671
+ var StatusHistorySchema = import_zod9.z.array(StatusUpdateSchema);
672
+ var JobRunStatusRecordSchema = InitalStatusUpdateSchema.extend({
673
+ key: import_zod9.z.string(),
674
+ history: StatusHistorySchema
675
+ });
676
+
677
+ // src/schemas/runs.ts
678
+ var RunStatusSchema = import_zod10.z.union([
679
+ import_zod10.z.literal("PENDING"),
680
+ import_zod10.z.literal("QUEUED"),
681
+ import_zod10.z.literal("WAITING_ON_CONNECTIONS"),
682
+ import_zod10.z.literal("PREPROCESSING"),
683
+ import_zod10.z.literal("STARTED"),
684
+ import_zod10.z.literal("SUCCESS"),
685
+ import_zod10.z.literal("FAILURE"),
686
+ import_zod10.z.literal("TIMED_OUT"),
687
+ import_zod10.z.literal("ABORTED"),
688
+ import_zod10.z.literal("CANCELED"),
689
+ import_zod10.z.literal("UNRESOLVED_AUTH"),
690
+ import_zod10.z.literal("INVALID_PAYLOAD")
691
+ ]);
692
+ var RunTaskSchema = import_zod10.z.object({
693
+ /** The Task id */
694
+ id: import_zod10.z.string(),
695
+ /** The key that you defined when creating the Task, the first param in any task. */
696
+ displayKey: import_zod10.z.string().nullable(),
697
+ /** The Task status */
698
+ status: TaskStatusSchema,
699
+ /** The name of the Task */
700
+ name: import_zod10.z.string(),
701
+ /** The icon of the Task, a string.
702
+ * For integrations, this will be a lowercase name of the company.
703
+ * Can be used with the [@trigger.dev/companyicons](https://www.npmjs.com/package/@trigger.dev/companyicons) package to display an svg. */
704
+ icon: import_zod10.z.string().nullable(),
705
+ /** When the task started */
706
+ startedAt: import_zod10.z.coerce.date().nullable(),
707
+ /** When the task completed */
708
+ completedAt: import_zod10.z.coerce.date().nullable()
709
+ });
710
+ var RunTaskWithSubtasksSchema = RunTaskSchema.extend({
711
+ subtasks: import_zod10.z.lazy(() => RunTaskWithSubtasksSchema.array()).optional()
712
+ });
713
+ var GetRunOptionsSchema = import_zod10.z.object({
714
+ /** Return subtasks, which appear in a `subtasks` array on a task. @default false */
715
+ subtasks: import_zod10.z.boolean().optional(),
716
+ /** You can use this to get more tasks, if there are more than are returned in a single batch @default undefined */
717
+ cursor: import_zod10.z.string().optional(),
718
+ /** How many tasks you want to return in one go, max 50. @default 20 */
719
+ take: import_zod10.z.number().optional()
720
+ });
721
+ var GetRunOptionsWithTaskDetailsSchema = GetRunOptionsSchema.extend({
722
+ /** If `true`, it returns the `params` and `output` of all tasks. @default false */
723
+ taskdetails: import_zod10.z.boolean().optional()
724
+ });
725
+ var RunSchema = import_zod10.z.object({
726
+ /** The Run id */
727
+ id: import_zod10.z.string(),
728
+ /** The Run status */
729
+ status: RunStatusSchema,
730
+ /** When the run started */
731
+ startedAt: import_zod10.z.coerce.date().nullable(),
732
+ /** When the run was last updated */
733
+ updatedAt: import_zod10.z.coerce.date().nullable(),
734
+ /** When the run was completed */
735
+ completedAt: import_zod10.z.coerce.date().nullable()
736
+ });
737
+ var GetRunSchema = RunSchema.extend({
738
+ /** The output of the run */
739
+ output: import_zod10.z.any().optional(),
740
+ /** The tasks from the run */
741
+ tasks: import_zod10.z.array(RunTaskWithSubtasksSchema),
742
+ /** Any status updates that were published from the run */
743
+ statuses: import_zod10.z.array(JobRunStatusRecordSchema).default([]),
744
+ /** If there are more tasks, you can use this to get them */
745
+ nextCursor: import_zod10.z.string().optional()
746
+ });
747
+ var GetRunsOptionsSchema = import_zod10.z.object({
748
+ /** You can use this to get more tasks, if there are more than are returned in a single batch @default undefined */
749
+ cursor: import_zod10.z.string().optional(),
750
+ /** How many runs you want to return in one go, max 50. @default 20 */
751
+ take: import_zod10.z.number().optional()
752
+ });
753
+ var GetRunsSchema = import_zod10.z.object({
754
+ /** The runs from the query */
755
+ runs: RunSchema.array(),
756
+ /** If there are more runs, you can use this to get them */
757
+ nextCursor: import_zod10.z.string().optional()
758
+ });
759
+
621
760
  // src/schemas/api.ts
622
- var UpdateTriggerSourceBodyV1Schema = import_zod9.z.object({
623
- registeredEvents: import_zod9.z.array(import_zod9.z.string()),
624
- secret: import_zod9.z.string().optional(),
761
+ var UpdateTriggerSourceBodyV1Schema = import_zod11.z.object({
762
+ registeredEvents: import_zod11.z.array(import_zod11.z.string()),
763
+ secret: import_zod11.z.string().optional(),
625
764
  data: SerializableJsonSchema.optional()
626
765
  });
627
- var UpdateTriggerSourceBodyV2Schema = import_zod9.z.object({
628
- secret: import_zod9.z.string().optional(),
766
+ var UpdateTriggerSourceBodyV2Schema = import_zod11.z.object({
767
+ secret: import_zod11.z.string().optional(),
629
768
  data: SerializableJsonSchema.optional(),
630
- options: import_zod9.z.object({
631
- event: import_zod9.z.array(import_zod9.z.string())
632
- }).and(import_zod9.z.record(import_zod9.z.string(), import_zod9.z.array(import_zod9.z.string())).optional())
769
+ options: import_zod11.z.object({
770
+ event: import_zod11.z.array(import_zod11.z.string())
771
+ }).and(import_zod11.z.record(import_zod11.z.string(), import_zod11.z.array(import_zod11.z.string())).optional())
633
772
  });
634
- var RegisterHTTPTriggerSourceBodySchema = import_zod9.z.object({
635
- type: import_zod9.z.literal("HTTP"),
636
- url: import_zod9.z.string().url()
773
+ var RegisterHTTPTriggerSourceBodySchema = import_zod11.z.object({
774
+ type: import_zod11.z.literal("HTTP"),
775
+ url: import_zod11.z.string().url()
637
776
  });
638
- var RegisterSMTPTriggerSourceBodySchema = import_zod9.z.object({
639
- type: import_zod9.z.literal("SMTP")
777
+ var RegisterSMTPTriggerSourceBodySchema = import_zod11.z.object({
778
+ type: import_zod11.z.literal("SMTP")
640
779
  });
641
- var RegisterSQSTriggerSourceBodySchema = import_zod9.z.object({
642
- type: import_zod9.z.literal("SQS")
780
+ var RegisterSQSTriggerSourceBodySchema = import_zod11.z.object({
781
+ type: import_zod11.z.literal("SQS")
643
782
  });
644
- var RegisterSourceChannelBodySchema = import_zod9.z.discriminatedUnion("type", [
783
+ var RegisterSourceChannelBodySchema = import_zod11.z.discriminatedUnion("type", [
645
784
  RegisterHTTPTriggerSourceBodySchema,
646
785
  RegisterSMTPTriggerSourceBodySchema,
647
786
  RegisterSQSTriggerSourceBodySchema
648
787
  ]);
649
788
  var REGISTER_SOURCE_EVENT_V1 = "dev.trigger.source.register";
650
789
  var REGISTER_SOURCE_EVENT_V2 = "dev.trigger.source.register.v2";
651
- var RegisterTriggerSourceSchema = import_zod9.z.object({
652
- key: import_zod9.z.string(),
653
- params: import_zod9.z.any(),
654
- active: import_zod9.z.boolean(),
655
- secret: import_zod9.z.string(),
790
+ var RegisterTriggerSourceSchema = import_zod11.z.object({
791
+ key: import_zod11.z.string(),
792
+ params: import_zod11.z.any(),
793
+ active: import_zod11.z.boolean(),
794
+ secret: import_zod11.z.string(),
656
795
  data: DeserializedJsonSchema.optional(),
657
796
  channel: RegisterSourceChannelBodySchema,
658
- clientId: import_zod9.z.string().optional()
797
+ clientId: import_zod11.z.string().optional()
659
798
  });
660
- var SourceEventOptionSchema = import_zod9.z.object({
661
- name: import_zod9.z.string(),
662
- value: import_zod9.z.string()
799
+ var SourceEventOptionSchema = import_zod11.z.object({
800
+ name: import_zod11.z.string(),
801
+ value: import_zod11.z.string()
663
802
  });
664
- var RegisterSourceEventSchemaV1 = import_zod9.z.object({
803
+ var RegisterSourceEventSchemaV1 = import_zod11.z.object({
665
804
  /** The id of the source */
666
- id: import_zod9.z.string(),
805
+ id: import_zod11.z.string(),
667
806
  source: RegisterTriggerSourceSchema,
668
- events: import_zod9.z.array(import_zod9.z.string()),
669
- missingEvents: import_zod9.z.array(import_zod9.z.string()),
670
- orphanedEvents: import_zod9.z.array(import_zod9.z.string()),
671
- dynamicTriggerId: import_zod9.z.string().optional()
807
+ events: import_zod11.z.array(import_zod11.z.string()),
808
+ missingEvents: import_zod11.z.array(import_zod11.z.string()),
809
+ orphanedEvents: import_zod11.z.array(import_zod11.z.string()),
810
+ dynamicTriggerId: import_zod11.z.string().optional()
672
811
  });
673
- var RegisteredOptionsDiffSchema = import_zod9.z.object({
674
- desired: import_zod9.z.array(import_zod9.z.string()),
675
- missing: import_zod9.z.array(import_zod9.z.string()),
676
- orphaned: import_zod9.z.array(import_zod9.z.string())
812
+ var RegisteredOptionsDiffSchema = import_zod11.z.object({
813
+ desired: import_zod11.z.array(import_zod11.z.string()),
814
+ missing: import_zod11.z.array(import_zod11.z.string()),
815
+ orphaned: import_zod11.z.array(import_zod11.z.string())
677
816
  });
678
- var RegisterSourceEventOptionsSchema = import_zod9.z.object({
817
+ var RegisterSourceEventOptionsSchema = import_zod11.z.object({
679
818
  event: RegisteredOptionsDiffSchema
680
- }).and(import_zod9.z.record(import_zod9.z.string(), RegisteredOptionsDiffSchema));
681
- var RegisterSourceEventSchemaV2 = import_zod9.z.object({
819
+ }).and(import_zod11.z.record(import_zod11.z.string(), RegisteredOptionsDiffSchema));
820
+ var RegisterSourceEventSchemaV2 = import_zod11.z.object({
682
821
  /** The id of the source */
683
- id: import_zod9.z.string(),
822
+ id: import_zod11.z.string(),
684
823
  source: RegisterTriggerSourceSchema,
685
824
  options: RegisterSourceEventOptionsSchema,
686
- dynamicTriggerId: import_zod9.z.string().optional()
825
+ dynamicTriggerId: import_zod11.z.string().optional()
687
826
  });
688
- var TriggerSourceSchema = import_zod9.z.object({
689
- id: import_zod9.z.string(),
690
- key: import_zod9.z.string()
827
+ var TriggerSourceSchema = import_zod11.z.object({
828
+ id: import_zod11.z.string(),
829
+ key: import_zod11.z.string()
691
830
  });
692
831
  var HttpSourceResponseMetadataSchema = DeserializedJsonSchema;
693
- var HandleTriggerSourceSchema = import_zod9.z.object({
694
- key: import_zod9.z.string(),
695
- secret: import_zod9.z.string(),
696
- data: import_zod9.z.any(),
697
- params: import_zod9.z.any(),
832
+ var HandleTriggerSourceSchema = import_zod11.z.object({
833
+ key: import_zod11.z.string(),
834
+ secret: import_zod11.z.string(),
835
+ data: import_zod11.z.any(),
836
+ params: import_zod11.z.any(),
698
837
  auth: ConnectionAuthSchema.optional(),
699
838
  metadata: HttpSourceResponseMetadataSchema.optional()
700
839
  });
701
- var HttpSourceRequestSchema = import_zod9.z.object({
702
- url: import_zod9.z.string().url(),
703
- method: import_zod9.z.string(),
704
- headers: import_zod9.z.record(import_zod9.z.string()),
705
- rawBody: import_zod9.z.instanceof(Buffer).optional().nullable()
706
- });
707
- var HttpSourceRequestHeadersSchema = import_zod9.z.object({
708
- "x-ts-key": import_zod9.z.string(),
709
- "x-ts-dynamic-id": import_zod9.z.string().optional(),
710
- "x-ts-secret": import_zod9.z.string(),
711
- "x-ts-data": import_zod9.z.string().transform((s) => JSON.parse(s)),
712
- "x-ts-params": import_zod9.z.string().transform((s) => JSON.parse(s)),
713
- "x-ts-http-url": import_zod9.z.string(),
714
- "x-ts-http-method": import_zod9.z.string(),
715
- "x-ts-http-headers": import_zod9.z.string().transform((s) => import_zod9.z.record(import_zod9.z.string()).parse(JSON.parse(s))),
716
- "x-ts-auth": import_zod9.z.string().optional().transform((s) => {
840
+ var HttpSourceRequestSchema = import_zod11.z.object({
841
+ url: import_zod11.z.string().url(),
842
+ method: import_zod11.z.string(),
843
+ headers: import_zod11.z.record(import_zod11.z.string()),
844
+ rawBody: import_zod11.z.instanceof(Buffer).optional().nullable()
845
+ });
846
+ var HttpSourceRequestHeadersSchema = import_zod11.z.object({
847
+ "x-ts-key": import_zod11.z.string(),
848
+ "x-ts-dynamic-id": import_zod11.z.string().optional(),
849
+ "x-ts-secret": import_zod11.z.string(),
850
+ "x-ts-data": import_zod11.z.string().transform((s) => JSON.parse(s)),
851
+ "x-ts-params": import_zod11.z.string().transform((s) => JSON.parse(s)),
852
+ "x-ts-http-url": import_zod11.z.string(),
853
+ "x-ts-http-method": import_zod11.z.string(),
854
+ "x-ts-http-headers": import_zod11.z.string().transform((s) => import_zod11.z.record(import_zod11.z.string()).parse(JSON.parse(s))),
855
+ "x-ts-auth": import_zod11.z.string().optional().transform((s) => {
717
856
  if (s === void 0)
718
857
  return;
719
858
  const json = JSON.parse(s);
720
859
  return ConnectionAuthSchema.parse(json);
721
860
  }),
722
- "x-ts-metadata": import_zod9.z.string().optional().transform((s) => {
861
+ "x-ts-metadata": import_zod11.z.string().optional().transform((s) => {
723
862
  if (s === void 0)
724
863
  return;
725
864
  const json = JSON.parse(s);
726
865
  return DeserializedJsonSchema.parse(json);
727
866
  })
728
867
  });
729
- var PongSuccessResponseSchema = import_zod9.z.object({
730
- ok: import_zod9.z.literal(true)
868
+ var PongSuccessResponseSchema = import_zod11.z.object({
869
+ ok: import_zod11.z.literal(true),
870
+ triggerVersion: import_zod11.z.string().optional(),
871
+ triggerSdkVersion: import_zod11.z.string().optional()
731
872
  });
732
- var PongErrorResponseSchema = import_zod9.z.object({
733
- ok: import_zod9.z.literal(false),
734
- error: import_zod9.z.string()
873
+ var PongErrorResponseSchema = import_zod11.z.object({
874
+ ok: import_zod11.z.literal(false),
875
+ error: import_zod11.z.string(),
876
+ triggerVersion: import_zod11.z.string().optional(),
877
+ triggerSdkVersion: import_zod11.z.string().optional()
735
878
  });
736
- var PongResponseSchema = import_zod9.z.discriminatedUnion("ok", [
879
+ var PongResponseSchema = import_zod11.z.discriminatedUnion("ok", [
737
880
  PongSuccessResponseSchema,
738
881
  PongErrorResponseSchema
739
882
  ]);
740
- var ValidateSuccessResponseSchema = import_zod9.z.object({
741
- ok: import_zod9.z.literal(true),
742
- endpointId: import_zod9.z.string()
883
+ var ValidateSuccessResponseSchema = import_zod11.z.object({
884
+ ok: import_zod11.z.literal(true),
885
+ endpointId: import_zod11.z.string(),
886
+ triggerVersion: import_zod11.z.string().optional()
743
887
  });
744
- var ValidateErrorResponseSchema = import_zod9.z.object({
745
- ok: import_zod9.z.literal(false),
746
- error: import_zod9.z.string()
888
+ var ValidateErrorResponseSchema = import_zod11.z.object({
889
+ ok: import_zod11.z.literal(false),
890
+ error: import_zod11.z.string(),
891
+ triggerVersion: import_zod11.z.string().optional()
747
892
  });
748
- var ValidateResponseSchema = import_zod9.z.discriminatedUnion("ok", [
893
+ var ValidateResponseSchema = import_zod11.z.discriminatedUnion("ok", [
749
894
  ValidateSuccessResponseSchema,
750
895
  ValidateErrorResponseSchema
751
896
  ]);
752
- var QueueOptionsSchema = import_zod9.z.object({
753
- name: import_zod9.z.string(),
754
- maxConcurrent: import_zod9.z.number().optional()
755
- });
756
- var JobMetadataSchema = import_zod9.z.object({
757
- id: import_zod9.z.string(),
758
- name: import_zod9.z.string(),
759
- version: import_zod9.z.string(),
897
+ var QueueOptionsSchema = import_zod11.z.object({
898
+ name: import_zod11.z.string(),
899
+ maxConcurrent: import_zod11.z.number().optional()
900
+ });
901
+ var JobMetadataSchema = import_zod11.z.object({
902
+ id: import_zod11.z.string(),
903
+ name: import_zod11.z.string(),
904
+ version: import_zod11.z.string(),
760
905
  event: EventSpecificationSchema,
761
906
  trigger: TriggerMetadataSchema,
762
- integrations: import_zod9.z.record(IntegrationConfigSchema),
763
- internal: import_zod9.z.boolean().default(false),
764
- enabled: import_zod9.z.boolean(),
765
- startPosition: import_zod9.z.enum([
907
+ integrations: import_zod11.z.record(IntegrationConfigSchema),
908
+ internal: import_zod11.z.boolean().default(false),
909
+ enabled: import_zod11.z.boolean(),
910
+ startPosition: import_zod11.z.enum([
766
911
  "initial",
767
912
  "latest"
768
913
  ]),
769
- preprocessRuns: import_zod9.z.boolean()
914
+ preprocessRuns: import_zod11.z.boolean()
770
915
  });
771
- var SourceMetadataV1Schema = import_zod9.z.object({
772
- version: import_zod9.z.literal("1"),
773
- channel: import_zod9.z.enum([
916
+ var SourceMetadataV1Schema = import_zod11.z.object({
917
+ version: import_zod11.z.literal("1"),
918
+ channel: import_zod11.z.enum([
774
919
  "HTTP",
775
920
  "SQS",
776
921
  "SMTP"
777
922
  ]),
778
923
  integration: IntegrationConfigSchema,
779
- key: import_zod9.z.string(),
780
- params: import_zod9.z.any(),
781
- events: import_zod9.z.array(import_zod9.z.string()),
782
- registerSourceJob: import_zod9.z.object({
783
- id: import_zod9.z.string(),
784
- version: import_zod9.z.string()
924
+ key: import_zod11.z.string(),
925
+ params: import_zod11.z.any(),
926
+ events: import_zod11.z.array(import_zod11.z.string()),
927
+ registerSourceJob: import_zod11.z.object({
928
+ id: import_zod11.z.string(),
929
+ version: import_zod11.z.string()
785
930
  }).optional()
786
931
  });
787
- var SourceMetadataV2Schema = import_zod9.z.object({
788
- version: import_zod9.z.literal("2"),
789
- channel: import_zod9.z.enum([
932
+ var SourceMetadataV2Schema = import_zod11.z.object({
933
+ version: import_zod11.z.literal("2"),
934
+ channel: import_zod11.z.enum([
790
935
  "HTTP",
791
936
  "SQS",
792
937
  "SMTP"
793
938
  ]),
794
939
  integration: IntegrationConfigSchema,
795
- key: import_zod9.z.string(),
796
- params: import_zod9.z.any(),
797
- options: import_zod9.z.record(import_zod9.z.array(import_zod9.z.string())),
798
- registerSourceJob: import_zod9.z.object({
799
- id: import_zod9.z.string(),
800
- version: import_zod9.z.string()
940
+ key: import_zod11.z.string(),
941
+ params: import_zod11.z.any(),
942
+ options: import_zod11.z.record(import_zod11.z.array(import_zod11.z.string())),
943
+ registerSourceJob: import_zod11.z.object({
944
+ id: import_zod11.z.string(),
945
+ version: import_zod11.z.string()
801
946
  }).optional()
802
947
  });
803
- var SourceMetadataSchema = import_zod9.z.preprocess(addMissingVersionField, import_zod9.z.discriminatedUnion("version", [
948
+ var SourceMetadataSchema = import_zod11.z.preprocess(addMissingVersionField, import_zod11.z.discriminatedUnion("version", [
804
949
  SourceMetadataV1Schema,
805
950
  SourceMetadataV2Schema
806
951
  ]));
807
- var DynamicTriggerEndpointMetadataSchema = import_zod9.z.object({
808
- id: import_zod9.z.string(),
809
- jobs: import_zod9.z.array(JobMetadataSchema.pick({
952
+ var DynamicTriggerEndpointMetadataSchema = import_zod11.z.object({
953
+ id: import_zod11.z.string(),
954
+ jobs: import_zod11.z.array(JobMetadataSchema.pick({
810
955
  id: true,
811
956
  version: true
812
957
  })),
813
- registerSourceJob: import_zod9.z.object({
814
- id: import_zod9.z.string(),
815
- version: import_zod9.z.string()
958
+ registerSourceJob: import_zod11.z.object({
959
+ id: import_zod11.z.string(),
960
+ version: import_zod11.z.string()
816
961
  }).optional()
817
962
  });
818
- var BackgroundTaskMetadataSchema = import_zod9.z.object({
819
- id: import_zod9.z.string(),
820
- name: import_zod9.z.string(),
821
- version: import_zod9.z.string(),
822
- enabled: import_zod9.z.boolean(),
823
- cpu: import_zod9.z.number(),
824
- memory: import_zod9.z.number(),
825
- concurrency: import_zod9.z.number(),
826
- secrets: import_zod9.z.record(import_zod9.z.string()).optional()
827
- });
828
- var IndexEndpointResponseSchema = import_zod9.z.object({
829
- jobs: import_zod9.z.array(JobMetadataSchema),
830
- sources: import_zod9.z.array(SourceMetadataSchema),
831
- dynamicTriggers: import_zod9.z.array(DynamicTriggerEndpointMetadataSchema),
832
- dynamicSchedules: import_zod9.z.array(RegisterDynamicSchedulePayloadSchema),
833
- backgroundTasks: import_zod9.z.array(BackgroundTaskMetadataSchema).optional()
834
- });
835
- var RawEventSchema = import_zod9.z.object({
963
+ var IndexEndpointResponseSchema = import_zod11.z.object({
964
+ jobs: import_zod11.z.array(JobMetadataSchema),
965
+ sources: import_zod11.z.array(SourceMetadataSchema),
966
+ dynamicTriggers: import_zod11.z.array(DynamicTriggerEndpointMetadataSchema),
967
+ dynamicSchedules: import_zod11.z.array(RegisterDynamicSchedulePayloadSchema)
968
+ });
969
+ var EndpointIndexErrorSchema = import_zod11.z.object({
970
+ message: import_zod11.z.string(),
971
+ raw: import_zod11.z.any().optional()
972
+ });
973
+ var IndexEndpointStatsSchema = import_zod11.z.object({
974
+ jobs: import_zod11.z.number(),
975
+ sources: import_zod11.z.number(),
976
+ dynamicTriggers: import_zod11.z.number(),
977
+ dynamicSchedules: import_zod11.z.number(),
978
+ disabledJobs: import_zod11.z.number().default(0)
979
+ });
980
+ function parseEndpointIndexStats(stats) {
981
+ if (stats === null || stats === void 0) {
982
+ return;
983
+ }
984
+ return IndexEndpointStatsSchema.parse(stats);
985
+ }
986
+ __name(parseEndpointIndexStats, "parseEndpointIndexStats");
987
+ var GetEndpointIndexResponseSchema = import_zod11.z.discriminatedUnion("status", [
988
+ import_zod11.z.object({
989
+ status: import_zod11.z.literal("PENDING"),
990
+ updatedAt: import_zod11.z.coerce.date()
991
+ }),
992
+ import_zod11.z.object({
993
+ status: import_zod11.z.literal("STARTED"),
994
+ updatedAt: import_zod11.z.coerce.date()
995
+ }),
996
+ import_zod11.z.object({
997
+ status: import_zod11.z.literal("SUCCESS"),
998
+ stats: IndexEndpointStatsSchema,
999
+ updatedAt: import_zod11.z.coerce.date()
1000
+ }),
1001
+ import_zod11.z.object({
1002
+ status: import_zod11.z.literal("FAILURE"),
1003
+ error: EndpointIndexErrorSchema,
1004
+ updatedAt: import_zod11.z.coerce.date()
1005
+ })
1006
+ ]);
1007
+ var EndpointHeadersSchema = import_zod11.z.object({
1008
+ "trigger-version": import_zod11.z.string().optional(),
1009
+ "trigger-sdk-version": import_zod11.z.string().optional()
1010
+ });
1011
+ var RawEventSchema = import_zod11.z.object({
836
1012
  /** The `name` property must exactly match any subscriptions you want to
837
1013
  trigger. */
838
- name: import_zod9.z.string(),
1014
+ name: import_zod11.z.string(),
839
1015
  /** The `payload` property will be sent to any matching Jobs and will appear
840
1016
  as the `payload` param of the `run()` function. You can leave this
841
1017
  parameter out if you just want to trigger a Job without any input data. */
842
- payload: import_zod9.z.any(),
1018
+ payload: import_zod11.z.any(),
843
1019
  /** The optional `context` property will be sent to any matching Jobs and will
844
1020
  be passed through as the `context.event.context` param of the `run()`
845
1021
  function. This is optional but can be useful if you want to pass through
846
1022
  some additional context to the Job. */
847
- context: import_zod9.z.any().optional(),
1023
+ context: import_zod11.z.any().optional(),
848
1024
  /** The `id` property uniquely identify this particular event. If unset it
849
1025
  will be set automatically using `ulid`. */
850
- id: import_zod9.z.string().default(() => (0, import_ulid.ulid)()),
1026
+ id: import_zod11.z.string().default(() => (0, import_ulid.ulid)()),
851
1027
  /** This is optional, it defaults to the current timestamp. Usually you would
852
1028
  only set this if you have a timestamp that you wish to pass through, e.g.
853
1029
  you receive a timestamp from a service and you want the same timestamp to
854
1030
  be used in your Job. */
855
- timestamp: import_zod9.z.coerce.date().optional(),
1031
+ timestamp: import_zod11.z.coerce.date().optional(),
856
1032
  /** This is optional, it defaults to "trigger.dev". It can be useful to set
857
1033
  this as you can filter events using this in the `eventTrigger()`. */
858
- source: import_zod9.z.string().optional()
1034
+ source: import_zod11.z.string().optional()
859
1035
  });
860
- var ApiEventLogSchema = import_zod9.z.object({
1036
+ var ApiEventLogSchema = import_zod11.z.object({
861
1037
  /** The `id` of the event that was sent.
862
1038
  */
863
- id: import_zod9.z.string(),
1039
+ id: import_zod11.z.string(),
864
1040
  /** The `name` of the event that was sent. */
865
- name: import_zod9.z.string(),
1041
+ name: import_zod11.z.string(),
866
1042
  /** The `payload` of the event that was sent */
867
1043
  payload: DeserializedJsonSchema,
868
1044
  /** The `context` of the event that was sent. Is `undefined` if no context was
869
1045
  set when sending the event. */
870
1046
  context: DeserializedJsonSchema.optional().nullable(),
871
1047
  /** The `timestamp` of the event that was sent */
872
- timestamp: import_zod9.z.coerce.date(),
1048
+ timestamp: import_zod11.z.coerce.date(),
873
1049
  /** The timestamp when the event will be delivered to any matching Jobs. Is
874
1050
  `undefined` if `deliverAt` or `deliverAfter` wasn't set when sending the
875
1051
  event. */
876
- deliverAt: import_zod9.z.coerce.date().optional().nullable(),
1052
+ deliverAt: import_zod11.z.coerce.date().optional().nullable(),
877
1053
  /** The timestamp when the event was delivered. Is `undefined` if `deliverAt`
878
1054
  or `deliverAfter` were set when sending the event. */
879
- deliveredAt: import_zod9.z.coerce.date().optional().nullable(),
1055
+ deliveredAt: import_zod11.z.coerce.date().optional().nullable(),
880
1056
  /** The timestamp when the event was cancelled. Is `undefined` if the event
881
1057
  * wasn't cancelled. */
882
- cancelledAt: import_zod9.z.coerce.date().optional().nullable()
1058
+ cancelledAt: import_zod11.z.coerce.date().optional().nullable()
883
1059
  });
884
- var SendEventOptionsSchema = import_zod9.z.object({
1060
+ var SendEventOptionsSchema = import_zod11.z.object({
885
1061
  /** An optional Date when you want the event to trigger Jobs. The event will
886
1062
  be sent to the platform immediately but won't be acted upon until the
887
1063
  specified time. */
888
- deliverAt: import_zod9.z.coerce.date().optional(),
1064
+ deliverAt: import_zod11.z.coerce.date().optional(),
889
1065
  /** An optional number of seconds you want to wait for the event to trigger
890
1066
  any relevant Jobs. The event will be sent to the platform immediately but
891
1067
  won't be delivered until after the elapsed number of seconds. */
892
- deliverAfter: import_zod9.z.number().int().optional(),
1068
+ deliverAfter: import_zod11.z.number().int().optional(),
893
1069
  /** This optional param will be used by Trigger.dev Connect, which
894
1070
  is coming soon. */
895
- accountId: import_zod9.z.string().optional()
1071
+ accountId: import_zod11.z.string().optional()
896
1072
  });
897
- var SendEventBodySchema = import_zod9.z.object({
1073
+ var SendEventBodySchema = import_zod11.z.object({
898
1074
  event: RawEventSchema,
899
1075
  options: SendEventOptionsSchema.optional()
900
1076
  });
901
- var DeliverEventResponseSchema = import_zod9.z.object({
902
- deliveredAt: import_zod9.z.string().datetime()
1077
+ var DeliverEventResponseSchema = import_zod11.z.object({
1078
+ deliveredAt: import_zod11.z.string().datetime()
903
1079
  });
904
- var RuntimeEnvironmentTypeSchema = import_zod9.z.enum([
1080
+ var RuntimeEnvironmentTypeSchema = import_zod11.z.enum([
905
1081
  "PRODUCTION",
906
1082
  "STAGING",
907
1083
  "DEVELOPMENT",
908
1084
  "PREVIEW"
909
1085
  ]);
910
- var RunSourceContextSchema = import_zod9.z.object({
911
- id: import_zod9.z.string(),
912
- metadata: import_zod9.z.any()
1086
+ var RunSourceContextSchema = import_zod11.z.object({
1087
+ id: import_zod11.z.string(),
1088
+ metadata: import_zod11.z.any()
1089
+ });
1090
+ var AutoYieldConfigSchema = import_zod11.z.object({
1091
+ startTaskThreshold: import_zod11.z.number(),
1092
+ beforeExecuteTaskThreshold: import_zod11.z.number(),
1093
+ beforeCompleteTaskThreshold: import_zod11.z.number(),
1094
+ afterCompleteTaskThreshold: import_zod11.z.number()
913
1095
  });
914
- var RunJobBodySchema = import_zod9.z.object({
1096
+ var RunJobBodySchema = import_zod11.z.object({
915
1097
  event: ApiEventLogSchema,
916
- job: import_zod9.z.object({
917
- id: import_zod9.z.string(),
918
- version: import_zod9.z.string()
1098
+ job: import_zod11.z.object({
1099
+ id: import_zod11.z.string(),
1100
+ version: import_zod11.z.string()
919
1101
  }),
920
- run: import_zod9.z.object({
921
- id: import_zod9.z.string(),
922
- isTest: import_zod9.z.boolean(),
923
- isRetry: import_zod9.z.boolean().default(false),
924
- startedAt: import_zod9.z.coerce.date()
1102
+ run: import_zod11.z.object({
1103
+ id: import_zod11.z.string(),
1104
+ isTest: import_zod11.z.boolean(),
1105
+ isRetry: import_zod11.z.boolean().default(false),
1106
+ startedAt: import_zod11.z.coerce.date()
925
1107
  }),
926
- environment: import_zod9.z.object({
927
- id: import_zod9.z.string(),
928
- slug: import_zod9.z.string(),
1108
+ environment: import_zod11.z.object({
1109
+ id: import_zod11.z.string(),
1110
+ slug: import_zod11.z.string(),
929
1111
  type: RuntimeEnvironmentTypeSchema
930
1112
  }),
931
- organization: import_zod9.z.object({
932
- id: import_zod9.z.string(),
933
- title: import_zod9.z.string(),
934
- slug: import_zod9.z.string()
1113
+ organization: import_zod11.z.object({
1114
+ id: import_zod11.z.string(),
1115
+ title: import_zod11.z.string(),
1116
+ slug: import_zod11.z.string()
935
1117
  }),
936
- account: import_zod9.z.object({
937
- id: import_zod9.z.string(),
938
- metadata: import_zod9.z.any()
1118
+ account: import_zod11.z.object({
1119
+ id: import_zod11.z.string(),
1120
+ metadata: import_zod11.z.any()
939
1121
  }).optional(),
940
1122
  source: RunSourceContextSchema.optional(),
941
- tasks: import_zod9.z.array(CachedTaskSchema).optional(),
942
- connections: import_zod9.z.record(ConnectionAuthSchema).optional()
943
- });
944
- var RunJobErrorSchema = import_zod9.z.object({
945
- status: import_zod9.z.literal("ERROR"),
1123
+ tasks: import_zod11.z.array(CachedTaskSchema).optional(),
1124
+ cachedTaskCursor: import_zod11.z.string().optional(),
1125
+ noopTasksSet: import_zod11.z.string().optional(),
1126
+ connections: import_zod11.z.record(ConnectionAuthSchema).optional(),
1127
+ yieldedExecutions: import_zod11.z.string().array().optional(),
1128
+ runChunkExecutionLimit: import_zod11.z.number().optional(),
1129
+ autoYieldConfig: AutoYieldConfigSchema.optional()
1130
+ });
1131
+ var RunJobErrorSchema = import_zod11.z.object({
1132
+ status: import_zod11.z.literal("ERROR"),
946
1133
  error: ErrorWithStackSchema,
947
1134
  task: TaskSchema.optional()
948
1135
  });
949
- var RunJobResumeWithTaskSchema = import_zod9.z.object({
950
- status: import_zod9.z.literal("RESUME_WITH_TASK"),
1136
+ var RunJobYieldExecutionErrorSchema = import_zod11.z.object({
1137
+ status: import_zod11.z.literal("YIELD_EXECUTION"),
1138
+ key: import_zod11.z.string()
1139
+ });
1140
+ var RunJobAutoYieldExecutionErrorSchema = import_zod11.z.object({
1141
+ status: import_zod11.z.literal("AUTO_YIELD_EXECUTION"),
1142
+ location: import_zod11.z.string(),
1143
+ timeRemaining: import_zod11.z.number(),
1144
+ timeElapsed: import_zod11.z.number(),
1145
+ limit: import_zod11.z.number().optional()
1146
+ });
1147
+ var RunJobAutoYieldWithCompletedTaskExecutionErrorSchema = import_zod11.z.object({
1148
+ status: import_zod11.z.literal("AUTO_YIELD_EXECUTION_WITH_COMPLETED_TASK"),
1149
+ id: import_zod11.z.string(),
1150
+ properties: import_zod11.z.array(DisplayPropertySchema).optional(),
1151
+ output: import_zod11.z.any(),
1152
+ data: import_zod11.z.object({
1153
+ location: import_zod11.z.string(),
1154
+ timeRemaining: import_zod11.z.number(),
1155
+ timeElapsed: import_zod11.z.number(),
1156
+ limit: import_zod11.z.number().optional()
1157
+ })
1158
+ });
1159
+ var RunJobInvalidPayloadErrorSchema = import_zod11.z.object({
1160
+ status: import_zod11.z.literal("INVALID_PAYLOAD"),
1161
+ errors: import_zod11.z.array(SchemaErrorSchema)
1162
+ });
1163
+ var RunJobUnresolvedAuthErrorSchema = import_zod11.z.object({
1164
+ status: import_zod11.z.literal("UNRESOLVED_AUTH_ERROR"),
1165
+ issues: import_zod11.z.record(import_zod11.z.object({
1166
+ id: import_zod11.z.string(),
1167
+ error: import_zod11.z.string()
1168
+ }))
1169
+ });
1170
+ var RunJobResumeWithTaskSchema = import_zod11.z.object({
1171
+ status: import_zod11.z.literal("RESUME_WITH_TASK"),
951
1172
  task: TaskSchema
952
1173
  });
953
- var RunJobRetryWithTaskSchema = import_zod9.z.object({
954
- status: import_zod9.z.literal("RETRY_WITH_TASK"),
1174
+ var RunJobRetryWithTaskSchema = import_zod11.z.object({
1175
+ status: import_zod11.z.literal("RETRY_WITH_TASK"),
955
1176
  task: TaskSchema,
956
1177
  error: ErrorWithStackSchema,
957
- retryAt: import_zod9.z.coerce.date()
1178
+ retryAt: import_zod11.z.coerce.date()
958
1179
  });
959
- var RunJobCanceledWithTaskSchema = import_zod9.z.object({
960
- status: import_zod9.z.literal("CANCELED"),
1180
+ var RunJobCanceledWithTaskSchema = import_zod11.z.object({
1181
+ status: import_zod11.z.literal("CANCELED"),
961
1182
  task: TaskSchema
962
1183
  });
963
- var RunJobSuccessSchema = import_zod9.z.object({
964
- status: import_zod9.z.literal("SUCCESS"),
1184
+ var RunJobSuccessSchema = import_zod11.z.object({
1185
+ status: import_zod11.z.literal("SUCCESS"),
965
1186
  output: DeserializedJsonSchema.optional()
966
1187
  });
967
- var RunJobResponseSchema = import_zod9.z.discriminatedUnion("status", [
1188
+ var RunJobResponseSchema = import_zod11.z.discriminatedUnion("status", [
1189
+ RunJobAutoYieldExecutionErrorSchema,
1190
+ RunJobAutoYieldWithCompletedTaskExecutionErrorSchema,
1191
+ RunJobYieldExecutionErrorSchema,
968
1192
  RunJobErrorSchema,
1193
+ RunJobUnresolvedAuthErrorSchema,
1194
+ RunJobInvalidPayloadErrorSchema,
969
1195
  RunJobResumeWithTaskSchema,
970
1196
  RunJobRetryWithTaskSchema,
971
1197
  RunJobCanceledWithTaskSchema,
972
1198
  RunJobSuccessSchema
973
1199
  ]);
974
- var PreprocessRunBodySchema = import_zod9.z.object({
1200
+ var PreprocessRunBodySchema = import_zod11.z.object({
975
1201
  event: ApiEventLogSchema,
976
- job: import_zod9.z.object({
977
- id: import_zod9.z.string(),
978
- version: import_zod9.z.string()
1202
+ job: import_zod11.z.object({
1203
+ id: import_zod11.z.string(),
1204
+ version: import_zod11.z.string()
979
1205
  }),
980
- run: import_zod9.z.object({
981
- id: import_zod9.z.string(),
982
- isTest: import_zod9.z.boolean()
1206
+ run: import_zod11.z.object({
1207
+ id: import_zod11.z.string(),
1208
+ isTest: import_zod11.z.boolean()
983
1209
  }),
984
- environment: import_zod9.z.object({
985
- id: import_zod9.z.string(),
986
- slug: import_zod9.z.string(),
1210
+ environment: import_zod11.z.object({
1211
+ id: import_zod11.z.string(),
1212
+ slug: import_zod11.z.string(),
987
1213
  type: RuntimeEnvironmentTypeSchema
988
1214
  }),
989
- organization: import_zod9.z.object({
990
- id: import_zod9.z.string(),
991
- title: import_zod9.z.string(),
992
- slug: import_zod9.z.string()
1215
+ organization: import_zod11.z.object({
1216
+ id: import_zod11.z.string(),
1217
+ title: import_zod11.z.string(),
1218
+ slug: import_zod11.z.string()
993
1219
  }),
994
- account: import_zod9.z.object({
995
- id: import_zod9.z.string(),
996
- metadata: import_zod9.z.any()
1220
+ account: import_zod11.z.object({
1221
+ id: import_zod11.z.string(),
1222
+ metadata: import_zod11.z.any()
997
1223
  }).optional()
998
1224
  });
999
- var PreprocessRunResponseSchema = import_zod9.z.object({
1000
- abort: import_zod9.z.boolean(),
1001
- properties: import_zod9.z.array(DisplayPropertySchema).optional()
1225
+ var PreprocessRunResponseSchema = import_zod11.z.object({
1226
+ abort: import_zod11.z.boolean(),
1227
+ properties: import_zod11.z.array(DisplayPropertySchema).optional()
1002
1228
  });
1003
- var CreateRunResponseOkSchema = import_zod9.z.object({
1004
- ok: import_zod9.z.literal(true),
1005
- data: import_zod9.z.object({
1006
- id: import_zod9.z.string()
1229
+ var CreateRunResponseOkSchema = import_zod11.z.object({
1230
+ ok: import_zod11.z.literal(true),
1231
+ data: import_zod11.z.object({
1232
+ id: import_zod11.z.string()
1007
1233
  })
1008
1234
  });
1009
- var CreateRunResponseErrorSchema = import_zod9.z.object({
1010
- ok: import_zod9.z.literal(false),
1011
- error: import_zod9.z.string()
1235
+ var CreateRunResponseErrorSchema = import_zod11.z.object({
1236
+ ok: import_zod11.z.literal(false),
1237
+ error: import_zod11.z.string()
1012
1238
  });
1013
- var CreateRunResponseBodySchema = import_zod9.z.discriminatedUnion("ok", [
1239
+ var CreateRunResponseBodySchema = import_zod11.z.discriminatedUnion("ok", [
1014
1240
  CreateRunResponseOkSchema,
1015
1241
  CreateRunResponseErrorSchema
1016
1242
  ]);
1017
- var RedactStringSchema = import_zod9.z.object({
1018
- __redactedString: import_zod9.z.literal(true),
1019
- strings: import_zod9.z.array(import_zod9.z.string()),
1020
- interpolations: import_zod9.z.array(import_zod9.z.string())
1243
+ var RedactStringSchema = import_zod11.z.object({
1244
+ __redactedString: import_zod11.z.literal(true),
1245
+ strings: import_zod11.z.array(import_zod11.z.string()),
1246
+ interpolations: import_zod11.z.array(import_zod11.z.string())
1021
1247
  });
1022
- var LogMessageSchema = import_zod9.z.object({
1023
- level: import_zod9.z.enum([
1248
+ var LogMessageSchema = import_zod11.z.object({
1249
+ level: import_zod11.z.enum([
1024
1250
  "DEBUG",
1025
1251
  "INFO",
1026
1252
  "WARN",
1027
1253
  "ERROR"
1028
1254
  ]),
1029
- message: import_zod9.z.string(),
1255
+ message: import_zod11.z.string(),
1030
1256
  data: SerializableJsonSchema.optional()
1031
1257
  });
1032
- var RedactSchema = import_zod9.z.object({
1033
- paths: import_zod9.z.array(import_zod9.z.string())
1258
+ var RedactSchema = import_zod11.z.object({
1259
+ paths: import_zod11.z.array(import_zod11.z.string())
1034
1260
  });
1035
- var RetryOptionsSchema = import_zod9.z.object({
1261
+ var RetryOptionsSchema = import_zod11.z.object({
1036
1262
  /** The maximum number of times to retry the request. */
1037
- limit: import_zod9.z.number().optional(),
1263
+ limit: import_zod11.z.number().optional(),
1038
1264
  /** The exponential factor to use when calculating the next retry time. */
1039
- factor: import_zod9.z.number().optional(),
1265
+ factor: import_zod11.z.number().optional(),
1040
1266
  /** The minimum amount of time to wait before retrying the request. */
1041
- minTimeoutInMs: import_zod9.z.number().optional(),
1267
+ minTimeoutInMs: import_zod11.z.number().optional(),
1042
1268
  /** The maximum amount of time to wait before retrying the request. */
1043
- maxTimeoutInMs: import_zod9.z.number().optional(),
1269
+ maxTimeoutInMs: import_zod11.z.number().optional(),
1044
1270
  /** Whether to randomize the retry time. */
1045
- randomize: import_zod9.z.boolean().optional()
1271
+ randomize: import_zod11.z.boolean().optional()
1046
1272
  });
1047
- var RunTaskOptionsSchema = import_zod9.z.object({
1273
+ var RunTaskOptionsSchema = import_zod11.z.object({
1048
1274
  /** The name of the Task is required. This is displayed on the Task in the logs. */
1049
- name: import_zod9.z.string().optional(),
1275
+ name: import_zod11.z.string().optional(),
1050
1276
  /** The Task will wait and only start at the specified Date */
1051
- delayUntil: import_zod9.z.coerce.date().optional(),
1277
+ delayUntil: import_zod11.z.coerce.date().optional(),
1052
1278
  /** Retry options */
1053
1279
  retry: RetryOptionsSchema.optional(),
1054
1280
  /** The icon for the Task, it will appear in the logs.
1055
1281
  * You can use the name of a company in lowercase, e.g. "github".
1056
- * Or any icon name that [Font Awesome](https://fontawesome.com/icons) supports. */
1057
- icon: import_zod9.z.string().optional(),
1282
+ * Or any icon name that [Tabler Icons](https://tabler-icons.io/) supports. */
1283
+ icon: import_zod11.z.string().optional(),
1058
1284
  /** The key for the Task that you want to appear in the logs */
1059
- displayKey: import_zod9.z.string().optional(),
1285
+ displayKey: import_zod11.z.string().optional(),
1060
1286
  /** A description of the Task */
1061
- description: import_zod9.z.string().optional(),
1287
+ description: import_zod11.z.string().optional(),
1062
1288
  /** Properties that are displayed in the logs */
1063
- properties: import_zod9.z.array(DisplayPropertySchema).optional(),
1289
+ properties: import_zod11.z.array(DisplayPropertySchema).optional(),
1064
1290
  /** The input params to the Task, will be displayed in the logs */
1065
- params: import_zod9.z.any(),
1291
+ params: import_zod11.z.any(),
1066
1292
  /** The style of the log entry. */
1067
1293
  style: StyleSchema.optional(),
1294
+ /** Allows you to expose a `task.callbackUrl` to use in your tasks. Enabling this feature will cause the task to return the data sent to the callbackUrl instead of the usual async callback result. */
1295
+ callback: import_zod11.z.object({
1296
+ /** Causes the task to wait for and return the data of the first request sent to `task.callbackUrl`. */
1297
+ enabled: import_zod11.z.boolean(),
1298
+ /** Time to wait for the first request to `task.callbackUrl`. Default: One hour. */
1299
+ timeoutInSeconds: import_zod11.z.number()
1300
+ }).partial().optional(),
1068
1301
  /** Allows you to link the Integration connection in the logs. This is handled automatically in integrations. */
1069
- connectionKey: import_zod9.z.string().optional(),
1302
+ connectionKey: import_zod11.z.string().optional(),
1070
1303
  /** 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. */
1071
- operation: import_zod9.z.enum([
1304
+ operation: import_zod11.z.enum([
1072
1305
  "fetch"
1073
1306
  ]).optional(),
1074
1307
  /** 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). */
1075
- noop: import_zod9.z.boolean().default(false),
1308
+ noop: import_zod11.z.boolean().default(false),
1076
1309
  redact: RedactSchema.optional(),
1077
1310
  trigger: TriggerMetadataSchema.optional()
1078
1311
  });
1079
1312
  var RunTaskBodyInputSchema = RunTaskOptionsSchema.extend({
1080
- idempotencyKey: import_zod9.z.string(),
1081
- parentId: import_zod9.z.string().optional()
1313
+ idempotencyKey: import_zod11.z.string(),
1314
+ parentId: import_zod11.z.string().optional()
1082
1315
  });
1083
1316
  var RunTaskBodyOutputSchema = RunTaskBodyInputSchema.extend({
1084
- params: DeserializedJsonSchema.optional().nullable()
1317
+ properties: import_zod11.z.array(DisplayPropertySchema.partial()).optional(),
1318
+ params: DeserializedJsonSchema.optional().nullable(),
1319
+ callback: import_zod11.z.object({
1320
+ enabled: import_zod11.z.boolean(),
1321
+ timeoutInSeconds: import_zod11.z.number().default(3600)
1322
+ }).optional()
1323
+ });
1324
+ var RunTaskResponseWithCachedTasksBodySchema = import_zod11.z.object({
1325
+ task: ServerTaskSchema,
1326
+ cachedTasks: import_zod11.z.object({
1327
+ tasks: import_zod11.z.array(CachedTaskSchema),
1328
+ cursor: import_zod11.z.string().optional()
1329
+ }).optional()
1085
1330
  });
1086
1331
  var CompleteTaskBodyInputSchema = RunTaskBodyInputSchema.pick({
1087
1332
  properties: true,
@@ -1090,287 +1335,203 @@ var CompleteTaskBodyInputSchema = RunTaskBodyInputSchema.pick({
1090
1335
  }).extend({
1091
1336
  output: SerializableJsonSchema.optional().transform((v) => v ? DeserializedJsonSchema.parse(JSON.parse(JSON.stringify(v))) : {})
1092
1337
  });
1093
- var FailTaskBodyInputSchema = import_zod9.z.object({
1338
+ var FailTaskBodyInputSchema = import_zod11.z.object({
1094
1339
  error: ErrorWithStackSchema
1095
1340
  });
1096
- var NormalizedRequestSchema = import_zod9.z.object({
1097
- headers: import_zod9.z.record(import_zod9.z.string()),
1098
- method: import_zod9.z.string(),
1099
- query: import_zod9.z.record(import_zod9.z.string()),
1100
- url: import_zod9.z.string(),
1101
- body: import_zod9.z.any()
1341
+ var NormalizedRequestSchema = import_zod11.z.object({
1342
+ headers: import_zod11.z.record(import_zod11.z.string()),
1343
+ method: import_zod11.z.string(),
1344
+ query: import_zod11.z.record(import_zod11.z.string()),
1345
+ url: import_zod11.z.string(),
1346
+ body: import_zod11.z.any()
1102
1347
  });
1103
- var NormalizedResponseSchema = import_zod9.z.object({
1104
- status: import_zod9.z.number(),
1105
- body: import_zod9.z.any(),
1106
- headers: import_zod9.z.record(import_zod9.z.string()).optional()
1348
+ var NormalizedResponseSchema = import_zod11.z.object({
1349
+ status: import_zod11.z.number(),
1350
+ body: import_zod11.z.any(),
1351
+ headers: import_zod11.z.record(import_zod11.z.string()).optional()
1107
1352
  });
1108
- var HttpSourceResponseSchema = import_zod9.z.object({
1353
+ var HttpSourceResponseSchema = import_zod11.z.object({
1109
1354
  response: NormalizedResponseSchema,
1110
- events: import_zod9.z.array(RawEventSchema),
1355
+ events: import_zod11.z.array(RawEventSchema),
1111
1356
  metadata: HttpSourceResponseMetadataSchema.optional()
1112
1357
  });
1113
- var RegisterTriggerBodySchemaV1 = import_zod9.z.object({
1358
+ var RegisterTriggerBodySchemaV1 = import_zod11.z.object({
1114
1359
  rule: EventRuleSchema,
1115
1360
  source: SourceMetadataV1Schema
1116
1361
  });
1117
- var RegisterTriggerBodySchemaV2 = import_zod9.z.object({
1362
+ var RegisterTriggerBodySchemaV2 = import_zod11.z.object({
1118
1363
  rule: EventRuleSchema,
1119
- source: SourceMetadataV2Schema
1364
+ source: SourceMetadataV2Schema,
1365
+ accountId: import_zod11.z.string().optional()
1120
1366
  });
1121
- var InitializeTriggerBodySchema = import_zod9.z.object({
1122
- id: import_zod9.z.string(),
1123
- params: import_zod9.z.any(),
1124
- accountId: import_zod9.z.string().optional(),
1125
- metadata: import_zod9.z.any().optional()
1367
+ var InitializeTriggerBodySchema = import_zod11.z.object({
1368
+ id: import_zod11.z.string(),
1369
+ params: import_zod11.z.any(),
1370
+ accountId: import_zod11.z.string().optional(),
1371
+ metadata: import_zod11.z.any().optional()
1126
1372
  });
1127
- var RegisterCommonScheduleBodySchema = import_zod9.z.object({
1373
+ var RegisterCommonScheduleBodySchema = import_zod11.z.object({
1128
1374
  /** A unique id for the schedule. This is used to identify and unregister the schedule later. */
1129
- id: import_zod9.z.string(),
1375
+ id: import_zod11.z.string(),
1130
1376
  /** Any additional metadata about the schedule. */
1131
- metadata: import_zod9.z.any(),
1132
- /** This will be used by the Trigger.dev Connect feature, which is coming soon. */
1133
- accountId: import_zod9.z.string().optional()
1377
+ metadata: import_zod11.z.any(),
1378
+ /** An optional Account ID to associate with runs triggered by this schedule */
1379
+ accountId: import_zod11.z.string().optional()
1134
1380
  });
1135
1381
  var RegisterIntervalScheduleBodySchema = RegisterCommonScheduleBodySchema.merge(IntervalMetadataSchema);
1136
1382
  var InitializeCronScheduleBodySchema = RegisterCommonScheduleBodySchema.merge(CronMetadataSchema);
1137
- var RegisterScheduleBodySchema = import_zod9.z.discriminatedUnion("type", [
1383
+ var RegisterScheduleBodySchema = import_zod11.z.discriminatedUnion("type", [
1138
1384
  RegisterIntervalScheduleBodySchema,
1139
1385
  InitializeCronScheduleBodySchema
1140
1386
  ]);
1141
- var RegisterScheduleResponseBodySchema = import_zod9.z.object({
1142
- id: import_zod9.z.string(),
1387
+ var RegisterScheduleResponseBodySchema = import_zod11.z.object({
1388
+ id: import_zod11.z.string(),
1143
1389
  schedule: ScheduleMetadataSchema,
1144
- metadata: import_zod9.z.any(),
1145
- active: import_zod9.z.boolean()
1390
+ metadata: import_zod11.z.any(),
1391
+ active: import_zod11.z.boolean()
1146
1392
  });
1147
- var CreateExternalConnectionBodySchema = import_zod9.z.object({
1148
- accessToken: import_zod9.z.string(),
1149
- type: import_zod9.z.enum([
1393
+ var CreateExternalConnectionBodySchema = import_zod11.z.object({
1394
+ accessToken: import_zod11.z.string(),
1395
+ type: import_zod11.z.enum([
1150
1396
  "oauth2"
1151
1397
  ]),
1152
- scopes: import_zod9.z.array(import_zod9.z.string()).optional(),
1153
- metadata: import_zod9.z.any()
1154
- });
1155
- var DeployBackgroundTaskRequestBodySchema = import_zod9.z.object({
1156
- id: import_zod9.z.string(),
1157
- version: import_zod9.z.string(),
1158
- fileName: import_zod9.z.string(),
1159
- bundle: import_zod9.z.string(),
1160
- sourcemap: import_zod9.z.object({
1161
- version: import_zod9.z.number(),
1162
- sources: import_zod9.z.array(import_zod9.z.string()),
1163
- mappings: import_zod9.z.string(),
1164
- sourcesContent: import_zod9.z.array(import_zod9.z.string()),
1165
- names: import_zod9.z.array(import_zod9.z.string())
1398
+ scopes: import_zod11.z.array(import_zod11.z.string()).optional(),
1399
+ metadata: import_zod11.z.any()
1400
+ });
1401
+ var GetRunStatusesSchema = import_zod11.z.object({
1402
+ run: import_zod11.z.object({
1403
+ id: import_zod11.z.string(),
1404
+ status: RunStatusSchema,
1405
+ output: import_zod11.z.any().optional()
1166
1406
  }),
1167
- dependencies: import_zod9.z.record(import_zod9.z.string()),
1168
- nodeVersion: import_zod9.z.string()
1407
+ statuses: import_zod11.z.array(JobRunStatusRecordSchema)
1169
1408
  });
1170
1409
 
1171
1410
  // src/schemas/notifications.ts
1172
- var import_zod10 = require("zod");
1411
+ var import_zod12 = require("zod");
1173
1412
  var MISSING_CONNECTION_NOTIFICATION = "dev.trigger.notifications.missingConnection";
1174
1413
  var MISSING_CONNECTION_RESOLVED_NOTIFICATION = "dev.trigger.notifications.missingConnectionResolved";
1175
- var CommonMissingConnectionNotificationPayloadSchema = import_zod10.z.object({
1176
- id: import_zod10.z.string(),
1177
- client: import_zod10.z.object({
1178
- id: import_zod10.z.string(),
1179
- title: import_zod10.z.string(),
1180
- scopes: import_zod10.z.array(import_zod10.z.string()),
1181
- createdAt: import_zod10.z.coerce.date(),
1182
- updatedAt: import_zod10.z.coerce.date()
1414
+ var CommonMissingConnectionNotificationPayloadSchema = import_zod12.z.object({
1415
+ id: import_zod12.z.string(),
1416
+ client: import_zod12.z.object({
1417
+ id: import_zod12.z.string(),
1418
+ title: import_zod12.z.string(),
1419
+ scopes: import_zod12.z.array(import_zod12.z.string()),
1420
+ createdAt: import_zod12.z.coerce.date(),
1421
+ updatedAt: import_zod12.z.coerce.date()
1183
1422
  }),
1184
- authorizationUrl: import_zod10.z.string()
1423
+ authorizationUrl: import_zod12.z.string()
1185
1424
  });
1186
1425
  var MissingDeveloperConnectionNotificationPayloadSchema = CommonMissingConnectionNotificationPayloadSchema.extend({
1187
- type: import_zod10.z.literal("DEVELOPER")
1426
+ type: import_zod12.z.literal("DEVELOPER")
1188
1427
  });
1189
1428
  var MissingExternalConnectionNotificationPayloadSchema = CommonMissingConnectionNotificationPayloadSchema.extend({
1190
- type: import_zod10.z.literal("EXTERNAL"),
1191
- account: import_zod10.z.object({
1192
- id: import_zod10.z.string(),
1193
- metadata: import_zod10.z.any()
1429
+ type: import_zod12.z.literal("EXTERNAL"),
1430
+ account: import_zod12.z.object({
1431
+ id: import_zod12.z.string(),
1432
+ metadata: import_zod12.z.any()
1194
1433
  })
1195
1434
  });
1196
- var MissingConnectionNotificationPayloadSchema = import_zod10.z.discriminatedUnion("type", [
1435
+ var MissingConnectionNotificationPayloadSchema = import_zod12.z.discriminatedUnion("type", [
1197
1436
  MissingDeveloperConnectionNotificationPayloadSchema,
1198
1437
  MissingExternalConnectionNotificationPayloadSchema
1199
1438
  ]);
1200
- var CommonMissingConnectionNotificationResolvedPayloadSchema = import_zod10.z.object({
1201
- id: import_zod10.z.string(),
1202
- client: import_zod10.z.object({
1203
- id: import_zod10.z.string(),
1204
- title: import_zod10.z.string(),
1205
- scopes: import_zod10.z.array(import_zod10.z.string()),
1206
- createdAt: import_zod10.z.coerce.date(),
1207
- updatedAt: import_zod10.z.coerce.date(),
1208
- integrationIdentifier: import_zod10.z.string(),
1209
- integrationAuthMethod: import_zod10.z.string()
1439
+ var CommonMissingConnectionNotificationResolvedPayloadSchema = import_zod12.z.object({
1440
+ id: import_zod12.z.string(),
1441
+ client: import_zod12.z.object({
1442
+ id: import_zod12.z.string(),
1443
+ title: import_zod12.z.string(),
1444
+ scopes: import_zod12.z.array(import_zod12.z.string()),
1445
+ createdAt: import_zod12.z.coerce.date(),
1446
+ updatedAt: import_zod12.z.coerce.date(),
1447
+ integrationIdentifier: import_zod12.z.string(),
1448
+ integrationAuthMethod: import_zod12.z.string()
1210
1449
  }),
1211
- expiresAt: import_zod10.z.coerce.date()
1450
+ expiresAt: import_zod12.z.coerce.date()
1212
1451
  });
1213
1452
  var MissingDeveloperConnectionResolvedNotificationPayloadSchema = CommonMissingConnectionNotificationResolvedPayloadSchema.extend({
1214
- type: import_zod10.z.literal("DEVELOPER")
1453
+ type: import_zod12.z.literal("DEVELOPER")
1215
1454
  });
1216
1455
  var MissingExternalConnectionResolvedNotificationPayloadSchema = CommonMissingConnectionNotificationResolvedPayloadSchema.extend({
1217
- type: import_zod10.z.literal("EXTERNAL"),
1218
- account: import_zod10.z.object({
1219
- id: import_zod10.z.string(),
1220
- metadata: import_zod10.z.any()
1456
+ type: import_zod12.z.literal("EXTERNAL"),
1457
+ account: import_zod12.z.object({
1458
+ id: import_zod12.z.string(),
1459
+ metadata: import_zod12.z.any()
1221
1460
  })
1222
1461
  });
1223
- var MissingConnectionResolvedNotificationPayloadSchema = import_zod10.z.discriminatedUnion("type", [
1462
+ var MissingConnectionResolvedNotificationPayloadSchema = import_zod12.z.discriminatedUnion("type", [
1224
1463
  MissingDeveloperConnectionResolvedNotificationPayloadSchema,
1225
1464
  MissingExternalConnectionResolvedNotificationPayloadSchema
1226
1465
  ]);
1227
1466
 
1228
1467
  // src/schemas/fetch.ts
1229
- var import_zod11 = require("zod");
1230
- var FetchRetryHeadersStrategySchema = import_zod11.z.object({
1468
+ var import_zod13 = require("zod");
1469
+ var FetchRetryHeadersStrategySchema = import_zod13.z.object({
1231
1470
  /** The `headers` strategy retries the request using info from the response headers. */
1232
- strategy: import_zod11.z.literal("headers"),
1471
+ strategy: import_zod13.z.literal("headers"),
1233
1472
  /** The header to use to determine the maximum number of times to retry the request. */
1234
- limitHeader: import_zod11.z.string(),
1473
+ limitHeader: import_zod13.z.string(),
1235
1474
  /** The header to use to determine the number of remaining retries. */
1236
- remainingHeader: import_zod11.z.string(),
1475
+ remainingHeader: import_zod13.z.string(),
1237
1476
  /** The header to use to determine the time when the number of remaining retries will be reset. */
1238
- resetHeader: import_zod11.z.string()
1477
+ resetHeader: import_zod13.z.string()
1239
1478
  });
1240
1479
  var FetchRetryBackoffStrategySchema = RetryOptionsSchema.extend({
1241
1480
  /** The `backoff` strategy retries the request with an exponential backoff. */
1242
- strategy: import_zod11.z.literal("backoff")
1481
+ strategy: import_zod13.z.literal("backoff")
1243
1482
  });
1244
- var FetchRetryStrategySchema = import_zod11.z.discriminatedUnion("strategy", [
1483
+ var FetchRetryStrategySchema = import_zod13.z.discriminatedUnion("strategy", [
1245
1484
  FetchRetryHeadersStrategySchema,
1246
1485
  FetchRetryBackoffStrategySchema
1247
1486
  ]);
1248
- var FetchRequestInitSchema = import_zod11.z.object({
1487
+ var FetchRequestInitSchema = import_zod13.z.object({
1249
1488
  /** The HTTP method to use for the request. */
1250
- method: import_zod11.z.string().optional(),
1489
+ method: import_zod13.z.string().optional(),
1251
1490
  /** 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. */
1252
- headers: import_zod11.z.record(import_zod11.z.union([
1253
- import_zod11.z.string(),
1491
+ headers: import_zod13.z.record(import_zod13.z.union([
1492
+ import_zod13.z.string(),
1254
1493
  RedactStringSchema
1255
1494
  ])).optional(),
1256
1495
  /** The body of the request. */
1257
- body: import_zod11.z.union([
1258
- import_zod11.z.string(),
1259
- import_zod11.z.instanceof(ArrayBuffer)
1496
+ body: import_zod13.z.union([
1497
+ import_zod13.z.string(),
1498
+ import_zod13.z.instanceof(ArrayBuffer)
1260
1499
  ]).optional()
1261
1500
  });
1262
- var FetchRetryOptionsSchema = import_zod11.z.record(FetchRetryStrategySchema);
1263
- var FetchOperationSchema = import_zod11.z.object({
1264
- url: import_zod11.z.string(),
1501
+ var FetchRetryOptionsSchema = import_zod13.z.record(FetchRetryStrategySchema);
1502
+ var FetchOperationSchema = import_zod13.z.object({
1503
+ url: import_zod13.z.string(),
1265
1504
  requestInit: FetchRequestInitSchema.optional(),
1266
- retry: import_zod11.z.record(FetchRetryStrategySchema).optional()
1267
- });
1268
-
1269
- // src/schemas/events.ts
1270
- var import_zod13 = require("zod");
1271
-
1272
- // src/schemas/runs.ts
1273
- var import_zod12 = require("zod");
1274
- var RunStatusSchema = import_zod12.z.union([
1275
- import_zod12.z.literal("PENDING"),
1276
- import_zod12.z.literal("QUEUED"),
1277
- import_zod12.z.literal("WAITING_ON_CONNECTIONS"),
1278
- import_zod12.z.literal("PREPROCESSING"),
1279
- import_zod12.z.literal("STARTED"),
1280
- import_zod12.z.literal("SUCCESS"),
1281
- import_zod12.z.literal("FAILURE"),
1282
- import_zod12.z.literal("TIMED_OUT"),
1283
- import_zod12.z.literal("ABORTED"),
1284
- import_zod12.z.literal("CANCELED")
1285
- ]);
1286
- var RunTaskSchema = import_zod12.z.object({
1287
- /** The Task id */
1288
- id: import_zod12.z.string(),
1289
- /** The key that you defined when creating the Task, the first param in any task. */
1290
- displayKey: import_zod12.z.string().nullable(),
1291
- /** The Task status */
1292
- status: TaskStatusSchema,
1293
- /** The name of the Task */
1294
- name: import_zod12.z.string(),
1295
- /** The icon of the Task, a string.
1296
- * For integrations, this will be a lowercase name of the company.
1297
- * Can be used with the [@trigger.dev/companyicons](https://www.npmjs.com/package/@trigger.dev/companyicons) package to display an svg. */
1298
- icon: import_zod12.z.string().nullable(),
1299
- /** When the task started */
1300
- startedAt: import_zod12.z.coerce.date().nullable(),
1301
- /** When the task completed */
1302
- completedAt: import_zod12.z.coerce.date().nullable()
1303
- });
1304
- var RunTaskWithSubtasksSchema = RunTaskSchema.extend({
1305
- subtasks: import_zod12.z.lazy(() => RunTaskWithSubtasksSchema.array()).optional()
1306
- });
1307
- var GetRunOptionsSchema = import_zod12.z.object({
1308
- /** Return subtasks, which appear in a `subtasks` array on a task. @default false */
1309
- subtasks: import_zod12.z.boolean().optional(),
1310
- /** You can use this to get more tasks, if there are more than are returned in a single batch @default undefined */
1311
- cursor: import_zod12.z.string().optional(),
1312
- /** How many tasks you want to return in one go, max 50. @default 20 */
1313
- take: import_zod12.z.number().optional()
1314
- });
1315
- var GetRunOptionsWithTaskDetailsSchema = GetRunOptionsSchema.extend({
1316
- /** If `true`, it returns the `params` and `output` of all tasks. @default false */
1317
- taskdetails: import_zod12.z.boolean().optional()
1318
- });
1319
- var RunSchema = import_zod12.z.object({
1320
- /** The Run id */
1321
- id: import_zod12.z.string(),
1322
- /** The Run status */
1323
- status: RunStatusSchema,
1324
- /** When the run started */
1325
- startedAt: import_zod12.z.coerce.date().nullable(),
1326
- /** When the run was last updated */
1327
- updatedAt: import_zod12.z.coerce.date().nullable(),
1328
- /** When the run was completed */
1329
- completedAt: import_zod12.z.coerce.date().nullable()
1330
- });
1331
- var GetRunSchema = RunSchema.extend({
1332
- /** The output of the run */
1333
- output: import_zod12.z.any().optional(),
1334
- /** The tasks from the run */
1335
- tasks: import_zod12.z.array(RunTaskWithSubtasksSchema),
1336
- /** If there are more tasks, you can use this to get them */
1337
- nextCursor: import_zod12.z.string().optional()
1338
- });
1339
- var GetRunsOptionsSchema = import_zod12.z.object({
1340
- /** You can use this to get more tasks, if there are more than are returned in a single batch @default undefined */
1341
- cursor: import_zod12.z.string().optional(),
1342
- /** How many runs you want to return in one go, max 50. @default 20 */
1343
- take: import_zod12.z.number().optional()
1344
- });
1345
- var GetRunsSchema = import_zod12.z.object({
1346
- /** The runs from the query */
1347
- runs: RunSchema.array(),
1348
- /** If there are more runs, you can use this to get them */
1349
- nextCursor: import_zod12.z.string().optional()
1505
+ retry: import_zod13.z.record(FetchRetryStrategySchema).optional()
1350
1506
  });
1351
1507
 
1352
1508
  // src/schemas/events.ts
1353
- var GetEventSchema = import_zod13.z.object({
1509
+ var import_zod14 = require("zod");
1510
+ var GetEventSchema = import_zod14.z.object({
1354
1511
  /** The event id */
1355
- id: import_zod13.z.string(),
1512
+ id: import_zod14.z.string(),
1356
1513
  /** The event name */
1357
- name: import_zod13.z.string(),
1514
+ name: import_zod14.z.string(),
1358
1515
  /** When the event was created */
1359
- createdAt: import_zod13.z.coerce.date(),
1516
+ createdAt: import_zod14.z.coerce.date(),
1360
1517
  /** When the event was last updated */
1361
- updatedAt: import_zod13.z.coerce.date(),
1518
+ updatedAt: import_zod14.z.coerce.date(),
1362
1519
  /** The runs that were triggered by the event */
1363
- runs: import_zod13.z.array(import_zod13.z.object({
1520
+ runs: import_zod14.z.array(import_zod14.z.object({
1364
1521
  /** The Run id */
1365
- id: import_zod13.z.string(),
1522
+ id: import_zod14.z.string(),
1366
1523
  /** The Run status */
1367
1524
  status: RunStatusSchema,
1368
1525
  /** When the run started */
1369
- startedAt: import_zod13.z.coerce.date().optional().nullable(),
1526
+ startedAt: import_zod14.z.coerce.date().optional().nullable(),
1370
1527
  /** When the run completed */
1371
- completedAt: import_zod13.z.coerce.date().optional().nullable()
1528
+ completedAt: import_zod14.z.coerce.date().optional().nullable()
1372
1529
  }))
1373
1530
  });
1531
+ var CancelRunsForEventSchema = import_zod14.z.object({
1532
+ cancelledRunIds: import_zod14.z.array(import_zod14.z.string()),
1533
+ failedToCancelRunIds: import_zod14.z.array(import_zod14.z.string())
1534
+ });
1374
1535
 
1375
1536
  // src/utils.ts
1376
1537
  function deepMergeFilters(...filters) {
@@ -1595,4 +1756,24 @@ function contentFilterMatches(actualValue, contentFilter) {
1595
1756
  return true;
1596
1757
  }
1597
1758
  __name(contentFilterMatches, "contentFilterMatches");
1759
+
1760
+ // src/index.ts
1761
+ var API_VERSIONS = {
1762
+ LAZY_LOADED_CACHED_TASKS: "2023-09-29"
1763
+ };
1764
+ var PLATFORM_FEATURES = {
1765
+ yieldExecution: API_VERSIONS.LAZY_LOADED_CACHED_TASKS,
1766
+ lazyLoadedCachedTasks: API_VERSIONS.LAZY_LOADED_CACHED_TASKS
1767
+ };
1768
+ function supportsFeature(featureName, version) {
1769
+ if (version === "unversioned" || version === "unknown") {
1770
+ return false;
1771
+ }
1772
+ const supportedVersion = PLATFORM_FEATURES[featureName];
1773
+ if (!supportedVersion) {
1774
+ return false;
1775
+ }
1776
+ return version >= supportedVersion;
1777
+ }
1778
+ __name(supportsFeature, "supportsFeature");
1598
1779
  //# sourceMappingURL=index.js.map