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

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