@trigger.dev/sdk 2.0.0-next.9 → 2.0.1

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,3309 +1,9 @@
1
+ import * as _trigger_dev_core from '@trigger.dev/core';
2
+ import { CreateRunBody, RunTaskBodyInput, CompleteTaskBodyInput, FailTaskBodyInput, SendEvent, SendEventOptions, UpdateTriggerSourceBody, TriggerSource, RegisterTriggerBody, RegisterSourceEvent, ScheduleMetadata, GetRunOptionsWithTaskDetails, GetRunsOptions, LogLevel, RuntimeEnvironmentType, DisplayProperty, TriggerMetadata, EventFilter, HandleTriggerSource, Logger, NormalizedResponse, Prettify, IntervalOptions, CronOptions, ScheduledPayload, ServerTask, CachedTask, FetchRequestInit, FetchRetryOptions, ConnectionAuth, SerializableJson, RunTaskOptions, IntegrationMetadata, QueueOptions, IntegrationConfig, JobMetadata, MissingConnectionNotificationPayload, MissingConnectionResolvedNotificationPayload, ErrorWithStack, ApiEventLog, RedactString } from '@trigger.dev/core';
3
+ export { EventFilter, Logger, NormalizedRequest, RedactString } from '@trigger.dev/core';
1
4
  import * as zod from 'zod';
2
5
  import { z } from 'zod';
3
6
 
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
- */
12
- type LogLevel = "log" | "error" | "warn" | "info" | "debug";
13
- declare class Logger {
14
- #private;
15
- constructor(name: string, level?: LogLevel, filteredKeys?: string[], jsonReplacer?: (key: string, value: unknown) => unknown);
16
- filter(...keys: string[]): Logger;
17
- static satisfiesLogLevel(logLevel: LogLevel, setLevel: LogLevel): boolean;
18
- log(...args: any[]): void;
19
- error(...args: any[]): void;
20
- warn(...args: any[]): void;
21
- info(...args: any[]): void;
22
- debug(message: string, ...args: Array<Record<string, unknown> | undefined>): void;
23
- }
24
-
25
- declare const EventMatcherSchema: z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodArray<z.ZodNumber, "many">, z.ZodArray<z.ZodBoolean, "many">]>;
26
- type EventMatcher = z.infer<typeof EventMatcherSchema>;
27
- /** A filter for matching against data */
28
- type EventFilter = {
29
- [key: string]: EventMatcher | EventFilter;
30
- };
31
-
32
- declare const LiteralSchema: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
33
- type Literal = z.infer<typeof LiteralSchema>;
34
- type DeserializedJson = Literal | {
35
- [key: string]: DeserializedJson;
36
- } | DeserializedJson[];
37
- declare const SerializableSchema: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodDate, z.ZodUndefined, z.ZodSymbol]>;
38
- type Serializable = z.infer<typeof SerializableSchema>;
39
- type SerializableJson = Serializable | {
40
- [key: string]: SerializableJson;
41
- } | SerializableJson[];
42
-
43
- declare const ServerTaskSchema: z.ZodObject<z.extendShape<{
44
- id: z.ZodString;
45
- name: z.ZodString;
46
- icon: z.ZodNullable<z.ZodOptional<z.ZodString>>;
47
- noop: z.ZodBoolean;
48
- startedAt: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
49
- completedAt: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
50
- delayUntil: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
51
- status: z.ZodEnum<["PENDING", "WAITING", "RUNNING", "COMPLETED", "ERRORED"]>;
52
- description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
53
- properties: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
54
- label: z.ZodString;
55
- text: z.ZodString;
56
- url: z.ZodOptional<z.ZodString>;
57
- }, "strip", z.ZodTypeAny, {
58
- url?: string | undefined;
59
- label: string;
60
- text: string;
61
- }, {
62
- url?: string | undefined;
63
- label: string;
64
- text: string;
65
- }>, "many">>>;
66
- params: z.ZodNullable<z.ZodOptional<z.ZodType<DeserializedJson, z.ZodTypeDef, DeserializedJson>>>;
67
- output: z.ZodNullable<z.ZodOptional<z.ZodType<DeserializedJson, z.ZodTypeDef, DeserializedJson>>>;
68
- error: z.ZodNullable<z.ZodOptional<z.ZodString>>;
69
- parentId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
70
- style: z.ZodNullable<z.ZodOptional<z.ZodObject<{
71
- style: z.ZodEnum<["normal", "minimal"]>;
72
- variant: z.ZodOptional<z.ZodString>;
73
- }, "strip", z.ZodTypeAny, {
74
- variant?: string | undefined;
75
- style: "normal" | "minimal";
76
- }, {
77
- variant?: string | undefined;
78
- style: "normal" | "minimal";
79
- }>>>;
80
- operation: z.ZodNullable<z.ZodOptional<z.ZodString>>;
81
- }, {
82
- idempotencyKey: z.ZodString;
83
- attempts: z.ZodNumber;
84
- }>, "strip", z.ZodTypeAny, {
85
- icon?: string | null | undefined;
86
- startedAt?: Date | null | undefined;
87
- completedAt?: Date | null | undefined;
88
- delayUntil?: Date | null | undefined;
89
- description?: string | null | undefined;
90
- params?: DeserializedJson | undefined;
91
- properties?: {
92
- url?: string | undefined;
93
- label: string;
94
- text: string;
95
- }[] | null | undefined;
96
- output?: DeserializedJson | undefined;
97
- error?: string | null | undefined;
98
- parentId?: string | null | undefined;
99
- style?: {
100
- variant?: string | undefined;
101
- style: "normal" | "minimal";
102
- } | null | undefined;
103
- operation?: string | null | undefined;
104
- id: string;
105
- name: string;
106
- noop: boolean;
107
- status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED";
108
- idempotencyKey: string;
109
- attempts: number;
110
- }, {
111
- icon?: string | null | undefined;
112
- startedAt?: Date | null | undefined;
113
- completedAt?: Date | null | undefined;
114
- delayUntil?: Date | null | undefined;
115
- description?: string | null | undefined;
116
- params?: DeserializedJson | undefined;
117
- properties?: {
118
- url?: string | undefined;
119
- label: string;
120
- text: string;
121
- }[] | null | undefined;
122
- output?: DeserializedJson | undefined;
123
- error?: string | null | undefined;
124
- parentId?: string | null | undefined;
125
- style?: {
126
- variant?: string | undefined;
127
- style: "normal" | "minimal";
128
- } | null | undefined;
129
- operation?: string | null | undefined;
130
- id: string;
131
- name: string;
132
- noop: boolean;
133
- status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED";
134
- idempotencyKey: string;
135
- attempts: number;
136
- }>;
137
- type ServerTask = z.infer<typeof ServerTaskSchema>;
138
- declare const CachedTaskSchema: z.ZodObject<{
139
- id: z.ZodString;
140
- idempotencyKey: z.ZodString;
141
- status: z.ZodEnum<["PENDING", "WAITING", "RUNNING", "COMPLETED", "ERRORED"]>;
142
- noop: z.ZodDefault<z.ZodBoolean>;
143
- output: z.ZodNullable<z.ZodOptional<z.ZodType<DeserializedJson, z.ZodTypeDef, DeserializedJson>>>;
144
- parentId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
145
- }, "strip", z.ZodTypeAny, {
146
- output?: DeserializedJson | undefined;
147
- parentId?: string | null | undefined;
148
- id: string;
149
- noop: boolean;
150
- status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED";
151
- idempotencyKey: string;
152
- }, {
153
- noop?: boolean | undefined;
154
- output?: DeserializedJson | undefined;
155
- parentId?: string | null | undefined;
156
- id: string;
157
- status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED";
158
- idempotencyKey: string;
159
- }>;
160
-
161
- declare const UpdateTriggerSourceBodySchema: z.ZodObject<{
162
- registeredEvents: z.ZodArray<z.ZodString, "many">;
163
- secret: z.ZodOptional<z.ZodString>;
164
- data: z.ZodOptional<z.ZodType<SerializableJson, z.ZodTypeDef, SerializableJson>>;
165
- }, "strip", z.ZodTypeAny, {
166
- data?: SerializableJson;
167
- secret?: string | undefined;
168
- registeredEvents: string[];
169
- }, {
170
- data?: SerializableJson;
171
- secret?: string | undefined;
172
- registeredEvents: string[];
173
- }>;
174
- type UpdateTriggerSourceBody = z.infer<typeof UpdateTriggerSourceBodySchema>;
175
- declare const RegisterSourceEventSchema: z.ZodObject<{
176
- id: z.ZodString;
177
- source: z.ZodObject<{
178
- key: z.ZodString;
179
- params: z.ZodAny;
180
- active: z.ZodBoolean;
181
- secret: z.ZodString;
182
- data: z.ZodOptional<z.ZodType<DeserializedJson, z.ZodTypeDef, DeserializedJson>>;
183
- channel: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
184
- type: z.ZodLiteral<"HTTP">;
185
- url: z.ZodString;
186
- }, "strip", z.ZodTypeAny, {
187
- url: string;
188
- type: "HTTP";
189
- }, {
190
- url: string;
191
- type: "HTTP";
192
- }>, z.ZodObject<{
193
- type: z.ZodLiteral<"SMTP">;
194
- }, "strip", z.ZodTypeAny, {
195
- type: "SMTP";
196
- }, {
197
- type: "SMTP";
198
- }>, z.ZodObject<{
199
- type: z.ZodLiteral<"SQS">;
200
- }, "strip", z.ZodTypeAny, {
201
- type: "SQS";
202
- }, {
203
- type: "SQS";
204
- }>]>;
205
- clientId: z.ZodOptional<z.ZodString>;
206
- }, "strip", z.ZodTypeAny, {
207
- params?: any;
208
- data?: DeserializedJson | undefined;
209
- clientId?: string | undefined;
210
- key: string;
211
- secret: string;
212
- active: boolean;
213
- channel: {
214
- url: string;
215
- type: "HTTP";
216
- } | {
217
- type: "SMTP";
218
- } | {
219
- type: "SQS";
220
- };
221
- }, {
222
- params?: any;
223
- data?: DeserializedJson | undefined;
224
- clientId?: string | undefined;
225
- key: string;
226
- secret: string;
227
- active: boolean;
228
- channel: {
229
- url: string;
230
- type: "HTTP";
231
- } | {
232
- type: "SMTP";
233
- } | {
234
- type: "SQS";
235
- };
236
- }>;
237
- events: z.ZodArray<z.ZodString, "many">;
238
- missingEvents: z.ZodArray<z.ZodString, "many">;
239
- orphanedEvents: z.ZodArray<z.ZodString, "many">;
240
- dynamicTriggerId: z.ZodOptional<z.ZodString>;
241
- }, "strip", z.ZodTypeAny, {
242
- dynamicTriggerId?: string | undefined;
243
- id: string;
244
- source: {
245
- params?: any;
246
- data?: DeserializedJson | undefined;
247
- clientId?: string | undefined;
248
- key: string;
249
- secret: string;
250
- active: boolean;
251
- channel: {
252
- url: string;
253
- type: "HTTP";
254
- } | {
255
- type: "SMTP";
256
- } | {
257
- type: "SQS";
258
- };
259
- };
260
- events: string[];
261
- missingEvents: string[];
262
- orphanedEvents: string[];
263
- }, {
264
- dynamicTriggerId?: string | undefined;
265
- id: string;
266
- source: {
267
- params?: any;
268
- data?: DeserializedJson | undefined;
269
- clientId?: string | undefined;
270
- key: string;
271
- secret: string;
272
- active: boolean;
273
- channel: {
274
- url: string;
275
- type: "HTTP";
276
- } | {
277
- type: "SMTP";
278
- } | {
279
- type: "SQS";
280
- };
281
- };
282
- events: string[];
283
- missingEvents: string[];
284
- orphanedEvents: string[];
285
- }>;
286
- type RegisterSourceEvent = z.infer<typeof RegisterSourceEventSchema>;
287
- declare const TriggerSourceSchema: z.ZodObject<{
288
- id: z.ZodString;
289
- key: z.ZodString;
290
- }, "strip", z.ZodTypeAny, {
291
- id: string;
292
- key: string;
293
- }, {
294
- id: string;
295
- key: string;
296
- }>;
297
- declare const HandleTriggerSourceSchema: z.ZodObject<{
298
- key: z.ZodString;
299
- secret: z.ZodString;
300
- data: z.ZodAny;
301
- params: z.ZodAny;
302
- }, "strip", z.ZodTypeAny, {
303
- params?: any;
304
- data?: any;
305
- key: string;
306
- secret: string;
307
- }, {
308
- params?: any;
309
- data?: any;
310
- key: string;
311
- secret: string;
312
- }>;
313
- type HandleTriggerSource = z.infer<typeof HandleTriggerSourceSchema>;
314
- type TriggerSource = z.infer<typeof TriggerSourceSchema>;
315
- declare const QueueOptionsSchema: z.ZodObject<{
316
- name: z.ZodString;
317
- maxConcurrent: z.ZodOptional<z.ZodNumber>;
318
- }, "strip", z.ZodTypeAny, {
319
- maxConcurrent?: number | undefined;
320
- name: string;
321
- }, {
322
- maxConcurrent?: number | undefined;
323
- name: string;
324
- }>;
325
- type QueueOptions = z.infer<typeof QueueOptionsSchema>;
326
- declare const JobMetadataSchema: z.ZodObject<{
327
- id: z.ZodString;
328
- name: z.ZodString;
329
- version: z.ZodString;
330
- event: z.ZodObject<{
331
- name: z.ZodString;
332
- title: z.ZodString;
333
- source: z.ZodString;
334
- icon: z.ZodString;
335
- filter: z.ZodOptional<z.ZodType<EventFilter, z.ZodTypeDef, EventFilter>>;
336
- properties: z.ZodOptional<z.ZodArray<z.ZodObject<{
337
- label: z.ZodString;
338
- text: z.ZodString;
339
- url: z.ZodOptional<z.ZodString>;
340
- }, "strip", z.ZodTypeAny, {
341
- url?: string | undefined;
342
- label: string;
343
- text: string;
344
- }, {
345
- url?: string | undefined;
346
- label: string;
347
- text: string;
348
- }>, "many">>;
349
- schema: z.ZodOptional<z.ZodAny>;
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">>;
366
- }, "strip", z.ZodTypeAny, {
367
- filter?: EventFilter | undefined;
368
- properties?: {
369
- url?: string | undefined;
370
- label: string;
371
- text: string;
372
- }[] | undefined;
373
- schema?: any;
374
- examples?: {
375
- icon?: string | undefined;
376
- payload?: any;
377
- id: string;
378
- name: string;
379
- }[] | undefined;
380
- name: string;
381
- icon: string;
382
- source: string;
383
- title: string;
384
- }, {
385
- filter?: EventFilter | undefined;
386
- properties?: {
387
- url?: string | undefined;
388
- label: string;
389
- text: string;
390
- }[] | undefined;
391
- schema?: any;
392
- examples?: {
393
- icon?: string | undefined;
394
- payload?: any;
395
- id: string;
396
- name: string;
397
- }[] | undefined;
398
- name: string;
399
- icon: string;
400
- source: string;
401
- title: string;
402
- }>;
403
- trigger: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
404
- type: z.ZodLiteral<"dynamic">;
405
- id: z.ZodString;
406
- }, "strip", z.ZodTypeAny, {
407
- id: string;
408
- type: "dynamic";
409
- }, {
410
- id: string;
411
- type: "dynamic";
412
- }>, z.ZodObject<{
413
- type: z.ZodLiteral<"static">;
414
- title: z.ZodString;
415
- properties: z.ZodOptional<z.ZodArray<z.ZodObject<{
416
- label: z.ZodString;
417
- text: z.ZodString;
418
- url: z.ZodOptional<z.ZodString>;
419
- }, "strip", z.ZodTypeAny, {
420
- url?: string | undefined;
421
- label: string;
422
- text: string;
423
- }, {
424
- url?: string | undefined;
425
- label: string;
426
- text: string;
427
- }>, "many">>;
428
- rule: z.ZodObject<{
429
- event: z.ZodString;
430
- source: z.ZodString;
431
- payload: z.ZodOptional<z.ZodType<EventFilter, z.ZodTypeDef, EventFilter>>;
432
- context: z.ZodOptional<z.ZodType<EventFilter, z.ZodTypeDef, EventFilter>>;
433
- }, "strip", z.ZodTypeAny, {
434
- payload?: EventFilter | undefined;
435
- context?: EventFilter | undefined;
436
- event: string;
437
- source: string;
438
- }, {
439
- payload?: EventFilter | undefined;
440
- context?: EventFilter | undefined;
441
- event: string;
442
- source: string;
443
- }>;
444
- }, "strip", z.ZodTypeAny, {
445
- properties?: {
446
- url?: string | undefined;
447
- label: string;
448
- text: string;
449
- }[] | undefined;
450
- type: "static";
451
- title: string;
452
- rule: {
453
- payload?: EventFilter | undefined;
454
- context?: EventFilter | undefined;
455
- event: string;
456
- source: string;
457
- };
458
- }, {
459
- properties?: {
460
- url?: string | undefined;
461
- label: string;
462
- text: string;
463
- }[] | undefined;
464
- type: "static";
465
- title: string;
466
- rule: {
467
- payload?: EventFilter | undefined;
468
- context?: EventFilter | undefined;
469
- event: string;
470
- source: string;
471
- };
472
- }>, z.ZodObject<{
473
- type: z.ZodLiteral<"scheduled">;
474
- schedule: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
475
- type: z.ZodLiteral<"interval">;
476
- options: z.ZodObject<{
477
- seconds: z.ZodNumber;
478
- }, "strip", z.ZodTypeAny, {
479
- seconds: number;
480
- }, {
481
- seconds: number;
482
- }>;
483
- metadata: z.ZodAny;
484
- }, "strip", z.ZodTypeAny, {
485
- metadata?: any;
486
- options: {
487
- seconds: number;
488
- };
489
- type: "interval";
490
- }, {
491
- metadata?: any;
492
- options: {
493
- seconds: number;
494
- };
495
- type: "interval";
496
- }>, z.ZodObject<{
497
- type: z.ZodLiteral<"cron">;
498
- options: z.ZodObject<{
499
- cron: z.ZodString;
500
- }, "strip", z.ZodTypeAny, {
501
- cron: string;
502
- }, {
503
- cron: string;
504
- }>;
505
- metadata: z.ZodAny;
506
- }, "strip", z.ZodTypeAny, {
507
- metadata?: any;
508
- options: {
509
- cron: string;
510
- };
511
- type: "cron";
512
- }, {
513
- metadata?: any;
514
- options: {
515
- cron: string;
516
- };
517
- type: "cron";
518
- }>]>;
519
- }, "strip", z.ZodTypeAny, {
520
- type: "scheduled";
521
- schedule: {
522
- metadata?: any;
523
- options: {
524
- cron: string;
525
- };
526
- type: "cron";
527
- } | {
528
- metadata?: any;
529
- options: {
530
- seconds: number;
531
- };
532
- type: "interval";
533
- };
534
- }, {
535
- type: "scheduled";
536
- schedule: {
537
- metadata?: any;
538
- options: {
539
- cron: string;
540
- };
541
- type: "cron";
542
- } | {
543
- metadata?: any;
544
- options: {
545
- seconds: number;
546
- };
547
- type: "interval";
548
- };
549
- }>]>;
550
- integrations: z.ZodRecord<z.ZodString, z.ZodObject<{
551
- id: z.ZodString;
552
- metadata: z.ZodObject<{
553
- id: z.ZodString;
554
- name: z.ZodString;
555
- instructions: z.ZodOptional<z.ZodString>;
556
- }, "strip", z.ZodTypeAny, {
557
- instructions?: string | undefined;
558
- id: string;
559
- name: string;
560
- }, {
561
- instructions?: string | undefined;
562
- id: string;
563
- name: string;
564
- }>;
565
- authSource: z.ZodEnum<["HOSTED", "LOCAL"]>;
566
- }, "strip", z.ZodTypeAny, {
567
- id: string;
568
- metadata: {
569
- instructions?: string | undefined;
570
- id: string;
571
- name: string;
572
- };
573
- authSource: "HOSTED" | "LOCAL";
574
- }, {
575
- id: string;
576
- metadata: {
577
- instructions?: string | undefined;
578
- id: string;
579
- name: string;
580
- };
581
- authSource: "HOSTED" | "LOCAL";
582
- }>>;
583
- internal: z.ZodDefault<z.ZodBoolean>;
584
- queue: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
585
- name: z.ZodString;
586
- maxConcurrent: z.ZodOptional<z.ZodNumber>;
587
- }, "strip", z.ZodTypeAny, {
588
- maxConcurrent?: number | undefined;
589
- name: string;
590
- }, {
591
- maxConcurrent?: number | undefined;
592
- name: string;
593
- }>, z.ZodString]>>;
594
- startPosition: z.ZodEnum<["initial", "latest"]>;
595
- enabled: z.ZodBoolean;
596
- preprocessRuns: z.ZodBoolean;
597
- }, "strip", z.ZodTypeAny, {
598
- queue?: string | {
599
- maxConcurrent?: number | undefined;
600
- name: string;
601
- } | undefined;
602
- id: string;
603
- name: string;
604
- event: {
605
- filter?: EventFilter | undefined;
606
- properties?: {
607
- url?: string | undefined;
608
- label: string;
609
- text: string;
610
- }[] | undefined;
611
- schema?: any;
612
- examples?: {
613
- icon?: string | undefined;
614
- payload?: any;
615
- id: string;
616
- name: string;
617
- }[] | undefined;
618
- name: string;
619
- icon: string;
620
- source: string;
621
- title: string;
622
- };
623
- version: string;
624
- trigger: {
625
- id: string;
626
- type: "dynamic";
627
- } | {
628
- properties?: {
629
- url?: string | undefined;
630
- label: string;
631
- text: string;
632
- }[] | undefined;
633
- type: "static";
634
- title: string;
635
- rule: {
636
- payload?: EventFilter | undefined;
637
- context?: EventFilter | undefined;
638
- event: string;
639
- source: string;
640
- };
641
- } | {
642
- type: "scheduled";
643
- schedule: {
644
- metadata?: any;
645
- options: {
646
- cron: string;
647
- };
648
- type: "cron";
649
- } | {
650
- metadata?: any;
651
- options: {
652
- seconds: number;
653
- };
654
- type: "interval";
655
- };
656
- };
657
- integrations: Record<string, {
658
- id: string;
659
- metadata: {
660
- instructions?: string | undefined;
661
- id: string;
662
- name: string;
663
- };
664
- authSource: "HOSTED" | "LOCAL";
665
- }>;
666
- internal: boolean;
667
- startPosition: "initial" | "latest";
668
- enabled: boolean;
669
- preprocessRuns: boolean;
670
- }, {
671
- internal?: boolean | undefined;
672
- queue?: string | {
673
- maxConcurrent?: number | undefined;
674
- name: string;
675
- } | undefined;
676
- id: string;
677
- name: string;
678
- event: {
679
- filter?: EventFilter | undefined;
680
- properties?: {
681
- url?: string | undefined;
682
- label: string;
683
- text: string;
684
- }[] | undefined;
685
- schema?: any;
686
- examples?: {
687
- icon?: string | undefined;
688
- payload?: any;
689
- id: string;
690
- name: string;
691
- }[] | undefined;
692
- name: string;
693
- icon: string;
694
- source: string;
695
- title: string;
696
- };
697
- version: string;
698
- trigger: {
699
- id: string;
700
- type: "dynamic";
701
- } | {
702
- properties?: {
703
- url?: string | undefined;
704
- label: string;
705
- text: string;
706
- }[] | undefined;
707
- type: "static";
708
- title: string;
709
- rule: {
710
- payload?: EventFilter | undefined;
711
- context?: EventFilter | undefined;
712
- event: string;
713
- source: string;
714
- };
715
- } | {
716
- type: "scheduled";
717
- schedule: {
718
- metadata?: any;
719
- options: {
720
- cron: string;
721
- };
722
- type: "cron";
723
- } | {
724
- metadata?: any;
725
- options: {
726
- seconds: number;
727
- };
728
- type: "interval";
729
- };
730
- };
731
- integrations: Record<string, {
732
- id: string;
733
- metadata: {
734
- instructions?: string | undefined;
735
- id: string;
736
- name: string;
737
- };
738
- authSource: "HOSTED" | "LOCAL";
739
- }>;
740
- startPosition: "initial" | "latest";
741
- enabled: boolean;
742
- preprocessRuns: boolean;
743
- }>;
744
- type JobMetadata = z.infer<typeof JobMetadataSchema>;
745
- declare const RawEventSchema: z.ZodObject<{
746
- /** The `name` property must exactly match any subscriptions you want to
747
- trigger. */
748
- name: 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. */
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. */
757
- context: z.ZodOptional<z.ZodAny>;
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>;
769
- }, "strip", z.ZodTypeAny, {
770
- source?: string | undefined;
771
- payload?: any;
772
- context?: any;
773
- timestamp?: Date | undefined;
774
- id: string;
775
- name: string;
776
- }, {
777
- id?: string | undefined;
778
- source?: string | undefined;
779
- payload?: any;
780
- context?: any;
781
- timestamp?: Date | undefined;
782
- name: string;
783
- }>;
784
- /** The event you wish to send to Trigger a Job */
785
- type SendEvent = z.input<typeof RawEventSchema>;
786
- /** Options to control the delivery of the event */
787
- declare const SendEventOptionsSchema: z.ZodObject<{
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. */
795
- deliverAfter: z.ZodOptional<z.ZodNumber>;
796
- /** This optional param will be used by Trigger.dev Connect, which
797
- is coming soon. */
798
- accountId: z.ZodOptional<z.ZodString>;
799
- }, "strip", z.ZodTypeAny, {
800
- deliverAt?: Date | undefined;
801
- deliverAfter?: number | undefined;
802
- accountId?: string | undefined;
803
- }, {
804
- deliverAt?: Date | undefined;
805
- deliverAfter?: number | undefined;
806
- accountId?: string | undefined;
807
- }>;
808
- type SendEventOptions = z.infer<typeof SendEventOptionsSchema>;
809
- declare const RuntimeEnvironmentTypeSchema: z.ZodEnum<["PRODUCTION", "STAGING", "DEVELOPMENT", "PREVIEW"]>;
810
- type RuntimeEnvironmentType = z.infer<typeof RuntimeEnvironmentTypeSchema>;
811
- declare const CreateRunBodySchema: z.ZodObject<{
812
- client: z.ZodString;
813
- job: z.ZodObject<{
814
- id: z.ZodString;
815
- name: z.ZodString;
816
- version: z.ZodString;
817
- event: z.ZodObject<{
818
- name: z.ZodString;
819
- title: z.ZodString;
820
- source: z.ZodString;
821
- icon: z.ZodString;
822
- filter: z.ZodOptional<z.ZodType<EventFilter, z.ZodTypeDef, EventFilter>>;
823
- properties: z.ZodOptional<z.ZodArray<z.ZodObject<{
824
- label: z.ZodString;
825
- text: z.ZodString;
826
- url: z.ZodOptional<z.ZodString>;
827
- }, "strip", z.ZodTypeAny, {
828
- url?: string | undefined;
829
- label: string;
830
- text: string;
831
- }, {
832
- url?: string | undefined;
833
- label: string;
834
- text: string;
835
- }>, "many">>;
836
- schema: z.ZodOptional<z.ZodAny>;
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">>;
853
- }, "strip", z.ZodTypeAny, {
854
- filter?: EventFilter | undefined;
855
- properties?: {
856
- url?: string | undefined;
857
- label: string;
858
- text: string;
859
- }[] | undefined;
860
- schema?: any;
861
- examples?: {
862
- icon?: string | undefined;
863
- payload?: any;
864
- id: string;
865
- name: string;
866
- }[] | undefined;
867
- name: string;
868
- icon: string;
869
- source: string;
870
- title: string;
871
- }, {
872
- filter?: EventFilter | undefined;
873
- properties?: {
874
- url?: string | undefined;
875
- label: string;
876
- text: string;
877
- }[] | undefined;
878
- schema?: any;
879
- examples?: {
880
- icon?: string | undefined;
881
- payload?: any;
882
- id: string;
883
- name: string;
884
- }[] | undefined;
885
- name: string;
886
- icon: string;
887
- source: string;
888
- title: string;
889
- }>;
890
- trigger: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
891
- type: z.ZodLiteral<"dynamic">;
892
- id: z.ZodString;
893
- }, "strip", z.ZodTypeAny, {
894
- id: string;
895
- type: "dynamic";
896
- }, {
897
- id: string;
898
- type: "dynamic";
899
- }>, z.ZodObject<{
900
- type: z.ZodLiteral<"static">;
901
- title: z.ZodString;
902
- properties: z.ZodOptional<z.ZodArray<z.ZodObject<{
903
- label: z.ZodString;
904
- text: z.ZodString;
905
- url: z.ZodOptional<z.ZodString>;
906
- }, "strip", z.ZodTypeAny, {
907
- url?: string | undefined;
908
- label: string;
909
- text: string;
910
- }, {
911
- url?: string | undefined;
912
- label: string;
913
- text: string;
914
- }>, "many">>;
915
- rule: z.ZodObject<{
916
- event: z.ZodString;
917
- source: z.ZodString;
918
- payload: z.ZodOptional<z.ZodType<EventFilter, z.ZodTypeDef, EventFilter>>;
919
- context: z.ZodOptional<z.ZodType<EventFilter, z.ZodTypeDef, EventFilter>>;
920
- }, "strip", z.ZodTypeAny, {
921
- payload?: EventFilter | undefined;
922
- context?: EventFilter | undefined;
923
- event: string;
924
- source: string;
925
- }, {
926
- payload?: EventFilter | undefined;
927
- context?: EventFilter | undefined;
928
- event: string;
929
- source: string;
930
- }>;
931
- }, "strip", z.ZodTypeAny, {
932
- properties?: {
933
- url?: string | undefined;
934
- label: string;
935
- text: string;
936
- }[] | undefined;
937
- type: "static";
938
- title: string;
939
- rule: {
940
- payload?: EventFilter | undefined;
941
- context?: EventFilter | undefined;
942
- event: string;
943
- source: string;
944
- };
945
- }, {
946
- properties?: {
947
- url?: string | undefined;
948
- label: string;
949
- text: string;
950
- }[] | undefined;
951
- type: "static";
952
- title: string;
953
- rule: {
954
- payload?: EventFilter | undefined;
955
- context?: EventFilter | undefined;
956
- event: string;
957
- source: string;
958
- };
959
- }>, z.ZodObject<{
960
- type: z.ZodLiteral<"scheduled">;
961
- schedule: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
962
- type: z.ZodLiteral<"interval">;
963
- options: z.ZodObject<{
964
- seconds: z.ZodNumber;
965
- }, "strip", z.ZodTypeAny, {
966
- seconds: number;
967
- }, {
968
- seconds: number;
969
- }>;
970
- metadata: z.ZodAny;
971
- }, "strip", z.ZodTypeAny, {
972
- metadata?: any;
973
- options: {
974
- seconds: number;
975
- };
976
- type: "interval";
977
- }, {
978
- metadata?: any;
979
- options: {
980
- seconds: number;
981
- };
982
- type: "interval";
983
- }>, z.ZodObject<{
984
- type: z.ZodLiteral<"cron">;
985
- options: z.ZodObject<{
986
- cron: z.ZodString;
987
- }, "strip", z.ZodTypeAny, {
988
- cron: string;
989
- }, {
990
- cron: string;
991
- }>;
992
- metadata: z.ZodAny;
993
- }, "strip", z.ZodTypeAny, {
994
- metadata?: any;
995
- options: {
996
- cron: string;
997
- };
998
- type: "cron";
999
- }, {
1000
- metadata?: any;
1001
- options: {
1002
- cron: string;
1003
- };
1004
- type: "cron";
1005
- }>]>;
1006
- }, "strip", z.ZodTypeAny, {
1007
- type: "scheduled";
1008
- schedule: {
1009
- metadata?: any;
1010
- options: {
1011
- cron: string;
1012
- };
1013
- type: "cron";
1014
- } | {
1015
- metadata?: any;
1016
- options: {
1017
- seconds: number;
1018
- };
1019
- type: "interval";
1020
- };
1021
- }, {
1022
- type: "scheduled";
1023
- schedule: {
1024
- metadata?: any;
1025
- options: {
1026
- cron: string;
1027
- };
1028
- type: "cron";
1029
- } | {
1030
- metadata?: any;
1031
- options: {
1032
- seconds: number;
1033
- };
1034
- type: "interval";
1035
- };
1036
- }>]>;
1037
- integrations: z.ZodRecord<z.ZodString, z.ZodObject<{
1038
- id: z.ZodString;
1039
- metadata: z.ZodObject<{
1040
- id: z.ZodString;
1041
- name: z.ZodString;
1042
- instructions: z.ZodOptional<z.ZodString>;
1043
- }, "strip", z.ZodTypeAny, {
1044
- instructions?: string | undefined;
1045
- id: string;
1046
- name: string;
1047
- }, {
1048
- instructions?: string | undefined;
1049
- id: string;
1050
- name: string;
1051
- }>;
1052
- authSource: z.ZodEnum<["HOSTED", "LOCAL"]>;
1053
- }, "strip", z.ZodTypeAny, {
1054
- id: string;
1055
- metadata: {
1056
- instructions?: string | undefined;
1057
- id: string;
1058
- name: string;
1059
- };
1060
- authSource: "HOSTED" | "LOCAL";
1061
- }, {
1062
- id: string;
1063
- metadata: {
1064
- instructions?: string | undefined;
1065
- id: string;
1066
- name: string;
1067
- };
1068
- authSource: "HOSTED" | "LOCAL";
1069
- }>>;
1070
- internal: z.ZodDefault<z.ZodBoolean>;
1071
- queue: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
1072
- name: z.ZodString;
1073
- maxConcurrent: z.ZodOptional<z.ZodNumber>;
1074
- }, "strip", z.ZodTypeAny, {
1075
- maxConcurrent?: number | undefined;
1076
- name: string;
1077
- }, {
1078
- maxConcurrent?: number | undefined;
1079
- name: string;
1080
- }>, z.ZodString]>>;
1081
- startPosition: z.ZodEnum<["initial", "latest"]>;
1082
- enabled: z.ZodBoolean;
1083
- preprocessRuns: z.ZodBoolean;
1084
- }, "strip", z.ZodTypeAny, {
1085
- queue?: string | {
1086
- maxConcurrent?: number | undefined;
1087
- name: string;
1088
- } | undefined;
1089
- id: string;
1090
- name: string;
1091
- event: {
1092
- filter?: EventFilter | undefined;
1093
- properties?: {
1094
- url?: string | undefined;
1095
- label: string;
1096
- text: string;
1097
- }[] | undefined;
1098
- schema?: any;
1099
- examples?: {
1100
- icon?: string | undefined;
1101
- payload?: any;
1102
- id: string;
1103
- name: string;
1104
- }[] | undefined;
1105
- name: string;
1106
- icon: string;
1107
- source: string;
1108
- title: string;
1109
- };
1110
- version: string;
1111
- trigger: {
1112
- id: string;
1113
- type: "dynamic";
1114
- } | {
1115
- properties?: {
1116
- url?: string | undefined;
1117
- label: string;
1118
- text: string;
1119
- }[] | undefined;
1120
- type: "static";
1121
- title: string;
1122
- rule: {
1123
- payload?: EventFilter | undefined;
1124
- context?: EventFilter | undefined;
1125
- event: string;
1126
- source: string;
1127
- };
1128
- } | {
1129
- type: "scheduled";
1130
- schedule: {
1131
- metadata?: any;
1132
- options: {
1133
- cron: string;
1134
- };
1135
- type: "cron";
1136
- } | {
1137
- metadata?: any;
1138
- options: {
1139
- seconds: number;
1140
- };
1141
- type: "interval";
1142
- };
1143
- };
1144
- integrations: Record<string, {
1145
- id: string;
1146
- metadata: {
1147
- instructions?: string | undefined;
1148
- id: string;
1149
- name: string;
1150
- };
1151
- authSource: "HOSTED" | "LOCAL";
1152
- }>;
1153
- internal: boolean;
1154
- startPosition: "initial" | "latest";
1155
- enabled: boolean;
1156
- preprocessRuns: boolean;
1157
- }, {
1158
- internal?: boolean | undefined;
1159
- queue?: string | {
1160
- maxConcurrent?: number | undefined;
1161
- name: string;
1162
- } | undefined;
1163
- id: string;
1164
- name: string;
1165
- event: {
1166
- filter?: EventFilter | undefined;
1167
- properties?: {
1168
- url?: string | undefined;
1169
- label: string;
1170
- text: string;
1171
- }[] | undefined;
1172
- schema?: any;
1173
- examples?: {
1174
- icon?: string | undefined;
1175
- payload?: any;
1176
- id: string;
1177
- name: string;
1178
- }[] | undefined;
1179
- name: string;
1180
- icon: string;
1181
- source: string;
1182
- title: string;
1183
- };
1184
- version: string;
1185
- trigger: {
1186
- id: string;
1187
- type: "dynamic";
1188
- } | {
1189
- properties?: {
1190
- url?: string | undefined;
1191
- label: string;
1192
- text: string;
1193
- }[] | undefined;
1194
- type: "static";
1195
- title: string;
1196
- rule: {
1197
- payload?: EventFilter | undefined;
1198
- context?: EventFilter | undefined;
1199
- event: string;
1200
- source: string;
1201
- };
1202
- } | {
1203
- type: "scheduled";
1204
- schedule: {
1205
- metadata?: any;
1206
- options: {
1207
- cron: string;
1208
- };
1209
- type: "cron";
1210
- } | {
1211
- metadata?: any;
1212
- options: {
1213
- seconds: number;
1214
- };
1215
- type: "interval";
1216
- };
1217
- };
1218
- integrations: Record<string, {
1219
- id: string;
1220
- metadata: {
1221
- instructions?: string | undefined;
1222
- id: string;
1223
- name: string;
1224
- };
1225
- authSource: "HOSTED" | "LOCAL";
1226
- }>;
1227
- startPosition: "initial" | "latest";
1228
- enabled: boolean;
1229
- preprocessRuns: boolean;
1230
- }>;
1231
- event: z.ZodObject<{
1232
- /** The `id` of the event that was sent.
1233
- */
1234
- id: z.ZodString;
1235
- /** The `name` of the event that was sent. */
1236
- name: z.ZodString;
1237
- /** The `payload` of the event that was sent */
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. */
1241
- context: z.ZodNullable<z.ZodOptional<z.ZodType<DeserializedJson, z.ZodTypeDef, DeserializedJson>>>;
1242
- /** The `timestamp` of the event that was sent */
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. */
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. */
1250
- deliveredAt: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
1251
- }, "strip", z.ZodTypeAny, {
1252
- context?: DeserializedJson | undefined;
1253
- deliverAt?: Date | null | undefined;
1254
- deliveredAt?: Date | null | undefined;
1255
- id: string;
1256
- name: string;
1257
- payload: DeserializedJson;
1258
- timestamp: Date;
1259
- }, {
1260
- context?: DeserializedJson | undefined;
1261
- deliverAt?: Date | null | undefined;
1262
- deliveredAt?: Date | null | undefined;
1263
- id: string;
1264
- name: string;
1265
- payload: DeserializedJson;
1266
- timestamp: Date;
1267
- }>;
1268
- properties: z.ZodOptional<z.ZodArray<z.ZodObject<{
1269
- label: z.ZodString;
1270
- text: z.ZodString;
1271
- url: z.ZodOptional<z.ZodString>;
1272
- }, "strip", z.ZodTypeAny, {
1273
- url?: string | undefined;
1274
- label: string;
1275
- text: string;
1276
- }, {
1277
- url?: string | undefined;
1278
- label: string;
1279
- text: string;
1280
- }>, "many">>;
1281
- }, "strip", z.ZodTypeAny, {
1282
- properties?: {
1283
- url?: string | undefined;
1284
- label: string;
1285
- text: string;
1286
- }[] | undefined;
1287
- event: {
1288
- context?: DeserializedJson | undefined;
1289
- deliverAt?: Date | null | undefined;
1290
- deliveredAt?: Date | null | undefined;
1291
- id: string;
1292
- name: string;
1293
- payload: DeserializedJson;
1294
- timestamp: Date;
1295
- };
1296
- job: {
1297
- queue?: string | {
1298
- maxConcurrent?: number | undefined;
1299
- name: string;
1300
- } | undefined;
1301
- id: string;
1302
- name: string;
1303
- event: {
1304
- filter?: EventFilter | undefined;
1305
- properties?: {
1306
- url?: string | undefined;
1307
- label: string;
1308
- text: string;
1309
- }[] | undefined;
1310
- schema?: any;
1311
- examples?: {
1312
- icon?: string | undefined;
1313
- payload?: any;
1314
- id: string;
1315
- name: string;
1316
- }[] | undefined;
1317
- name: string;
1318
- icon: string;
1319
- source: string;
1320
- title: string;
1321
- };
1322
- version: string;
1323
- trigger: {
1324
- id: string;
1325
- type: "dynamic";
1326
- } | {
1327
- properties?: {
1328
- url?: string | undefined;
1329
- label: string;
1330
- text: string;
1331
- }[] | undefined;
1332
- type: "static";
1333
- title: string;
1334
- rule: {
1335
- payload?: EventFilter | undefined;
1336
- context?: EventFilter | undefined;
1337
- event: string;
1338
- source: string;
1339
- };
1340
- } | {
1341
- type: "scheduled";
1342
- schedule: {
1343
- metadata?: any;
1344
- options: {
1345
- cron: string;
1346
- };
1347
- type: "cron";
1348
- } | {
1349
- metadata?: any;
1350
- options: {
1351
- seconds: number;
1352
- };
1353
- type: "interval";
1354
- };
1355
- };
1356
- integrations: Record<string, {
1357
- id: string;
1358
- metadata: {
1359
- instructions?: string | undefined;
1360
- id: string;
1361
- name: string;
1362
- };
1363
- authSource: "HOSTED" | "LOCAL";
1364
- }>;
1365
- internal: boolean;
1366
- startPosition: "initial" | "latest";
1367
- enabled: boolean;
1368
- preprocessRuns: boolean;
1369
- };
1370
- client: string;
1371
- }, {
1372
- properties?: {
1373
- url?: string | undefined;
1374
- label: string;
1375
- text: string;
1376
- }[] | undefined;
1377
- event: {
1378
- context?: DeserializedJson | undefined;
1379
- deliverAt?: Date | null | undefined;
1380
- deliveredAt?: Date | null | undefined;
1381
- id: string;
1382
- name: string;
1383
- payload: DeserializedJson;
1384
- timestamp: Date;
1385
- };
1386
- job: {
1387
- internal?: boolean | undefined;
1388
- queue?: string | {
1389
- maxConcurrent?: number | undefined;
1390
- name: string;
1391
- } | undefined;
1392
- id: string;
1393
- name: string;
1394
- event: {
1395
- filter?: EventFilter | undefined;
1396
- properties?: {
1397
- url?: string | undefined;
1398
- label: string;
1399
- text: string;
1400
- }[] | undefined;
1401
- schema?: any;
1402
- examples?: {
1403
- icon?: string | undefined;
1404
- payload?: any;
1405
- id: string;
1406
- name: string;
1407
- }[] | undefined;
1408
- name: string;
1409
- icon: string;
1410
- source: string;
1411
- title: string;
1412
- };
1413
- version: string;
1414
- trigger: {
1415
- id: string;
1416
- type: "dynamic";
1417
- } | {
1418
- properties?: {
1419
- url?: string | undefined;
1420
- label: string;
1421
- text: string;
1422
- }[] | undefined;
1423
- type: "static";
1424
- title: string;
1425
- rule: {
1426
- payload?: EventFilter | undefined;
1427
- context?: EventFilter | undefined;
1428
- event: string;
1429
- source: string;
1430
- };
1431
- } | {
1432
- type: "scheduled";
1433
- schedule: {
1434
- metadata?: any;
1435
- options: {
1436
- cron: string;
1437
- };
1438
- type: "cron";
1439
- } | {
1440
- metadata?: any;
1441
- options: {
1442
- seconds: number;
1443
- };
1444
- type: "interval";
1445
- };
1446
- };
1447
- integrations: Record<string, {
1448
- id: string;
1449
- metadata: {
1450
- instructions?: string | undefined;
1451
- id: string;
1452
- name: string;
1453
- };
1454
- authSource: "HOSTED" | "LOCAL";
1455
- }>;
1456
- startPosition: "initial" | "latest";
1457
- enabled: boolean;
1458
- preprocessRuns: boolean;
1459
- };
1460
- client: string;
1461
- }>;
1462
- type CreateRunBody = z.infer<typeof CreateRunBodySchema>;
1463
- declare const RedactStringSchema: z.ZodObject<{
1464
- __redactedString: z.ZodLiteral<true>;
1465
- strings: z.ZodArray<z.ZodString, "many">;
1466
- interpolations: z.ZodArray<z.ZodString, "many">;
1467
- }, "strip", z.ZodTypeAny, {
1468
- __redactedString: true;
1469
- strings: string[];
1470
- interpolations: string[];
1471
- }, {
1472
- __redactedString: true;
1473
- strings: string[];
1474
- interpolations: string[];
1475
- }>;
1476
- type RedactString = z.infer<typeof RedactStringSchema>;
1477
- type CachedTask = z.infer<typeof CachedTaskSchema>;
1478
- declare const RunTaskOptionsSchema: z.ZodObject<{
1479
- /** The name of the Task is required. This is displayed on the Task in the logs. */
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. */
1511
- icon: z.ZodOptional<z.ZodString>;
1512
- /** The key for the Task that you want to appear in the logs */
1513
- displayKey: z.ZodOptional<z.ZodString>;
1514
- /** A description of the Task */
1515
- description: z.ZodOptional<z.ZodString>;
1516
- /** Properties that are displayed in the logs */
1517
- properties: z.ZodOptional<z.ZodArray<z.ZodObject<{
1518
- label: z.ZodString;
1519
- text: z.ZodString;
1520
- url: z.ZodOptional<z.ZodString>;
1521
- }, "strip", z.ZodTypeAny, {
1522
- url?: string | undefined;
1523
- label: string;
1524
- text: string;
1525
- }, {
1526
- url?: string | undefined;
1527
- label: string;
1528
- text: string;
1529
- }>, "many">>;
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
- }>>;
1556
- trigger: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1557
- type: z.ZodLiteral<"dynamic">;
1558
- id: z.ZodString;
1559
- }, "strip", z.ZodTypeAny, {
1560
- id: string;
1561
- type: "dynamic";
1562
- }, {
1563
- id: string;
1564
- type: "dynamic";
1565
- }>, z.ZodObject<{
1566
- type: z.ZodLiteral<"static">;
1567
- title: z.ZodString;
1568
- properties: z.ZodOptional<z.ZodArray<z.ZodObject<{
1569
- label: z.ZodString;
1570
- text: z.ZodString;
1571
- url: z.ZodOptional<z.ZodString>;
1572
- }, "strip", z.ZodTypeAny, {
1573
- url?: string | undefined;
1574
- label: string;
1575
- text: string;
1576
- }, {
1577
- url?: string | undefined;
1578
- label: string;
1579
- text: string;
1580
- }>, "many">>;
1581
- rule: z.ZodObject<{
1582
- event: z.ZodString;
1583
- source: z.ZodString;
1584
- payload: z.ZodOptional<z.ZodType<EventFilter, z.ZodTypeDef, EventFilter>>;
1585
- context: z.ZodOptional<z.ZodType<EventFilter, z.ZodTypeDef, EventFilter>>;
1586
- }, "strip", z.ZodTypeAny, {
1587
- payload?: EventFilter | undefined;
1588
- context?: EventFilter | undefined;
1589
- event: string;
1590
- source: string;
1591
- }, {
1592
- payload?: EventFilter | undefined;
1593
- context?: EventFilter | undefined;
1594
- event: string;
1595
- source: string;
1596
- }>;
1597
- }, "strip", z.ZodTypeAny, {
1598
- properties?: {
1599
- url?: string | undefined;
1600
- label: string;
1601
- text: string;
1602
- }[] | undefined;
1603
- type: "static";
1604
- title: string;
1605
- rule: {
1606
- payload?: EventFilter | undefined;
1607
- context?: EventFilter | undefined;
1608
- event: string;
1609
- source: string;
1610
- };
1611
- }, {
1612
- properties?: {
1613
- url?: string | undefined;
1614
- label: string;
1615
- text: string;
1616
- }[] | undefined;
1617
- type: "static";
1618
- title: string;
1619
- rule: {
1620
- payload?: EventFilter | undefined;
1621
- context?: EventFilter | undefined;
1622
- event: string;
1623
- source: string;
1624
- };
1625
- }>, z.ZodObject<{
1626
- type: z.ZodLiteral<"scheduled">;
1627
- schedule: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1628
- type: z.ZodLiteral<"interval">;
1629
- options: z.ZodObject<{
1630
- seconds: z.ZodNumber;
1631
- }, "strip", z.ZodTypeAny, {
1632
- seconds: number;
1633
- }, {
1634
- seconds: number;
1635
- }>;
1636
- metadata: z.ZodAny;
1637
- }, "strip", z.ZodTypeAny, {
1638
- metadata?: any;
1639
- options: {
1640
- seconds: number;
1641
- };
1642
- type: "interval";
1643
- }, {
1644
- metadata?: any;
1645
- options: {
1646
- seconds: number;
1647
- };
1648
- type: "interval";
1649
- }>, z.ZodObject<{
1650
- type: z.ZodLiteral<"cron">;
1651
- options: z.ZodObject<{
1652
- cron: z.ZodString;
1653
- }, "strip", z.ZodTypeAny, {
1654
- cron: string;
1655
- }, {
1656
- cron: string;
1657
- }>;
1658
- metadata: z.ZodAny;
1659
- }, "strip", z.ZodTypeAny, {
1660
- metadata?: any;
1661
- options: {
1662
- cron: string;
1663
- };
1664
- type: "cron";
1665
- }, {
1666
- metadata?: any;
1667
- options: {
1668
- cron: string;
1669
- };
1670
- type: "cron";
1671
- }>]>;
1672
- }, "strip", z.ZodTypeAny, {
1673
- type: "scheduled";
1674
- schedule: {
1675
- metadata?: any;
1676
- options: {
1677
- cron: string;
1678
- };
1679
- type: "cron";
1680
- } | {
1681
- metadata?: any;
1682
- options: {
1683
- seconds: number;
1684
- };
1685
- type: "interval";
1686
- };
1687
- }, {
1688
- type: "scheduled";
1689
- schedule: {
1690
- metadata?: any;
1691
- options: {
1692
- cron: string;
1693
- };
1694
- type: "cron";
1695
- } | {
1696
- metadata?: any;
1697
- options: {
1698
- seconds: number;
1699
- };
1700
- type: "interval";
1701
- };
1702
- }>]>>;
1703
- }, "strip", z.ZodTypeAny, {
1704
- icon?: string | undefined;
1705
- delayUntil?: Date | undefined;
1706
- description?: string | undefined;
1707
- params?: any;
1708
- properties?: {
1709
- url?: string | undefined;
1710
- label: string;
1711
- text: string;
1712
- }[] | undefined;
1713
- style?: {
1714
- variant?: string | undefined;
1715
- style: "normal" | "minimal";
1716
- } | undefined;
1717
- operation?: "fetch" | undefined;
1718
- trigger?: {
1719
- id: string;
1720
- type: "dynamic";
1721
- } | {
1722
- properties?: {
1723
- url?: string | undefined;
1724
- label: string;
1725
- text: string;
1726
- }[] | undefined;
1727
- type: "static";
1728
- title: string;
1729
- rule: {
1730
- payload?: EventFilter | undefined;
1731
- context?: EventFilter | undefined;
1732
- event: string;
1733
- source: string;
1734
- };
1735
- } | {
1736
- type: "scheduled";
1737
- schedule: {
1738
- metadata?: any;
1739
- options: {
1740
- cron: string;
1741
- };
1742
- type: "cron";
1743
- } | {
1744
- metadata?: any;
1745
- options: {
1746
- seconds: number;
1747
- };
1748
- type: "interval";
1749
- };
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;
1758
- displayKey?: string | undefined;
1759
- connectionKey?: string | undefined;
1760
- redact?: {
1761
- paths: string[];
1762
- } | undefined;
1763
- name: string;
1764
- noop: boolean;
1765
- }, {
1766
- icon?: string | undefined;
1767
- noop?: boolean | undefined;
1768
- delayUntil?: Date | undefined;
1769
- description?: string | undefined;
1770
- params?: any;
1771
- properties?: {
1772
- url?: string | undefined;
1773
- label: string;
1774
- text: string;
1775
- }[] | undefined;
1776
- style?: {
1777
- variant?: string | undefined;
1778
- style: "normal" | "minimal";
1779
- } | undefined;
1780
- operation?: "fetch" | undefined;
1781
- trigger?: {
1782
- id: string;
1783
- type: "dynamic";
1784
- } | {
1785
- properties?: {
1786
- url?: string | undefined;
1787
- label: string;
1788
- text: string;
1789
- }[] | undefined;
1790
- type: "static";
1791
- title: string;
1792
- rule: {
1793
- payload?: EventFilter | undefined;
1794
- context?: EventFilter | undefined;
1795
- event: string;
1796
- source: string;
1797
- };
1798
- } | {
1799
- type: "scheduled";
1800
- schedule: {
1801
- metadata?: any;
1802
- options: {
1803
- cron: string;
1804
- };
1805
- type: "cron";
1806
- } | {
1807
- metadata?: any;
1808
- options: {
1809
- seconds: number;
1810
- };
1811
- type: "interval";
1812
- };
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;
1821
- displayKey?: string | undefined;
1822
- connectionKey?: string | undefined;
1823
- redact?: {
1824
- paths: string[];
1825
- } | undefined;
1826
- name: string;
1827
- }>;
1828
- type RunTaskOptions = z.input<typeof RunTaskOptionsSchema>;
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. */
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. */
1862
- icon: z.ZodOptional<z.ZodString>;
1863
- /** The key for the Task that you want to appear in the logs */
1864
- displayKey: z.ZodOptional<z.ZodString>;
1865
- /** A description of the Task */
1866
- description: z.ZodOptional<z.ZodString>;
1867
- /** Properties that are displayed in the logs */
1868
- properties: z.ZodOptional<z.ZodArray<z.ZodObject<{
1869
- label: z.ZodString;
1870
- text: z.ZodString;
1871
- url: z.ZodOptional<z.ZodString>;
1872
- }, "strip", z.ZodTypeAny, {
1873
- url?: string | undefined;
1874
- label: string;
1875
- text: string;
1876
- }, {
1877
- url?: string | undefined;
1878
- label: string;
1879
- text: string;
1880
- }>, "many">>;
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
- }>>;
1907
- trigger: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1908
- type: z.ZodLiteral<"dynamic">;
1909
- id: z.ZodString;
1910
- }, "strip", z.ZodTypeAny, {
1911
- id: string;
1912
- type: "dynamic";
1913
- }, {
1914
- id: string;
1915
- type: "dynamic";
1916
- }>, z.ZodObject<{
1917
- type: z.ZodLiteral<"static">;
1918
- title: z.ZodString;
1919
- properties: z.ZodOptional<z.ZodArray<z.ZodObject<{
1920
- label: z.ZodString;
1921
- text: z.ZodString;
1922
- url: z.ZodOptional<z.ZodString>;
1923
- }, "strip", z.ZodTypeAny, {
1924
- url?: string | undefined;
1925
- label: string;
1926
- text: string;
1927
- }, {
1928
- url?: string | undefined;
1929
- label: string;
1930
- text: string;
1931
- }>, "many">>;
1932
- rule: z.ZodObject<{
1933
- event: z.ZodString;
1934
- source: z.ZodString;
1935
- payload: z.ZodOptional<z.ZodType<EventFilter, z.ZodTypeDef, EventFilter>>;
1936
- context: z.ZodOptional<z.ZodType<EventFilter, z.ZodTypeDef, EventFilter>>;
1937
- }, "strip", z.ZodTypeAny, {
1938
- payload?: EventFilter | undefined;
1939
- context?: EventFilter | undefined;
1940
- event: string;
1941
- source: string;
1942
- }, {
1943
- payload?: EventFilter | undefined;
1944
- context?: EventFilter | undefined;
1945
- event: string;
1946
- source: string;
1947
- }>;
1948
- }, "strip", z.ZodTypeAny, {
1949
- properties?: {
1950
- url?: string | undefined;
1951
- label: string;
1952
- text: string;
1953
- }[] | undefined;
1954
- type: "static";
1955
- title: string;
1956
- rule: {
1957
- payload?: EventFilter | undefined;
1958
- context?: EventFilter | undefined;
1959
- event: string;
1960
- source: string;
1961
- };
1962
- }, {
1963
- properties?: {
1964
- url?: string | undefined;
1965
- label: string;
1966
- text: string;
1967
- }[] | undefined;
1968
- type: "static";
1969
- title: string;
1970
- rule: {
1971
- payload?: EventFilter | undefined;
1972
- context?: EventFilter | undefined;
1973
- event: string;
1974
- source: string;
1975
- };
1976
- }>, z.ZodObject<{
1977
- type: z.ZodLiteral<"scheduled">;
1978
- schedule: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1979
- type: z.ZodLiteral<"interval">;
1980
- options: z.ZodObject<{
1981
- seconds: z.ZodNumber;
1982
- }, "strip", z.ZodTypeAny, {
1983
- seconds: number;
1984
- }, {
1985
- seconds: number;
1986
- }>;
1987
- metadata: z.ZodAny;
1988
- }, "strip", z.ZodTypeAny, {
1989
- metadata?: any;
1990
- options: {
1991
- seconds: number;
1992
- };
1993
- type: "interval";
1994
- }, {
1995
- metadata?: any;
1996
- options: {
1997
- seconds: number;
1998
- };
1999
- type: "interval";
2000
- }>, z.ZodObject<{
2001
- type: z.ZodLiteral<"cron">;
2002
- options: z.ZodObject<{
2003
- cron: z.ZodString;
2004
- }, "strip", z.ZodTypeAny, {
2005
- cron: string;
2006
- }, {
2007
- cron: string;
2008
- }>;
2009
- metadata: z.ZodAny;
2010
- }, "strip", z.ZodTypeAny, {
2011
- metadata?: any;
2012
- options: {
2013
- cron: string;
2014
- };
2015
- type: "cron";
2016
- }, {
2017
- metadata?: any;
2018
- options: {
2019
- cron: string;
2020
- };
2021
- type: "cron";
2022
- }>]>;
2023
- }, "strip", z.ZodTypeAny, {
2024
- type: "scheduled";
2025
- schedule: {
2026
- metadata?: any;
2027
- options: {
2028
- cron: string;
2029
- };
2030
- type: "cron";
2031
- } | {
2032
- metadata?: any;
2033
- options: {
2034
- seconds: number;
2035
- };
2036
- type: "interval";
2037
- };
2038
- }, {
2039
- type: "scheduled";
2040
- schedule: {
2041
- metadata?: any;
2042
- options: {
2043
- cron: string;
2044
- };
2045
- type: "cron";
2046
- } | {
2047
- metadata?: any;
2048
- options: {
2049
- seconds: number;
2050
- };
2051
- type: "interval";
2052
- };
2053
- }>]>>;
2054
- }, {
2055
- idempotencyKey: z.ZodString;
2056
- parentId: z.ZodOptional<z.ZodString>;
2057
- }>, "strip", z.ZodTypeAny, {
2058
- icon?: string | undefined;
2059
- delayUntil?: Date | undefined;
2060
- description?: string | undefined;
2061
- params?: any;
2062
- properties?: {
2063
- url?: string | undefined;
2064
- label: string;
2065
- text: string;
2066
- }[] | undefined;
2067
- parentId?: string | undefined;
2068
- style?: {
2069
- variant?: string | undefined;
2070
- style: "normal" | "minimal";
2071
- } | undefined;
2072
- operation?: "fetch" | undefined;
2073
- trigger?: {
2074
- id: string;
2075
- type: "dynamic";
2076
- } | {
2077
- properties?: {
2078
- url?: string | undefined;
2079
- label: string;
2080
- text: string;
2081
- }[] | undefined;
2082
- type: "static";
2083
- title: string;
2084
- rule: {
2085
- payload?: EventFilter | undefined;
2086
- context?: EventFilter | undefined;
2087
- event: string;
2088
- source: string;
2089
- };
2090
- } | {
2091
- type: "scheduled";
2092
- schedule: {
2093
- metadata?: any;
2094
- options: {
2095
- cron: string;
2096
- };
2097
- type: "cron";
2098
- } | {
2099
- metadata?: any;
2100
- options: {
2101
- seconds: number;
2102
- };
2103
- type: "interval";
2104
- };
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;
2113
- displayKey?: string | undefined;
2114
- connectionKey?: string | undefined;
2115
- redact?: {
2116
- paths: string[];
2117
- } | undefined;
2118
- name: string;
2119
- noop: boolean;
2120
- idempotencyKey: string;
2121
- }, {
2122
- icon?: string | undefined;
2123
- noop?: boolean | undefined;
2124
- delayUntil?: Date | undefined;
2125
- description?: string | undefined;
2126
- params?: any;
2127
- properties?: {
2128
- url?: string | undefined;
2129
- label: string;
2130
- text: string;
2131
- }[] | undefined;
2132
- parentId?: string | undefined;
2133
- style?: {
2134
- variant?: string | undefined;
2135
- style: "normal" | "minimal";
2136
- } | undefined;
2137
- operation?: "fetch" | undefined;
2138
- trigger?: {
2139
- id: string;
2140
- type: "dynamic";
2141
- } | {
2142
- properties?: {
2143
- url?: string | undefined;
2144
- label: string;
2145
- text: string;
2146
- }[] | undefined;
2147
- type: "static";
2148
- title: string;
2149
- rule: {
2150
- payload?: EventFilter | undefined;
2151
- context?: EventFilter | undefined;
2152
- event: string;
2153
- source: string;
2154
- };
2155
- } | {
2156
- type: "scheduled";
2157
- schedule: {
2158
- metadata?: any;
2159
- options: {
2160
- cron: string;
2161
- };
2162
- type: "cron";
2163
- } | {
2164
- metadata?: any;
2165
- options: {
2166
- seconds: number;
2167
- };
2168
- type: "interval";
2169
- };
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;
2178
- displayKey?: string | undefined;
2179
- connectionKey?: string | undefined;
2180
- redact?: {
2181
- paths: string[];
2182
- } | undefined;
2183
- name: string;
2184
- idempotencyKey: string;
2185
- }>;
2186
- type RunTaskBodyInput = z.infer<typeof RunTaskBodyInputSchema>;
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. */
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. */
2220
- icon: z.ZodOptional<z.ZodString>;
2221
- /** The key for the Task that you want to appear in the logs */
2222
- displayKey: z.ZodOptional<z.ZodString>;
2223
- /** A description of the Task */
2224
- description: z.ZodOptional<z.ZodString>;
2225
- /** Properties that are displayed in the logs */
2226
- properties: z.ZodOptional<z.ZodArray<z.ZodObject<{
2227
- label: z.ZodString;
2228
- text: z.ZodString;
2229
- url: z.ZodOptional<z.ZodString>;
2230
- }, "strip", z.ZodTypeAny, {
2231
- url?: string | undefined;
2232
- label: string;
2233
- text: string;
2234
- }, {
2235
- url?: string | undefined;
2236
- label: string;
2237
- text: string;
2238
- }>, "many">>;
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
- }>>;
2265
- trigger: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2266
- type: z.ZodLiteral<"dynamic">;
2267
- id: z.ZodString;
2268
- }, "strip", z.ZodTypeAny, {
2269
- id: string;
2270
- type: "dynamic";
2271
- }, {
2272
- id: string;
2273
- type: "dynamic";
2274
- }>, z.ZodObject<{
2275
- type: z.ZodLiteral<"static">;
2276
- title: z.ZodString;
2277
- properties: z.ZodOptional<z.ZodArray<z.ZodObject<{
2278
- label: z.ZodString;
2279
- text: z.ZodString;
2280
- url: z.ZodOptional<z.ZodString>;
2281
- }, "strip", z.ZodTypeAny, {
2282
- url?: string | undefined;
2283
- label: string;
2284
- text: string;
2285
- }, {
2286
- url?: string | undefined;
2287
- label: string;
2288
- text: string;
2289
- }>, "many">>;
2290
- rule: z.ZodObject<{
2291
- event: z.ZodString;
2292
- source: z.ZodString;
2293
- payload: z.ZodOptional<z.ZodType<EventFilter, z.ZodTypeDef, EventFilter>>;
2294
- context: z.ZodOptional<z.ZodType<EventFilter, z.ZodTypeDef, EventFilter>>;
2295
- }, "strip", z.ZodTypeAny, {
2296
- payload?: EventFilter | undefined;
2297
- context?: EventFilter | undefined;
2298
- event: string;
2299
- source: string;
2300
- }, {
2301
- payload?: EventFilter | undefined;
2302
- context?: EventFilter | undefined;
2303
- event: string;
2304
- source: string;
2305
- }>;
2306
- }, "strip", z.ZodTypeAny, {
2307
- properties?: {
2308
- url?: string | undefined;
2309
- label: string;
2310
- text: string;
2311
- }[] | undefined;
2312
- type: "static";
2313
- title: string;
2314
- rule: {
2315
- payload?: EventFilter | undefined;
2316
- context?: EventFilter | undefined;
2317
- event: string;
2318
- source: string;
2319
- };
2320
- }, {
2321
- properties?: {
2322
- url?: string | undefined;
2323
- label: string;
2324
- text: string;
2325
- }[] | undefined;
2326
- type: "static";
2327
- title: string;
2328
- rule: {
2329
- payload?: EventFilter | undefined;
2330
- context?: EventFilter | undefined;
2331
- event: string;
2332
- source: string;
2333
- };
2334
- }>, z.ZodObject<{
2335
- type: z.ZodLiteral<"scheduled">;
2336
- schedule: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2337
- type: z.ZodLiteral<"interval">;
2338
- options: z.ZodObject<{
2339
- seconds: z.ZodNumber;
2340
- }, "strip", z.ZodTypeAny, {
2341
- seconds: number;
2342
- }, {
2343
- seconds: number;
2344
- }>;
2345
- metadata: z.ZodAny;
2346
- }, "strip", z.ZodTypeAny, {
2347
- metadata?: any;
2348
- options: {
2349
- seconds: number;
2350
- };
2351
- type: "interval";
2352
- }, {
2353
- metadata?: any;
2354
- options: {
2355
- seconds: number;
2356
- };
2357
- type: "interval";
2358
- }>, z.ZodObject<{
2359
- type: z.ZodLiteral<"cron">;
2360
- options: z.ZodObject<{
2361
- cron: z.ZodString;
2362
- }, "strip", z.ZodTypeAny, {
2363
- cron: string;
2364
- }, {
2365
- cron: string;
2366
- }>;
2367
- metadata: z.ZodAny;
2368
- }, "strip", z.ZodTypeAny, {
2369
- metadata?: any;
2370
- options: {
2371
- cron: string;
2372
- };
2373
- type: "cron";
2374
- }, {
2375
- metadata?: any;
2376
- options: {
2377
- cron: string;
2378
- };
2379
- type: "cron";
2380
- }>]>;
2381
- }, "strip", z.ZodTypeAny, {
2382
- type: "scheduled";
2383
- schedule: {
2384
- metadata?: any;
2385
- options: {
2386
- cron: string;
2387
- };
2388
- type: "cron";
2389
- } | {
2390
- metadata?: any;
2391
- options: {
2392
- seconds: number;
2393
- };
2394
- type: "interval";
2395
- };
2396
- }, {
2397
- type: "scheduled";
2398
- schedule: {
2399
- metadata?: any;
2400
- options: {
2401
- cron: string;
2402
- };
2403
- type: "cron";
2404
- } | {
2405
- metadata?: any;
2406
- options: {
2407
- seconds: number;
2408
- };
2409
- type: "interval";
2410
- };
2411
- }>]>>;
2412
- }, {
2413
- idempotencyKey: z.ZodString;
2414
- parentId: z.ZodOptional<z.ZodString>;
2415
- }>, "description" | "params" | "properties">, {
2416
- output: z.ZodEffects<z.ZodOptional<z.ZodType<SerializableJson, z.ZodTypeDef, SerializableJson>>, string | number | boolean | {
2417
- [key: string]: DeserializedJson;
2418
- } | DeserializedJson[] | null, SerializableJson>;
2419
- }>, "strip", z.ZodTypeAny, {
2420
- description?: string | undefined;
2421
- params?: any;
2422
- properties?: {
2423
- url?: string | undefined;
2424
- label: string;
2425
- text: string;
2426
- }[] | undefined;
2427
- output: string | number | boolean | {
2428
- [key: string]: DeserializedJson;
2429
- } | DeserializedJson[] | null;
2430
- }, {
2431
- description?: string | undefined;
2432
- params?: any;
2433
- properties?: {
2434
- url?: string | undefined;
2435
- label: string;
2436
- text: string;
2437
- }[] | undefined;
2438
- output?: SerializableJson;
2439
- }>;
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>;
2469
- declare const NormalizedRequestSchema: z.ZodObject<{
2470
- headers: z.ZodRecord<z.ZodString, z.ZodString>;
2471
- method: z.ZodString;
2472
- query: z.ZodRecord<z.ZodString, z.ZodString>;
2473
- url: z.ZodString;
2474
- body: z.ZodAny;
2475
- }, "strip", z.ZodTypeAny, {
2476
- body?: any;
2477
- url: string;
2478
- method: string;
2479
- headers: Record<string, string>;
2480
- query: Record<string, string>;
2481
- }, {
2482
- body?: any;
2483
- url: string;
2484
- method: string;
2485
- headers: Record<string, string>;
2486
- query: Record<string, string>;
2487
- }>;
2488
- type NormalizedRequest = z.infer<typeof NormalizedRequestSchema>;
2489
- declare const NormalizedResponseSchema: z.ZodObject<{
2490
- status: z.ZodNumber;
2491
- body: z.ZodAny;
2492
- headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2493
- }, "strip", z.ZodTypeAny, {
2494
- headers?: Record<string, string> | undefined;
2495
- body?: any;
2496
- status: number;
2497
- }, {
2498
- headers?: Record<string, string> | undefined;
2499
- body?: any;
2500
- status: number;
2501
- }>;
2502
- type NormalizedResponse = z.infer<typeof NormalizedResponseSchema>;
2503
- declare const RegisterTriggerBodySchema: z.ZodObject<{
2504
- rule: z.ZodObject<{
2505
- event: z.ZodString;
2506
- source: z.ZodString;
2507
- payload: z.ZodOptional<z.ZodType<EventFilter, z.ZodTypeDef, EventFilter>>;
2508
- context: z.ZodOptional<z.ZodType<EventFilter, z.ZodTypeDef, EventFilter>>;
2509
- }, "strip", z.ZodTypeAny, {
2510
- payload?: EventFilter | undefined;
2511
- context?: EventFilter | undefined;
2512
- event: string;
2513
- source: string;
2514
- }, {
2515
- payload?: EventFilter | undefined;
2516
- context?: EventFilter | undefined;
2517
- event: string;
2518
- source: string;
2519
- }>;
2520
- source: z.ZodObject<{
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
- }>;
2555
- key: z.ZodString;
2556
- params: z.ZodAny;
2557
- events: z.ZodArray<z.ZodString, "many">;
2558
- }, "strip", z.ZodTypeAny, {
2559
- params?: any;
2560
- key: string;
2561
- channel: "HTTP" | "SMTP" | "SQS";
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
- };
2572
- }, {
2573
- params?: any;
2574
- key: string;
2575
- channel: "HTTP" | "SMTP" | "SQS";
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
- };
2586
- }>;
2587
- }, "strip", z.ZodTypeAny, {
2588
- source: {
2589
- params?: any;
2590
- key: string;
2591
- channel: "HTTP" | "SMTP" | "SQS";
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
- };
2602
- };
2603
- rule: {
2604
- payload?: EventFilter | undefined;
2605
- context?: EventFilter | undefined;
2606
- event: string;
2607
- source: string;
2608
- };
2609
- }, {
2610
- source: {
2611
- params?: any;
2612
- key: string;
2613
- channel: "HTTP" | "SMTP" | "SQS";
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
- };
2624
- };
2625
- rule: {
2626
- payload?: EventFilter | undefined;
2627
- context?: EventFilter | undefined;
2628
- event: string;
2629
- source: string;
2630
- };
2631
- }>;
2632
- type RegisterTriggerBody = z.infer<typeof RegisterTriggerBodySchema>;
2633
-
2634
- declare const TriggerMetadataSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2635
- type: z.ZodLiteral<"dynamic">;
2636
- id: z.ZodString;
2637
- }, "strip", z.ZodTypeAny, {
2638
- id: string;
2639
- type: "dynamic";
2640
- }, {
2641
- id: string;
2642
- type: "dynamic";
2643
- }>, z.ZodObject<{
2644
- type: z.ZodLiteral<"static">;
2645
- title: z.ZodString;
2646
- properties: z.ZodOptional<z.ZodArray<z.ZodObject<{
2647
- label: z.ZodString;
2648
- text: z.ZodString;
2649
- url: z.ZodOptional<z.ZodString>;
2650
- }, "strip", z.ZodTypeAny, {
2651
- url?: string | undefined;
2652
- label: string;
2653
- text: string;
2654
- }, {
2655
- url?: string | undefined;
2656
- label: string;
2657
- text: string;
2658
- }>, "many">>;
2659
- rule: z.ZodObject<{
2660
- event: z.ZodString;
2661
- source: z.ZodString;
2662
- payload: z.ZodOptional<z.ZodType<EventFilter, z.ZodTypeDef, EventFilter>>;
2663
- context: z.ZodOptional<z.ZodType<EventFilter, z.ZodTypeDef, EventFilter>>;
2664
- }, "strip", z.ZodTypeAny, {
2665
- payload?: EventFilter | undefined;
2666
- context?: EventFilter | undefined;
2667
- event: string;
2668
- source: string;
2669
- }, {
2670
- payload?: EventFilter | undefined;
2671
- context?: EventFilter | undefined;
2672
- event: string;
2673
- source: string;
2674
- }>;
2675
- }, "strip", z.ZodTypeAny, {
2676
- properties?: {
2677
- url?: string | undefined;
2678
- label: string;
2679
- text: string;
2680
- }[] | undefined;
2681
- type: "static";
2682
- title: string;
2683
- rule: {
2684
- payload?: EventFilter | undefined;
2685
- context?: EventFilter | undefined;
2686
- event: string;
2687
- source: string;
2688
- };
2689
- }, {
2690
- properties?: {
2691
- url?: string | undefined;
2692
- label: string;
2693
- text: string;
2694
- }[] | undefined;
2695
- type: "static";
2696
- title: string;
2697
- rule: {
2698
- payload?: EventFilter | undefined;
2699
- context?: EventFilter | undefined;
2700
- event: string;
2701
- source: string;
2702
- };
2703
- }>, z.ZodObject<{
2704
- type: z.ZodLiteral<"scheduled">;
2705
- schedule: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2706
- type: z.ZodLiteral<"interval">;
2707
- options: z.ZodObject<{
2708
- seconds: z.ZodNumber;
2709
- }, "strip", z.ZodTypeAny, {
2710
- seconds: number;
2711
- }, {
2712
- seconds: number;
2713
- }>;
2714
- metadata: z.ZodAny;
2715
- }, "strip", z.ZodTypeAny, {
2716
- metadata?: any;
2717
- options: {
2718
- seconds: number;
2719
- };
2720
- type: "interval";
2721
- }, {
2722
- metadata?: any;
2723
- options: {
2724
- seconds: number;
2725
- };
2726
- type: "interval";
2727
- }>, z.ZodObject<{
2728
- type: z.ZodLiteral<"cron">;
2729
- options: z.ZodObject<{
2730
- cron: z.ZodString;
2731
- }, "strip", z.ZodTypeAny, {
2732
- cron: string;
2733
- }, {
2734
- cron: string;
2735
- }>;
2736
- metadata: z.ZodAny;
2737
- }, "strip", z.ZodTypeAny, {
2738
- metadata?: any;
2739
- options: {
2740
- cron: string;
2741
- };
2742
- type: "cron";
2743
- }, {
2744
- metadata?: any;
2745
- options: {
2746
- cron: string;
2747
- };
2748
- type: "cron";
2749
- }>]>;
2750
- }, "strip", z.ZodTypeAny, {
2751
- type: "scheduled";
2752
- schedule: {
2753
- metadata?: any;
2754
- options: {
2755
- cron: string;
2756
- };
2757
- type: "cron";
2758
- } | {
2759
- metadata?: any;
2760
- options: {
2761
- seconds: number;
2762
- };
2763
- type: "interval";
2764
- };
2765
- }, {
2766
- type: "scheduled";
2767
- schedule: {
2768
- metadata?: any;
2769
- options: {
2770
- cron: string;
2771
- };
2772
- type: "cron";
2773
- } | {
2774
- metadata?: any;
2775
- options: {
2776
- seconds: number;
2777
- };
2778
- type: "interval";
2779
- };
2780
- }>]>;
2781
- type TriggerMetadata = z.infer<typeof TriggerMetadataSchema>;
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 */
2799
- declare const DisplayPropertySchema: z.ZodObject<{
2800
- /** The label for the property */
2801
- label: z.ZodString;
2802
- /** The value of the property */
2803
- text: z.ZodString;
2804
- /** The URL to link to when the property is clicked */
2805
- url: z.ZodOptional<z.ZodString>;
2806
- }, "strip", z.ZodTypeAny, {
2807
- url?: string | undefined;
2808
- label: string;
2809
- text: string;
2810
- }, {
2811
- url?: string | undefined;
2812
- label: string;
2813
- text: string;
2814
- }>;
2815
- type DisplayProperty = z.infer<typeof DisplayPropertySchema>;
2816
-
2817
- declare const ConnectionAuthSchema: z.ZodObject<{
2818
- type: z.ZodEnum<["oauth2"]>;
2819
- accessToken: z.ZodString;
2820
- scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2821
- additionalFields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2822
- }, "strip", z.ZodTypeAny, {
2823
- scopes?: string[] | undefined;
2824
- additionalFields?: Record<string, string> | undefined;
2825
- type: "oauth2";
2826
- accessToken: string;
2827
- }, {
2828
- scopes?: string[] | undefined;
2829
- additionalFields?: Record<string, string> | undefined;
2830
- type: "oauth2";
2831
- accessToken: string;
2832
- }>;
2833
- type ConnectionAuth = z.infer<typeof ConnectionAuthSchema>;
2834
- declare const IntegrationMetadataSchema: z.ZodObject<{
2835
- id: z.ZodString;
2836
- name: z.ZodString;
2837
- instructions: z.ZodOptional<z.ZodString>;
2838
- }, "strip", z.ZodTypeAny, {
2839
- instructions?: string | undefined;
2840
- id: string;
2841
- name: string;
2842
- }, {
2843
- instructions?: string | undefined;
2844
- id: string;
2845
- name: string;
2846
- }>;
2847
- type IntegrationMetadata = z.infer<typeof IntegrationMetadataSchema>;
2848
- declare const IntegrationConfigSchema: z.ZodObject<{
2849
- id: z.ZodString;
2850
- metadata: z.ZodObject<{
2851
- id: z.ZodString;
2852
- name: z.ZodString;
2853
- instructions: z.ZodOptional<z.ZodString>;
2854
- }, "strip", z.ZodTypeAny, {
2855
- instructions?: string | undefined;
2856
- id: string;
2857
- name: string;
2858
- }, {
2859
- instructions?: string | undefined;
2860
- id: string;
2861
- name: string;
2862
- }>;
2863
- authSource: z.ZodEnum<["HOSTED", "LOCAL"]>;
2864
- }, "strip", z.ZodTypeAny, {
2865
- id: string;
2866
- metadata: {
2867
- instructions?: string | undefined;
2868
- id: string;
2869
- name: string;
2870
- };
2871
- authSource: "HOSTED" | "LOCAL";
2872
- }, {
2873
- id: string;
2874
- metadata: {
2875
- instructions?: string | undefined;
2876
- id: string;
2877
- name: string;
2878
- };
2879
- authSource: "HOSTED" | "LOCAL";
2880
- }>;
2881
- type IntegrationConfig = z.infer<typeof IntegrationConfigSchema>;
2882
-
2883
- declare const ScheduledPayloadSchema: z.ZodObject<{
2884
- ts: z.ZodDate;
2885
- lastTimestamp: z.ZodOptional<z.ZodDate>;
2886
- }, "strip", z.ZodTypeAny, {
2887
- lastTimestamp?: Date | undefined;
2888
- ts: Date;
2889
- }, {
2890
- lastTimestamp?: Date | undefined;
2891
- ts: Date;
2892
- }>;
2893
- type ScheduledPayload = z.infer<typeof ScheduledPayloadSchema>;
2894
- declare const IntervalOptionsSchema: z.ZodObject<{
2895
- /** The number of seconds for the interval. Min = 60, Max = 86400 (1 day) */
2896
- seconds: z.ZodNumber;
2897
- }, "strip", z.ZodTypeAny, {
2898
- seconds: number;
2899
- }, {
2900
- seconds: number;
2901
- }>;
2902
- /** Interval options */
2903
- type IntervalOptions = z.infer<typeof IntervalOptionsSchema>;
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. */
2908
- cron: z.ZodString;
2909
- }, "strip", z.ZodTypeAny, {
2910
- cron: string;
2911
- }, {
2912
- cron: string;
2913
- }>;
2914
- type CronOptions = z.infer<typeof CronOptionsSchema>;
2915
- declare const ScheduleMetadataSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2916
- /** An interval reoccurs at the specified number of seconds */
2917
- type: z.ZodLiteral<"interval">;
2918
- /** An object containing options about the interval. */
2919
- options: z.ZodObject<{
2920
- /** The number of seconds for the interval. Min = 60, Max = 86400 (1 day) */
2921
- seconds: z.ZodNumber;
2922
- }, "strip", z.ZodTypeAny, {
2923
- seconds: number;
2924
- }, {
2925
- seconds: number;
2926
- }>;
2927
- /** Any additional metadata about the schedule. */
2928
- metadata: z.ZodAny;
2929
- }, "strip", z.ZodTypeAny, {
2930
- metadata?: any;
2931
- options: {
2932
- seconds: number;
2933
- };
2934
- type: "interval";
2935
- }, {
2936
- metadata?: any;
2937
- options: {
2938
- seconds: number;
2939
- };
2940
- type: "interval";
2941
- }>, z.ZodObject<{
2942
- type: z.ZodLiteral<"cron">;
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. */
2947
- cron: z.ZodString;
2948
- }, "strip", z.ZodTypeAny, {
2949
- cron: string;
2950
- }, {
2951
- cron: string;
2952
- }>;
2953
- metadata: z.ZodAny;
2954
- }, "strip", z.ZodTypeAny, {
2955
- metadata?: any;
2956
- options: {
2957
- cron: string;
2958
- };
2959
- type: "cron";
2960
- }, {
2961
- metadata?: any;
2962
- options: {
2963
- cron: string;
2964
- };
2965
- type: "cron";
2966
- }>]>;
2967
- type ScheduleMetadata = z.infer<typeof ScheduleMetadataSchema>;
2968
-
2969
- declare const MissingConnectionNotificationPayloadSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<z.extendShape<{
2970
- id: z.ZodString;
2971
- client: z.ZodObject<{
2972
- id: z.ZodString;
2973
- title: z.ZodString;
2974
- scopes: z.ZodArray<z.ZodString, "many">;
2975
- createdAt: z.ZodDate;
2976
- updatedAt: z.ZodDate;
2977
- }, "strip", z.ZodTypeAny, {
2978
- id: string;
2979
- scopes: string[];
2980
- title: string;
2981
- createdAt: Date;
2982
- updatedAt: Date;
2983
- }, {
2984
- id: string;
2985
- scopes: string[];
2986
- title: string;
2987
- createdAt: Date;
2988
- updatedAt: Date;
2989
- }>;
2990
- authorizationUrl: z.ZodString;
2991
- }, {
2992
- type: z.ZodLiteral<"DEVELOPER">;
2993
- }>, "strip", z.ZodTypeAny, {
2994
- id: string;
2995
- type: "DEVELOPER";
2996
- client: {
2997
- id: string;
2998
- scopes: string[];
2999
- title: string;
3000
- createdAt: Date;
3001
- updatedAt: Date;
3002
- };
3003
- authorizationUrl: string;
3004
- }, {
3005
- id: string;
3006
- type: "DEVELOPER";
3007
- client: {
3008
- id: string;
3009
- scopes: string[];
3010
- title: string;
3011
- createdAt: Date;
3012
- updatedAt: Date;
3013
- };
3014
- authorizationUrl: string;
3015
- }>, z.ZodObject<z.extendShape<{
3016
- id: z.ZodString;
3017
- client: z.ZodObject<{
3018
- id: z.ZodString;
3019
- title: z.ZodString;
3020
- scopes: z.ZodArray<z.ZodString, "many">;
3021
- createdAt: z.ZodDate;
3022
- updatedAt: z.ZodDate;
3023
- }, "strip", z.ZodTypeAny, {
3024
- id: string;
3025
- scopes: string[];
3026
- title: string;
3027
- createdAt: Date;
3028
- updatedAt: Date;
3029
- }, {
3030
- id: string;
3031
- scopes: string[];
3032
- title: string;
3033
- createdAt: Date;
3034
- updatedAt: Date;
3035
- }>;
3036
- authorizationUrl: z.ZodString;
3037
- }, {
3038
- type: z.ZodLiteral<"EXTERNAL">;
3039
- account: z.ZodObject<{
3040
- id: z.ZodString;
3041
- metadata: z.ZodAny;
3042
- }, "strip", z.ZodTypeAny, {
3043
- metadata?: any;
3044
- id: string;
3045
- }, {
3046
- metadata?: any;
3047
- id: string;
3048
- }>;
3049
- }>, "strip", z.ZodTypeAny, {
3050
- id: string;
3051
- type: "EXTERNAL";
3052
- account: {
3053
- metadata?: any;
3054
- id: string;
3055
- };
3056
- client: {
3057
- id: string;
3058
- scopes: string[];
3059
- title: string;
3060
- createdAt: Date;
3061
- updatedAt: Date;
3062
- };
3063
- authorizationUrl: string;
3064
- }, {
3065
- id: string;
3066
- type: "EXTERNAL";
3067
- account: {
3068
- metadata?: any;
3069
- id: string;
3070
- };
3071
- client: {
3072
- id: string;
3073
- scopes: string[];
3074
- title: string;
3075
- createdAt: Date;
3076
- updatedAt: Date;
3077
- };
3078
- authorizationUrl: string;
3079
- }>]>;
3080
- type MissingConnectionNotificationPayload = z.infer<typeof MissingConnectionNotificationPayloadSchema>;
3081
- declare const MissingConnectionResolvedNotificationPayloadSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<z.extendShape<{
3082
- id: z.ZodString;
3083
- client: z.ZodObject<{
3084
- id: z.ZodString;
3085
- title: z.ZodString;
3086
- scopes: z.ZodArray<z.ZodString, "many">;
3087
- createdAt: z.ZodDate;
3088
- updatedAt: z.ZodDate;
3089
- integrationIdentifier: z.ZodString;
3090
- integrationAuthMethod: z.ZodString;
3091
- }, "strip", z.ZodTypeAny, {
3092
- id: string;
3093
- scopes: string[];
3094
- title: string;
3095
- createdAt: Date;
3096
- updatedAt: Date;
3097
- integrationIdentifier: string;
3098
- integrationAuthMethod: string;
3099
- }, {
3100
- id: string;
3101
- scopes: string[];
3102
- title: string;
3103
- createdAt: Date;
3104
- updatedAt: Date;
3105
- integrationIdentifier: string;
3106
- integrationAuthMethod: string;
3107
- }>;
3108
- expiresAt: z.ZodDate;
3109
- }, {
3110
- type: z.ZodLiteral<"DEVELOPER">;
3111
- }>, "strip", z.ZodTypeAny, {
3112
- id: string;
3113
- type: "DEVELOPER";
3114
- client: {
3115
- id: string;
3116
- scopes: string[];
3117
- title: string;
3118
- createdAt: Date;
3119
- updatedAt: Date;
3120
- integrationIdentifier: string;
3121
- integrationAuthMethod: string;
3122
- };
3123
- expiresAt: Date;
3124
- }, {
3125
- id: string;
3126
- type: "DEVELOPER";
3127
- client: {
3128
- id: string;
3129
- scopes: string[];
3130
- title: string;
3131
- createdAt: Date;
3132
- updatedAt: Date;
3133
- integrationIdentifier: string;
3134
- integrationAuthMethod: string;
3135
- };
3136
- expiresAt: Date;
3137
- }>, z.ZodObject<z.extendShape<{
3138
- id: z.ZodString;
3139
- client: z.ZodObject<{
3140
- id: z.ZodString;
3141
- title: z.ZodString;
3142
- scopes: z.ZodArray<z.ZodString, "many">;
3143
- createdAt: z.ZodDate;
3144
- updatedAt: z.ZodDate;
3145
- integrationIdentifier: z.ZodString;
3146
- integrationAuthMethod: z.ZodString;
3147
- }, "strip", z.ZodTypeAny, {
3148
- id: string;
3149
- scopes: string[];
3150
- title: string;
3151
- createdAt: Date;
3152
- updatedAt: Date;
3153
- integrationIdentifier: string;
3154
- integrationAuthMethod: string;
3155
- }, {
3156
- id: string;
3157
- scopes: string[];
3158
- title: string;
3159
- createdAt: Date;
3160
- updatedAt: Date;
3161
- integrationIdentifier: string;
3162
- integrationAuthMethod: string;
3163
- }>;
3164
- expiresAt: z.ZodDate;
3165
- }, {
3166
- type: z.ZodLiteral<"EXTERNAL">;
3167
- account: z.ZodObject<{
3168
- id: z.ZodString;
3169
- metadata: z.ZodAny;
3170
- }, "strip", z.ZodTypeAny, {
3171
- metadata?: any;
3172
- id: string;
3173
- }, {
3174
- metadata?: any;
3175
- id: string;
3176
- }>;
3177
- }>, "strip", z.ZodTypeAny, {
3178
- id: string;
3179
- type: "EXTERNAL";
3180
- account: {
3181
- metadata?: any;
3182
- id: string;
3183
- };
3184
- client: {
3185
- id: string;
3186
- scopes: string[];
3187
- title: string;
3188
- createdAt: Date;
3189
- updatedAt: Date;
3190
- integrationIdentifier: string;
3191
- integrationAuthMethod: string;
3192
- };
3193
- expiresAt: Date;
3194
- }, {
3195
- id: string;
3196
- type: "EXTERNAL";
3197
- account: {
3198
- metadata?: any;
3199
- id: string;
3200
- };
3201
- client: {
3202
- id: string;
3203
- scopes: string[];
3204
- title: string;
3205
- createdAt: Date;
3206
- updatedAt: Date;
3207
- integrationIdentifier: string;
3208
- integrationAuthMethod: string;
3209
- };
3210
- expiresAt: Date;
3211
- }>]>;
3212
- type MissingConnectionResolvedNotificationPayload = z.infer<typeof MissingConnectionResolvedNotificationPayloadSchema>;
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
-
3307
7
  type ApiClientOptions = {
3308
8
  apiKey?: string;
3309
9
  apiUrl?: string;
@@ -3331,124 +31,183 @@ declare class ApiClient {
3331
31
  ok: false;
3332
32
  }>;
3333
33
  runTask(runId: string, task: RunTaskBodyInput): Promise<{
34
+ id: string;
35
+ name: string;
36
+ noop: boolean;
37
+ status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED" | "CANCELED";
38
+ idempotencyKey: string;
39
+ attempts: number;
3334
40
  icon?: string | null | undefined;
3335
41
  startedAt?: Date | null | undefined;
3336
42
  completedAt?: Date | null | undefined;
3337
43
  delayUntil?: Date | null | undefined;
3338
44
  description?: string | null | undefined;
3339
- params?: DeserializedJson | undefined;
45
+ params?: _trigger_dev_core.DeserializedJson | undefined;
3340
46
  properties?: {
47
+ label: string;
48
+ text: string;
3341
49
  url?: string | undefined;
50
+ }[] | null | undefined;
51
+ outputProperties?: {
3342
52
  label: string;
3343
53
  text: string;
54
+ url?: string | undefined;
3344
55
  }[] | null | undefined;
3345
- output?: DeserializedJson | undefined;
56
+ output?: _trigger_dev_core.DeserializedJson | undefined;
3346
57
  error?: string | null | undefined;
3347
58
  parentId?: string | null | undefined;
3348
59
  style?: {
3349
- variant?: string | undefined;
3350
60
  style: "normal" | "minimal";
61
+ variant?: string | undefined;
3351
62
  } | null | undefined;
3352
63
  operation?: string | null | undefined;
64
+ }>;
65
+ completeTask(runId: string, id: string, task: CompleteTaskBodyInput): Promise<{
3353
66
  id: string;
3354
67
  name: string;
3355
68
  noop: boolean;
3356
- status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED";
69
+ status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED" | "CANCELED";
3357
70
  idempotencyKey: string;
3358
71
  attempts: number;
3359
- }>;
3360
- completeTask(runId: string, id: string, task: CompleteTaskBodyInput): Promise<{
3361
72
  icon?: string | null | undefined;
3362
73
  startedAt?: Date | null | undefined;
3363
74
  completedAt?: Date | null | undefined;
3364
75
  delayUntil?: Date | null | undefined;
3365
76
  description?: string | null | undefined;
3366
- params?: DeserializedJson | undefined;
77
+ params?: _trigger_dev_core.DeserializedJson | undefined;
3367
78
  properties?: {
79
+ label: string;
80
+ text: string;
3368
81
  url?: string | undefined;
82
+ }[] | null | undefined;
83
+ outputProperties?: {
3369
84
  label: string;
3370
85
  text: string;
86
+ url?: string | undefined;
3371
87
  }[] | null | undefined;
3372
- output?: DeserializedJson | undefined;
88
+ output?: _trigger_dev_core.DeserializedJson | undefined;
3373
89
  error?: string | null | undefined;
3374
90
  parentId?: string | null | undefined;
3375
91
  style?: {
3376
- variant?: string | undefined;
3377
92
  style: "normal" | "minimal";
93
+ variant?: string | undefined;
3378
94
  } | null | undefined;
3379
95
  operation?: string | null | undefined;
96
+ }>;
97
+ failTask(runId: string, id: string, body: FailTaskBodyInput): Promise<{
3380
98
  id: string;
3381
99
  name: string;
3382
100
  noop: boolean;
3383
- status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED";
101
+ status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED" | "CANCELED";
3384
102
  idempotencyKey: string;
3385
103
  attempts: number;
3386
- }>;
3387
- failTask(runId: string, id: string, body: FailTaskBodyInput): Promise<{
3388
104
  icon?: string | null | undefined;
3389
105
  startedAt?: Date | null | undefined;
3390
106
  completedAt?: Date | null | undefined;
3391
107
  delayUntil?: Date | null | undefined;
3392
108
  description?: string | null | undefined;
3393
- params?: DeserializedJson | undefined;
109
+ params?: _trigger_dev_core.DeserializedJson | undefined;
3394
110
  properties?: {
111
+ label: string;
112
+ text: string;
3395
113
  url?: string | undefined;
114
+ }[] | null | undefined;
115
+ outputProperties?: {
3396
116
  label: string;
3397
117
  text: string;
118
+ url?: string | undefined;
3398
119
  }[] | null | undefined;
3399
- output?: DeserializedJson | undefined;
120
+ output?: _trigger_dev_core.DeserializedJson | undefined;
3400
121
  error?: string | null | undefined;
3401
122
  parentId?: string | null | undefined;
3402
123
  style?: {
3403
- variant?: string | undefined;
3404
124
  style: "normal" | "minimal";
125
+ variant?: string | undefined;
3405
126
  } | null | undefined;
3406
127
  operation?: string | null | undefined;
3407
- id: string;
3408
- name: string;
3409
- noop: boolean;
3410
- status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED";
3411
- idempotencyKey: string;
3412
- attempts: number;
3413
128
  }>;
3414
129
  sendEvent(event: SendEvent, options?: SendEventOptions): Promise<{
3415
- context?: DeserializedJson | undefined;
3416
- deliverAt?: Date | null | undefined;
3417
- deliveredAt?: Date | null | undefined;
3418
130
  id: string;
3419
131
  name: string;
3420
- payload: DeserializedJson;
132
+ payload: ((string | number | boolean | {
133
+ [key: string]: _trigger_dev_core.DeserializedJson;
134
+ } | _trigger_dev_core.DeserializedJson[]) & (string | number | boolean | {
135
+ [key: string]: _trigger_dev_core.DeserializedJson;
136
+ } | _trigger_dev_core.DeserializedJson[] | undefined)) | null;
3421
137
  timestamp: Date;
138
+ context?: _trigger_dev_core.DeserializedJson | undefined;
139
+ deliverAt?: Date | null | undefined;
140
+ deliveredAt?: Date | null | undefined;
3422
141
  }>;
3423
142
  updateSource(client: string, key: string, source: UpdateTriggerSourceBody): Promise<TriggerSource>;
3424
143
  registerTrigger(client: string, id: string, key: string, payload: RegisterTriggerBody): Promise<RegisterSourceEvent>;
3425
144
  registerSchedule(client: string, id: string, key: string, payload: ScheduleMetadata): Promise<{
3426
- metadata?: any;
3427
145
  id: string;
3428
146
  schedule: {
3429
- metadata?: any;
3430
147
  options: {
3431
148
  cron: string;
3432
149
  };
3433
150
  type: "cron";
3434
- } | {
3435
151
  metadata?: any;
152
+ } | {
3436
153
  options: {
3437
154
  seconds: number;
3438
155
  };
3439
156
  type: "interval";
157
+ metadata?: any;
3440
158
  };
3441
159
  active: boolean;
160
+ metadata?: any;
3442
161
  }>;
3443
162
  unregisterSchedule(client: string, id: string, key: string): Promise<{
3444
163
  ok: boolean;
3445
164
  }>;
3446
165
  getAuth(client: string, id: string): Promise<{
3447
- scopes?: string[] | undefined;
3448
- additionalFields?: Record<string, string> | undefined;
3449
166
  type: "oauth2";
3450
167
  accessToken: string;
168
+ scopes?: string[] | undefined;
169
+ additionalFields?: Record<string, string> | undefined;
3451
170
  } | undefined>;
171
+ getEvent(eventId: string): Promise<{
172
+ id: string;
173
+ name: string;
174
+ createdAt: Date;
175
+ updatedAt: Date;
176
+ runs: {
177
+ id: string;
178
+ status: "PENDING" | "CANCELED" | "SUCCESS" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "FAILURE" | "TIMED_OUT" | "ABORTED";
179
+ startedAt?: Date | null | undefined;
180
+ completedAt?: Date | null | undefined;
181
+ }[];
182
+ }>;
183
+ getRun(runId: string, options?: GetRunOptionsWithTaskDetails): Promise<{
184
+ id: string;
185
+ startedAt: Date | null;
186
+ completedAt: Date | null;
187
+ status: "PENDING" | "CANCELED" | "SUCCESS" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "FAILURE" | "TIMED_OUT" | "ABORTED";
188
+ tasks: {
189
+ id: string;
190
+ name: string;
191
+ icon: string | null;
192
+ startedAt: Date | null;
193
+ completedAt: Date | null;
194
+ status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED" | "CANCELED";
195
+ displayKey: string | null;
196
+ }[];
197
+ updatedAt: Date | null;
198
+ output?: any;
199
+ nextCursor?: string | undefined;
200
+ }>;
201
+ getRuns(jobSlug: string, options?: GetRunsOptions): Promise<{
202
+ runs: {
203
+ id: string;
204
+ startedAt: Date | null;
205
+ completedAt: Date | null;
206
+ status: "PENDING" | "CANCELED" | "SUCCESS" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "FAILURE" | "TIMED_OUT" | "ABORTED";
207
+ updatedAt: Date | null;
208
+ }[];
209
+ nextCursor?: string | undefined;
210
+ }>;
3452
211
  }
3453
212
 
3454
213
  interface TriggerContext {
@@ -3474,6 +233,7 @@ interface TriggerContext {
3474
233
  id: string;
3475
234
  isTest: boolean;
3476
235
  startedAt: Date;
236
+ isRetry: boolean;
3477
237
  };
3478
238
  /** Event metadata */
3479
239
  event: {
@@ -3540,6 +300,7 @@ interface Trigger<TEventSpec extends EventSpecification<any>> {
3540
300
  attachToJob(triggerClient: TriggerClient, job: Job<Trigger<TEventSpec>, any>): void;
3541
301
  preprocessRuns: boolean;
3542
302
  }
303
+ type TriggerPayload<TTrigger> = TTrigger extends Trigger<EventSpecification<infer TEvent>> ? TEvent : never;
3543
304
  type EventSpecificationExample = {
3544
305
  id: string;
3545
306
  name: string;
@@ -3547,7 +308,7 @@ type EventSpecificationExample = {
3547
308
  payload: any;
3548
309
  };
3549
310
  interface EventSpecification<TEvent extends any> {
3550
- name: string;
311
+ name: string | string[];
3551
312
  title: string;
3552
313
  source: string;
3553
314
  icon: string;
@@ -3624,7 +385,7 @@ type ExternalSourceOptions<TChannel extends ChannelNames, TIntegration extends T
3624
385
  schema: z.Schema<TParams>;
3625
386
  integration: TIntegration;
3626
387
  register: RegisterFunction<TIntegration, TParams, TChannel>;
3627
- filter: FilterFunction<TParams>;
388
+ filter?: FilterFunction<TParams>;
3628
389
  handler: HandlerFunction<TChannel, TParams>;
3629
390
  key: KeyFunction<TParams>;
3630
391
  properties?: (params: TParams) => DisplayProperty[];
@@ -3635,40 +396,42 @@ declare class ExternalSource<TIntegration extends TriggerIntegration<Integration
3635
396
  constructor(channel: TChannel, options: ExternalSourceOptions<TChannel, TIntegration, TParams>);
3636
397
  handle(source: HandleTriggerSource, rawEvent: ExternalSourceChannelMap[TChannel]["event"], logger: Logger): Promise<void | {
3637
398
  events: {
3638
- id?: string | undefined;
3639
- source?: string | undefined;
399
+ name: string;
3640
400
  payload?: any;
3641
401
  context?: any;
402
+ id?: string | undefined;
3642
403
  timestamp?: Date | undefined;
3643
- name: string;
404
+ source?: string | undefined;
3644
405
  }[];
3645
406
  response?: {
3646
- headers?: Record<string, string> | undefined;
3647
- body?: any;
3648
407
  status: number;
408
+ body?: any;
409
+ headers?: Record<string, string> | undefined;
3649
410
  } | undefined;
3650
411
  }>;
3651
412
  filter(params: TParams): EventFilter;
3652
413
  properties(params: TParams): DisplayProperty[];
3653
414
  register(params: TParams, registerEvent: RegisterSourceEvent, io: IO, ctx: TriggerContext): Promise<{
3654
- data?: SerializableJson;
3655
- secret?: string | undefined;
3656
415
  registeredEvents: string[];
416
+ secret?: string | undefined;
417
+ data?: _trigger_dev_core.SerializableJson;
3657
418
  } | undefined>;
3658
419
  key(params: TParams): string;
3659
420
  get integration(): TIntegration;
3660
421
  get integrationConfig(): {
3661
422
  id: string;
3662
423
  metadata: {
3663
- instructions?: string | undefined;
3664
424
  id: string;
3665
425
  name: string;
426
+ instructions?: string | undefined;
3666
427
  };
3667
428
  };
3668
429
  get id(): string;
3669
430
  get version(): string;
3670
431
  }
3671
- type ExternalSourceParams<TExternalSource extends ExternalSource<any, any, any>> = TExternalSource extends ExternalSource<any, infer TParams, any> ? TParams : never;
432
+ type ExternalSourceParams<TExternalSource extends ExternalSource<any, any, any>> = TExternalSource extends ExternalSource<any, infer TParams, any> ? TParams & {
433
+ filter?: EventFilter;
434
+ } : never;
3672
435
  type ExternalSourceTriggerOptions<TEventSpecification extends EventSpecification<any>, TEventSource extends ExternalSource<any, any, any>> = {
3673
436
  event: TEventSpecification;
3674
437
  source: TEventSource;
@@ -3687,19 +450,43 @@ declare function omit<T extends Record<string, unknown>, K extends keyof T>(obj:
3687
450
  ommited: T[K];
3688
451
  };
3689
452
 
453
+ /** Options for a DynamicTrigger */
3690
454
  type DynamicTriggerOptions<TEventSpec extends EventSpecification<any>, TExternalSource extends ExternalSource<any, any, any>> = {
455
+ /** Used to uniquely identify a DynamicTrigger */
3691
456
  id: string;
457
+ /** An event from an [Integration](https://trigger.dev/docs/integrations) package that you want to attach to the DynamicTrigger. The event types will come through to the payload in your Job's run. */
3692
458
  event: TEventSpec;
459
+ /** An external source fron an [Integration](https://trigger.dev/docs/integrations) package
460
+ * @example
461
+ * ```ts
462
+ * import { events } from "@trigger.dev/github";
463
+ *
464
+ * const dynamicOnIssueOpened = new DynamicTrigger(client, {
465
+ id: "github-issue-opened",
466
+ event: events.onIssueOpened,
467
+ source: github.sources.repo,
468
+ });
469
+ * ```
470
+ */
3693
471
  source: TExternalSource;
3694
472
  };
473
+ /** `DynamicTrigger` allows you to define a trigger that can be configured dynamically at runtime. */
3695
474
  declare class DynamicTrigger<TEventSpec extends EventSpecification<any>, TExternalSource extends ExternalSource<any, any, any>> implements Trigger<TEventSpec> {
3696
475
  #private;
3697
476
  source: TExternalSource;
477
+ /** `DynamicTrigger` allows you to define a trigger that can be configured dynamically at runtime.
478
+ * @param client The `TriggerClient` instance to use for registering the trigger.
479
+ * @param options The options for the dynamic trigger.
480
+ * */
3698
481
  constructor(client: TriggerClient, options: DynamicTriggerOptions<TEventSpec, TExternalSource>);
3699
482
  toJSON(): TriggerMetadata;
3700
483
  get id(): string;
3701
484
  get event(): TEventSpec;
3702
485
  registeredTriggerForParams(params: ExternalSourceParams<TExternalSource>): RegisterTriggerBody;
486
+ /** Use this method to register a new configuration with the DynamicTrigger.
487
+ * @param key The key for the configuration. This will be used to identify the configuration when it is triggered.
488
+ * @param params The params for the configuration.
489
+ */
3703
490
  register(key: string, params: ExternalSourceParams<TExternalSource>): Promise<RegisterSourceEvent>;
3704
491
  attachToJob(triggerClient: TriggerClient, job: Job<Trigger<TEventSpec>, any>): void;
3705
492
  get preprocessRuns(): boolean;
@@ -3741,12 +528,8 @@ declare class TriggerClient {
3741
528
  }): void;
3742
529
  attachDynamicSchedule(key: string, job: Job<Trigger<any>, any>): void;
3743
530
  registerTrigger(id: string, key: string, options: RegisterTriggerBody): Promise<{
3744
- dynamicTriggerId?: string | undefined;
3745
531
  id: string;
3746
532
  source: {
3747
- params?: any;
3748
- data?: DeserializedJson | undefined;
3749
- clientId?: string | undefined;
3750
533
  key: string;
3751
534
  secret: string;
3752
535
  active: boolean;
@@ -3758,16 +541,20 @@ declare class TriggerClient {
3758
541
  } | {
3759
542
  type: "SQS";
3760
543
  };
544
+ params?: any;
545
+ data?: _trigger_dev_core.DeserializedJson | undefined;
546
+ clientId?: string | undefined;
3761
547
  };
3762
548
  events: string[];
3763
549
  missingEvents: string[];
3764
550
  orphanedEvents: string[];
551
+ dynamicTriggerId?: string | undefined;
3765
552
  }>;
3766
553
  getAuth(id: string): Promise<{
3767
- scopes?: string[] | undefined;
3768
- additionalFields?: Record<string, string> | undefined;
3769
554
  type: "oauth2";
3770
555
  accessToken: string;
556
+ scopes?: string[] | undefined;
557
+ additionalFields?: Record<string, string> | undefined;
3771
558
  } | undefined>;
3772
559
  /** 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
560
  * @param event The event to send.
@@ -3775,37 +562,82 @@ declare class TriggerClient {
3775
562
  * @returns A promise that resolves to the event details
3776
563
  */
3777
564
  sendEvent(event: SendEvent, options?: SendEventOptions): Promise<{
3778
- context?: DeserializedJson | undefined;
3779
- deliverAt?: Date | null | undefined;
3780
- deliveredAt?: Date | null | undefined;
3781
565
  id: string;
3782
566
  name: string;
3783
- payload: DeserializedJson;
567
+ payload: ((string | number | boolean | {
568
+ [key: string]: _trigger_dev_core.DeserializedJson;
569
+ } | _trigger_dev_core.DeserializedJson[]) & (string | number | boolean | {
570
+ [key: string]: _trigger_dev_core.DeserializedJson;
571
+ } | _trigger_dev_core.DeserializedJson[] | undefined)) | null;
3784
572
  timestamp: Date;
573
+ context?: _trigger_dev_core.DeserializedJson | undefined;
574
+ deliverAt?: Date | null | undefined;
575
+ deliveredAt?: Date | null | undefined;
3785
576
  }>;
3786
577
  registerSchedule(id: string, key: string, schedule: ScheduleMetadata): Promise<{
3787
- metadata?: any;
3788
578
  id: string;
3789
579
  schedule: {
3790
- metadata?: any;
3791
580
  options: {
3792
581
  cron: string;
3793
582
  };
3794
583
  type: "cron";
3795
- } | {
3796
584
  metadata?: any;
585
+ } | {
3797
586
  options: {
3798
587
  seconds: number;
3799
588
  };
3800
589
  type: "interval";
590
+ metadata?: any;
3801
591
  };
3802
592
  active: boolean;
593
+ metadata?: any;
3803
594
  }>;
3804
595
  unregisterSchedule(id: string, key: string): Promise<{
3805
596
  ok: boolean;
3806
597
  }>;
598
+ getEvent(eventId: string): Promise<{
599
+ id: string;
600
+ name: string;
601
+ createdAt: Date;
602
+ updatedAt: Date;
603
+ runs: {
604
+ id: string;
605
+ status: "PENDING" | "CANCELED" | "SUCCESS" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "FAILURE" | "TIMED_OUT" | "ABORTED";
606
+ startedAt?: Date | null | undefined;
607
+ completedAt?: Date | null | undefined;
608
+ }[];
609
+ }>;
610
+ getRun(runId: string, options?: GetRunOptionsWithTaskDetails): Promise<{
611
+ id: string;
612
+ startedAt: Date | null;
613
+ completedAt: Date | null;
614
+ status: "PENDING" | "CANCELED" | "SUCCESS" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "FAILURE" | "TIMED_OUT" | "ABORTED";
615
+ tasks: {
616
+ id: string;
617
+ name: string;
618
+ icon: string | null;
619
+ startedAt: Date | null;
620
+ completedAt: Date | null;
621
+ status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED" | "CANCELED";
622
+ displayKey: string | null;
623
+ }[];
624
+ updatedAt: Date | null;
625
+ output?: any;
626
+ nextCursor?: string | undefined;
627
+ }>;
628
+ getRuns(jobSlug: string, options?: GetRunsOptions): Promise<{
629
+ runs: {
630
+ id: string;
631
+ startedAt: Date | null;
632
+ completedAt: Date | null;
633
+ status: "PENDING" | "CANCELED" | "SUCCESS" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "FAILURE" | "TIMED_OUT" | "ABORTED";
634
+ updatedAt: Date | null;
635
+ }[];
636
+ nextCursor?: string | undefined;
637
+ }>;
3807
638
  authorized(apiKey?: string | null): "authorized" | "unauthorized" | "missing-client" | "missing-header";
3808
639
  apiKey(): string | undefined;
640
+ defineJob<TTrigger extends Trigger<EventSpecification<any>>, TIntegrations extends Record<string, TriggerIntegration<IntegrationClient<any, any>>> = {}>(options: JobOptions<TTrigger, TIntegrations>): Job<TTrigger, TIntegrations>;
3809
641
  }
3810
642
 
3811
643
  type ScheduledEventSpecification = EventSpecification<ScheduledPayload>;
@@ -3827,8 +659,8 @@ declare class IntervalTrigger implements Trigger<ScheduledEventSpecification> {
3827
659
  };
3828
660
  }[];
3829
661
  parsePayload: (data: unknown, params?: Partial<zod.ParseParams> | undefined) => {
3830
- lastTimestamp?: Date | undefined;
3831
662
  ts: Date;
663
+ lastTimestamp?: Date | undefined;
3832
664
  };
3833
665
  properties: {
3834
666
  label: string;
@@ -3839,6 +671,9 @@ declare class IntervalTrigger implements Trigger<ScheduledEventSpecification> {
3839
671
  get preprocessRuns(): boolean;
3840
672
  toJSON(): TriggerMetadata;
3841
673
  }
674
+ /** `intervalTrigger()` is set as a [Job's trigger](/sdk/job) to trigger a Job at a recurring interval.
675
+ * @param options An object containing options about the interval.
676
+ */
3842
677
  declare function intervalTrigger(options: IntervalOptions): IntervalTrigger;
3843
678
  declare class CronTrigger implements Trigger<ScheduledEventSpecification> {
3844
679
  private options;
@@ -3858,8 +693,8 @@ declare class CronTrigger implements Trigger<ScheduledEventSpecification> {
3858
693
  };
3859
694
  }[];
3860
695
  parsePayload: (data: unknown, params?: Partial<zod.ParseParams> | undefined) => {
3861
- lastTimestamp?: Date | undefined;
3862
696
  ts: Date;
697
+ lastTimestamp?: Date | undefined;
3863
698
  };
3864
699
  properties: {
3865
700
  label: string;
@@ -3870,13 +705,24 @@ declare class CronTrigger implements Trigger<ScheduledEventSpecification> {
3870
705
  get preprocessRuns(): boolean;
3871
706
  toJSON(): TriggerMetadata;
3872
707
  }
708
+ /** `cronTrigger()` is set as a [Job's trigger](https://trigger.dev/docs/sdk/job) to trigger a Job on a recurring schedule using a CRON expression.
709
+ * @param options An object containing options about the CRON schedule.
710
+ */
3873
711
  declare function cronTrigger(options: CronOptions): CronTrigger;
712
+ /** DynamicSchedule options
713
+ * @param id Used to uniquely identify a DynamicSchedule
714
+ */
3874
715
  type DynamicIntervalOptions = {
3875
716
  id: string;
3876
717
  };
718
+ /** DynamicSchedule` allows you to define a scheduled trigger that can be configured dynamically at runtime. */
3877
719
  declare class DynamicSchedule implements Trigger<ScheduledEventSpecification> {
3878
720
  private client;
3879
721
  private options;
722
+ /**
723
+ * @param client The `TriggerClient` instance to use for registering the trigger.
724
+ * @param options The options for the schedule.
725
+ */
3880
726
  constructor(client: TriggerClient, options: DynamicIntervalOptions);
3881
727
  get id(): string;
3882
728
  get event(): {
@@ -3894,27 +740,27 @@ declare class DynamicSchedule implements Trigger<ScheduledEventSpecification> {
3894
740
  };
3895
741
  }[];
3896
742
  parsePayload: (data: unknown, params?: Partial<zod.ParseParams> | undefined) => {
3897
- lastTimestamp?: Date | undefined;
3898
743
  ts: Date;
744
+ lastTimestamp?: Date | undefined;
3899
745
  };
3900
746
  };
3901
747
  register(key: string, metadata: ScheduleMetadata): Promise<{
3902
- metadata?: any;
3903
748
  id: string;
3904
749
  schedule: {
3905
- metadata?: any;
3906
750
  options: {
3907
751
  cron: string;
3908
752
  };
3909
753
  type: "cron";
3910
- } | {
3911
754
  metadata?: any;
755
+ } | {
3912
756
  options: {
3913
757
  seconds: number;
3914
758
  };
3915
759
  type: "interval";
760
+ metadata?: any;
3916
761
  };
3917
762
  active: boolean;
763
+ metadata?: any;
3918
764
  }>;
3919
765
  unregister(key: string): Promise<{
3920
766
  ok: boolean;
@@ -3973,13 +819,17 @@ declare class IO {
3973
819
  * @param options Options for sending the event.
3974
820
  */
3975
821
  sendEvent(key: string | any[], event: SendEvent, options?: SendEventOptions): Promise<{
3976
- context?: DeserializedJson | undefined;
3977
- deliverAt?: Date | null | undefined;
3978
- deliveredAt?: Date | null | undefined;
3979
822
  id: string;
3980
823
  name: string;
3981
- payload: DeserializedJson;
824
+ payload: ((string | number | boolean | {
825
+ [key: string]: _trigger_dev_core.DeserializedJson;
826
+ } | _trigger_dev_core.DeserializedJson[]) & (string | number | boolean | {
827
+ [key: string]: _trigger_dev_core.DeserializedJson;
828
+ } | _trigger_dev_core.DeserializedJson[] | undefined)) | null;
3982
829
  timestamp: Date;
830
+ context?: _trigger_dev_core.DeserializedJson | undefined;
831
+ deliverAt?: Date | null | undefined;
832
+ deliveredAt?: Date | null | undefined;
3983
833
  }>;
3984
834
  updateSource(key: string | any[], options: {
3985
835
  key: string;
@@ -3995,22 +845,22 @@ declare class IO {
3995
845
  * @returns A promise that has information about the interval.
3996
846
  */
3997
847
  registerInterval(key: string | any[], dynamicSchedule: DynamicSchedule, id: string, options: IntervalOptions): Promise<{
3998
- metadata?: any;
3999
848
  id: string;
4000
849
  schedule: {
4001
- metadata?: any;
4002
850
  options: {
4003
851
  cron: string;
4004
852
  };
4005
853
  type: "cron";
4006
- } | {
4007
854
  metadata?: any;
855
+ } | {
4008
856
  options: {
4009
857
  seconds: number;
4010
858
  };
4011
859
  type: "interval";
860
+ metadata?: any;
4012
861
  };
4013
862
  active: boolean;
863
+ metadata?: any;
4014
864
  }>;
4015
865
  /** `io.unregisterInterval()` allows you to unregister a [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) that was previously registered with `io.registerInterval()`.
4016
866
  * @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
@@ -4027,22 +877,22 @@ declare class IO {
4027
877
  * @param options The options for the CRON schedule.
4028
878
  */
4029
879
  registerCron(key: string | any[], dynamicSchedule: DynamicSchedule, id: string, options: CronOptions): Promise<{
4030
- metadata?: any;
4031
880
  id: string;
4032
881
  schedule: {
4033
- metadata?: any;
4034
882
  options: {
4035
883
  cron: string;
4036
884
  };
4037
885
  type: "cron";
4038
- } | {
4039
886
  metadata?: any;
887
+ } | {
4040
888
  options: {
4041
889
  seconds: number;
4042
890
  };
4043
891
  type: "interval";
892
+ metadata?: any;
4044
893
  };
4045
894
  active: boolean;
895
+ metadata?: any;
4046
896
  }>;
4047
897
  /** `io.unregisterCron()` allows you to unregister a [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) that was previously registered with `io.registerCron()`.
4048
898
  * @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
@@ -4075,7 +925,7 @@ declare class IO {
4075
925
  retryAt: Date;
4076
926
  error?: Error;
4077
927
  jitter?: number;
4078
- } | undefined | void): Promise<TResult>;
928
+ } | Error | undefined | void): Promise<TResult>;
4079
929
  /** `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
930
  * 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
931
  * @param tryCallback The code you wish to run
@@ -4100,6 +950,7 @@ declare class IOLogger implements TaskLogger {
4100
950
  error(message: string, properties?: Record<string, any>): Promise<void>;
4101
951
  }
4102
952
 
953
+ type IntegrationRunTaskFunction<TClient> = <TResult>(key: string | any[], callback: (client: TClient, task: IOTask, io: IO) => Promise<TResult>, options?: RunTaskOptions) => Promise<TResult>;
4103
954
  type ClientFactory<TClient> = (auth: ConnectionAuth) => TClient;
4104
955
  interface TriggerIntegration<TIntegrationClient extends IntegrationClient<any, any> = IntegrationClient<any, any>> {
4105
956
  client: TIntegrationClient;
@@ -4122,7 +973,7 @@ type AuthenticatedTask<TClient, TParams, TResult, TAuth = ConnectionAuth> = {
4122
973
  onError?: (error: unknown, task: ServerTask) => {
4123
974
  retryAt: Date;
4124
975
  error?: Error;
4125
- } | undefined | void;
976
+ } | Error | undefined | void;
4126
977
  };
4127
978
  declare function authenticatedTask<TClient, TParams, TResult>(options: {
4128
979
  run: (params: TParams, client: TClient, task: ServerTask, io: IO) => Promise<TResult>;
@@ -4137,13 +988,16 @@ type ExtractIntegrationClientClient<TIntegrationClient extends IntegrationClient
4137
988
  client: infer TClient;
4138
989
  } ? {
4139
990
  client: TClient;
991
+ runTask: IntegrationRunTaskFunction<TClient>;
4140
992
  } : TIntegrationClient extends {
4141
993
  usesLocalAuth: false;
4142
994
  clientFactory: ClientFactory<infer TClient>;
4143
995
  } ? {
4144
996
  client: TClient;
997
+ runTask: IntegrationRunTaskFunction<TClient>;
4145
998
  } : never;
4146
999
  type ExtractIntegrationClient<TIntegrationClient extends IntegrationClient<any, any>> = ExtractIntegrationClientClient<TIntegrationClient> & ExtractTasks<TIntegrationClient["tasks"]>;
1000
+ type IntegrationIO<TIntegration extends TriggerIntegration<IntegrationClient<any, any>>> = ExtractIntegrationClient<TIntegration["client"]>;
4147
1001
  type ExtractIntegrations<TIntegrations extends Record<string, TriggerIntegration<IntegrationClient<any, any>>>> = {
4148
1002
  [key in keyof TIntegrations]: ExtractIntegrationClient<TIntegrations[key]["client"]>;
4149
1003
  };
@@ -4169,7 +1023,7 @@ type JobOptions<TTrigger extends Trigger<EventSpecification<any>>, TIntegrations
4169
1023
  logLevel?: LogLevel;
4170
1024
  /** 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
1025
  ```ts
4172
- new Job(client, {
1026
+ client.defineJob({
4173
1027
  //... other options
4174
1028
  integrations: {
4175
1029
  slack,
@@ -4197,6 +1051,8 @@ type JobOptions<TTrigger extends Trigger<EventSpecification<any>>, TIntegrations
4197
1051
  */
4198
1052
  run: (payload: TriggerEventType<TTrigger>, io: IOWithIntegrations<TIntegrations>, context: TriggerContext) => Promise<any>;
4199
1053
  };
1054
+ type JobPayload<TJob> = TJob extends Job<Trigger<EventSpecification<infer TEvent>>, any> ? TEvent : never;
1055
+ type JobIO<TJob> = TJob extends Job<any, infer TIntegrations> ? IOWithIntegrations<TIntegrations> : never;
4200
1056
  /** 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. */
4201
1057
  declare class Job<TTrigger extends Trigger<EventSpecification<any>>, TIntegrations extends Record<string, TriggerIntegration<IntegrationClient<any, any>>> = {}> {
4202
1058
  #private;
@@ -4218,7 +1074,7 @@ declare class Job<TTrigger extends Trigger<EventSpecification<any>>, TIntegratio
4218
1074
 
4219
1075
  type EventTriggerOptions<TEventSpecification extends EventSpecification<any>> = {
4220
1076
  event: TEventSpecification;
4221
- name?: string;
1077
+ name?: string | string[];
4222
1078
  source?: string;
4223
1079
  filter?: EventFilter;
4224
1080
  };
@@ -4232,8 +1088,8 @@ declare class EventTrigger<TEventSpecification extends EventSpecification<any>>
4232
1088
  }
4233
1089
  /** Configuration options for an EventTrigger */
4234
1090
  type TriggerOptions<TEvent> = {
4235
- /** The name of the event you are subscribing to. Must be an exact match (case sensitive). */
4236
- name: string;
1091
+ /** The name of the event you are subscribing to. Must be an exact match (case sensitive). To trigger on multiple possible events, pass in an array of event names */
1092
+ name: string | string[];
4237
1093
  /** A [Zod](https://trigger.dev/docs/documentation/guides/zod) schema that defines the shape of the event payload.
4238
1094
  * The default is `z.any()` which is `any`.
4239
1095
  * */
@@ -4260,6 +1116,7 @@ type TriggerOptions<TEvent> = {
4260
1116
  * ```
4261
1117
  */
4262
1118
  filter?: EventFilter;
1119
+ examples?: EventSpecificationExample[];
4263
1120
  };
4264
1121
  /** `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
1122
  * @param options options for the EventTrigger
@@ -4295,8 +1152,8 @@ declare class MissingConnectionNotification implements Trigger<MissingConnection
4295
1152
  id: string;
4296
1153
  type: "EXTERNAL";
4297
1154
  account: {
4298
- metadata?: any;
4299
1155
  id: string;
1156
+ metadata?: any;
4300
1157
  };
4301
1158
  client: {
4302
1159
  id: string;
@@ -4342,8 +1199,8 @@ declare class MissingConnectionResolvedNotification implements Trigger<MissingCo
4342
1199
  id: string;
4343
1200
  type: "EXTERNAL";
4344
1201
  account: {
4345
- metadata?: any;
4346
1202
  id: string;
1203
+ metadata?: any;
4347
1204
  };
4348
1205
  client: {
4349
1206
  id: string;
@@ -4376,15 +1233,21 @@ declare class RetryWithTaskError {
4376
1233
  retryAt: Date;
4377
1234
  constructor(cause: ErrorWithStack, task: ServerTask, retryAt: Date);
4378
1235
  }
1236
+ declare class CanceledWithTaskError {
1237
+ task: ServerTask;
1238
+ constructor(task: ServerTask);
1239
+ }
4379
1240
  /** Use this function if you're using a `try/catch` block to catch errors.
4380
1241
  * It checks if a thrown error is a special internal error that you should ignore.
4381
1242
  * If this returns `true` then you must rethrow the error: `throw err;`
4382
1243
  * @param err The error to check
4383
1244
  * @returns `true` if the error is a Trigger Error, `false` otherwise.
4384
1245
  */
4385
- declare function isTriggerError(err: unknown): err is ResumeWithTaskError | RetryWithTaskError;
1246
+ declare function isTriggerError(err: unknown): err is ResumeWithTaskError | RetryWithTaskError | CanceledWithTaskError;
4386
1247
 
4387
1248
  type Task = ServerTask;
1249
+
1250
+ type SentEvent = ApiEventLog;
4388
1251
  declare function redactString(strings: TemplateStringsArray, ...interpolations: string[]): RedactString;
4389
1252
 
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 };
1253
+ export { AuthenticatedTask, ClientFactory, CronTrigger, DynamicIntervalOptions, DynamicSchedule, DynamicTrigger, DynamicTriggerOptions, EventSpecification, EventSpecificationExample, EventTrigger, EventTypeFromSpecification, ExternalSource, ExternalSourceParams, ExternalSourceTrigger, ExternalSourceTriggerOptions, HandlerEvent, HttpSourceEvent, IO, IOLogger, IOOptions, IOTask, IOWithIntegrations, IntegrationClient, IntegrationIO, IntervalTrigger, Job, JobIO, JobOptions, JobPayload, MissingConnectionNotification, MissingConnectionResolvedNotification, PreprocessResults, SentEvent, Task, TaskLogger, Trigger, TriggerClient, TriggerClientOptions, TriggerContext, TriggerEventType, TriggerIntegration, TriggerPayload, TriggerPreprocessContext, authenticatedTask, cronTrigger, eventTrigger, intervalTrigger, isTriggerError, missingConnectionNotification, missingConnectionResolvedNotification, omit, redactString };