@trigger.dev/core 0.0.0-isomorphic-sdk-20230918151405 → 0.0.0-node-18-20231010094401

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
@@ -3,6 +3,7 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
7
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
8
  var __export = (target, all) => {
8
9
  for (var name in all)
@@ -17,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
17
18
  return to;
18
19
  };
19
20
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+ var __publicField = (obj, key, value) => {
22
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
23
+ return value;
24
+ };
20
25
  var __accessCheck = (obj, member, msg) => {
21
26
  if (!member.has(obj))
22
27
  throw TypeError("Cannot " + msg);
@@ -43,7 +48,9 @@ var __privateMethod = (obj, member, method) => {
43
48
  // src/index.ts
44
49
  var src_exports = {};
45
50
  __export(src_exports, {
51
+ API_VERSIONS: () => API_VERSIONS,
46
52
  ApiEventLogSchema: () => ApiEventLogSchema,
53
+ BloomFilter: () => BloomFilter,
47
54
  CachedTaskSchema: () => CachedTaskSchema,
48
55
  CommonMissingConnectionNotificationPayloadSchema: () => CommonMissingConnectionNotificationPayloadSchema,
49
56
  CommonMissingConnectionNotificationResolvedPayloadSchema: () => CommonMissingConnectionNotificationResolvedPayloadSchema,
@@ -59,6 +66,7 @@ __export(src_exports, {
59
66
  DisplayPropertySchema: () => DisplayPropertySchema,
60
67
  DynamicTriggerEndpointMetadataSchema: () => DynamicTriggerEndpointMetadataSchema,
61
68
  DynamicTriggerMetadataSchema: () => DynamicTriggerMetadataSchema,
69
+ EndpointHeadersSchema: () => EndpointHeadersSchema,
62
70
  ErrorWithStackSchema: () => ErrorWithStackSchema,
63
71
  EventExampleSchema: () => EventExampleSchema,
64
72
  EventFilterSchema: () => EventFilterSchema,
@@ -73,6 +81,7 @@ __export(src_exports, {
73
81
  FetchRetryStrategySchema: () => FetchRetryStrategySchema,
74
82
  GetEventSchema: () => GetEventSchema,
75
83
  GetRunSchema: () => GetRunSchema,
84
+ GetRunStatusesSchema: () => GetRunStatusesSchema,
76
85
  GetRunsSchema: () => GetRunsSchema,
77
86
  HandleTriggerSourceSchema: () => HandleTriggerSourceSchema,
78
87
  HttpSourceRequestHeadersSchema: () => HttpSourceRequestHeadersSchema,
@@ -86,6 +95,7 @@ __export(src_exports, {
86
95
  IntervalMetadataSchema: () => IntervalMetadataSchema,
87
96
  IntervalOptionsSchema: () => IntervalOptionsSchema,
88
97
  JobMetadataSchema: () => JobMetadataSchema,
98
+ JobRunStatusRecordSchema: () => JobRunStatusRecordSchema,
89
99
  LogMessageSchema: () => LogMessageSchema,
90
100
  Logger: () => Logger,
91
101
  MISSING_CONNECTION_NOTIFICATION: () => MISSING_CONNECTION_NOTIFICATION,
@@ -98,6 +108,7 @@ __export(src_exports, {
98
108
  MissingExternalConnectionResolvedNotificationPayloadSchema: () => MissingExternalConnectionResolvedNotificationPayloadSchema,
99
109
  NormalizedRequestSchema: () => NormalizedRequestSchema,
100
110
  NormalizedResponseSchema: () => NormalizedResponseSchema,
111
+ PLATFORM_FEATURES: () => PLATFORM_FEATURES,
101
112
  PongErrorResponseSchema: () => PongErrorResponseSchema,
102
113
  PongResponseSchema: () => PongResponseSchema,
103
114
  PongSuccessResponseSchema: () => PongSuccessResponseSchema,
@@ -126,27 +137,35 @@ __export(src_exports, {
126
137
  RunJobBodySchema: () => RunJobBodySchema,
127
138
  RunJobCanceledWithTaskSchema: () => RunJobCanceledWithTaskSchema,
128
139
  RunJobErrorSchema: () => RunJobErrorSchema,
140
+ RunJobInvalidPayloadErrorSchema: () => RunJobInvalidPayloadErrorSchema,
129
141
  RunJobResponseSchema: () => RunJobResponseSchema,
130
142
  RunJobResumeWithTaskSchema: () => RunJobResumeWithTaskSchema,
131
143
  RunJobRetryWithTaskSchema: () => RunJobRetryWithTaskSchema,
132
144
  RunJobSuccessSchema: () => RunJobSuccessSchema,
145
+ RunJobUnresolvedAuthErrorSchema: () => RunJobUnresolvedAuthErrorSchema,
146
+ RunJobYieldExecutionErrorSchema: () => RunJobYieldExecutionErrorSchema,
133
147
  RunSourceContextSchema: () => RunSourceContextSchema,
134
148
  RunStatusSchema: () => RunStatusSchema,
135
149
  RunTaskBodyInputSchema: () => RunTaskBodyInputSchema,
136
150
  RunTaskBodyOutputSchema: () => RunTaskBodyOutputSchema,
137
151
  RunTaskOptionsSchema: () => RunTaskOptionsSchema,
152
+ RunTaskResponseWithCachedTasksBodySchema: () => RunTaskResponseWithCachedTasksBodySchema,
138
153
  RunTaskSchema: () => RunTaskSchema,
139
154
  RuntimeEnvironmentTypeSchema: () => RuntimeEnvironmentTypeSchema,
140
155
  SCHEDULED_EVENT: () => SCHEDULED_EVENT,
141
156
  ScheduleMetadataSchema: () => ScheduleMetadataSchema,
142
157
  ScheduledPayloadSchema: () => ScheduledPayloadSchema,
143
158
  ScheduledTriggerMetadataSchema: () => ScheduledTriggerMetadataSchema,
159
+ SchemaErrorSchema: () => SchemaErrorSchema,
144
160
  SendEventBodySchema: () => SendEventBodySchema,
145
161
  SendEventOptionsSchema: () => SendEventOptionsSchema,
146
162
  SerializableJsonSchema: () => SerializableJsonSchema,
147
163
  ServerTaskSchema: () => ServerTaskSchema,
148
164
  SourceMetadataV2Schema: () => SourceMetadataV2Schema,
149
165
  StaticTriggerMetadataSchema: () => StaticTriggerMetadataSchema,
166
+ StatusHistorySchema: () => StatusHistorySchema,
167
+ StatusUpdateSchema: () => StatusUpdateSchema,
168
+ StatusUpdateStateSchema: () => StatusUpdateStateSchema,
150
169
  StyleSchema: () => StyleSchema,
151
170
  TaskSchema: () => TaskSchema,
152
171
  TaskStatusSchema: () => TaskStatusSchema,
@@ -165,12 +184,12 @@ __export(src_exports, {
165
184
  deepMergeFilters: () => deepMergeFilters,
166
185
  eventFilterMatches: () => eventFilterMatches,
167
186
  replacements: () => replacements,
187
+ supportsFeature: () => supportsFeature,
168
188
  urlWithSearchParams: () => urlWithSearchParams
169
189
  });
170
190
  module.exports = __toCommonJS(src_exports);
171
191
 
172
192
  // src/logger.ts
173
- var import_node_buffer = require("buffer");
174
193
  var logLevels = [
175
194
  "log",
176
195
  "error",
@@ -304,7 +323,7 @@ function prettyPrintBytes(value) {
304
323
  if (process.env.NODE_ENV === "production") {
305
324
  return "skipped size";
306
325
  }
307
- const sizeInBytes = import_node_buffer.Buffer.byteLength(JSON.stringify(value), "utf8");
326
+ const sizeInBytes = Buffer.byteLength(JSON.stringify(value), "utf8");
308
327
  if (sizeInBytes < 1024) {
309
328
  return `${sizeInBytes} bytes`;
310
329
  }
@@ -319,8 +338,8 @@ function prettyPrintBytes(value) {
319
338
  __name(prettyPrintBytes, "prettyPrintBytes");
320
339
 
321
340
  // src/schemas/api.ts
322
- var import_ulidx = require("ulidx");
323
- var import_zod9 = require("zod");
341
+ var import_ulid = require("ulid");
342
+ var import_zod11 = require("zod");
324
343
 
325
344
  // src/schemas/addMissingVersionField.ts
326
345
  function addMissingVersionField(val) {
@@ -341,6 +360,10 @@ var ErrorWithStackSchema = import_zod.z.object({
341
360
  name: import_zod.z.string().optional(),
342
361
  stack: import_zod.z.string().optional()
343
362
  });
363
+ var SchemaErrorSchema = import_zod.z.object({
364
+ path: import_zod.z.array(import_zod.z.string()),
365
+ message: import_zod.z.string()
366
+ });
344
367
 
345
368
  // src/schemas/eventFilter.ts
346
369
  var import_zod2 = require("zod");
@@ -423,7 +446,8 @@ var EventRuleSchema = import_zod2.z.object({
423
446
  var import_zod3 = require("zod");
424
447
  var ConnectionAuthSchema = import_zod3.z.object({
425
448
  type: import_zod3.z.enum([
426
- "oauth2"
449
+ "oauth2",
450
+ "apiKey"
427
451
  ]),
428
452
  accessToken: import_zod3.z.string(),
429
453
  scopes: import_zod3.z.array(import_zod3.z.string()).optional(),
@@ -439,7 +463,8 @@ var IntegrationConfigSchema = import_zod3.z.object({
439
463
  metadata: IntegrationMetadataSchema,
440
464
  authSource: import_zod3.z.enum([
441
465
  "HOSTED",
442
- "LOCAL"
466
+ "LOCAL",
467
+ "RESOLVER"
443
468
  ])
444
469
  });
445
470
 
@@ -500,8 +525,8 @@ var ScheduledPayloadSchema = import_zod6.z.object({
500
525
  lastTimestamp: import_zod6.z.coerce.date().optional()
501
526
  });
502
527
  var IntervalOptionsSchema = import_zod6.z.object({
503
- /** The number of seconds for the interval. Min = 60, Max = 86400 (1 day) */
504
- seconds: import_zod6.z.number().int().positive().min(60).max(86400)
528
+ /** The number of seconds for the interval. Min = 60, Max = 2_592_000 (30 days) */
529
+ seconds: import_zod6.z.number().int().positive().min(60).max(2592e3)
505
530
  });
506
531
  var CronOptionsSchema = import_zod6.z.object({
507
532
  /** A CRON expression that defines the schedule. A useful tool when writing CRON
@@ -512,6 +537,8 @@ var CronOptionsSchema = import_zod6.z.object({
512
537
  var CronMetadataSchema = import_zod6.z.object({
513
538
  type: import_zod6.z.literal("cron"),
514
539
  options: CronOptionsSchema,
540
+ /** An optional Account ID to associate with runs triggered by this interval */
541
+ accountId: import_zod6.z.string().optional(),
515
542
  metadata: import_zod6.z.any()
516
543
  });
517
544
  var IntervalMetadataSchema = import_zod6.z.object({
@@ -519,6 +546,8 @@ var IntervalMetadataSchema = import_zod6.z.object({
519
546
  type: import_zod6.z.literal("interval"),
520
547
  /** An object containing options about the interval. */
521
548
  options: IntervalOptionsSchema,
549
+ /** An optional Account ID to associate with runs triggered by this interval */
550
+ accountId: import_zod6.z.string().optional(),
522
551
  /** Any additional metadata about the schedule. */
523
552
  metadata: import_zod6.z.any()
524
553
  });
@@ -561,7 +590,8 @@ var TaskSchema = import_zod7.z.object({
561
590
  error: import_zod7.z.string().optional().nullable(),
562
591
  parentId: import_zod7.z.string().optional().nullable(),
563
592
  style: StyleSchema.optional().nullable(),
564
- operation: import_zod7.z.string().optional().nullable()
593
+ operation: import_zod7.z.string().optional().nullable(),
594
+ callbackUrl: import_zod7.z.string().optional().nullable()
565
595
  });
566
596
  var ServerTaskSchema = TaskSchema.extend({
567
597
  idempotencyKey: import_zod7.z.string(),
@@ -617,459 +647,613 @@ var TriggerMetadataSchema = import_zod8.z.discriminatedUnion("type", [
617
647
  ScheduledTriggerMetadataSchema
618
648
  ]);
619
649
 
650
+ // src/schemas/runs.ts
651
+ var import_zod10 = require("zod");
652
+
653
+ // src/schemas/statuses.ts
654
+ var import_zod9 = require("zod");
655
+ var StatusUpdateStateSchema = import_zod9.z.union([
656
+ import_zod9.z.literal("loading"),
657
+ import_zod9.z.literal("success"),
658
+ import_zod9.z.literal("failure")
659
+ ]);
660
+ var StatusUpdateDataSchema = import_zod9.z.record(SerializableJsonSchema);
661
+ var StatusUpdateSchema = import_zod9.z.object({
662
+ label: import_zod9.z.string().optional(),
663
+ state: StatusUpdateStateSchema.optional(),
664
+ data: StatusUpdateDataSchema.optional()
665
+ });
666
+ var InitalStatusUpdateSchema = StatusUpdateSchema.required({
667
+ label: true
668
+ });
669
+ var StatusHistorySchema = import_zod9.z.array(StatusUpdateSchema);
670
+ var JobRunStatusRecordSchema = InitalStatusUpdateSchema.extend({
671
+ key: import_zod9.z.string(),
672
+ history: StatusHistorySchema
673
+ });
674
+
675
+ // src/schemas/runs.ts
676
+ var RunStatusSchema = import_zod10.z.union([
677
+ import_zod10.z.literal("PENDING"),
678
+ import_zod10.z.literal("QUEUED"),
679
+ import_zod10.z.literal("WAITING_ON_CONNECTIONS"),
680
+ import_zod10.z.literal("PREPROCESSING"),
681
+ import_zod10.z.literal("STARTED"),
682
+ import_zod10.z.literal("SUCCESS"),
683
+ import_zod10.z.literal("FAILURE"),
684
+ import_zod10.z.literal("TIMED_OUT"),
685
+ import_zod10.z.literal("ABORTED"),
686
+ import_zod10.z.literal("CANCELED"),
687
+ import_zod10.z.literal("UNRESOLVED_AUTH"),
688
+ import_zod10.z.literal("INVALID_PAYLOAD")
689
+ ]);
690
+ var RunTaskSchema = import_zod10.z.object({
691
+ /** The Task id */
692
+ id: import_zod10.z.string(),
693
+ /** The key that you defined when creating the Task, the first param in any task. */
694
+ displayKey: import_zod10.z.string().nullable(),
695
+ /** The Task status */
696
+ status: TaskStatusSchema,
697
+ /** The name of the Task */
698
+ name: import_zod10.z.string(),
699
+ /** The icon of the Task, a string.
700
+ * For integrations, this will be a lowercase name of the company.
701
+ * Can be used with the [@trigger.dev/companyicons](https://www.npmjs.com/package/@trigger.dev/companyicons) package to display an svg. */
702
+ icon: import_zod10.z.string().nullable(),
703
+ /** When the task started */
704
+ startedAt: import_zod10.z.coerce.date().nullable(),
705
+ /** When the task completed */
706
+ completedAt: import_zod10.z.coerce.date().nullable()
707
+ });
708
+ var RunTaskWithSubtasksSchema = RunTaskSchema.extend({
709
+ subtasks: import_zod10.z.lazy(() => RunTaskWithSubtasksSchema.array()).optional()
710
+ });
711
+ var GetRunOptionsSchema = import_zod10.z.object({
712
+ /** Return subtasks, which appear in a `subtasks` array on a task. @default false */
713
+ subtasks: import_zod10.z.boolean().optional(),
714
+ /** You can use this to get more tasks, if there are more than are returned in a single batch @default undefined */
715
+ cursor: import_zod10.z.string().optional(),
716
+ /** How many tasks you want to return in one go, max 50. @default 20 */
717
+ take: import_zod10.z.number().optional()
718
+ });
719
+ var GetRunOptionsWithTaskDetailsSchema = GetRunOptionsSchema.extend({
720
+ /** If `true`, it returns the `params` and `output` of all tasks. @default false */
721
+ taskdetails: import_zod10.z.boolean().optional()
722
+ });
723
+ var RunSchema = import_zod10.z.object({
724
+ /** The Run id */
725
+ id: import_zod10.z.string(),
726
+ /** The Run status */
727
+ status: RunStatusSchema,
728
+ /** When the run started */
729
+ startedAt: import_zod10.z.coerce.date().nullable(),
730
+ /** When the run was last updated */
731
+ updatedAt: import_zod10.z.coerce.date().nullable(),
732
+ /** When the run was completed */
733
+ completedAt: import_zod10.z.coerce.date().nullable()
734
+ });
735
+ var GetRunSchema = RunSchema.extend({
736
+ /** The output of the run */
737
+ output: import_zod10.z.any().optional(),
738
+ /** The tasks from the run */
739
+ tasks: import_zod10.z.array(RunTaskWithSubtasksSchema),
740
+ /** Any status updates that were published from the run */
741
+ statuses: import_zod10.z.array(JobRunStatusRecordSchema).default([]),
742
+ /** If there are more tasks, you can use this to get them */
743
+ nextCursor: import_zod10.z.string().optional()
744
+ });
745
+ var GetRunsOptionsSchema = import_zod10.z.object({
746
+ /** You can use this to get more tasks, if there are more than are returned in a single batch @default undefined */
747
+ cursor: import_zod10.z.string().optional(),
748
+ /** How many runs you want to return in one go, max 50. @default 20 */
749
+ take: import_zod10.z.number().optional()
750
+ });
751
+ var GetRunsSchema = import_zod10.z.object({
752
+ /** The runs from the query */
753
+ runs: RunSchema.array(),
754
+ /** If there are more runs, you can use this to get them */
755
+ nextCursor: import_zod10.z.string().optional()
756
+ });
757
+
620
758
  // src/schemas/api.ts
621
- var UpdateTriggerSourceBodyV1Schema = import_zod9.z.object({
622
- registeredEvents: import_zod9.z.array(import_zod9.z.string()),
623
- secret: import_zod9.z.string().optional(),
759
+ var UpdateTriggerSourceBodyV1Schema = import_zod11.z.object({
760
+ registeredEvents: import_zod11.z.array(import_zod11.z.string()),
761
+ secret: import_zod11.z.string().optional(),
624
762
  data: SerializableJsonSchema.optional()
625
763
  });
626
- var UpdateTriggerSourceBodyV2Schema = import_zod9.z.object({
627
- secret: import_zod9.z.string().optional(),
764
+ var UpdateTriggerSourceBodyV2Schema = import_zod11.z.object({
765
+ secret: import_zod11.z.string().optional(),
628
766
  data: SerializableJsonSchema.optional(),
629
- options: import_zod9.z.object({
630
- event: import_zod9.z.array(import_zod9.z.string())
631
- }).and(import_zod9.z.record(import_zod9.z.string(), import_zod9.z.array(import_zod9.z.string())).optional())
767
+ options: import_zod11.z.object({
768
+ event: import_zod11.z.array(import_zod11.z.string())
769
+ }).and(import_zod11.z.record(import_zod11.z.string(), import_zod11.z.array(import_zod11.z.string())).optional())
632
770
  });
633
- var RegisterHTTPTriggerSourceBodySchema = import_zod9.z.object({
634
- type: import_zod9.z.literal("HTTP"),
635
- url: import_zod9.z.string().url()
771
+ var RegisterHTTPTriggerSourceBodySchema = import_zod11.z.object({
772
+ type: import_zod11.z.literal("HTTP"),
773
+ url: import_zod11.z.string().url()
636
774
  });
637
- var RegisterSMTPTriggerSourceBodySchema = import_zod9.z.object({
638
- type: import_zod9.z.literal("SMTP")
775
+ var RegisterSMTPTriggerSourceBodySchema = import_zod11.z.object({
776
+ type: import_zod11.z.literal("SMTP")
639
777
  });
640
- var RegisterSQSTriggerSourceBodySchema = import_zod9.z.object({
641
- type: import_zod9.z.literal("SQS")
778
+ var RegisterSQSTriggerSourceBodySchema = import_zod11.z.object({
779
+ type: import_zod11.z.literal("SQS")
642
780
  });
643
- var RegisterSourceChannelBodySchema = import_zod9.z.discriminatedUnion("type", [
781
+ var RegisterSourceChannelBodySchema = import_zod11.z.discriminatedUnion("type", [
644
782
  RegisterHTTPTriggerSourceBodySchema,
645
783
  RegisterSMTPTriggerSourceBodySchema,
646
784
  RegisterSQSTriggerSourceBodySchema
647
785
  ]);
648
786
  var REGISTER_SOURCE_EVENT_V1 = "dev.trigger.source.register";
649
787
  var REGISTER_SOURCE_EVENT_V2 = "dev.trigger.source.register.v2";
650
- var RegisterTriggerSourceSchema = import_zod9.z.object({
651
- key: import_zod9.z.string(),
652
- params: import_zod9.z.any(),
653
- active: import_zod9.z.boolean(),
654
- secret: import_zod9.z.string(),
788
+ var RegisterTriggerSourceSchema = import_zod11.z.object({
789
+ key: import_zod11.z.string(),
790
+ params: import_zod11.z.any(),
791
+ active: import_zod11.z.boolean(),
792
+ secret: import_zod11.z.string(),
655
793
  data: DeserializedJsonSchema.optional(),
656
794
  channel: RegisterSourceChannelBodySchema,
657
- clientId: import_zod9.z.string().optional()
795
+ clientId: import_zod11.z.string().optional()
658
796
  });
659
- var SourceEventOptionSchema = import_zod9.z.object({
660
- name: import_zod9.z.string(),
661
- value: import_zod9.z.string()
797
+ var SourceEventOptionSchema = import_zod11.z.object({
798
+ name: import_zod11.z.string(),
799
+ value: import_zod11.z.string()
662
800
  });
663
- var RegisterSourceEventSchemaV1 = import_zod9.z.object({
801
+ var RegisterSourceEventSchemaV1 = import_zod11.z.object({
664
802
  /** The id of the source */
665
- id: import_zod9.z.string(),
803
+ id: import_zod11.z.string(),
666
804
  source: RegisterTriggerSourceSchema,
667
- events: import_zod9.z.array(import_zod9.z.string()),
668
- missingEvents: import_zod9.z.array(import_zod9.z.string()),
669
- orphanedEvents: import_zod9.z.array(import_zod9.z.string()),
670
- dynamicTriggerId: import_zod9.z.string().optional()
805
+ events: import_zod11.z.array(import_zod11.z.string()),
806
+ missingEvents: import_zod11.z.array(import_zod11.z.string()),
807
+ orphanedEvents: import_zod11.z.array(import_zod11.z.string()),
808
+ dynamicTriggerId: import_zod11.z.string().optional()
671
809
  });
672
- var RegisteredOptionsDiffSchema = import_zod9.z.object({
673
- desired: import_zod9.z.array(import_zod9.z.string()),
674
- missing: import_zod9.z.array(import_zod9.z.string()),
675
- orphaned: import_zod9.z.array(import_zod9.z.string())
810
+ var RegisteredOptionsDiffSchema = import_zod11.z.object({
811
+ desired: import_zod11.z.array(import_zod11.z.string()),
812
+ missing: import_zod11.z.array(import_zod11.z.string()),
813
+ orphaned: import_zod11.z.array(import_zod11.z.string())
676
814
  });
677
- var RegisterSourceEventOptionsSchema = import_zod9.z.object({
815
+ var RegisterSourceEventOptionsSchema = import_zod11.z.object({
678
816
  event: RegisteredOptionsDiffSchema
679
- }).and(import_zod9.z.record(import_zod9.z.string(), RegisteredOptionsDiffSchema));
680
- var RegisterSourceEventSchemaV2 = import_zod9.z.object({
817
+ }).and(import_zod11.z.record(import_zod11.z.string(), RegisteredOptionsDiffSchema));
818
+ var RegisterSourceEventSchemaV2 = import_zod11.z.object({
681
819
  /** The id of the source */
682
- id: import_zod9.z.string(),
820
+ id: import_zod11.z.string(),
683
821
  source: RegisterTriggerSourceSchema,
684
822
  options: RegisterSourceEventOptionsSchema,
685
- dynamicTriggerId: import_zod9.z.string().optional()
823
+ dynamicTriggerId: import_zod11.z.string().optional()
686
824
  });
687
- var TriggerSourceSchema = import_zod9.z.object({
688
- id: import_zod9.z.string(),
689
- key: import_zod9.z.string()
825
+ var TriggerSourceSchema = import_zod11.z.object({
826
+ id: import_zod11.z.string(),
827
+ key: import_zod11.z.string()
690
828
  });
691
829
  var HttpSourceResponseMetadataSchema = DeserializedJsonSchema;
692
- var HandleTriggerSourceSchema = import_zod9.z.object({
693
- key: import_zod9.z.string(),
694
- secret: import_zod9.z.string(),
695
- data: import_zod9.z.any(),
696
- params: import_zod9.z.any(),
830
+ var HandleTriggerSourceSchema = import_zod11.z.object({
831
+ key: import_zod11.z.string(),
832
+ secret: import_zod11.z.string(),
833
+ data: import_zod11.z.any(),
834
+ params: import_zod11.z.any(),
697
835
  auth: ConnectionAuthSchema.optional(),
698
836
  metadata: HttpSourceResponseMetadataSchema.optional()
699
837
  });
700
- var HttpSourceRequestSchema = import_zod9.z.object({
701
- url: import_zod9.z.string().url(),
702
- method: import_zod9.z.string(),
703
- headers: import_zod9.z.record(import_zod9.z.string()),
704
- rawBody: import_zod9.z.instanceof(Uint8Array).optional().nullable()
705
- });
706
- var HttpSourceRequestHeadersSchema = import_zod9.z.object({
707
- "x-ts-key": import_zod9.z.string(),
708
- "x-ts-dynamic-id": import_zod9.z.string().optional(),
709
- "x-ts-secret": import_zod9.z.string(),
710
- "x-ts-data": import_zod9.z.string().transform((s) => JSON.parse(s)),
711
- "x-ts-params": import_zod9.z.string().transform((s) => JSON.parse(s)),
712
- "x-ts-http-url": import_zod9.z.string(),
713
- "x-ts-http-method": import_zod9.z.string(),
714
- "x-ts-http-headers": import_zod9.z.string().transform((s) => import_zod9.z.record(import_zod9.z.string()).parse(JSON.parse(s))),
715
- "x-ts-auth": import_zod9.z.string().optional().transform((s) => {
838
+ var HttpSourceRequestSchema = import_zod11.z.object({
839
+ url: import_zod11.z.string().url(),
840
+ method: import_zod11.z.string(),
841
+ headers: import_zod11.z.record(import_zod11.z.string()),
842
+ rawBody: import_zod11.z.instanceof(Buffer).optional().nullable()
843
+ });
844
+ var HttpSourceRequestHeadersSchema = import_zod11.z.object({
845
+ "x-ts-key": import_zod11.z.string(),
846
+ "x-ts-dynamic-id": import_zod11.z.string().optional(),
847
+ "x-ts-secret": import_zod11.z.string(),
848
+ "x-ts-data": import_zod11.z.string().transform((s) => JSON.parse(s)),
849
+ "x-ts-params": import_zod11.z.string().transform((s) => JSON.parse(s)),
850
+ "x-ts-http-url": import_zod11.z.string(),
851
+ "x-ts-http-method": import_zod11.z.string(),
852
+ "x-ts-http-headers": import_zod11.z.string().transform((s) => import_zod11.z.record(import_zod11.z.string()).parse(JSON.parse(s))),
853
+ "x-ts-auth": import_zod11.z.string().optional().transform((s) => {
716
854
  if (s === void 0)
717
855
  return;
718
856
  const json = JSON.parse(s);
719
857
  return ConnectionAuthSchema.parse(json);
720
858
  }),
721
- "x-ts-metadata": import_zod9.z.string().optional().transform((s) => {
859
+ "x-ts-metadata": import_zod11.z.string().optional().transform((s) => {
722
860
  if (s === void 0)
723
861
  return;
724
862
  const json = JSON.parse(s);
725
863
  return DeserializedJsonSchema.parse(json);
726
864
  })
727
865
  });
728
- var PongSuccessResponseSchema = import_zod9.z.object({
729
- ok: import_zod9.z.literal(true)
866
+ var PongSuccessResponseSchema = import_zod11.z.object({
867
+ ok: import_zod11.z.literal(true),
868
+ triggerVersion: import_zod11.z.string().optional()
730
869
  });
731
- var PongErrorResponseSchema = import_zod9.z.object({
732
- ok: import_zod9.z.literal(false),
733
- error: import_zod9.z.string()
870
+ var PongErrorResponseSchema = import_zod11.z.object({
871
+ ok: import_zod11.z.literal(false),
872
+ error: import_zod11.z.string(),
873
+ triggerVersion: import_zod11.z.string().optional()
734
874
  });
735
- var PongResponseSchema = import_zod9.z.discriminatedUnion("ok", [
875
+ var PongResponseSchema = import_zod11.z.discriminatedUnion("ok", [
736
876
  PongSuccessResponseSchema,
737
877
  PongErrorResponseSchema
738
878
  ]);
739
- var ValidateSuccessResponseSchema = import_zod9.z.object({
740
- ok: import_zod9.z.literal(true),
741
- endpointId: import_zod9.z.string()
879
+ var ValidateSuccessResponseSchema = import_zod11.z.object({
880
+ ok: import_zod11.z.literal(true),
881
+ endpointId: import_zod11.z.string(),
882
+ triggerVersion: import_zod11.z.string().optional()
742
883
  });
743
- var ValidateErrorResponseSchema = import_zod9.z.object({
744
- ok: import_zod9.z.literal(false),
745
- error: import_zod9.z.string()
884
+ var ValidateErrorResponseSchema = import_zod11.z.object({
885
+ ok: import_zod11.z.literal(false),
886
+ error: import_zod11.z.string(),
887
+ triggerVersion: import_zod11.z.string().optional()
746
888
  });
747
- var ValidateResponseSchema = import_zod9.z.discriminatedUnion("ok", [
889
+ var ValidateResponseSchema = import_zod11.z.discriminatedUnion("ok", [
748
890
  ValidateSuccessResponseSchema,
749
891
  ValidateErrorResponseSchema
750
892
  ]);
751
- var QueueOptionsSchema = import_zod9.z.object({
752
- name: import_zod9.z.string(),
753
- maxConcurrent: import_zod9.z.number().optional()
754
- });
755
- var JobMetadataSchema = import_zod9.z.object({
756
- id: import_zod9.z.string(),
757
- name: import_zod9.z.string(),
758
- version: import_zod9.z.string(),
893
+ var QueueOptionsSchema = import_zod11.z.object({
894
+ name: import_zod11.z.string(),
895
+ maxConcurrent: import_zod11.z.number().optional()
896
+ });
897
+ var JobMetadataSchema = import_zod11.z.object({
898
+ id: import_zod11.z.string(),
899
+ name: import_zod11.z.string(),
900
+ version: import_zod11.z.string(),
759
901
  event: EventSpecificationSchema,
760
902
  trigger: TriggerMetadataSchema,
761
- integrations: import_zod9.z.record(IntegrationConfigSchema),
762
- internal: import_zod9.z.boolean().default(false),
763
- enabled: import_zod9.z.boolean(),
764
- startPosition: import_zod9.z.enum([
903
+ integrations: import_zod11.z.record(IntegrationConfigSchema),
904
+ internal: import_zod11.z.boolean().default(false),
905
+ enabled: import_zod11.z.boolean(),
906
+ startPosition: import_zod11.z.enum([
765
907
  "initial",
766
908
  "latest"
767
909
  ]),
768
- preprocessRuns: import_zod9.z.boolean()
910
+ preprocessRuns: import_zod11.z.boolean()
769
911
  });
770
- var SourceMetadataV1Schema = import_zod9.z.object({
771
- version: import_zod9.z.literal("1"),
772
- channel: import_zod9.z.enum([
912
+ var SourceMetadataV1Schema = import_zod11.z.object({
913
+ version: import_zod11.z.literal("1"),
914
+ channel: import_zod11.z.enum([
773
915
  "HTTP",
774
916
  "SQS",
775
917
  "SMTP"
776
918
  ]),
777
919
  integration: IntegrationConfigSchema,
778
- key: import_zod9.z.string(),
779
- params: import_zod9.z.any(),
780
- events: import_zod9.z.array(import_zod9.z.string()),
781
- registerSourceJob: import_zod9.z.object({
782
- id: import_zod9.z.string(),
783
- version: import_zod9.z.string()
920
+ key: import_zod11.z.string(),
921
+ params: import_zod11.z.any(),
922
+ events: import_zod11.z.array(import_zod11.z.string()),
923
+ registerSourceJob: import_zod11.z.object({
924
+ id: import_zod11.z.string(),
925
+ version: import_zod11.z.string()
784
926
  }).optional()
785
927
  });
786
- var SourceMetadataV2Schema = import_zod9.z.object({
787
- version: import_zod9.z.literal("2"),
788
- channel: import_zod9.z.enum([
928
+ var SourceMetadataV2Schema = import_zod11.z.object({
929
+ version: import_zod11.z.literal("2"),
930
+ channel: import_zod11.z.enum([
789
931
  "HTTP",
790
932
  "SQS",
791
933
  "SMTP"
792
934
  ]),
793
935
  integration: IntegrationConfigSchema,
794
- key: import_zod9.z.string(),
795
- params: import_zod9.z.any(),
796
- options: import_zod9.z.record(import_zod9.z.array(import_zod9.z.string())),
797
- registerSourceJob: import_zod9.z.object({
798
- id: import_zod9.z.string(),
799
- version: import_zod9.z.string()
936
+ key: import_zod11.z.string(),
937
+ params: import_zod11.z.any(),
938
+ options: import_zod11.z.record(import_zod11.z.array(import_zod11.z.string())),
939
+ registerSourceJob: import_zod11.z.object({
940
+ id: import_zod11.z.string(),
941
+ version: import_zod11.z.string()
800
942
  }).optional()
801
943
  });
802
- var SourceMetadataSchema = import_zod9.z.preprocess(addMissingVersionField, import_zod9.z.discriminatedUnion("version", [
944
+ var SourceMetadataSchema = import_zod11.z.preprocess(addMissingVersionField, import_zod11.z.discriminatedUnion("version", [
803
945
  SourceMetadataV1Schema,
804
946
  SourceMetadataV2Schema
805
947
  ]));
806
- var DynamicTriggerEndpointMetadataSchema = import_zod9.z.object({
807
- id: import_zod9.z.string(),
808
- jobs: import_zod9.z.array(JobMetadataSchema.pick({
948
+ var DynamicTriggerEndpointMetadataSchema = import_zod11.z.object({
949
+ id: import_zod11.z.string(),
950
+ jobs: import_zod11.z.array(JobMetadataSchema.pick({
809
951
  id: true,
810
952
  version: true
811
953
  })),
812
- registerSourceJob: import_zod9.z.object({
813
- id: import_zod9.z.string(),
814
- version: import_zod9.z.string()
954
+ registerSourceJob: import_zod11.z.object({
955
+ id: import_zod11.z.string(),
956
+ version: import_zod11.z.string()
815
957
  }).optional()
816
958
  });
817
- var IndexEndpointResponseSchema = import_zod9.z.object({
818
- jobs: import_zod9.z.array(JobMetadataSchema),
819
- sources: import_zod9.z.array(SourceMetadataSchema),
820
- dynamicTriggers: import_zod9.z.array(DynamicTriggerEndpointMetadataSchema),
821
- dynamicSchedules: import_zod9.z.array(RegisterDynamicSchedulePayloadSchema)
959
+ var IndexEndpointResponseSchema = import_zod11.z.object({
960
+ jobs: import_zod11.z.array(JobMetadataSchema),
961
+ sources: import_zod11.z.array(SourceMetadataSchema),
962
+ dynamicTriggers: import_zod11.z.array(DynamicTriggerEndpointMetadataSchema),
963
+ dynamicSchedules: import_zod11.z.array(RegisterDynamicSchedulePayloadSchema)
964
+ });
965
+ var EndpointHeadersSchema = import_zod11.z.object({
966
+ "trigger-version": import_zod11.z.string().optional()
822
967
  });
823
- var RawEventSchema = import_zod9.z.object({
968
+ var RawEventSchema = import_zod11.z.object({
824
969
  /** The `name` property must exactly match any subscriptions you want to
825
970
  trigger. */
826
- name: import_zod9.z.string(),
971
+ name: import_zod11.z.string(),
827
972
  /** The `payload` property will be sent to any matching Jobs and will appear
828
973
  as the `payload` param of the `run()` function. You can leave this
829
974
  parameter out if you just want to trigger a Job without any input data. */
830
- payload: import_zod9.z.any(),
975
+ payload: import_zod11.z.any(),
831
976
  /** The optional `context` property will be sent to any matching Jobs and will
832
977
  be passed through as the `context.event.context` param of the `run()`
833
978
  function. This is optional but can be useful if you want to pass through
834
979
  some additional context to the Job. */
835
- context: import_zod9.z.any().optional(),
980
+ context: import_zod11.z.any().optional(),
836
981
  /** The `id` property uniquely identify this particular event. If unset it
837
982
  will be set automatically using `ulid`. */
838
- id: import_zod9.z.string().default(() => (0, import_ulidx.ulid)()),
983
+ id: import_zod11.z.string().default(() => (0, import_ulid.ulid)()),
839
984
  /** This is optional, it defaults to the current timestamp. Usually you would
840
985
  only set this if you have a timestamp that you wish to pass through, e.g.
841
986
  you receive a timestamp from a service and you want the same timestamp to
842
987
  be used in your Job. */
843
- timestamp: import_zod9.z.coerce.date().optional(),
988
+ timestamp: import_zod11.z.coerce.date().optional(),
844
989
  /** This is optional, it defaults to "trigger.dev". It can be useful to set
845
990
  this as you can filter events using this in the `eventTrigger()`. */
846
- source: import_zod9.z.string().optional()
991
+ source: import_zod11.z.string().optional()
847
992
  });
848
- var ApiEventLogSchema = import_zod9.z.object({
993
+ var ApiEventLogSchema = import_zod11.z.object({
849
994
  /** The `id` of the event that was sent.
850
995
  */
851
- id: import_zod9.z.string(),
996
+ id: import_zod11.z.string(),
852
997
  /** The `name` of the event that was sent. */
853
- name: import_zod9.z.string(),
998
+ name: import_zod11.z.string(),
854
999
  /** The `payload` of the event that was sent */
855
1000
  payload: DeserializedJsonSchema,
856
1001
  /** The `context` of the event that was sent. Is `undefined` if no context was
857
1002
  set when sending the event. */
858
1003
  context: DeserializedJsonSchema.optional().nullable(),
859
1004
  /** The `timestamp` of the event that was sent */
860
- timestamp: import_zod9.z.coerce.date(),
1005
+ timestamp: import_zod11.z.coerce.date(),
861
1006
  /** The timestamp when the event will be delivered to any matching Jobs. Is
862
1007
  `undefined` if `deliverAt` or `deliverAfter` wasn't set when sending the
863
1008
  event. */
864
- deliverAt: import_zod9.z.coerce.date().optional().nullable(),
1009
+ deliverAt: import_zod11.z.coerce.date().optional().nullable(),
865
1010
  /** The timestamp when the event was delivered. Is `undefined` if `deliverAt`
866
1011
  or `deliverAfter` were set when sending the event. */
867
- deliveredAt: import_zod9.z.coerce.date().optional().nullable(),
1012
+ deliveredAt: import_zod11.z.coerce.date().optional().nullable(),
868
1013
  /** The timestamp when the event was cancelled. Is `undefined` if the event
869
1014
  * wasn't cancelled. */
870
- cancelledAt: import_zod9.z.coerce.date().optional().nullable()
1015
+ cancelledAt: import_zod11.z.coerce.date().optional().nullable()
871
1016
  });
872
- var SendEventOptionsSchema = import_zod9.z.object({
1017
+ var SendEventOptionsSchema = import_zod11.z.object({
873
1018
  /** An optional Date when you want the event to trigger Jobs. The event will
874
1019
  be sent to the platform immediately but won't be acted upon until the
875
1020
  specified time. */
876
- deliverAt: import_zod9.z.coerce.date().optional(),
1021
+ deliverAt: import_zod11.z.coerce.date().optional(),
877
1022
  /** An optional number of seconds you want to wait for the event to trigger
878
1023
  any relevant Jobs. The event will be sent to the platform immediately but
879
1024
  won't be delivered until after the elapsed number of seconds. */
880
- deliverAfter: import_zod9.z.number().int().optional(),
1025
+ deliverAfter: import_zod11.z.number().int().optional(),
881
1026
  /** This optional param will be used by Trigger.dev Connect, which
882
1027
  is coming soon. */
883
- accountId: import_zod9.z.string().optional()
1028
+ accountId: import_zod11.z.string().optional()
884
1029
  });
885
- var SendEventBodySchema = import_zod9.z.object({
1030
+ var SendEventBodySchema = import_zod11.z.object({
886
1031
  event: RawEventSchema,
887
1032
  options: SendEventOptionsSchema.optional()
888
1033
  });
889
- var DeliverEventResponseSchema = import_zod9.z.object({
890
- deliveredAt: import_zod9.z.string().datetime()
1034
+ var DeliverEventResponseSchema = import_zod11.z.object({
1035
+ deliveredAt: import_zod11.z.string().datetime()
891
1036
  });
892
- var RuntimeEnvironmentTypeSchema = import_zod9.z.enum([
1037
+ var RuntimeEnvironmentTypeSchema = import_zod11.z.enum([
893
1038
  "PRODUCTION",
894
1039
  "STAGING",
895
1040
  "DEVELOPMENT",
896
1041
  "PREVIEW"
897
1042
  ]);
898
- var RunSourceContextSchema = import_zod9.z.object({
899
- id: import_zod9.z.string(),
900
- metadata: import_zod9.z.any()
1043
+ var RunSourceContextSchema = import_zod11.z.object({
1044
+ id: import_zod11.z.string(),
1045
+ metadata: import_zod11.z.any()
901
1046
  });
902
- var RunJobBodySchema = import_zod9.z.object({
1047
+ var RunJobBodySchema = import_zod11.z.object({
903
1048
  event: ApiEventLogSchema,
904
- job: import_zod9.z.object({
905
- id: import_zod9.z.string(),
906
- version: import_zod9.z.string()
1049
+ job: import_zod11.z.object({
1050
+ id: import_zod11.z.string(),
1051
+ version: import_zod11.z.string()
907
1052
  }),
908
- run: import_zod9.z.object({
909
- id: import_zod9.z.string(),
910
- isTest: import_zod9.z.boolean(),
911
- isRetry: import_zod9.z.boolean().default(false),
912
- startedAt: import_zod9.z.coerce.date()
1053
+ run: import_zod11.z.object({
1054
+ id: import_zod11.z.string(),
1055
+ isTest: import_zod11.z.boolean(),
1056
+ isRetry: import_zod11.z.boolean().default(false),
1057
+ startedAt: import_zod11.z.coerce.date()
913
1058
  }),
914
- environment: import_zod9.z.object({
915
- id: import_zod9.z.string(),
916
- slug: import_zod9.z.string(),
1059
+ environment: import_zod11.z.object({
1060
+ id: import_zod11.z.string(),
1061
+ slug: import_zod11.z.string(),
917
1062
  type: RuntimeEnvironmentTypeSchema
918
1063
  }),
919
- organization: import_zod9.z.object({
920
- id: import_zod9.z.string(),
921
- title: import_zod9.z.string(),
922
- slug: import_zod9.z.string()
1064
+ organization: import_zod11.z.object({
1065
+ id: import_zod11.z.string(),
1066
+ title: import_zod11.z.string(),
1067
+ slug: import_zod11.z.string()
923
1068
  }),
924
- account: import_zod9.z.object({
925
- id: import_zod9.z.string(),
926
- metadata: import_zod9.z.any()
1069
+ account: import_zod11.z.object({
1070
+ id: import_zod11.z.string(),
1071
+ metadata: import_zod11.z.any()
927
1072
  }).optional(),
928
1073
  source: RunSourceContextSchema.optional(),
929
- tasks: import_zod9.z.array(CachedTaskSchema).optional(),
930
- connections: import_zod9.z.record(ConnectionAuthSchema).optional()
931
- });
932
- var RunJobErrorSchema = import_zod9.z.object({
933
- status: import_zod9.z.literal("ERROR"),
1074
+ tasks: import_zod11.z.array(CachedTaskSchema).optional(),
1075
+ cachedTaskCursor: import_zod11.z.string().optional(),
1076
+ noopTasksSet: import_zod11.z.string().optional(),
1077
+ connections: import_zod11.z.record(ConnectionAuthSchema).optional(),
1078
+ yieldedExecutions: import_zod11.z.string().array().optional()
1079
+ });
1080
+ var RunJobErrorSchema = import_zod11.z.object({
1081
+ status: import_zod11.z.literal("ERROR"),
934
1082
  error: ErrorWithStackSchema,
935
1083
  task: TaskSchema.optional()
936
1084
  });
937
- var RunJobResumeWithTaskSchema = import_zod9.z.object({
938
- status: import_zod9.z.literal("RESUME_WITH_TASK"),
1085
+ var RunJobYieldExecutionErrorSchema = import_zod11.z.object({
1086
+ status: import_zod11.z.literal("YIELD_EXECUTION"),
1087
+ key: import_zod11.z.string()
1088
+ });
1089
+ var RunJobInvalidPayloadErrorSchema = import_zod11.z.object({
1090
+ status: import_zod11.z.literal("INVALID_PAYLOAD"),
1091
+ errors: import_zod11.z.array(SchemaErrorSchema)
1092
+ });
1093
+ var RunJobUnresolvedAuthErrorSchema = import_zod11.z.object({
1094
+ status: import_zod11.z.literal("UNRESOLVED_AUTH_ERROR"),
1095
+ issues: import_zod11.z.record(import_zod11.z.object({
1096
+ id: import_zod11.z.string(),
1097
+ error: import_zod11.z.string()
1098
+ }))
1099
+ });
1100
+ var RunJobResumeWithTaskSchema = import_zod11.z.object({
1101
+ status: import_zod11.z.literal("RESUME_WITH_TASK"),
939
1102
  task: TaskSchema
940
1103
  });
941
- var RunJobRetryWithTaskSchema = import_zod9.z.object({
942
- status: import_zod9.z.literal("RETRY_WITH_TASK"),
1104
+ var RunJobRetryWithTaskSchema = import_zod11.z.object({
1105
+ status: import_zod11.z.literal("RETRY_WITH_TASK"),
943
1106
  task: TaskSchema,
944
1107
  error: ErrorWithStackSchema,
945
- retryAt: import_zod9.z.coerce.date()
1108
+ retryAt: import_zod11.z.coerce.date()
946
1109
  });
947
- var RunJobCanceledWithTaskSchema = import_zod9.z.object({
948
- status: import_zod9.z.literal("CANCELED"),
1110
+ var RunJobCanceledWithTaskSchema = import_zod11.z.object({
1111
+ status: import_zod11.z.literal("CANCELED"),
949
1112
  task: TaskSchema
950
1113
  });
951
- var RunJobSuccessSchema = import_zod9.z.object({
952
- status: import_zod9.z.literal("SUCCESS"),
1114
+ var RunJobSuccessSchema = import_zod11.z.object({
1115
+ status: import_zod11.z.literal("SUCCESS"),
953
1116
  output: DeserializedJsonSchema.optional()
954
1117
  });
955
- var RunJobResponseSchema = import_zod9.z.discriminatedUnion("status", [
1118
+ var RunJobResponseSchema = import_zod11.z.discriminatedUnion("status", [
1119
+ RunJobYieldExecutionErrorSchema,
956
1120
  RunJobErrorSchema,
1121
+ RunJobUnresolvedAuthErrorSchema,
1122
+ RunJobInvalidPayloadErrorSchema,
957
1123
  RunJobResumeWithTaskSchema,
958
1124
  RunJobRetryWithTaskSchema,
959
1125
  RunJobCanceledWithTaskSchema,
960
1126
  RunJobSuccessSchema
961
1127
  ]);
962
- var PreprocessRunBodySchema = import_zod9.z.object({
1128
+ var PreprocessRunBodySchema = import_zod11.z.object({
963
1129
  event: ApiEventLogSchema,
964
- job: import_zod9.z.object({
965
- id: import_zod9.z.string(),
966
- version: import_zod9.z.string()
1130
+ job: import_zod11.z.object({
1131
+ id: import_zod11.z.string(),
1132
+ version: import_zod11.z.string()
967
1133
  }),
968
- run: import_zod9.z.object({
969
- id: import_zod9.z.string(),
970
- isTest: import_zod9.z.boolean()
1134
+ run: import_zod11.z.object({
1135
+ id: import_zod11.z.string(),
1136
+ isTest: import_zod11.z.boolean()
971
1137
  }),
972
- environment: import_zod9.z.object({
973
- id: import_zod9.z.string(),
974
- slug: import_zod9.z.string(),
1138
+ environment: import_zod11.z.object({
1139
+ id: import_zod11.z.string(),
1140
+ slug: import_zod11.z.string(),
975
1141
  type: RuntimeEnvironmentTypeSchema
976
1142
  }),
977
- organization: import_zod9.z.object({
978
- id: import_zod9.z.string(),
979
- title: import_zod9.z.string(),
980
- slug: import_zod9.z.string()
1143
+ organization: import_zod11.z.object({
1144
+ id: import_zod11.z.string(),
1145
+ title: import_zod11.z.string(),
1146
+ slug: import_zod11.z.string()
981
1147
  }),
982
- account: import_zod9.z.object({
983
- id: import_zod9.z.string(),
984
- metadata: import_zod9.z.any()
1148
+ account: import_zod11.z.object({
1149
+ id: import_zod11.z.string(),
1150
+ metadata: import_zod11.z.any()
985
1151
  }).optional()
986
1152
  });
987
- var PreprocessRunResponseSchema = import_zod9.z.object({
988
- abort: import_zod9.z.boolean(),
989
- properties: import_zod9.z.array(DisplayPropertySchema).optional()
1153
+ var PreprocessRunResponseSchema = import_zod11.z.object({
1154
+ abort: import_zod11.z.boolean(),
1155
+ properties: import_zod11.z.array(DisplayPropertySchema).optional()
990
1156
  });
991
- var CreateRunResponseOkSchema = import_zod9.z.object({
992
- ok: import_zod9.z.literal(true),
993
- data: import_zod9.z.object({
994
- id: import_zod9.z.string()
1157
+ var CreateRunResponseOkSchema = import_zod11.z.object({
1158
+ ok: import_zod11.z.literal(true),
1159
+ data: import_zod11.z.object({
1160
+ id: import_zod11.z.string()
995
1161
  })
996
1162
  });
997
- var CreateRunResponseErrorSchema = import_zod9.z.object({
998
- ok: import_zod9.z.literal(false),
999
- error: import_zod9.z.string()
1163
+ var CreateRunResponseErrorSchema = import_zod11.z.object({
1164
+ ok: import_zod11.z.literal(false),
1165
+ error: import_zod11.z.string()
1000
1166
  });
1001
- var CreateRunResponseBodySchema = import_zod9.z.discriminatedUnion("ok", [
1167
+ var CreateRunResponseBodySchema = import_zod11.z.discriminatedUnion("ok", [
1002
1168
  CreateRunResponseOkSchema,
1003
1169
  CreateRunResponseErrorSchema
1004
1170
  ]);
1005
- var RedactStringSchema = import_zod9.z.object({
1006
- __redactedString: import_zod9.z.literal(true),
1007
- strings: import_zod9.z.array(import_zod9.z.string()),
1008
- interpolations: import_zod9.z.array(import_zod9.z.string())
1171
+ var RedactStringSchema = import_zod11.z.object({
1172
+ __redactedString: import_zod11.z.literal(true),
1173
+ strings: import_zod11.z.array(import_zod11.z.string()),
1174
+ interpolations: import_zod11.z.array(import_zod11.z.string())
1009
1175
  });
1010
- var LogMessageSchema = import_zod9.z.object({
1011
- level: import_zod9.z.enum([
1176
+ var LogMessageSchema = import_zod11.z.object({
1177
+ level: import_zod11.z.enum([
1012
1178
  "DEBUG",
1013
1179
  "INFO",
1014
1180
  "WARN",
1015
1181
  "ERROR"
1016
1182
  ]),
1017
- message: import_zod9.z.string(),
1183
+ message: import_zod11.z.string(),
1018
1184
  data: SerializableJsonSchema.optional()
1019
1185
  });
1020
- var RedactSchema = import_zod9.z.object({
1021
- paths: import_zod9.z.array(import_zod9.z.string())
1186
+ var RedactSchema = import_zod11.z.object({
1187
+ paths: import_zod11.z.array(import_zod11.z.string())
1022
1188
  });
1023
- var RetryOptionsSchema = import_zod9.z.object({
1189
+ var RetryOptionsSchema = import_zod11.z.object({
1024
1190
  /** The maximum number of times to retry the request. */
1025
- limit: import_zod9.z.number().optional(),
1191
+ limit: import_zod11.z.number().optional(),
1026
1192
  /** The exponential factor to use when calculating the next retry time. */
1027
- factor: import_zod9.z.number().optional(),
1193
+ factor: import_zod11.z.number().optional(),
1028
1194
  /** The minimum amount of time to wait before retrying the request. */
1029
- minTimeoutInMs: import_zod9.z.number().optional(),
1195
+ minTimeoutInMs: import_zod11.z.number().optional(),
1030
1196
  /** The maximum amount of time to wait before retrying the request. */
1031
- maxTimeoutInMs: import_zod9.z.number().optional(),
1197
+ maxTimeoutInMs: import_zod11.z.number().optional(),
1032
1198
  /** Whether to randomize the retry time. */
1033
- randomize: import_zod9.z.boolean().optional()
1199
+ randomize: import_zod11.z.boolean().optional()
1034
1200
  });
1035
- var RunTaskOptionsSchema = import_zod9.z.object({
1201
+ var RunTaskOptionsSchema = import_zod11.z.object({
1036
1202
  /** The name of the Task is required. This is displayed on the Task in the logs. */
1037
- name: import_zod9.z.string().optional(),
1203
+ name: import_zod11.z.string().optional(),
1038
1204
  /** The Task will wait and only start at the specified Date */
1039
- delayUntil: import_zod9.z.coerce.date().optional(),
1205
+ delayUntil: import_zod11.z.coerce.date().optional(),
1040
1206
  /** Retry options */
1041
1207
  retry: RetryOptionsSchema.optional(),
1042
1208
  /** The icon for the Task, it will appear in the logs.
1043
1209
  * You can use the name of a company in lowercase, e.g. "github".
1044
1210
  * Or any icon name that [Font Awesome](https://fontawesome.com/icons) supports. */
1045
- icon: import_zod9.z.string().optional(),
1211
+ icon: import_zod11.z.string().optional(),
1046
1212
  /** The key for the Task that you want to appear in the logs */
1047
- displayKey: import_zod9.z.string().optional(),
1213
+ displayKey: import_zod11.z.string().optional(),
1048
1214
  /** A description of the Task */
1049
- description: import_zod9.z.string().optional(),
1215
+ description: import_zod11.z.string().optional(),
1050
1216
  /** Properties that are displayed in the logs */
1051
- properties: import_zod9.z.array(DisplayPropertySchema).optional(),
1217
+ properties: import_zod11.z.array(DisplayPropertySchema).optional(),
1052
1218
  /** The input params to the Task, will be displayed in the logs */
1053
- params: import_zod9.z.any(),
1219
+ params: import_zod11.z.any(),
1054
1220
  /** The style of the log entry. */
1055
1221
  style: StyleSchema.optional(),
1222
+ /** 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. */
1223
+ callback: import_zod11.z.object({
1224
+ /** Causes the task to wait for and return the data of the first request sent to `task.callbackUrl`. */
1225
+ enabled: import_zod11.z.boolean(),
1226
+ /** Time to wait for the first request to `task.callbackUrl`. Default: One hour. */
1227
+ timeoutInSeconds: import_zod11.z.number()
1228
+ }).partial().optional(),
1056
1229
  /** Allows you to link the Integration connection in the logs. This is handled automatically in integrations. */
1057
- connectionKey: import_zod9.z.string().optional(),
1230
+ connectionKey: import_zod11.z.string().optional(),
1058
1231
  /** 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. */
1059
- operation: import_zod9.z.enum([
1232
+ operation: import_zod11.z.enum([
1060
1233
  "fetch"
1061
1234
  ]).optional(),
1062
1235
  /** 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). */
1063
- noop: import_zod9.z.boolean().default(false),
1236
+ noop: import_zod11.z.boolean().default(false),
1064
1237
  redact: RedactSchema.optional(),
1065
1238
  trigger: TriggerMetadataSchema.optional()
1066
1239
  });
1067
1240
  var RunTaskBodyInputSchema = RunTaskOptionsSchema.extend({
1068
- idempotencyKey: import_zod9.z.string(),
1069
- parentId: import_zod9.z.string().optional()
1241
+ idempotencyKey: import_zod11.z.string(),
1242
+ parentId: import_zod11.z.string().optional()
1070
1243
  });
1071
1244
  var RunTaskBodyOutputSchema = RunTaskBodyInputSchema.extend({
1072
- params: DeserializedJsonSchema.optional().nullable()
1245
+ params: DeserializedJsonSchema.optional().nullable(),
1246
+ callback: import_zod11.z.object({
1247
+ enabled: import_zod11.z.boolean(),
1248
+ timeoutInSeconds: import_zod11.z.number().default(3600)
1249
+ }).optional()
1250
+ });
1251
+ var RunTaskResponseWithCachedTasksBodySchema = import_zod11.z.object({
1252
+ task: ServerTaskSchema,
1253
+ cachedTasks: import_zod11.z.object({
1254
+ tasks: import_zod11.z.array(CachedTaskSchema),
1255
+ cursor: import_zod11.z.string().optional()
1256
+ }).optional()
1073
1257
  });
1074
1258
  var CompleteTaskBodyInputSchema = RunTaskBodyInputSchema.pick({
1075
1259
  properties: true,
@@ -1078,270 +1262,197 @@ var CompleteTaskBodyInputSchema = RunTaskBodyInputSchema.pick({
1078
1262
  }).extend({
1079
1263
  output: SerializableJsonSchema.optional().transform((v) => v ? DeserializedJsonSchema.parse(JSON.parse(JSON.stringify(v))) : {})
1080
1264
  });
1081
- var FailTaskBodyInputSchema = import_zod9.z.object({
1265
+ var FailTaskBodyInputSchema = import_zod11.z.object({
1082
1266
  error: ErrorWithStackSchema
1083
1267
  });
1084
- var NormalizedRequestSchema = import_zod9.z.object({
1085
- headers: import_zod9.z.record(import_zod9.z.string()),
1086
- method: import_zod9.z.string(),
1087
- query: import_zod9.z.record(import_zod9.z.string()),
1088
- url: import_zod9.z.string(),
1089
- body: import_zod9.z.any()
1268
+ var NormalizedRequestSchema = import_zod11.z.object({
1269
+ headers: import_zod11.z.record(import_zod11.z.string()),
1270
+ method: import_zod11.z.string(),
1271
+ query: import_zod11.z.record(import_zod11.z.string()),
1272
+ url: import_zod11.z.string(),
1273
+ body: import_zod11.z.any()
1090
1274
  });
1091
- var NormalizedResponseSchema = import_zod9.z.object({
1092
- status: import_zod9.z.number(),
1093
- body: import_zod9.z.any(),
1094
- headers: import_zod9.z.record(import_zod9.z.string()).optional()
1275
+ var NormalizedResponseSchema = import_zod11.z.object({
1276
+ status: import_zod11.z.number(),
1277
+ body: import_zod11.z.any(),
1278
+ headers: import_zod11.z.record(import_zod11.z.string()).optional()
1095
1279
  });
1096
- var HttpSourceResponseSchema = import_zod9.z.object({
1280
+ var HttpSourceResponseSchema = import_zod11.z.object({
1097
1281
  response: NormalizedResponseSchema,
1098
- events: import_zod9.z.array(RawEventSchema),
1282
+ events: import_zod11.z.array(RawEventSchema),
1099
1283
  metadata: HttpSourceResponseMetadataSchema.optional()
1100
1284
  });
1101
- var RegisterTriggerBodySchemaV1 = import_zod9.z.object({
1285
+ var RegisterTriggerBodySchemaV1 = import_zod11.z.object({
1102
1286
  rule: EventRuleSchema,
1103
1287
  source: SourceMetadataV1Schema
1104
1288
  });
1105
- var RegisterTriggerBodySchemaV2 = import_zod9.z.object({
1289
+ var RegisterTriggerBodySchemaV2 = import_zod11.z.object({
1106
1290
  rule: EventRuleSchema,
1107
- source: SourceMetadataV2Schema
1291
+ source: SourceMetadataV2Schema,
1292
+ accountId: import_zod11.z.string().optional()
1108
1293
  });
1109
- var InitializeTriggerBodySchema = import_zod9.z.object({
1110
- id: import_zod9.z.string(),
1111
- params: import_zod9.z.any(),
1112
- accountId: import_zod9.z.string().optional(),
1113
- metadata: import_zod9.z.any().optional()
1294
+ var InitializeTriggerBodySchema = import_zod11.z.object({
1295
+ id: import_zod11.z.string(),
1296
+ params: import_zod11.z.any(),
1297
+ accountId: import_zod11.z.string().optional(),
1298
+ metadata: import_zod11.z.any().optional()
1114
1299
  });
1115
- var RegisterCommonScheduleBodySchema = import_zod9.z.object({
1300
+ var RegisterCommonScheduleBodySchema = import_zod11.z.object({
1116
1301
  /** A unique id for the schedule. This is used to identify and unregister the schedule later. */
1117
- id: import_zod9.z.string(),
1302
+ id: import_zod11.z.string(),
1118
1303
  /** Any additional metadata about the schedule. */
1119
- metadata: import_zod9.z.any(),
1120
- /** This will be used by the Trigger.dev Connect feature, which is coming soon. */
1121
- accountId: import_zod9.z.string().optional()
1304
+ metadata: import_zod11.z.any(),
1305
+ /** An optional Account ID to associate with runs triggered by this schedule */
1306
+ accountId: import_zod11.z.string().optional()
1122
1307
  });
1123
1308
  var RegisterIntervalScheduleBodySchema = RegisterCommonScheduleBodySchema.merge(IntervalMetadataSchema);
1124
1309
  var InitializeCronScheduleBodySchema = RegisterCommonScheduleBodySchema.merge(CronMetadataSchema);
1125
- var RegisterScheduleBodySchema = import_zod9.z.discriminatedUnion("type", [
1310
+ var RegisterScheduleBodySchema = import_zod11.z.discriminatedUnion("type", [
1126
1311
  RegisterIntervalScheduleBodySchema,
1127
1312
  InitializeCronScheduleBodySchema
1128
1313
  ]);
1129
- var RegisterScheduleResponseBodySchema = import_zod9.z.object({
1130
- id: import_zod9.z.string(),
1314
+ var RegisterScheduleResponseBodySchema = import_zod11.z.object({
1315
+ id: import_zod11.z.string(),
1131
1316
  schedule: ScheduleMetadataSchema,
1132
- metadata: import_zod9.z.any(),
1133
- active: import_zod9.z.boolean()
1317
+ metadata: import_zod11.z.any(),
1318
+ active: import_zod11.z.boolean()
1134
1319
  });
1135
- var CreateExternalConnectionBodySchema = import_zod9.z.object({
1136
- accessToken: import_zod9.z.string(),
1137
- type: import_zod9.z.enum([
1320
+ var CreateExternalConnectionBodySchema = import_zod11.z.object({
1321
+ accessToken: import_zod11.z.string(),
1322
+ type: import_zod11.z.enum([
1138
1323
  "oauth2"
1139
1324
  ]),
1140
- scopes: import_zod9.z.array(import_zod9.z.string()).optional(),
1141
- metadata: import_zod9.z.any()
1325
+ scopes: import_zod11.z.array(import_zod11.z.string()).optional(),
1326
+ metadata: import_zod11.z.any()
1327
+ });
1328
+ var GetRunStatusesSchema = import_zod11.z.object({
1329
+ run: import_zod11.z.object({
1330
+ id: import_zod11.z.string(),
1331
+ status: RunStatusSchema,
1332
+ output: import_zod11.z.any().optional()
1333
+ }),
1334
+ statuses: import_zod11.z.array(JobRunStatusRecordSchema)
1142
1335
  });
1143
1336
 
1144
1337
  // src/schemas/notifications.ts
1145
- var import_zod10 = require("zod");
1338
+ var import_zod12 = require("zod");
1146
1339
  var MISSING_CONNECTION_NOTIFICATION = "dev.trigger.notifications.missingConnection";
1147
1340
  var MISSING_CONNECTION_RESOLVED_NOTIFICATION = "dev.trigger.notifications.missingConnectionResolved";
1148
- var CommonMissingConnectionNotificationPayloadSchema = import_zod10.z.object({
1149
- id: import_zod10.z.string(),
1150
- client: import_zod10.z.object({
1151
- id: import_zod10.z.string(),
1152
- title: import_zod10.z.string(),
1153
- scopes: import_zod10.z.array(import_zod10.z.string()),
1154
- createdAt: import_zod10.z.coerce.date(),
1155
- updatedAt: import_zod10.z.coerce.date()
1341
+ var CommonMissingConnectionNotificationPayloadSchema = import_zod12.z.object({
1342
+ id: import_zod12.z.string(),
1343
+ client: import_zod12.z.object({
1344
+ id: import_zod12.z.string(),
1345
+ title: import_zod12.z.string(),
1346
+ scopes: import_zod12.z.array(import_zod12.z.string()),
1347
+ createdAt: import_zod12.z.coerce.date(),
1348
+ updatedAt: import_zod12.z.coerce.date()
1156
1349
  }),
1157
- authorizationUrl: import_zod10.z.string()
1350
+ authorizationUrl: import_zod12.z.string()
1158
1351
  });
1159
1352
  var MissingDeveloperConnectionNotificationPayloadSchema = CommonMissingConnectionNotificationPayloadSchema.extend({
1160
- type: import_zod10.z.literal("DEVELOPER")
1353
+ type: import_zod12.z.literal("DEVELOPER")
1161
1354
  });
1162
1355
  var MissingExternalConnectionNotificationPayloadSchema = CommonMissingConnectionNotificationPayloadSchema.extend({
1163
- type: import_zod10.z.literal("EXTERNAL"),
1164
- account: import_zod10.z.object({
1165
- id: import_zod10.z.string(),
1166
- metadata: import_zod10.z.any()
1356
+ type: import_zod12.z.literal("EXTERNAL"),
1357
+ account: import_zod12.z.object({
1358
+ id: import_zod12.z.string(),
1359
+ metadata: import_zod12.z.any()
1167
1360
  })
1168
1361
  });
1169
- var MissingConnectionNotificationPayloadSchema = import_zod10.z.discriminatedUnion("type", [
1362
+ var MissingConnectionNotificationPayloadSchema = import_zod12.z.discriminatedUnion("type", [
1170
1363
  MissingDeveloperConnectionNotificationPayloadSchema,
1171
1364
  MissingExternalConnectionNotificationPayloadSchema
1172
1365
  ]);
1173
- var CommonMissingConnectionNotificationResolvedPayloadSchema = import_zod10.z.object({
1174
- id: import_zod10.z.string(),
1175
- client: import_zod10.z.object({
1176
- id: import_zod10.z.string(),
1177
- title: import_zod10.z.string(),
1178
- scopes: import_zod10.z.array(import_zod10.z.string()),
1179
- createdAt: import_zod10.z.coerce.date(),
1180
- updatedAt: import_zod10.z.coerce.date(),
1181
- integrationIdentifier: import_zod10.z.string(),
1182
- integrationAuthMethod: import_zod10.z.string()
1366
+ var CommonMissingConnectionNotificationResolvedPayloadSchema = import_zod12.z.object({
1367
+ id: import_zod12.z.string(),
1368
+ client: import_zod12.z.object({
1369
+ id: import_zod12.z.string(),
1370
+ title: import_zod12.z.string(),
1371
+ scopes: import_zod12.z.array(import_zod12.z.string()),
1372
+ createdAt: import_zod12.z.coerce.date(),
1373
+ updatedAt: import_zod12.z.coerce.date(),
1374
+ integrationIdentifier: import_zod12.z.string(),
1375
+ integrationAuthMethod: import_zod12.z.string()
1183
1376
  }),
1184
- expiresAt: import_zod10.z.coerce.date()
1377
+ expiresAt: import_zod12.z.coerce.date()
1185
1378
  });
1186
1379
  var MissingDeveloperConnectionResolvedNotificationPayloadSchema = CommonMissingConnectionNotificationResolvedPayloadSchema.extend({
1187
- type: import_zod10.z.literal("DEVELOPER")
1380
+ type: import_zod12.z.literal("DEVELOPER")
1188
1381
  });
1189
1382
  var MissingExternalConnectionResolvedNotificationPayloadSchema = CommonMissingConnectionNotificationResolvedPayloadSchema.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()
1383
+ type: import_zod12.z.literal("EXTERNAL"),
1384
+ account: import_zod12.z.object({
1385
+ id: import_zod12.z.string(),
1386
+ metadata: import_zod12.z.any()
1194
1387
  })
1195
1388
  });
1196
- var MissingConnectionResolvedNotificationPayloadSchema = import_zod10.z.discriminatedUnion("type", [
1389
+ var MissingConnectionResolvedNotificationPayloadSchema = import_zod12.z.discriminatedUnion("type", [
1197
1390
  MissingDeveloperConnectionResolvedNotificationPayloadSchema,
1198
1391
  MissingExternalConnectionResolvedNotificationPayloadSchema
1199
1392
  ]);
1200
1393
 
1201
1394
  // src/schemas/fetch.ts
1202
- var import_zod11 = require("zod");
1203
- var FetchRetryHeadersStrategySchema = import_zod11.z.object({
1395
+ var import_zod13 = require("zod");
1396
+ var FetchRetryHeadersStrategySchema = import_zod13.z.object({
1204
1397
  /** The `headers` strategy retries the request using info from the response headers. */
1205
- strategy: import_zod11.z.literal("headers"),
1398
+ strategy: import_zod13.z.literal("headers"),
1206
1399
  /** The header to use to determine the maximum number of times to retry the request. */
1207
- limitHeader: import_zod11.z.string(),
1400
+ limitHeader: import_zod13.z.string(),
1208
1401
  /** The header to use to determine the number of remaining retries. */
1209
- remainingHeader: import_zod11.z.string(),
1402
+ remainingHeader: import_zod13.z.string(),
1210
1403
  /** The header to use to determine the time when the number of remaining retries will be reset. */
1211
- resetHeader: import_zod11.z.string()
1404
+ resetHeader: import_zod13.z.string()
1212
1405
  });
1213
1406
  var FetchRetryBackoffStrategySchema = RetryOptionsSchema.extend({
1214
1407
  /** The `backoff` strategy retries the request with an exponential backoff. */
1215
- strategy: import_zod11.z.literal("backoff")
1408
+ strategy: import_zod13.z.literal("backoff")
1216
1409
  });
1217
- var FetchRetryStrategySchema = import_zod11.z.discriminatedUnion("strategy", [
1410
+ var FetchRetryStrategySchema = import_zod13.z.discriminatedUnion("strategy", [
1218
1411
  FetchRetryHeadersStrategySchema,
1219
1412
  FetchRetryBackoffStrategySchema
1220
1413
  ]);
1221
- var FetchRequestInitSchema = import_zod11.z.object({
1414
+ var FetchRequestInitSchema = import_zod13.z.object({
1222
1415
  /** The HTTP method to use for the request. */
1223
- method: import_zod11.z.string().optional(),
1416
+ method: import_zod13.z.string().optional(),
1224
1417
  /** 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. */
1225
- headers: import_zod11.z.record(import_zod11.z.union([
1226
- import_zod11.z.string(),
1418
+ headers: import_zod13.z.record(import_zod13.z.union([
1419
+ import_zod13.z.string(),
1227
1420
  RedactStringSchema
1228
1421
  ])).optional(),
1229
1422
  /** The body of the request. */
1230
- body: import_zod11.z.union([
1231
- import_zod11.z.string(),
1232
- import_zod11.z.instanceof(ArrayBuffer)
1423
+ body: import_zod13.z.union([
1424
+ import_zod13.z.string(),
1425
+ import_zod13.z.instanceof(ArrayBuffer)
1233
1426
  ]).optional()
1234
1427
  });
1235
- var FetchRetryOptionsSchema = import_zod11.z.record(FetchRetryStrategySchema);
1236
- var FetchOperationSchema = import_zod11.z.object({
1237
- url: import_zod11.z.string(),
1428
+ var FetchRetryOptionsSchema = import_zod13.z.record(FetchRetryStrategySchema);
1429
+ var FetchOperationSchema = import_zod13.z.object({
1430
+ url: import_zod13.z.string(),
1238
1431
  requestInit: FetchRequestInitSchema.optional(),
1239
- retry: import_zod11.z.record(FetchRetryStrategySchema).optional()
1240
- });
1241
-
1242
- // src/schemas/events.ts
1243
- var import_zod13 = require("zod");
1244
-
1245
- // src/schemas/runs.ts
1246
- var import_zod12 = require("zod");
1247
- var RunStatusSchema = import_zod12.z.union([
1248
- import_zod12.z.literal("PENDING"),
1249
- import_zod12.z.literal("QUEUED"),
1250
- import_zod12.z.literal("WAITING_ON_CONNECTIONS"),
1251
- import_zod12.z.literal("PREPROCESSING"),
1252
- import_zod12.z.literal("STARTED"),
1253
- import_zod12.z.literal("SUCCESS"),
1254
- import_zod12.z.literal("FAILURE"),
1255
- import_zod12.z.literal("TIMED_OUT"),
1256
- import_zod12.z.literal("ABORTED"),
1257
- import_zod12.z.literal("CANCELED")
1258
- ]);
1259
- var RunTaskSchema = import_zod12.z.object({
1260
- /** The Task id */
1261
- id: import_zod12.z.string(),
1262
- /** The key that you defined when creating the Task, the first param in any task. */
1263
- displayKey: import_zod12.z.string().nullable(),
1264
- /** The Task status */
1265
- status: TaskStatusSchema,
1266
- /** The name of the Task */
1267
- name: import_zod12.z.string(),
1268
- /** The icon of the Task, a string.
1269
- * For integrations, this will be a lowercase name of the company.
1270
- * Can be used with the [@trigger.dev/companyicons](https://www.npmjs.com/package/@trigger.dev/companyicons) package to display an svg. */
1271
- icon: import_zod12.z.string().nullable(),
1272
- /** When the task started */
1273
- startedAt: import_zod12.z.coerce.date().nullable(),
1274
- /** When the task completed */
1275
- completedAt: import_zod12.z.coerce.date().nullable()
1276
- });
1277
- var RunTaskWithSubtasksSchema = RunTaskSchema.extend({
1278
- subtasks: import_zod12.z.lazy(() => RunTaskWithSubtasksSchema.array()).optional()
1279
- });
1280
- var GetRunOptionsSchema = import_zod12.z.object({
1281
- /** Return subtasks, which appear in a `subtasks` array on a task. @default false */
1282
- subtasks: import_zod12.z.boolean().optional(),
1283
- /** You can use this to get more tasks, if there are more than are returned in a single batch @default undefined */
1284
- cursor: import_zod12.z.string().optional(),
1285
- /** How many tasks you want to return in one go, max 50. @default 20 */
1286
- take: import_zod12.z.number().optional()
1287
- });
1288
- var GetRunOptionsWithTaskDetailsSchema = GetRunOptionsSchema.extend({
1289
- /** If `true`, it returns the `params` and `output` of all tasks. @default false */
1290
- taskdetails: import_zod12.z.boolean().optional()
1291
- });
1292
- var RunSchema = import_zod12.z.object({
1293
- /** The Run id */
1294
- id: import_zod12.z.string(),
1295
- /** The Run status */
1296
- status: RunStatusSchema,
1297
- /** When the run started */
1298
- startedAt: import_zod12.z.coerce.date().nullable(),
1299
- /** When the run was last updated */
1300
- updatedAt: import_zod12.z.coerce.date().nullable(),
1301
- /** When the run was completed */
1302
- completedAt: import_zod12.z.coerce.date().nullable()
1303
- });
1304
- var GetRunSchema = RunSchema.extend({
1305
- /** The output of the run */
1306
- output: import_zod12.z.any().optional(),
1307
- /** The tasks from the run */
1308
- tasks: import_zod12.z.array(RunTaskWithSubtasksSchema),
1309
- /** If there are more tasks, you can use this to get them */
1310
- nextCursor: import_zod12.z.string().optional()
1311
- });
1312
- var GetRunsOptionsSchema = import_zod12.z.object({
1313
- /** You can use this to get more tasks, if there are more than are returned in a single batch @default undefined */
1314
- cursor: import_zod12.z.string().optional(),
1315
- /** How many runs you want to return in one go, max 50. @default 20 */
1316
- take: import_zod12.z.number().optional()
1317
- });
1318
- var GetRunsSchema = import_zod12.z.object({
1319
- /** The runs from the query */
1320
- runs: RunSchema.array(),
1321
- /** If there are more runs, you can use this to get them */
1322
- nextCursor: import_zod12.z.string().optional()
1432
+ retry: import_zod13.z.record(FetchRetryStrategySchema).optional()
1323
1433
  });
1324
1434
 
1325
1435
  // src/schemas/events.ts
1326
- var GetEventSchema = import_zod13.z.object({
1436
+ var import_zod14 = require("zod");
1437
+ var GetEventSchema = import_zod14.z.object({
1327
1438
  /** The event id */
1328
- id: import_zod13.z.string(),
1439
+ id: import_zod14.z.string(),
1329
1440
  /** The event name */
1330
- name: import_zod13.z.string(),
1441
+ name: import_zod14.z.string(),
1331
1442
  /** When the event was created */
1332
- createdAt: import_zod13.z.coerce.date(),
1443
+ createdAt: import_zod14.z.coerce.date(),
1333
1444
  /** When the event was last updated */
1334
- updatedAt: import_zod13.z.coerce.date(),
1445
+ updatedAt: import_zod14.z.coerce.date(),
1335
1446
  /** The runs that were triggered by the event */
1336
- runs: import_zod13.z.array(import_zod13.z.object({
1447
+ runs: import_zod14.z.array(import_zod14.z.object({
1337
1448
  /** The Run id */
1338
- id: import_zod13.z.string(),
1449
+ id: import_zod14.z.string(),
1339
1450
  /** The Run status */
1340
1451
  status: RunStatusSchema,
1341
1452
  /** When the run started */
1342
- startedAt: import_zod13.z.coerce.date().optional().nullable(),
1453
+ startedAt: import_zod14.z.coerce.date().optional().nullable(),
1343
1454
  /** When the run completed */
1344
- completedAt: import_zod13.z.coerce.date().optional().nullable()
1455
+ completedAt: import_zod14.z.coerce.date().optional().nullable()
1345
1456
  }))
1346
1457
  });
1347
1458
 
@@ -1568,130 +1679,76 @@ function contentFilterMatches(actualValue, contentFilter) {
1568
1679
  return true;
1569
1680
  }
1570
1681
  __name(contentFilterMatches, "contentFilterMatches");
1571
- // Annotate the CommonJS export names for ESM import in node:
1572
- 0 && (module.exports = {
1573
- ApiEventLogSchema,
1574
- CachedTaskSchema,
1575
- CommonMissingConnectionNotificationPayloadSchema,
1576
- CommonMissingConnectionNotificationResolvedPayloadSchema,
1577
- CompleteTaskBodyInputSchema,
1578
- ConnectionAuthSchema,
1579
- CreateExternalConnectionBodySchema,
1580
- CreateRunResponseBodySchema,
1581
- CronMetadataSchema,
1582
- CronOptionsSchema,
1583
- DeliverEventResponseSchema,
1584
- DeserializedJsonSchema,
1585
- DisplayPropertiesSchema,
1586
- DisplayPropertySchema,
1587
- DynamicTriggerEndpointMetadataSchema,
1588
- DynamicTriggerMetadataSchema,
1589
- ErrorWithStackSchema,
1590
- EventExampleSchema,
1591
- EventFilterSchema,
1592
- EventRuleSchema,
1593
- EventSpecificationSchema,
1594
- FailTaskBodyInputSchema,
1595
- FetchOperationSchema,
1596
- FetchRequestInitSchema,
1597
- FetchRetryBackoffStrategySchema,
1598
- FetchRetryHeadersStrategySchema,
1599
- FetchRetryOptionsSchema,
1600
- FetchRetryStrategySchema,
1601
- GetEventSchema,
1602
- GetRunSchema,
1603
- GetRunsSchema,
1604
- HandleTriggerSourceSchema,
1605
- HttpSourceRequestHeadersSchema,
1606
- HttpSourceRequestSchema,
1607
- HttpSourceResponseSchema,
1608
- IndexEndpointResponseSchema,
1609
- InitializeCronScheduleBodySchema,
1610
- InitializeTriggerBodySchema,
1611
- IntegrationConfigSchema,
1612
- IntegrationMetadataSchema,
1613
- IntervalMetadataSchema,
1614
- IntervalOptionsSchema,
1615
- JobMetadataSchema,
1616
- LogMessageSchema,
1617
- Logger,
1618
- MISSING_CONNECTION_NOTIFICATION,
1619
- MISSING_CONNECTION_RESOLVED_NOTIFICATION,
1620
- MissingConnectionNotificationPayloadSchema,
1621
- MissingConnectionResolvedNotificationPayloadSchema,
1622
- MissingDeveloperConnectionNotificationPayloadSchema,
1623
- MissingDeveloperConnectionResolvedNotificationPayloadSchema,
1624
- MissingExternalConnectionNotificationPayloadSchema,
1625
- MissingExternalConnectionResolvedNotificationPayloadSchema,
1626
- NormalizedRequestSchema,
1627
- NormalizedResponseSchema,
1628
- PongErrorResponseSchema,
1629
- PongResponseSchema,
1630
- PongSuccessResponseSchema,
1631
- PreprocessRunBodySchema,
1632
- PreprocessRunResponseSchema,
1633
- QueueOptionsSchema,
1634
- REGISTER_SOURCE_EVENT_V1,
1635
- REGISTER_SOURCE_EVENT_V2,
1636
- RawEventSchema,
1637
- RedactSchema,
1638
- RedactStringSchema,
1639
- RegisterDynamicSchedulePayloadSchema,
1640
- RegisterHTTPTriggerSourceBodySchema,
1641
- RegisterIntervalScheduleBodySchema,
1642
- RegisterSMTPTriggerSourceBodySchema,
1643
- RegisterSQSTriggerSourceBodySchema,
1644
- RegisterScheduleBodySchema,
1645
- RegisterScheduleResponseBodySchema,
1646
- RegisterSourceChannelBodySchema,
1647
- RegisterSourceEventSchemaV1,
1648
- RegisterSourceEventSchemaV2,
1649
- RegisterTriggerBodySchemaV1,
1650
- RegisterTriggerBodySchemaV2,
1651
- RegisterTriggerSourceSchema,
1652
- RetryOptionsSchema,
1653
- RunJobBodySchema,
1654
- RunJobCanceledWithTaskSchema,
1655
- RunJobErrorSchema,
1656
- RunJobResponseSchema,
1657
- RunJobResumeWithTaskSchema,
1658
- RunJobRetryWithTaskSchema,
1659
- RunJobSuccessSchema,
1660
- RunSourceContextSchema,
1661
- RunStatusSchema,
1662
- RunTaskBodyInputSchema,
1663
- RunTaskBodyOutputSchema,
1664
- RunTaskOptionsSchema,
1665
- RunTaskSchema,
1666
- RuntimeEnvironmentTypeSchema,
1667
- SCHEDULED_EVENT,
1668
- ScheduleMetadataSchema,
1669
- ScheduledPayloadSchema,
1670
- ScheduledTriggerMetadataSchema,
1671
- SendEventBodySchema,
1672
- SendEventOptionsSchema,
1673
- SerializableJsonSchema,
1674
- ServerTaskSchema,
1675
- SourceMetadataV2Schema,
1676
- StaticTriggerMetadataSchema,
1677
- StyleSchema,
1678
- TaskSchema,
1679
- TaskStatusSchema,
1680
- TriggerMetadataSchema,
1681
- TriggerSourceSchema,
1682
- UpdateTriggerSourceBodyV1Schema,
1683
- UpdateTriggerSourceBodyV2Schema,
1684
- ValidateErrorResponseSchema,
1685
- ValidateResponseSchema,
1686
- ValidateSuccessResponseSchema,
1687
- addMissingVersionField,
1688
- calculateRetryAt,
1689
- currentDate,
1690
- currentTimestampMilliseconds,
1691
- currentTimestampSeconds,
1692
- deepMergeFilters,
1693
- eventFilterMatches,
1694
- replacements,
1695
- urlWithSearchParams
1696
- });
1682
+
1683
+ // src/bloom.ts
1684
+ var import_node_buffer = require("buffer");
1685
+ var _BloomFilter = class _BloomFilter {
1686
+ constructor(size) {
1687
+ this.size = size;
1688
+ this.bitArray = new Uint8Array(Math.ceil(size / 8));
1689
+ }
1690
+ add(item) {
1691
+ const index = murmurHash3(item) % this.size;
1692
+ this.bitArray[Math.floor(index / 8)] |= 1 << index % 8;
1693
+ }
1694
+ test(item) {
1695
+ const index = murmurHash3(item) % this.size;
1696
+ return (this.bitArray[Math.floor(index / 8)] & 1 << index % 8) !== 0;
1697
+ }
1698
+ // Serialize to a Base64 string
1699
+ serialize() {
1700
+ return import_node_buffer.Buffer.from(this.bitArray).toString("base64");
1701
+ }
1702
+ // Deserialize from a Base64 string
1703
+ static deserialize(str, size) {
1704
+ const filter = new _BloomFilter(size);
1705
+ filter.bitArray = Uint8Array.from(import_node_buffer.Buffer.from(str, "base64"));
1706
+ return filter;
1707
+ }
1708
+ };
1709
+ __name(_BloomFilter, "BloomFilter");
1710
+ __publicField(_BloomFilter, "NOOP_TASK_SET_SIZE", 32768);
1711
+ var BloomFilter = _BloomFilter;
1712
+ function murmurHash3(str, seed = 0) {
1713
+ let h1 = 3735928559 ^ seed, h2 = 1103547991 ^ seed;
1714
+ for (let i = 0, ch; i < str.length; i++) {
1715
+ ch = str.charCodeAt(i);
1716
+ h1 = Math.imul(h1 ^ ch, 3432918353);
1717
+ h1 = h1 << 15 | h1 >>> 17;
1718
+ h1 = Math.imul(h1, 461845907);
1719
+ h2 = Math.imul(h2 ^ ch, 2246822507);
1720
+ h2 = h2 << 13 | h2 >>> 19;
1721
+ h2 = Math.imul(h2, 3266489909);
1722
+ }
1723
+ h1 ^= str.length;
1724
+ h2 ^= str.length;
1725
+ h1 = Math.imul(h1 ^ h1 >>> 16, 2246822507);
1726
+ h1 = Math.imul(h1 ^ h1 >>> 13, 3266489909);
1727
+ h1 ^= h1 >>> 16;
1728
+ h2 = Math.imul(h2 ^ h2 >>> 16, 2246822507);
1729
+ h2 = Math.imul(h2 ^ h2 >>> 13, 3266489909);
1730
+ h2 ^= h2 >>> 16;
1731
+ return 4294967296 * (2097151 & h2) + (h1 >>> 0);
1732
+ }
1733
+ __name(murmurHash3, "murmurHash3");
1734
+
1735
+ // src/index.ts
1736
+ var API_VERSIONS = {
1737
+ LAZY_LOADED_CACHED_TASKS: "2023-09-29"
1738
+ };
1739
+ var PLATFORM_FEATURES = {
1740
+ yieldExecution: API_VERSIONS.LAZY_LOADED_CACHED_TASKS,
1741
+ lazyLoadedCachedTasks: API_VERSIONS.LAZY_LOADED_CACHED_TASKS
1742
+ };
1743
+ function supportsFeature(featureName, version) {
1744
+ if (version === "unversioned" || version === "unknown") {
1745
+ return false;
1746
+ }
1747
+ const supportedVersion = PLATFORM_FEATURES[featureName];
1748
+ if (!supportedVersion) {
1749
+ return false;
1750
+ }
1751
+ return version >= supportedVersion;
1752
+ }
1753
+ __name(supportsFeature, "supportsFeature");
1697
1754
  //# sourceMappingURL=index.js.map