@trigger.dev/sdk 0.0.0-buffer-import-20231031121649 → 0.0.0-buffer-fix-20231206151546

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,8 +1,39 @@
1
1
  import * as _trigger_dev_core from '@trigger.dev/core';
2
- import { RunTaskBodyInput, CompleteTaskBodyInput, FailTaskBodyInput, SendEvent, SendEventOptions, StatusUpdate, UpdateTriggerSourceBodyV2, TriggerSource, RegisterTriggerBodyV2, RegisterSourceEventV2, ScheduleMetadata, GetRunOptionsWithTaskDetails, GetRunsOptions, LogLevel, RuntimeEnvironmentType, DisplayProperty, TriggerMetadata, EventFilter, Prettify, HandleTriggerSource, Logger, RegisterTriggerSource, SerializableJson, ConnectionAuth, NormalizedResponse, HttpSourceResponseMetadata, IntervalOptions, CronOptions, ScheduledPayload, DeserializedJson, ServerTask, CachedTask, InitialStatusUpdate, FetchRequestInit, FetchRetryOptions, RunTaskOptions, IntegrationMetadata, QueueOptions, IntegrationConfig, JobMetadata, MissingConnectionNotificationPayload, MissingConnectionResolvedNotificationPayload, ErrorWithStack, ApiEventLog, RedactString } from '@trigger.dev/core';
3
- export { ConnectionAuth, DisplayProperty, EventFilter, Logger, NormalizedRequest, OverridableRunTaskOptions, Prettify, RedactString, RegisteredOptionsDiff, RunTaskOptions, SourceEventOption } from '@trigger.dev/core';
2
+ import { AsyncMap, KeyValueStoreResponseBody, RunTaskBodyInput, CompleteTaskBodyV2Input, FailTaskBodyInput, SendEvent, SendEventOptions, StatusUpdate, UpdateTriggerSourceBodyV2, TriggerSource, UpdateWebhookBody, RegisterTriggerBodyV2, RegisterSourceEventV2, ScheduleMetadata, GetRunOptionsWithTaskDetails, GetRunsOptions, InvokeOptions, EphemeralEventDispatcherRequestBody, RuntimeEnvironmentType, DisplayProperty, TriggerMetadata, EventFilter, SuccessfulRunNotification, FailedRunNotification, HttpEndpointMetadata, RequestFilter, Prettify, HandleTriggerSource, RegisterTriggerSource, SerializableJson, ConnectionAuth, NormalizedResponse, HttpSourceResponseMetadata, IntervalOptions, CronOptions, ScheduledPayload, RegisterWebhookSource, DeserializedJson, ServerTask, CachedTask, InitialStatusUpdate, FetchRequestInit, FetchRetryOptions, FetchTimeoutOptions, FetchPollOperation, RunTaskOptions, IntegrationMetadata, IntegrationConfig, JobMetadata, RunNotification, MissingConnectionNotificationPayload, MissingConnectionResolvedNotificationPayload, ErrorWithStack, ApiEventLog, RedactString } from '@trigger.dev/core';
3
+ export { ConnectionAuth, DisplayProperty, EventFilter, NormalizedRequest, OverridableRunTaskOptions, Prettify, RedactString, RegisteredOptionsDiff, RunTaskOptions, SourceEventOption } from '@trigger.dev/core';
4
+ import { LogLevel, Logger } from '@trigger.dev/core-backend';
5
+ export { Logger } from '@trigger.dev/core-backend';
4
6
  import * as zod from 'zod';
5
- import { z } from 'zod';
7
+ import { z, ZodType, TypeOf } from 'zod';
8
+ import { Buffer } from 'buffer';
9
+ import { BinaryToTextEncoding, BinaryLike, KeyObject } from 'crypto';
10
+
11
+ type ConcurrencyLimitOptions = {
12
+ id: string;
13
+ limit: number;
14
+ };
15
+ declare class ConcurrencyLimit {
16
+ private options;
17
+ constructor(options: ConcurrencyLimitOptions);
18
+ get id(): string;
19
+ get limit(): number;
20
+ }
21
+
22
+ type QueryKeyValueStoreFunction = (action: "DELETE" | "GET" | "HAS" | "SET", data: {
23
+ key: string;
24
+ value?: string;
25
+ }) => Promise<KeyValueStoreResponseBody>;
26
+ declare class KeyValueStoreClient implements AsyncMap {
27
+ #private;
28
+ private queryStore;
29
+ private type;
30
+ private namespace;
31
+ constructor(queryStore: QueryKeyValueStoreFunction, type?: string | null, namespace?: string);
32
+ delete(key: string): Promise<boolean>;
33
+ get<T extends Json<T>>(key: string): Promise<T | undefined>;
34
+ has(key: string): Promise<boolean>;
35
+ set<T extends Json<T>>(key: string, value: T): Promise<T>;
36
+ }
6
37
 
7
38
  type ApiClientOptions = {
8
39
  apiKey?: string;
@@ -40,29 +71,36 @@ declare class ApiClient {
40
71
  label: z.ZodString;
41
72
  text: z.ZodString;
42
73
  url: z.ZodOptional<z.ZodString>;
74
+ imageUrl: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
43
75
  }, "strip", z.ZodTypeAny, {
44
76
  label: string;
45
77
  text: string;
46
78
  url?: string | undefined;
79
+ imageUrl?: string[] | undefined;
47
80
  }, {
48
81
  label: string;
49
82
  text: string;
50
83
  url?: string | undefined;
84
+ imageUrl?: string[] | undefined;
51
85
  }>, "many">>>;
52
86
  outputProperties: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
53
87
  label: z.ZodString;
54
88
  text: z.ZodString;
55
89
  url: z.ZodOptional<z.ZodString>;
90
+ imageUrl: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
56
91
  }, "strip", z.ZodTypeAny, {
57
92
  label: string;
58
93
  text: string;
59
94
  url?: string | undefined;
95
+ imageUrl?: string[] | undefined;
60
96
  }, {
61
97
  label: string;
62
98
  text: string;
63
99
  url?: string | undefined;
100
+ imageUrl?: string[] | undefined;
64
101
  }>, "many">>>;
65
102
  output: z.ZodNullable<z.ZodOptional<z.ZodType<_trigger_dev_core.DeserializedJson, z.ZodTypeDef, _trigger_dev_core.DeserializedJson>>>;
103
+ context: z.ZodNullable<z.ZodOptional<z.ZodType<_trigger_dev_core.DeserializedJson, z.ZodTypeDef, _trigger_dev_core.DeserializedJson>>>;
66
104
  error: z.ZodNullable<z.ZodOptional<z.ZodString>>;
67
105
  parentId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
68
106
  style: z.ZodNullable<z.ZodOptional<z.ZodObject<{
@@ -77,6 +115,7 @@ declare class ApiClient {
77
115
  }>>>;
78
116
  operation: z.ZodNullable<z.ZodOptional<z.ZodString>>;
79
117
  callbackUrl: z.ZodNullable<z.ZodOptional<z.ZodString>>;
118
+ childExecutionMode: z.ZodNullable<z.ZodOptional<z.ZodEnum<["SEQUENTIAL", "PARALLEL"]>>>;
80
119
  idempotencyKey: z.ZodString;
81
120
  attempts: z.ZodNumber;
82
121
  forceYield: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
@@ -97,13 +136,16 @@ declare class ApiClient {
97
136
  label: string;
98
137
  text: string;
99
138
  url?: string | undefined;
139
+ imageUrl?: string[] | undefined;
100
140
  }[] | null | undefined;
101
141
  outputProperties?: {
102
142
  label: string;
103
143
  text: string;
104
144
  url?: string | undefined;
145
+ imageUrl?: string[] | undefined;
105
146
  }[] | null | undefined;
106
147
  output?: _trigger_dev_core.DeserializedJson | undefined;
148
+ context?: _trigger_dev_core.DeserializedJson | undefined;
107
149
  error?: string | null | undefined;
108
150
  parentId?: string | null | undefined;
109
151
  style?: {
@@ -112,6 +154,7 @@ declare class ApiClient {
112
154
  } | null | undefined;
113
155
  operation?: string | null | undefined;
114
156
  callbackUrl?: string | null | undefined;
157
+ childExecutionMode?: "SEQUENTIAL" | "PARALLEL" | null | undefined;
115
158
  forceYield?: boolean | null | undefined;
116
159
  }, {
117
160
  id: string;
@@ -130,13 +173,16 @@ declare class ApiClient {
130
173
  label: string;
131
174
  text: string;
132
175
  url?: string | undefined;
176
+ imageUrl?: string[] | undefined;
133
177
  }[] | null | undefined;
134
178
  outputProperties?: {
135
179
  label: string;
136
180
  text: string;
137
181
  url?: string | undefined;
182
+ imageUrl?: string[] | undefined;
138
183
  }[] | null | undefined;
139
184
  output?: _trigger_dev_core.DeserializedJson | undefined;
185
+ context?: _trigger_dev_core.DeserializedJson | undefined;
140
186
  error?: string | null | undefined;
141
187
  parentId?: string | null | undefined;
142
188
  style?: {
@@ -145,6 +191,7 @@ declare class ApiClient {
145
191
  } | null | undefined;
146
192
  operation?: string | null | undefined;
147
193
  callbackUrl?: string | null | undefined;
194
+ childExecutionMode?: "SEQUENTIAL" | "PARALLEL" | null | undefined;
148
195
  forceYield?: boolean | null | undefined;
149
196
  }>;
150
197
  cachedTasks: z.ZodOptional<z.ZodObject<{
@@ -210,13 +257,16 @@ declare class ApiClient {
210
257
  label: string;
211
258
  text: string;
212
259
  url?: string | undefined;
260
+ imageUrl?: string[] | undefined;
213
261
  }[] | null | undefined;
214
262
  outputProperties?: {
215
263
  label: string;
216
264
  text: string;
217
265
  url?: string | undefined;
266
+ imageUrl?: string[] | undefined;
218
267
  }[] | null | undefined;
219
268
  output?: _trigger_dev_core.DeserializedJson | undefined;
269
+ context?: _trigger_dev_core.DeserializedJson | undefined;
220
270
  error?: string | null | undefined;
221
271
  parentId?: string | null | undefined;
222
272
  style?: {
@@ -225,6 +275,7 @@ declare class ApiClient {
225
275
  } | null | undefined;
226
276
  operation?: string | null | undefined;
227
277
  callbackUrl?: string | null | undefined;
278
+ childExecutionMode?: "SEQUENTIAL" | "PARALLEL" | null | undefined;
228
279
  forceYield?: boolean | null | undefined;
229
280
  };
230
281
  cachedTasks?: {
@@ -256,13 +307,16 @@ declare class ApiClient {
256
307
  label: string;
257
308
  text: string;
258
309
  url?: string | undefined;
310
+ imageUrl?: string[] | undefined;
259
311
  }[] | null | undefined;
260
312
  outputProperties?: {
261
313
  label: string;
262
314
  text: string;
263
315
  url?: string | undefined;
316
+ imageUrl?: string[] | undefined;
264
317
  }[] | null | undefined;
265
318
  output?: _trigger_dev_core.DeserializedJson | undefined;
319
+ context?: _trigger_dev_core.DeserializedJson | undefined;
266
320
  error?: string | null | undefined;
267
321
  parentId?: string | null | undefined;
268
322
  style?: {
@@ -271,6 +325,7 @@ declare class ApiClient {
271
325
  } | null | undefined;
272
326
  operation?: string | null | undefined;
273
327
  callbackUrl?: string | null | undefined;
328
+ childExecutionMode?: "SEQUENTIAL" | "PARALLEL" | null | undefined;
274
329
  forceYield?: boolean | null | undefined;
275
330
  };
276
331
  cachedTasks?: {
@@ -300,29 +355,36 @@ declare class ApiClient {
300
355
  label: z.ZodString;
301
356
  text: z.ZodString;
302
357
  url: z.ZodOptional<z.ZodString>;
358
+ imageUrl: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
303
359
  }, "strip", z.ZodTypeAny, {
304
360
  label: string;
305
361
  text: string;
306
362
  url?: string | undefined;
363
+ imageUrl?: string[] | undefined;
307
364
  }, {
308
365
  label: string;
309
366
  text: string;
310
367
  url?: string | undefined;
368
+ imageUrl?: string[] | undefined;
311
369
  }>, "many">>>;
312
370
  outputProperties: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
313
371
  label: z.ZodString;
314
372
  text: z.ZodString;
315
373
  url: z.ZodOptional<z.ZodString>;
374
+ imageUrl: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
316
375
  }, "strip", z.ZodTypeAny, {
317
376
  label: string;
318
377
  text: string;
319
378
  url?: string | undefined;
379
+ imageUrl?: string[] | undefined;
320
380
  }, {
321
381
  label: string;
322
382
  text: string;
323
383
  url?: string | undefined;
384
+ imageUrl?: string[] | undefined;
324
385
  }>, "many">>>;
325
386
  output: z.ZodNullable<z.ZodOptional<z.ZodType<_trigger_dev_core.DeserializedJson, z.ZodTypeDef, _trigger_dev_core.DeserializedJson>>>;
387
+ context: z.ZodNullable<z.ZodOptional<z.ZodType<_trigger_dev_core.DeserializedJson, z.ZodTypeDef, _trigger_dev_core.DeserializedJson>>>;
326
388
  error: z.ZodNullable<z.ZodOptional<z.ZodString>>;
327
389
  parentId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
328
390
  style: z.ZodNullable<z.ZodOptional<z.ZodObject<{
@@ -337,6 +399,7 @@ declare class ApiClient {
337
399
  }>>>;
338
400
  operation: z.ZodNullable<z.ZodOptional<z.ZodString>>;
339
401
  callbackUrl: z.ZodNullable<z.ZodOptional<z.ZodString>>;
402
+ childExecutionMode: z.ZodNullable<z.ZodOptional<z.ZodEnum<["SEQUENTIAL", "PARALLEL"]>>>;
340
403
  idempotencyKey: z.ZodString;
341
404
  attempts: z.ZodNumber;
342
405
  forceYield: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
@@ -357,13 +420,16 @@ declare class ApiClient {
357
420
  label: string;
358
421
  text: string;
359
422
  url?: string | undefined;
423
+ imageUrl?: string[] | undefined;
360
424
  }[] | null | undefined;
361
425
  outputProperties?: {
362
426
  label: string;
363
427
  text: string;
364
428
  url?: string | undefined;
429
+ imageUrl?: string[] | undefined;
365
430
  }[] | null | undefined;
366
431
  output?: _trigger_dev_core.DeserializedJson | undefined;
432
+ context?: _trigger_dev_core.DeserializedJson | undefined;
367
433
  error?: string | null | undefined;
368
434
  parentId?: string | null | undefined;
369
435
  style?: {
@@ -372,6 +438,7 @@ declare class ApiClient {
372
438
  } | null | undefined;
373
439
  operation?: string | null | undefined;
374
440
  callbackUrl?: string | null | undefined;
441
+ childExecutionMode?: "SEQUENTIAL" | "PARALLEL" | null | undefined;
375
442
  forceYield?: boolean | null | undefined;
376
443
  }, {
377
444
  id: string;
@@ -390,13 +457,16 @@ declare class ApiClient {
390
457
  label: string;
391
458
  text: string;
392
459
  url?: string | undefined;
460
+ imageUrl?: string[] | undefined;
393
461
  }[] | null | undefined;
394
462
  outputProperties?: {
395
463
  label: string;
396
464
  text: string;
397
465
  url?: string | undefined;
466
+ imageUrl?: string[] | undefined;
398
467
  }[] | null | undefined;
399
468
  output?: _trigger_dev_core.DeserializedJson | undefined;
469
+ context?: _trigger_dev_core.DeserializedJson | undefined;
400
470
  error?: string | null | undefined;
401
471
  parentId?: string | null | undefined;
402
472
  style?: {
@@ -405,9 +475,10 @@ declare class ApiClient {
405
475
  } | null | undefined;
406
476
  operation?: string | null | undefined;
407
477
  callbackUrl?: string | null | undefined;
478
+ childExecutionMode?: "SEQUENTIAL" | "PARALLEL" | null | undefined;
408
479
  forceYield?: boolean | null | undefined;
409
480
  }>>>;
410
- completeTask(runId: string, id: string, task: CompleteTaskBodyInput): Promise<{
481
+ completeTask(runId: string, id: string, task: CompleteTaskBodyV2Input): Promise<{
411
482
  id: string;
412
483
  name: string;
413
484
  noop: boolean;
@@ -424,13 +495,16 @@ declare class ApiClient {
424
495
  label: string;
425
496
  text: string;
426
497
  url?: string | undefined;
498
+ imageUrl?: string[] | undefined;
427
499
  }[] | null | undefined;
428
500
  outputProperties?: {
429
501
  label: string;
430
502
  text: string;
431
503
  url?: string | undefined;
504
+ imageUrl?: string[] | undefined;
432
505
  }[] | null | undefined;
433
506
  output?: _trigger_dev_core.DeserializedJson | undefined;
507
+ context?: _trigger_dev_core.DeserializedJson | undefined;
434
508
  error?: string | null | undefined;
435
509
  parentId?: string | null | undefined;
436
510
  style?: {
@@ -439,6 +513,7 @@ declare class ApiClient {
439
513
  } | null | undefined;
440
514
  operation?: string | null | undefined;
441
515
  callbackUrl?: string | null | undefined;
516
+ childExecutionMode?: "SEQUENTIAL" | "PARALLEL" | null | undefined;
442
517
  forceYield?: boolean | null | undefined;
443
518
  }>;
444
519
  failTask(runId: string, id: string, body: FailTaskBodyInput): Promise<{
@@ -458,13 +533,16 @@ declare class ApiClient {
458
533
  label: string;
459
534
  text: string;
460
535
  url?: string | undefined;
536
+ imageUrl?: string[] | undefined;
461
537
  }[] | null | undefined;
462
538
  outputProperties?: {
463
539
  label: string;
464
540
  text: string;
465
541
  url?: string | undefined;
542
+ imageUrl?: string[] | undefined;
466
543
  }[] | null | undefined;
467
544
  output?: _trigger_dev_core.DeserializedJson | undefined;
545
+ context?: _trigger_dev_core.DeserializedJson | undefined;
468
546
  error?: string | null | undefined;
469
547
  parentId?: string | null | undefined;
470
548
  style?: {
@@ -473,6 +551,7 @@ declare class ApiClient {
473
551
  } | null | undefined;
474
552
  operation?: string | null | undefined;
475
553
  callbackUrl?: string | null | undefined;
554
+ childExecutionMode?: "SEQUENTIAL" | "PARALLEL" | null | undefined;
476
555
  forceYield?: boolean | null | undefined;
477
556
  }>;
478
557
  sendEvent(event: SendEvent, options?: SendEventOptions): Promise<{
@@ -489,6 +568,20 @@ declare class ApiClient {
489
568
  deliveredAt?: Date | null | undefined;
490
569
  cancelledAt?: Date | null | undefined;
491
570
  }>;
571
+ sendEvents(events: SendEvent[], options?: SendEventOptions): Promise<{
572
+ id: string;
573
+ name: string;
574
+ payload: ((string | number | boolean | {
575
+ [key: string]: _trigger_dev_core.DeserializedJson;
576
+ } | _trigger_dev_core.DeserializedJson[]) & (string | number | boolean | {
577
+ [key: string]: _trigger_dev_core.DeserializedJson;
578
+ } | _trigger_dev_core.DeserializedJson[] | undefined)) | null;
579
+ timestamp: Date;
580
+ context?: _trigger_dev_core.DeserializedJson | undefined;
581
+ deliverAt?: Date | null | undefined;
582
+ deliveredAt?: Date | null | undefined;
583
+ cancelledAt?: Date | null | undefined;
584
+ }[]>;
492
585
  cancelEvent(eventId: string): Promise<{
493
586
  id: string;
494
587
  name: string;
@@ -519,6 +612,7 @@ declare class ApiClient {
519
612
  state?: "loading" | "success" | "failure" | undefined;
520
613
  }>;
521
614
  updateSource(client: string, key: string, source: UpdateTriggerSourceBodyV2): Promise<TriggerSource>;
615
+ updateWebhook(key: string, webhookData: UpdateWebhookBody): Promise<TriggerSource>;
522
616
  registerTrigger(client: string, id: string, key: string, payload: RegisterTriggerBodyV2, idempotencyKey?: string): Promise<RegisterSourceEventV2>;
523
617
  registerSchedule(client: string, id: string, key: string, payload: ScheduleMetadata): Promise<{
524
618
  id: string;
@@ -555,7 +649,7 @@ declare class ApiClient {
555
649
  updatedAt: Date;
556
650
  runs: {
557
651
  id: string;
558
- status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD";
652
+ status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD" | "EXECUTING" | "WAITING_TO_CONTINUE" | "WAITING_TO_EXECUTE";
559
653
  startedAt?: Date | null | undefined;
560
654
  completedAt?: Date | null | undefined;
561
655
  }[];
@@ -565,7 +659,7 @@ declare class ApiClient {
565
659
  id: string;
566
660
  startedAt: Date | null;
567
661
  completedAt: Date | null;
568
- status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD";
662
+ status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD" | "EXECUTING" | "WAITING_TO_CONTINUE" | "WAITING_TO_EXECUTE";
569
663
  updatedAt: Date | null;
570
664
  tasks: _trigger_dev_core.RunTaskWithSubtasks[];
571
665
  statuses: {
@@ -586,7 +680,7 @@ declare class ApiClient {
586
680
  id: string;
587
681
  startedAt: Date | null;
588
682
  completedAt: Date | null;
589
- status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD";
683
+ status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD" | "EXECUTING" | "WAITING_TO_CONTINUE" | "WAITING_TO_EXECUTE";
590
684
  updatedAt: Date | null;
591
685
  tasks: _trigger_dev_core.RunTaskWithSubtasks[];
592
686
  statuses: {
@@ -617,7 +711,7 @@ declare class ApiClient {
617
711
  }[];
618
712
  run: {
619
713
  id: string;
620
- status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD";
714
+ status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD" | "EXECUTING" | "WAITING_TO_CONTINUE" | "WAITING_TO_EXECUTE";
621
715
  output?: any;
622
716
  };
623
717
  }>;
@@ -626,11 +720,18 @@ declare class ApiClient {
626
720
  id: string;
627
721
  startedAt: Date | null;
628
722
  completedAt: Date | null;
629
- status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD";
723
+ status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD" | "EXECUTING" | "WAITING_TO_CONTINUE" | "WAITING_TO_EXECUTE";
630
724
  updatedAt: Date | null;
631
725
  }[];
632
726
  nextCursor?: string | undefined;
633
727
  }>;
728
+ invokeJob(jobId: string, payload: any, options?: InvokeOptions): Promise<{
729
+ id: string;
730
+ }>;
731
+ createEphemeralEventDispatcher(payload: EphemeralEventDispatcherRequestBody): Promise<{
732
+ id: string;
733
+ }>;
734
+ get store(): KeyValueStoreClient;
634
735
  }
635
736
  type VersionedResponseBodyMap = {
636
737
  [key: string]: z.ZodTypeAny;
@@ -662,6 +763,48 @@ declare class TriggerStatus {
662
763
  }>;
663
764
  }
664
765
 
766
+ type EventMap = {
767
+ [key: string]: (...args: any[]) => void
768
+ }
769
+
770
+ /**
771
+ * Type-safe event emitter.
772
+ *
773
+ * Use it like this:
774
+ *
775
+ * ```typescript
776
+ * type MyEvents = {
777
+ * error: (error: Error) => void;
778
+ * message: (from: string, content: string) => void;
779
+ * }
780
+ *
781
+ * const myEmitter = new EventEmitter() as TypedEmitter<MyEvents>;
782
+ *
783
+ * myEmitter.emit("error", "x") // <- Will catch this type error;
784
+ * ```
785
+ */
786
+ interface TypedEventEmitter<Events extends EventMap> {
787
+ addListener<E extends keyof Events> (event: E, listener: Events[E]): this
788
+ on<E extends keyof Events> (event: E, listener: Events[E]): this
789
+ once<E extends keyof Events> (event: E, listener: Events[E]): this
790
+ prependListener<E extends keyof Events> (event: E, listener: Events[E]): this
791
+ prependOnceListener<E extends keyof Events> (event: E, listener: Events[E]): this
792
+
793
+ off<E extends keyof Events>(event: E, listener: Events[E]): this
794
+ removeAllListeners<E extends keyof Events> (event?: E): this
795
+ removeListener<E extends keyof Events> (event: E, listener: Events[E]): this
796
+
797
+ emit<E extends keyof Events> (event: E, ...args: Parameters<Events[E]>): boolean
798
+ // The sloppy `eventNames()` return type is to mitigate type incompatibilities - see #5
799
+ eventNames (): (keyof Events | string | symbol)[]
800
+ rawListeners<E extends keyof Events> (event: E): Events[E][]
801
+ listeners<E extends keyof Events> (event: E): Events[E][]
802
+ listenerCount<E extends keyof Events> (event: E): number
803
+
804
+ getMaxListeners (): number
805
+ setMaxListeners (maxListeners: number): this
806
+ }
807
+
665
808
  interface TriggerContext {
666
809
  /** Job metadata */
667
810
  job: {
@@ -680,6 +823,12 @@ interface TriggerContext {
680
823
  id: string;
681
824
  title: string;
682
825
  };
826
+ /** Project metadata */
827
+ project: {
828
+ slug: string;
829
+ id: string;
830
+ name: string;
831
+ };
683
832
  /** Run metadata */
684
833
  run: {
685
834
  id: string;
@@ -746,20 +895,45 @@ type PreprocessResults = {
746
895
  properties: DisplayProperty[];
747
896
  };
748
897
  type TriggerEventType<TTrigger extends Trigger<any>> = TTrigger extends Trigger<infer TEventSpec> ? ReturnType<TEventSpec["parsePayload"]> : never;
898
+ type TriggerInvokeType<TTrigger extends Trigger<any>> = TTrigger extends Trigger<infer TEventSpec> ? TEventSpec["parseInvokePayload"] extends (payload: unknown) => infer TInvoke ? TInvoke : any : never;
899
+ type VerifyResult = {
900
+ success: true;
901
+ } | {
902
+ success: false;
903
+ reason?: string;
904
+ };
749
905
  interface Trigger<TEventSpec extends EventSpecification<any>> {
750
906
  event: TEventSpec;
751
907
  toJSON(): TriggerMetadata;
752
908
  attachToJob(triggerClient: TriggerClient, job: Job<Trigger<TEventSpec>, any>): void;
753
909
  preprocessRuns: boolean;
910
+ verifyPayload: (payload: ReturnType<TEventSpec["parsePayload"]>) => Promise<VerifyResult>;
754
911
  }
755
912
  type TriggerPayload<TTrigger> = TTrigger extends Trigger<EventSpecification<infer TEvent>> ? TEvent : never;
756
- type EventSpecificationExample = {
913
+ declare const EventSpecificationExampleSchema: z.ZodObject<{
914
+ id: z.ZodString;
915
+ name: z.ZodString;
916
+ icon: z.ZodOptional<z.ZodString>;
917
+ payload: z.ZodAny;
918
+ }, "strip", z.ZodTypeAny, {
919
+ id: string;
920
+ name: string;
921
+ icon?: string | undefined;
922
+ payload?: any;
923
+ }, {
924
+ id: string;
925
+ name: string;
926
+ icon?: string | undefined;
927
+ payload?: any;
928
+ }>;
929
+ type EventSpecificationExample = z.infer<typeof EventSpecificationExampleSchema>;
930
+ type TypedEventSpecificationExample<TEvent> = {
757
931
  id: string;
758
932
  name: string;
759
933
  icon?: string;
760
- payload: any;
934
+ payload: TEvent;
761
935
  };
762
- interface EventSpecification<TEvent extends any> {
936
+ interface EventSpecification<TEvent extends any, TInvoke extends any = TEvent> {
763
937
  name: string | string[];
764
938
  title: string;
765
939
  source: string;
@@ -769,6 +943,7 @@ interface EventSpecification<TEvent extends any> {
769
943
  examples?: Array<EventSpecificationExample>;
770
944
  filter?: EventFilter;
771
945
  parsePayload: (payload: unknown) => TEvent;
946
+ parseInvokePayload?: (payload: unknown) => TInvoke;
772
947
  runProperties?: (payload: TEvent) => DisplayProperty[];
773
948
  }
774
949
  type EventTypeFromSpecification<TEventSpec extends EventSpecification<any>> = TEventSpec extends EventSpecification<infer TEvent> ? TEvent : never;
@@ -788,6 +963,143 @@ type SchemaParserResult<T> = {
788
963
  type SchemaParser<T extends unknown = unknown> = {
789
964
  safeParse: (a: unknown) => SchemaParserResult<T>;
790
965
  };
966
+ type WaitForEventResult<TEvent> = {
967
+ id: string;
968
+ name: string;
969
+ source: string;
970
+ payload: TEvent;
971
+ timestamp: Date;
972
+ context?: any;
973
+ accountId?: string;
974
+ };
975
+ declare function waitForEventSchema(schema: z.ZodTypeAny): z.ZodObject<{
976
+ id: z.ZodString;
977
+ name: z.ZodString;
978
+ source: z.ZodString;
979
+ payload: z.ZodTypeAny;
980
+ timestamp: z.ZodDate;
981
+ context: z.ZodOptional<z.ZodAny>;
982
+ accountId: z.ZodOptional<z.ZodString>;
983
+ }, "strip", z.ZodTypeAny, {
984
+ id: string;
985
+ name: string;
986
+ timestamp: Date;
987
+ source: string;
988
+ payload?: any;
989
+ context?: any;
990
+ accountId?: string | undefined;
991
+ }, {
992
+ id: string;
993
+ name: string;
994
+ timestamp: Date;
995
+ source: string;
996
+ payload?: any;
997
+ context?: any;
998
+ accountId?: string | undefined;
999
+ }>;
1000
+ type NotificationEvents = {
1001
+ runSucceeeded: (notification: SuccessfulRunNotification<any>) => void;
1002
+ runFailed: (notification: FailedRunNotification) => void;
1003
+ };
1004
+ type NotificationsEventEmitter = TypedEventEmitter<NotificationEvents>;
1005
+
1006
+ type HttpEndpointOptions<TEventSpecification extends EventSpecification<any>> = {
1007
+ id: string;
1008
+ enabled?: boolean;
1009
+ event: TEventSpecification;
1010
+ respondWith?: RespondWith;
1011
+ verify: VerifyCallback;
1012
+ };
1013
+ type RequestOptions = {
1014
+ filter?: RequestFilter;
1015
+ };
1016
+ declare class HttpEndpoint<TEventSpecification extends EventSpecification<any>> {
1017
+ private readonly options;
1018
+ constructor(options: HttpEndpointOptions<TEventSpecification>);
1019
+ get id(): string;
1020
+ onRequest(options?: RequestOptions): HttpTrigger<EventSpecification<Request>>;
1021
+ toJSON(): HttpEndpointMetadata;
1022
+ }
1023
+ type TriggerOptions$1<TEventSpecification extends EventSpecification<any>> = {
1024
+ endpointId: string;
1025
+ event: TEventSpecification;
1026
+ filter?: EventFilter;
1027
+ verify: VerifyCallback;
1028
+ };
1029
+ declare class HttpTrigger<TEventSpecification extends EventSpecification<any>> implements Trigger<TEventSpecification> {
1030
+ private readonly options;
1031
+ constructor(options: TriggerOptions$1<TEventSpecification>);
1032
+ toJSON(): TriggerMetadata;
1033
+ get event(): TEventSpecification;
1034
+ attachToJob(triggerClient: TriggerClient, job: Job<Trigger<TEventSpecification>, any>): void;
1035
+ get preprocessRuns(): boolean;
1036
+ verifyPayload(payload: Request): Promise<VerifyResult>;
1037
+ }
1038
+ type RespondWith = {
1039
+ /** Only Requests that match this filter will cause the `handler` function to run.
1040
+ * For example, you can use this to only respond to `GET` Requests. */
1041
+ filter?: RequestFilter;
1042
+ /** If you set this to `true`, the Request that comes in won't go on to Trigger any Runs.
1043
+ * This is useful if you want to Respond to the Request, but don't want to Trigger any Runs. */
1044
+ skipTriggeringRuns?: boolean;
1045
+ /** This is a function that's called when a Request comes in.
1046
+ * It's passed the Request object, and expects you to return a Response object. */
1047
+ handler: (request: Request, verify: () => Promise<VerifyResult>) => Promise<Response>;
1048
+ };
1049
+ type VerifyCallback = (request: Request) => Promise<VerifyResult>;
1050
+ type EndpointOptions = {
1051
+ /** Used to uniquely identify the HTTP Endpoint inside your Project. */
1052
+ id: string;
1053
+ enabled?: boolean;
1054
+ /** Usually you would use the domain name of the service, e.g. `cal.com`. */
1055
+ source: string;
1056
+ /** An optional title, displayed in the dashboard. */
1057
+ title?: string;
1058
+ /** An optional icon name that's displayed in the dashboard.
1059
+ * Lots of company names are supported, e.g. `github`, `twilio`.
1060
+ * You can also reference the name of any [Tabler icon](https://tabler-icons.io/), e.g. `brand-google-maps`, `brand-twitch`. */
1061
+ icon?: string;
1062
+ /** Used to provide example payloads that are accepted by the job.
1063
+ * This will be available in the dashboard and can be used to trigger test runs. */
1064
+ examples?: EventSpecificationExample[];
1065
+ /** Properties that are displayed in the dashboard. */
1066
+ properties?: DisplayProperty[];
1067
+ /** This optional object allows you to immediately Respond to a Request. This is useful for some APIs where they do a `GET` Request when the webhook is first setup and expect a specific Response.
1068
+
1069
+ Only use this if you really need to Respond to the Request that comes in. Most of the time you don't. */
1070
+ respondWith?: RespondWith;
1071
+ /** This is compulsory, and is used to verify that the received webhook is authentic.
1072
+ * It's a function that expects you to return a result object like:
1073
+
1074
+ In 90% of cases, you'll want to use the `verifyRequestSignature` helper function we provide.
1075
+
1076
+ @example
1077
+ ```ts
1078
+ //if it's valid
1079
+ return { success: true }
1080
+ //if it's invalid, reason is optional
1081
+ return { success: false, reason: "No header" }
1082
+ ```
1083
+
1084
+ */
1085
+ verify: VerifyCallback;
1086
+ };
1087
+
1088
+ declare class KeyValueStore {
1089
+ #private;
1090
+ private apiClient;
1091
+ private type;
1092
+ private namespace;
1093
+ constructor(apiClient: ApiClient, type?: string | null, namespace?: string);
1094
+ delete(cacheKey: string | any[], key: string): Promise<boolean>;
1095
+ delete(key: string): Promise<boolean>;
1096
+ get<T extends Json<T> = any>(cacheKey: string | any[], key: string): Promise<T | undefined>;
1097
+ get<T extends Json<T> = any>(key: string): Promise<T | undefined>;
1098
+ has(cacheKey: string | any[], key: string): Promise<boolean>;
1099
+ has(key: string): Promise<boolean>;
1100
+ set<T extends Json<T>>(cacheKey: string | any[], key: string, value: T): Promise<T>;
1101
+ set<T extends Json<T>>(key: string, value: T): Promise<T>;
1102
+ }
791
1103
 
792
1104
  type HttpSourceEvent = {
793
1105
  url: string;
@@ -833,7 +1145,7 @@ type TriggerOptionsRecordWithEvent<TValue, TTriggerOptionDefinitions extends Rec
833
1145
  type TriggerOptionRecord<TValue, TTriggerOptionDefinitions extends Record<string, string[]> = any> = {
834
1146
  [K in keyof TTriggerOptionDefinitions]: TValue;
835
1147
  };
836
- type RegisterFunctionEvent<TChannel extends ChannelNames, TParams extends any, TTriggerOptionDefinitions extends Record<string, string[]> = any> = {
1148
+ type RegisterFunctionEvent$1<TChannel extends ChannelNames, TParams extends any, TTriggerOptionDefinitions extends Record<string, string[]> = any> = {
837
1149
  options: TriggerOptionDiffs<TTriggerOptionDefinitions>;
838
1150
  source: {
839
1151
  active: boolean;
@@ -848,14 +1160,14 @@ type RegisterSourceEvent<TTriggerOptionDefinitions extends Record<string, string
848
1160
  dynamicTriggerId?: string;
849
1161
  options: TriggerOptionDiffs<TTriggerOptionDefinitions>;
850
1162
  };
851
- type RegisterFunctionOutput<TTriggerOptionDefinitions extends Record<string, string[]> = any> = {
1163
+ type RegisterFunctionOutput$1<TTriggerOptionDefinitions extends Record<string, string[]> = any> = {
852
1164
  secret?: string;
853
1165
  data?: SerializableJson;
854
1166
  options: TriggerOptionsRecordWithEvent<string[], TTriggerOptionDefinitions>;
855
1167
  };
856
- type RegisterFunction<TIntegration extends TriggerIntegration, TParams extends any, TChannel extends ChannelNames, TTriggerOptionDefinitions extends Record<string, string[]> = any> = (event: RegisterFunctionEvent<TChannel, TParams, TTriggerOptionDefinitions>, io: IOWithIntegrations<{
1168
+ type RegisterFunction$1<TIntegration extends TriggerIntegration, TParams extends any, TChannel extends ChannelNames, TTriggerOptionDefinitions extends Record<string, string[]> = any> = (event: RegisterFunctionEvent$1<TChannel, TParams, TTriggerOptionDefinitions>, io: IOWithIntegrations<{
857
1169
  integration: TIntegration;
858
- }>, ctx: TriggerContext) => Promise<RegisterFunctionOutput<TTriggerOptionDefinitions> | undefined>;
1170
+ }>, ctx: TriggerContext) => Promise<RegisterFunctionOutput$1<TTriggerOptionDefinitions> | undefined>;
859
1171
  type HandlerEvent<TChannel extends ChannelNames, TParams extends any = any> = {
860
1172
  rawEvent: ExternalSourceChannelMap[TChannel]["event"];
861
1173
  source: Prettify<Omit<HandleTriggerSource, "params"> & {
@@ -867,18 +1179,18 @@ type HandlerFunction<TChannel extends ChannelNames, TParams extends any, TTrigge
867
1179
  response?: NormalizedResponse;
868
1180
  metadata?: HttpSourceResponseMetadata;
869
1181
  } | void>;
870
- type KeyFunction<TParams extends any> = (params: TParams) => string;
871
- type FilterFunction<TParams extends any, TTriggerOptionDefinitions extends Record<string, string[]> = any> = (params: TParams, options?: TTriggerOptionDefinitions) => EventFilter;
1182
+ type KeyFunction$1<TParams extends any> = (params: TParams) => string;
1183
+ type FilterFunction$1<TParams extends any, TTriggerOptionDefinitions extends Record<string, string[]> = any> = (params: TParams, options?: TTriggerOptionDefinitions) => EventFilter;
872
1184
  type ExternalSourceOptions<TChannel extends ChannelNames, TIntegration extends TriggerIntegration, TParams extends any, TTriggerOptionDefinitions extends Record<string, string[]> = any> = {
873
1185
  id: string;
874
1186
  version: string;
875
1187
  schema: SchemaParser<TParams>;
876
1188
  optionSchema?: SchemaParser<TTriggerOptionDefinitions>;
877
1189
  integration: TIntegration;
878
- register: RegisterFunction<TIntegration, TParams, TChannel, TTriggerOptionDefinitions>;
879
- filter?: FilterFunction<TParams, TTriggerOptionDefinitions>;
1190
+ register: RegisterFunction$1<TIntegration, TParams, TChannel, TTriggerOptionDefinitions>;
1191
+ filter?: FilterFunction$1<TParams, TTriggerOptionDefinitions>;
880
1192
  handler: HandlerFunction<TChannel, TParams, TIntegration>;
881
- key: KeyFunction<TParams>;
1193
+ key: KeyFunction$1<TParams>;
882
1194
  properties?: (params: TParams) => DisplayProperty[];
883
1195
  };
884
1196
  declare class ExternalSource<TIntegration extends TriggerIntegration, TParams extends any, TChannel extends ChannelNames = ChannelNames, TTriggerOptionDefinitions extends Record<string, string[]> = any> {
@@ -893,6 +1205,7 @@ declare class ExternalSource<TIntegration extends TriggerIntegration, TParams ex
893
1205
  id?: string | undefined;
894
1206
  timestamp?: Date | undefined;
895
1207
  source?: string | undefined;
1208
+ payloadType?: "JSON" | "REQUEST" | undefined;
896
1209
  }[];
897
1210
  response?: {
898
1211
  status: number;
@@ -903,7 +1216,7 @@ declare class ExternalSource<TIntegration extends TriggerIntegration, TParams ex
903
1216
  }>;
904
1217
  filter(params: TParams, options?: TTriggerOptionDefinitions): EventFilter;
905
1218
  properties(params: TParams): DisplayProperty[];
906
- register(params: TParams, registerEvent: RegisterSourceEvent<TTriggerOptionDefinitions>, io: IO, ctx: TriggerContext): Promise<RegisterFunctionOutput<TTriggerOptionDefinitions> | undefined>;
1219
+ register(params: TParams, registerEvent: RegisterSourceEvent<TTriggerOptionDefinitions>, io: IO, ctx: TriggerContext): Promise<RegisterFunctionOutput$1<TTriggerOptionDefinitions> | undefined>;
907
1220
  key(params: TParams): string;
908
1221
  get integration(): TIntegration;
909
1222
  get integrationConfig(): {
@@ -931,6 +1244,9 @@ declare class ExternalSourceTrigger<TEventSpecification extends EventSpecificati
931
1244
  toJSON(): TriggerMetadata;
932
1245
  attachToJob(triggerClient: TriggerClient, job: Job<Trigger<TEventSpecification>, any>): void;
933
1246
  get preprocessRuns(): boolean;
1247
+ verifyPayload(payload: ReturnType<TEventSpecification["parsePayload"]>): Promise<{
1248
+ success: true;
1249
+ }>;
934
1250
  }
935
1251
  declare function omit<T extends Record<string, unknown>, K extends keyof T>(obj: T, key: K): {
936
1252
  result: Omit<T, K>;
@@ -983,6 +1299,9 @@ declare class DynamicTrigger<TEventSpec extends EventSpecification<any>, TExtern
983
1299
  }): Promise<RegisterSourceEventV2>;
984
1300
  attachToJob(triggerClient: TriggerClient, job: Job<Trigger<TEventSpec>, any>): void;
985
1301
  get preprocessRuns(): boolean;
1302
+ verifyPayload(payload: ReturnType<TEventSpec["parsePayload"]>): Promise<{
1303
+ success: true;
1304
+ }>;
986
1305
  }
987
1306
 
988
1307
  type ScheduledEventSpecification = EventSpecification<ScheduledPayload>;
@@ -1014,6 +1333,9 @@ declare class IntervalTrigger implements Trigger<ScheduledEventSpecification> {
1014
1333
  };
1015
1334
  attachToJob(triggerClient: TriggerClient, job: Job<Trigger<ScheduledEventSpecification>, any>): void;
1016
1335
  get preprocessRuns(): boolean;
1336
+ verifyPayload(payload: ReturnType<ScheduledEventSpecification["parsePayload"]>): Promise<{
1337
+ success: true;
1338
+ }>;
1017
1339
  toJSON(): TriggerMetadata;
1018
1340
  }
1019
1341
  /** `intervalTrigger()` is set as a [Job's trigger](/sdk/job) to trigger a Job at a recurring interval.
@@ -1048,6 +1370,9 @@ declare class CronTrigger implements Trigger<ScheduledEventSpecification> {
1048
1370
  };
1049
1371
  attachToJob(triggerClient: TriggerClient, job: Job<Trigger<ScheduledEventSpecification>, any>): void;
1050
1372
  get preprocessRuns(): boolean;
1373
+ verifyPayload(payload: ReturnType<ScheduledEventSpecification["parsePayload"]>): Promise<{
1374
+ success: true;
1375
+ }>;
1051
1376
  toJSON(): TriggerMetadata;
1052
1377
  }
1053
1378
  /** `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.
@@ -1114,9 +1439,147 @@ declare class DynamicSchedule implements Trigger<ScheduledEventSpecification> {
1114
1439
  }>;
1115
1440
  attachToJob(triggerClient: TriggerClient, job: Job<Trigger<ScheduledEventSpecification>, any>): void;
1116
1441
  get preprocessRuns(): boolean;
1442
+ verifyPayload(payload: ReturnType<ScheduledEventSpecification["parsePayload"]>): Promise<{
1443
+ success: true;
1444
+ }>;
1117
1445
  toJSON(): TriggerMetadata;
1118
1446
  }
1119
1447
 
1448
+ type WebhookCRUDContext<TParams extends any, TConfig extends Record<string, string[]>> = {
1449
+ active: boolean;
1450
+ params: TParams;
1451
+ config: {
1452
+ current: Partial<TConfig>;
1453
+ desired: TConfig;
1454
+ };
1455
+ url: string;
1456
+ secret: string;
1457
+ };
1458
+ type WebhookCRUDFunction<TIntegration extends TriggerIntegration, TParams extends any, TConfig extends Record<string, string[]>> = (options: {
1459
+ io: IOWithIntegrations<{
1460
+ integration: TIntegration;
1461
+ }>;
1462
+ ctx: WebhookCRUDContext<TParams, TConfig>;
1463
+ }) => Promise<any>;
1464
+ interface WebhookCRUD<TIntegration extends TriggerIntegration, TParams extends any, TConfig extends Record<string, string[]>> {
1465
+ create: WebhookCRUDFunction<TIntegration, TParams, TConfig>;
1466
+ read?: WebhookCRUDFunction<TIntegration, TParams, TConfig>;
1467
+ update?: WebhookCRUDFunction<TIntegration, TParams, TConfig>;
1468
+ delete: WebhookCRUDFunction<TIntegration, TParams, TConfig>;
1469
+ }
1470
+ type WebhookConfig<TConfigKeys extends string> = {
1471
+ [K in TConfigKeys]: string[];
1472
+ };
1473
+ type RegisterFunctionEvent<TParams extends any, TConfig extends Record<string, string[]>> = {
1474
+ source: {
1475
+ active: boolean;
1476
+ data?: any;
1477
+ secret: string;
1478
+ url: string;
1479
+ };
1480
+ params: TParams;
1481
+ config: TConfig;
1482
+ };
1483
+ type WebhookRegisterEvent<TConfig extends Record<string, string[]>> = {
1484
+ id: string;
1485
+ source: RegisterWebhookSource;
1486
+ dynamicTriggerId?: string;
1487
+ config: TConfig;
1488
+ };
1489
+ type RegisterFunctionOutput<TConfig extends Record<string, string[]>> = {
1490
+ secret?: string;
1491
+ data?: SerializableJson;
1492
+ config: TConfig;
1493
+ };
1494
+ type RegisterFunction<TIntegration extends TriggerIntegration, TParams extends any, TConfig extends Record<string, string[]>> = (event: RegisterFunctionEvent<TParams, TConfig>, io: IOWithIntegrations<{
1495
+ integration: TIntegration;
1496
+ }>, ctx: TriggerContext) => Promise<RegisterFunctionOutput<TConfig> | undefined>;
1497
+ type WebhookHandlerEvent<TParams extends any = any> = {
1498
+ rawEvent: Request;
1499
+ source: Prettify<Omit<HandleTriggerSource, "params"> & {
1500
+ params: TParams;
1501
+ }>;
1502
+ };
1503
+ type WebhookDeliveryContext = {
1504
+ key: string;
1505
+ secret: string;
1506
+ params: any;
1507
+ };
1508
+ type EventGenerator<TParams extends any, TConfig extends Record<string, string[]>, TIntegration extends TriggerIntegration> = (options: {
1509
+ request: Request;
1510
+ client: TriggerClient;
1511
+ ctx: WebhookDeliveryContext;
1512
+ }) => Promise<any>;
1513
+ type KeyFunction<TParams extends any> = (params: TParams) => string;
1514
+ type FilterFunction<TParams extends any, TConfig extends Record<string, string[]>> = (params: TParams, config?: TConfig) => EventFilter;
1515
+ type WebhookOptions<TIntegration extends TriggerIntegration, TParams extends any, TConfig extends Record<string, string[]>> = {
1516
+ id: string;
1517
+ version: string;
1518
+ integration: TIntegration;
1519
+ schemas: {
1520
+ params: SchemaParser<TParams>;
1521
+ config?: SchemaParser<TConfig>;
1522
+ };
1523
+ key: KeyFunction<TParams>;
1524
+ crud: WebhookCRUD<TIntegration, TParams, TConfig>;
1525
+ filter?: FilterFunction<TParams, TConfig>;
1526
+ register?: RegisterFunction<TIntegration, TParams, TConfig>;
1527
+ verify?: (options: {
1528
+ request: Request;
1529
+ client: TriggerClient;
1530
+ ctx: WebhookDeliveryContext;
1531
+ }) => Promise<VerifyResult>;
1532
+ generateEvents: EventGenerator<TParams, TConfig, TIntegration>;
1533
+ properties?: (params: TParams) => DisplayProperty[];
1534
+ };
1535
+ declare class WebhookSource<TIntegration extends TriggerIntegration, TParams extends any = any, TConfig extends Record<string, string[]> = Record<string, string[]>> {
1536
+ #private;
1537
+ private options;
1538
+ constructor(options: WebhookOptions<TIntegration, TParams, TConfig>);
1539
+ generateEvents(request: Request, client: TriggerClient, ctx: WebhookDeliveryContext): Promise<any>;
1540
+ filter(params: TParams, config?: TConfig): EventFilter;
1541
+ properties(params: TParams): DisplayProperty[];
1542
+ get crud(): WebhookCRUD<TIntegration, TParams, TConfig>;
1543
+ register(params: TParams, registerEvent: WebhookRegisterEvent<TConfig>, io: IO, ctx: TriggerContext): Promise<RegisterFunctionOutput<TConfig> | undefined>;
1544
+ verify(request: Request, client: TriggerClient, ctx: WebhookDeliveryContext): Promise<VerifyResult>;
1545
+ key(params: TParams): string;
1546
+ get integration(): TIntegration;
1547
+ get integrationConfig(): {
1548
+ id: string;
1549
+ metadata: {
1550
+ id: string;
1551
+ name: string;
1552
+ instructions?: string | undefined;
1553
+ };
1554
+ };
1555
+ get id(): string;
1556
+ get version(): string;
1557
+ }
1558
+ type GetWebhookParams<TWebhook extends WebhookSource<any, any, any>> = TWebhook extends WebhookSource<any, infer TParams, any> ? TParams : never;
1559
+ type GetWebhookConfig<TWebhook extends WebhookSource<any, any, any>> = TWebhook extends WebhookSource<any, any, infer TConfig> ? TConfig : never;
1560
+ type WebhookTriggerOptions<TEventSpecification extends EventSpecification<any>, TEventSource extends WebhookSource<any, any, any>, TConfig extends Record<string, string[]> = Record<string, string[]>> = {
1561
+ event: TEventSpecification;
1562
+ source: TEventSource;
1563
+ params: GetWebhookParams<TEventSource>;
1564
+ config: TConfig;
1565
+ };
1566
+ declare class WebhookTrigger<TEventSpecification extends EventSpecification<any>, TEventSource extends WebhookSource<any, any, any>> implements Trigger<TEventSpecification> {
1567
+ private options;
1568
+ constructor(options: WebhookTriggerOptions<TEventSpecification, TEventSource>);
1569
+ get event(): TEventSpecification;
1570
+ get source(): TEventSource;
1571
+ get key(): string;
1572
+ toJSON(): TriggerMetadata;
1573
+ filter(eventFilter: EventFilter): WebhookTrigger<Omit<TEventSpecification, "filter"> & {
1574
+ filter: EventFilter;
1575
+ }, TEventSource>;
1576
+ attachToJob(triggerClient: TriggerClient, job: Job<Trigger<TEventSpecification>, any>): void;
1577
+ get preprocessRuns(): boolean;
1578
+ verifyPayload(payload: ReturnType<TEventSpecification["parsePayload"]>): Promise<{
1579
+ success: true;
1580
+ }>;
1581
+ }
1582
+
1120
1583
  type TriggerClientOptions = {
1121
1584
  /** The `id` property is used to uniquely identify the client.
1122
1585
  */
@@ -1147,11 +1610,20 @@ declare class TriggerClient {
1147
1610
  #private;
1148
1611
  id: string;
1149
1612
  constructor(options: Prettify<TriggerClientOptions>);
1613
+ on: <E extends keyof NotificationEvents>(event: E, listener: NotificationEvents[E]) => NotificationsEventEmitter;
1150
1614
  handleRequest(request: Request, timeOrigin?: number): Promise<NormalizedResponse>;
1151
- defineJob<TTrigger extends Trigger<EventSpecification<any>>, TIntegrations extends Record<string, TriggerIntegration> = {}>(options: JobOptions<TTrigger, TIntegrations>): Job<TTrigger, TIntegrations>;
1615
+ defineJob<TTrigger extends Trigger<EventSpecification<any>>, TIntegrations extends Record<string, TriggerIntegration> = {}, TOutput extends any = any>(options: JobOptions<TTrigger, TIntegrations, TOutput>): Job<TTrigger, TIntegrations, TOutput>;
1152
1616
  defineAuthResolver(integration: TriggerIntegration, resolver: TriggerAuthResolver): TriggerClient;
1153
1617
  defineDynamicSchedule(options: DynamicIntervalOptions): DynamicSchedule;
1154
1618
  defineDynamicTrigger<TEventSpec extends EventSpecification<any>, TExternalSource extends ExternalSource<any, any, any>>(options: DynamicTriggerOptions<TEventSpec, TExternalSource>): DynamicTrigger<TEventSpec, TExternalSource>;
1619
+ /**
1620
+ * An [HTTP endpoint](https://trigger.dev/docs/documentation/concepts/http-endpoints) allows you to create a [HTTP Trigger](https://trigger.dev/docs/documentation/concepts/triggers/http), which means you can trigger your Jobs from any webhooks.
1621
+ * @param options The Endpoint options
1622
+ * @returns An HTTP Endpoint, that can be used to create an HTTP Trigger.
1623
+ * @link https://trigger.dev/docs/documentation/concepts/http-endpoints
1624
+ */
1625
+ defineHttpEndpoint(options: EndpointOptions, suppressWarnings?: boolean): HttpEndpoint<EventSpecification<Request, Request>>;
1626
+ defineConcurrencyLimit(options: ConcurrencyLimitOptions): ConcurrencyLimit;
1155
1627
  attach(job: Job<Trigger<any>, any>): void;
1156
1628
  attachDynamicTrigger(trigger: DynamicTrigger<any, any>): void;
1157
1629
  attachJobToDynamicTrigger(job: Job<Trigger<any>, any>, trigger: DynamicTrigger<any, any>): void;
@@ -1164,6 +1636,13 @@ declare class TriggerClient {
1164
1636
  }): void;
1165
1637
  attachDynamicSchedule(key: string): void;
1166
1638
  attachDynamicScheduleToJob(key: string, job: Job<Trigger<any>, any>): void;
1639
+ attachWebhook<TIntegration extends TriggerIntegration, TParams extends any, TConfig extends Record<string, string[]>>(options: {
1640
+ key: string;
1641
+ source: WebhookSource<TIntegration, TParams, TConfig>;
1642
+ event: EventSpecification<any>;
1643
+ params: any;
1644
+ config: TConfig;
1645
+ }): void;
1167
1646
  registerTrigger(id: string, key: string, options: RegisterTriggerBodyV2, idempotencyKey?: string): Promise<{
1168
1647
  id: string;
1169
1648
  options: {
@@ -1220,6 +1699,25 @@ declare class TriggerClient {
1220
1699
  deliveredAt?: Date | null | undefined;
1221
1700
  cancelledAt?: Date | null | undefined;
1222
1701
  }>;
1702
+ /** You can call this function from anywhere in your backend to send multiple events. The other way to send multiple events is by using [`io.sendEvents()`](https://trigger.dev/docs/sdk/io/sendevents) from inside a `run()` function.
1703
+ * @param events The events to send.
1704
+ * @param options Options for sending the events.
1705
+ * @returns A promise that resolves to an array of event details
1706
+ */
1707
+ sendEvents(events: SendEvent[], options?: SendEventOptions): Promise<{
1708
+ id: string;
1709
+ name: string;
1710
+ payload: ((string | number | boolean | {
1711
+ [key: string]: DeserializedJson;
1712
+ } | DeserializedJson[]) & (string | number | boolean | {
1713
+ [key: string]: DeserializedJson;
1714
+ } | DeserializedJson[] | undefined)) | null;
1715
+ timestamp: Date;
1716
+ context?: DeserializedJson | undefined;
1717
+ deliverAt?: Date | null | undefined;
1718
+ deliveredAt?: Date | null | undefined;
1719
+ cancelledAt?: Date | null | undefined;
1720
+ }[]>;
1223
1721
  cancelEvent(eventId: string): Promise<{
1224
1722
  id: string;
1225
1723
  name: string;
@@ -1278,7 +1776,7 @@ declare class TriggerClient {
1278
1776
  updatedAt: Date;
1279
1777
  runs: {
1280
1778
  id: string;
1281
- status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD";
1779
+ status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD" | "EXECUTING" | "WAITING_TO_CONTINUE" | "WAITING_TO_EXECUTE";
1282
1780
  startedAt?: Date | null | undefined;
1283
1781
  completedAt?: Date | null | undefined;
1284
1782
  }[];
@@ -1288,7 +1786,7 @@ declare class TriggerClient {
1288
1786
  id: string;
1289
1787
  startedAt: Date | null;
1290
1788
  completedAt: Date | null;
1291
- status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD";
1789
+ status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD" | "EXECUTING" | "WAITING_TO_CONTINUE" | "WAITING_TO_EXECUTE";
1292
1790
  updatedAt: Date | null;
1293
1791
  tasks: _trigger_dev_core.RunTaskWithSubtasks[];
1294
1792
  statuses: {
@@ -1309,7 +1807,7 @@ declare class TriggerClient {
1309
1807
  id: string;
1310
1808
  startedAt: Date | null;
1311
1809
  completedAt: Date | null;
1312
- status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD";
1810
+ status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD" | "EXECUTING" | "WAITING_TO_CONTINUE" | "WAITING_TO_EXECUTE";
1313
1811
  updatedAt: Date | null;
1314
1812
  tasks: _trigger_dev_core.RunTaskWithSubtasks[];
1315
1813
  statuses: {
@@ -1331,7 +1829,7 @@ declare class TriggerClient {
1331
1829
  id: string;
1332
1830
  startedAt: Date | null;
1333
1831
  completedAt: Date | null;
1334
- status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD";
1832
+ status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD" | "EXECUTING" | "WAITING_TO_CONTINUE" | "WAITING_TO_EXECUTE";
1335
1833
  updatedAt: Date | null;
1336
1834
  }[];
1337
1835
  nextCursor?: string | undefined;
@@ -1350,10 +1848,19 @@ declare class TriggerClient {
1350
1848
  }[];
1351
1849
  run: {
1352
1850
  id: string;
1353
- status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD";
1851
+ status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD" | "EXECUTING" | "WAITING_TO_CONTINUE" | "WAITING_TO_EXECUTE";
1354
1852
  output?: any;
1355
1853
  };
1356
1854
  }>;
1855
+ invokeJob(jobId: string, payload: any, options?: InvokeOptions): Promise<{
1856
+ id: string;
1857
+ }>;
1858
+ createEphemeralEventDispatcher(payload: EphemeralEventDispatcherRequestBody): Promise<{
1859
+ id: string;
1860
+ }>;
1861
+ get store(): {
1862
+ env: KeyValueStore;
1863
+ };
1357
1864
  authorized(apiKey?: string | null): "authorized" | "unauthorized" | "missing-client" | "missing-header";
1358
1865
  apiKey(): string | undefined;
1359
1866
  }
@@ -1361,6 +1868,7 @@ declare class TriggerClient {
1361
1868
  type IOTask = ServerTask;
1362
1869
  type IOOptions = {
1363
1870
  id: string;
1871
+ jobId: string;
1364
1872
  apiClient: ApiClient;
1365
1873
  client: TriggerClient;
1366
1874
  context: TriggerContext;
@@ -1397,9 +1905,23 @@ type IOStats = {
1397
1905
  noopCachedTaskHits: number;
1398
1906
  noopCachedTaskMisses: number;
1399
1907
  };
1908
+ interface OutputSerializer {
1909
+ serialize(value: any): string;
1910
+ deserialize<T>(value: string): T;
1911
+ }
1912
+ declare class JSONOutputSerializer implements OutputSerializer {
1913
+ serialize(value: any): string;
1914
+ deserialize(value?: string): any;
1915
+ }
1916
+ type BackgroundFetchResponse<T> = {
1917
+ status: number;
1918
+ data: T;
1919
+ headers: Record<string, string>;
1920
+ };
1400
1921
  declare class IO {
1401
1922
  #private;
1402
1923
  private _id;
1924
+ private _jobId;
1403
1925
  private _apiClient;
1404
1926
  private _triggerClient;
1405
1927
  private _logger;
@@ -1410,21 +1932,68 @@ declare class IO {
1410
1932
  private _cachedTasksCursor?;
1411
1933
  private _context;
1412
1934
  private _yieldedExecutions;
1413
- private _noopTasksRawData;
1414
- private __noopTasksBloomFilter;
1935
+ private _noopTasksBloomFilter;
1415
1936
  private _stats;
1416
1937
  private _serverVersion;
1417
1938
  private _timeOrigin;
1418
1939
  private _executionTimeout?;
1940
+ private _outputSerializer;
1941
+ private _visitedCacheKeys;
1942
+ private _envStore;
1943
+ private _jobStore;
1944
+ private _runStore;
1419
1945
  get stats(): IOStats;
1420
1946
  constructor(options: IOOptions);
1421
1947
  /** Used to send log messages to the [Run log](https://trigger.dev/docs/documentation/guides/viewing-runs). */
1422
1948
  get logger(): IOLogger;
1949
+ /** `io.random()` is identical to `Math.random()` when called without options but ensures your random numbers are not regenerated on resume or retry. It will return a pseudo-random floating-point number between optional `min` (default: 0, inclusive) and `max` (default: 1, exclusive). Can optionally `round` to the nearest integer.
1950
+ * @param cacheKey Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
1951
+ * @param min Sets the lower bound (inclusive). Can't be higher than `max`.
1952
+ * @param max Sets the upper bound (exclusive). Can't be lower than `min`.
1953
+ * @param round Controls rounding to the nearest integer. Any `max` integer will become inclusive when enabled. Rounding with floating-point bounds may cause unexpected skew and boundary inclusivity.
1954
+ */
1955
+ random(cacheKey: string | any[], { min, max, round, }?: {
1956
+ min?: number;
1957
+ max?: number;
1958
+ round?: boolean;
1959
+ }): Promise<number>;
1423
1960
  /** `io.wait()` waits for the specified amount of time before continuing the Job. Delays work even if you're on a serverless platform with timeouts, or if your server goes down. They utilize [resumability](https://trigger.dev/docs/documentation/concepts/resumability) to ensure that the Run can be resumed after the delay.
1424
1961
  * @param cacheKey Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
1425
1962
  * @param seconds The number of seconds to wait. This can be very long, serverless timeouts are not an issue.
1426
1963
  */
1427
1964
  wait(cacheKey: string | any[], seconds: number): Promise<void>;
1965
+ waitForEvent<T extends z.ZodTypeAny = z.ZodTypeAny>(cacheKey: string | any[], event: {
1966
+ name: string;
1967
+ schema?: T;
1968
+ filter?: EventFilter;
1969
+ source?: string;
1970
+ contextFilter?: EventFilter;
1971
+ accountId?: string;
1972
+ }, options?: {
1973
+ timeoutInSeconds?: number;
1974
+ }): Promise<WaitForEventResult<z.output<T>>>;
1975
+ /** `io.waitForRequest()` allows you to pause the execution of a run until the url provided in the callback is POSTed to.
1976
+ * This is useful for integrating with external services that require a callback URL to be provided, or if you want to be able to wait until an action is performed somewhere else in your system.
1977
+ * @param cacheKey Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
1978
+ * @param callback A callback function that will provide the unique URL to POST to.
1979
+ * @param options Options for the callback.
1980
+ * @param options.timeoutInSeconds How long to wait for the request to be POSTed to the callback URL before timing out. Defaults to 1hr.
1981
+ * @returns The POSTed request JSON body.
1982
+ * @example
1983
+ * ```ts
1984
+ const result = await io.waitForRequest<{ message: string }>(
1985
+ "wait-for-request",
1986
+ async (url, task) => {
1987
+ // Save the URL somewhere so you can POST to it later
1988
+ // Or send it to an external service that will POST to it
1989
+ },
1990
+ { timeoutInSeconds: 60 } // wait 60 seconds
1991
+ );
1992
+ * ```
1993
+ */
1994
+ waitForRequest<T extends Json<T> | unknown = unknown>(cacheKey: string | any[], callback: (url: string) => Promise<unknown>, options?: {
1995
+ timeoutInSeconds?: number;
1996
+ }): Promise<T>;
1428
1997
  /** `io.createStatus()` allows you to set a status with associated data during the Run. Statuses can be used by your UI using the react package
1429
1998
  * @param cacheKey Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
1430
1999
  * @param initialStatus The initial status you want this status to have. You can update it during the rub using the returned object.
@@ -1469,8 +2038,60 @@ declare class IO {
1469
2038
  * - Ranges: 500-599
1470
2039
  * - Wildcards: 2xx, 3xx, 4xx, 5xx
1471
2040
  */
1472
- backgroundFetch<TResponseData>(cacheKey: string | any[], url: string, requestInit?: FetchRequestInit, retry?: FetchRetryOptions): Promise<TResponseData>;
1473
- /** `io.sendEvent()` allows you to send an event from inside a Job run. The sent even will trigger any Jobs that are listening for that event (based on the name).
2041
+ backgroundFetch<TResponseData>(cacheKey: string | any[], url: string, requestInit?: FetchRequestInit, options?: {
2042
+ retry?: FetchRetryOptions;
2043
+ timeout?: FetchTimeoutOptions;
2044
+ }): Promise<TResponseData>;
2045
+ /** `io.backgroundPoll()` will fetch data from a URL on an interval. The actual `fetch` requests are performed on the Trigger.dev server, so you don't have to worry about serverless function timeouts.
2046
+ * @param cacheKey Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
2047
+ * @param params The options for the background poll
2048
+ * @param params.url The URL to fetch from.
2049
+ * @param params.requestInit The options for the request, like headers and method
2050
+ * @param params.responseFilter An [EventFilter](https://trigger.dev/docs/documentation/guides/event-filter) that allows you to specify when to stop polling.
2051
+ * @param params.interval The interval in seconds to poll the URL in seconds. Defaults to 10 seconds which is the minimum.
2052
+ * @param params.timeout The timeout in seconds for each request in seconds. Defaults to 10 minutes. Minimum is 60 seconds and max is 1 hour
2053
+ * @param params.requestTimeout An optional object that allows you to timeout individual fetch requests
2054
+ * @param params.requestTimeout An optional object that allows you to timeout individual fetch requests
2055
+ * @param params.requestTimeout.durationInMs The duration in milliseconds to timeout the request
2056
+ *
2057
+ * @example
2058
+ * ```ts
2059
+ * const result = await io.backgroundPoll<{ id: string; status: string; }>("poll", {
2060
+ url: `http://localhost:3030/api/v1/runs/${run.id}`,
2061
+ requestInit: {
2062
+ headers: {
2063
+ Accept: "application/json",
2064
+ Authorization: redactString`Bearer ${process.env["TRIGGER_API_KEY"]!}`,
2065
+ },
2066
+ },
2067
+ interval: 10,
2068
+ timeout: 600,
2069
+ responseFilter: {
2070
+ status: [200],
2071
+ body: {
2072
+ status: ["SUCCESS"],
2073
+ },
2074
+ },
2075
+ });
2076
+ * ```
2077
+ */
2078
+ backgroundPoll<TResponseData>(cacheKey: string | any[], params: FetchPollOperation): Promise<TResponseData>;
2079
+ /** `io.backgroundFetchResponse()` fetches data from a URL that can take longer that the serverless timeout. The actual `fetch` request is performed on the Trigger.dev platform, and the response is sent back to you.
2080
+ * @param cacheKey Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
2081
+ * @param url The URL to fetch from.
2082
+ * @param requestInit The options for the request
2083
+ * @param retry The options for retrying the request if it fails
2084
+ * An object where the key is a status code pattern and the value is a retrying strategy.
2085
+ * Supported patterns are:
2086
+ * - Specific status codes: 429
2087
+ * - Ranges: 500-599
2088
+ * - Wildcards: 2xx, 3xx, 4xx, 5xx
2089
+ */
2090
+ backgroundFetchResponse<TResponseData>(cacheKey: string | any[], url: string, requestInit?: FetchRequestInit, options?: {
2091
+ retry?: FetchRetryOptions;
2092
+ timeout?: FetchTimeoutOptions;
2093
+ }): Promise<BackgroundFetchResponse<TResponseData>>;
2094
+ /** `io.sendEvent()` allows you to send an event from inside a Job run. The sent event will trigger any Jobs that are listening for that event (based on the name).
1474
2095
  * @param cacheKey Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
1475
2096
  * @param event The event to send. The event name must match the name of the event that your Jobs are listening for.
1476
2097
  * @param options Options for sending the event.
@@ -1489,13 +2110,32 @@ declare class IO {
1489
2110
  deliveredAt?: Date | null | undefined;
1490
2111
  cancelledAt?: Date | null | undefined;
1491
2112
  }>;
2113
+ /** `io.sendEvents()` allows you to send multiple events from inside a Job run. The sent events will trigger any Jobs that are listening for those events (based on the name).
2114
+ * @param cacheKey Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
2115
+ * @param event The events to send. The event names must match the names of the events that your Jobs are listening for.
2116
+ * @param options Options for sending the events.
2117
+ */
2118
+ sendEvents(cacheKey: string | any[], events: SendEvent[], options?: SendEventOptions): Promise<{
2119
+ id: string;
2120
+ name: string;
2121
+ payload: ((string | number | boolean | {
2122
+ [key: string]: _trigger_dev_core.DeserializedJson;
2123
+ } | _trigger_dev_core.DeserializedJson[]) & (string | number | boolean | {
2124
+ [key: string]: _trigger_dev_core.DeserializedJson;
2125
+ } | _trigger_dev_core.DeserializedJson[] | undefined)) | null;
2126
+ timestamp: Date;
2127
+ context?: _trigger_dev_core.DeserializedJson | undefined;
2128
+ deliverAt?: Date | null | undefined;
2129
+ deliveredAt?: Date | null | undefined;
2130
+ cancelledAt?: Date | null | undefined;
2131
+ }[]>;
1492
2132
  getEvent(cacheKey: string | any[], id: string): Promise<{
1493
2133
  id: string;
1494
2134
  name: string;
1495
2135
  updatedAt: Date;
1496
2136
  runs: {
1497
2137
  id: string;
1498
- status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD";
2138
+ status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD" | "EXECUTING" | "WAITING_TO_CONTINUE" | "WAITING_TO_EXECUTE";
1499
2139
  startedAt?: Date | null | undefined;
1500
2140
  completedAt?: Date | null | undefined;
1501
2141
  }[];
@@ -1526,6 +2166,12 @@ declare class IO {
1526
2166
  id: string;
1527
2167
  key: string;
1528
2168
  }>;
2169
+ updateWebhook(cacheKey: string | any[], options: {
2170
+ key: string;
2171
+ } & UpdateWebhookBody): Promise<{
2172
+ id: string;
2173
+ key: string;
2174
+ }>;
1529
2175
  /** `io.registerInterval()` allows you to register a [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) that will trigger any jobs it's attached to on a regular interval.
1530
2176
  * @param cacheKey Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
1531
2177
  * @param dynamicSchedule The [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) to register a new schedule on.
@@ -1611,6 +2257,7 @@ declare class IO {
1611
2257
  key: string;
1612
2258
  } | undefined>;
1613
2259
  getAuth(cacheKey: string | any[], clientId?: string): Promise<ConnectionAuth | undefined>;
2260
+ parallel<T extends Json<T> | void, TItem>(cacheKey: string | any[], items: Array<TItem>, callback: (item: TItem, index: number) => Promise<T>, options?: Pick<RunTaskOptions, "name" | "properties">): Promise<Array<T>>;
1614
2261
  /** `io.runTask()` allows you to run a [Task](https://trigger.dev/docs/documentation/concepts/tasks) from inside a Job run. A Task is a resumable unit of a Run that can be retried, resumed and is logged. [Integrations](https://trigger.dev/docs/integrations) use Tasks internally to perform their actions.
1615
2262
  *
1616
2263
  * @param cacheKey Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
@@ -1619,7 +2266,9 @@ declare class IO {
1619
2266
  * @param onError The callback that will be called when the Task fails. The callback receives the error, the Task and the IO as parameters. If you wish to retry then return an object with a `retryAt` property.
1620
2267
  * @returns A Promise that resolves with the returned value of the callback.
1621
2268
  */
1622
- runTask<T extends Json<T> | void>(cacheKey: string | any[], callback: (task: ServerTask, io: IO) => Promise<T>, options?: RunTaskOptions, onError?: RunTaskErrorCallback): Promise<T>;
2269
+ runTask<T extends Json<T> | void>(cacheKey: string | any[], callback: (task: ServerTask, io: IO) => Promise<T>, options?: RunTaskOptions & {
2270
+ parseOutput?: (output: unknown) => T;
2271
+ }, onError?: RunTaskErrorCallback): Promise<T>;
1623
2272
  /**
1624
2273
  * `io.yield()` allows you to yield execution of the current run and resume it in a new function execution. Similar to `io.wait()` but does not create a task and resumes execution immediately.
1625
2274
  */
@@ -1628,13 +2277,18 @@ declare class IO {
1628
2277
  * `io.brb()` is an alias of `io.yield()`
1629
2278
  */
1630
2279
  brb: (cacheKey: string) => void;
1631
- /** `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).
2280
+ /** `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()](https://trigger.dev/docs/sdk/io/runtask).
1632
2281
  * 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.
1633
2282
  * @param tryCallback The code you wish to run
1634
2283
  * @param catchCallback Thhis will be called if the Task fails. The callback receives the error
1635
2284
  * @returns A Promise that resolves with the returned value or the error
1636
2285
  */
1637
2286
  try<TResult, TCatchResult>(tryCallback: () => Promise<TResult>, catchCallback: (error: unknown) => Promise<TCatchResult>): Promise<TResult | TCatchResult>;
2287
+ get store(): {
2288
+ env: KeyValueStore;
2289
+ job: KeyValueStore;
2290
+ run: KeyValueStore;
2291
+ };
1638
2292
  }
1639
2293
  type CallbackFunction = (level: "DEBUG" | "INFO" | "WARN" | "ERROR" | "LOG", message: string, properties?: Record<string, any>) => Promise<void>;
1640
2294
  declare class IOLogger implements TaskLogger {
@@ -1661,7 +2315,7 @@ interface TriggerIntegration {
1661
2315
  type IOWithIntegrations<TIntegrations extends Record<string, TriggerIntegration>> = IO & TIntegrations;
1662
2316
  type IntegrationTaskKey = string | any[];
1663
2317
 
1664
- type JobOptions<TTrigger extends Trigger<EventSpecification<any>>, TIntegrations extends Record<string, TriggerIntegration> = {}> = {
2318
+ type JobOptions<TTrigger extends Trigger<EventSpecification<any>>, TIntegrations extends Record<string, TriggerIntegration> = {}, TOutput extends any = any> = {
1665
2319
  /** The `id` property is used to uniquely identify the Job. Only change this if you want to create a new Job. */
1666
2320
  id: string;
1667
2321
  /** The `name` of the Job that you want to appear in the dashboard and logs. You can change this without creating a new Job. */
@@ -1696,9 +2350,15 @@ type JobOptions<TTrigger extends Trigger<EventSpecification<any>>, TIntegrations
1696
2350
  });
1697
2351
  ``` */
1698
2352
  integrations?: TIntegrations;
1699
- /** @deprecated This property is deprecated and no longer effects the execution of the Job
1700
- * */
1701
- queue?: QueueOptions | string;
2353
+ /**
2354
+ * The `concurrencyLimit` property is used to limit the number of concurrent run executions of a job.
2355
+ * Can be a number which represents the limit or a `ConcurrencyLimit` instance which can be used to
2356
+ * group together multiple jobs to share the same concurrency limit.
2357
+ *
2358
+ * If undefined the job will be limited only by the server's global concurrency limit, or if you are using the
2359
+ * Trigger.dev Cloud service, the concurrency limit of your plan.
2360
+ */
2361
+ concurrencyLimit?: number | ConcurrencyLimit;
1702
2362
  /** The `enabled` property is used to enable or disable the Job. If you disable a Job, it will not run. */
1703
2363
  enabled?: boolean;
1704
2364
  /** This function gets called automatically when a Run is Triggered.
@@ -1707,19 +2367,22 @@ type JobOptions<TTrigger extends Trigger<EventSpecification<any>>, TIntegrations
1707
2367
  * @param io An object that contains the integrations that you specified in the `integrations` property and other useful functions like delays and running Tasks.
1708
2368
  * @param context An object that contains information about the Organization, Job, Run and more.
1709
2369
  */
1710
- run: (payload: TriggerEventType<TTrigger>, io: IOWithIntegrations<TIntegrations>, context: TriggerContext) => Promise<any>;
2370
+ run: (payload: TriggerEventType<TTrigger>, io: IOWithIntegrations<TIntegrations>, context: TriggerContext) => Promise<TOutput>;
2371
+ onSuccess?: (notification: SuccessfulRunNotification<TOutput, TriggerEventType<TTrigger>>) => void;
2372
+ onFailure?: (notification: FailedRunNotification<TriggerEventType<TTrigger>>) => void;
1711
2373
  };
1712
2374
  type JobPayload<TJob> = TJob extends Job<Trigger<EventSpecification<infer TEvent>>, any> ? TEvent : never;
1713
2375
  type JobIO<TJob> = TJob extends Job<any, infer TIntegrations> ? IOWithIntegrations<TIntegrations> : never;
1714
2376
  /** 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. */
1715
- declare class Job<TTrigger extends Trigger<EventSpecification<any>>, TIntegrations extends Record<string, TriggerIntegration> = {}> {
2377
+ declare class Job<TTrigger extends Trigger<EventSpecification<any>>, TIntegrations extends Record<string, TriggerIntegration> = {}, TOutput extends any = any> {
1716
2378
  #private;
1717
- readonly options: JobOptions<TTrigger, TIntegrations>;
1718
- client: TriggerClient;
1719
- constructor(
1720
- /** An instance of [TriggerClient](/sdk/triggerclient) that is used to send events
1721
- to the Trigger API. */
1722
- client: TriggerClient, options: JobOptions<TTrigger, TIntegrations>);
2379
+ readonly options: JobOptions<TTrigger, TIntegrations, TOutput>;
2380
+ client?: TriggerClient;
2381
+ constructor(options: JobOptions<TTrigger, TIntegrations, TOutput>);
2382
+ /**
2383
+ * Attaches the job to a client. This is called automatically when you define a job using `client.defineJob()`.
2384
+ */
2385
+ attachToClient(client: TriggerClient): void;
1723
2386
  get id(): string;
1724
2387
  get enabled(): boolean;
1725
2388
  get name(): string;
@@ -1728,6 +2391,19 @@ declare class Job<TTrigger extends Trigger<EventSpecification<any>>, TIntegratio
1728
2391
  get logLevel(): LogLevel | undefined;
1729
2392
  get integrations(): Record<string, IntegrationConfig>;
1730
2393
  toJSON(): JobMetadata;
2394
+ invoke(cacheKey: string, payload: TriggerInvokeType<TTrigger>, options?: InvokeOptions): Promise<{
2395
+ id: string;
2396
+ }>;
2397
+ invoke(payload: TriggerInvokeType<TTrigger>, options?: InvokeOptions): Promise<{
2398
+ id: string;
2399
+ }>;
2400
+ invokeAndWaitForCompletion(cacheKey: string | string[], payload: TriggerInvokeType<TTrigger>, timeoutInSeconds?: number, // 1 hour
2401
+ options?: Prettify<Pick<InvokeOptions, "accountId" | "context">>): Promise<RunNotification<TOutput>>;
2402
+ batchInvokeAndWaitForCompletion(cacheKey: string | string[], batch: Array<{
2403
+ payload: TriggerInvokeType<TTrigger>;
2404
+ timeoutInSeconds?: number;
2405
+ options?: Prettify<Pick<InvokeOptions, "accountId" | "context">>;
2406
+ }>): Promise<Array<RunNotification<TOutput>>>;
1731
2407
  }
1732
2408
 
1733
2409
  type EventTriggerOptions<TEventSpecification extends EventSpecification<any>> = {
@@ -1735,6 +2411,7 @@ type EventTriggerOptions<TEventSpecification extends EventSpecification<any>> =
1735
2411
  name?: string | string[];
1736
2412
  source?: string;
1737
2413
  filter?: EventFilter;
2414
+ verify?: EventTypeFromSpecification<TEventSpecification> extends Request ? VerifyCallback : never;
1738
2415
  };
1739
2416
  declare class EventTrigger<TEventSpecification extends EventSpecification<any>> implements Trigger<TEventSpecification> {
1740
2417
  #private;
@@ -1743,6 +2420,7 @@ declare class EventTrigger<TEventSpecification extends EventSpecification<any>>
1743
2420
  get event(): TEventSpecification;
1744
2421
  attachToJob(triggerClient: TriggerClient, job: Job<Trigger<TEventSpecification>, any>): void;
1745
2422
  get preprocessRuns(): boolean;
2423
+ verifyPayload(payload: ReturnType<TEventSpecification["parsePayload"]>): Promise<VerifyResult>;
1746
2424
  }
1747
2425
  /** Configuration options for an EventTrigger */
1748
2426
  type TriggerOptions<TEvent> = {
@@ -1829,6 +2507,9 @@ declare class MissingConnectionNotification implements Trigger<MissingConnection
1829
2507
  };
1830
2508
  attachToJob(triggerClient: TriggerClient, job: Job<Trigger<MissingConnectionNotificationSpecification>, any>): void;
1831
2509
  get preprocessRuns(): boolean;
2510
+ verifyPayload(payload: ReturnType<MissingConnectionNotificationSpecification["parsePayload"]>): Promise<{
2511
+ success: true;
2512
+ }>;
1832
2513
  toJSON(): TriggerMetadata;
1833
2514
  }
1834
2515
  type MissingConnectionResolvedNotificationSpecification = EventSpecification<MissingConnectionResolvedNotificationPayload>;
@@ -1878,13 +2559,74 @@ declare class MissingConnectionResolvedNotification implements Trigger<MissingCo
1878
2559
  };
1879
2560
  attachToJob(triggerClient: TriggerClient, job: Job<Trigger<MissingConnectionResolvedNotificationSpecification>, any>): void;
1880
2561
  get preprocessRuns(): boolean;
2562
+ verifyPayload(payload: ReturnType<MissingConnectionResolvedNotificationSpecification["parsePayload"]>): Promise<{
2563
+ success: true;
2564
+ }>;
1881
2565
  toJSON(): TriggerMetadata;
1882
2566
  }
1883
2567
 
2568
+ /** Configuration options for an InvokeTrigger */
2569
+ type InvokeTriggerOptions<TSchema extends ZodType = z.ZodTypeAny> = {
2570
+ /** A [Zod](https://trigger.dev/docs/documentation/guides/zod) schema that defines the shape of the event payload.
2571
+ * The default is `z.any()` which is `any`.
2572
+ * */
2573
+ schema?: TSchema;
2574
+ examples?: EventSpecificationExample[];
2575
+ };
2576
+ declare class InvokeTrigger<TSchema extends ZodType = z.ZodTypeAny> implements Trigger<EventSpecification<TypeOf<TSchema>, z.input<TSchema>>> {
2577
+ #private;
2578
+ constructor(options: InvokeTriggerOptions<TSchema>);
2579
+ toJSON(): TriggerMetadata;
2580
+ get event(): {
2581
+ name: string;
2582
+ title: string;
2583
+ source: string;
2584
+ examples: {
2585
+ id: string;
2586
+ name: string;
2587
+ icon?: string | undefined;
2588
+ payload?: any;
2589
+ }[];
2590
+ icon: string;
2591
+ parsePayload: (rawPayload: unknown) => any;
2592
+ parseInvokePayload: (rawPayload: unknown) => any;
2593
+ };
2594
+ attachToJob(triggerClient: TriggerClient, job: Job<Trigger<EventSpecification<ZodType<TSchema>>>, any>): void;
2595
+ get preprocessRuns(): boolean;
2596
+ verifyPayload(): Promise<{
2597
+ success: true;
2598
+ }>;
2599
+ }
2600
+ declare function invokeTrigger<TSchema extends ZodType = z.ZodTypeAny>(options?: InvokeTriggerOptions<TSchema>): Trigger<EventSpecification<TypeOf<TSchema>, z.input<TSchema>>>;
2601
+
2602
+ declare function slugifyId(input: string): string;
2603
+
2604
+ /** Easily verify webhook payloads when they're using common signing methods. */
2605
+ declare function verifyRequestSignature({ request, headerName, headerEncoding, secret, algorithm, }: {
2606
+ /** The web request that you want to verify. */
2607
+ request: Request;
2608
+ /** The name of the header that contains the signature. E.g. `X-Cal-Signature-256`. */
2609
+ headerName: string;
2610
+ /** The header encoding. Defaults to `hex`. */
2611
+ headerEncoding?: BinaryToTextEncoding;
2612
+ /** The secret that you use to hash the payload. For HttpEndpoints this will usually originally
2613
+ come from the Trigger.dev dashboard and should be stored in an environment variable. */
2614
+ secret: BinaryLike | KeyObject;
2615
+ /** The hashing algorithm that was used to create the signature. Currently only `sha256` is
2616
+ supported. */
2617
+ algorithm: "sha256";
2618
+ }): Promise<VerifyResult>;
2619
+ declare function verifyHmacSha256(headerValue: string, headerEncoding: BinaryToTextEncoding, secret: BinaryLike | KeyObject, body: string): boolean;
2620
+
1884
2621
  declare class ResumeWithTaskError {
1885
2622
  task: ServerTask;
1886
2623
  constructor(task: ServerTask);
1887
2624
  }
2625
+ declare class ResumeWithParallelTaskError {
2626
+ task: ServerTask;
2627
+ childErrors: Array<TriggerInternalError>;
2628
+ constructor(task: ServerTask, childErrors: Array<TriggerInternalError>);
2629
+ }
1888
2630
  declare class RetryWithTaskError {
1889
2631
  cause: ErrorWithStack;
1890
2632
  task: ServerTask;
@@ -1908,25 +2650,26 @@ declare class AutoYieldExecutionError {
1908
2650
  declare class AutoYieldWithCompletedTaskExecutionError {
1909
2651
  id: string;
1910
2652
  properties: DisplayProperty[] | undefined;
1911
- output: any;
1912
2653
  data: {
1913
2654
  location: string;
1914
2655
  timeRemaining: number;
1915
2656
  timeElapsed: number;
1916
2657
  };
1917
- constructor(id: string, properties: DisplayProperty[] | undefined, output: any, data: {
2658
+ output?: string | undefined;
2659
+ constructor(id: string, properties: DisplayProperty[] | undefined, data: {
1918
2660
  location: string;
1919
2661
  timeRemaining: number;
1920
2662
  timeElapsed: number;
1921
- });
2663
+ }, output?: string | undefined);
1922
2664
  }
2665
+ type TriggerInternalError = ResumeWithTaskError | RetryWithTaskError | CanceledWithTaskError | YieldExecutionError | AutoYieldExecutionError | AutoYieldWithCompletedTaskExecutionError | ResumeWithParallelTaskError;
1923
2666
  /** Use this function if you're using a `try/catch` block to catch errors.
1924
2667
  * It checks if a thrown error is a special internal error that you should ignore.
1925
2668
  * If this returns `true` then you must rethrow the error: `throw err;`
1926
2669
  * @param err The error to check
1927
2670
  * @returns `true` if the error is a Trigger Error, `false` otherwise.
1928
2671
  */
1929
- declare function isTriggerError(err: unknown): err is ResumeWithTaskError | RetryWithTaskError | CanceledWithTaskError | YieldExecutionError | AutoYieldExecutionError | AutoYieldWithCompletedTaskExecutionError;
2672
+ declare function isTriggerError(err: unknown): err is TriggerInternalError;
1930
2673
 
1931
2674
  declare const retry: {
1932
2675
  readonly standardBackoff: {
@@ -1936,6 +2679,13 @@ declare const retry: {
1936
2679
  readonly maxTimeoutInMs: 30000;
1937
2680
  readonly randomize: true;
1938
2681
  };
2682
+ readonly exponentialBackoff: {
2683
+ readonly limit: 8;
2684
+ readonly factor: 2;
2685
+ readonly minTimeoutInMs: 1000;
2686
+ readonly maxTimeoutInMs: 30000;
2687
+ readonly randomize: true;
2688
+ };
1939
2689
  };
1940
2690
 
1941
2691
  type Task = ServerTask;
@@ -1943,4 +2693,4 @@ type Task = ServerTask;
1943
2693
  type SentEvent = ApiEventLog;
1944
2694
  declare function redactString(strings: TemplateStringsArray, ...interpolations: string[]): RedactString;
1945
2695
 
1946
- export { AuthResolverResult, CronTrigger, DynamicIntervalOptions, DynamicSchedule, DynamicTrigger, DynamicTriggerOptions, EventSpecification, EventSpecificationExample, EventTrigger, EventTypeFromSpecification, ExternalSource, ExternalSourceParams, ExternalSourceTrigger, ExternalSourceTriggerOptions, HandlerEvent, HttpSourceEvent, IO, IOLogger, IOOptions, IOStats, IOTask, IOWithIntegrations, IntegrationTaskKey, IntervalTrigger, Job, JobIO, JobOptions, JobPayload, Json, MissingConnectionNotification, MissingConnectionResolvedNotification, PreprocessResults, RunTaskErrorCallback, SchemaParser, SchemaParserIssue, SchemaParserResult, SentEvent, Task, TaskLogger, Trigger, TriggerAuthResolver, TriggerClient, TriggerClientOptions, TriggerContext, TriggerEventType, TriggerIntegration, TriggerOptionRecord, TriggerPayload, TriggerPreprocessContext, cronTrigger, eventTrigger, intervalTrigger, isTriggerError, missingConnectionNotification, missingConnectionResolvedNotification, omit, redactString, retry };
2696
+ export { type AuthResolverResult, type BackgroundFetchResponse, CronTrigger, type DynamicIntervalOptions, DynamicSchedule, DynamicTrigger, type DynamicTriggerOptions, type EventSpecification, type EventSpecificationExample, EventSpecificationExampleSchema, EventTrigger, type EventTypeFromSpecification, ExternalSource, type ExternalSourceParams, ExternalSourceTrigger, type ExternalSourceTriggerOptions, type GetWebhookConfig, type GetWebhookParams, type HandlerEvent, type HttpSourceEvent, IO, IOLogger, type IOOptions, type IOStats, type IOTask, type IOWithIntegrations, type IntegrationTaskKey, IntervalTrigger, InvokeTrigger, JSONOutputSerializer, Job, type JobIO, type JobOptions, type JobPayload, type Json, MissingConnectionNotification, MissingConnectionResolvedNotification, type NotificationEvents, type NotificationsEventEmitter, type OutputSerializer, type PreprocessResults, type RunTaskErrorCallback, type SchemaParser, type SchemaParserIssue, type SchemaParserResult, type SentEvent, type Task, type TaskLogger, type Trigger, type TriggerAuthResolver, TriggerClient, type TriggerClientOptions, type TriggerContext, type TriggerEventType, type TriggerIntegration, type TriggerInvokeType, type TriggerOptionRecord, type TriggerPayload, type TriggerPreprocessContext, type TypedEventSpecificationExample, type VerifyResult, type WaitForEventResult, type WebhookConfig, type WebhookDeliveryContext, type WebhookHandlerEvent, WebhookSource, WebhookTrigger, type WebhookTriggerOptions, cronTrigger, eventTrigger, intervalTrigger, invokeTrigger, isTriggerError, missingConnectionNotification, missingConnectionResolvedNotification, omit, redactString, retry, slugifyId, verifyHmacSha256, verifyRequestSignature, waitForEventSchema };