@trigger.dev/sdk 0.0.0-cliframeworks-20230929110149 → 0.0.0-cross-runtime-20231201102436

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,7 +1,25 @@
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';
2
+ import { AsyncMap, KeyValueStoreResponseBody, RunTaskBodyInput, CompleteTaskBodyV2Input, FailTaskBodyInput, SendEvent, SendEventOptions, StatusUpdate, UpdateTriggerSourceBodyV2, TriggerSource, UpdateWebhookBody, RegisterTriggerBodyV2, RegisterSourceEventV2, ScheduleMetadata, GetRunOptionsWithTaskDetails, GetRunsOptions, InvokeOptions, EphemeralEventDispatcherRequestBody, LogLevel, RuntimeEnvironmentType, DisplayProperty, TriggerMetadata, EventFilter, SuccessfulRunNotification, FailedRunNotification, HttpEndpointMetadata, RequestFilter, Prettify, HandleTriggerSource, Logger, 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
3
  export { ConnectionAuth, DisplayProperty, EventFilter, Logger, NormalizedRequest, OverridableRunTaskOptions, Prettify, RedactString, RegisteredOptionsDiff, RunTaskOptions, SourceEventOption } from '@trigger.dev/core';
4
4
  import * as zod from 'zod';
5
+ import { z, ZodType, TypeOf } from 'zod';
6
+ import { BinaryToTextEncoding, BinaryLike, KeyObject } from 'crypto';
7
+
8
+ type QueryKeyValueStoreFunction = (action: "DELETE" | "GET" | "HAS" | "SET", data: {
9
+ key: string;
10
+ value?: string;
11
+ }) => Promise<KeyValueStoreResponseBody>;
12
+ declare class KeyValueStoreClient implements AsyncMap {
13
+ #private;
14
+ private queryStore;
15
+ private type;
16
+ private namespace;
17
+ constructor(queryStore: QueryKeyValueStoreFunction, type?: string | null, namespace?: string);
18
+ delete(key: string): Promise<boolean>;
19
+ get<T extends Json<T>>(key: string): Promise<T>;
20
+ has(key: string): Promise<boolean>;
21
+ set<T extends Json<T>>(key: string, value: T): Promise<T>;
22
+ }
5
23
 
6
24
  type ApiClientOptions = {
7
25
  apiKey?: string;
@@ -20,7 +38,358 @@ declare class ApiClient {
20
38
  url: string;
21
39
  name: string;
22
40
  }): Promise<EndpointRecord>;
23
- runTask(runId: string, task: RunTaskBodyInput): Promise<{
41
+ runTask(runId: string, task: RunTaskBodyInput, options?: {
42
+ cachedTasksCursor?: string;
43
+ }): Promise<VersionedResponseBody<{
44
+ "2023-09-29": z.ZodObject<{
45
+ task: z.ZodObject<{
46
+ id: z.ZodString;
47
+ name: z.ZodString;
48
+ icon: z.ZodNullable<z.ZodOptional<z.ZodString>>;
49
+ noop: z.ZodBoolean;
50
+ startedAt: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
51
+ completedAt: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
52
+ delayUntil: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
53
+ status: z.ZodEnum<["PENDING", "WAITING", "RUNNING", "COMPLETED", "ERRORED", "CANCELED"]>;
54
+ description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
55
+ params: z.ZodNullable<z.ZodOptional<z.ZodType<_trigger_dev_core.DeserializedJson, z.ZodTypeDef, _trigger_dev_core.DeserializedJson>>>;
56
+ properties: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
57
+ label: z.ZodString;
58
+ text: z.ZodString;
59
+ url: z.ZodOptional<z.ZodString>;
60
+ imageUrl: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
61
+ }, "strip", z.ZodTypeAny, {
62
+ label: string;
63
+ text: string;
64
+ url?: string | undefined;
65
+ imageUrl?: string[] | undefined;
66
+ }, {
67
+ label: string;
68
+ text: string;
69
+ url?: string | undefined;
70
+ imageUrl?: string[] | undefined;
71
+ }>, "many">>>;
72
+ outputProperties: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
73
+ label: z.ZodString;
74
+ text: z.ZodString;
75
+ url: z.ZodOptional<z.ZodString>;
76
+ imageUrl: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
77
+ }, "strip", z.ZodTypeAny, {
78
+ label: string;
79
+ text: string;
80
+ url?: string | undefined;
81
+ imageUrl?: string[] | undefined;
82
+ }, {
83
+ label: string;
84
+ text: string;
85
+ url?: string | undefined;
86
+ imageUrl?: string[] | undefined;
87
+ }>, "many">>>;
88
+ output: z.ZodNullable<z.ZodOptional<z.ZodType<_trigger_dev_core.DeserializedJson, z.ZodTypeDef, _trigger_dev_core.DeserializedJson>>>;
89
+ context: z.ZodNullable<z.ZodOptional<z.ZodType<_trigger_dev_core.DeserializedJson, z.ZodTypeDef, _trigger_dev_core.DeserializedJson>>>;
90
+ error: z.ZodNullable<z.ZodOptional<z.ZodString>>;
91
+ parentId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
92
+ style: z.ZodNullable<z.ZodOptional<z.ZodObject<{
93
+ style: z.ZodEnum<["normal", "minimal"]>;
94
+ variant: z.ZodOptional<z.ZodString>;
95
+ }, "strip", z.ZodTypeAny, {
96
+ style: "normal" | "minimal";
97
+ variant?: string | undefined;
98
+ }, {
99
+ style: "normal" | "minimal";
100
+ variant?: string | undefined;
101
+ }>>>;
102
+ operation: z.ZodNullable<z.ZodOptional<z.ZodString>>;
103
+ callbackUrl: z.ZodNullable<z.ZodOptional<z.ZodString>>;
104
+ childExecutionMode: z.ZodNullable<z.ZodOptional<z.ZodEnum<["SEQUENTIAL", "PARALLEL"]>>>;
105
+ idempotencyKey: z.ZodString;
106
+ attempts: z.ZodNumber;
107
+ forceYield: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
108
+ }, "strip", z.ZodTypeAny, {
109
+ id: string;
110
+ name: string;
111
+ noop: boolean;
112
+ status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED" | "CANCELED";
113
+ idempotencyKey: string;
114
+ attempts: number;
115
+ icon?: string | null | undefined;
116
+ startedAt?: Date | null | undefined;
117
+ completedAt?: Date | null | undefined;
118
+ delayUntil?: Date | null | undefined;
119
+ description?: string | null | undefined;
120
+ params?: _trigger_dev_core.DeserializedJson | undefined;
121
+ properties?: {
122
+ label: string;
123
+ text: string;
124
+ url?: string | undefined;
125
+ imageUrl?: string[] | undefined;
126
+ }[] | null | undefined;
127
+ outputProperties?: {
128
+ label: string;
129
+ text: string;
130
+ url?: string | undefined;
131
+ imageUrl?: string[] | undefined;
132
+ }[] | null | undefined;
133
+ output?: _trigger_dev_core.DeserializedJson | undefined;
134
+ context?: _trigger_dev_core.DeserializedJson | undefined;
135
+ error?: string | null | undefined;
136
+ parentId?: string | null | undefined;
137
+ style?: {
138
+ style: "normal" | "minimal";
139
+ variant?: string | undefined;
140
+ } | null | undefined;
141
+ operation?: string | null | undefined;
142
+ callbackUrl?: string | null | undefined;
143
+ childExecutionMode?: "SEQUENTIAL" | "PARALLEL" | null | undefined;
144
+ forceYield?: boolean | null | undefined;
145
+ }, {
146
+ id: string;
147
+ name: string;
148
+ noop: boolean;
149
+ status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED" | "CANCELED";
150
+ idempotencyKey: string;
151
+ attempts: number;
152
+ icon?: string | null | undefined;
153
+ startedAt?: Date | null | undefined;
154
+ completedAt?: Date | null | undefined;
155
+ delayUntil?: Date | null | undefined;
156
+ description?: string | null | undefined;
157
+ params?: _trigger_dev_core.DeserializedJson | undefined;
158
+ properties?: {
159
+ label: string;
160
+ text: string;
161
+ url?: string | undefined;
162
+ imageUrl?: string[] | undefined;
163
+ }[] | null | undefined;
164
+ outputProperties?: {
165
+ label: string;
166
+ text: string;
167
+ url?: string | undefined;
168
+ imageUrl?: string[] | undefined;
169
+ }[] | null | undefined;
170
+ output?: _trigger_dev_core.DeserializedJson | undefined;
171
+ context?: _trigger_dev_core.DeserializedJson | undefined;
172
+ error?: string | null | undefined;
173
+ parentId?: string | null | undefined;
174
+ style?: {
175
+ style: "normal" | "minimal";
176
+ variant?: string | undefined;
177
+ } | null | undefined;
178
+ operation?: string | null | undefined;
179
+ callbackUrl?: string | null | undefined;
180
+ childExecutionMode?: "SEQUENTIAL" | "PARALLEL" | null | undefined;
181
+ forceYield?: boolean | null | undefined;
182
+ }>;
183
+ cachedTasks: z.ZodOptional<z.ZodObject<{
184
+ tasks: z.ZodArray<z.ZodObject<{
185
+ id: z.ZodString;
186
+ idempotencyKey: z.ZodString;
187
+ status: z.ZodEnum<["PENDING", "WAITING", "RUNNING", "COMPLETED", "ERRORED", "CANCELED"]>;
188
+ noop: z.ZodDefault<z.ZodBoolean>;
189
+ output: z.ZodNullable<z.ZodOptional<z.ZodType<_trigger_dev_core.DeserializedJson, z.ZodTypeDef, _trigger_dev_core.DeserializedJson>>>;
190
+ parentId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
191
+ }, "strip", z.ZodTypeAny, {
192
+ id: string;
193
+ noop: boolean;
194
+ status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED" | "CANCELED";
195
+ idempotencyKey: string;
196
+ output?: _trigger_dev_core.DeserializedJson | undefined;
197
+ parentId?: string | null | undefined;
198
+ }, {
199
+ id: string;
200
+ status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED" | "CANCELED";
201
+ idempotencyKey: string;
202
+ noop?: boolean | undefined;
203
+ output?: _trigger_dev_core.DeserializedJson | undefined;
204
+ parentId?: string | null | undefined;
205
+ }>, "many">;
206
+ cursor: z.ZodOptional<z.ZodString>;
207
+ }, "strip", z.ZodTypeAny, {
208
+ tasks: {
209
+ id: string;
210
+ noop: boolean;
211
+ status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED" | "CANCELED";
212
+ idempotencyKey: string;
213
+ output?: _trigger_dev_core.DeserializedJson | undefined;
214
+ parentId?: string | null | undefined;
215
+ }[];
216
+ cursor?: string | undefined;
217
+ }, {
218
+ tasks: {
219
+ id: string;
220
+ status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED" | "CANCELED";
221
+ idempotencyKey: string;
222
+ noop?: boolean | undefined;
223
+ output?: _trigger_dev_core.DeserializedJson | undefined;
224
+ parentId?: string | null | undefined;
225
+ }[];
226
+ cursor?: string | undefined;
227
+ }>>;
228
+ }, "strip", z.ZodTypeAny, {
229
+ task: {
230
+ id: string;
231
+ name: string;
232
+ noop: boolean;
233
+ status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED" | "CANCELED";
234
+ idempotencyKey: string;
235
+ attempts: number;
236
+ icon?: string | null | undefined;
237
+ startedAt?: Date | null | undefined;
238
+ completedAt?: Date | null | undefined;
239
+ delayUntil?: Date | null | undefined;
240
+ description?: string | null | undefined;
241
+ params?: _trigger_dev_core.DeserializedJson | undefined;
242
+ properties?: {
243
+ label: string;
244
+ text: string;
245
+ url?: string | undefined;
246
+ imageUrl?: string[] | undefined;
247
+ }[] | null | undefined;
248
+ outputProperties?: {
249
+ label: string;
250
+ text: string;
251
+ url?: string | undefined;
252
+ imageUrl?: string[] | undefined;
253
+ }[] | null | undefined;
254
+ output?: _trigger_dev_core.DeserializedJson | undefined;
255
+ context?: _trigger_dev_core.DeserializedJson | undefined;
256
+ error?: string | null | undefined;
257
+ parentId?: string | null | undefined;
258
+ style?: {
259
+ style: "normal" | "minimal";
260
+ variant?: string | undefined;
261
+ } | null | undefined;
262
+ operation?: string | null | undefined;
263
+ callbackUrl?: string | null | undefined;
264
+ childExecutionMode?: "SEQUENTIAL" | "PARALLEL" | null | undefined;
265
+ forceYield?: boolean | null | undefined;
266
+ };
267
+ cachedTasks?: {
268
+ tasks: {
269
+ id: string;
270
+ noop: boolean;
271
+ status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED" | "CANCELED";
272
+ idempotencyKey: string;
273
+ output?: _trigger_dev_core.DeserializedJson | undefined;
274
+ parentId?: string | null | undefined;
275
+ }[];
276
+ cursor?: string | undefined;
277
+ } | undefined;
278
+ }, {
279
+ task: {
280
+ id: string;
281
+ name: string;
282
+ noop: boolean;
283
+ status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED" | "CANCELED";
284
+ idempotencyKey: string;
285
+ attempts: number;
286
+ icon?: string | null | undefined;
287
+ startedAt?: Date | null | undefined;
288
+ completedAt?: Date | null | undefined;
289
+ delayUntil?: Date | null | undefined;
290
+ description?: string | null | undefined;
291
+ params?: _trigger_dev_core.DeserializedJson | undefined;
292
+ properties?: {
293
+ label: string;
294
+ text: string;
295
+ url?: string | undefined;
296
+ imageUrl?: string[] | undefined;
297
+ }[] | null | undefined;
298
+ outputProperties?: {
299
+ label: string;
300
+ text: string;
301
+ url?: string | undefined;
302
+ imageUrl?: string[] | undefined;
303
+ }[] | null | undefined;
304
+ output?: _trigger_dev_core.DeserializedJson | undefined;
305
+ context?: _trigger_dev_core.DeserializedJson | undefined;
306
+ error?: string | null | undefined;
307
+ parentId?: string | null | undefined;
308
+ style?: {
309
+ style: "normal" | "minimal";
310
+ variant?: string | undefined;
311
+ } | null | undefined;
312
+ operation?: string | null | undefined;
313
+ callbackUrl?: string | null | undefined;
314
+ childExecutionMode?: "SEQUENTIAL" | "PARALLEL" | null | undefined;
315
+ forceYield?: boolean | null | undefined;
316
+ };
317
+ cachedTasks?: {
318
+ tasks: {
319
+ id: string;
320
+ status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED" | "CANCELED";
321
+ idempotencyKey: string;
322
+ noop?: boolean | undefined;
323
+ output?: _trigger_dev_core.DeserializedJson | undefined;
324
+ parentId?: string | null | undefined;
325
+ }[];
326
+ cursor?: string | undefined;
327
+ } | undefined;
328
+ }>;
329
+ }, z.ZodObject<{
330
+ id: z.ZodString;
331
+ name: z.ZodString;
332
+ icon: z.ZodNullable<z.ZodOptional<z.ZodString>>;
333
+ noop: z.ZodBoolean;
334
+ startedAt: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
335
+ completedAt: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
336
+ delayUntil: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
337
+ status: z.ZodEnum<["PENDING", "WAITING", "RUNNING", "COMPLETED", "ERRORED", "CANCELED"]>;
338
+ description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
339
+ params: z.ZodNullable<z.ZodOptional<z.ZodType<_trigger_dev_core.DeserializedJson, z.ZodTypeDef, _trigger_dev_core.DeserializedJson>>>;
340
+ properties: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
341
+ label: z.ZodString;
342
+ text: z.ZodString;
343
+ url: z.ZodOptional<z.ZodString>;
344
+ imageUrl: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
345
+ }, "strip", z.ZodTypeAny, {
346
+ label: string;
347
+ text: string;
348
+ url?: string | undefined;
349
+ imageUrl?: string[] | undefined;
350
+ }, {
351
+ label: string;
352
+ text: string;
353
+ url?: string | undefined;
354
+ imageUrl?: string[] | undefined;
355
+ }>, "many">>>;
356
+ outputProperties: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
357
+ label: z.ZodString;
358
+ text: z.ZodString;
359
+ url: z.ZodOptional<z.ZodString>;
360
+ imageUrl: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
361
+ }, "strip", z.ZodTypeAny, {
362
+ label: string;
363
+ text: string;
364
+ url?: string | undefined;
365
+ imageUrl?: string[] | undefined;
366
+ }, {
367
+ label: string;
368
+ text: string;
369
+ url?: string | undefined;
370
+ imageUrl?: string[] | undefined;
371
+ }>, "many">>>;
372
+ output: z.ZodNullable<z.ZodOptional<z.ZodType<_trigger_dev_core.DeserializedJson, z.ZodTypeDef, _trigger_dev_core.DeserializedJson>>>;
373
+ context: z.ZodNullable<z.ZodOptional<z.ZodType<_trigger_dev_core.DeserializedJson, z.ZodTypeDef, _trigger_dev_core.DeserializedJson>>>;
374
+ error: z.ZodNullable<z.ZodOptional<z.ZodString>>;
375
+ parentId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
376
+ style: z.ZodNullable<z.ZodOptional<z.ZodObject<{
377
+ style: z.ZodEnum<["normal", "minimal"]>;
378
+ variant: z.ZodOptional<z.ZodString>;
379
+ }, "strip", z.ZodTypeAny, {
380
+ style: "normal" | "minimal";
381
+ variant?: string | undefined;
382
+ }, {
383
+ style: "normal" | "minimal";
384
+ variant?: string | undefined;
385
+ }>>>;
386
+ operation: z.ZodNullable<z.ZodOptional<z.ZodString>>;
387
+ callbackUrl: z.ZodNullable<z.ZodOptional<z.ZodString>>;
388
+ childExecutionMode: z.ZodNullable<z.ZodOptional<z.ZodEnum<["SEQUENTIAL", "PARALLEL"]>>>;
389
+ idempotencyKey: z.ZodString;
390
+ attempts: z.ZodNumber;
391
+ forceYield: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
392
+ }, "strip", z.ZodTypeAny, {
24
393
  id: string;
25
394
  name: string;
26
395
  noop: boolean;
@@ -37,13 +406,16 @@ declare class ApiClient {
37
406
  label: string;
38
407
  text: string;
39
408
  url?: string | undefined;
409
+ imageUrl?: string[] | undefined;
40
410
  }[] | null | undefined;
41
411
  outputProperties?: {
42
412
  label: string;
43
413
  text: string;
44
414
  url?: string | undefined;
415
+ imageUrl?: string[] | undefined;
45
416
  }[] | null | undefined;
46
417
  output?: _trigger_dev_core.DeserializedJson | undefined;
418
+ context?: _trigger_dev_core.DeserializedJson | undefined;
47
419
  error?: string | null | undefined;
48
420
  parentId?: string | null | undefined;
49
421
  style?: {
@@ -51,8 +423,48 @@ declare class ApiClient {
51
423
  variant?: string | undefined;
52
424
  } | null | undefined;
53
425
  operation?: string | null | undefined;
54
- }>;
55
- completeTask(runId: string, id: string, task: CompleteTaskBodyInput): Promise<{
426
+ callbackUrl?: string | null | undefined;
427
+ childExecutionMode?: "SEQUENTIAL" | "PARALLEL" | null | undefined;
428
+ forceYield?: boolean | null | undefined;
429
+ }, {
430
+ id: string;
431
+ name: string;
432
+ noop: boolean;
433
+ status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED" | "CANCELED";
434
+ idempotencyKey: string;
435
+ attempts: number;
436
+ icon?: string | null | undefined;
437
+ startedAt?: Date | null | undefined;
438
+ completedAt?: Date | null | undefined;
439
+ delayUntil?: Date | null | undefined;
440
+ description?: string | null | undefined;
441
+ params?: _trigger_dev_core.DeserializedJson | undefined;
442
+ properties?: {
443
+ label: string;
444
+ text: string;
445
+ url?: string | undefined;
446
+ imageUrl?: string[] | undefined;
447
+ }[] | null | undefined;
448
+ outputProperties?: {
449
+ label: string;
450
+ text: string;
451
+ url?: string | undefined;
452
+ imageUrl?: string[] | undefined;
453
+ }[] | null | undefined;
454
+ output?: _trigger_dev_core.DeserializedJson | undefined;
455
+ context?: _trigger_dev_core.DeserializedJson | undefined;
456
+ error?: string | null | undefined;
457
+ parentId?: string | null | undefined;
458
+ style?: {
459
+ style: "normal" | "minimal";
460
+ variant?: string | undefined;
461
+ } | null | undefined;
462
+ operation?: string | null | undefined;
463
+ callbackUrl?: string | null | undefined;
464
+ childExecutionMode?: "SEQUENTIAL" | "PARALLEL" | null | undefined;
465
+ forceYield?: boolean | null | undefined;
466
+ }>>>;
467
+ completeTask(runId: string, id: string, task: CompleteTaskBodyV2Input): Promise<{
56
468
  id: string;
57
469
  name: string;
58
470
  noop: boolean;
@@ -69,13 +481,16 @@ declare class ApiClient {
69
481
  label: string;
70
482
  text: string;
71
483
  url?: string | undefined;
484
+ imageUrl?: string[] | undefined;
72
485
  }[] | null | undefined;
73
486
  outputProperties?: {
74
487
  label: string;
75
488
  text: string;
76
489
  url?: string | undefined;
490
+ imageUrl?: string[] | undefined;
77
491
  }[] | null | undefined;
78
492
  output?: _trigger_dev_core.DeserializedJson | undefined;
493
+ context?: _trigger_dev_core.DeserializedJson | undefined;
79
494
  error?: string | null | undefined;
80
495
  parentId?: string | null | undefined;
81
496
  style?: {
@@ -83,6 +498,9 @@ declare class ApiClient {
83
498
  variant?: string | undefined;
84
499
  } | null | undefined;
85
500
  operation?: string | null | undefined;
501
+ callbackUrl?: string | null | undefined;
502
+ childExecutionMode?: "SEQUENTIAL" | "PARALLEL" | null | undefined;
503
+ forceYield?: boolean | null | undefined;
86
504
  }>;
87
505
  failTask(runId: string, id: string, body: FailTaskBodyInput): Promise<{
88
506
  id: string;
@@ -101,13 +519,16 @@ declare class ApiClient {
101
519
  label: string;
102
520
  text: string;
103
521
  url?: string | undefined;
522
+ imageUrl?: string[] | undefined;
104
523
  }[] | null | undefined;
105
524
  outputProperties?: {
106
525
  label: string;
107
526
  text: string;
108
527
  url?: string | undefined;
528
+ imageUrl?: string[] | undefined;
109
529
  }[] | null | undefined;
110
530
  output?: _trigger_dev_core.DeserializedJson | undefined;
531
+ context?: _trigger_dev_core.DeserializedJson | undefined;
111
532
  error?: string | null | undefined;
112
533
  parentId?: string | null | undefined;
113
534
  style?: {
@@ -115,6 +536,9 @@ declare class ApiClient {
115
536
  variant?: string | undefined;
116
537
  } | null | undefined;
117
538
  operation?: string | null | undefined;
539
+ callbackUrl?: string | null | undefined;
540
+ childExecutionMode?: "SEQUENTIAL" | "PARALLEL" | null | undefined;
541
+ forceYield?: boolean | null | undefined;
118
542
  }>;
119
543
  sendEvent(event: SendEvent, options?: SendEventOptions): Promise<{
120
544
  id: string;
@@ -130,6 +554,20 @@ declare class ApiClient {
130
554
  deliveredAt?: Date | null | undefined;
131
555
  cancelledAt?: Date | null | undefined;
132
556
  }>;
557
+ sendEvents(events: SendEvent[], options?: SendEventOptions): Promise<{
558
+ id: string;
559
+ name: string;
560
+ payload: ((string | number | boolean | {
561
+ [key: string]: _trigger_dev_core.DeserializedJson;
562
+ } | _trigger_dev_core.DeserializedJson[]) & (string | number | boolean | {
563
+ [key: string]: _trigger_dev_core.DeserializedJson;
564
+ } | _trigger_dev_core.DeserializedJson[] | undefined)) | null;
565
+ timestamp: Date;
566
+ context?: _trigger_dev_core.DeserializedJson | undefined;
567
+ deliverAt?: Date | null | undefined;
568
+ deliveredAt?: Date | null | undefined;
569
+ cancelledAt?: Date | null | undefined;
570
+ }[]>;
133
571
  cancelEvent(eventId: string): Promise<{
134
572
  id: string;
135
573
  name: string;
@@ -144,6 +582,10 @@ declare class ApiClient {
144
582
  deliveredAt?: Date | null | undefined;
145
583
  cancelledAt?: Date | null | undefined;
146
584
  }>;
585
+ cancelRunsForEvent(eventId: string): Promise<{
586
+ cancelledRunIds: string[];
587
+ failedToCancelRunIds: string[];
588
+ }>;
147
589
  updateStatus(runId: string, id: string, status: StatusUpdate): Promise<{
148
590
  label: string;
149
591
  key: string;
@@ -156,7 +598,8 @@ declare class ApiClient {
156
598
  state?: "loading" | "success" | "failure" | undefined;
157
599
  }>;
158
600
  updateSource(client: string, key: string, source: UpdateTriggerSourceBodyV2): Promise<TriggerSource>;
159
- registerTrigger(client: string, id: string, key: string, payload: RegisterTriggerBodyV2): Promise<RegisterSourceEventV2>;
601
+ updateWebhook(key: string, webhookData: UpdateWebhookBody): Promise<TriggerSource>;
602
+ registerTrigger(client: string, id: string, key: string, payload: RegisterTriggerBodyV2, idempotencyKey?: string): Promise<RegisterSourceEventV2>;
160
603
  registerSchedule(client: string, id: string, key: string, payload: ScheduleMetadata): Promise<{
161
604
  id: string;
162
605
  schedule: {
@@ -192,7 +635,7 @@ declare class ApiClient {
192
635
  updatedAt: Date;
193
636
  runs: {
194
637
  id: string;
195
- status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD";
638
+ 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";
196
639
  startedAt?: Date | null | undefined;
197
640
  completedAt?: Date | null | undefined;
198
641
  }[];
@@ -202,11 +645,31 @@ declare class ApiClient {
202
645
  id: string;
203
646
  startedAt: Date | null;
204
647
  completedAt: Date | null;
205
- status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD";
648
+ 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";
206
649
  updatedAt: Date | null;
207
650
  tasks: _trigger_dev_core.RunTaskWithSubtasks[];
651
+ statuses: {
652
+ label: string;
653
+ key: string;
654
+ history: {
655
+ label?: string | undefined;
656
+ state?: "loading" | "success" | "failure" | undefined;
657
+ data?: Record<string, _trigger_dev_core.SerializableJson> | undefined;
658
+ }[];
659
+ data?: Record<string, _trigger_dev_core.SerializableJson> | undefined;
660
+ state?: "loading" | "success" | "failure" | undefined;
661
+ }[];
208
662
  output?: any;
209
- statuses?: {
663
+ nextCursor?: string | undefined;
664
+ }>;
665
+ cancelRun(runId: string): Promise<{
666
+ id: string;
667
+ startedAt: Date | null;
668
+ completedAt: Date | null;
669
+ 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";
670
+ updatedAt: Date | null;
671
+ tasks: _trigger_dev_core.RunTaskWithSubtasks[];
672
+ statuses: {
210
673
  label: string;
211
674
  key: string;
212
675
  history: {
@@ -216,7 +679,8 @@ declare class ApiClient {
216
679
  }[];
217
680
  data?: Record<string, _trigger_dev_core.SerializableJson> | undefined;
218
681
  state?: "loading" | "success" | "failure" | undefined;
219
- }[] | undefined;
682
+ }[];
683
+ output?: any;
220
684
  nextCursor?: string | undefined;
221
685
  }>;
222
686
  getRunStatuses(runId: string): Promise<{
@@ -233,7 +697,7 @@ declare class ApiClient {
233
697
  }[];
234
698
  run: {
235
699
  id: string;
236
- status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD";
700
+ 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";
237
701
  output?: any;
238
702
  };
239
703
  }>;
@@ -242,11 +706,89 @@ declare class ApiClient {
242
706
  id: string;
243
707
  startedAt: Date | null;
244
708
  completedAt: Date | null;
245
- status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD";
709
+ 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";
246
710
  updatedAt: Date | null;
247
711
  }[];
248
712
  nextCursor?: string | undefined;
249
713
  }>;
714
+ invokeJob(jobId: string, payload: any, options?: InvokeOptions): Promise<{
715
+ id: string;
716
+ }>;
717
+ createEphemeralEventDispatcher(payload: EphemeralEventDispatcherRequestBody): Promise<{
718
+ id: string;
719
+ }>;
720
+ get store(): KeyValueStoreClient;
721
+ }
722
+ type VersionedResponseBodyMap = {
723
+ [key: string]: z.ZodTypeAny;
724
+ };
725
+ type VersionedResponseBody<TVersions extends VersionedResponseBodyMap, TUnversioned extends z.ZodTypeAny> = {
726
+ [TVersion in keyof TVersions]: {
727
+ version: TVersion;
728
+ body: z.infer<TVersions[TVersion]>;
729
+ };
730
+ }[keyof TVersions] | {
731
+ version: "unversioned";
732
+ body: z.infer<TUnversioned>;
733
+ };
734
+
735
+ declare class TriggerStatus {
736
+ private id;
737
+ private io;
738
+ constructor(id: string, io: IO);
739
+ update(key: IntegrationTaskKey, status: StatusUpdate): Promise<{
740
+ label: string;
741
+ key: string;
742
+ history: {
743
+ label?: string | undefined;
744
+ state?: "loading" | "success" | "failure" | undefined;
745
+ data?: Record<string, _trigger_dev_core.SerializableJson> | undefined;
746
+ }[];
747
+ data?: Record<string, _trigger_dev_core.SerializableJson> | undefined;
748
+ state?: "loading" | "success" | "failure" | undefined;
749
+ }>;
750
+ }
751
+
752
+ type EventMap = {
753
+ [key: string]: (...args: any[]) => void
754
+ }
755
+
756
+ /**
757
+ * Type-safe event emitter.
758
+ *
759
+ * Use it like this:
760
+ *
761
+ * ```typescript
762
+ * type MyEvents = {
763
+ * error: (error: Error) => void;
764
+ * message: (from: string, content: string) => void;
765
+ * }
766
+ *
767
+ * const myEmitter = new EventEmitter() as TypedEmitter<MyEvents>;
768
+ *
769
+ * myEmitter.emit("error", "x") // <- Will catch this type error;
770
+ * ```
771
+ */
772
+ interface TypedEventEmitter<Events extends EventMap> {
773
+ addListener<E extends keyof Events> (event: E, listener: Events[E]): this
774
+ on<E extends keyof Events> (event: E, listener: Events[E]): this
775
+ once<E extends keyof Events> (event: E, listener: Events[E]): this
776
+ prependListener<E extends keyof Events> (event: E, listener: Events[E]): this
777
+ prependOnceListener<E extends keyof Events> (event: E, listener: Events[E]): this
778
+
779
+ off<E extends keyof Events>(event: E, listener: Events[E]): this
780
+ removeAllListeners<E extends keyof Events> (event?: E): this
781
+ removeListener<E extends keyof Events> (event: E, listener: Events[E]): this
782
+
783
+ emit<E extends keyof Events> (event: E, ...args: Parameters<Events[E]>): boolean
784
+ // The sloppy `eventNames()` return type is to mitigate type incompatibilities - see #5
785
+ eventNames (): (keyof Events | string | symbol)[]
786
+ rawListeners<E extends keyof Events> (event: E): Events[E][]
787
+ listeners<E extends keyof Events> (event: E): Events[E][]
788
+ listenerCount<E extends keyof Events> (event: E): number
789
+
790
+ getMaxListeners (): number
791
+ setMaxListeners (maxListeners: number): this
250
792
  }
251
793
 
252
794
  interface TriggerContext {
@@ -267,6 +809,12 @@ interface TriggerContext {
267
809
  id: string;
268
810
  title: string;
269
811
  };
812
+ /** Project metadata */
813
+ project: {
814
+ slug: string;
815
+ id: string;
816
+ name: string;
817
+ };
270
818
  /** Run metadata */
271
819
  run: {
272
820
  id: string;
@@ -333,20 +881,45 @@ type PreprocessResults = {
333
881
  properties: DisplayProperty[];
334
882
  };
335
883
  type TriggerEventType<TTrigger extends Trigger<any>> = TTrigger extends Trigger<infer TEventSpec> ? ReturnType<TEventSpec["parsePayload"]> : never;
884
+ type TriggerInvokeType<TTrigger extends Trigger<any>> = TTrigger extends Trigger<infer TEventSpec> ? TEventSpec["parseInvokePayload"] extends (payload: unknown) => infer TInvoke ? TInvoke : any : never;
885
+ type VerifyResult = {
886
+ success: true;
887
+ } | {
888
+ success: false;
889
+ reason?: string;
890
+ };
336
891
  interface Trigger<TEventSpec extends EventSpecification<any>> {
337
892
  event: TEventSpec;
338
893
  toJSON(): TriggerMetadata;
339
894
  attachToJob(triggerClient: TriggerClient, job: Job<Trigger<TEventSpec>, any>): void;
340
895
  preprocessRuns: boolean;
896
+ verifyPayload: (payload: ReturnType<TEventSpec["parsePayload"]>) => Promise<VerifyResult>;
341
897
  }
342
898
  type TriggerPayload<TTrigger> = TTrigger extends Trigger<EventSpecification<infer TEvent>> ? TEvent : never;
343
- type EventSpecificationExample = {
899
+ declare const EventSpecificationExampleSchema: z.ZodObject<{
900
+ id: z.ZodString;
901
+ name: z.ZodString;
902
+ icon: z.ZodOptional<z.ZodString>;
903
+ payload: z.ZodAny;
904
+ }, "strip", z.ZodTypeAny, {
905
+ id: string;
906
+ name: string;
907
+ icon?: string | undefined;
908
+ payload?: any;
909
+ }, {
910
+ id: string;
911
+ name: string;
912
+ icon?: string | undefined;
913
+ payload?: any;
914
+ }>;
915
+ type EventSpecificationExample = z.infer<typeof EventSpecificationExampleSchema>;
916
+ type TypedEventSpecificationExample<TEvent> = {
344
917
  id: string;
345
918
  name: string;
346
919
  icon?: string;
347
- payload: any;
920
+ payload: TEvent;
348
921
  };
349
- interface EventSpecification<TEvent extends any> {
922
+ interface EventSpecification<TEvent extends any, TInvoke extends any = TEvent> {
350
923
  name: string | string[];
351
924
  title: string;
352
925
  source: string;
@@ -356,6 +929,7 @@ interface EventSpecification<TEvent extends any> {
356
929
  examples?: Array<EventSpecificationExample>;
357
930
  filter?: EventFilter;
358
931
  parsePayload: (payload: unknown) => TEvent;
932
+ parseInvokePayload?: (payload: unknown) => TInvoke;
359
933
  runProperties?: (payload: TEvent) => DisplayProperty[];
360
934
  }
361
935
  type EventTypeFromSpecification<TEventSpec extends EventSpecification<any>> = TEventSpec extends EventSpecification<infer TEvent> ? TEvent : never;
@@ -375,6 +949,127 @@ type SchemaParserResult<T> = {
375
949
  type SchemaParser<T extends unknown = unknown> = {
376
950
  safeParse: (a: unknown) => SchemaParserResult<T>;
377
951
  };
952
+ type WaitForEventResult<TEvent> = {
953
+ id: string;
954
+ name: string;
955
+ source: string;
956
+ payload: TEvent;
957
+ timestamp: Date;
958
+ context?: any;
959
+ accountId?: string;
960
+ };
961
+ declare function waitForEventSchema(schema: z.ZodTypeAny): z.ZodObject<{
962
+ id: z.ZodString;
963
+ name: z.ZodString;
964
+ source: z.ZodString;
965
+ payload: z.ZodTypeAny;
966
+ timestamp: z.ZodDate;
967
+ context: z.ZodOptional<z.ZodAny>;
968
+ accountId: z.ZodOptional<z.ZodString>;
969
+ }, "strip", z.ZodTypeAny, {
970
+ id: string;
971
+ name: string;
972
+ timestamp: Date;
973
+ source: string;
974
+ payload?: any;
975
+ context?: any;
976
+ accountId?: string | undefined;
977
+ }, {
978
+ id: string;
979
+ name: string;
980
+ timestamp: Date;
981
+ source: string;
982
+ payload?: any;
983
+ context?: any;
984
+ accountId?: string | undefined;
985
+ }>;
986
+ type NotificationEvents = {
987
+ runSucceeeded: (notification: SuccessfulRunNotification<any>) => void;
988
+ runFailed: (notification: FailedRunNotification) => void;
989
+ };
990
+ type NotificationsEventEmitter = TypedEventEmitter<NotificationEvents>;
991
+
992
+ type HttpEndpointOptions<TEventSpecification extends EventSpecification<any>> = {
993
+ id: string;
994
+ enabled?: boolean;
995
+ event: TEventSpecification;
996
+ respondWith?: RespondWith;
997
+ verify: VerifyCallback;
998
+ };
999
+ type RequestOptions = {
1000
+ filter?: RequestFilter;
1001
+ };
1002
+ declare class HttpEndpoint<TEventSpecification extends EventSpecification<any>> {
1003
+ private readonly options;
1004
+ constructor(options: HttpEndpointOptions<TEventSpecification>);
1005
+ get id(): string;
1006
+ onRequest(options?: RequestOptions): HttpTrigger<EventSpecification<Request>>;
1007
+ toJSON(): HttpEndpointMetadata;
1008
+ }
1009
+ type TriggerOptions$1<TEventSpecification extends EventSpecification<any>> = {
1010
+ endpointId: string;
1011
+ event: TEventSpecification;
1012
+ filter?: EventFilter;
1013
+ verify: VerifyCallback;
1014
+ };
1015
+ declare class HttpTrigger<TEventSpecification extends EventSpecification<any>> implements Trigger<TEventSpecification> {
1016
+ private readonly options;
1017
+ constructor(options: TriggerOptions$1<TEventSpecification>);
1018
+ toJSON(): TriggerMetadata;
1019
+ get event(): TEventSpecification;
1020
+ attachToJob(triggerClient: TriggerClient, job: Job<Trigger<TEventSpecification>, any>): void;
1021
+ get preprocessRuns(): boolean;
1022
+ verifyPayload(payload: Request): Promise<VerifyResult>;
1023
+ }
1024
+ type RespondWith = {
1025
+ /** Only Requests that match this filter will cause the `handler` function to run.
1026
+ * For example, you can use this to only respond to `GET` Requests. */
1027
+ filter?: RequestFilter;
1028
+ /** If you set this to `true`, the Request that comes in won't go on to Trigger any Runs.
1029
+ * This is useful if you want to Respond to the Request, but don't want to Trigger any Runs. */
1030
+ skipTriggeringRuns?: boolean;
1031
+ /** This is a function that's called when a Request comes in.
1032
+ * It's passed the Request object, and expects you to return a Response object. */
1033
+ handler: (request: Request, verify: () => Promise<VerifyResult>) => Promise<Response>;
1034
+ };
1035
+ type VerifyCallback = (request: Request) => Promise<VerifyResult>;
1036
+ type EndpointOptions = {
1037
+ /** Used to uniquely identify the HTTP Endpoint inside your Project. */
1038
+ id: string;
1039
+ enabled?: boolean;
1040
+ /** Usually you would use the domain name of the service, e.g. `cal.com`. */
1041
+ source: string;
1042
+ /** An optional title, displayed in the dashboard. */
1043
+ title?: string;
1044
+ /** An optional icon name that's displayed in the dashboard.
1045
+ * Lots of company names are supported, e.g. `github`, `twilio`.
1046
+ * You can also reference the name of any [Tabler icon](https://tabler-icons.io/), e.g. `brand-google-maps`, `brand-twitch`. */
1047
+ icon?: string;
1048
+ /** Used to provide example payloads that are accepted by the job.
1049
+ * This will be available in the dashboard and can be used to trigger test runs. */
1050
+ examples?: EventSpecificationExample[];
1051
+ /** Properties that are displayed in the dashboard. */
1052
+ properties?: DisplayProperty[];
1053
+ /** 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.
1054
+
1055
+ Only use this if you really need to Respond to the Request that comes in. Most of the time you don't. */
1056
+ respondWith?: RespondWith;
1057
+ /** This is compulsory, and is used to verify that the received webhook is authentic.
1058
+ * It's a function that expects you to return a result object like:
1059
+
1060
+ In 90% of cases, you'll want to use the `verifyRequestSignature` helper function we provide.
1061
+
1062
+ @example
1063
+ ```ts
1064
+ //if it's valid
1065
+ return { success: true }
1066
+ //if it's invalid, reason is optional
1067
+ return { success: false, reason: "No header" }
1068
+ ```
1069
+
1070
+ */
1071
+ verify: VerifyCallback;
1072
+ };
378
1073
 
379
1074
  type HttpSourceEvent = {
380
1075
  url: string;
@@ -420,7 +1115,7 @@ type TriggerOptionsRecordWithEvent<TValue, TTriggerOptionDefinitions extends Rec
420
1115
  type TriggerOptionRecord<TValue, TTriggerOptionDefinitions extends Record<string, string[]> = any> = {
421
1116
  [K in keyof TTriggerOptionDefinitions]: TValue;
422
1117
  };
423
- type RegisterFunctionEvent<TChannel extends ChannelNames, TParams extends any, TTriggerOptionDefinitions extends Record<string, string[]> = any> = {
1118
+ type RegisterFunctionEvent$1<TChannel extends ChannelNames, TParams extends any, TTriggerOptionDefinitions extends Record<string, string[]> = any> = {
424
1119
  options: TriggerOptionDiffs<TTriggerOptionDefinitions>;
425
1120
  source: {
426
1121
  active: boolean;
@@ -435,14 +1130,14 @@ type RegisterSourceEvent<TTriggerOptionDefinitions extends Record<string, string
435
1130
  dynamicTriggerId?: string;
436
1131
  options: TriggerOptionDiffs<TTriggerOptionDefinitions>;
437
1132
  };
438
- type RegisterFunctionOutput<TTriggerOptionDefinitions extends Record<string, string[]> = any> = {
1133
+ type RegisterFunctionOutput$1<TTriggerOptionDefinitions extends Record<string, string[]> = any> = {
439
1134
  secret?: string;
440
1135
  data?: SerializableJson;
441
1136
  options: TriggerOptionsRecordWithEvent<string[], TTriggerOptionDefinitions>;
442
1137
  };
443
- type RegisterFunction<TIntegration extends TriggerIntegration, TParams extends any, TChannel extends ChannelNames, TTriggerOptionDefinitions extends Record<string, string[]> = any> = (event: RegisterFunctionEvent<TChannel, TParams, TTriggerOptionDefinitions>, io: IOWithIntegrations<{
1138
+ 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<{
444
1139
  integration: TIntegration;
445
- }>, ctx: TriggerContext) => Promise<RegisterFunctionOutput<TTriggerOptionDefinitions> | undefined>;
1140
+ }>, ctx: TriggerContext) => Promise<RegisterFunctionOutput$1<TTriggerOptionDefinitions> | undefined>;
446
1141
  type HandlerEvent<TChannel extends ChannelNames, TParams extends any = any> = {
447
1142
  rawEvent: ExternalSourceChannelMap[TChannel]["event"];
448
1143
  source: Prettify<Omit<HandleTriggerSource, "params"> & {
@@ -454,18 +1149,18 @@ type HandlerFunction<TChannel extends ChannelNames, TParams extends any, TTrigge
454
1149
  response?: NormalizedResponse;
455
1150
  metadata?: HttpSourceResponseMetadata;
456
1151
  } | void>;
457
- type KeyFunction<TParams extends any> = (params: TParams) => string;
458
- type FilterFunction<TParams extends any, TTriggerOptionDefinitions extends Record<string, string[]> = any> = (params: TParams, options?: TTriggerOptionDefinitions) => EventFilter;
1152
+ type KeyFunction$1<TParams extends any> = (params: TParams) => string;
1153
+ type FilterFunction$1<TParams extends any, TTriggerOptionDefinitions extends Record<string, string[]> = any> = (params: TParams, options?: TTriggerOptionDefinitions) => EventFilter;
459
1154
  type ExternalSourceOptions<TChannel extends ChannelNames, TIntegration extends TriggerIntegration, TParams extends any, TTriggerOptionDefinitions extends Record<string, string[]> = any> = {
460
1155
  id: string;
461
1156
  version: string;
462
1157
  schema: SchemaParser<TParams>;
463
1158
  optionSchema?: SchemaParser<TTriggerOptionDefinitions>;
464
1159
  integration: TIntegration;
465
- register: RegisterFunction<TIntegration, TParams, TChannel, TTriggerOptionDefinitions>;
466
- filter?: FilterFunction<TParams, TTriggerOptionDefinitions>;
1160
+ register: RegisterFunction$1<TIntegration, TParams, TChannel, TTriggerOptionDefinitions>;
1161
+ filter?: FilterFunction$1<TParams, TTriggerOptionDefinitions>;
467
1162
  handler: HandlerFunction<TChannel, TParams, TIntegration>;
468
- key: KeyFunction<TParams>;
1163
+ key: KeyFunction$1<TParams>;
469
1164
  properties?: (params: TParams) => DisplayProperty[];
470
1165
  };
471
1166
  declare class ExternalSource<TIntegration extends TriggerIntegration, TParams extends any, TChannel extends ChannelNames = ChannelNames, TTriggerOptionDefinitions extends Record<string, string[]> = any> {
@@ -480,6 +1175,7 @@ declare class ExternalSource<TIntegration extends TriggerIntegration, TParams ex
480
1175
  id?: string | undefined;
481
1176
  timestamp?: Date | undefined;
482
1177
  source?: string | undefined;
1178
+ payloadType?: "JSON" | "REQUEST" | undefined;
483
1179
  }[];
484
1180
  response?: {
485
1181
  status: number;
@@ -490,7 +1186,7 @@ declare class ExternalSource<TIntegration extends TriggerIntegration, TParams ex
490
1186
  }>;
491
1187
  filter(params: TParams, options?: TTriggerOptionDefinitions): EventFilter;
492
1188
  properties(params: TParams): DisplayProperty[];
493
- register(params: TParams, registerEvent: RegisterSourceEvent<TTriggerOptionDefinitions>, io: IO, ctx: TriggerContext): Promise<RegisterFunctionOutput<TTriggerOptionDefinitions> | undefined>;
1189
+ register(params: TParams, registerEvent: RegisterSourceEvent<TTriggerOptionDefinitions>, io: IO, ctx: TriggerContext): Promise<RegisterFunctionOutput$1<TTriggerOptionDefinitions> | undefined>;
494
1190
  key(params: TParams): string;
495
1191
  get integration(): TIntegration;
496
1192
  get integrationConfig(): {
@@ -518,6 +1214,9 @@ declare class ExternalSourceTrigger<TEventSpecification extends EventSpecificati
518
1214
  toJSON(): TriggerMetadata;
519
1215
  attachToJob(triggerClient: TriggerClient, job: Job<Trigger<TEventSpecification>, any>): void;
520
1216
  get preprocessRuns(): boolean;
1217
+ verifyPayload(payload: ReturnType<TEventSpecification["parsePayload"]>): Promise<{
1218
+ success: true;
1219
+ }>;
521
1220
  }
522
1221
  declare function omit<T extends Record<string, unknown>, K extends keyof T>(obj: T, key: K): {
523
1222
  result: Omit<T, K>;
@@ -570,6 +1269,9 @@ declare class DynamicTrigger<TEventSpec extends EventSpecification<any>, TExtern
570
1269
  }): Promise<RegisterSourceEventV2>;
571
1270
  attachToJob(triggerClient: TriggerClient, job: Job<Trigger<TEventSpec>, any>): void;
572
1271
  get preprocessRuns(): boolean;
1272
+ verifyPayload(payload: ReturnType<TEventSpec["parsePayload"]>): Promise<{
1273
+ success: true;
1274
+ }>;
573
1275
  }
574
1276
 
575
1277
  type ScheduledEventSpecification = EventSpecification<ScheduledPayload>;
@@ -601,6 +1303,9 @@ declare class IntervalTrigger implements Trigger<ScheduledEventSpecification> {
601
1303
  };
602
1304
  attachToJob(triggerClient: TriggerClient, job: Job<Trigger<ScheduledEventSpecification>, any>): void;
603
1305
  get preprocessRuns(): boolean;
1306
+ verifyPayload(payload: ReturnType<ScheduledEventSpecification["parsePayload"]>): Promise<{
1307
+ success: true;
1308
+ }>;
604
1309
  toJSON(): TriggerMetadata;
605
1310
  }
606
1311
  /** `intervalTrigger()` is set as a [Job's trigger](/sdk/job) to trigger a Job at a recurring interval.
@@ -635,6 +1340,9 @@ declare class CronTrigger implements Trigger<ScheduledEventSpecification> {
635
1340
  };
636
1341
  attachToJob(triggerClient: TriggerClient, job: Job<Trigger<ScheduledEventSpecification>, any>): void;
637
1342
  get preprocessRuns(): boolean;
1343
+ verifyPayload(payload: ReturnType<ScheduledEventSpecification["parsePayload"]>): Promise<{
1344
+ success: true;
1345
+ }>;
638
1346
  toJSON(): TriggerMetadata;
639
1347
  }
640
1348
  /** `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.
@@ -701,7 +1409,172 @@ declare class DynamicSchedule implements Trigger<ScheduledEventSpecification> {
701
1409
  }>;
702
1410
  attachToJob(triggerClient: TriggerClient, job: Job<Trigger<ScheduledEventSpecification>, any>): void;
703
1411
  get preprocessRuns(): boolean;
1412
+ verifyPayload(payload: ReturnType<ScheduledEventSpecification["parsePayload"]>): Promise<{
1413
+ success: true;
1414
+ }>;
1415
+ toJSON(): TriggerMetadata;
1416
+ }
1417
+
1418
+ type ConcurrencyLimitOptions = {
1419
+ id: string;
1420
+ limit: number;
1421
+ };
1422
+ declare class ConcurrencyLimit {
1423
+ private options;
1424
+ constructor(options: ConcurrencyLimitOptions);
1425
+ get id(): string;
1426
+ get limit(): number;
1427
+ }
1428
+
1429
+ type WebhookCRUDContext<TParams extends any, TConfig extends Record<string, string[]>> = {
1430
+ active: boolean;
1431
+ params: TParams;
1432
+ config: {
1433
+ current: Partial<TConfig>;
1434
+ desired: TConfig;
1435
+ };
1436
+ url: string;
1437
+ secret: string;
1438
+ };
1439
+ type WebhookCRUDFunction<TIntegration extends TriggerIntegration, TParams extends any, TConfig extends Record<string, string[]>> = (options: {
1440
+ io: IOWithIntegrations<{
1441
+ integration: TIntegration;
1442
+ }>;
1443
+ ctx: WebhookCRUDContext<TParams, TConfig>;
1444
+ }) => Promise<any>;
1445
+ interface WebhookCRUD<TIntegration extends TriggerIntegration, TParams extends any, TConfig extends Record<string, string[]>> {
1446
+ create: WebhookCRUDFunction<TIntegration, TParams, TConfig>;
1447
+ read?: WebhookCRUDFunction<TIntegration, TParams, TConfig>;
1448
+ update?: WebhookCRUDFunction<TIntegration, TParams, TConfig>;
1449
+ delete: WebhookCRUDFunction<TIntegration, TParams, TConfig>;
1450
+ }
1451
+ type WebhookConfig<TConfigKeys extends string> = {
1452
+ [K in TConfigKeys]: string[];
1453
+ };
1454
+ type RegisterFunctionEvent<TParams extends any, TConfig extends Record<string, string[]>> = {
1455
+ source: {
1456
+ active: boolean;
1457
+ data?: any;
1458
+ secret: string;
1459
+ url: string;
1460
+ };
1461
+ params: TParams;
1462
+ config: TConfig;
1463
+ };
1464
+ type WebhookRegisterEvent<TConfig extends Record<string, string[]>> = {
1465
+ id: string;
1466
+ source: RegisterWebhookSource;
1467
+ dynamicTriggerId?: string;
1468
+ config: TConfig;
1469
+ };
1470
+ type RegisterFunctionOutput<TConfig extends Record<string, string[]>> = {
1471
+ secret?: string;
1472
+ data?: SerializableJson;
1473
+ config: TConfig;
1474
+ };
1475
+ type RegisterFunction<TIntegration extends TriggerIntegration, TParams extends any, TConfig extends Record<string, string[]>> = (event: RegisterFunctionEvent<TParams, TConfig>, io: IOWithIntegrations<{
1476
+ integration: TIntegration;
1477
+ }>, ctx: TriggerContext) => Promise<RegisterFunctionOutput<TConfig> | undefined>;
1478
+ type WebhookHandlerEvent<TParams extends any = any> = {
1479
+ rawEvent: Request;
1480
+ source: Prettify<Omit<HandleTriggerSource, "params"> & {
1481
+ params: TParams;
1482
+ }>;
1483
+ };
1484
+ type WebhookDeliveryContext = {
1485
+ key: string;
1486
+ secret: string;
1487
+ params: any;
1488
+ };
1489
+ type EventGenerator<TParams extends any, TConfig extends Record<string, string[]>, TIntegration extends TriggerIntegration> = (options: {
1490
+ request: Request;
1491
+ client: TriggerClient;
1492
+ ctx: WebhookDeliveryContext;
1493
+ }) => Promise<any>;
1494
+ type KeyFunction<TParams extends any> = (params: TParams) => string;
1495
+ type FilterFunction<TParams extends any, TConfig extends Record<string, string[]>> = (params: TParams, config?: TConfig) => EventFilter;
1496
+ type WebhookOptions<TIntegration extends TriggerIntegration, TParams extends any, TConfig extends Record<string, string[]>> = {
1497
+ id: string;
1498
+ version: string;
1499
+ integration: TIntegration;
1500
+ schemas: {
1501
+ params: SchemaParser<TParams>;
1502
+ config?: SchemaParser<TConfig>;
1503
+ };
1504
+ key: KeyFunction<TParams>;
1505
+ crud: WebhookCRUD<TIntegration, TParams, TConfig>;
1506
+ filter?: FilterFunction<TParams, TConfig>;
1507
+ register?: RegisterFunction<TIntegration, TParams, TConfig>;
1508
+ verify?: (options: {
1509
+ request: Request;
1510
+ client: TriggerClient;
1511
+ ctx: WebhookDeliveryContext;
1512
+ }) => Promise<VerifyResult>;
1513
+ generateEvents: EventGenerator<TParams, TConfig, TIntegration>;
1514
+ properties?: (params: TParams) => DisplayProperty[];
1515
+ };
1516
+ declare class WebhookSource<TIntegration extends TriggerIntegration, TParams extends any = any, TConfig extends Record<string, string[]> = Record<string, string[]>> {
1517
+ #private;
1518
+ private options;
1519
+ constructor(options: WebhookOptions<TIntegration, TParams, TConfig>);
1520
+ generateEvents(request: Request, client: TriggerClient, ctx: WebhookDeliveryContext): Promise<any>;
1521
+ filter(params: TParams, config?: TConfig): EventFilter;
1522
+ properties(params: TParams): DisplayProperty[];
1523
+ get crud(): WebhookCRUD<TIntegration, TParams, TConfig>;
1524
+ register(params: TParams, registerEvent: WebhookRegisterEvent<TConfig>, io: IO, ctx: TriggerContext): Promise<RegisterFunctionOutput<TConfig> | undefined>;
1525
+ verify(request: Request, client: TriggerClient, ctx: WebhookDeliveryContext): Promise<VerifyResult>;
1526
+ key(params: TParams): string;
1527
+ get integration(): TIntegration;
1528
+ get integrationConfig(): {
1529
+ id: string;
1530
+ metadata: {
1531
+ id: string;
1532
+ name: string;
1533
+ instructions?: string | undefined;
1534
+ };
1535
+ };
1536
+ get id(): string;
1537
+ get version(): string;
1538
+ }
1539
+ type GetWebhookParams<TWebhook extends WebhookSource<any, any, any>> = TWebhook extends WebhookSource<any, infer TParams, any> ? TParams : never;
1540
+ type GetWebhookConfig<TWebhook extends WebhookSource<any, any, any>> = TWebhook extends WebhookSource<any, any, infer TConfig> ? TConfig : never;
1541
+ type WebhookTriggerOptions<TEventSpecification extends EventSpecification<any>, TEventSource extends WebhookSource<any, any, any>, TConfig extends Record<string, string[]> = Record<string, string[]>> = {
1542
+ event: TEventSpecification;
1543
+ source: TEventSource;
1544
+ params: GetWebhookParams<TEventSource>;
1545
+ config: TConfig;
1546
+ };
1547
+ declare class WebhookTrigger<TEventSpecification extends EventSpecification<any>, TEventSource extends WebhookSource<any, any, any>> implements Trigger<TEventSpecification> {
1548
+ private options;
1549
+ constructor(options: WebhookTriggerOptions<TEventSpecification, TEventSource>);
1550
+ get event(): TEventSpecification;
1551
+ get source(): TEventSource;
1552
+ get key(): string;
704
1553
  toJSON(): TriggerMetadata;
1554
+ filter(eventFilter: EventFilter): WebhookTrigger<Omit<TEventSpecification, "filter"> & {
1555
+ filter: EventFilter;
1556
+ }, TEventSource>;
1557
+ attachToJob(triggerClient: TriggerClient, job: Job<Trigger<TEventSpecification>, any>): void;
1558
+ get preprocessRuns(): boolean;
1559
+ verifyPayload(payload: ReturnType<TEventSpecification["parsePayload"]>): Promise<{
1560
+ success: true;
1561
+ }>;
1562
+ }
1563
+
1564
+ declare class KeyValueStore {
1565
+ #private;
1566
+ private apiClient;
1567
+ private type;
1568
+ private namespace;
1569
+ constructor(apiClient: ApiClient, type?: string | null, namespace?: string);
1570
+ delete(cacheKey: string | any[], key: string): Promise<boolean>;
1571
+ delete(key: string): Promise<boolean>;
1572
+ get<T extends Json<T> = any>(cacheKey: string | any[], key: string): Promise<T>;
1573
+ get<T extends Json<T> = any>(key: string): Promise<T>;
1574
+ has(cacheKey: string | any[], key: string): Promise<boolean>;
1575
+ has(key: string): Promise<boolean>;
1576
+ set<T extends Json<T>>(cacheKey: string | any[], key: string, value: T): Promise<T>;
1577
+ set<T extends Json<T>>(key: string, value: T): Promise<T>;
705
1578
  }
706
1579
 
707
1580
  type TriggerClientOptions = {
@@ -734,11 +1607,20 @@ declare class TriggerClient {
734
1607
  #private;
735
1608
  id: string;
736
1609
  constructor(options: Prettify<TriggerClientOptions>);
737
- handleRequest(request: Request): Promise<NormalizedResponse>;
738
- defineJob<TTrigger extends Trigger<EventSpecification<any>>, TIntegrations extends Record<string, TriggerIntegration> = {}>(options: JobOptions<TTrigger, TIntegrations>): Job<TTrigger, TIntegrations>;
1610
+ on: <E extends keyof NotificationEvents>(event: E, listener: NotificationEvents[E]) => NotificationsEventEmitter;
1611
+ handleRequest(request: Request, timeOrigin?: number): Promise<NormalizedResponse>;
1612
+ defineJob<TTrigger extends Trigger<EventSpecification<any>>, TIntegrations extends Record<string, TriggerIntegration> = {}, TOutput extends any = any>(options: JobOptions<TTrigger, TIntegrations, TOutput>): Job<TTrigger, TIntegrations, TOutput>;
739
1613
  defineAuthResolver(integration: TriggerIntegration, resolver: TriggerAuthResolver): TriggerClient;
740
1614
  defineDynamicSchedule(options: DynamicIntervalOptions): DynamicSchedule;
741
1615
  defineDynamicTrigger<TEventSpec extends EventSpecification<any>, TExternalSource extends ExternalSource<any, any, any>>(options: DynamicTriggerOptions<TEventSpec, TExternalSource>): DynamicTrigger<TEventSpec, TExternalSource>;
1616
+ /**
1617
+ * 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.
1618
+ * @param options The Endpoint options
1619
+ * @returns An HTTP Endpoint, that can be used to create an HTTP Trigger.
1620
+ * @link https://trigger.dev/docs/documentation/concepts/http-endpoints
1621
+ */
1622
+ defineHttpEndpoint(options: EndpointOptions, suppressWarnings?: boolean): HttpEndpoint<EventSpecification<Request, Request>>;
1623
+ defineConcurrencyLimit(options: ConcurrencyLimitOptions): ConcurrencyLimit;
742
1624
  attach(job: Job<Trigger<any>, any>): void;
743
1625
  attachDynamicTrigger(trigger: DynamicTrigger<any, any>): void;
744
1626
  attachJobToDynamicTrigger(job: Job<Trigger<any>, any>, trigger: DynamicTrigger<any, any>): void;
@@ -751,7 +1633,14 @@ declare class TriggerClient {
751
1633
  }): void;
752
1634
  attachDynamicSchedule(key: string): void;
753
1635
  attachDynamicScheduleToJob(key: string, job: Job<Trigger<any>, any>): void;
754
- registerTrigger(id: string, key: string, options: RegisterTriggerBodyV2): Promise<{
1636
+ attachWebhook<TIntegration extends TriggerIntegration, TParams extends any, TConfig extends Record<string, string[]>>(options: {
1637
+ key: string;
1638
+ source: WebhookSource<TIntegration, TParams, TConfig>;
1639
+ event: EventSpecification<any>;
1640
+ params: any;
1641
+ config: TConfig;
1642
+ }): void;
1643
+ registerTrigger(id: string, key: string, options: RegisterTriggerBodyV2, idempotencyKey?: string): Promise<{
755
1644
  id: string;
756
1645
  options: {
757
1646
  event: {
@@ -788,7 +1677,7 @@ declare class TriggerClient {
788
1677
  scopes?: string[] | undefined;
789
1678
  additionalFields?: Record<string, string> | undefined;
790
1679
  } | undefined>;
791
- /** 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.
1680
+ /** You can call this function from anywhere in your backend 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.
792
1681
  * @param event The event to send.
793
1682
  * @param options Options for sending the event.
794
1683
  * @returns A promise that resolves to the event details
@@ -807,6 +1696,25 @@ declare class TriggerClient {
807
1696
  deliveredAt?: Date | null | undefined;
808
1697
  cancelledAt?: Date | null | undefined;
809
1698
  }>;
1699
+ /** 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.
1700
+ * @param events The events to send.
1701
+ * @param options Options for sending the events.
1702
+ * @returns A promise that resolves to an array of event details
1703
+ */
1704
+ sendEvents(events: SendEvent[], options?: SendEventOptions): Promise<{
1705
+ id: string;
1706
+ name: string;
1707
+ payload: ((string | number | boolean | {
1708
+ [key: string]: DeserializedJson;
1709
+ } | DeserializedJson[]) & (string | number | boolean | {
1710
+ [key: string]: DeserializedJson;
1711
+ } | DeserializedJson[] | undefined)) | null;
1712
+ timestamp: Date;
1713
+ context?: DeserializedJson | undefined;
1714
+ deliverAt?: Date | null | undefined;
1715
+ deliveredAt?: Date | null | undefined;
1716
+ cancelledAt?: Date | null | undefined;
1717
+ }[]>;
810
1718
  cancelEvent(eventId: string): Promise<{
811
1719
  id: string;
812
1720
  name: string;
@@ -821,6 +1729,10 @@ declare class TriggerClient {
821
1729
  deliveredAt?: Date | null | undefined;
822
1730
  cancelledAt?: Date | null | undefined;
823
1731
  }>;
1732
+ cancelRunsForEvent(eventId: string): Promise<{
1733
+ cancelledRunIds: string[];
1734
+ failedToCancelRunIds: string[];
1735
+ }>;
824
1736
  updateStatus(runId: string, id: string, status: StatusUpdate): Promise<{
825
1737
  label: string;
826
1738
  key: string;
@@ -861,7 +1773,7 @@ declare class TriggerClient {
861
1773
  updatedAt: Date;
862
1774
  runs: {
863
1775
  id: string;
864
- status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD";
1776
+ 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";
865
1777
  startedAt?: Date | null | undefined;
866
1778
  completedAt?: Date | null | undefined;
867
1779
  }[];
@@ -871,11 +1783,31 @@ declare class TriggerClient {
871
1783
  id: string;
872
1784
  startedAt: Date | null;
873
1785
  completedAt: Date | null;
874
- status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD";
1786
+ 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";
875
1787
  updatedAt: Date | null;
876
1788
  tasks: _trigger_dev_core.RunTaskWithSubtasks[];
1789
+ statuses: {
1790
+ label: string;
1791
+ key: string;
1792
+ history: {
1793
+ label?: string | undefined;
1794
+ state?: "loading" | "success" | "failure" | undefined;
1795
+ data?: Record<string, _trigger_dev_core.SerializableJson> | undefined;
1796
+ }[];
1797
+ data?: Record<string, _trigger_dev_core.SerializableJson> | undefined;
1798
+ state?: "loading" | "success" | "failure" | undefined;
1799
+ }[];
877
1800
  output?: any;
878
- statuses?: {
1801
+ nextCursor?: string | undefined;
1802
+ }>;
1803
+ cancelRun(runId: string): Promise<{
1804
+ id: string;
1805
+ startedAt: Date | null;
1806
+ completedAt: Date | null;
1807
+ 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";
1808
+ updatedAt: Date | null;
1809
+ tasks: _trigger_dev_core.RunTaskWithSubtasks[];
1810
+ statuses: {
879
1811
  label: string;
880
1812
  key: string;
881
1813
  history: {
@@ -885,7 +1817,8 @@ declare class TriggerClient {
885
1817
  }[];
886
1818
  data?: Record<string, _trigger_dev_core.SerializableJson> | undefined;
887
1819
  state?: "loading" | "success" | "failure" | undefined;
888
- }[] | undefined;
1820
+ }[];
1821
+ output?: any;
889
1822
  nextCursor?: string | undefined;
890
1823
  }>;
891
1824
  getRuns(jobSlug: string, options?: GetRunsOptions): Promise<{
@@ -893,7 +1826,7 @@ declare class TriggerClient {
893
1826
  id: string;
894
1827
  startedAt: Date | null;
895
1828
  completedAt: Date | null;
896
- status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD";
1829
+ 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";
897
1830
  updatedAt: Date | null;
898
1831
  }[];
899
1832
  nextCursor?: string | undefined;
@@ -912,42 +1845,41 @@ declare class TriggerClient {
912
1845
  }[];
913
1846
  run: {
914
1847
  id: string;
915
- status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD";
1848
+ 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";
916
1849
  output?: any;
917
1850
  };
918
1851
  }>;
1852
+ invokeJob(jobId: string, payload: any, options?: InvokeOptions): Promise<{
1853
+ id: string;
1854
+ }>;
1855
+ createEphemeralEventDispatcher(payload: EphemeralEventDispatcherRequestBody): Promise<{
1856
+ id: string;
1857
+ }>;
1858
+ get store(): {
1859
+ env: KeyValueStore;
1860
+ };
919
1861
  authorized(apiKey?: string | null): "authorized" | "unauthorized" | "missing-client" | "missing-header";
920
1862
  apiKey(): string | undefined;
921
1863
  }
922
1864
 
923
- declare class TriggerStatus {
924
- private id;
925
- private io;
926
- constructor(id: string, io: IO);
927
- update(key: IntegrationTaskKey, status: StatusUpdate): Promise<{
928
- label: string;
929
- key: string;
930
- history: {
931
- label?: string | undefined;
932
- state?: "loading" | "success" | "failure" | undefined;
933
- data?: Record<string, _trigger_dev_core.SerializableJson> | undefined;
934
- }[];
935
- data?: Record<string, _trigger_dev_core.SerializableJson> | undefined;
936
- state?: "loading" | "success" | "failure" | undefined;
937
- }>;
938
- }
939
-
940
1865
  type IOTask = ServerTask;
941
1866
  type IOOptions = {
942
1867
  id: string;
1868
+ jobId: string;
943
1869
  apiClient: ApiClient;
944
1870
  client: TriggerClient;
945
1871
  context: TriggerContext;
1872
+ timeOrigin: number;
946
1873
  logger?: Logger;
947
1874
  logLevel?: LogLevel;
948
1875
  jobLogger?: Logger;
949
1876
  jobLogLevel: LogLevel;
950
1877
  cachedTasks?: Array<CachedTask>;
1878
+ cachedTasksCursor?: string;
1879
+ yieldedExecutions?: Array<string>;
1880
+ noopTasksSet?: string;
1881
+ serverVersion?: string | null;
1882
+ executionTimeout?: number;
951
1883
  };
952
1884
  type JsonPrimitive = string | number | boolean | null | undefined | Date | symbol;
953
1885
  type JsonArray = Json[];
@@ -961,9 +1893,32 @@ type RunTaskErrorCallback = (error: unknown, task: IOTask, io: IO) => {
961
1893
  jitter?: number;
962
1894
  skipRetrying?: boolean;
963
1895
  } | Error | undefined | void;
1896
+ type IOStats = {
1897
+ initialCachedTasks: number;
1898
+ lazyLoadedCachedTasks: number;
1899
+ executedTasks: number;
1900
+ cachedTaskHits: number;
1901
+ cachedTaskMisses: number;
1902
+ noopCachedTaskHits: number;
1903
+ noopCachedTaskMisses: number;
1904
+ };
1905
+ interface OutputSerializer {
1906
+ serialize(value: any): string;
1907
+ deserialize<T>(value: string): T;
1908
+ }
1909
+ declare class JSONOutputSerializer implements OutputSerializer {
1910
+ serialize(value: any): string;
1911
+ deserialize(value?: string): any;
1912
+ }
1913
+ type BackgroundFetchResponse<T> = {
1914
+ status: number;
1915
+ data: T;
1916
+ headers: Record<string, string>;
1917
+ };
964
1918
  declare class IO {
965
1919
  #private;
966
1920
  private _id;
1921
+ private _jobId;
967
1922
  private _apiClient;
968
1923
  private _triggerClient;
969
1924
  private _logger;
@@ -971,17 +1926,73 @@ declare class IO {
971
1926
  private _jobLogLevel;
972
1927
  private _cachedTasks;
973
1928
  private _taskStorage;
1929
+ private _cachedTasksCursor?;
974
1930
  private _context;
1931
+ private _yieldedExecutions;
1932
+ private _noopTasksBloomFilter;
1933
+ private _stats;
1934
+ private _serverVersion;
1935
+ private _timeOrigin;
1936
+ private _executionTimeout?;
1937
+ private _outputSerializer;
1938
+ private _visitedCacheKeys;
1939
+ private _envStore;
1940
+ private _jobStore;
1941
+ private _runStore;
1942
+ get stats(): IOStats;
975
1943
  constructor(options: IOOptions);
976
1944
  /** Used to send log messages to the [Run log](https://trigger.dev/docs/documentation/guides/viewing-runs). */
977
1945
  get logger(): IOLogger;
1946
+ /** `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.
1947
+ * @param cacheKey Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
1948
+ * @param min Sets the lower bound (inclusive). Can't be higher than `max`.
1949
+ * @param max Sets the upper bound (exclusive). Can't be lower than `min`.
1950
+ * @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.
1951
+ */
1952
+ random(cacheKey: string | any[], { min, max, round, }?: {
1953
+ min?: number;
1954
+ max?: number;
1955
+ round?: boolean;
1956
+ }): Promise<number>;
978
1957
  /** `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.
979
- * @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
1958
+ * @param cacheKey Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
980
1959
  * @param seconds The number of seconds to wait. This can be very long, serverless timeouts are not an issue.
981
1960
  */
982
- wait(key: string | any[], seconds: number): Promise<void>;
1961
+ wait(cacheKey: string | any[], seconds: number): Promise<void>;
1962
+ waitForEvent<T extends z.ZodTypeAny = z.ZodTypeAny>(cacheKey: string | any[], event: {
1963
+ name: string;
1964
+ schema?: T;
1965
+ filter?: EventFilter;
1966
+ source?: string;
1967
+ contextFilter?: EventFilter;
1968
+ accountId?: string;
1969
+ }, options?: {
1970
+ timeoutInSeconds?: number;
1971
+ }): Promise<WaitForEventResult<z.output<T>>>;
1972
+ /** `io.waitForRequest()` allows you to pause the execution of a run until the url provided in the callback is POSTed to.
1973
+ * 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.
1974
+ * @param cacheKey Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
1975
+ * @param callback A callback function that will provide the unique URL to POST to.
1976
+ * @param options Options for the callback.
1977
+ * @param options.timeoutInSeconds How long to wait for the request to be POSTed to the callback URL before timing out. Defaults to 1hr.
1978
+ * @returns The POSTed request JSON body.
1979
+ * @example
1980
+ * ```ts
1981
+ const result = await io.waitForRequest<{ message: string }>(
1982
+ "wait-for-request",
1983
+ async (url, task) => {
1984
+ // Save the URL somewhere so you can POST to it later
1985
+ // Or send it to an external service that will POST to it
1986
+ },
1987
+ { timeoutInSeconds: 60 } // wait 60 seconds
1988
+ );
1989
+ * ```
1990
+ */
1991
+ waitForRequest<T extends Json<T> | unknown = unknown>(cacheKey: string | any[], callback: (url: string) => Promise<unknown>, options?: {
1992
+ timeoutInSeconds?: number;
1993
+ }): Promise<T>;
983
1994
  /** `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
984
- * @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
1995
+ * @param cacheKey Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
985
1996
  * @param initialStatus The initial status you want this status to have. You can update it during the rub using the returned object.
986
1997
  * @returns a TriggerStatus object that you can call `update()` on, to update the status.
987
1998
  * @example
@@ -1012,9 +2023,58 @@ declare class IO {
1012
2023
  });
1013
2024
  * ```
1014
2025
  */
1015
- createStatus(key: IntegrationTaskKey, initialStatus: InitialStatusUpdate): Promise<TriggerStatus>;
2026
+ createStatus(cacheKey: IntegrationTaskKey, initialStatus: InitialStatusUpdate): Promise<TriggerStatus>;
1016
2027
  /** `io.backgroundFetch()` fetches data from a URL that can take longer that the serverless timeout. The actual `fetch` request is performed on the Trigger.dev platform, and the response is sent back to you.
1017
- * @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
2028
+ * @param cacheKey Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
2029
+ * @param url The URL to fetch from.
2030
+ * @param requestInit The options for the request
2031
+ * @param retry The options for retrying the request if it fails
2032
+ * An object where the key is a status code pattern and the value is a retrying strategy.
2033
+ * Supported patterns are:
2034
+ * - Specific status codes: 429
2035
+ * - Ranges: 500-599
2036
+ * - Wildcards: 2xx, 3xx, 4xx, 5xx
2037
+ */
2038
+ backgroundFetch<TResponseData>(cacheKey: string | any[], url: string, requestInit?: FetchRequestInit, options?: {
2039
+ retry?: FetchRetryOptions;
2040
+ timeout?: FetchTimeoutOptions;
2041
+ }): Promise<TResponseData>;
2042
+ /** `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.
2043
+ * @param cacheKey Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
2044
+ * @param params The options for the background poll
2045
+ * @param params.url The URL to fetch from.
2046
+ * @param params.requestInit The options for the request, like headers and method
2047
+ * @param params.responseFilter An [EventFilter](https://trigger.dev/docs/documentation/guides/event-filter) that allows you to specify when to stop polling.
2048
+ * @param params.interval The interval in seconds to poll the URL in seconds. Defaults to 10 seconds which is the minimum.
2049
+ * @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
2050
+ * @param params.requestTimeout An optional object that allows you to timeout individual fetch requests
2051
+ * @param params.requestTimeout An optional object that allows you to timeout individual fetch requests
2052
+ * @param params.requestTimeout.durationInMs The duration in milliseconds to timeout the request
2053
+ *
2054
+ * @example
2055
+ * ```ts
2056
+ * const result = await io.backgroundPoll<{ id: string; status: string; }>("poll", {
2057
+ url: `http://localhost:3030/api/v1/runs/${run.id}`,
2058
+ requestInit: {
2059
+ headers: {
2060
+ Accept: "application/json",
2061
+ Authorization: redactString`Bearer ${process.env["TRIGGER_API_KEY"]!}`,
2062
+ },
2063
+ },
2064
+ interval: 10,
2065
+ timeout: 600,
2066
+ responseFilter: {
2067
+ status: [200],
2068
+ body: {
2069
+ status: ["SUCCESS"],
2070
+ },
2071
+ },
2072
+ });
2073
+ * ```
2074
+ */
2075
+ backgroundPoll<TResponseData>(cacheKey: string | any[], params: FetchPollOperation): Promise<TResponseData>;
2076
+ /** `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.
2077
+ * @param cacheKey Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
1018
2078
  * @param url The URL to fetch from.
1019
2079
  * @param requestInit The options for the request
1020
2080
  * @param retry The options for retrying the request if it fails
@@ -1024,13 +2084,16 @@ declare class IO {
1024
2084
  * - Ranges: 500-599
1025
2085
  * - Wildcards: 2xx, 3xx, 4xx, 5xx
1026
2086
  */
1027
- backgroundFetch<TResponseData>(key: string | any[], url: string, requestInit?: FetchRequestInit, retry?: FetchRetryOptions): Promise<TResponseData>;
1028
- /** `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).
1029
- * @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
2087
+ backgroundFetchResponse<TResponseData>(cacheKey: string | any[], url: string, requestInit?: FetchRequestInit, options?: {
2088
+ retry?: FetchRetryOptions;
2089
+ timeout?: FetchTimeoutOptions;
2090
+ }): Promise<BackgroundFetchResponse<TResponseData>>;
2091
+ /** `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).
2092
+ * @param cacheKey Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
1030
2093
  * @param event The event to send. The event name must match the name of the event that your Jobs are listening for.
1031
2094
  * @param options Options for sending the event.
1032
2095
  */
1033
- sendEvent(key: string | any[], event: SendEvent, options?: SendEventOptions): Promise<{
2096
+ sendEvent(cacheKey: string | any[], event: SendEvent, options?: SendEventOptions): Promise<{
1034
2097
  id: string;
1035
2098
  name: string;
1036
2099
  payload: ((string | number | boolean | {
@@ -1044,24 +2107,43 @@ declare class IO {
1044
2107
  deliveredAt?: Date | null | undefined;
1045
2108
  cancelledAt?: Date | null | undefined;
1046
2109
  }>;
1047
- getEvent(key: string | any[], id: string): Promise<{
2110
+ /** `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).
2111
+ * @param cacheKey Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
2112
+ * @param event The events to send. The event names must match the names of the events that your Jobs are listening for.
2113
+ * @param options Options for sending the events.
2114
+ */
2115
+ sendEvents(cacheKey: string | any[], events: SendEvent[], options?: SendEventOptions): Promise<{
2116
+ id: string;
2117
+ name: string;
2118
+ payload: ((string | number | boolean | {
2119
+ [key: string]: _trigger_dev_core.DeserializedJson;
2120
+ } | _trigger_dev_core.DeserializedJson[]) & (string | number | boolean | {
2121
+ [key: string]: _trigger_dev_core.DeserializedJson;
2122
+ } | _trigger_dev_core.DeserializedJson[] | undefined)) | null;
2123
+ timestamp: Date;
2124
+ context?: _trigger_dev_core.DeserializedJson | undefined;
2125
+ deliverAt?: Date | null | undefined;
2126
+ deliveredAt?: Date | null | undefined;
2127
+ cancelledAt?: Date | null | undefined;
2128
+ }[]>;
2129
+ getEvent(cacheKey: string | any[], id: string): Promise<{
1048
2130
  id: string;
1049
2131
  name: string;
1050
2132
  updatedAt: Date;
1051
2133
  runs: {
1052
2134
  id: string;
1053
- status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD";
2135
+ 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";
1054
2136
  startedAt?: Date | null | undefined;
1055
2137
  completedAt?: Date | null | undefined;
1056
2138
  }[];
1057
2139
  createdAt: Date;
1058
2140
  }>;
1059
2141
  /** `io.cancelEvent()` allows you to cancel an event that was previously sent with `io.sendEvent()`. This will prevent any Jobs from running that are listening for that event if the event was sent with a delay
1060
- * @param key
2142
+ * @param cacheKey
1061
2143
  * @param eventId
1062
2144
  * @returns
1063
2145
  */
1064
- cancelEvent(key: string | any[], eventId: string): Promise<{
2146
+ cancelEvent(cacheKey: string | any[], eventId: string): Promise<{
1065
2147
  id: string;
1066
2148
  name: string;
1067
2149
  payload: ((string | number | boolean | {
@@ -1075,21 +2157,27 @@ declare class IO {
1075
2157
  deliveredAt?: Date | null | undefined;
1076
2158
  cancelledAt?: Date | null | undefined;
1077
2159
  }>;
1078
- updateSource(key: string | any[], options: {
2160
+ updateSource(cacheKey: string | any[], options: {
1079
2161
  key: string;
1080
2162
  } & UpdateTriggerSourceBodyV2): Promise<{
1081
2163
  id: string;
1082
2164
  key: string;
1083
2165
  }>;
2166
+ updateWebhook(cacheKey: string | any[], options: {
2167
+ key: string;
2168
+ } & UpdateWebhookBody): Promise<{
2169
+ id: string;
2170
+ key: string;
2171
+ }>;
1084
2172
  /** `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.
1085
- * @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
2173
+ * @param cacheKey Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
1086
2174
  * @param dynamicSchedule The [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) to register a new schedule on.
1087
2175
  * @param id A unique id for the interval. This is used to identify and unregister the interval later.
1088
2176
  * @param options The options for the interval.
1089
2177
  * @returns A promise that has information about the interval.
1090
2178
  * @deprecated Use `DynamicSchedule.register` instead.
1091
2179
  */
1092
- registerInterval(key: string | any[], dynamicSchedule: DynamicSchedule, id: string, options: IntervalOptions): Promise<{
2180
+ registerInterval(cacheKey: string | any[], dynamicSchedule: DynamicSchedule, id: string, options: IntervalOptions): Promise<{
1093
2181
  id: string;
1094
2182
  schedule: {
1095
2183
  options: {
@@ -1110,22 +2198,22 @@ declare class IO {
1110
2198
  metadata?: any;
1111
2199
  }>;
1112
2200
  /** `io.unregisterInterval()` allows you to unregister a [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) that was previously registered with `io.registerInterval()`.
1113
- * @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
2201
+ * @param cacheKey Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
1114
2202
  * @param dynamicSchedule The [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) to unregister a schedule on.
1115
2203
  * @param id A unique id for the interval. This is used to identify and unregister the interval later.
1116
2204
  * @deprecated Use `DynamicSchedule.unregister` instead.
1117
2205
  */
1118
- unregisterInterval(key: string | any[], dynamicSchedule: DynamicSchedule, id: string): Promise<{
2206
+ unregisterInterval(cacheKey: string | any[], dynamicSchedule: DynamicSchedule, id: string): Promise<{
1119
2207
  ok: boolean;
1120
2208
  }>;
1121
2209
  /** `io.registerCron()` allows you to register a [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) that will trigger any jobs it's attached to on a regular CRON schedule.
1122
- * @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
2210
+ * @param cacheKey Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
1123
2211
  * @param dynamicSchedule The [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) to register a new schedule on.
1124
2212
  * @param id A unique id for the schedule. This is used to identify and unregister the schedule later.
1125
2213
  * @param options The options for the CRON schedule.
1126
2214
  * @deprecated Use `DynamicSchedule.register` instead.
1127
2215
  */
1128
- registerCron(key: string | any[], dynamicSchedule: DynamicSchedule, id: string, options: CronOptions): Promise<{
2216
+ registerCron(cacheKey: string | any[], dynamicSchedule: DynamicSchedule, id: string, options: CronOptions): Promise<{
1129
2217
  id: string;
1130
2218
  schedule: {
1131
2219
  options: {
@@ -1146,42 +2234,58 @@ declare class IO {
1146
2234
  metadata?: any;
1147
2235
  }>;
1148
2236
  /** `io.unregisterCron()` allows you to unregister a [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) that was previously registered with `io.registerCron()`.
1149
- * @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
2237
+ * @param cacheKey Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
1150
2238
  * @param dynamicSchedule The [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) to unregister a schedule on.
1151
2239
  * @param id A unique id for the interval. This is used to identify and unregister the interval later.
1152
2240
  * @deprecated Use `DynamicSchedule.unregister` instead.
1153
2241
  */
1154
- unregisterCron(key: string | any[], dynamicSchedule: DynamicSchedule, id: string): Promise<{
2242
+ unregisterCron(cacheKey: string | any[], dynamicSchedule: DynamicSchedule, id: string): Promise<{
1155
2243
  ok: boolean;
1156
2244
  }>;
1157
2245
  /** `io.registerTrigger()` allows you to register a [DynamicTrigger](https://trigger.dev/docs/sdk/dynamictrigger) with the specified trigger params.
1158
- * @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
2246
+ * @param cacheKey Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
1159
2247
  * @param trigger The [DynamicTrigger](https://trigger.dev/docs/sdk/dynamictrigger) to register.
1160
2248
  * @param id A unique id for the trigger. This is used to identify and unregister the trigger later.
1161
2249
  * @param params The params for the trigger.
1162
2250
  * @deprecated Use `DynamicTrigger.register` instead.
1163
2251
  */
1164
- registerTrigger<TTrigger extends DynamicTrigger<EventSpecification<any>, ExternalSource<any, any, any>>>(key: string | any[], trigger: TTrigger, id: string, params: ExternalSourceParams<TTrigger["source"]>): Promise<{
2252
+ registerTrigger<TTrigger extends DynamicTrigger<EventSpecification<any>, ExternalSource<any, any, any>>>(cacheKey: string | any[], trigger: TTrigger, id: string, params: ExternalSourceParams<TTrigger["source"]>): Promise<{
1165
2253
  id: string;
1166
2254
  key: string;
1167
2255
  } | undefined>;
1168
- getAuth(key: string | any[], clientId?: string): Promise<ConnectionAuth | undefined>;
2256
+ getAuth(cacheKey: string | any[], clientId?: string): Promise<ConnectionAuth | undefined>;
2257
+ 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>>;
1169
2258
  /** `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.
1170
2259
  *
1171
- * @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
2260
+ * @param cacheKey Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
1172
2261
  * @param callback The callback that will be called when the Task is run. The callback receives the Task and the IO as parameters.
1173
2262
  * @param options The options of how you'd like to run and log the Task.
1174
2263
  * @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.
1175
2264
  * @returns A Promise that resolves with the returned value of the callback.
1176
2265
  */
1177
- runTask<T extends Json<T> | void>(key: string | any[], callback: (task: ServerTask, io: IO) => Promise<T>, options?: RunTaskOptions, onError?: RunTaskErrorCallback): Promise<T>;
1178
- /** `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).
2266
+ runTask<T extends Json<T> | void>(cacheKey: string | any[], callback: (task: ServerTask, io: IO) => Promise<T>, options?: RunTaskOptions & {
2267
+ parseOutput?: (output: unknown) => T;
2268
+ }, onError?: RunTaskErrorCallback): Promise<T>;
2269
+ /**
2270
+ * `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.
2271
+ */
2272
+ yield(cacheKey: string): void;
2273
+ /**
2274
+ * `io.brb()` is an alias of `io.yield()`
2275
+ */
2276
+ brb: (cacheKey: string) => void;
2277
+ /** `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).
1179
2278
  * 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.
1180
2279
  * @param tryCallback The code you wish to run
1181
2280
  * @param catchCallback Thhis will be called if the Task fails. The callback receives the error
1182
2281
  * @returns A Promise that resolves with the returned value or the error
1183
2282
  */
1184
2283
  try<TResult, TCatchResult>(tryCallback: () => Promise<TResult>, catchCallback: (error: unknown) => Promise<TCatchResult>): Promise<TResult | TCatchResult>;
2284
+ get store(): {
2285
+ env: KeyValueStore;
2286
+ job: KeyValueStore;
2287
+ run: KeyValueStore;
2288
+ };
1185
2289
  }
1186
2290
  type CallbackFunction = (level: "DEBUG" | "INFO" | "WARN" | "ERROR" | "LOG", message: string, properties?: Record<string, any>) => Promise<void>;
1187
2291
  declare class IOLogger implements TaskLogger {
@@ -1208,7 +2312,7 @@ interface TriggerIntegration {
1208
2312
  type IOWithIntegrations<TIntegrations extends Record<string, TriggerIntegration>> = IO & TIntegrations;
1209
2313
  type IntegrationTaskKey = string | any[];
1210
2314
 
1211
- type JobOptions<TTrigger extends Trigger<EventSpecification<any>>, TIntegrations extends Record<string, TriggerIntegration> = {}> = {
2315
+ type JobOptions<TTrigger extends Trigger<EventSpecification<any>>, TIntegrations extends Record<string, TriggerIntegration> = {}, TOutput extends any = any> = {
1212
2316
  /** The `id` property is used to uniquely identify the Job. Only change this if you want to create a new Job. */
1213
2317
  id: string;
1214
2318
  /** The `name` of the Job that you want to appear in the dashboard and logs. You can change this without creating a new Job. */
@@ -1243,9 +2347,15 @@ type JobOptions<TTrigger extends Trigger<EventSpecification<any>>, TIntegrations
1243
2347
  });
1244
2348
  ``` */
1245
2349
  integrations?: TIntegrations;
1246
- /** @deprecated This property is deprecated and no longer effects the execution of the Job
1247
- * */
1248
- queue?: QueueOptions | string;
2350
+ /**
2351
+ * The `concurrencyLimit` property is used to limit the number of concurrent run executions of a job.
2352
+ * Can be a number which represents the limit or a `ConcurrencyLimit` instance which can be used to
2353
+ * group together multiple jobs to share the same concurrency limit.
2354
+ *
2355
+ * If undefined the job will be limited only by the server's global concurrency limit, or if you are using the
2356
+ * Trigger.dev Cloud service, the concurrency limit of your plan.
2357
+ */
2358
+ concurrencyLimit?: number | ConcurrencyLimit;
1249
2359
  /** The `enabled` property is used to enable or disable the Job. If you disable a Job, it will not run. */
1250
2360
  enabled?: boolean;
1251
2361
  /** This function gets called automatically when a Run is Triggered.
@@ -1254,19 +2364,21 @@ type JobOptions<TTrigger extends Trigger<EventSpecification<any>>, TIntegrations
1254
2364
  * @param io An object that contains the integrations that you specified in the `integrations` property and other useful functions like delays and running Tasks.
1255
2365
  * @param context An object that contains information about the Organization, Job, Run and more.
1256
2366
  */
1257
- run: (payload: TriggerEventType<TTrigger>, io: IOWithIntegrations<TIntegrations>, context: TriggerContext) => Promise<any>;
2367
+ run: (payload: TriggerEventType<TTrigger>, io: IOWithIntegrations<TIntegrations>, context: TriggerContext) => Promise<TOutput>;
2368
+ onSuccess?: (notification: SuccessfulRunNotification<TOutput, TriggerEventType<TTrigger>>) => void;
2369
+ onFailure?: (notification: FailedRunNotification<TriggerEventType<TTrigger>>) => void;
1258
2370
  };
1259
2371
  type JobPayload<TJob> = TJob extends Job<Trigger<EventSpecification<infer TEvent>>, any> ? TEvent : never;
1260
2372
  type JobIO<TJob> = TJob extends Job<any, infer TIntegrations> ? IOWithIntegrations<TIntegrations> : never;
1261
2373
  /** 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. */
1262
- declare class Job<TTrigger extends Trigger<EventSpecification<any>>, TIntegrations extends Record<string, TriggerIntegration> = {}> {
2374
+ declare class Job<TTrigger extends Trigger<EventSpecification<any>>, TIntegrations extends Record<string, TriggerIntegration> = {}, TOutput extends any = any> {
1263
2375
  #private;
1264
- readonly options: JobOptions<TTrigger, TIntegrations>;
2376
+ readonly options: JobOptions<TTrigger, TIntegrations, TOutput>;
1265
2377
  client: TriggerClient;
1266
2378
  constructor(
1267
2379
  /** An instance of [TriggerClient](/sdk/triggerclient) that is used to send events
1268
2380
  to the Trigger API. */
1269
- client: TriggerClient, options: JobOptions<TTrigger, TIntegrations>);
2381
+ client: TriggerClient, options: JobOptions<TTrigger, TIntegrations, TOutput>);
1270
2382
  get id(): string;
1271
2383
  get enabled(): boolean;
1272
2384
  get name(): string;
@@ -1275,6 +2387,19 @@ declare class Job<TTrigger extends Trigger<EventSpecification<any>>, TIntegratio
1275
2387
  get logLevel(): LogLevel | undefined;
1276
2388
  get integrations(): Record<string, IntegrationConfig>;
1277
2389
  toJSON(): JobMetadata;
2390
+ invoke(cacheKey: string, payload: TriggerInvokeType<TTrigger>, options?: InvokeOptions): Promise<{
2391
+ id: string;
2392
+ }>;
2393
+ invoke(payload: TriggerInvokeType<TTrigger>, options?: InvokeOptions): Promise<{
2394
+ id: string;
2395
+ }>;
2396
+ invokeAndWaitForCompletion(cacheKey: string | string[], payload: TriggerInvokeType<TTrigger>, timeoutInSeconds?: number, // 1 hour
2397
+ options?: Prettify<Pick<InvokeOptions, "accountId" | "context">>): Promise<RunNotification<TOutput>>;
2398
+ batchInvokeAndWaitForCompletion(cacheKey: string | string[], batch: Array<{
2399
+ payload: TriggerInvokeType<TTrigger>;
2400
+ timeoutInSeconds?: number;
2401
+ options?: Prettify<Pick<InvokeOptions, "accountId" | "context">>;
2402
+ }>): Promise<Array<RunNotification<TOutput>>>;
1278
2403
  }
1279
2404
 
1280
2405
  type EventTriggerOptions<TEventSpecification extends EventSpecification<any>> = {
@@ -1282,6 +2407,7 @@ type EventTriggerOptions<TEventSpecification extends EventSpecification<any>> =
1282
2407
  name?: string | string[];
1283
2408
  source?: string;
1284
2409
  filter?: EventFilter;
2410
+ verify?: EventTypeFromSpecification<TEventSpecification> extends Request ? VerifyCallback : never;
1285
2411
  };
1286
2412
  declare class EventTrigger<TEventSpecification extends EventSpecification<any>> implements Trigger<TEventSpecification> {
1287
2413
  #private;
@@ -1290,6 +2416,7 @@ declare class EventTrigger<TEventSpecification extends EventSpecification<any>>
1290
2416
  get event(): TEventSpecification;
1291
2417
  attachToJob(triggerClient: TriggerClient, job: Job<Trigger<TEventSpecification>, any>): void;
1292
2418
  get preprocessRuns(): boolean;
2419
+ verifyPayload(payload: ReturnType<TEventSpecification["parsePayload"]>): Promise<VerifyResult>;
1293
2420
  }
1294
2421
  /** Configuration options for an EventTrigger */
1295
2422
  type TriggerOptions<TEvent> = {
@@ -1376,6 +2503,9 @@ declare class MissingConnectionNotification implements Trigger<MissingConnection
1376
2503
  };
1377
2504
  attachToJob(triggerClient: TriggerClient, job: Job<Trigger<MissingConnectionNotificationSpecification>, any>): void;
1378
2505
  get preprocessRuns(): boolean;
2506
+ verifyPayload(payload: ReturnType<MissingConnectionNotificationSpecification["parsePayload"]>): Promise<{
2507
+ success: true;
2508
+ }>;
1379
2509
  toJSON(): TriggerMetadata;
1380
2510
  }
1381
2511
  type MissingConnectionResolvedNotificationSpecification = EventSpecification<MissingConnectionResolvedNotificationPayload>;
@@ -1425,13 +2555,74 @@ declare class MissingConnectionResolvedNotification implements Trigger<MissingCo
1425
2555
  };
1426
2556
  attachToJob(triggerClient: TriggerClient, job: Job<Trigger<MissingConnectionResolvedNotificationSpecification>, any>): void;
1427
2557
  get preprocessRuns(): boolean;
2558
+ verifyPayload(payload: ReturnType<MissingConnectionResolvedNotificationSpecification["parsePayload"]>): Promise<{
2559
+ success: true;
2560
+ }>;
1428
2561
  toJSON(): TriggerMetadata;
1429
2562
  }
1430
2563
 
2564
+ /** Configuration options for an InvokeTrigger */
2565
+ type InvokeTriggerOptions<TSchema extends ZodType = z.ZodTypeAny> = {
2566
+ /** A [Zod](https://trigger.dev/docs/documentation/guides/zod) schema that defines the shape of the event payload.
2567
+ * The default is `z.any()` which is `any`.
2568
+ * */
2569
+ schema?: TSchema;
2570
+ examples?: EventSpecificationExample[];
2571
+ };
2572
+ declare class InvokeTrigger<TSchema extends ZodType = z.ZodTypeAny> implements Trigger<EventSpecification<TypeOf<TSchema>, z.input<TSchema>>> {
2573
+ #private;
2574
+ constructor(options: InvokeTriggerOptions<TSchema>);
2575
+ toJSON(): TriggerMetadata;
2576
+ get event(): {
2577
+ name: string;
2578
+ title: string;
2579
+ source: string;
2580
+ examples: {
2581
+ id: string;
2582
+ name: string;
2583
+ icon?: string | undefined;
2584
+ payload?: any;
2585
+ }[];
2586
+ icon: string;
2587
+ parsePayload: (rawPayload: unknown) => any;
2588
+ parseInvokePayload: (rawPayload: unknown) => any;
2589
+ };
2590
+ attachToJob(triggerClient: TriggerClient, job: Job<Trigger<EventSpecification<ZodType<TSchema>>>, any>): void;
2591
+ get preprocessRuns(): boolean;
2592
+ verifyPayload(): Promise<{
2593
+ success: true;
2594
+ }>;
2595
+ }
2596
+ declare function invokeTrigger<TSchema extends ZodType = z.ZodTypeAny>(options?: InvokeTriggerOptions<TSchema>): Trigger<EventSpecification<TypeOf<TSchema>, z.input<TSchema>>>;
2597
+
2598
+ declare function slugifyId(input: string): string;
2599
+
2600
+ /** Easily verify webhook payloads when they're using common signing methods. */
2601
+ declare function verifyRequestSignature({ request, headerName, headerEncoding, secret, algorithm, }: {
2602
+ /** The web request that you want to verify. */
2603
+ request: Request;
2604
+ /** The name of the header that contains the signature. E.g. `X-Cal-Signature-256`. */
2605
+ headerName: string;
2606
+ /** The header encoding. Defaults to `hex`. */
2607
+ headerEncoding?: BinaryToTextEncoding;
2608
+ /** The secret that you use to hash the payload. For HttpEndpoints this will usually originally
2609
+ come from the Trigger.dev dashboard and should be stored in an environment variable. */
2610
+ secret: BinaryLike | KeyObject;
2611
+ /** The hashing algorithm that was used to create the signature. Currently only `sha256` is
2612
+ supported. */
2613
+ algorithm: "sha256";
2614
+ }): Promise<VerifyResult>;
2615
+ declare function verifyHmacSha256(headerValue: string, headerEncoding: BinaryToTextEncoding, secret: BinaryLike | KeyObject, body: string): boolean;
2616
+
1431
2617
  declare class ResumeWithTaskError {
1432
2618
  task: ServerTask;
1433
2619
  constructor(task: ServerTask);
1434
2620
  }
2621
+ declare class ResumeWithParallelTaskError {
2622
+ task: ServerTask;
2623
+ childErrors: Array<TriggerInternalError>;
2624
+ constructor(task: ServerTask, childErrors: Array<TriggerInternalError>);
2625
+ }
1435
2626
  declare class RetryWithTaskError {
1436
2627
  cause: ErrorWithStack;
1437
2628
  task: ServerTask;
@@ -1442,13 +2633,39 @@ declare class CanceledWithTaskError {
1442
2633
  task: ServerTask;
1443
2634
  constructor(task: ServerTask);
1444
2635
  }
2636
+ declare class YieldExecutionError {
2637
+ key: string;
2638
+ constructor(key: string);
2639
+ }
2640
+ declare class AutoYieldExecutionError {
2641
+ location: string;
2642
+ timeRemaining: number;
2643
+ timeElapsed: number;
2644
+ constructor(location: string, timeRemaining: number, timeElapsed: number);
2645
+ }
2646
+ declare class AutoYieldWithCompletedTaskExecutionError {
2647
+ id: string;
2648
+ properties: DisplayProperty[] | undefined;
2649
+ data: {
2650
+ location: string;
2651
+ timeRemaining: number;
2652
+ timeElapsed: number;
2653
+ };
2654
+ output?: string | undefined;
2655
+ constructor(id: string, properties: DisplayProperty[] | undefined, data: {
2656
+ location: string;
2657
+ timeRemaining: number;
2658
+ timeElapsed: number;
2659
+ }, output?: string | undefined);
2660
+ }
2661
+ type TriggerInternalError = ResumeWithTaskError | RetryWithTaskError | CanceledWithTaskError | YieldExecutionError | AutoYieldExecutionError | AutoYieldWithCompletedTaskExecutionError | ResumeWithParallelTaskError;
1445
2662
  /** Use this function if you're using a `try/catch` block to catch errors.
1446
2663
  * It checks if a thrown error is a special internal error that you should ignore.
1447
2664
  * If this returns `true` then you must rethrow the error: `throw err;`
1448
2665
  * @param err The error to check
1449
2666
  * @returns `true` if the error is a Trigger Error, `false` otherwise.
1450
2667
  */
1451
- declare function isTriggerError(err: unknown): err is ResumeWithTaskError | RetryWithTaskError | CanceledWithTaskError;
2668
+ declare function isTriggerError(err: unknown): err is TriggerInternalError;
1452
2669
 
1453
2670
  declare const retry: {
1454
2671
  readonly standardBackoff: {
@@ -1458,6 +2675,13 @@ declare const retry: {
1458
2675
  readonly maxTimeoutInMs: 30000;
1459
2676
  readonly randomize: true;
1460
2677
  };
2678
+ readonly exponentialBackoff: {
2679
+ readonly limit: 8;
2680
+ readonly factor: 2;
2681
+ readonly minTimeoutInMs: 1000;
2682
+ readonly maxTimeoutInMs: 30000;
2683
+ readonly randomize: true;
2684
+ };
1461
2685
  };
1462
2686
 
1463
2687
  type Task = ServerTask;
@@ -1465,4 +2689,4 @@ type Task = ServerTask;
1465
2689
  type SentEvent = ApiEventLog;
1466
2690
  declare function redactString(strings: TemplateStringsArray, ...interpolations: string[]): RedactString;
1467
2691
 
1468
- export { AuthResolverResult, CronTrigger, DynamicIntervalOptions, DynamicSchedule, DynamicTrigger, DynamicTriggerOptions, EventSpecification, EventSpecificationExample, EventTrigger, EventTypeFromSpecification, ExternalSource, ExternalSourceParams, ExternalSourceTrigger, ExternalSourceTriggerOptions, HandlerEvent, HttpSourceEvent, IO, IOLogger, IOOptions, 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 };
2692
+ export { AuthResolverResult, BackgroundFetchResponse, CronTrigger, DynamicIntervalOptions, DynamicSchedule, DynamicTrigger, DynamicTriggerOptions, EventSpecification, EventSpecificationExample, EventSpecificationExampleSchema, EventTrigger, EventTypeFromSpecification, ExternalSource, ExternalSourceParams, ExternalSourceTrigger, ExternalSourceTriggerOptions, GetWebhookConfig, GetWebhookParams, HandlerEvent, HttpSourceEvent, IO, IOLogger, IOOptions, IOStats, IOTask, IOWithIntegrations, IntegrationTaskKey, IntervalTrigger, InvokeTrigger, JSONOutputSerializer, Job, JobIO, JobOptions, JobPayload, Json, MissingConnectionNotification, MissingConnectionResolvedNotification, NotificationEvents, NotificationsEventEmitter, OutputSerializer, PreprocessResults, RunTaskErrorCallback, SchemaParser, SchemaParserIssue, SchemaParserResult, SentEvent, Task, TaskLogger, Trigger, TriggerAuthResolver, TriggerClient, TriggerClientOptions, TriggerContext, TriggerEventType, TriggerIntegration, TriggerInvokeType, TriggerOptionRecord, TriggerPayload, TriggerPreprocessContext, TypedEventSpecificationExample, VerifyResult, WaitForEventResult, WebhookConfig, WebhookDeliveryContext, WebhookHandlerEvent, WebhookSource, WebhookTrigger, WebhookTriggerOptions, cronTrigger, eventTrigger, intervalTrigger, invokeTrigger, isTriggerError, missingConnectionNotification, missingConnectionResolvedNotification, omit, redactString, retry, slugifyId, verifyHmacSha256, verifyRequestSignature, waitForEventSchema };