@trigger.dev/sdk 2.2.5 → 2.2.6

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,5 +1,5 @@
1
1
  import * as _trigger_dev_core from '@trigger.dev/core';
2
- import { RunTaskBodyInput, CompleteTaskBodyV2Input, FailTaskBodyInput, SendEvent, SendEventOptions, StatusUpdate, UpdateTriggerSourceBodyV2, TriggerSource, RegisterTriggerBodyV2, RegisterSourceEventV2, ScheduleMetadata, GetRunOptionsWithTaskDetails, GetRunsOptions, InvokeOptions, LogLevel, RuntimeEnvironmentType, DisplayProperty, TriggerMetadata, EventFilter, HttpEndpointMetadata, RequestFilter, Prettify, HandleTriggerSource, Logger, RegisterTriggerSource, SerializableJson, ConnectionAuth, NormalizedResponse, HttpSourceResponseMetadata, IntervalOptions, CronOptions, ScheduledPayload, DeserializedJson, ServerTask, CachedTask, InitialStatusUpdate, FetchRequestInit, FetchRetryOptions, FetchTimeoutOptions, RunTaskOptions, IntegrationMetadata, QueueOptions, IntegrationConfig, JobMetadata, RunNotification, MissingConnectionNotificationPayload, MissingConnectionResolvedNotificationPayload, ErrorWithStack, ApiEventLog, RedactString } from '@trigger.dev/core';
2
+ import { RunTaskBodyInput, CompleteTaskBodyV2Input, FailTaskBodyInput, SendEvent, SendEventOptions, StatusUpdate, UpdateTriggerSourceBodyV2, TriggerSource, RegisterTriggerBodyV2, RegisterSourceEventV2, ScheduleMetadata, GetRunOptionsWithTaskDetails, GetRunsOptions, InvokeOptions, EphemeralEventDispatcherRequestBody, LogLevel, RuntimeEnvironmentType, DisplayProperty, TriggerMetadata, EventFilter, HttpEndpointMetadata, RequestFilter, Prettify, HandleTriggerSource, Logger, RegisterTriggerSource, SerializableJson, ConnectionAuth, NormalizedResponse, HttpSourceResponseMetadata, IntervalOptions, CronOptions, ScheduledPayload, DeserializedJson, ServerTask, CachedTask, InitialStatusUpdate, FetchRequestInit, FetchRetryOptions, FetchTimeoutOptions, FetchPollOperation, RunTaskOptions, IntegrationMetadata, QueueOptions, 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
5
  import { z, ZodType, TypeOf } from 'zod';
@@ -40,29 +40,36 @@ declare class ApiClient {
40
40
  label: z.ZodString;
41
41
  text: z.ZodString;
42
42
  url: z.ZodOptional<z.ZodString>;
43
+ imageUrl: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
43
44
  }, "strip", z.ZodTypeAny, {
44
45
  label: string;
45
46
  text: string;
46
47
  url?: string | undefined;
48
+ imageUrl?: string[] | undefined;
47
49
  }, {
48
50
  label: string;
49
51
  text: string;
50
52
  url?: string | undefined;
53
+ imageUrl?: string[] | undefined;
51
54
  }>, "many">>>;
52
55
  outputProperties: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
53
56
  label: z.ZodString;
54
57
  text: z.ZodString;
55
58
  url: z.ZodOptional<z.ZodString>;
59
+ imageUrl: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
56
60
  }, "strip", z.ZodTypeAny, {
57
61
  label: string;
58
62
  text: string;
59
63
  url?: string | undefined;
64
+ imageUrl?: string[] | undefined;
60
65
  }, {
61
66
  label: string;
62
67
  text: string;
63
68
  url?: string | undefined;
69
+ imageUrl?: string[] | undefined;
64
70
  }>, "many">>>;
65
71
  output: z.ZodNullable<z.ZodOptional<z.ZodType<_trigger_dev_core.DeserializedJson, z.ZodTypeDef, _trigger_dev_core.DeserializedJson>>>;
72
+ context: z.ZodNullable<z.ZodOptional<z.ZodType<_trigger_dev_core.DeserializedJson, z.ZodTypeDef, _trigger_dev_core.DeserializedJson>>>;
66
73
  error: z.ZodNullable<z.ZodOptional<z.ZodString>>;
67
74
  parentId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
68
75
  style: z.ZodNullable<z.ZodOptional<z.ZodObject<{
@@ -98,13 +105,16 @@ declare class ApiClient {
98
105
  label: string;
99
106
  text: string;
100
107
  url?: string | undefined;
108
+ imageUrl?: string[] | undefined;
101
109
  }[] | null | undefined;
102
110
  outputProperties?: {
103
111
  label: string;
104
112
  text: string;
105
113
  url?: string | undefined;
114
+ imageUrl?: string[] | undefined;
106
115
  }[] | null | undefined;
107
116
  output?: _trigger_dev_core.DeserializedJson | undefined;
117
+ context?: _trigger_dev_core.DeserializedJson | undefined;
108
118
  error?: string | null | undefined;
109
119
  parentId?: string | null | undefined;
110
120
  style?: {
@@ -132,13 +142,16 @@ declare class ApiClient {
132
142
  label: string;
133
143
  text: string;
134
144
  url?: string | undefined;
145
+ imageUrl?: string[] | undefined;
135
146
  }[] | null | undefined;
136
147
  outputProperties?: {
137
148
  label: string;
138
149
  text: string;
139
150
  url?: string | undefined;
151
+ imageUrl?: string[] | undefined;
140
152
  }[] | null | undefined;
141
153
  output?: _trigger_dev_core.DeserializedJson | undefined;
154
+ context?: _trigger_dev_core.DeserializedJson | undefined;
142
155
  error?: string | null | undefined;
143
156
  parentId?: string | null | undefined;
144
157
  style?: {
@@ -213,13 +226,16 @@ declare class ApiClient {
213
226
  label: string;
214
227
  text: string;
215
228
  url?: string | undefined;
229
+ imageUrl?: string[] | undefined;
216
230
  }[] | null | undefined;
217
231
  outputProperties?: {
218
232
  label: string;
219
233
  text: string;
220
234
  url?: string | undefined;
235
+ imageUrl?: string[] | undefined;
221
236
  }[] | null | undefined;
222
237
  output?: _trigger_dev_core.DeserializedJson | undefined;
238
+ context?: _trigger_dev_core.DeserializedJson | undefined;
223
239
  error?: string | null | undefined;
224
240
  parentId?: string | null | undefined;
225
241
  style?: {
@@ -260,13 +276,16 @@ declare class ApiClient {
260
276
  label: string;
261
277
  text: string;
262
278
  url?: string | undefined;
279
+ imageUrl?: string[] | undefined;
263
280
  }[] | null | undefined;
264
281
  outputProperties?: {
265
282
  label: string;
266
283
  text: string;
267
284
  url?: string | undefined;
285
+ imageUrl?: string[] | undefined;
268
286
  }[] | null | undefined;
269
287
  output?: _trigger_dev_core.DeserializedJson | undefined;
288
+ context?: _trigger_dev_core.DeserializedJson | undefined;
270
289
  error?: string | null | undefined;
271
290
  parentId?: string | null | undefined;
272
291
  style?: {
@@ -305,29 +324,36 @@ declare class ApiClient {
305
324
  label: z.ZodString;
306
325
  text: z.ZodString;
307
326
  url: z.ZodOptional<z.ZodString>;
327
+ imageUrl: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
308
328
  }, "strip", z.ZodTypeAny, {
309
329
  label: string;
310
330
  text: string;
311
331
  url?: string | undefined;
332
+ imageUrl?: string[] | undefined;
312
333
  }, {
313
334
  label: string;
314
335
  text: string;
315
336
  url?: string | undefined;
337
+ imageUrl?: string[] | undefined;
316
338
  }>, "many">>>;
317
339
  outputProperties: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
318
340
  label: z.ZodString;
319
341
  text: z.ZodString;
320
342
  url: z.ZodOptional<z.ZodString>;
343
+ imageUrl: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
321
344
  }, "strip", z.ZodTypeAny, {
322
345
  label: string;
323
346
  text: string;
324
347
  url?: string | undefined;
348
+ imageUrl?: string[] | undefined;
325
349
  }, {
326
350
  label: string;
327
351
  text: string;
328
352
  url?: string | undefined;
353
+ imageUrl?: string[] | undefined;
329
354
  }>, "many">>>;
330
355
  output: z.ZodNullable<z.ZodOptional<z.ZodType<_trigger_dev_core.DeserializedJson, z.ZodTypeDef, _trigger_dev_core.DeserializedJson>>>;
356
+ context: z.ZodNullable<z.ZodOptional<z.ZodType<_trigger_dev_core.DeserializedJson, z.ZodTypeDef, _trigger_dev_core.DeserializedJson>>>;
331
357
  error: z.ZodNullable<z.ZodOptional<z.ZodString>>;
332
358
  parentId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
333
359
  style: z.ZodNullable<z.ZodOptional<z.ZodObject<{
@@ -363,13 +389,16 @@ declare class ApiClient {
363
389
  label: string;
364
390
  text: string;
365
391
  url?: string | undefined;
392
+ imageUrl?: string[] | undefined;
366
393
  }[] | null | undefined;
367
394
  outputProperties?: {
368
395
  label: string;
369
396
  text: string;
370
397
  url?: string | undefined;
398
+ imageUrl?: string[] | undefined;
371
399
  }[] | null | undefined;
372
400
  output?: _trigger_dev_core.DeserializedJson | undefined;
401
+ context?: _trigger_dev_core.DeserializedJson | undefined;
373
402
  error?: string | null | undefined;
374
403
  parentId?: string | null | undefined;
375
404
  style?: {
@@ -397,13 +426,16 @@ declare class ApiClient {
397
426
  label: string;
398
427
  text: string;
399
428
  url?: string | undefined;
429
+ imageUrl?: string[] | undefined;
400
430
  }[] | null | undefined;
401
431
  outputProperties?: {
402
432
  label: string;
403
433
  text: string;
404
434
  url?: string | undefined;
435
+ imageUrl?: string[] | undefined;
405
436
  }[] | null | undefined;
406
437
  output?: _trigger_dev_core.DeserializedJson | undefined;
438
+ context?: _trigger_dev_core.DeserializedJson | undefined;
407
439
  error?: string | null | undefined;
408
440
  parentId?: string | null | undefined;
409
441
  style?: {
@@ -432,13 +464,16 @@ declare class ApiClient {
432
464
  label: string;
433
465
  text: string;
434
466
  url?: string | undefined;
467
+ imageUrl?: string[] | undefined;
435
468
  }[] | null | undefined;
436
469
  outputProperties?: {
437
470
  label: string;
438
471
  text: string;
439
472
  url?: string | undefined;
473
+ imageUrl?: string[] | undefined;
440
474
  }[] | null | undefined;
441
475
  output?: _trigger_dev_core.DeserializedJson | undefined;
476
+ context?: _trigger_dev_core.DeserializedJson | undefined;
442
477
  error?: string | null | undefined;
443
478
  parentId?: string | null | undefined;
444
479
  style?: {
@@ -467,13 +502,16 @@ declare class ApiClient {
467
502
  label: string;
468
503
  text: string;
469
504
  url?: string | undefined;
505
+ imageUrl?: string[] | undefined;
470
506
  }[] | null | undefined;
471
507
  outputProperties?: {
472
508
  label: string;
473
509
  text: string;
474
510
  url?: string | undefined;
511
+ imageUrl?: string[] | undefined;
475
512
  }[] | null | undefined;
476
513
  output?: _trigger_dev_core.DeserializedJson | undefined;
514
+ context?: _trigger_dev_core.DeserializedJson | undefined;
477
515
  error?: string | null | undefined;
478
516
  parentId?: string | null | undefined;
479
517
  style?: {
@@ -499,6 +537,20 @@ declare class ApiClient {
499
537
  deliveredAt?: Date | null | undefined;
500
538
  cancelledAt?: Date | null | undefined;
501
539
  }>;
540
+ sendEvents(events: SendEvent[], options?: SendEventOptions): Promise<{
541
+ id: string;
542
+ name: string;
543
+ payload: ((string | number | boolean | {
544
+ [key: string]: _trigger_dev_core.DeserializedJson;
545
+ } | _trigger_dev_core.DeserializedJson[]) & (string | number | boolean | {
546
+ [key: string]: _trigger_dev_core.DeserializedJson;
547
+ } | _trigger_dev_core.DeserializedJson[] | undefined)) | null;
548
+ timestamp: Date;
549
+ context?: _trigger_dev_core.DeserializedJson | undefined;
550
+ deliverAt?: Date | null | undefined;
551
+ deliveredAt?: Date | null | undefined;
552
+ cancelledAt?: Date | null | undefined;
553
+ }[]>;
502
554
  cancelEvent(eventId: string): Promise<{
503
555
  id: string;
504
556
  name: string;
@@ -644,6 +696,9 @@ declare class ApiClient {
644
696
  invokeJob(jobId: string, payload: any, options?: InvokeOptions): Promise<{
645
697
  id: string;
646
698
  }>;
699
+ createEphemeralEventDispatcher(payload: EphemeralEventDispatcherRequestBody): Promise<{
700
+ id: string;
701
+ }>;
647
702
  }
648
703
  type VersionedResponseBodyMap = {
649
704
  [key: string]: z.ZodTypeAny;
@@ -827,6 +882,40 @@ type SchemaParserResult<T> = {
827
882
  type SchemaParser<T extends unknown = unknown> = {
828
883
  safeParse: (a: unknown) => SchemaParserResult<T>;
829
884
  };
885
+ type WaitForEventResult<TEvent> = {
886
+ id: string;
887
+ name: string;
888
+ source: string;
889
+ payload: TEvent;
890
+ timestamp: Date;
891
+ context?: any;
892
+ accountId?: string;
893
+ };
894
+ declare function waitForEventSchema(schema: z.ZodTypeAny): z.ZodObject<{
895
+ id: z.ZodString;
896
+ name: z.ZodString;
897
+ source: z.ZodString;
898
+ payload: z.ZodTypeAny;
899
+ timestamp: z.ZodDate;
900
+ context: z.ZodOptional<z.ZodAny>;
901
+ accountId: z.ZodOptional<z.ZodString>;
902
+ }, "strip", z.ZodTypeAny, {
903
+ id: string;
904
+ name: string;
905
+ timestamp: Date;
906
+ source: string;
907
+ payload?: any;
908
+ context?: any;
909
+ accountId?: string | undefined;
910
+ }, {
911
+ id: string;
912
+ name: string;
913
+ timestamp: Date;
914
+ source: string;
915
+ payload?: any;
916
+ context?: any;
917
+ accountId?: string | undefined;
918
+ }>;
830
919
 
831
920
  type HttpEndpointOptions<TEventSpecification extends EventSpecification<any>> = {
832
921
  id: string;
@@ -1364,6 +1453,25 @@ declare class TriggerClient {
1364
1453
  deliveredAt?: Date | null | undefined;
1365
1454
  cancelledAt?: Date | null | undefined;
1366
1455
  }>;
1456
+ /** 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.
1457
+ * @param events The events to send.
1458
+ * @param options Options for sending the events.
1459
+ * @returns A promise that resolves to an array of event details
1460
+ */
1461
+ sendEvents(events: SendEvent[], options?: SendEventOptions): Promise<{
1462
+ id: string;
1463
+ name: string;
1464
+ payload: ((string | number | boolean | {
1465
+ [key: string]: DeserializedJson;
1466
+ } | DeserializedJson[]) & (string | number | boolean | {
1467
+ [key: string]: DeserializedJson;
1468
+ } | DeserializedJson[] | undefined)) | null;
1469
+ timestamp: Date;
1470
+ context?: DeserializedJson | undefined;
1471
+ deliverAt?: Date | null | undefined;
1472
+ deliveredAt?: Date | null | undefined;
1473
+ cancelledAt?: Date | null | undefined;
1474
+ }[]>;
1367
1475
  cancelEvent(eventId: string): Promise<{
1368
1476
  id: string;
1369
1477
  name: string;
@@ -1501,6 +1609,9 @@ declare class TriggerClient {
1501
1609
  invokeJob(jobId: string, payload: any, options?: InvokeOptions): Promise<{
1502
1610
  id: string;
1503
1611
  }>;
1612
+ createEphemeralEventDispatcher(payload: EphemeralEventDispatcherRequestBody): Promise<{
1613
+ id: string;
1614
+ }>;
1504
1615
  authorized(apiKey?: string | null): "authorized" | "unauthorized" | "missing-client" | "missing-header";
1505
1616
  apiKey(): string | undefined;
1506
1617
  }
@@ -1552,6 +1663,11 @@ declare class JSONOutputSerializer implements OutputSerializer {
1552
1663
  serialize(value: any): string;
1553
1664
  deserialize(value?: string): any;
1554
1665
  }
1666
+ type BackgroundFetchResponse<T> = {
1667
+ status: number;
1668
+ data: T;
1669
+ headers: Record<string, string>;
1670
+ };
1555
1671
  declare class IO {
1556
1672
  #private;
1557
1673
  private _id;
@@ -1592,6 +1708,16 @@ declare class IO {
1592
1708
  * @param seconds The number of seconds to wait. This can be very long, serverless timeouts are not an issue.
1593
1709
  */
1594
1710
  wait(cacheKey: string | any[], seconds: number): Promise<void>;
1711
+ waitForEvent<T extends z.ZodTypeAny = z.ZodTypeAny>(cacheKey: string | any[], event: {
1712
+ name: string;
1713
+ schema?: T;
1714
+ filter?: EventFilter;
1715
+ source?: string;
1716
+ contextFilter?: EventFilter;
1717
+ accountId?: string;
1718
+ }, options?: {
1719
+ timeoutInSeconds?: number;
1720
+ }): Promise<WaitForEventResult<z.output<T>>>;
1595
1721
  /** `io.waitForRequest()` allows you to pause the execution of a run until the url provided in the callback is POSTed to.
1596
1722
  * 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.
1597
1723
  * @param cacheKey Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
@@ -1658,8 +1784,60 @@ declare class IO {
1658
1784
  * - Ranges: 500-599
1659
1785
  * - Wildcards: 2xx, 3xx, 4xx, 5xx
1660
1786
  */
1661
- backgroundFetch<TResponseData>(cacheKey: string | any[], url: string, requestInit?: FetchRequestInit, retry?: FetchRetryOptions, timeout?: FetchTimeoutOptions): Promise<TResponseData>;
1662
- /** `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).
1787
+ backgroundFetch<TResponseData>(cacheKey: string | any[], url: string, requestInit?: FetchRequestInit, options?: {
1788
+ retry?: FetchRetryOptions;
1789
+ timeout?: FetchTimeoutOptions;
1790
+ }): Promise<TResponseData>;
1791
+ /** `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.
1792
+ * @param cacheKey Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
1793
+ * @param params The options for the background poll
1794
+ * @param params.url The URL to fetch from.
1795
+ * @param params.requestInit The options for the request, like headers and method
1796
+ * @param params.responseFilter An [EventFilter](https://trigger.dev/docs/documentation/guides/event-filter) that allows you to specify when to stop polling.
1797
+ * @param params.interval The interval in seconds to poll the URL in seconds. Defaults to 10 seconds which is the minimum.
1798
+ * @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
1799
+ * @param params.requestTimeout An optional object that allows you to timeout individual fetch requests
1800
+ * @param params.requestTimeout An optional object that allows you to timeout individual fetch requests
1801
+ * @param params.requestTimeout.durationInMs The duration in milliseconds to timeout the request
1802
+ *
1803
+ * @example
1804
+ * ```ts
1805
+ * const result = await io.backgroundPoll<{ id: string; status: string; }>("poll", {
1806
+ url: `http://localhost:3030/api/v1/runs/${run.id}`,
1807
+ requestInit: {
1808
+ headers: {
1809
+ Accept: "application/json",
1810
+ Authorization: redactString`Bearer ${process.env["TRIGGER_API_KEY"]!}`,
1811
+ },
1812
+ },
1813
+ interval: 10,
1814
+ timeout: 600,
1815
+ responseFilter: {
1816
+ status: [200],
1817
+ body: {
1818
+ status: ["SUCCESS"],
1819
+ },
1820
+ },
1821
+ });
1822
+ * ```
1823
+ */
1824
+ backgroundPoll<TResponseData>(cacheKey: string | any[], params: FetchPollOperation): Promise<TResponseData>;
1825
+ /** `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.
1826
+ * @param cacheKey Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
1827
+ * @param url The URL to fetch from.
1828
+ * @param requestInit The options for the request
1829
+ * @param retry The options for retrying the request if it fails
1830
+ * An object where the key is a status code pattern and the value is a retrying strategy.
1831
+ * Supported patterns are:
1832
+ * - Specific status codes: 429
1833
+ * - Ranges: 500-599
1834
+ * - Wildcards: 2xx, 3xx, 4xx, 5xx
1835
+ */
1836
+ backgroundFetchResponse<TResponseData>(cacheKey: string | any[], url: string, requestInit?: FetchRequestInit, options?: {
1837
+ retry?: FetchRetryOptions;
1838
+ timeout?: FetchTimeoutOptions;
1839
+ }): Promise<BackgroundFetchResponse<TResponseData>>;
1840
+ /** `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).
1663
1841
  * @param cacheKey Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
1664
1842
  * @param event The event to send. The event name must match the name of the event that your Jobs are listening for.
1665
1843
  * @param options Options for sending the event.
@@ -1678,6 +1856,25 @@ declare class IO {
1678
1856
  deliveredAt?: Date | null | undefined;
1679
1857
  cancelledAt?: Date | null | undefined;
1680
1858
  }>;
1859
+ /** `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).
1860
+ * @param cacheKey Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
1861
+ * @param event The events to send. The event names must match the names of the events that your Jobs are listening for.
1862
+ * @param options Options for sending the events.
1863
+ */
1864
+ sendEvents(cacheKey: string | any[], events: SendEvent[], options?: SendEventOptions): Promise<{
1865
+ id: string;
1866
+ name: string;
1867
+ payload: ((string | number | boolean | {
1868
+ [key: string]: _trigger_dev_core.DeserializedJson;
1869
+ } | _trigger_dev_core.DeserializedJson[]) & (string | number | boolean | {
1870
+ [key: string]: _trigger_dev_core.DeserializedJson;
1871
+ } | _trigger_dev_core.DeserializedJson[] | undefined)) | null;
1872
+ timestamp: Date;
1873
+ context?: _trigger_dev_core.DeserializedJson | undefined;
1874
+ deliverAt?: Date | null | undefined;
1875
+ deliveredAt?: Date | null | undefined;
1876
+ cancelledAt?: Date | null | undefined;
1877
+ }[]>;
1681
1878
  getEvent(cacheKey: string | any[], id: string): Promise<{
1682
1879
  id: string;
1683
1880
  name: string;
@@ -1809,7 +2006,9 @@ declare class IO {
1809
2006
  * @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.
1810
2007
  * @returns A Promise that resolves with the returned value of the callback.
1811
2008
  */
1812
- runTask<T extends Json<T> | void>(cacheKey: string | any[], callback: (task: ServerTask, io: IO) => Promise<T>, options?: RunTaskOptions, onError?: RunTaskErrorCallback): Promise<T>;
2009
+ runTask<T extends Json<T> | void>(cacheKey: string | any[], callback: (task: ServerTask, io: IO) => Promise<T>, options?: RunTaskOptions & {
2010
+ parseOutput?: (output: unknown) => T;
2011
+ }, onError?: RunTaskErrorCallback): Promise<T>;
1813
2012
  /**
1814
2013
  * `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.
1815
2014
  */
@@ -2203,6 +2402,13 @@ declare const retry: {
2203
2402
  readonly maxTimeoutInMs: 30000;
2204
2403
  readonly randomize: true;
2205
2404
  };
2405
+ readonly exponentialBackoff: {
2406
+ readonly limit: 8;
2407
+ readonly factor: 2;
2408
+ readonly minTimeoutInMs: 1000;
2409
+ readonly maxTimeoutInMs: 30000;
2410
+ readonly randomize: true;
2411
+ };
2206
2412
  };
2207
2413
 
2208
2414
  type Task = ServerTask;
@@ -2210,4 +2416,4 @@ type Task = ServerTask;
2210
2416
  type SentEvent = ApiEventLog;
2211
2417
  declare function redactString(strings: TemplateStringsArray, ...interpolations: string[]): RedactString;
2212
2418
 
2213
- export { AuthResolverResult, CronTrigger, DynamicIntervalOptions, DynamicSchedule, DynamicTrigger, DynamicTriggerOptions, EventSpecification, EventSpecificationExample, EventSpecificationExampleSchema, EventTrigger, EventTypeFromSpecification, ExternalSource, ExternalSourceParams, ExternalSourceTrigger, ExternalSourceTriggerOptions, HandlerEvent, HttpSourceEvent, IO, IOLogger, IOOptions, IOStats, IOTask, IOWithIntegrations, IntegrationTaskKey, IntervalTrigger, InvokeTrigger, JSONOutputSerializer, Job, JobIO, JobOptions, JobPayload, Json, MissingConnectionNotification, MissingConnectionResolvedNotification, OutputSerializer, PreprocessResults, RunTaskErrorCallback, SchemaParser, SchemaParserIssue, SchemaParserResult, SentEvent, Task, TaskLogger, Trigger, TriggerAuthResolver, TriggerClient, TriggerClientOptions, TriggerContext, TriggerEventType, TriggerIntegration, TriggerInvokeType, TriggerOptionRecord, TriggerPayload, TriggerPreprocessContext, VerifyResult, cronTrigger, eventTrigger, intervalTrigger, invokeTrigger, isTriggerError, missingConnectionNotification, missingConnectionResolvedNotification, omit, redactString, retry, verifyHmacSha256, verifyRequestSignature };
2419
+ export { AuthResolverResult, BackgroundFetchResponse, CronTrigger, DynamicIntervalOptions, DynamicSchedule, DynamicTrigger, DynamicTriggerOptions, EventSpecification, EventSpecificationExample, EventSpecificationExampleSchema, EventTrigger, EventTypeFromSpecification, ExternalSource, ExternalSourceParams, ExternalSourceTrigger, ExternalSourceTriggerOptions, HandlerEvent, HttpSourceEvent, IO, IOLogger, IOOptions, IOStats, IOTask, IOWithIntegrations, IntegrationTaskKey, IntervalTrigger, InvokeTrigger, JSONOutputSerializer, Job, JobIO, JobOptions, JobPayload, Json, MissingConnectionNotification, MissingConnectionResolvedNotification, OutputSerializer, PreprocessResults, RunTaskErrorCallback, SchemaParser, SchemaParserIssue, SchemaParserResult, SentEvent, Task, TaskLogger, Trigger, TriggerAuthResolver, TriggerClient, TriggerClientOptions, TriggerContext, TriggerEventType, TriggerIntegration, TriggerInvokeType, TriggerOptionRecord, TriggerPayload, TriggerPreprocessContext, VerifyResult, WaitForEventResult, cronTrigger, eventTrigger, intervalTrigger, invokeTrigger, isTriggerError, missingConnectionNotification, missingConnectionResolvedNotification, omit, redactString, retry, verifyHmacSha256, verifyRequestSignature, waitForEventSchema };