@trigger.dev/sdk 2.0.0-next.0 → 2.0.0-next.10

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.d.ts CHANGED
@@ -1,11 +1,20 @@
1
1
  import * as zod from 'zod';
2
2
  import { z } from 'zod';
3
3
 
4
+ /**
5
+ * Represents different log levels.
6
+ * - `"log"`: Only essential messages.
7
+ * - `"error"`: Errors and essential messages.
8
+ * - `"warn"`: Warnings, Errors and essential messages.
9
+ * - `"info"`: Info, Warnings, Errors and essential messages.
10
+ * - `"debug"`: Everything.
11
+ */
4
12
  type LogLevel = "log" | "error" | "warn" | "info" | "debug";
5
13
  declare class Logger {
6
14
  #private;
7
- constructor(name: string, level?: LogLevel, filteredKeys?: string[]);
15
+ constructor(name: string, level?: LogLevel, filteredKeys?: string[], jsonReplacer?: (key: string, value: unknown) => unknown);
8
16
  filter(...keys: string[]): Logger;
17
+ static satisfiesLogLevel(logLevel: LogLevel, setLevel: LogLevel): boolean;
9
18
  log(...args: any[]): void;
10
19
  error(...args: any[]): void;
11
20
  warn(...args: any[]): void;
@@ -15,6 +24,7 @@ declare class Logger {
15
24
 
16
25
  declare const EventMatcherSchema: z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodArray<z.ZodNumber, "many">, z.ZodArray<z.ZodBoolean, "many">]>;
17
26
  type EventMatcher = z.infer<typeof EventMatcherSchema>;
27
+ /** A filter for matching against data */
18
28
  type EventFilter = {
19
29
  [key: string]: EventMatcher | EventFilter;
20
30
  };
@@ -67,57 +77,64 @@ declare const ServerTaskSchema: z.ZodObject<z.extendShape<{
67
77
  variant?: string | undefined;
68
78
  style: "normal" | "minimal";
69
79
  }>>>;
80
+ operation: z.ZodNullable<z.ZodOptional<z.ZodString>>;
70
81
  }, {
71
82
  idempotencyKey: z.ZodString;
83
+ attempts: z.ZodNumber;
72
84
  }>, "strip", z.ZodTypeAny, {
73
- error?: string | null | undefined;
74
- params?: DeserializedJson | undefined;
75
85
  icon?: string | null | undefined;
76
- style?: {
77
- variant?: string | undefined;
78
- style: "normal" | "minimal";
79
- } | null | undefined;
80
86
  startedAt?: Date | null | undefined;
81
87
  completedAt?: Date | null | undefined;
82
88
  delayUntil?: Date | null | undefined;
83
89
  description?: string | null | undefined;
90
+ params?: DeserializedJson | undefined;
84
91
  properties?: {
85
92
  url?: string | undefined;
86
93
  label: string;
87
94
  text: string;
88
95
  }[] | null | undefined;
89
96
  output?: DeserializedJson | undefined;
97
+ error?: string | null | undefined;
90
98
  parentId?: string | null | undefined;
91
- status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED";
99
+ style?: {
100
+ variant?: string | undefined;
101
+ style: "normal" | "minimal";
102
+ } | null | undefined;
103
+ operation?: string | null | undefined;
92
104
  id: string;
93
105
  name: string;
94
106
  noop: boolean;
107
+ status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED";
95
108
  idempotencyKey: string;
109
+ attempts: number;
96
110
  }, {
97
- error?: string | null | undefined;
98
- params?: DeserializedJson | undefined;
99
111
  icon?: string | null | undefined;
100
- style?: {
101
- variant?: string | undefined;
102
- style: "normal" | "minimal";
103
- } | null | undefined;
104
112
  startedAt?: Date | null | undefined;
105
113
  completedAt?: Date | null | undefined;
106
114
  delayUntil?: Date | null | undefined;
107
115
  description?: string | null | undefined;
116
+ params?: DeserializedJson | undefined;
108
117
  properties?: {
109
118
  url?: string | undefined;
110
119
  label: string;
111
120
  text: string;
112
121
  }[] | null | undefined;
113
122
  output?: DeserializedJson | undefined;
123
+ error?: string | null | undefined;
114
124
  parentId?: string | null | undefined;
115
- status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED";
125
+ style?: {
126
+ variant?: string | undefined;
127
+ style: "normal" | "minimal";
128
+ } | null | undefined;
129
+ operation?: string | null | undefined;
116
130
  id: string;
117
131
  name: string;
118
132
  noop: boolean;
133
+ status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED";
119
134
  idempotencyKey: string;
135
+ attempts: number;
120
136
  }>;
137
+ type ServerTask = z.infer<typeof ServerTaskSchema>;
121
138
  declare const CachedTaskSchema: z.ZodObject<{
122
139
  id: z.ZodString;
123
140
  idempotencyKey: z.ZodString;
@@ -128,16 +145,16 @@ declare const CachedTaskSchema: z.ZodObject<{
128
145
  }, "strip", z.ZodTypeAny, {
129
146
  output?: DeserializedJson | undefined;
130
147
  parentId?: string | null | undefined;
131
- status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED";
132
148
  id: string;
133
149
  noop: boolean;
150
+ status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED";
134
151
  idempotencyKey: string;
135
152
  }, {
136
153
  noop?: boolean | undefined;
137
154
  output?: DeserializedJson | undefined;
138
155
  parentId?: string | null | undefined;
139
- status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED";
140
156
  id: string;
157
+ status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED";
141
158
  idempotencyKey: string;
142
159
  }>;
143
160
 
@@ -167,11 +184,11 @@ declare const RegisterSourceEventSchema: z.ZodObject<{
167
184
  type: z.ZodLiteral<"HTTP">;
168
185
  url: z.ZodString;
169
186
  }, "strip", z.ZodTypeAny, {
170
- type: "HTTP";
171
187
  url: string;
172
- }, {
173
188
  type: "HTTP";
189
+ }, {
174
190
  url: string;
191
+ type: "HTTP";
175
192
  }>, z.ZodObject<{
176
193
  type: z.ZodLiteral<"SMTP">;
177
194
  }, "strip", z.ZodTypeAny, {
@@ -187,30 +204,30 @@ declare const RegisterSourceEventSchema: z.ZodObject<{
187
204
  }>]>;
188
205
  clientId: z.ZodOptional<z.ZodString>;
189
206
  }, "strip", z.ZodTypeAny, {
190
- data?: DeserializedJson | undefined;
191
207
  params?: any;
208
+ data?: DeserializedJson | undefined;
192
209
  clientId?: string | undefined;
193
210
  key: string;
194
211
  secret: string;
195
212
  active: boolean;
196
213
  channel: {
197
- type: "HTTP";
198
214
  url: string;
215
+ type: "HTTP";
199
216
  } | {
200
217
  type: "SMTP";
201
218
  } | {
202
219
  type: "SQS";
203
220
  };
204
221
  }, {
205
- data?: DeserializedJson | undefined;
206
222
  params?: any;
223
+ data?: DeserializedJson | undefined;
207
224
  clientId?: string | undefined;
208
225
  key: string;
209
226
  secret: string;
210
227
  active: boolean;
211
228
  channel: {
212
- type: "HTTP";
213
229
  url: string;
230
+ type: "HTTP";
214
231
  } | {
215
232
  type: "SMTP";
216
233
  } | {
@@ -225,15 +242,15 @@ declare const RegisterSourceEventSchema: z.ZodObject<{
225
242
  dynamicTriggerId?: string | undefined;
226
243
  id: string;
227
244
  source: {
228
- data?: DeserializedJson | undefined;
229
245
  params?: any;
246
+ data?: DeserializedJson | undefined;
230
247
  clientId?: string | undefined;
231
248
  key: string;
232
249
  secret: string;
233
250
  active: boolean;
234
251
  channel: {
235
- type: "HTTP";
236
252
  url: string;
253
+ type: "HTTP";
237
254
  } | {
238
255
  type: "SMTP";
239
256
  } | {
@@ -247,15 +264,15 @@ declare const RegisterSourceEventSchema: z.ZodObject<{
247
264
  dynamicTriggerId?: string | undefined;
248
265
  id: string;
249
266
  source: {
250
- data?: DeserializedJson | undefined;
251
267
  params?: any;
268
+ data?: DeserializedJson | undefined;
252
269
  clientId?: string | undefined;
253
270
  key: string;
254
271
  secret: string;
255
272
  active: boolean;
256
273
  channel: {
257
- type: "HTTP";
258
274
  url: string;
275
+ type: "HTTP";
259
276
  } | {
260
277
  type: "SMTP";
261
278
  } | {
@@ -271,11 +288,11 @@ declare const TriggerSourceSchema: z.ZodObject<{
271
288
  id: z.ZodString;
272
289
  key: z.ZodString;
273
290
  }, "strip", z.ZodTypeAny, {
274
- key: string;
275
291
  id: string;
276
- }, {
277
292
  key: string;
293
+ }, {
278
294
  id: string;
295
+ key: string;
279
296
  }>;
280
297
  declare const HandleTriggerSourceSchema: z.ZodObject<{
281
298
  key: z.ZodString;
@@ -283,13 +300,13 @@ declare const HandleTriggerSourceSchema: z.ZodObject<{
283
300
  data: z.ZodAny;
284
301
  params: z.ZodAny;
285
302
  }, "strip", z.ZodTypeAny, {
286
- data?: any;
287
303
  params?: any;
304
+ data?: any;
288
305
  key: string;
289
306
  secret: string;
290
307
  }, {
291
- data?: any;
292
308
  params?: any;
309
+ data?: any;
293
310
  key: string;
294
311
  secret: string;
295
312
  }>;
@@ -330,7 +347,22 @@ declare const JobMetadataSchema: z.ZodObject<{
330
347
  text: string;
331
348
  }>, "many">>;
332
349
  schema: z.ZodOptional<z.ZodAny>;
333
- examples: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
350
+ examples: z.ZodOptional<z.ZodArray<z.ZodObject<{
351
+ id: z.ZodString;
352
+ icon: z.ZodOptional<z.ZodString>;
353
+ name: z.ZodString;
354
+ payload: z.ZodAny;
355
+ }, "strip", z.ZodTypeAny, {
356
+ icon?: string | undefined;
357
+ payload?: any;
358
+ id: string;
359
+ name: string;
360
+ }, {
361
+ icon?: string | undefined;
362
+ payload?: any;
363
+ id: string;
364
+ name: string;
365
+ }>, "many">>;
334
366
  }, "strip", z.ZodTypeAny, {
335
367
  filter?: EventFilter | undefined;
336
368
  properties?: {
@@ -339,11 +371,16 @@ declare const JobMetadataSchema: z.ZodObject<{
339
371
  text: string;
340
372
  }[] | undefined;
341
373
  schema?: any;
342
- examples?: any[] | undefined;
343
- title: string;
344
- icon: string;
374
+ examples?: {
375
+ icon?: string | undefined;
376
+ payload?: any;
377
+ id: string;
378
+ name: string;
379
+ }[] | undefined;
345
380
  name: string;
381
+ icon: string;
346
382
  source: string;
383
+ title: string;
347
384
  }, {
348
385
  filter?: EventFilter | undefined;
349
386
  properties?: {
@@ -352,21 +389,26 @@ declare const JobMetadataSchema: z.ZodObject<{
352
389
  text: string;
353
390
  }[] | undefined;
354
391
  schema?: any;
355
- examples?: any[] | undefined;
356
- title: string;
357
- icon: string;
392
+ examples?: {
393
+ icon?: string | undefined;
394
+ payload?: any;
395
+ id: string;
396
+ name: string;
397
+ }[] | undefined;
358
398
  name: string;
399
+ icon: string;
359
400
  source: string;
401
+ title: string;
360
402
  }>;
361
403
  trigger: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
362
404
  type: z.ZodLiteral<"dynamic">;
363
405
  id: z.ZodString;
364
406
  }, "strip", z.ZodTypeAny, {
365
- type: "dynamic";
366
407
  id: string;
367
- }, {
368
408
  type: "dynamic";
409
+ }, {
369
410
  id: string;
411
+ type: "dynamic";
370
412
  }>, z.ZodObject<{
371
413
  type: z.ZodLiteral<"static">;
372
414
  title: z.ZodString;
@@ -508,32 +550,35 @@ declare const JobMetadataSchema: z.ZodObject<{
508
550
  integrations: z.ZodRecord<z.ZodString, z.ZodObject<{
509
551
  id: z.ZodString;
510
552
  metadata: z.ZodObject<{
511
- key: z.ZodString;
512
- title: z.ZodString;
513
- icon: z.ZodString;
553
+ id: z.ZodString;
554
+ name: z.ZodString;
555
+ instructions: z.ZodOptional<z.ZodString>;
514
556
  }, "strip", z.ZodTypeAny, {
515
- key: string;
516
- title: string;
517
- icon: string;
557
+ instructions?: string | undefined;
558
+ id: string;
559
+ name: string;
518
560
  }, {
519
- key: string;
520
- title: string;
521
- icon: string;
561
+ instructions?: string | undefined;
562
+ id: string;
563
+ name: string;
522
564
  }>;
565
+ authSource: z.ZodEnum<["HOSTED", "LOCAL"]>;
523
566
  }, "strip", z.ZodTypeAny, {
524
567
  id: string;
525
568
  metadata: {
526
- key: string;
527
- title: string;
528
- icon: string;
569
+ instructions?: string | undefined;
570
+ id: string;
571
+ name: string;
529
572
  };
573
+ authSource: "HOSTED" | "LOCAL";
530
574
  }, {
531
575
  id: string;
532
576
  metadata: {
533
- key: string;
534
- title: string;
535
- icon: string;
577
+ instructions?: string | undefined;
578
+ id: string;
579
+ name: string;
536
580
  };
581
+ authSource: "HOSTED" | "LOCAL";
537
582
  }>>;
538
583
  internal: z.ZodDefault<z.ZodBoolean>;
539
584
  queue: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
@@ -564,16 +609,21 @@ declare const JobMetadataSchema: z.ZodObject<{
564
609
  text: string;
565
610
  }[] | undefined;
566
611
  schema?: any;
567
- examples?: any[] | undefined;
568
- title: string;
569
- icon: string;
612
+ examples?: {
613
+ icon?: string | undefined;
614
+ payload?: any;
615
+ id: string;
616
+ name: string;
617
+ }[] | undefined;
570
618
  name: string;
619
+ icon: string;
571
620
  source: string;
621
+ title: string;
572
622
  };
573
623
  version: string;
574
624
  trigger: {
575
- type: "dynamic";
576
625
  id: string;
626
+ type: "dynamic";
577
627
  } | {
578
628
  properties?: {
579
629
  url?: string | undefined;
@@ -607,10 +657,11 @@ declare const JobMetadataSchema: z.ZodObject<{
607
657
  integrations: Record<string, {
608
658
  id: string;
609
659
  metadata: {
610
- key: string;
611
- title: string;
612
- icon: string;
660
+ instructions?: string | undefined;
661
+ id: string;
662
+ name: string;
613
663
  };
664
+ authSource: "HOSTED" | "LOCAL";
614
665
  }>;
615
666
  internal: boolean;
616
667
  startPosition: "initial" | "latest";
@@ -632,16 +683,21 @@ declare const JobMetadataSchema: z.ZodObject<{
632
683
  text: string;
633
684
  }[] | undefined;
634
685
  schema?: any;
635
- examples?: any[] | undefined;
636
- title: string;
637
- icon: string;
686
+ examples?: {
687
+ icon?: string | undefined;
688
+ payload?: any;
689
+ id: string;
690
+ name: string;
691
+ }[] | undefined;
638
692
  name: string;
693
+ icon: string;
639
694
  source: string;
695
+ title: string;
640
696
  };
641
697
  version: string;
642
698
  trigger: {
643
- type: "dynamic";
644
699
  id: string;
700
+ type: "dynamic";
645
701
  } | {
646
702
  properties?: {
647
703
  url?: string | undefined;
@@ -675,10 +731,11 @@ declare const JobMetadataSchema: z.ZodObject<{
675
731
  integrations: Record<string, {
676
732
  id: string;
677
733
  metadata: {
678
- key: string;
679
- title: string;
680
- icon: string;
734
+ instructions?: string | undefined;
735
+ id: string;
736
+ name: string;
681
737
  };
738
+ authSource: "HOSTED" | "LOCAL";
682
739
  }>;
683
740
  startPosition: "initial" | "latest";
684
741
  enabled: boolean;
@@ -686,17 +743,34 @@ declare const JobMetadataSchema: z.ZodObject<{
686
743
  }>;
687
744
  type JobMetadata = z.infer<typeof JobMetadataSchema>;
688
745
  declare const RawEventSchema: z.ZodObject<{
689
- id: z.ZodDefault<z.ZodString>;
746
+ /** The `name` property must exactly match any subscriptions you want to
747
+ trigger. */
690
748
  name: z.ZodString;
691
- source: z.ZodOptional<z.ZodString>;
749
+ /** The `payload` property will be sent to any matching Jobs and will appear
750
+ as the `payload` param of the `run()` function. You can leave this
751
+ parameter out if you just want to trigger a Job without any input data. */
692
752
  payload: z.ZodAny;
753
+ /** The optional `context` property will be sent to any matching Jobs and will
754
+ be passed through as the `context.event.context` param of the `run()`
755
+ function. This is optional but can be useful if you want to pass through
756
+ some additional context to the Job. */
693
757
  context: z.ZodOptional<z.ZodAny>;
694
- timestamp: z.ZodOptional<z.ZodString>;
758
+ /** The `id` property uniquely identify this particular event. If unset it
759
+ will be set automatically using `ulid`. */
760
+ id: z.ZodDefault<z.ZodString>;
761
+ /** This is optional, it defaults to the current timestamp. Usually you would
762
+ only set this if you have a timestamp that you wish to pass through, e.g.
763
+ you receive a timestamp from a service and you want the same timestamp to
764
+ be used in your Job. */
765
+ timestamp: z.ZodOptional<z.ZodDate>;
766
+ /** This is optional, it defaults to "trigger.dev". It can be useful to set
767
+ this as you can filter events using this in the `eventTrigger()`. */
768
+ source: z.ZodOptional<z.ZodString>;
695
769
  }, "strip", z.ZodTypeAny, {
696
770
  source?: string | undefined;
697
771
  payload?: any;
698
772
  context?: any;
699
- timestamp?: string | undefined;
773
+ timestamp?: Date | undefined;
700
774
  id: string;
701
775
  name: string;
702
776
  }, {
@@ -704,20 +778,30 @@ declare const RawEventSchema: z.ZodObject<{
704
778
  source?: string | undefined;
705
779
  payload?: any;
706
780
  context?: any;
707
- timestamp?: string | undefined;
781
+ timestamp?: Date | undefined;
708
782
  name: string;
709
783
  }>;
784
+ /** The event you wish to send to Trigger a Job */
710
785
  type SendEvent = z.input<typeof RawEventSchema>;
786
+ /** Options to control the delivery of the event */
711
787
  declare const SendEventOptionsSchema: z.ZodObject<{
712
- deliverAt: z.ZodOptional<z.ZodString>;
788
+ /** An optional Date when you want the event to trigger Jobs. The event will
789
+ be sent to the platform immediately but won't be acted upon until the
790
+ specified time. */
791
+ deliverAt: z.ZodOptional<z.ZodDate>;
792
+ /** An optional number of seconds you want to wait for the event to trigger
793
+ any relevant Jobs. The event will be sent to the platform immediately but
794
+ won't be delivered until after the elapsed number of seconds. */
713
795
  deliverAfter: z.ZodOptional<z.ZodNumber>;
796
+ /** This optional param will be used by Trigger.dev Connect, which
797
+ is coming soon. */
714
798
  accountId: z.ZodOptional<z.ZodString>;
715
799
  }, "strip", z.ZodTypeAny, {
716
- deliverAt?: string | undefined;
800
+ deliverAt?: Date | undefined;
717
801
  deliverAfter?: number | undefined;
718
802
  accountId?: string | undefined;
719
803
  }, {
720
- deliverAt?: string | undefined;
804
+ deliverAt?: Date | undefined;
721
805
  deliverAfter?: number | undefined;
722
806
  accountId?: string | undefined;
723
807
  }>;
@@ -750,7 +834,22 @@ declare const CreateRunBodySchema: z.ZodObject<{
750
834
  text: string;
751
835
  }>, "many">>;
752
836
  schema: z.ZodOptional<z.ZodAny>;
753
- examples: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
837
+ examples: z.ZodOptional<z.ZodArray<z.ZodObject<{
838
+ id: z.ZodString;
839
+ icon: z.ZodOptional<z.ZodString>;
840
+ name: z.ZodString;
841
+ payload: z.ZodAny;
842
+ }, "strip", z.ZodTypeAny, {
843
+ icon?: string | undefined;
844
+ payload?: any;
845
+ id: string;
846
+ name: string;
847
+ }, {
848
+ icon?: string | undefined;
849
+ payload?: any;
850
+ id: string;
851
+ name: string;
852
+ }>, "many">>;
754
853
  }, "strip", z.ZodTypeAny, {
755
854
  filter?: EventFilter | undefined;
756
855
  properties?: {
@@ -759,11 +858,16 @@ declare const CreateRunBodySchema: z.ZodObject<{
759
858
  text: string;
760
859
  }[] | undefined;
761
860
  schema?: any;
762
- examples?: any[] | undefined;
763
- title: string;
764
- icon: string;
861
+ examples?: {
862
+ icon?: string | undefined;
863
+ payload?: any;
864
+ id: string;
865
+ name: string;
866
+ }[] | undefined;
765
867
  name: string;
868
+ icon: string;
766
869
  source: string;
870
+ title: string;
767
871
  }, {
768
872
  filter?: EventFilter | undefined;
769
873
  properties?: {
@@ -772,21 +876,26 @@ declare const CreateRunBodySchema: z.ZodObject<{
772
876
  text: string;
773
877
  }[] | undefined;
774
878
  schema?: any;
775
- examples?: any[] | undefined;
776
- title: string;
777
- icon: string;
879
+ examples?: {
880
+ icon?: string | undefined;
881
+ payload?: any;
882
+ id: string;
883
+ name: string;
884
+ }[] | undefined;
778
885
  name: string;
886
+ icon: string;
779
887
  source: string;
888
+ title: string;
780
889
  }>;
781
890
  trigger: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
782
891
  type: z.ZodLiteral<"dynamic">;
783
892
  id: z.ZodString;
784
893
  }, "strip", z.ZodTypeAny, {
785
- type: "dynamic";
786
894
  id: string;
787
- }, {
788
895
  type: "dynamic";
896
+ }, {
789
897
  id: string;
898
+ type: "dynamic";
790
899
  }>, z.ZodObject<{
791
900
  type: z.ZodLiteral<"static">;
792
901
  title: z.ZodString;
@@ -928,32 +1037,35 @@ declare const CreateRunBodySchema: z.ZodObject<{
928
1037
  integrations: z.ZodRecord<z.ZodString, z.ZodObject<{
929
1038
  id: z.ZodString;
930
1039
  metadata: z.ZodObject<{
931
- key: z.ZodString;
932
- title: z.ZodString;
933
- icon: z.ZodString;
1040
+ id: z.ZodString;
1041
+ name: z.ZodString;
1042
+ instructions: z.ZodOptional<z.ZodString>;
934
1043
  }, "strip", z.ZodTypeAny, {
935
- key: string;
936
- title: string;
937
- icon: string;
1044
+ instructions?: string | undefined;
1045
+ id: string;
1046
+ name: string;
938
1047
  }, {
939
- key: string;
940
- title: string;
941
- icon: string;
1048
+ instructions?: string | undefined;
1049
+ id: string;
1050
+ name: string;
942
1051
  }>;
1052
+ authSource: z.ZodEnum<["HOSTED", "LOCAL"]>;
943
1053
  }, "strip", z.ZodTypeAny, {
944
1054
  id: string;
945
1055
  metadata: {
946
- key: string;
947
- title: string;
948
- icon: string;
1056
+ instructions?: string | undefined;
1057
+ id: string;
1058
+ name: string;
949
1059
  };
1060
+ authSource: "HOSTED" | "LOCAL";
950
1061
  }, {
951
1062
  id: string;
952
1063
  metadata: {
953
- key: string;
954
- title: string;
955
- icon: string;
1064
+ instructions?: string | undefined;
1065
+ id: string;
1066
+ name: string;
956
1067
  };
1068
+ authSource: "HOSTED" | "LOCAL";
957
1069
  }>>;
958
1070
  internal: z.ZodDefault<z.ZodBoolean>;
959
1071
  queue: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
@@ -984,16 +1096,21 @@ declare const CreateRunBodySchema: z.ZodObject<{
984
1096
  text: string;
985
1097
  }[] | undefined;
986
1098
  schema?: any;
987
- examples?: any[] | undefined;
988
- title: string;
989
- icon: string;
1099
+ examples?: {
1100
+ icon?: string | undefined;
1101
+ payload?: any;
1102
+ id: string;
1103
+ name: string;
1104
+ }[] | undefined;
990
1105
  name: string;
1106
+ icon: string;
991
1107
  source: string;
1108
+ title: string;
992
1109
  };
993
1110
  version: string;
994
1111
  trigger: {
995
- type: "dynamic";
996
1112
  id: string;
1113
+ type: "dynamic";
997
1114
  } | {
998
1115
  properties?: {
999
1116
  url?: string | undefined;
@@ -1027,10 +1144,11 @@ declare const CreateRunBodySchema: z.ZodObject<{
1027
1144
  integrations: Record<string, {
1028
1145
  id: string;
1029
1146
  metadata: {
1030
- key: string;
1031
- title: string;
1032
- icon: string;
1147
+ instructions?: string | undefined;
1148
+ id: string;
1149
+ name: string;
1033
1150
  };
1151
+ authSource: "HOSTED" | "LOCAL";
1034
1152
  }>;
1035
1153
  internal: boolean;
1036
1154
  startPosition: "initial" | "latest";
@@ -1052,16 +1170,21 @@ declare const CreateRunBodySchema: z.ZodObject<{
1052
1170
  text: string;
1053
1171
  }[] | undefined;
1054
1172
  schema?: any;
1055
- examples?: any[] | undefined;
1056
- title: string;
1057
- icon: string;
1173
+ examples?: {
1174
+ icon?: string | undefined;
1175
+ payload?: any;
1176
+ id: string;
1177
+ name: string;
1178
+ }[] | undefined;
1058
1179
  name: string;
1180
+ icon: string;
1059
1181
  source: string;
1182
+ title: string;
1060
1183
  };
1061
1184
  version: string;
1062
1185
  trigger: {
1063
- type: "dynamic";
1064
1186
  id: string;
1187
+ type: "dynamic";
1065
1188
  } | {
1066
1189
  properties?: {
1067
1190
  url?: string | undefined;
@@ -1095,22 +1218,35 @@ declare const CreateRunBodySchema: z.ZodObject<{
1095
1218
  integrations: Record<string, {
1096
1219
  id: string;
1097
1220
  metadata: {
1098
- key: string;
1099
- title: string;
1100
- icon: string;
1221
+ instructions?: string | undefined;
1222
+ id: string;
1223
+ name: string;
1101
1224
  };
1225
+ authSource: "HOSTED" | "LOCAL";
1102
1226
  }>;
1103
1227
  startPosition: "initial" | "latest";
1104
1228
  enabled: boolean;
1105
1229
  preprocessRuns: boolean;
1106
1230
  }>;
1107
1231
  event: z.ZodObject<{
1232
+ /** The `id` of the event that was sent.
1233
+ */
1108
1234
  id: z.ZodString;
1235
+ /** The `name` of the event that was sent. */
1109
1236
  name: z.ZodString;
1237
+ /** The `payload` of the event that was sent */
1110
1238
  payload: z.ZodType<DeserializedJson, z.ZodTypeDef, DeserializedJson>;
1239
+ /** The `context` of the event that was sent. Is `undefined` if no context was
1240
+ set when sending the event. */
1111
1241
  context: z.ZodNullable<z.ZodOptional<z.ZodType<DeserializedJson, z.ZodTypeDef, DeserializedJson>>>;
1242
+ /** The `timestamp` of the event that was sent */
1112
1243
  timestamp: z.ZodDate;
1244
+ /** The timestamp when the event will be delivered to any matching Jobs. Is
1245
+ `undefined` if `deliverAt` or `deliverAfter` wasn't set when sending the
1246
+ event. */
1113
1247
  deliverAt: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
1248
+ /** The timestamp when the event was delivered. Is `undefined` if `deliverAt`
1249
+ or `deliverAfter` were set when sending the event. */
1114
1250
  deliveredAt: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
1115
1251
  }, "strip", z.ZodTypeAny, {
1116
1252
  context?: DeserializedJson | undefined;
@@ -1172,16 +1308,21 @@ declare const CreateRunBodySchema: z.ZodObject<{
1172
1308
  text: string;
1173
1309
  }[] | undefined;
1174
1310
  schema?: any;
1175
- examples?: any[] | undefined;
1176
- title: string;
1177
- icon: string;
1311
+ examples?: {
1312
+ icon?: string | undefined;
1313
+ payload?: any;
1314
+ id: string;
1315
+ name: string;
1316
+ }[] | undefined;
1178
1317
  name: string;
1318
+ icon: string;
1179
1319
  source: string;
1320
+ title: string;
1180
1321
  };
1181
1322
  version: string;
1182
1323
  trigger: {
1183
- type: "dynamic";
1184
1324
  id: string;
1325
+ type: "dynamic";
1185
1326
  } | {
1186
1327
  properties?: {
1187
1328
  url?: string | undefined;
@@ -1215,10 +1356,11 @@ declare const CreateRunBodySchema: z.ZodObject<{
1215
1356
  integrations: Record<string, {
1216
1357
  id: string;
1217
1358
  metadata: {
1218
- key: string;
1219
- title: string;
1220
- icon: string;
1359
+ instructions?: string | undefined;
1360
+ id: string;
1361
+ name: string;
1221
1362
  };
1363
+ authSource: "HOSTED" | "LOCAL";
1222
1364
  }>;
1223
1365
  internal: boolean;
1224
1366
  startPosition: "initial" | "latest";
@@ -1257,16 +1399,21 @@ declare const CreateRunBodySchema: z.ZodObject<{
1257
1399
  text: string;
1258
1400
  }[] | undefined;
1259
1401
  schema?: any;
1260
- examples?: any[] | undefined;
1261
- title: string;
1262
- icon: string;
1402
+ examples?: {
1403
+ icon?: string | undefined;
1404
+ payload?: any;
1405
+ id: string;
1406
+ name: string;
1407
+ }[] | undefined;
1263
1408
  name: string;
1409
+ icon: string;
1264
1410
  source: string;
1411
+ title: string;
1265
1412
  };
1266
1413
  version: string;
1267
1414
  trigger: {
1268
- type: "dynamic";
1269
1415
  id: string;
1416
+ type: "dynamic";
1270
1417
  } | {
1271
1418
  properties?: {
1272
1419
  url?: string | undefined;
@@ -1300,10 +1447,11 @@ declare const CreateRunBodySchema: z.ZodObject<{
1300
1447
  integrations: Record<string, {
1301
1448
  id: string;
1302
1449
  metadata: {
1303
- key: string;
1304
- title: string;
1305
- icon: string;
1450
+ instructions?: string | undefined;
1451
+ id: string;
1452
+ name: string;
1306
1453
  };
1454
+ authSource: "HOSTED" | "LOCAL";
1307
1455
  }>;
1308
1456
  startPosition: "initial" | "latest";
1309
1457
  enabled: boolean;
@@ -1312,29 +1460,60 @@ declare const CreateRunBodySchema: z.ZodObject<{
1312
1460
  client: string;
1313
1461
  }>;
1314
1462
  type CreateRunBody = z.infer<typeof CreateRunBodySchema>;
1315
- declare const SecureStringSchema: z.ZodObject<{
1316
- __secureString: z.ZodLiteral<true>;
1463
+ declare const RedactStringSchema: z.ZodObject<{
1464
+ __redactedString: z.ZodLiteral<true>;
1317
1465
  strings: z.ZodArray<z.ZodString, "many">;
1318
1466
  interpolations: z.ZodArray<z.ZodString, "many">;
1319
1467
  }, "strip", z.ZodTypeAny, {
1320
- __secureString: true;
1468
+ __redactedString: true;
1321
1469
  strings: string[];
1322
1470
  interpolations: string[];
1323
1471
  }, {
1324
- __secureString: true;
1472
+ __redactedString: true;
1325
1473
  strings: string[];
1326
1474
  interpolations: string[];
1327
1475
  }>;
1328
- type SecureString = z.infer<typeof SecureStringSchema>;
1329
- type ServerTask = z.output<typeof ServerTaskSchema>;
1476
+ type RedactString = z.infer<typeof RedactStringSchema>;
1330
1477
  type CachedTask = z.infer<typeof CachedTaskSchema>;
1331
1478
  declare const RunTaskOptionsSchema: z.ZodObject<{
1479
+ /** The name of the Task is required. This is displayed on the Task in the logs. */
1332
1480
  name: z.ZodString;
1481
+ /** The Task will wait and only start at the specified Date */
1482
+ delayUntil: z.ZodOptional<z.ZodDate>;
1483
+ /** Retry options */
1484
+ retry: z.ZodOptional<z.ZodObject<{
1485
+ /** The maximum number of times to retry the request. */
1486
+ limit: z.ZodOptional<z.ZodNumber>;
1487
+ /** The exponential factor to use when calculating the next retry time. */
1488
+ factor: z.ZodOptional<z.ZodNumber>;
1489
+ /** The minimum amount of time to wait before retrying the request. */
1490
+ minTimeoutInMs: z.ZodOptional<z.ZodNumber>;
1491
+ /** The maximum amount of time to wait before retrying the request. */
1492
+ maxTimeoutInMs: z.ZodOptional<z.ZodNumber>;
1493
+ /** Whether to randomize the retry time. */
1494
+ randomize: z.ZodOptional<z.ZodBoolean>;
1495
+ }, "strip", z.ZodTypeAny, {
1496
+ limit?: number | undefined;
1497
+ factor?: number | undefined;
1498
+ minTimeoutInMs?: number | undefined;
1499
+ maxTimeoutInMs?: number | undefined;
1500
+ randomize?: boolean | undefined;
1501
+ }, {
1502
+ limit?: number | undefined;
1503
+ factor?: number | undefined;
1504
+ minTimeoutInMs?: number | undefined;
1505
+ maxTimeoutInMs?: number | undefined;
1506
+ randomize?: boolean | undefined;
1507
+ }>>;
1508
+ /** The icon for the Task, it will appear in the logs.
1509
+ * You can use the name of a company in lowercase, e.g. "github".
1510
+ * Or any icon name that [Font Awesome](https://fontawesome.com/icons) supports. */
1333
1511
  icon: z.ZodOptional<z.ZodString>;
1512
+ /** The key for the Task that you want to appear in the logs */
1334
1513
  displayKey: z.ZodOptional<z.ZodString>;
1335
- noop: z.ZodDefault<z.ZodBoolean>;
1336
- delayUntil: z.ZodOptional<z.ZodDate>;
1514
+ /** A description of the Task */
1337
1515
  description: z.ZodOptional<z.ZodString>;
1516
+ /** Properties that are displayed in the logs */
1338
1517
  properties: z.ZodOptional<z.ZodArray<z.ZodObject<{
1339
1518
  label: z.ZodString;
1340
1519
  text: z.ZodString;
@@ -1348,16 +1527,41 @@ declare const RunTaskOptionsSchema: z.ZodObject<{
1348
1527
  label: string;
1349
1528
  text: string;
1350
1529
  }>, "many">>;
1351
- params: z.ZodOptional<z.ZodType<SerializableJson, z.ZodTypeDef, SerializableJson>>;
1530
+ /** The input params to the Task, will be displayed in the logs */
1531
+ params: z.ZodAny;
1532
+ /** The style of the log entry. */
1533
+ style: z.ZodOptional<z.ZodObject<{
1534
+ style: z.ZodEnum<["normal", "minimal"]>;
1535
+ variant: z.ZodOptional<z.ZodString>;
1536
+ }, "strip", z.ZodTypeAny, {
1537
+ variant?: string | undefined;
1538
+ style: "normal" | "minimal";
1539
+ }, {
1540
+ variant?: string | undefined;
1541
+ style: "normal" | "minimal";
1542
+ }>>;
1543
+ /** Allows you to link the Integration connection in the logs. This is handled automatically in integrations. */
1544
+ connectionKey: z.ZodOptional<z.ZodString>;
1545
+ /** 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. */
1546
+ operation: z.ZodOptional<z.ZodEnum<["fetch"]>>;
1547
+ /** 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). */
1548
+ noop: z.ZodDefault<z.ZodBoolean>;
1549
+ redact: z.ZodOptional<z.ZodObject<{
1550
+ paths: z.ZodArray<z.ZodString, "many">;
1551
+ }, "strip", z.ZodTypeAny, {
1552
+ paths: string[];
1553
+ }, {
1554
+ paths: string[];
1555
+ }>>;
1352
1556
  trigger: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1353
1557
  type: z.ZodLiteral<"dynamic">;
1354
1558
  id: z.ZodString;
1355
1559
  }, "strip", z.ZodTypeAny, {
1356
- type: "dynamic";
1357
1560
  id: string;
1358
- }, {
1359
1561
  type: "dynamic";
1562
+ }, {
1360
1563
  id: string;
1564
+ type: "dynamic";
1361
1565
  }>, z.ZodObject<{
1362
1566
  type: z.ZodLiteral<"static">;
1363
1567
  title: z.ZodString;
@@ -1496,41 +1700,24 @@ declare const RunTaskOptionsSchema: z.ZodObject<{
1496
1700
  type: "interval";
1497
1701
  };
1498
1702
  }>]>>;
1499
- redact: z.ZodOptional<z.ZodObject<{
1500
- paths: z.ZodArray<z.ZodString, "many">;
1501
- }, "strip", z.ZodTypeAny, {
1502
- paths: string[];
1503
- }, {
1504
- paths: string[];
1505
- }>>;
1506
- connectionKey: z.ZodOptional<z.ZodString>;
1507
- style: z.ZodOptional<z.ZodObject<{
1508
- style: z.ZodEnum<["normal", "minimal"]>;
1509
- variant: z.ZodOptional<z.ZodString>;
1510
- }, "strip", z.ZodTypeAny, {
1511
- variant?: string | undefined;
1512
- style: "normal" | "minimal";
1513
- }, {
1514
- variant?: string | undefined;
1515
- style: "normal" | "minimal";
1516
- }>>;
1517
1703
  }, "strip", z.ZodTypeAny, {
1518
- params?: SerializableJson;
1519
1704
  icon?: string | undefined;
1520
- style?: {
1521
- variant?: string | undefined;
1522
- style: "normal" | "minimal";
1523
- } | undefined;
1524
1705
  delayUntil?: Date | undefined;
1525
1706
  description?: string | undefined;
1707
+ params?: any;
1526
1708
  properties?: {
1527
1709
  url?: string | undefined;
1528
1710
  label: string;
1529
1711
  text: string;
1530
1712
  }[] | undefined;
1713
+ style?: {
1714
+ variant?: string | undefined;
1715
+ style: "normal" | "minimal";
1716
+ } | undefined;
1717
+ operation?: "fetch" | undefined;
1531
1718
  trigger?: {
1532
- type: "dynamic";
1533
1719
  id: string;
1720
+ type: "dynamic";
1534
1721
  } | {
1535
1722
  properties?: {
1536
1723
  url?: string | undefined;
@@ -1561,31 +1748,39 @@ declare const RunTaskOptionsSchema: z.ZodObject<{
1561
1748
  type: "interval";
1562
1749
  };
1563
1750
  } | undefined;
1751
+ retry?: {
1752
+ limit?: number | undefined;
1753
+ factor?: number | undefined;
1754
+ minTimeoutInMs?: number | undefined;
1755
+ maxTimeoutInMs?: number | undefined;
1756
+ randomize?: boolean | undefined;
1757
+ } | undefined;
1564
1758
  displayKey?: string | undefined;
1759
+ connectionKey?: string | undefined;
1565
1760
  redact?: {
1566
1761
  paths: string[];
1567
1762
  } | undefined;
1568
- connectionKey?: string | undefined;
1569
1763
  name: string;
1570
1764
  noop: boolean;
1571
1765
  }, {
1572
- params?: SerializableJson;
1573
1766
  icon?: string | undefined;
1574
- style?: {
1575
- variant?: string | undefined;
1576
- style: "normal" | "minimal";
1577
- } | undefined;
1578
1767
  noop?: boolean | undefined;
1579
1768
  delayUntil?: Date | undefined;
1580
1769
  description?: string | undefined;
1770
+ params?: any;
1581
1771
  properties?: {
1582
1772
  url?: string | undefined;
1583
1773
  label: string;
1584
1774
  text: string;
1585
1775
  }[] | undefined;
1776
+ style?: {
1777
+ variant?: string | undefined;
1778
+ style: "normal" | "minimal";
1779
+ } | undefined;
1780
+ operation?: "fetch" | undefined;
1586
1781
  trigger?: {
1587
- type: "dynamic";
1588
1782
  id: string;
1783
+ type: "dynamic";
1589
1784
  } | {
1590
1785
  properties?: {
1591
1786
  url?: string | undefined;
@@ -1616,21 +1811,60 @@ declare const RunTaskOptionsSchema: z.ZodObject<{
1616
1811
  type: "interval";
1617
1812
  };
1618
1813
  } | undefined;
1814
+ retry?: {
1815
+ limit?: number | undefined;
1816
+ factor?: number | undefined;
1817
+ minTimeoutInMs?: number | undefined;
1818
+ maxTimeoutInMs?: number | undefined;
1819
+ randomize?: boolean | undefined;
1820
+ } | undefined;
1619
1821
  displayKey?: string | undefined;
1822
+ connectionKey?: string | undefined;
1620
1823
  redact?: {
1621
1824
  paths: string[];
1622
1825
  } | undefined;
1623
- connectionKey?: string | undefined;
1624
1826
  name: string;
1625
1827
  }>;
1626
1828
  type RunTaskOptions = z.input<typeof RunTaskOptionsSchema>;
1627
1829
  declare const RunTaskBodyInputSchema: z.ZodObject<z.extendShape<{
1830
+ /** The name of the Task is required. This is displayed on the Task in the logs. */
1628
1831
  name: z.ZodString;
1832
+ /** The Task will wait and only start at the specified Date */
1833
+ delayUntil: z.ZodOptional<z.ZodDate>;
1834
+ /** Retry options */
1835
+ retry: z.ZodOptional<z.ZodObject<{
1836
+ /** The maximum number of times to retry the request. */
1837
+ limit: z.ZodOptional<z.ZodNumber>;
1838
+ /** The exponential factor to use when calculating the next retry time. */
1839
+ factor: z.ZodOptional<z.ZodNumber>;
1840
+ /** The minimum amount of time to wait before retrying the request. */
1841
+ minTimeoutInMs: z.ZodOptional<z.ZodNumber>;
1842
+ /** The maximum amount of time to wait before retrying the request. */
1843
+ maxTimeoutInMs: z.ZodOptional<z.ZodNumber>;
1844
+ /** Whether to randomize the retry time. */
1845
+ randomize: z.ZodOptional<z.ZodBoolean>;
1846
+ }, "strip", z.ZodTypeAny, {
1847
+ limit?: number | undefined;
1848
+ factor?: number | undefined;
1849
+ minTimeoutInMs?: number | undefined;
1850
+ maxTimeoutInMs?: number | undefined;
1851
+ randomize?: boolean | undefined;
1852
+ }, {
1853
+ limit?: number | undefined;
1854
+ factor?: number | undefined;
1855
+ minTimeoutInMs?: number | undefined;
1856
+ maxTimeoutInMs?: number | undefined;
1857
+ randomize?: boolean | undefined;
1858
+ }>>;
1859
+ /** The icon for the Task, it will appear in the logs.
1860
+ * You can use the name of a company in lowercase, e.g. "github".
1861
+ * Or any icon name that [Font Awesome](https://fontawesome.com/icons) supports. */
1629
1862
  icon: z.ZodOptional<z.ZodString>;
1863
+ /** The key for the Task that you want to appear in the logs */
1630
1864
  displayKey: z.ZodOptional<z.ZodString>;
1631
- noop: z.ZodDefault<z.ZodBoolean>;
1632
- delayUntil: z.ZodOptional<z.ZodDate>;
1865
+ /** A description of the Task */
1633
1866
  description: z.ZodOptional<z.ZodString>;
1867
+ /** Properties that are displayed in the logs */
1634
1868
  properties: z.ZodOptional<z.ZodArray<z.ZodObject<{
1635
1869
  label: z.ZodString;
1636
1870
  text: z.ZodString;
@@ -1644,16 +1878,41 @@ declare const RunTaskBodyInputSchema: z.ZodObject<z.extendShape<{
1644
1878
  label: string;
1645
1879
  text: string;
1646
1880
  }>, "many">>;
1647
- params: z.ZodOptional<z.ZodType<SerializableJson, z.ZodTypeDef, SerializableJson>>;
1881
+ /** The input params to the Task, will be displayed in the logs */
1882
+ params: z.ZodAny;
1883
+ /** The style of the log entry. */
1884
+ style: z.ZodOptional<z.ZodObject<{
1885
+ style: z.ZodEnum<["normal", "minimal"]>;
1886
+ variant: z.ZodOptional<z.ZodString>;
1887
+ }, "strip", z.ZodTypeAny, {
1888
+ variant?: string | undefined;
1889
+ style: "normal" | "minimal";
1890
+ }, {
1891
+ variant?: string | undefined;
1892
+ style: "normal" | "minimal";
1893
+ }>>;
1894
+ /** Allows you to link the Integration connection in the logs. This is handled automatically in integrations. */
1895
+ connectionKey: z.ZodOptional<z.ZodString>;
1896
+ /** 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. */
1897
+ operation: z.ZodOptional<z.ZodEnum<["fetch"]>>;
1898
+ /** 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). */
1899
+ noop: z.ZodDefault<z.ZodBoolean>;
1900
+ redact: z.ZodOptional<z.ZodObject<{
1901
+ paths: z.ZodArray<z.ZodString, "many">;
1902
+ }, "strip", z.ZodTypeAny, {
1903
+ paths: string[];
1904
+ }, {
1905
+ paths: string[];
1906
+ }>>;
1648
1907
  trigger: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1649
1908
  type: z.ZodLiteral<"dynamic">;
1650
1909
  id: z.ZodString;
1651
1910
  }, "strip", z.ZodTypeAny, {
1652
- type: "dynamic";
1653
1911
  id: string;
1654
- }, {
1655
1912
  type: "dynamic";
1913
+ }, {
1656
1914
  id: string;
1915
+ type: "dynamic";
1657
1916
  }>, z.ZodObject<{
1658
1917
  type: z.ZodLiteral<"static">;
1659
1918
  title: z.ZodString;
@@ -1792,45 +2051,28 @@ declare const RunTaskBodyInputSchema: z.ZodObject<z.extendShape<{
1792
2051
  type: "interval";
1793
2052
  };
1794
2053
  }>]>>;
1795
- redact: z.ZodOptional<z.ZodObject<{
1796
- paths: z.ZodArray<z.ZodString, "many">;
1797
- }, "strip", z.ZodTypeAny, {
1798
- paths: string[];
1799
- }, {
1800
- paths: string[];
1801
- }>>;
1802
- connectionKey: z.ZodOptional<z.ZodString>;
1803
- style: z.ZodOptional<z.ZodObject<{
1804
- style: z.ZodEnum<["normal", "minimal"]>;
1805
- variant: z.ZodOptional<z.ZodString>;
1806
- }, "strip", z.ZodTypeAny, {
1807
- variant?: string | undefined;
1808
- style: "normal" | "minimal";
1809
- }, {
1810
- variant?: string | undefined;
1811
- style: "normal" | "minimal";
1812
- }>>;
1813
2054
  }, {
1814
2055
  idempotencyKey: z.ZodString;
1815
2056
  parentId: z.ZodOptional<z.ZodString>;
1816
2057
  }>, "strip", z.ZodTypeAny, {
1817
- params?: SerializableJson;
1818
2058
  icon?: string | undefined;
1819
- style?: {
1820
- variant?: string | undefined;
1821
- style: "normal" | "minimal";
1822
- } | undefined;
1823
2059
  delayUntil?: Date | undefined;
1824
2060
  description?: string | undefined;
2061
+ params?: any;
1825
2062
  properties?: {
1826
2063
  url?: string | undefined;
1827
2064
  label: string;
1828
2065
  text: string;
1829
2066
  }[] | undefined;
1830
2067
  parentId?: string | undefined;
2068
+ style?: {
2069
+ variant?: string | undefined;
2070
+ style: "normal" | "minimal";
2071
+ } | undefined;
2072
+ operation?: "fetch" | undefined;
1831
2073
  trigger?: {
1832
- type: "dynamic";
1833
2074
  id: string;
2075
+ type: "dynamic";
1834
2076
  } | {
1835
2077
  properties?: {
1836
2078
  url?: string | undefined;
@@ -1861,33 +2103,41 @@ declare const RunTaskBodyInputSchema: z.ZodObject<z.extendShape<{
1861
2103
  type: "interval";
1862
2104
  };
1863
2105
  } | undefined;
2106
+ retry?: {
2107
+ limit?: number | undefined;
2108
+ factor?: number | undefined;
2109
+ minTimeoutInMs?: number | undefined;
2110
+ maxTimeoutInMs?: number | undefined;
2111
+ randomize?: boolean | undefined;
2112
+ } | undefined;
1864
2113
  displayKey?: string | undefined;
2114
+ connectionKey?: string | undefined;
1865
2115
  redact?: {
1866
2116
  paths: string[];
1867
2117
  } | undefined;
1868
- connectionKey?: string | undefined;
1869
2118
  name: string;
1870
2119
  noop: boolean;
1871
2120
  idempotencyKey: string;
1872
2121
  }, {
1873
- params?: SerializableJson;
1874
2122
  icon?: string | undefined;
1875
- style?: {
1876
- variant?: string | undefined;
1877
- style: "normal" | "minimal";
1878
- } | undefined;
1879
2123
  noop?: boolean | undefined;
1880
2124
  delayUntil?: Date | undefined;
1881
2125
  description?: string | undefined;
2126
+ params?: any;
1882
2127
  properties?: {
1883
2128
  url?: string | undefined;
1884
2129
  label: string;
1885
2130
  text: string;
1886
2131
  }[] | undefined;
1887
2132
  parentId?: string | undefined;
2133
+ style?: {
2134
+ variant?: string | undefined;
2135
+ style: "normal" | "minimal";
2136
+ } | undefined;
2137
+ operation?: "fetch" | undefined;
1888
2138
  trigger?: {
1889
- type: "dynamic";
1890
2139
  id: string;
2140
+ type: "dynamic";
1891
2141
  } | {
1892
2142
  properties?: {
1893
2143
  url?: string | undefined;
@@ -1918,22 +2168,61 @@ declare const RunTaskBodyInputSchema: z.ZodObject<z.extendShape<{
1918
2168
  type: "interval";
1919
2169
  };
1920
2170
  } | undefined;
2171
+ retry?: {
2172
+ limit?: number | undefined;
2173
+ factor?: number | undefined;
2174
+ minTimeoutInMs?: number | undefined;
2175
+ maxTimeoutInMs?: number | undefined;
2176
+ randomize?: boolean | undefined;
2177
+ } | undefined;
1921
2178
  displayKey?: string | undefined;
2179
+ connectionKey?: string | undefined;
1922
2180
  redact?: {
1923
2181
  paths: string[];
1924
2182
  } | undefined;
1925
- connectionKey?: string | undefined;
1926
2183
  name: string;
1927
2184
  idempotencyKey: string;
1928
2185
  }>;
1929
2186
  type RunTaskBodyInput = z.infer<typeof RunTaskBodyInputSchema>;
1930
2187
  declare const CompleteTaskBodyInputSchema: z.ZodObject<z.extendShape<Pick<z.extendShape<{
2188
+ /** The name of the Task is required. This is displayed on the Task in the logs. */
1931
2189
  name: z.ZodString;
2190
+ /** The Task will wait and only start at the specified Date */
2191
+ delayUntil: z.ZodOptional<z.ZodDate>;
2192
+ /** Retry options */
2193
+ retry: z.ZodOptional<z.ZodObject<{
2194
+ /** The maximum number of times to retry the request. */
2195
+ limit: z.ZodOptional<z.ZodNumber>;
2196
+ /** The exponential factor to use when calculating the next retry time. */
2197
+ factor: z.ZodOptional<z.ZodNumber>;
2198
+ /** The minimum amount of time to wait before retrying the request. */
2199
+ minTimeoutInMs: z.ZodOptional<z.ZodNumber>;
2200
+ /** The maximum amount of time to wait before retrying the request. */
2201
+ maxTimeoutInMs: z.ZodOptional<z.ZodNumber>;
2202
+ /** Whether to randomize the retry time. */
2203
+ randomize: z.ZodOptional<z.ZodBoolean>;
2204
+ }, "strip", z.ZodTypeAny, {
2205
+ limit?: number | undefined;
2206
+ factor?: number | undefined;
2207
+ minTimeoutInMs?: number | undefined;
2208
+ maxTimeoutInMs?: number | undefined;
2209
+ randomize?: boolean | undefined;
2210
+ }, {
2211
+ limit?: number | undefined;
2212
+ factor?: number | undefined;
2213
+ minTimeoutInMs?: number | undefined;
2214
+ maxTimeoutInMs?: number | undefined;
2215
+ randomize?: boolean | undefined;
2216
+ }>>;
2217
+ /** The icon for the Task, it will appear in the logs.
2218
+ * You can use the name of a company in lowercase, e.g. "github".
2219
+ * Or any icon name that [Font Awesome](https://fontawesome.com/icons) supports. */
1932
2220
  icon: z.ZodOptional<z.ZodString>;
2221
+ /** The key for the Task that you want to appear in the logs */
1933
2222
  displayKey: z.ZodOptional<z.ZodString>;
1934
- noop: z.ZodDefault<z.ZodBoolean>;
1935
- delayUntil: z.ZodOptional<z.ZodDate>;
2223
+ /** A description of the Task */
1936
2224
  description: z.ZodOptional<z.ZodString>;
2225
+ /** Properties that are displayed in the logs */
1937
2226
  properties: z.ZodOptional<z.ZodArray<z.ZodObject<{
1938
2227
  label: z.ZodString;
1939
2228
  text: z.ZodString;
@@ -1947,16 +2236,41 @@ declare const CompleteTaskBodyInputSchema: z.ZodObject<z.extendShape<Pick<z.exte
1947
2236
  label: string;
1948
2237
  text: string;
1949
2238
  }>, "many">>;
1950
- params: z.ZodOptional<z.ZodType<SerializableJson, z.ZodTypeDef, SerializableJson>>;
2239
+ /** The input params to the Task, will be displayed in the logs */
2240
+ params: z.ZodAny;
2241
+ /** The style of the log entry. */
2242
+ style: z.ZodOptional<z.ZodObject<{
2243
+ style: z.ZodEnum<["normal", "minimal"]>;
2244
+ variant: z.ZodOptional<z.ZodString>;
2245
+ }, "strip", z.ZodTypeAny, {
2246
+ variant?: string | undefined;
2247
+ style: "normal" | "minimal";
2248
+ }, {
2249
+ variant?: string | undefined;
2250
+ style: "normal" | "minimal";
2251
+ }>>;
2252
+ /** Allows you to link the Integration connection in the logs. This is handled automatically in integrations. */
2253
+ connectionKey: z.ZodOptional<z.ZodString>;
2254
+ /** 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. */
2255
+ operation: z.ZodOptional<z.ZodEnum<["fetch"]>>;
2256
+ /** 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). */
2257
+ noop: z.ZodDefault<z.ZodBoolean>;
2258
+ redact: z.ZodOptional<z.ZodObject<{
2259
+ paths: z.ZodArray<z.ZodString, "many">;
2260
+ }, "strip", z.ZodTypeAny, {
2261
+ paths: string[];
2262
+ }, {
2263
+ paths: string[];
2264
+ }>>;
1951
2265
  trigger: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1952
2266
  type: z.ZodLiteral<"dynamic">;
1953
2267
  id: z.ZodString;
1954
2268
  }, "strip", z.ZodTypeAny, {
1955
- type: "dynamic";
1956
2269
  id: string;
1957
- }, {
1958
2270
  type: "dynamic";
2271
+ }, {
1959
2272
  id: string;
2273
+ type: "dynamic";
1960
2274
  }>, z.ZodObject<{
1961
2275
  type: z.ZodLiteral<"static">;
1962
2276
  title: z.ZodString;
@@ -2095,34 +2409,16 @@ declare const CompleteTaskBodyInputSchema: z.ZodObject<z.extendShape<Pick<z.exte
2095
2409
  type: "interval";
2096
2410
  };
2097
2411
  }>]>>;
2098
- redact: z.ZodOptional<z.ZodObject<{
2099
- paths: z.ZodArray<z.ZodString, "many">;
2100
- }, "strip", z.ZodTypeAny, {
2101
- paths: string[];
2102
- }, {
2103
- paths: string[];
2104
- }>>;
2105
- connectionKey: z.ZodOptional<z.ZodString>;
2106
- style: z.ZodOptional<z.ZodObject<{
2107
- style: z.ZodEnum<["normal", "minimal"]>;
2108
- variant: z.ZodOptional<z.ZodString>;
2109
- }, "strip", z.ZodTypeAny, {
2110
- variant?: string | undefined;
2111
- style: "normal" | "minimal";
2112
- }, {
2113
- variant?: string | undefined;
2114
- style: "normal" | "minimal";
2115
- }>>;
2116
2412
  }, {
2117
2413
  idempotencyKey: z.ZodString;
2118
2414
  parentId: z.ZodOptional<z.ZodString>;
2119
- }>, "params" | "description" | "properties">, {
2415
+ }>, "description" | "params" | "properties">, {
2120
2416
  output: z.ZodEffects<z.ZodOptional<z.ZodType<SerializableJson, z.ZodTypeDef, SerializableJson>>, string | number | boolean | {
2121
2417
  [key: string]: DeserializedJson;
2122
2418
  } | DeserializedJson[] | null, SerializableJson>;
2123
2419
  }>, "strip", z.ZodTypeAny, {
2124
- params?: SerializableJson;
2125
2420
  description?: string | undefined;
2421
+ params?: any;
2126
2422
  properties?: {
2127
2423
  url?: string | undefined;
2128
2424
  label: string;
@@ -2132,8 +2428,8 @@ declare const CompleteTaskBodyInputSchema: z.ZodObject<z.extendShape<Pick<z.exte
2132
2428
  [key: string]: DeserializedJson;
2133
2429
  } | DeserializedJson[] | null;
2134
2430
  }, {
2135
- params?: SerializableJson;
2136
2431
  description?: string | undefined;
2432
+ params?: any;
2137
2433
  properties?: {
2138
2434
  url?: string | undefined;
2139
2435
  label: string;
@@ -2142,6 +2438,34 @@ declare const CompleteTaskBodyInputSchema: z.ZodObject<z.extendShape<Pick<z.exte
2142
2438
  output?: SerializableJson;
2143
2439
  }>;
2144
2440
  type CompleteTaskBodyInput = z.input<typeof CompleteTaskBodyInputSchema>;
2441
+ declare const FailTaskBodyInputSchema: z.ZodObject<{
2442
+ error: z.ZodObject<{
2443
+ message: z.ZodString;
2444
+ name: z.ZodOptional<z.ZodString>;
2445
+ stack: z.ZodOptional<z.ZodString>;
2446
+ }, "strip", z.ZodTypeAny, {
2447
+ name?: string | undefined;
2448
+ stack?: string | undefined;
2449
+ message: string;
2450
+ }, {
2451
+ name?: string | undefined;
2452
+ stack?: string | undefined;
2453
+ message: string;
2454
+ }>;
2455
+ }, "strip", z.ZodTypeAny, {
2456
+ error: {
2457
+ name?: string | undefined;
2458
+ stack?: string | undefined;
2459
+ message: string;
2460
+ };
2461
+ }, {
2462
+ error: {
2463
+ name?: string | undefined;
2464
+ stack?: string | undefined;
2465
+ message: string;
2466
+ };
2467
+ }>;
2468
+ type FailTaskBodyInput = z.infer<typeof FailTaskBodyInputSchema>;
2145
2469
  declare const NormalizedRequestSchema: z.ZodObject<{
2146
2470
  headers: z.ZodRecord<z.ZodString, z.ZodString>;
2147
2471
  method: z.ZodString;
@@ -2195,30 +2519,86 @@ declare const RegisterTriggerBodySchema: z.ZodObject<{
2195
2519
  }>;
2196
2520
  source: z.ZodObject<{
2197
2521
  channel: z.ZodEnum<["HTTP", "SQS", "SMTP"]>;
2522
+ integration: z.ZodObject<{
2523
+ id: z.ZodString;
2524
+ metadata: z.ZodObject<{
2525
+ id: z.ZodString;
2526
+ name: z.ZodString;
2527
+ instructions: z.ZodOptional<z.ZodString>;
2528
+ }, "strip", z.ZodTypeAny, {
2529
+ instructions?: string | undefined;
2530
+ id: string;
2531
+ name: string;
2532
+ }, {
2533
+ instructions?: string | undefined;
2534
+ id: string;
2535
+ name: string;
2536
+ }>;
2537
+ authSource: z.ZodEnum<["HOSTED", "LOCAL"]>;
2538
+ }, "strip", z.ZodTypeAny, {
2539
+ id: string;
2540
+ metadata: {
2541
+ instructions?: string | undefined;
2542
+ id: string;
2543
+ name: string;
2544
+ };
2545
+ authSource: "HOSTED" | "LOCAL";
2546
+ }, {
2547
+ id: string;
2548
+ metadata: {
2549
+ instructions?: string | undefined;
2550
+ id: string;
2551
+ name: string;
2552
+ };
2553
+ authSource: "HOSTED" | "LOCAL";
2554
+ }>;
2198
2555
  key: z.ZodString;
2199
2556
  params: z.ZodAny;
2200
2557
  events: z.ZodArray<z.ZodString, "many">;
2201
- clientId: z.ZodOptional<z.ZodString>;
2202
2558
  }, "strip", z.ZodTypeAny, {
2203
2559
  params?: any;
2204
- clientId?: string | undefined;
2205
2560
  key: string;
2206
2561
  channel: "HTTP" | "SMTP" | "SQS";
2207
2562
  events: string[];
2563
+ integration: {
2564
+ id: string;
2565
+ metadata: {
2566
+ instructions?: string | undefined;
2567
+ id: string;
2568
+ name: string;
2569
+ };
2570
+ authSource: "HOSTED" | "LOCAL";
2571
+ };
2208
2572
  }, {
2209
2573
  params?: any;
2210
- clientId?: string | undefined;
2211
2574
  key: string;
2212
2575
  channel: "HTTP" | "SMTP" | "SQS";
2213
2576
  events: string[];
2577
+ integration: {
2578
+ id: string;
2579
+ metadata: {
2580
+ instructions?: string | undefined;
2581
+ id: string;
2582
+ name: string;
2583
+ };
2584
+ authSource: "HOSTED" | "LOCAL";
2585
+ };
2214
2586
  }>;
2215
2587
  }, "strip", z.ZodTypeAny, {
2216
2588
  source: {
2217
2589
  params?: any;
2218
- clientId?: string | undefined;
2219
2590
  key: string;
2220
2591
  channel: "HTTP" | "SMTP" | "SQS";
2221
2592
  events: string[];
2593
+ integration: {
2594
+ id: string;
2595
+ metadata: {
2596
+ instructions?: string | undefined;
2597
+ id: string;
2598
+ name: string;
2599
+ };
2600
+ authSource: "HOSTED" | "LOCAL";
2601
+ };
2222
2602
  };
2223
2603
  rule: {
2224
2604
  payload?: EventFilter | undefined;
@@ -2229,10 +2609,18 @@ declare const RegisterTriggerBodySchema: z.ZodObject<{
2229
2609
  }, {
2230
2610
  source: {
2231
2611
  params?: any;
2232
- clientId?: string | undefined;
2233
2612
  key: string;
2234
2613
  channel: "HTTP" | "SMTP" | "SQS";
2235
2614
  events: string[];
2615
+ integration: {
2616
+ id: string;
2617
+ metadata: {
2618
+ instructions?: string | undefined;
2619
+ id: string;
2620
+ name: string;
2621
+ };
2622
+ authSource: "HOSTED" | "LOCAL";
2623
+ };
2236
2624
  };
2237
2625
  rule: {
2238
2626
  payload?: EventFilter | undefined;
@@ -2247,11 +2635,11 @@ declare const TriggerMetadataSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObjec
2247
2635
  type: z.ZodLiteral<"dynamic">;
2248
2636
  id: z.ZodString;
2249
2637
  }, "strip", z.ZodTypeAny, {
2250
- type: "dynamic";
2251
2638
  id: string;
2252
- }, {
2253
2639
  type: "dynamic";
2640
+ }, {
2254
2641
  id: string;
2642
+ type: "dynamic";
2255
2643
  }>, z.ZodObject<{
2256
2644
  type: z.ZodLiteral<"static">;
2257
2645
  title: z.ZodString;
@@ -2392,9 +2780,28 @@ declare const TriggerMetadataSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObjec
2392
2780
  }>]>;
2393
2781
  type TriggerMetadata = z.infer<typeof TriggerMetadataSchema>;
2394
2782
 
2783
+ declare const ErrorWithStackSchema: z.ZodObject<{
2784
+ message: z.ZodString;
2785
+ name: z.ZodOptional<z.ZodString>;
2786
+ stack: z.ZodOptional<z.ZodString>;
2787
+ }, "strip", z.ZodTypeAny, {
2788
+ name?: string | undefined;
2789
+ stack?: string | undefined;
2790
+ message: string;
2791
+ }, {
2792
+ name?: string | undefined;
2793
+ stack?: string | undefined;
2794
+ message: string;
2795
+ }>;
2796
+ type ErrorWithStack = z.infer<typeof ErrorWithStackSchema>;
2797
+
2798
+ /** A property that is displayed in the logs */
2395
2799
  declare const DisplayPropertySchema: z.ZodObject<{
2800
+ /** The label for the property */
2396
2801
  label: z.ZodString;
2802
+ /** The value of the property */
2397
2803
  text: z.ZodString;
2804
+ /** The URL to link to when the property is clicked */
2398
2805
  url: z.ZodOptional<z.ZodString>;
2399
2806
  }, "strip", z.ZodTypeAny, {
2400
2807
  url?: string | undefined;
@@ -2425,48 +2832,51 @@ declare const ConnectionAuthSchema: z.ZodObject<{
2425
2832
  }>;
2426
2833
  type ConnectionAuth = z.infer<typeof ConnectionAuthSchema>;
2427
2834
  declare const IntegrationMetadataSchema: z.ZodObject<{
2428
- key: z.ZodString;
2429
- title: z.ZodString;
2430
- icon: z.ZodString;
2835
+ id: z.ZodString;
2836
+ name: z.ZodString;
2837
+ instructions: z.ZodOptional<z.ZodString>;
2431
2838
  }, "strip", z.ZodTypeAny, {
2432
- key: string;
2433
- title: string;
2434
- icon: string;
2839
+ instructions?: string | undefined;
2840
+ id: string;
2841
+ name: string;
2435
2842
  }, {
2436
- key: string;
2437
- title: string;
2438
- icon: string;
2843
+ instructions?: string | undefined;
2844
+ id: string;
2845
+ name: string;
2439
2846
  }>;
2440
2847
  type IntegrationMetadata = z.infer<typeof IntegrationMetadataSchema>;
2441
2848
  declare const IntegrationConfigSchema: z.ZodObject<{
2442
2849
  id: z.ZodString;
2443
2850
  metadata: z.ZodObject<{
2444
- key: z.ZodString;
2445
- title: z.ZodString;
2446
- icon: z.ZodString;
2851
+ id: z.ZodString;
2852
+ name: z.ZodString;
2853
+ instructions: z.ZodOptional<z.ZodString>;
2447
2854
  }, "strip", z.ZodTypeAny, {
2448
- key: string;
2449
- title: string;
2450
- icon: string;
2855
+ instructions?: string | undefined;
2856
+ id: string;
2857
+ name: string;
2451
2858
  }, {
2452
- key: string;
2453
- title: string;
2454
- icon: string;
2859
+ instructions?: string | undefined;
2860
+ id: string;
2861
+ name: string;
2455
2862
  }>;
2863
+ authSource: z.ZodEnum<["HOSTED", "LOCAL"]>;
2456
2864
  }, "strip", z.ZodTypeAny, {
2457
2865
  id: string;
2458
2866
  metadata: {
2459
- key: string;
2460
- title: string;
2461
- icon: string;
2867
+ instructions?: string | undefined;
2868
+ id: string;
2869
+ name: string;
2462
2870
  };
2871
+ authSource: "HOSTED" | "LOCAL";
2463
2872
  }, {
2464
2873
  id: string;
2465
2874
  metadata: {
2466
- key: string;
2467
- title: string;
2468
- icon: string;
2875
+ instructions?: string | undefined;
2876
+ id: string;
2877
+ name: string;
2469
2878
  };
2879
+ authSource: "HOSTED" | "LOCAL";
2470
2880
  }>;
2471
2881
  type IntegrationConfig = z.infer<typeof IntegrationConfigSchema>;
2472
2882
 
@@ -2482,14 +2892,19 @@ declare const ScheduledPayloadSchema: z.ZodObject<{
2482
2892
  }>;
2483
2893
  type ScheduledPayload = z.infer<typeof ScheduledPayloadSchema>;
2484
2894
  declare const IntervalOptionsSchema: z.ZodObject<{
2895
+ /** The number of seconds for the interval. Min = 60, Max = 86400 (1 day) */
2485
2896
  seconds: z.ZodNumber;
2486
2897
  }, "strip", z.ZodTypeAny, {
2487
2898
  seconds: number;
2488
2899
  }, {
2489
2900
  seconds: number;
2490
2901
  }>;
2902
+ /** Interval options */
2491
2903
  type IntervalOptions = z.infer<typeof IntervalOptionsSchema>;
2492
2904
  declare const CronOptionsSchema: z.ZodObject<{
2905
+ /** A CRON expression that defines the schedule. A useful tool when writing CRON
2906
+ expressions is [crontab guru](https://crontab.guru). Note that the timezone
2907
+ used is UTC. */
2493
2908
  cron: z.ZodString;
2494
2909
  }, "strip", z.ZodTypeAny, {
2495
2910
  cron: string;
@@ -2498,14 +2913,18 @@ declare const CronOptionsSchema: z.ZodObject<{
2498
2913
  }>;
2499
2914
  type CronOptions = z.infer<typeof CronOptionsSchema>;
2500
2915
  declare const ScheduleMetadataSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2916
+ /** An interval reoccurs at the specified number of seconds */
2501
2917
  type: z.ZodLiteral<"interval">;
2918
+ /** An object containing options about the interval. */
2502
2919
  options: z.ZodObject<{
2920
+ /** The number of seconds for the interval. Min = 60, Max = 86400 (1 day) */
2503
2921
  seconds: z.ZodNumber;
2504
2922
  }, "strip", z.ZodTypeAny, {
2505
2923
  seconds: number;
2506
2924
  }, {
2507
2925
  seconds: number;
2508
2926
  }>;
2927
+ /** Any additional metadata about the schedule. */
2509
2928
  metadata: z.ZodAny;
2510
2929
  }, "strip", z.ZodTypeAny, {
2511
2930
  metadata?: any;
@@ -2522,6 +2941,9 @@ declare const ScheduleMetadataSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
2522
2941
  }>, z.ZodObject<{
2523
2942
  type: z.ZodLiteral<"cron">;
2524
2943
  options: z.ZodObject<{
2944
+ /** A CRON expression that defines the schedule. A useful tool when writing CRON
2945
+ expressions is [crontab guru](https://crontab.guru). Note that the timezone
2946
+ used is UTC. */
2525
2947
  cron: z.ZodString;
2526
2948
  }, "strip", z.ZodTypeAny, {
2527
2949
  cron: string;
@@ -2552,52 +2974,42 @@ declare const MissingConnectionNotificationPayloadSchema: z.ZodDiscriminatedUnio
2552
2974
  scopes: z.ZodArray<z.ZodString, "many">;
2553
2975
  createdAt: z.ZodDate;
2554
2976
  updatedAt: z.ZodDate;
2555
- integrationIdentifier: z.ZodString;
2556
- integrationAuthMethod: z.ZodString;
2557
2977
  }, "strip", z.ZodTypeAny, {
2978
+ id: string;
2558
2979
  scopes: string[];
2559
2980
  title: string;
2560
- id: string;
2561
2981
  createdAt: Date;
2562
2982
  updatedAt: Date;
2563
- integrationIdentifier: string;
2564
- integrationAuthMethod: string;
2565
2983
  }, {
2984
+ id: string;
2566
2985
  scopes: string[];
2567
2986
  title: string;
2568
- id: string;
2569
2987
  createdAt: Date;
2570
2988
  updatedAt: Date;
2571
- integrationIdentifier: string;
2572
- integrationAuthMethod: string;
2573
2989
  }>;
2574
2990
  authorizationUrl: z.ZodString;
2575
2991
  }, {
2576
2992
  type: z.ZodLiteral<"DEVELOPER">;
2577
2993
  }>, "strip", z.ZodTypeAny, {
2578
- type: "DEVELOPER";
2579
2994
  id: string;
2995
+ type: "DEVELOPER";
2580
2996
  client: {
2997
+ id: string;
2581
2998
  scopes: string[];
2582
2999
  title: string;
2583
- id: string;
2584
3000
  createdAt: Date;
2585
3001
  updatedAt: Date;
2586
- integrationIdentifier: string;
2587
- integrationAuthMethod: string;
2588
3002
  };
2589
3003
  authorizationUrl: string;
2590
3004
  }, {
2591
- type: "DEVELOPER";
2592
3005
  id: string;
3006
+ type: "DEVELOPER";
2593
3007
  client: {
3008
+ id: string;
2594
3009
  scopes: string[];
2595
3010
  title: string;
2596
- id: string;
2597
3011
  createdAt: Date;
2598
3012
  updatedAt: Date;
2599
- integrationIdentifier: string;
2600
- integrationAuthMethod: string;
2601
3013
  };
2602
3014
  authorizationUrl: string;
2603
3015
  }>, z.ZodObject<z.extendShape<{
@@ -2608,24 +3020,18 @@ declare const MissingConnectionNotificationPayloadSchema: z.ZodDiscriminatedUnio
2608
3020
  scopes: z.ZodArray<z.ZodString, "many">;
2609
3021
  createdAt: z.ZodDate;
2610
3022
  updatedAt: z.ZodDate;
2611
- integrationIdentifier: z.ZodString;
2612
- integrationAuthMethod: z.ZodString;
2613
3023
  }, "strip", z.ZodTypeAny, {
3024
+ id: string;
2614
3025
  scopes: string[];
2615
3026
  title: string;
2616
- id: string;
2617
3027
  createdAt: Date;
2618
3028
  updatedAt: Date;
2619
- integrationIdentifier: string;
2620
- integrationAuthMethod: string;
2621
3029
  }, {
3030
+ id: string;
2622
3031
  scopes: string[];
2623
3032
  title: string;
2624
- id: string;
2625
3033
  createdAt: Date;
2626
3034
  updatedAt: Date;
2627
- integrationIdentifier: string;
2628
- integrationAuthMethod: string;
2629
3035
  }>;
2630
3036
  authorizationUrl: z.ZodString;
2631
3037
  }, {
@@ -2641,37 +3047,33 @@ declare const MissingConnectionNotificationPayloadSchema: z.ZodDiscriminatedUnio
2641
3047
  id: string;
2642
3048
  }>;
2643
3049
  }>, "strip", z.ZodTypeAny, {
2644
- type: "EXTERNAL";
2645
3050
  id: string;
3051
+ type: "EXTERNAL";
2646
3052
  account: {
2647
3053
  metadata?: any;
2648
3054
  id: string;
2649
3055
  };
2650
3056
  client: {
3057
+ id: string;
2651
3058
  scopes: string[];
2652
3059
  title: string;
2653
- id: string;
2654
3060
  createdAt: Date;
2655
3061
  updatedAt: Date;
2656
- integrationIdentifier: string;
2657
- integrationAuthMethod: string;
2658
3062
  };
2659
3063
  authorizationUrl: string;
2660
3064
  }, {
2661
- type: "EXTERNAL";
2662
3065
  id: string;
3066
+ type: "EXTERNAL";
2663
3067
  account: {
2664
3068
  metadata?: any;
2665
3069
  id: string;
2666
3070
  };
2667
3071
  client: {
3072
+ id: string;
2668
3073
  scopes: string[];
2669
3074
  title: string;
2670
- id: string;
2671
3075
  createdAt: Date;
2672
3076
  updatedAt: Date;
2673
- integrationIdentifier: string;
2674
- integrationAuthMethod: string;
2675
3077
  };
2676
3078
  authorizationUrl: string;
2677
3079
  }>]>;
@@ -2687,17 +3089,17 @@ declare const MissingConnectionResolvedNotificationPayloadSchema: z.ZodDiscrimin
2687
3089
  integrationIdentifier: z.ZodString;
2688
3090
  integrationAuthMethod: z.ZodString;
2689
3091
  }, "strip", z.ZodTypeAny, {
3092
+ id: string;
2690
3093
  scopes: string[];
2691
3094
  title: string;
2692
- id: string;
2693
3095
  createdAt: Date;
2694
3096
  updatedAt: Date;
2695
3097
  integrationIdentifier: string;
2696
3098
  integrationAuthMethod: string;
2697
3099
  }, {
3100
+ id: string;
2698
3101
  scopes: string[];
2699
3102
  title: string;
2700
- id: string;
2701
3103
  createdAt: Date;
2702
3104
  updatedAt: Date;
2703
3105
  integrationIdentifier: string;
@@ -2707,12 +3109,12 @@ declare const MissingConnectionResolvedNotificationPayloadSchema: z.ZodDiscrimin
2707
3109
  }, {
2708
3110
  type: z.ZodLiteral<"DEVELOPER">;
2709
3111
  }>, "strip", z.ZodTypeAny, {
2710
- type: "DEVELOPER";
2711
3112
  id: string;
3113
+ type: "DEVELOPER";
2712
3114
  client: {
3115
+ id: string;
2713
3116
  scopes: string[];
2714
3117
  title: string;
2715
- id: string;
2716
3118
  createdAt: Date;
2717
3119
  updatedAt: Date;
2718
3120
  integrationIdentifier: string;
@@ -2720,12 +3122,12 @@ declare const MissingConnectionResolvedNotificationPayloadSchema: z.ZodDiscrimin
2720
3122
  };
2721
3123
  expiresAt: Date;
2722
3124
  }, {
2723
- type: "DEVELOPER";
2724
3125
  id: string;
3126
+ type: "DEVELOPER";
2725
3127
  client: {
3128
+ id: string;
2726
3129
  scopes: string[];
2727
3130
  title: string;
2728
- id: string;
2729
3131
  createdAt: Date;
2730
3132
  updatedAt: Date;
2731
3133
  integrationIdentifier: string;
@@ -2743,17 +3145,17 @@ declare const MissingConnectionResolvedNotificationPayloadSchema: z.ZodDiscrimin
2743
3145
  integrationIdentifier: z.ZodString;
2744
3146
  integrationAuthMethod: z.ZodString;
2745
3147
  }, "strip", z.ZodTypeAny, {
3148
+ id: string;
2746
3149
  scopes: string[];
2747
3150
  title: string;
2748
- id: string;
2749
3151
  createdAt: Date;
2750
3152
  updatedAt: Date;
2751
3153
  integrationIdentifier: string;
2752
3154
  integrationAuthMethod: string;
2753
3155
  }, {
3156
+ id: string;
2754
3157
  scopes: string[];
2755
3158
  title: string;
2756
- id: string;
2757
3159
  createdAt: Date;
2758
3160
  updatedAt: Date;
2759
3161
  integrationIdentifier: string;
@@ -2773,16 +3175,16 @@ declare const MissingConnectionResolvedNotificationPayloadSchema: z.ZodDiscrimin
2773
3175
  id: string;
2774
3176
  }>;
2775
3177
  }>, "strip", z.ZodTypeAny, {
2776
- type: "EXTERNAL";
2777
3178
  id: string;
3179
+ type: "EXTERNAL";
2778
3180
  account: {
2779
3181
  metadata?: any;
2780
3182
  id: string;
2781
3183
  };
2782
3184
  client: {
3185
+ id: string;
2783
3186
  scopes: string[];
2784
3187
  title: string;
2785
- id: string;
2786
3188
  createdAt: Date;
2787
3189
  updatedAt: Date;
2788
3190
  integrationIdentifier: string;
@@ -2790,16 +3192,16 @@ declare const MissingConnectionResolvedNotificationPayloadSchema: z.ZodDiscrimin
2790
3192
  };
2791
3193
  expiresAt: Date;
2792
3194
  }, {
2793
- type: "EXTERNAL";
2794
3195
  id: string;
3196
+ type: "EXTERNAL";
2795
3197
  account: {
2796
3198
  metadata?: any;
2797
3199
  id: string;
2798
3200
  };
2799
3201
  client: {
3202
+ id: string;
2800
3203
  scopes: string[];
2801
3204
  title: string;
2802
- id: string;
2803
3205
  createdAt: Date;
2804
3206
  updatedAt: Date;
2805
3207
  integrationIdentifier: string;
@@ -2809,6 +3211,99 @@ declare const MissingConnectionResolvedNotificationPayloadSchema: z.ZodDiscrimin
2809
3211
  }>]>;
2810
3212
  type MissingConnectionResolvedNotificationPayload = z.infer<typeof MissingConnectionResolvedNotificationPayloadSchema>;
2811
3213
 
3214
+ /** The options for a fetch request */
3215
+ declare const FetchRequestInitSchema: z.ZodObject<{
3216
+ /** The HTTP method to use for the request. */
3217
+ method: z.ZodOptional<z.ZodString>;
3218
+ /** 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. */
3219
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodObject<{
3220
+ __redactedString: z.ZodLiteral<true>;
3221
+ strings: z.ZodArray<z.ZodString, "many">;
3222
+ interpolations: z.ZodArray<z.ZodString, "many">;
3223
+ }, "strip", z.ZodTypeAny, {
3224
+ __redactedString: true;
3225
+ strings: string[];
3226
+ interpolations: string[];
3227
+ }, {
3228
+ __redactedString: true;
3229
+ strings: string[];
3230
+ interpolations: string[];
3231
+ }>]>>>;
3232
+ /** The body of the request. */
3233
+ body: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodType<ArrayBuffer, z.ZodTypeDef, ArrayBuffer>]>>;
3234
+ }, "strip", z.ZodTypeAny, {
3235
+ method?: string | undefined;
3236
+ headers?: Record<string, string | {
3237
+ __redactedString: true;
3238
+ strings: string[];
3239
+ interpolations: string[];
3240
+ }> | undefined;
3241
+ body?: string | ArrayBuffer | undefined;
3242
+ }, {
3243
+ method?: string | undefined;
3244
+ headers?: Record<string, string | {
3245
+ __redactedString: true;
3246
+ strings: string[];
3247
+ interpolations: string[];
3248
+ }> | undefined;
3249
+ body?: string | ArrayBuffer | undefined;
3250
+ }>;
3251
+ /** The options for a fetch request */
3252
+ type FetchRequestInit = z.infer<typeof FetchRequestInitSchema>;
3253
+ declare const FetchRetryOptionsSchema: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<"strategy", [z.ZodObject<{
3254
+ /** The `headers` strategy retries the request using info from the response headers. */
3255
+ strategy: z.ZodLiteral<"headers">;
3256
+ /** The header to use to determine the maximum number of times to retry the request. */
3257
+ limitHeader: z.ZodString;
3258
+ /** The header to use to determine the number of remaining retries. */
3259
+ remainingHeader: z.ZodString;
3260
+ /** The header to use to determine the time when the number of remaining retries will be reset. */
3261
+ resetHeader: z.ZodString;
3262
+ }, "strip", z.ZodTypeAny, {
3263
+ strategy: "headers";
3264
+ limitHeader: string;
3265
+ remainingHeader: string;
3266
+ resetHeader: string;
3267
+ }, {
3268
+ strategy: "headers";
3269
+ limitHeader: string;
3270
+ remainingHeader: string;
3271
+ resetHeader: string;
3272
+ }>, z.ZodObject<z.extendShape<{
3273
+ limit: z.ZodOptional<z.ZodNumber>;
3274
+ factor: z.ZodOptional<z.ZodNumber>;
3275
+ minTimeoutInMs: z.ZodOptional<z.ZodNumber>;
3276
+ maxTimeoutInMs: z.ZodOptional<z.ZodNumber>;
3277
+ randomize: z.ZodOptional<z.ZodBoolean>;
3278
+ }, {
3279
+ /** The `backoff` strategy retries the request with an exponential backoff. */
3280
+ strategy: z.ZodLiteral<"backoff">;
3281
+ }>, "strip", z.ZodTypeAny, {
3282
+ limit?: number | undefined;
3283
+ factor?: number | undefined;
3284
+ minTimeoutInMs?: number | undefined;
3285
+ maxTimeoutInMs?: number | undefined;
3286
+ randomize?: boolean | undefined;
3287
+ strategy: "backoff";
3288
+ }, {
3289
+ limit?: number | undefined;
3290
+ factor?: number | undefined;
3291
+ minTimeoutInMs?: number | undefined;
3292
+ maxTimeoutInMs?: number | undefined;
3293
+ randomize?: boolean | undefined;
3294
+ strategy: "backoff";
3295
+ }>]>>;
3296
+ /** An object where the key is a status code pattern and the value is a retrying strategy. Supported patterns are:
3297
+ - Specific status codes: 429
3298
+ - Ranges: 500-599
3299
+ - Wildcards: 2xx, 3xx, 4xx, 5xx
3300
+ */
3301
+ type FetchRetryOptions = z.infer<typeof FetchRetryOptionsSchema>;
3302
+
3303
+ type Prettify<T> = {
3304
+ [K in keyof T]: T[K];
3305
+ } & {};
3306
+
2812
3307
  type ApiClientOptions = {
2813
3308
  apiKey?: string;
2814
3309
  apiUrl?: string;
@@ -2836,54 +3331,85 @@ declare class ApiClient {
2836
3331
  ok: false;
2837
3332
  }>;
2838
3333
  runTask(runId: string, task: RunTaskBodyInput): Promise<{
2839
- error?: string | null | undefined;
2840
- params?: DeserializedJson | undefined;
2841
3334
  icon?: string | null | undefined;
2842
- style?: {
2843
- variant?: string | undefined;
2844
- style: "normal" | "minimal";
2845
- } | null | undefined;
2846
3335
  startedAt?: Date | null | undefined;
2847
3336
  completedAt?: Date | null | undefined;
2848
3337
  delayUntil?: Date | null | undefined;
2849
3338
  description?: string | null | undefined;
3339
+ params?: DeserializedJson | undefined;
2850
3340
  properties?: {
2851
3341
  url?: string | undefined;
2852
3342
  label: string;
2853
3343
  text: string;
2854
3344
  }[] | null | undefined;
2855
3345
  output?: DeserializedJson | undefined;
3346
+ error?: string | null | undefined;
2856
3347
  parentId?: string | null | undefined;
2857
- status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED";
3348
+ style?: {
3349
+ variant?: string | undefined;
3350
+ style: "normal" | "minimal";
3351
+ } | null | undefined;
3352
+ operation?: string | null | undefined;
2858
3353
  id: string;
2859
3354
  name: string;
2860
3355
  noop: boolean;
3356
+ status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED";
2861
3357
  idempotencyKey: string;
3358
+ attempts: number;
2862
3359
  }>;
2863
3360
  completeTask(runId: string, id: string, task: CompleteTaskBodyInput): Promise<{
2864
- error?: string | null | undefined;
2865
- params?: DeserializedJson | undefined;
2866
3361
  icon?: string | null | undefined;
3362
+ startedAt?: Date | null | undefined;
3363
+ completedAt?: Date | null | undefined;
3364
+ delayUntil?: Date | null | undefined;
3365
+ description?: string | null | undefined;
3366
+ params?: DeserializedJson | undefined;
3367
+ properties?: {
3368
+ url?: string | undefined;
3369
+ label: string;
3370
+ text: string;
3371
+ }[] | null | undefined;
3372
+ output?: DeserializedJson | undefined;
3373
+ error?: string | null | undefined;
3374
+ parentId?: string | null | undefined;
2867
3375
  style?: {
2868
3376
  variant?: string | undefined;
2869
3377
  style: "normal" | "minimal";
2870
3378
  } | null | undefined;
3379
+ operation?: string | null | undefined;
3380
+ id: string;
3381
+ name: string;
3382
+ noop: boolean;
3383
+ status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED";
3384
+ idempotencyKey: string;
3385
+ attempts: number;
3386
+ }>;
3387
+ failTask(runId: string, id: string, body: FailTaskBodyInput): Promise<{
3388
+ icon?: string | null | undefined;
2871
3389
  startedAt?: Date | null | undefined;
2872
3390
  completedAt?: Date | null | undefined;
2873
3391
  delayUntil?: Date | null | undefined;
2874
3392
  description?: string | null | undefined;
3393
+ params?: DeserializedJson | undefined;
2875
3394
  properties?: {
2876
3395
  url?: string | undefined;
2877
3396
  label: string;
2878
3397
  text: string;
2879
3398
  }[] | null | undefined;
2880
3399
  output?: DeserializedJson | undefined;
3400
+ error?: string | null | undefined;
2881
3401
  parentId?: string | null | undefined;
2882
- status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED";
3402
+ style?: {
3403
+ variant?: string | undefined;
3404
+ style: "normal" | "minimal";
3405
+ } | null | undefined;
3406
+ operation?: string | null | undefined;
2883
3407
  id: string;
2884
3408
  name: string;
2885
3409
  noop: boolean;
3410
+ status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED";
2886
3411
  idempotencyKey: string;
3412
+ attempts: number;
2887
3413
  }>;
2888
3414
  sendEvent(event: SendEvent, options?: SendEventOptions): Promise<{
2889
3415
  context?: DeserializedJson | undefined;
@@ -2926,31 +3452,42 @@ declare class ApiClient {
2926
3452
  }
2927
3453
 
2928
3454
  interface TriggerContext {
3455
+ /** Job metadata */
2929
3456
  job: {
2930
3457
  id: string;
2931
3458
  version: string;
2932
3459
  };
3460
+ /** Environment metadata */
2933
3461
  environment: {
2934
3462
  slug: string;
2935
3463
  id: string;
2936
3464
  type: RuntimeEnvironmentType;
2937
3465
  };
3466
+ /** Organization metadata */
2938
3467
  organization: {
2939
3468
  slug: string;
2940
3469
  id: string;
2941
3470
  title: string;
2942
3471
  };
3472
+ /** Run metadata */
2943
3473
  run: {
2944
3474
  id: string;
2945
3475
  isTest: boolean;
2946
3476
  startedAt: Date;
2947
3477
  };
3478
+ /** Event metadata */
2948
3479
  event: {
2949
3480
  id: string;
2950
3481
  name: string;
2951
3482
  context: any;
2952
3483
  timestamp: Date;
2953
3484
  };
3485
+ /** Source metadata */
3486
+ source?: {
3487
+ id: string;
3488
+ metadata?: any;
3489
+ };
3490
+ /** Account metadata */
2954
3491
  account?: {
2955
3492
  id: string;
2956
3493
  metadata?: any;
@@ -3003,6 +3540,12 @@ interface Trigger<TEventSpec extends EventSpecification<any>> {
3003
3540
  attachToJob(triggerClient: TriggerClient, job: Job<Trigger<TEventSpec>, any>): void;
3004
3541
  preprocessRuns: boolean;
3005
3542
  }
3543
+ type EventSpecificationExample = {
3544
+ id: string;
3545
+ name: string;
3546
+ icon?: string;
3547
+ payload: any;
3548
+ };
3006
3549
  interface EventSpecification<TEvent extends any> {
3007
3550
  name: string;
3008
3551
  title: string;
@@ -3010,7 +3553,7 @@ interface EventSpecification<TEvent extends any> {
3010
3553
  icon: string;
3011
3554
  properties?: DisplayProperty[];
3012
3555
  schema?: any;
3013
- examples?: Array<TEvent>;
3556
+ examples?: Array<EventSpecificationExample>;
3014
3557
  filter?: EventFilter;
3015
3558
  parsePayload: (payload: unknown) => TEvent;
3016
3559
  runProperties?: (payload: TEvent) => DisplayProperty[];
@@ -3096,7 +3639,7 @@ declare class ExternalSource<TIntegration extends TriggerIntegration<Integration
3096
3639
  source?: string | undefined;
3097
3640
  payload?: any;
3098
3641
  context?: any;
3099
- timestamp?: string | undefined;
3642
+ timestamp?: Date | undefined;
3100
3643
  name: string;
3101
3644
  }[];
3102
3645
  response?: {
@@ -3117,9 +3660,9 @@ declare class ExternalSource<TIntegration extends TriggerIntegration<Integration
3117
3660
  get integrationConfig(): {
3118
3661
  id: string;
3119
3662
  metadata: {
3120
- key: string;
3121
- title: string;
3122
- icon: string;
3663
+ instructions?: string | undefined;
3664
+ id: string;
3665
+ name: string;
3123
3666
  };
3124
3667
  };
3125
3668
  get id(): string;
@@ -3163,22 +3706,29 @@ declare class DynamicTrigger<TEventSpec extends EventSpecification<any>, TExtern
3163
3706
  }
3164
3707
 
3165
3708
  type TriggerClientOptions = {
3709
+ /** The `id` property is used to uniquely identify the client.
3710
+ */
3166
3711
  id: string;
3167
- url?: string;
3712
+ /** The `apiKey` property is the API Key for your Trigger.dev environment. We
3713
+ recommend using an environment variable to store your API Key. */
3168
3714
  apiKey?: string;
3715
+ /** The `apiUrl` property is an optional property that specifies the API URL. You
3716
+ only need to specify this if you are not using Trigger.dev Cloud and are
3717
+ running your own Trigger.dev instance. */
3169
3718
  apiUrl?: string;
3719
+ /** The `logLevel` property is an optional property that specifies the level of
3720
+ logging for the TriggerClient. The level is inherited by all Jobs that use this Client, unless they also specify a `logLevel`. */
3170
3721
  logLevel?: LogLevel;
3722
+ /** Very verbose log messages, defaults to false. */
3723
+ verbose?: boolean;
3724
+ /** Default is unset and off. If set to true it will log to the server's console as well as the Trigger.dev platform */
3725
+ ioLogLocalEnabled?: boolean;
3171
3726
  };
3172
- type ListenOptions = {
3173
- url: string;
3174
- };
3727
+ /** A [TriggerClient](https://trigger.dev/docs/documentation/concepts/client-adaptors) is used to connect to a specific [Project](https://trigger.dev/docs/documentation/concepts/projects) by using an [API Key](https://trigger.dev/docs/documentation/concepts/environments-apikeys). */
3175
3728
  declare class TriggerClient {
3176
3729
  #private;
3177
- private _url;
3178
3730
  id: string;
3179
- path?: string;
3180
- constructor(options: TriggerClientOptions);
3181
- get url(): string;
3731
+ constructor(options: Prettify<TriggerClientOptions>);
3182
3732
  handleRequest(request: Request): Promise<NormalizedResponse>;
3183
3733
  attach(job: Job<Trigger<any>, any>): void;
3184
3734
  attachDynamicTrigger(trigger: DynamicTrigger<any, any>): void;
@@ -3194,15 +3744,15 @@ declare class TriggerClient {
3194
3744
  dynamicTriggerId?: string | undefined;
3195
3745
  id: string;
3196
3746
  source: {
3197
- data?: DeserializedJson | undefined;
3198
3747
  params?: any;
3748
+ data?: DeserializedJson | undefined;
3199
3749
  clientId?: string | undefined;
3200
3750
  key: string;
3201
3751
  secret: string;
3202
3752
  active: boolean;
3203
3753
  channel: {
3204
- type: "HTTP";
3205
3754
  url: string;
3755
+ type: "HTTP";
3206
3756
  } | {
3207
3757
  type: "SMTP";
3208
3758
  } | {
@@ -3219,6 +3769,11 @@ declare class TriggerClient {
3219
3769
  type: "oauth2";
3220
3770
  accessToken: string;
3221
3771
  } | undefined>;
3772
+ /** You can call this function from anywhere in your code to send an event. The other way to send an event is by using [`io.sendEvent()`](https://trigger.dev/docs/sdk/io/sendevent) from inside a `run()` function.
3773
+ * @param event The event to send.
3774
+ * @param options Options for sending the event.
3775
+ * @returns A promise that resolves to the event details
3776
+ */
3222
3777
  sendEvent(event: SendEvent, options?: SendEventOptions): Promise<{
3223
3778
  context?: DeserializedJson | undefined;
3224
3779
  deliverAt?: Date | null | undefined;
@@ -3249,9 +3804,8 @@ declare class TriggerClient {
3249
3804
  unregisterSchedule(id: string, key: string): Promise<{
3250
3805
  ok: boolean;
3251
3806
  }>;
3252
- authorized(apiKey?: string | null): boolean;
3807
+ authorized(apiKey?: string | null): "authorized" | "unauthorized" | "missing-client" | "missing-header";
3253
3808
  apiKey(): string | undefined;
3254
- listen(): Promise<void>;
3255
3809
  }
3256
3810
 
3257
3811
  type ScheduledEventSpecification = EventSpecification<ScheduledPayload>;
@@ -3263,6 +3817,15 @@ declare class IntervalTrigger implements Trigger<ScheduledEventSpecification> {
3263
3817
  title: string;
3264
3818
  source: string;
3265
3819
  icon: string;
3820
+ examples: {
3821
+ id: string;
3822
+ name: string;
3823
+ icon: string;
3824
+ payload: {
3825
+ ts: string;
3826
+ lastTimestamp: string;
3827
+ };
3828
+ }[];
3266
3829
  parsePayload: (data: unknown, params?: Partial<zod.ParseParams> | undefined) => {
3267
3830
  lastTimestamp?: Date | undefined;
3268
3831
  ts: Date;
@@ -3285,6 +3848,15 @@ declare class CronTrigger implements Trigger<ScheduledEventSpecification> {
3285
3848
  title: string;
3286
3849
  source: string;
3287
3850
  icon: string;
3851
+ examples: {
3852
+ id: string;
3853
+ name: string;
3854
+ icon: string;
3855
+ payload: {
3856
+ ts: string;
3857
+ lastTimestamp: string;
3858
+ };
3859
+ }[];
3288
3860
  parsePayload: (data: unknown, params?: Partial<zod.ParseParams> | undefined) => {
3289
3861
  lastTimestamp?: Date | undefined;
3290
3862
  ts: Date;
@@ -3312,6 +3884,15 @@ declare class DynamicSchedule implements Trigger<ScheduledEventSpecification> {
3312
3884
  title: string;
3313
3885
  source: string;
3314
3886
  icon: string;
3887
+ examples: {
3888
+ id: string;
3889
+ name: string;
3890
+ icon: string;
3891
+ payload: {
3892
+ ts: string;
3893
+ lastTimestamp: string;
3894
+ };
3895
+ }[];
3315
3896
  parsePayload: (data: unknown, params?: Partial<zod.ParseParams> | undefined) => {
3316
3897
  lastTimestamp?: Date | undefined;
3317
3898
  ts: Date;
@@ -3343,10 +3924,6 @@ declare class DynamicSchedule implements Trigger<ScheduledEventSpecification> {
3343
3924
  toJSON(): TriggerMetadata;
3344
3925
  }
3345
3926
 
3346
- declare class ResumeWithTask {
3347
- task: ServerTask;
3348
- constructor(task: ServerTask);
3349
- }
3350
3927
  type IOTask = ServerTask;
3351
3928
  type IOOptions = {
3352
3929
  id: string;
@@ -3355,6 +3932,8 @@ type IOOptions = {
3355
3932
  context: TriggerContext;
3356
3933
  logger?: Logger;
3357
3934
  logLevel?: LogLevel;
3935
+ jobLogger?: Logger;
3936
+ jobLogLevel: LogLevel;
3358
3937
  cachedTasks?: Array<CachedTask>;
3359
3938
  };
3360
3939
  declare class IO {
@@ -3363,12 +3942,36 @@ declare class IO {
3363
3942
  private _apiClient;
3364
3943
  private _triggerClient;
3365
3944
  private _logger;
3945
+ private _jobLogger?;
3946
+ private _jobLogLevel;
3366
3947
  private _cachedTasks;
3367
3948
  private _taskStorage;
3368
3949
  private _context;
3369
3950
  constructor(options: IOOptions);
3951
+ /** Used to send log messages to the [Run log](https://trigger.dev/docs/documentation/guides/viewing-runs). */
3370
3952
  get logger(): IOLogger;
3953
+ /** `io.wait()` waits for the specified amount of time before continuing the Job. Delays work even if you're on a serverless platform with timeouts, or if your server goes down. They utilize [resumability](https://trigger.dev/docs/documentation/concepts/resumability) to ensure that the Run can be resumed after the delay.
3954
+ * @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
3955
+ * @param seconds The number of seconds to wait. This can be very long, serverless timeouts are not an issue.
3956
+ */
3371
3957
  wait(key: string | any[], seconds: number): Promise<void>;
3958
+ /** `io.backgroundFetch()` fetches data from a URL that can take longer that the serverless timeout. The actual `fetch` request is performed on the Trigger.dev platform, and the response is sent back to you.
3959
+ * @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
3960
+ * @param url The URL to fetch from.
3961
+ * @param requestInit The options for the request
3962
+ * @param retry The options for retrying the request if it fails
3963
+ * An object where the key is a status code pattern and the value is a retrying strategy.
3964
+ * Supported patterns are:
3965
+ * - Specific status codes: 429
3966
+ * - Ranges: 500-599
3967
+ * - Wildcards: 2xx, 3xx, 4xx, 5xx
3968
+ */
3969
+ backgroundFetch<TResponseData>(key: string | any[], url: string, requestInit?: FetchRequestInit, retry?: FetchRetryOptions): Promise<TResponseData>;
3970
+ /** `io.sendEvent()` allows you to send an event from inside a Job run. The sent even will trigger any Jobs that are listening for that event (based on the name).
3971
+ * @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
3972
+ * @param event The event to send. The event name must match the name of the event that your Jobs are listening for.
3973
+ * @param options Options for sending the event.
3974
+ */
3372
3975
  sendEvent(key: string | any[], event: SendEvent, options?: SendEventOptions): Promise<{
3373
3976
  context?: DeserializedJson | undefined;
3374
3977
  deliverAt?: Date | null | undefined;
@@ -3381,9 +3984,16 @@ declare class IO {
3381
3984
  updateSource(key: string | any[], options: {
3382
3985
  key: string;
3383
3986
  } & UpdateTriggerSourceBody): Promise<{
3384
- key: string;
3385
3987
  id: string;
3988
+ key: string;
3386
3989
  }>;
3990
+ /** `io.registerInterval()` allows you to register a [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) that will trigger any jobs it's attached to on a regular interval.
3991
+ * @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
3992
+ * @param dynamicSchedule The [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) to register a new schedule on.
3993
+ * @param id A unique id for the interval. This is used to identify and unregister the interval later.
3994
+ * @param options The options for the interval.
3995
+ * @returns A promise that has information about the interval.
3996
+ */
3387
3997
  registerInterval(key: string | any[], dynamicSchedule: DynamicSchedule, id: string, options: IntervalOptions): Promise<{
3388
3998
  metadata?: any;
3389
3999
  id: string;
@@ -3402,9 +4012,20 @@ declare class IO {
3402
4012
  };
3403
4013
  active: boolean;
3404
4014
  }>;
4015
+ /** `io.unregisterInterval()` allows you to unregister a [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) that was previously registered with `io.registerInterval()`.
4016
+ * @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
4017
+ * @param dynamicSchedule The [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) to unregister a schedule on.
4018
+ * @param id A unique id for the interval. This is used to identify and unregister the interval later.
4019
+ */
3405
4020
  unregisterInterval(key: string | any[], dynamicSchedule: DynamicSchedule, id: string): Promise<{
3406
4021
  ok: boolean;
3407
4022
  }>;
4023
+ /** `io.registerCron()` allows you to register a [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) that will trigger any jobs it's attached to on a regular CRON schedule.
4024
+ * @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
4025
+ * @param dynamicSchedule The [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) to register a new schedule on.
4026
+ * @param id A unique id for the schedule. This is used to identify and unregister the schedule later.
4027
+ * @param options The options for the CRON schedule.
4028
+ */
3408
4029
  registerCron(key: string | any[], dynamicSchedule: DynamicSchedule, id: string, options: CronOptions): Promise<{
3409
4030
  metadata?: any;
3410
4031
  id: string;
@@ -3423,23 +4044,59 @@ declare class IO {
3423
4044
  };
3424
4045
  active: boolean;
3425
4046
  }>;
4047
+ /** `io.unregisterCron()` allows you to unregister a [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) that was previously registered with `io.registerCron()`.
4048
+ * @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
4049
+ * @param dynamicSchedule The [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) to unregister a schedule on.
4050
+ * @param id A unique id for the interval. This is used to identify and unregister the interval later.
4051
+ */
3426
4052
  unregisterCron(key: string | any[], dynamicSchedule: DynamicSchedule, id: string): Promise<{
3427
4053
  ok: boolean;
3428
4054
  }>;
4055
+ /** `io.registerTrigger()` allows you to register a [DynamicTrigger](https://trigger.dev/docs/sdk/dynamictrigger) with the specified trigger params.
4056
+ * @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
4057
+ * @param trigger The [DynamicTrigger](https://trigger.dev/docs/sdk/dynamictrigger) to register.
4058
+ * @param id A unique id for the trigger. This is used to identify and unregister the trigger later.
4059
+ * @param params The params for the trigger.
4060
+ */
3429
4061
  registerTrigger<TTrigger extends DynamicTrigger<EventSpecification<any>, ExternalSource<any, any, any>>>(key: string | any[], trigger: TTrigger, id: string, params: ExternalSourceParams<TTrigger["source"]>): Promise<{
3430
4062
  id: string;
3431
4063
  key: string;
3432
4064
  } | undefined>;
3433
4065
  getAuth(key: string | any[], clientId?: string): Promise<ConnectionAuth | undefined>;
3434
- runTask<T extends SerializableJson | void = void>(key: string | any[], options: RunTaskOptions, callback: (task: IOTask, io: IO) => Promise<T>): Promise<T>;
4066
+ /** `io.runTask()` allows you to run a [Task](https://trigger.dev/docs/documentation/concepts/tasks) from inside a Job run. A Task is a resumable unit of a Run that can be retried, resumed and is logged. [Integrations](https://trigger.dev/docs/integrations) use Tasks internally to perform their actions.
4067
+ *
4068
+ * @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
4069
+ * @param options The options of how you'd like to run and log the Task. Name is required.
4070
+ * @param callback The callback that will be called when the Task is run. The callback receives the Task and the IO as parameters.
4071
+ = * @param onError The callback that will be called when the Task fails. The callback receives the error, the Task and the IO as parameters. If you wish to retry then return an object with a `retryAt` property.
4072
+ * @returns A Promise that resolves with the returned value of the callback.
4073
+ */
4074
+ runTask<TResult extends SerializableJson | void = void>(key: string | any[], options: RunTaskOptions, callback: (task: IOTask, io: IO) => Promise<TResult>, onError?: (error: unknown, task: IOTask, io: IO) => {
4075
+ retryAt: Date;
4076
+ error?: Error;
4077
+ jitter?: number;
4078
+ } | undefined | void): Promise<TResult>;
4079
+ /** `io.try()` allows you to run Tasks and catch any errors that are thrown, it's similar to a normal `try/catch` block but works with [io.runTask()](/sdk/io/runtask).
4080
+ * A regular `try/catch` block on its own won't work as expected with Tasks. Internally `runTask()` throws some special errors to control flow execution. This is necessary to deal with resumability, serverless timeouts, and retrying Tasks.
4081
+ * @param tryCallback The code you wish to run
4082
+ * @param catchCallback Thhis will be called if the Task fails. The callback receives the error
4083
+ * @returns A Promise that resolves with the returned value or the error
4084
+ */
4085
+ try<TResult, TCatchResult>(tryCallback: () => Promise<TResult>, catchCallback: (error: unknown) => Promise<TCatchResult>): Promise<TResult | TCatchResult>;
3435
4086
  }
3436
- type CallbackFunction = (level: "DEBUG" | "INFO" | "WARN" | "ERROR", message: string, properties?: Record<string, any>) => Promise<void>;
4087
+ type CallbackFunction = (level: "DEBUG" | "INFO" | "WARN" | "ERROR" | "LOG", message: string, properties?: Record<string, any>) => Promise<void>;
3437
4088
  declare class IOLogger implements TaskLogger {
3438
4089
  private callback;
3439
4090
  constructor(callback: CallbackFunction);
4091
+ /** Log: essential messages */
4092
+ log(message: string, properties?: Record<string, any>): Promise<void>;
4093
+ /** For debugging: the least important log level */
3440
4094
  debug(message: string, properties?: Record<string, any>): Promise<void>;
4095
+ /** Info: the second least important log level */
3441
4096
  info(message: string, properties?: Record<string, any>): Promise<void>;
4097
+ /** Warnings: the third most important log level */
3442
4098
  warn(message: string, properties?: Record<string, any>): Promise<void>;
4099
+ /** Error: The second most important log level */
3443
4100
  error(message: string, properties?: Record<string, any>): Promise<void>;
3444
4101
  }
3445
4102
 
@@ -3449,25 +4106,30 @@ interface TriggerIntegration<TIntegrationClient extends IntegrationClient<any, a
3449
4106
  id: string;
3450
4107
  metadata: IntegrationMetadata;
3451
4108
  }
3452
- type IntegrationClient<TClient, TTasks extends Record<string, AuthenticatedTask<TClient, any, any>>> = {
4109
+ type IntegrationClient<TClient, TTasks extends Record<string, AuthenticatedTask<TClient, any, any, any>>> = {
3453
4110
  usesLocalAuth: true;
3454
4111
  client: TClient;
3455
4112
  tasks?: TTasks;
4113
+ auth: any;
3456
4114
  } | {
3457
4115
  usesLocalAuth: false;
3458
4116
  clientFactory: ClientFactory<TClient>;
3459
4117
  tasks?: TTasks;
3460
4118
  };
3461
- type AuthenticatedTask<TClient, TParams, TResult> = {
3462
- run: (params: TParams, client: TClient, task: ServerTask, io: IO) => Promise<TResult>;
4119
+ type AuthenticatedTask<TClient, TParams, TResult, TAuth = ConnectionAuth> = {
4120
+ run: (params: TParams, client: TClient, task: ServerTask, io: IO, auth: TAuth) => Promise<TResult>;
3463
4121
  init: (params: TParams) => RunTaskOptions;
4122
+ onError?: (error: unknown, task: ServerTask) => {
4123
+ retryAt: Date;
4124
+ error?: Error;
4125
+ } | undefined | void;
3464
4126
  };
3465
4127
  declare function authenticatedTask<TClient, TParams, TResult>(options: {
3466
4128
  run: (params: TParams, client: TClient, task: ServerTask, io: IO) => Promise<TResult>;
3467
4129
  init: (params: TParams) => RunTaskOptions;
3468
4130
  }): AuthenticatedTask<TClient, TParams, TResult>;
3469
- type ExtractRunFunction<T> = T extends AuthenticatedTask<any, infer TParams, infer TResult> ? (key: string, params: TParams) => Promise<TResult> : never;
3470
- type ExtractTasks<TTasks extends Record<string, AuthenticatedTask<any, any, any>>> = {
4131
+ type ExtractRunFunction<T> = T extends AuthenticatedTask<any, infer TParams, infer TResult, infer TAuth> ? (key: string, params: TParams) => Promise<TResult> : never;
4132
+ type ExtractTasks<TTasks extends Record<string, AuthenticatedTask<any, any, any, any>>> = {
3471
4133
  [key in keyof TTasks]: ExtractRunFunction<TTasks[key]>;
3472
4134
  };
3473
4135
  type ExtractIntegrationClientClient<TIntegrationClient extends IntegrationClient<any, any>> = TIntegrationClient extends {
@@ -3488,28 +4150,69 @@ type ExtractIntegrations<TIntegrations extends Record<string, TriggerIntegration
3488
4150
  type IOWithIntegrations<TIntegrations extends Record<string, TriggerIntegration<IntegrationClient<any, any>>>> = IO & ExtractIntegrations<TIntegrations>;
3489
4151
 
3490
4152
  type JobOptions<TTrigger extends Trigger<EventSpecification<any>>, TIntegrations extends Record<string, TriggerIntegration<IntegrationClient<any, any>>> = {}> = {
4153
+ /** The `id` property is used to uniquely identify the Job. Only change this if you want to create a new Job. */
3491
4154
  id: string;
4155
+ /** The `name` of the Job that you want to appear in the dashboard and logs. You can change this without creating a new Job. */
3492
4156
  name: string;
4157
+ /** The `version` property is used to version your Job. A new version will be created if you change this property. We recommend using [semantic versioning](https://www.baeldung.com/cs/semantic-versioning), e.g. `1.0.3`. */
3493
4158
  version: string;
4159
+ /** The `trigger` property is used to define when the Job should run. There are currently the following Trigger types:
4160
+ - [cronTrigger](https://trigger.dev/docs/sdk/crontrigger)
4161
+ - [intervalTrigger](https://trigger.dev/docs/sdk/intervaltrigger)
4162
+ - [eventTrigger](https://trigger.dev/docs/sdk/eventtrigger)
4163
+ - [DynamicTrigger](https://trigger.dev/docs/sdk/dynamictrigger)
4164
+ - [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule)
4165
+ - integration Triggers, like webhooks. See the [integrations](https://trigger.dev/docs/integrations) page for more information. */
3494
4166
  trigger: TTrigger;
4167
+ /** The `logLevel` property is an optional property that specifies the level of
4168
+ logging for the Job. The level is inherited from the client if you omit this property. */
3495
4169
  logLevel?: LogLevel;
4170
+ /** Imports the specified integrations into the Job. The integrations will be available on the `io` object in the `run()` function with the same name as the key. For example:
4171
+ ```ts
4172
+ new Job(client, {
4173
+ //... other options
4174
+ integrations: {
4175
+ slack,
4176
+ gh: github,
4177
+ },
4178
+ run: async (payload, io, ctx) => {
4179
+ //slack is available on io.slack
4180
+ io.slack.postMessage(...);
4181
+ //github is available on io.gh
4182
+ io.gh.addIssueLabels(...);
4183
+ }
4184
+ });
4185
+ ``` */
3496
4186
  integrations?: TIntegrations;
4187
+ /** The `queue` property is used to specify a custom queue. If you use an Object and specify the `maxConcurrent` option, you can control how many simulataneous runs can happen. */
3497
4188
  queue?: QueueOptions | string;
3498
4189
  startPosition?: "initial" | "latest";
4190
+ /** The `enabled` property is used to enable or disable the Job. If you disable a Job, it will not run. */
3499
4191
  enabled?: boolean;
3500
- run: (event: TriggerEventType<TTrigger>, io: IOWithIntegrations<TIntegrations>, ctx: TriggerContext) => Promise<any>;
4192
+ /** This function gets called automatically when a Run is Triggered.
4193
+ * This is where you put the code you want to run for a Job. You can use normal code in here and you can also use Tasks. You can return a value from this function and it will be sent back to the Trigger API.
4194
+ * @param payload The payload of the event
4195
+ * @param io An object that contains the integrations that you specified in the `integrations` property and other useful functions like delays and running Tasks.
4196
+ * @param context An object that contains information about the Organization, Job, Run and more.
4197
+ */
4198
+ run: (payload: TriggerEventType<TTrigger>, io: IOWithIntegrations<TIntegrations>, context: TriggerContext) => Promise<any>;
3501
4199
  };
4200
+ /** A [Job](https://trigger.dev/docs/documentation/concepts/jobs) is used to define the [Trigger](https://trigger.dev/docs/documentation/concepts/triggers), metadata, and what happens when it runs. */
3502
4201
  declare class Job<TTrigger extends Trigger<EventSpecification<any>>, TIntegrations extends Record<string, TriggerIntegration<IntegrationClient<any, any>>> = {}> {
3503
4202
  #private;
3504
4203
  readonly options: JobOptions<TTrigger, TIntegrations>;
3505
4204
  client: TriggerClient;
3506
- constructor(client: TriggerClient, options: JobOptions<TTrigger, TIntegrations>);
4205
+ constructor(
4206
+ /** An instance of [TriggerClient](/sdk/triggerclient) that is used to send events
4207
+ to the Trigger API. */
4208
+ client: TriggerClient, options: JobOptions<TTrigger, TIntegrations>);
3507
4209
  get id(): string;
3508
4210
  get enabled(): boolean;
3509
4211
  get name(): string;
3510
4212
  get trigger(): TTrigger;
3511
4213
  get version(): string;
3512
4214
  get integrations(): Record<string, IntegrationConfig>;
4215
+ get logLevel(): LogLevel | undefined;
3513
4216
  toJSON(): JobMetadata;
3514
4217
  }
3515
4218
 
@@ -3527,12 +4230,40 @@ declare class EventTrigger<TEventSpecification extends EventSpecification<any>>
3527
4230
  attachToJob(triggerClient: TriggerClient, job: Job<Trigger<TEventSpecification>, any>): void;
3528
4231
  get preprocessRuns(): boolean;
3529
4232
  }
4233
+ /** Configuration options for an EventTrigger */
3530
4234
  type TriggerOptions<TEvent> = {
4235
+ /** The name of the event you are subscribing to. Must be an exact match (case sensitive). */
3531
4236
  name: string;
4237
+ /** A [Zod](https://trigger.dev/docs/documentation/guides/zod) schema that defines the shape of the event payload.
4238
+ * The default is `z.any()` which is `any`.
4239
+ * */
3532
4240
  schema?: z.Schema<TEvent>;
4241
+ /** You can use this to filter events based on the source. */
3533
4242
  source?: string;
4243
+ /** Used to filter which events trigger the Job
4244
+ * @example
4245
+ * filter:
4246
+ * ```ts
4247
+ * {
4248
+ * name: ["John", "Jane"],
4249
+ * age: [18, 21]
4250
+ * }
4251
+ * ```
4252
+ *
4253
+ * This filter would match against an event with the following data:
4254
+ * ```json
4255
+ * {
4256
+ * "name": "Jane",
4257
+ * "age": 18,
4258
+ * "location": "San Francisco"
4259
+ * }
4260
+ * ```
4261
+ */
3534
4262
  filter?: EventFilter;
3535
4263
  };
4264
+ /** `eventTrigger()` is set as a [Job's trigger](https://trigger.dev/docs/sdk/job) to subscribe to an event a Job from [a sent event](https://trigger.dev/docs/sdk/triggerclient/instancemethods/sendevent)
4265
+ * @param options options for the EventTrigger
4266
+ */
3536
4267
  declare function eventTrigger<TEvent extends any = any>(options: TriggerOptions<TEvent>): Trigger<EventSpecification<TEvent>>;
3537
4268
 
3538
4269
  declare function missingConnectionNotification(integrations: Array<TriggerIntegration>): MissingConnectionNotification;
@@ -3550,33 +4281,29 @@ declare class MissingConnectionNotification implements Trigger<MissingConnection
3550
4281
  source: string;
3551
4282
  icon: string;
3552
4283
  parsePayload: (data: unknown, params?: Partial<zod.ParseParams> | undefined) => {
3553
- type: "DEVELOPER";
3554
4284
  id: string;
4285
+ type: "DEVELOPER";
3555
4286
  client: {
4287
+ id: string;
3556
4288
  scopes: string[];
3557
4289
  title: string;
3558
- id: string;
3559
4290
  createdAt: Date;
3560
4291
  updatedAt: Date;
3561
- integrationIdentifier: string;
3562
- integrationAuthMethod: string;
3563
4292
  };
3564
4293
  authorizationUrl: string;
3565
4294
  } | {
3566
- type: "EXTERNAL";
3567
4295
  id: string;
4296
+ type: "EXTERNAL";
3568
4297
  account: {
3569
4298
  metadata?: any;
3570
4299
  id: string;
3571
4300
  };
3572
4301
  client: {
4302
+ id: string;
3573
4303
  scopes: string[];
3574
4304
  title: string;
3575
- id: string;
3576
4305
  createdAt: Date;
3577
4306
  updatedAt: Date;
3578
- integrationIdentifier: string;
3579
- integrationAuthMethod: string;
3580
4307
  };
3581
4308
  authorizationUrl: string;
3582
4309
  };
@@ -3599,12 +4326,12 @@ declare class MissingConnectionResolvedNotification implements Trigger<MissingCo
3599
4326
  source: string;
3600
4327
  icon: string;
3601
4328
  parsePayload: (data: unknown, params?: Partial<zod.ParseParams> | undefined) => {
3602
- type: "DEVELOPER";
3603
4329
  id: string;
4330
+ type: "DEVELOPER";
3604
4331
  client: {
4332
+ id: string;
3605
4333
  scopes: string[];
3606
4334
  title: string;
3607
- id: string;
3608
4335
  createdAt: Date;
3609
4336
  updatedAt: Date;
3610
4337
  integrationIdentifier: string;
@@ -3612,16 +4339,16 @@ declare class MissingConnectionResolvedNotification implements Trigger<MissingCo
3612
4339
  };
3613
4340
  expiresAt: Date;
3614
4341
  } | {
3615
- type: "EXTERNAL";
3616
4342
  id: string;
4343
+ type: "EXTERNAL";
3617
4344
  account: {
3618
4345
  metadata?: any;
3619
4346
  id: string;
3620
4347
  };
3621
4348
  client: {
4349
+ id: string;
3622
4350
  scopes: string[];
3623
4351
  title: string;
3624
- id: string;
3625
4352
  createdAt: Date;
3626
4353
  updatedAt: Date;
3627
4354
  integrationIdentifier: string;
@@ -3639,6 +4366,25 @@ declare class MissingConnectionResolvedNotification implements Trigger<MissingCo
3639
4366
  toJSON(): TriggerMetadata;
3640
4367
  }
3641
4368
 
3642
- declare function secureString(strings: TemplateStringsArray, ...interpolations: string[]): SecureString;
4369
+ declare class ResumeWithTaskError {
4370
+ task: ServerTask;
4371
+ constructor(task: ServerTask);
4372
+ }
4373
+ declare class RetryWithTaskError {
4374
+ cause: ErrorWithStack;
4375
+ task: ServerTask;
4376
+ retryAt: Date;
4377
+ constructor(cause: ErrorWithStack, task: ServerTask, retryAt: Date);
4378
+ }
4379
+ /** Use this function if you're using a `try/catch` block to catch errors.
4380
+ * It checks if a thrown error is a special internal error that you should ignore.
4381
+ * If this returns `true` then you must rethrow the error: `throw err;`
4382
+ * @param err The error to check
4383
+ * @returns `true` if the error is a Trigger Error, `false` otherwise.
4384
+ */
4385
+ declare function isTriggerError(err: unknown): err is ResumeWithTaskError | RetryWithTaskError;
4386
+
4387
+ type Task = ServerTask;
4388
+ declare function redactString(strings: TemplateStringsArray, ...interpolations: string[]): RedactString;
3643
4389
 
3644
- export { AuthenticatedTask, ClientFactory, CronTrigger, DynamicIntervalOptions, DynamicSchedule, DynamicTrigger, DynamicTriggerOptions, EventFilter, EventSpecification, EventTrigger, EventTypeFromSpecification, ExternalSource, ExternalSourceParams, ExternalSourceTrigger, ExternalSourceTriggerOptions, HandlerEvent, HttpSourceEvent, IO, IOLogger, IOOptions, IOTask, IOWithIntegrations, IntegrationClient, IntervalTrigger, Job, JobOptions, ListenOptions, Logger, MissingConnectionNotification, MissingConnectionResolvedNotification, NormalizedRequest, PreprocessResults, ResumeWithTask, SecureString, TaskLogger, Trigger, TriggerClient, TriggerClientOptions, TriggerContext, TriggerEventType, TriggerIntegration, TriggerPreprocessContext, authenticatedTask, cronTrigger, eventTrigger, intervalTrigger, missingConnectionNotification, missingConnectionResolvedNotification, omit, secureString };
4390
+ export { AuthenticatedTask, ClientFactory, CronTrigger, DynamicIntervalOptions, DynamicSchedule, DynamicTrigger, DynamicTriggerOptions, EventFilter, EventSpecification, EventSpecificationExample, EventTrigger, EventTypeFromSpecification, ExternalSource, ExternalSourceParams, ExternalSourceTrigger, ExternalSourceTriggerOptions, HandlerEvent, HttpSourceEvent, IO, IOLogger, IOOptions, IOTask, IOWithIntegrations, IntegrationClient, IntervalTrigger, Job, JobOptions, Logger, MissingConnectionNotification, MissingConnectionResolvedNotification, NormalizedRequest, PreprocessResults, RedactString, Task, TaskLogger, Trigger, TriggerClient, TriggerClientOptions, TriggerContext, TriggerEventType, TriggerIntegration, TriggerPreprocessContext, authenticatedTask, cronTrigger, eventTrigger, intervalTrigger, isTriggerError, missingConnectionNotification, missingConnectionResolvedNotification, omit, redactString };