@trigger.dev/sdk 0.0.0-prerelease-20240926084729 → 0.0.0-realtime-20240930190059

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.
@@ -1,11 +1,10 @@
1
- import type { ApiRequestOptions, ListProjectRunsQueryParams, ListRunsQueryParams, RescheduleRunRequestBody } from "@trigger.dev/core/v3";
1
+ import type { ApiRequestOptions, ListProjectRunsQueryParams, ListRunsQueryParams, RescheduleRunRequestBody, RunStreamCallback, RunSubscription } from "@trigger.dev/core/v3";
2
2
  import { ApiPromise, CanceledRunResponse, CursorPagePromise, ListRunResponseItem, ReplayRunResponse, RetrieveRunResponse } from "@trigger.dev/core/v3";
3
- import { AnyTask, Prettify, RunHandle, Task } from "./shared.js";
4
- export type RetrieveRunResult<TRunId> = Prettify<TRunId extends RunHandle<infer TOutput> ? Omit<RetrieveRunResponse, "output"> & {
3
+ import { AnyRunHandle, AnyTask, Prettify, RunHandle, Task } from "./shared.js";
4
+ export type RetrieveRunResult<TPayload = any, TOutput = any> = Prettify<Omit<RetrieveRunResponse, "output" | "payload"> & {
5
5
  output?: TOutput;
6
- } : TRunId extends Task<string, any, infer TTaskOutput> ? Omit<RetrieveRunResponse, "output"> & {
7
- output?: TTaskOutput;
8
- } : TRunId extends string ? RetrieveRunResponse : never>;
6
+ payload?: TPayload;
7
+ }>;
9
8
  export declare const runs: {
10
9
  replay: typeof replayRun;
11
10
  cancel: typeof cancelRun;
@@ -13,133 +12,56 @@ export declare const runs: {
13
12
  list: typeof listRuns;
14
13
  reschedule: typeof rescheduleRun;
15
14
  poll: typeof poll;
15
+ subscribe: typeof subscribeToRun;
16
16
  };
17
17
  export type ListRunsItem = ListRunResponseItem;
18
18
  declare function listRuns(projectRef: string, params?: ListProjectRunsQueryParams, requestOptions?: ApiRequestOptions): CursorPagePromise<typeof ListRunResponseItem>;
19
19
  declare function listRuns(params?: ListRunsQueryParams, requestOptions?: ApiRequestOptions): CursorPagePromise<typeof ListRunResponseItem>;
20
- type RunId<TRunId> = TRunId extends RunHandle<any> ? TRunId : TRunId extends AnyTask ? string : TRunId extends string ? TRunId : never;
21
- declare function retrieveRun<TRunId extends RunHandle<any> | AnyTask | string>(runId: RunId<TRunId>, requestOptions?: ApiRequestOptions): ApiPromise<RetrieveRunResult<TRunId>>;
20
+ type RunId<TRunId> = TRunId extends AnyRunHandle ? TRunId : TRunId extends AnyTask ? string : TRunId extends string ? TRunId : never;
21
+ type InferRunId<TRunId> = TRunId extends RunHandle<infer TPayload, infer TOutput> ? {
22
+ output?: TOutput;
23
+ payload: TPayload;
24
+ } : TRunId extends Task<string, infer TTaskPayload, infer TTaskOutput> ? {
25
+ output?: TTaskOutput;
26
+ payload: TTaskPayload;
27
+ } : {
28
+ output?: any;
29
+ payload: any;
30
+ };
31
+ declare function retrieveRun<TRunId extends AnyRunHandle | AnyTask | string>(runId: RunId<TRunId>, requestOptions?: ApiRequestOptions): ApiPromise<RetrieveRunResult<InferRunId<TRunId>["payload"], InferRunId<TRunId>["output"]>>;
22
32
  declare function replayRun(runId: string, requestOptions?: ApiRequestOptions): ApiPromise<ReplayRunResponse>;
23
33
  declare function cancelRun(runId: string, requestOptions?: ApiRequestOptions): ApiPromise<CanceledRunResponse>;
24
34
  declare function rescheduleRun(runId: string, body: RescheduleRunRequestBody, requestOptions?: ApiRequestOptions): ApiPromise<RetrieveRunResponse>;
25
35
  export type PollOptions = {
26
36
  pollIntervalMs?: number;
27
37
  };
28
- declare function poll<TRunId extends RunHandle<any> | AnyTask | string>(runId: RunId<TRunId>, options?: {
38
+ declare function poll<TRunId extends AnyRunHandle | AnyTask | string>(runId: RunId<TRunId>, options?: {
29
39
  pollIntervalMs?: number;
30
- }, requestOptions?: ApiRequestOptions): Promise<(TRunId extends RunHandle<infer TOutput> ? Omit<{
31
- status: "CANCELED" | "COMPLETED" | "FAILED" | "WAITING_FOR_DEPLOY" | "QUEUED" | "EXECUTING" | "REATTEMPTING" | "FROZEN" | "CRASHED" | "INTERRUPTED" | "SYSTEM_FAILURE" | "DELAYED" | "EXPIRED";
40
+ }, requestOptions?: ApiRequestOptions): Promise<{
41
+ status: "COMPLETED" | "CANCELED" | "QUEUED" | "EXECUTING" | "FAILED" | "WAITING_FOR_DEPLOY" | "REATTEMPTING" | "FROZEN" | "CRASHED" | "INTERRUPTED" | "SYSTEM_FAILURE" | "DELAYED" | "EXPIRED" | "UNKNOWN";
32
42
  id: string;
33
- tags: string[];
43
+ idempotencyKey?: string | undefined;
44
+ startedAt?: Date | undefined;
45
+ updatedAt: Date;
34
46
  isTest: boolean;
47
+ version?: string | undefined;
48
+ metadata?: Record<string, any> | undefined;
35
49
  createdAt: Date;
36
- durationMs: number;
37
- costInCents: number;
38
- baseCostInCents: number;
39
- depth: number;
40
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
41
- taskIdentifier: string;
42
- isQueued: boolean;
43
- isExecuting: boolean;
44
- isCompleted: boolean;
45
- isSuccess: boolean;
46
- isFailed: boolean;
47
- isCancelled: boolean;
48
- updatedAt: Date;
49
- relatedRuns: {
50
- root?: {
51
- status: "CANCELED" | "COMPLETED" | "FAILED" | "WAITING_FOR_DEPLOY" | "QUEUED" | "EXECUTING" | "REATTEMPTING" | "FROZEN" | "CRASHED" | "INTERRUPTED" | "SYSTEM_FAILURE" | "DELAYED" | "EXPIRED";
52
- id: string;
53
- tags: string[];
54
- isTest: boolean;
55
- createdAt: Date;
56
- durationMs: number;
57
- costInCents: number;
58
- baseCostInCents: number;
59
- depth: number;
60
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
61
- taskIdentifier: string;
62
- isQueued: boolean;
63
- isExecuting: boolean;
64
- isCompleted: boolean;
65
- isSuccess: boolean;
66
- isFailed: boolean;
67
- isCancelled: boolean;
68
- updatedAt: Date;
69
- batchId?: string | undefined;
70
- idempotencyKey?: string | undefined;
71
- version?: string | undefined;
72
- startedAt?: Date | undefined;
73
- finishedAt?: Date | undefined;
74
- delayedUntil?: Date | undefined;
75
- ttl?: string | undefined;
76
- expiredAt?: Date | undefined;
77
- metadata?: Record<string, any> | undefined;
78
- } | undefined;
79
- parent?: {
80
- status: "CANCELED" | "COMPLETED" | "FAILED" | "WAITING_FOR_DEPLOY" | "QUEUED" | "EXECUTING" | "REATTEMPTING" | "FROZEN" | "CRASHED" | "INTERRUPTED" | "SYSTEM_FAILURE" | "DELAYED" | "EXPIRED";
81
- id: string;
82
- tags: string[];
83
- isTest: boolean;
84
- createdAt: Date;
85
- durationMs: number;
86
- costInCents: number;
87
- baseCostInCents: number;
88
- depth: number;
89
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
90
- taskIdentifier: string;
91
- isQueued: boolean;
92
- isExecuting: boolean;
93
- isCompleted: boolean;
94
- isSuccess: boolean;
95
- isFailed: boolean;
96
- isCancelled: boolean;
97
- updatedAt: Date;
98
- batchId?: string | undefined;
99
- idempotencyKey?: string | undefined;
100
- version?: string | undefined;
101
- startedAt?: Date | undefined;
102
- finishedAt?: Date | undefined;
103
- delayedUntil?: Date | undefined;
104
- ttl?: string | undefined;
105
- expiredAt?: Date | undefined;
106
- metadata?: Record<string, any> | undefined;
107
- } | undefined;
108
- children?: {
109
- status: "CANCELED" | "COMPLETED" | "FAILED" | "WAITING_FOR_DEPLOY" | "QUEUED" | "EXECUTING" | "REATTEMPTING" | "FROZEN" | "CRASHED" | "INTERRUPTED" | "SYSTEM_FAILURE" | "DELAYED" | "EXPIRED";
110
- id: string;
111
- tags: string[];
112
- isTest: boolean;
113
- createdAt: Date;
114
- durationMs: number;
115
- costInCents: number;
116
- baseCostInCents: number;
117
- depth: number;
118
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
119
- taskIdentifier: string;
120
- isQueued: boolean;
121
- isExecuting: boolean;
122
- isCompleted: boolean;
123
- isSuccess: boolean;
124
- isFailed: boolean;
125
- isCancelled: boolean;
126
- updatedAt: Date;
127
- batchId?: string | undefined;
128
- idempotencyKey?: string | undefined;
129
- version?: string | undefined;
130
- startedAt?: Date | undefined;
131
- finishedAt?: Date | undefined;
132
- delayedUntil?: Date | undefined;
133
- ttl?: string | undefined;
134
- expiredAt?: Date | undefined;
135
- metadata?: Record<string, any> | undefined;
136
- }[] | undefined;
137
- };
50
+ schedule?: {
51
+ id: string;
52
+ generator: {
53
+ type: "CRON";
54
+ description: string;
55
+ expression: string;
56
+ };
57
+ externalId?: string | undefined;
58
+ deduplicationKey?: string | undefined;
59
+ } | undefined;
138
60
  attempts: ({
139
- status: "PENDING" | "CANCELED" | "COMPLETED" | "FAILED" | "EXECUTING" | "PAUSED";
61
+ status: "PENDING" | "COMPLETED" | "CANCELED" | "EXECUTING" | "FAILED" | "PAUSED";
140
62
  id: string;
141
- createdAt: Date;
142
63
  updatedAt: Date;
64
+ createdAt: Date;
143
65
  startedAt?: Date | undefined;
144
66
  completedAt?: Date | undefined;
145
67
  error?: {
@@ -148,42 +70,12 @@ declare function poll<TRunId extends RunHandle<any> | AnyTask | string>(runId: R
148
70
  stackTrace?: string | undefined;
149
71
  } | undefined;
150
72
  } | undefined)[];
151
- payload?: any;
152
- payloadPresignedUrl?: string | undefined;
153
- output?: any;
154
- outputPresignedUrl?: string | undefined;
155
- schedule?: {
156
- id: string;
157
- generator: {
158
- type: "CRON";
159
- expression: string;
160
- description: string;
161
- };
162
- externalId?: string | undefined;
163
- deduplicationKey?: string | undefined;
164
- } | undefined;
165
- batchId?: string | undefined;
166
- idempotencyKey?: string | undefined;
167
- version?: string | undefined;
168
- startedAt?: Date | undefined;
169
- finishedAt?: Date | undefined;
170
- delayedUntil?: Date | undefined;
171
- ttl?: string | undefined;
172
- expiredAt?: Date | undefined;
173
- metadata?: Record<string, any> | undefined;
174
- }, "output"> & {
175
- output?: TOutput;
176
- } : TRunId extends Task<string, any, infer TTaskOutput> ? Omit<{
177
- status: "CANCELED" | "COMPLETED" | "FAILED" | "WAITING_FOR_DEPLOY" | "QUEUED" | "EXECUTING" | "REATTEMPTING" | "FROZEN" | "CRASHED" | "INTERRUPTED" | "SYSTEM_FAILURE" | "DELAYED" | "EXPIRED";
178
- id: string;
179
73
  tags: string[];
180
- isTest: boolean;
181
- createdAt: Date;
182
74
  durationMs: number;
183
75
  costInCents: number;
184
76
  baseCostInCents: number;
185
77
  depth: number;
186
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
78
+ triggerFunction: "trigger" | "triggerAndWait" | "batchTriggerAndWait" | "batchTrigger";
187
79
  taskIdentifier: string;
188
80
  isQueued: boolean;
189
81
  isExecuting: boolean;
@@ -191,19 +83,19 @@ declare function poll<TRunId extends RunHandle<any> | AnyTask | string>(runId: R
191
83
  isSuccess: boolean;
192
84
  isFailed: boolean;
193
85
  isCancelled: boolean;
194
- updatedAt: Date;
195
86
  relatedRuns: {
196
87
  root?: {
197
- status: "CANCELED" | "COMPLETED" | "FAILED" | "WAITING_FOR_DEPLOY" | "QUEUED" | "EXECUTING" | "REATTEMPTING" | "FROZEN" | "CRASHED" | "INTERRUPTED" | "SYSTEM_FAILURE" | "DELAYED" | "EXPIRED";
88
+ status: "COMPLETED" | "CANCELED" | "QUEUED" | "EXECUTING" | "FAILED" | "WAITING_FOR_DEPLOY" | "REATTEMPTING" | "FROZEN" | "CRASHED" | "INTERRUPTED" | "SYSTEM_FAILURE" | "DELAYED" | "EXPIRED" | "UNKNOWN";
198
89
  id: string;
199
- tags: string[];
90
+ updatedAt: Date;
200
91
  isTest: boolean;
201
92
  createdAt: Date;
93
+ tags: string[];
202
94
  durationMs: number;
203
95
  costInCents: number;
204
96
  baseCostInCents: number;
205
97
  depth: number;
206
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
98
+ triggerFunction: "trigger" | "triggerAndWait" | "batchTriggerAndWait" | "batchTrigger";
207
99
  taskIdentifier: string;
208
100
  isQueued: boolean;
209
101
  isExecuting: boolean;
@@ -211,7 +103,6 @@ declare function poll<TRunId extends RunHandle<any> | AnyTask | string>(runId: R
211
103
  isSuccess: boolean;
212
104
  isFailed: boolean;
213
105
  isCancelled: boolean;
214
- updatedAt: Date;
215
106
  batchId?: string | undefined;
216
107
  idempotencyKey?: string | undefined;
217
108
  version?: string | undefined;
@@ -223,16 +114,17 @@ declare function poll<TRunId extends RunHandle<any> | AnyTask | string>(runId: R
223
114
  metadata?: Record<string, any> | undefined;
224
115
  } | undefined;
225
116
  parent?: {
226
- status: "CANCELED" | "COMPLETED" | "FAILED" | "WAITING_FOR_DEPLOY" | "QUEUED" | "EXECUTING" | "REATTEMPTING" | "FROZEN" | "CRASHED" | "INTERRUPTED" | "SYSTEM_FAILURE" | "DELAYED" | "EXPIRED";
117
+ status: "COMPLETED" | "CANCELED" | "QUEUED" | "EXECUTING" | "FAILED" | "WAITING_FOR_DEPLOY" | "REATTEMPTING" | "FROZEN" | "CRASHED" | "INTERRUPTED" | "SYSTEM_FAILURE" | "DELAYED" | "EXPIRED" | "UNKNOWN";
227
118
  id: string;
228
- tags: string[];
119
+ updatedAt: Date;
229
120
  isTest: boolean;
230
121
  createdAt: Date;
122
+ tags: string[];
231
123
  durationMs: number;
232
124
  costInCents: number;
233
125
  baseCostInCents: number;
234
126
  depth: number;
235
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
127
+ triggerFunction: "trigger" | "triggerAndWait" | "batchTriggerAndWait" | "batchTrigger";
236
128
  taskIdentifier: string;
237
129
  isQueued: boolean;
238
130
  isExecuting: boolean;
@@ -240,7 +132,6 @@ declare function poll<TRunId extends RunHandle<any> | AnyTask | string>(runId: R
240
132
  isSuccess: boolean;
241
133
  isFailed: boolean;
242
134
  isCancelled: boolean;
243
- updatedAt: Date;
244
135
  batchId?: string | undefined;
245
136
  idempotencyKey?: string | undefined;
246
137
  version?: string | undefined;
@@ -252,16 +143,17 @@ declare function poll<TRunId extends RunHandle<any> | AnyTask | string>(runId: R
252
143
  metadata?: Record<string, any> | undefined;
253
144
  } | undefined;
254
145
  children?: {
255
- status: "CANCELED" | "COMPLETED" | "FAILED" | "WAITING_FOR_DEPLOY" | "QUEUED" | "EXECUTING" | "REATTEMPTING" | "FROZEN" | "CRASHED" | "INTERRUPTED" | "SYSTEM_FAILURE" | "DELAYED" | "EXPIRED";
146
+ status: "COMPLETED" | "CANCELED" | "QUEUED" | "EXECUTING" | "FAILED" | "WAITING_FOR_DEPLOY" | "REATTEMPTING" | "FROZEN" | "CRASHED" | "INTERRUPTED" | "SYSTEM_FAILURE" | "DELAYED" | "EXPIRED" | "UNKNOWN";
256
147
  id: string;
257
- tags: string[];
148
+ updatedAt: Date;
258
149
  isTest: boolean;
259
150
  createdAt: Date;
151
+ tags: string[];
260
152
  durationMs: number;
261
153
  costInCents: number;
262
154
  baseCostInCents: number;
263
155
  depth: number;
264
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
156
+ triggerFunction: "trigger" | "triggerAndWait" | "batchTriggerAndWait" | "batchTrigger";
265
157
  taskIdentifier: string;
266
158
  isQueued: boolean;
267
159
  isExecuting: boolean;
@@ -269,7 +161,6 @@ declare function poll<TRunId extends RunHandle<any> | AnyTask | string>(runId: R
269
161
  isSuccess: boolean;
270
162
  isFailed: boolean;
271
163
  isCancelled: boolean;
272
- updatedAt: Date;
273
164
  batchId?: string | undefined;
274
165
  idempotencyKey?: string | undefined;
275
166
  version?: string | undefined;
@@ -281,623 +172,15 @@ declare function poll<TRunId extends RunHandle<any> | AnyTask | string>(runId: R
281
172
  metadata?: Record<string, any> | undefined;
282
173
  }[] | undefined;
283
174
  };
284
- attempts: ({
285
- status: "PENDING" | "CANCELED" | "COMPLETED" | "FAILED" | "EXECUTING" | "PAUSED";
286
- id: string;
287
- createdAt: Date;
288
- updatedAt: Date;
289
- startedAt?: Date | undefined;
290
- completedAt?: Date | undefined;
291
- error?: {
292
- message: string;
293
- name?: string | undefined;
294
- stackTrace?: string | undefined;
295
- } | undefined;
296
- } | undefined)[];
297
- payload?: any;
298
175
  payloadPresignedUrl?: string | undefined;
299
- output?: any;
300
176
  outputPresignedUrl?: string | undefined;
301
- schedule?: {
302
- id: string;
303
- generator: {
304
- type: "CRON";
305
- expression: string;
306
- description: string;
307
- };
308
- externalId?: string | undefined;
309
- deduplicationKey?: string | undefined;
310
- } | undefined;
311
177
  batchId?: string | undefined;
312
- idempotencyKey?: string | undefined;
313
- version?: string | undefined;
314
- startedAt?: Date | undefined;
315
178
  finishedAt?: Date | undefined;
316
179
  delayedUntil?: Date | undefined;
317
180
  ttl?: string | undefined;
318
181
  expiredAt?: Date | undefined;
319
- metadata?: Record<string, any> | undefined;
320
- }, "output"> & {
321
- output?: TTaskOutput;
322
- } : TRunId extends string ? {
323
- status: "CANCELED" | "COMPLETED" | "FAILED" | "WAITING_FOR_DEPLOY" | "QUEUED" | "EXECUTING" | "REATTEMPTING" | "FROZEN" | "CRASHED" | "INTERRUPTED" | "SYSTEM_FAILURE" | "DELAYED" | "EXPIRED";
324
- id: string;
325
- tags: string[];
326
- isTest: boolean;
327
- createdAt: Date;
328
- durationMs: number;
329
- costInCents: number;
330
- baseCostInCents: number;
331
- depth: number;
332
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
333
- taskIdentifier: string;
334
- isQueued: boolean;
335
- isExecuting: boolean;
336
- isCompleted: boolean;
337
- isSuccess: boolean;
338
- isFailed: boolean;
339
- isCancelled: boolean;
340
- updatedAt: Date;
341
- relatedRuns: {
342
- root?: {
343
- status: "CANCELED" | "COMPLETED" | "FAILED" | "WAITING_FOR_DEPLOY" | "QUEUED" | "EXECUTING" | "REATTEMPTING" | "FROZEN" | "CRASHED" | "INTERRUPTED" | "SYSTEM_FAILURE" | "DELAYED" | "EXPIRED";
344
- id: string;
345
- tags: string[];
346
- isTest: boolean;
347
- createdAt: Date;
348
- durationMs: number;
349
- costInCents: number;
350
- baseCostInCents: number;
351
- depth: number;
352
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
353
- taskIdentifier: string;
354
- isQueued: boolean;
355
- isExecuting: boolean;
356
- isCompleted: boolean;
357
- isSuccess: boolean;
358
- isFailed: boolean;
359
- isCancelled: boolean;
360
- updatedAt: Date;
361
- batchId?: string | undefined;
362
- idempotencyKey?: string | undefined;
363
- version?: string | undefined;
364
- startedAt?: Date | undefined;
365
- finishedAt?: Date | undefined;
366
- delayedUntil?: Date | undefined;
367
- ttl?: string | undefined;
368
- expiredAt?: Date | undefined;
369
- metadata?: Record<string, any> | undefined;
370
- } | undefined;
371
- parent?: {
372
- status: "CANCELED" | "COMPLETED" | "FAILED" | "WAITING_FOR_DEPLOY" | "QUEUED" | "EXECUTING" | "REATTEMPTING" | "FROZEN" | "CRASHED" | "INTERRUPTED" | "SYSTEM_FAILURE" | "DELAYED" | "EXPIRED";
373
- id: string;
374
- tags: string[];
375
- isTest: boolean;
376
- createdAt: Date;
377
- durationMs: number;
378
- costInCents: number;
379
- baseCostInCents: number;
380
- depth: number;
381
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
382
- taskIdentifier: string;
383
- isQueued: boolean;
384
- isExecuting: boolean;
385
- isCompleted: boolean;
386
- isSuccess: boolean;
387
- isFailed: boolean;
388
- isCancelled: boolean;
389
- updatedAt: Date;
390
- batchId?: string | undefined;
391
- idempotencyKey?: string | undefined;
392
- version?: string | undefined;
393
- startedAt?: Date | undefined;
394
- finishedAt?: Date | undefined;
395
- delayedUntil?: Date | undefined;
396
- ttl?: string | undefined;
397
- expiredAt?: Date | undefined;
398
- metadata?: Record<string, any> | undefined;
399
- } | undefined;
400
- children?: {
401
- status: "CANCELED" | "COMPLETED" | "FAILED" | "WAITING_FOR_DEPLOY" | "QUEUED" | "EXECUTING" | "REATTEMPTING" | "FROZEN" | "CRASHED" | "INTERRUPTED" | "SYSTEM_FAILURE" | "DELAYED" | "EXPIRED";
402
- id: string;
403
- tags: string[];
404
- isTest: boolean;
405
- createdAt: Date;
406
- durationMs: number;
407
- costInCents: number;
408
- baseCostInCents: number;
409
- depth: number;
410
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
411
- taskIdentifier: string;
412
- isQueued: boolean;
413
- isExecuting: boolean;
414
- isCompleted: boolean;
415
- isSuccess: boolean;
416
- isFailed: boolean;
417
- isCancelled: boolean;
418
- updatedAt: Date;
419
- batchId?: string | undefined;
420
- idempotencyKey?: string | undefined;
421
- version?: string | undefined;
422
- startedAt?: Date | undefined;
423
- finishedAt?: Date | undefined;
424
- delayedUntil?: Date | undefined;
425
- ttl?: string | undefined;
426
- expiredAt?: Date | undefined;
427
- metadata?: Record<string, any> | undefined;
428
- }[] | undefined;
429
- };
430
- attempts: ({
431
- status: "PENDING" | "CANCELED" | "COMPLETED" | "FAILED" | "EXECUTING" | "PAUSED";
432
- id: string;
433
- createdAt: Date;
434
- updatedAt: Date;
435
- startedAt?: Date | undefined;
436
- completedAt?: Date | undefined;
437
- error?: {
438
- message: string;
439
- name?: string | undefined;
440
- stackTrace?: string | undefined;
441
- } | undefined;
442
- } | undefined)[];
443
- payload?: any;
444
- payloadPresignedUrl?: string | undefined;
445
- output?: any;
446
- outputPresignedUrl?: string | undefined;
447
- schedule?: {
448
- id: string;
449
- generator: {
450
- type: "CRON";
451
- expression: string;
452
- description: string;
453
- };
454
- externalId?: string | undefined;
455
- deduplicationKey?: string | undefined;
456
- } | undefined;
457
- batchId?: string | undefined;
458
- idempotencyKey?: string | undefined;
459
- version?: string | undefined;
460
- startedAt?: Date | undefined;
461
- finishedAt?: Date | undefined;
462
- delayedUntil?: Date | undefined;
463
- ttl?: string | undefined;
464
- expiredAt?: Date | undefined;
465
- metadata?: Record<string, any> | undefined;
466
- } : never) extends infer T ? { [K in keyof T]: (TRunId extends RunHandle<infer TOutput> ? Omit<{
467
- status: "CANCELED" | "COMPLETED" | "FAILED" | "WAITING_FOR_DEPLOY" | "QUEUED" | "EXECUTING" | "REATTEMPTING" | "FROZEN" | "CRASHED" | "INTERRUPTED" | "SYSTEM_FAILURE" | "DELAYED" | "EXPIRED";
468
- id: string;
469
- tags: string[];
470
- isTest: boolean;
471
- createdAt: Date;
472
- durationMs: number;
473
- costInCents: number;
474
- baseCostInCents: number;
475
- depth: number;
476
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
477
- taskIdentifier: string;
478
- isQueued: boolean;
479
- isExecuting: boolean;
480
- isCompleted: boolean;
481
- isSuccess: boolean;
482
- isFailed: boolean;
483
- isCancelled: boolean;
484
- updatedAt: Date;
485
- relatedRuns: {
486
- root?: {
487
- status: "CANCELED" | "COMPLETED" | "FAILED" | "WAITING_FOR_DEPLOY" | "QUEUED" | "EXECUTING" | "REATTEMPTING" | "FROZEN" | "CRASHED" | "INTERRUPTED" | "SYSTEM_FAILURE" | "DELAYED" | "EXPIRED";
488
- id: string;
489
- tags: string[];
490
- isTest: boolean;
491
- createdAt: Date;
492
- durationMs: number;
493
- costInCents: number;
494
- baseCostInCents: number;
495
- depth: number;
496
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
497
- taskIdentifier: string;
498
- isQueued: boolean;
499
- isExecuting: boolean;
500
- isCompleted: boolean;
501
- isSuccess: boolean;
502
- isFailed: boolean;
503
- isCancelled: boolean;
504
- updatedAt: Date;
505
- batchId?: string | undefined;
506
- idempotencyKey?: string | undefined;
507
- version?: string | undefined;
508
- startedAt?: Date | undefined;
509
- finishedAt?: Date | undefined;
510
- delayedUntil?: Date | undefined;
511
- ttl?: string | undefined;
512
- expiredAt?: Date | undefined;
513
- metadata?: Record<string, any> | undefined;
514
- } | undefined;
515
- parent?: {
516
- status: "CANCELED" | "COMPLETED" | "FAILED" | "WAITING_FOR_DEPLOY" | "QUEUED" | "EXECUTING" | "REATTEMPTING" | "FROZEN" | "CRASHED" | "INTERRUPTED" | "SYSTEM_FAILURE" | "DELAYED" | "EXPIRED";
517
- id: string;
518
- tags: string[];
519
- isTest: boolean;
520
- createdAt: Date;
521
- durationMs: number;
522
- costInCents: number;
523
- baseCostInCents: number;
524
- depth: number;
525
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
526
- taskIdentifier: string;
527
- isQueued: boolean;
528
- isExecuting: boolean;
529
- isCompleted: boolean;
530
- isSuccess: boolean;
531
- isFailed: boolean;
532
- isCancelled: boolean;
533
- updatedAt: Date;
534
- batchId?: string | undefined;
535
- idempotencyKey?: string | undefined;
536
- version?: string | undefined;
537
- startedAt?: Date | undefined;
538
- finishedAt?: Date | undefined;
539
- delayedUntil?: Date | undefined;
540
- ttl?: string | undefined;
541
- expiredAt?: Date | undefined;
542
- metadata?: Record<string, any> | undefined;
543
- } | undefined;
544
- children?: {
545
- status: "CANCELED" | "COMPLETED" | "FAILED" | "WAITING_FOR_DEPLOY" | "QUEUED" | "EXECUTING" | "REATTEMPTING" | "FROZEN" | "CRASHED" | "INTERRUPTED" | "SYSTEM_FAILURE" | "DELAYED" | "EXPIRED";
546
- id: string;
547
- tags: string[];
548
- isTest: boolean;
549
- createdAt: Date;
550
- durationMs: number;
551
- costInCents: number;
552
- baseCostInCents: number;
553
- depth: number;
554
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
555
- taskIdentifier: string;
556
- isQueued: boolean;
557
- isExecuting: boolean;
558
- isCompleted: boolean;
559
- isSuccess: boolean;
560
- isFailed: boolean;
561
- isCancelled: boolean;
562
- updatedAt: Date;
563
- batchId?: string | undefined;
564
- idempotencyKey?: string | undefined;
565
- version?: string | undefined;
566
- startedAt?: Date | undefined;
567
- finishedAt?: Date | undefined;
568
- delayedUntil?: Date | undefined;
569
- ttl?: string | undefined;
570
- expiredAt?: Date | undefined;
571
- metadata?: Record<string, any> | undefined;
572
- }[] | undefined;
573
- };
574
- attempts: ({
575
- status: "PENDING" | "CANCELED" | "COMPLETED" | "FAILED" | "EXECUTING" | "PAUSED";
576
- id: string;
577
- createdAt: Date;
578
- updatedAt: Date;
579
- startedAt?: Date | undefined;
580
- completedAt?: Date | undefined;
581
- error?: {
582
- message: string;
583
- name?: string | undefined;
584
- stackTrace?: string | undefined;
585
- } | undefined;
586
- } | undefined)[];
587
- payload?: any;
588
- payloadPresignedUrl?: string | undefined;
589
- output?: any;
590
- outputPresignedUrl?: string | undefined;
591
- schedule?: {
592
- id: string;
593
- generator: {
594
- type: "CRON";
595
- expression: string;
596
- description: string;
597
- };
598
- externalId?: string | undefined;
599
- deduplicationKey?: string | undefined;
600
- } | undefined;
601
- batchId?: string | undefined;
602
- idempotencyKey?: string | undefined;
603
- version?: string | undefined;
604
- startedAt?: Date | undefined;
605
- finishedAt?: Date | undefined;
606
- delayedUntil?: Date | undefined;
607
- ttl?: string | undefined;
608
- expiredAt?: Date | undefined;
609
- metadata?: Record<string, any> | undefined;
610
- }, "output"> & {
611
- output?: TOutput;
612
- } : TRunId extends Task<string, any, infer TTaskOutput> ? Omit<{
613
- status: "CANCELED" | "COMPLETED" | "FAILED" | "WAITING_FOR_DEPLOY" | "QUEUED" | "EXECUTING" | "REATTEMPTING" | "FROZEN" | "CRASHED" | "INTERRUPTED" | "SYSTEM_FAILURE" | "DELAYED" | "EXPIRED";
614
- id: string;
615
- tags: string[];
616
- isTest: boolean;
617
- createdAt: Date;
618
- durationMs: number;
619
- costInCents: number;
620
- baseCostInCents: number;
621
- depth: number;
622
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
623
- taskIdentifier: string;
624
- isQueued: boolean;
625
- isExecuting: boolean;
626
- isCompleted: boolean;
627
- isSuccess: boolean;
628
- isFailed: boolean;
629
- isCancelled: boolean;
630
- updatedAt: Date;
631
- relatedRuns: {
632
- root?: {
633
- status: "CANCELED" | "COMPLETED" | "FAILED" | "WAITING_FOR_DEPLOY" | "QUEUED" | "EXECUTING" | "REATTEMPTING" | "FROZEN" | "CRASHED" | "INTERRUPTED" | "SYSTEM_FAILURE" | "DELAYED" | "EXPIRED";
634
- id: string;
635
- tags: string[];
636
- isTest: boolean;
637
- createdAt: Date;
638
- durationMs: number;
639
- costInCents: number;
640
- baseCostInCents: number;
641
- depth: number;
642
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
643
- taskIdentifier: string;
644
- isQueued: boolean;
645
- isExecuting: boolean;
646
- isCompleted: boolean;
647
- isSuccess: boolean;
648
- isFailed: boolean;
649
- isCancelled: boolean;
650
- updatedAt: Date;
651
- batchId?: string | undefined;
652
- idempotencyKey?: string | undefined;
653
- version?: string | undefined;
654
- startedAt?: Date | undefined;
655
- finishedAt?: Date | undefined;
656
- delayedUntil?: Date | undefined;
657
- ttl?: string | undefined;
658
- expiredAt?: Date | undefined;
659
- metadata?: Record<string, any> | undefined;
660
- } | undefined;
661
- parent?: {
662
- status: "CANCELED" | "COMPLETED" | "FAILED" | "WAITING_FOR_DEPLOY" | "QUEUED" | "EXECUTING" | "REATTEMPTING" | "FROZEN" | "CRASHED" | "INTERRUPTED" | "SYSTEM_FAILURE" | "DELAYED" | "EXPIRED";
663
- id: string;
664
- tags: string[];
665
- isTest: boolean;
666
- createdAt: Date;
667
- durationMs: number;
668
- costInCents: number;
669
- baseCostInCents: number;
670
- depth: number;
671
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
672
- taskIdentifier: string;
673
- isQueued: boolean;
674
- isExecuting: boolean;
675
- isCompleted: boolean;
676
- isSuccess: boolean;
677
- isFailed: boolean;
678
- isCancelled: boolean;
679
- updatedAt: Date;
680
- batchId?: string | undefined;
681
- idempotencyKey?: string | undefined;
682
- version?: string | undefined;
683
- startedAt?: Date | undefined;
684
- finishedAt?: Date | undefined;
685
- delayedUntil?: Date | undefined;
686
- ttl?: string | undefined;
687
- expiredAt?: Date | undefined;
688
- metadata?: Record<string, any> | undefined;
689
- } | undefined;
690
- children?: {
691
- status: "CANCELED" | "COMPLETED" | "FAILED" | "WAITING_FOR_DEPLOY" | "QUEUED" | "EXECUTING" | "REATTEMPTING" | "FROZEN" | "CRASHED" | "INTERRUPTED" | "SYSTEM_FAILURE" | "DELAYED" | "EXPIRED";
692
- id: string;
693
- tags: string[];
694
- isTest: boolean;
695
- createdAt: Date;
696
- durationMs: number;
697
- costInCents: number;
698
- baseCostInCents: number;
699
- depth: number;
700
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
701
- taskIdentifier: string;
702
- isQueued: boolean;
703
- isExecuting: boolean;
704
- isCompleted: boolean;
705
- isSuccess: boolean;
706
- isFailed: boolean;
707
- isCancelled: boolean;
708
- updatedAt: Date;
709
- batchId?: string | undefined;
710
- idempotencyKey?: string | undefined;
711
- version?: string | undefined;
712
- startedAt?: Date | undefined;
713
- finishedAt?: Date | undefined;
714
- delayedUntil?: Date | undefined;
715
- ttl?: string | undefined;
716
- expiredAt?: Date | undefined;
717
- metadata?: Record<string, any> | undefined;
718
- }[] | undefined;
719
- };
720
- attempts: ({
721
- status: "PENDING" | "CANCELED" | "COMPLETED" | "FAILED" | "EXECUTING" | "PAUSED";
722
- id: string;
723
- createdAt: Date;
724
- updatedAt: Date;
725
- startedAt?: Date | undefined;
726
- completedAt?: Date | undefined;
727
- error?: {
728
- message: string;
729
- name?: string | undefined;
730
- stackTrace?: string | undefined;
731
- } | undefined;
732
- } | undefined)[];
733
- payload?: any;
734
- payloadPresignedUrl?: string | undefined;
735
- output?: any;
736
- outputPresignedUrl?: string | undefined;
737
- schedule?: {
738
- id: string;
739
- generator: {
740
- type: "CRON";
741
- expression: string;
742
- description: string;
743
- };
744
- externalId?: string | undefined;
745
- deduplicationKey?: string | undefined;
746
- } | undefined;
747
- batchId?: string | undefined;
748
- idempotencyKey?: string | undefined;
749
- version?: string | undefined;
750
- startedAt?: Date | undefined;
751
- finishedAt?: Date | undefined;
752
- delayedUntil?: Date | undefined;
753
- ttl?: string | undefined;
754
- expiredAt?: Date | undefined;
755
- metadata?: Record<string, any> | undefined;
756
- }, "output"> & {
757
- output?: TTaskOutput;
758
- } : TRunId extends string ? {
759
- status: "CANCELED" | "COMPLETED" | "FAILED" | "WAITING_FOR_DEPLOY" | "QUEUED" | "EXECUTING" | "REATTEMPTING" | "FROZEN" | "CRASHED" | "INTERRUPTED" | "SYSTEM_FAILURE" | "DELAYED" | "EXPIRED";
760
- id: string;
761
- tags: string[];
762
- isTest: boolean;
763
- createdAt: Date;
764
- durationMs: number;
765
- costInCents: number;
766
- baseCostInCents: number;
767
- depth: number;
768
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
769
- taskIdentifier: string;
770
- isQueued: boolean;
771
- isExecuting: boolean;
772
- isCompleted: boolean;
773
- isSuccess: boolean;
774
- isFailed: boolean;
775
- isCancelled: boolean;
776
- updatedAt: Date;
777
- relatedRuns: {
778
- root?: {
779
- status: "CANCELED" | "COMPLETED" | "FAILED" | "WAITING_FOR_DEPLOY" | "QUEUED" | "EXECUTING" | "REATTEMPTING" | "FROZEN" | "CRASHED" | "INTERRUPTED" | "SYSTEM_FAILURE" | "DELAYED" | "EXPIRED";
780
- id: string;
781
- tags: string[];
782
- isTest: boolean;
783
- createdAt: Date;
784
- durationMs: number;
785
- costInCents: number;
786
- baseCostInCents: number;
787
- depth: number;
788
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
789
- taskIdentifier: string;
790
- isQueued: boolean;
791
- isExecuting: boolean;
792
- isCompleted: boolean;
793
- isSuccess: boolean;
794
- isFailed: boolean;
795
- isCancelled: boolean;
796
- updatedAt: Date;
797
- batchId?: string | undefined;
798
- idempotencyKey?: string | undefined;
799
- version?: string | undefined;
800
- startedAt?: Date | undefined;
801
- finishedAt?: Date | undefined;
802
- delayedUntil?: Date | undefined;
803
- ttl?: string | undefined;
804
- expiredAt?: Date | undefined;
805
- metadata?: Record<string, any> | undefined;
806
- } | undefined;
807
- parent?: {
808
- status: "CANCELED" | "COMPLETED" | "FAILED" | "WAITING_FOR_DEPLOY" | "QUEUED" | "EXECUTING" | "REATTEMPTING" | "FROZEN" | "CRASHED" | "INTERRUPTED" | "SYSTEM_FAILURE" | "DELAYED" | "EXPIRED";
809
- id: string;
810
- tags: string[];
811
- isTest: boolean;
812
- createdAt: Date;
813
- durationMs: number;
814
- costInCents: number;
815
- baseCostInCents: number;
816
- depth: number;
817
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
818
- taskIdentifier: string;
819
- isQueued: boolean;
820
- isExecuting: boolean;
821
- isCompleted: boolean;
822
- isSuccess: boolean;
823
- isFailed: boolean;
824
- isCancelled: boolean;
825
- updatedAt: Date;
826
- batchId?: string | undefined;
827
- idempotencyKey?: string | undefined;
828
- version?: string | undefined;
829
- startedAt?: Date | undefined;
830
- finishedAt?: Date | undefined;
831
- delayedUntil?: Date | undefined;
832
- ttl?: string | undefined;
833
- expiredAt?: Date | undefined;
834
- metadata?: Record<string, any> | undefined;
835
- } | undefined;
836
- children?: {
837
- status: "CANCELED" | "COMPLETED" | "FAILED" | "WAITING_FOR_DEPLOY" | "QUEUED" | "EXECUTING" | "REATTEMPTING" | "FROZEN" | "CRASHED" | "INTERRUPTED" | "SYSTEM_FAILURE" | "DELAYED" | "EXPIRED";
838
- id: string;
839
- tags: string[];
840
- isTest: boolean;
841
- createdAt: Date;
842
- durationMs: number;
843
- costInCents: number;
844
- baseCostInCents: number;
845
- depth: number;
846
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
847
- taskIdentifier: string;
848
- isQueued: boolean;
849
- isExecuting: boolean;
850
- isCompleted: boolean;
851
- isSuccess: boolean;
852
- isFailed: boolean;
853
- isCancelled: boolean;
854
- updatedAt: Date;
855
- batchId?: string | undefined;
856
- idempotencyKey?: string | undefined;
857
- version?: string | undefined;
858
- startedAt?: Date | undefined;
859
- finishedAt?: Date | undefined;
860
- delayedUntil?: Date | undefined;
861
- ttl?: string | undefined;
862
- expiredAt?: Date | undefined;
863
- metadata?: Record<string, any> | undefined;
864
- }[] | undefined;
865
- };
866
- attempts: ({
867
- status: "PENDING" | "CANCELED" | "COMPLETED" | "FAILED" | "EXECUTING" | "PAUSED";
868
- id: string;
869
- createdAt: Date;
870
- updatedAt: Date;
871
- startedAt?: Date | undefined;
872
- completedAt?: Date | undefined;
873
- error?: {
874
- message: string;
875
- name?: string | undefined;
876
- stackTrace?: string | undefined;
877
- } | undefined;
878
- } | undefined)[];
879
- payload?: any;
880
- payloadPresignedUrl?: string | undefined;
881
- output?: any;
882
- outputPresignedUrl?: string | undefined;
883
- schedule?: {
884
- id: string;
885
- generator: {
886
- type: "CRON";
887
- expression: string;
888
- description: string;
889
- };
890
- externalId?: string | undefined;
891
- deduplicationKey?: string | undefined;
892
- } | undefined;
893
- batchId?: string | undefined;
894
- idempotencyKey?: string | undefined;
895
- version?: string | undefined;
896
- startedAt?: Date | undefined;
897
- finishedAt?: Date | undefined;
898
- delayedUntil?: Date | undefined;
899
- ttl?: string | undefined;
900
- expiredAt?: Date | undefined;
901
- metadata?: Record<string, any> | undefined;
902
- } : never)[K]; } : never>;
182
+ output?: InferRunId<TRunId>["output"] | undefined;
183
+ payload?: InferRunId<TRunId>["payload"] | undefined;
184
+ }>;
185
+ declare function subscribeToRun<TRunId extends AnyRunHandle | AnyTask | string>(runId: RunId<TRunId>, callback?: RunStreamCallback<InferRunId<TRunId>["payload"], InferRunId<TRunId>["output"]>): Promise<RunSubscription<InferRunId<TRunId>["payload"], InferRunId<TRunId>["output"]>>;
903
186
  export {};