@trigger.dev/sdk 0.0.0-prerelease-20240930020332 → 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
- createdAt: Date;
34
- tags: string[];
35
- depth: number;
36
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
37
- taskIdentifier: string;
38
- isQueued: boolean;
39
- isExecuting: boolean;
40
- isCompleted: boolean;
41
- isSuccess: boolean;
42
- isFailed: boolean;
43
- isCancelled: boolean;
44
- isTest: boolean;
43
+ idempotencyKey?: string | undefined;
44
+ startedAt?: Date | undefined;
45
45
  updatedAt: Date;
46
- costInCents: number;
47
- baseCostInCents: number;
48
- durationMs: number;
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
- createdAt: Date;
54
- tags: string[];
55
- depth: number;
56
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
57
- taskIdentifier: string;
58
- isQueued: boolean;
59
- isExecuting: boolean;
60
- isCompleted: boolean;
61
- isSuccess: boolean;
62
- isFailed: boolean;
63
- isCancelled: boolean;
64
- isTest: boolean;
65
- updatedAt: Date;
66
- costInCents: number;
67
- baseCostInCents: number;
68
- durationMs: number;
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
- createdAt: Date;
83
- tags: string[];
84
- depth: number;
85
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
86
- taskIdentifier: string;
87
- isQueued: boolean;
88
- isExecuting: boolean;
89
- isCompleted: boolean;
90
- isSuccess: boolean;
91
- isFailed: boolean;
92
- isCancelled: boolean;
93
- isTest: boolean;
94
- updatedAt: Date;
95
- costInCents: number;
96
- baseCostInCents: number;
97
- durationMs: number;
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
- createdAt: Date;
112
- tags: string[];
113
- depth: number;
114
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
115
- taskIdentifier: string;
116
- isQueued: boolean;
117
- isExecuting: boolean;
118
- isCompleted: boolean;
119
- isSuccess: boolean;
120
- isFailed: boolean;
121
- isCancelled: boolean;
122
- isTest: boolean;
123
- updatedAt: Date;
124
- costInCents: number;
125
- baseCostInCents: number;
126
- durationMs: number;
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
- };
46
+ isTest: boolean;
47
+ version?: string | undefined;
48
+ metadata?: Record<string, any> | undefined;
49
+ createdAt: Date;
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,38 +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
- createdAt: Date;
180
73
  tags: string[];
74
+ durationMs: number;
75
+ costInCents: number;
76
+ baseCostInCents: number;
181
77
  depth: number;
182
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
78
+ triggerFunction: "trigger" | "triggerAndWait" | "batchTriggerAndWait" | "batchTrigger";
183
79
  taskIdentifier: string;
184
80
  isQueued: boolean;
185
81
  isExecuting: boolean;
@@ -187,19 +83,19 @@ declare function poll<TRunId extends RunHandle<any> | AnyTask | string>(runId: R
187
83
  isSuccess: boolean;
188
84
  isFailed: boolean;
189
85
  isCancelled: boolean;
190
- isTest: boolean;
191
- updatedAt: Date;
192
- costInCents: number;
193
- baseCostInCents: number;
194
- durationMs: number;
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;
90
+ updatedAt: Date;
91
+ isTest: boolean;
199
92
  createdAt: Date;
200
93
  tags: string[];
94
+ durationMs: number;
95
+ costInCents: number;
96
+ baseCostInCents: number;
201
97
  depth: number;
202
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
98
+ triggerFunction: "trigger" | "triggerAndWait" | "batchTriggerAndWait" | "batchTrigger";
203
99
  taskIdentifier: string;
204
100
  isQueued: boolean;
205
101
  isExecuting: boolean;
@@ -207,11 +103,6 @@ declare function poll<TRunId extends RunHandle<any> | AnyTask | string>(runId: R
207
103
  isSuccess: boolean;
208
104
  isFailed: boolean;
209
105
  isCancelled: boolean;
210
- isTest: boolean;
211
- updatedAt: Date;
212
- costInCents: number;
213
- baseCostInCents: number;
214
- durationMs: number;
215
106
  batchId?: string | undefined;
216
107
  idempotencyKey?: string | undefined;
217
108
  version?: string | undefined;
@@ -223,12 +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;
119
+ updatedAt: Date;
120
+ isTest: boolean;
228
121
  createdAt: Date;
229
122
  tags: string[];
123
+ durationMs: number;
124
+ costInCents: number;
125
+ baseCostInCents: number;
230
126
  depth: number;
231
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
127
+ triggerFunction: "trigger" | "triggerAndWait" | "batchTriggerAndWait" | "batchTrigger";
232
128
  taskIdentifier: string;
233
129
  isQueued: boolean;
234
130
  isExecuting: boolean;
@@ -236,11 +132,6 @@ declare function poll<TRunId extends RunHandle<any> | AnyTask | string>(runId: R
236
132
  isSuccess: boolean;
237
133
  isFailed: boolean;
238
134
  isCancelled: boolean;
239
- isTest: boolean;
240
- updatedAt: Date;
241
- costInCents: number;
242
- baseCostInCents: number;
243
- durationMs: number;
244
135
  batchId?: string | undefined;
245
136
  idempotencyKey?: string | undefined;
246
137
  version?: string | undefined;
@@ -252,12 +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;
148
+ updatedAt: Date;
149
+ isTest: boolean;
257
150
  createdAt: Date;
258
151
  tags: string[];
152
+ durationMs: number;
153
+ costInCents: number;
154
+ baseCostInCents: number;
259
155
  depth: number;
260
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
156
+ triggerFunction: "trigger" | "triggerAndWait" | "batchTriggerAndWait" | "batchTrigger";
261
157
  taskIdentifier: string;
262
158
  isQueued: boolean;
263
159
  isExecuting: boolean;
@@ -265,11 +161,6 @@ declare function poll<TRunId extends RunHandle<any> | AnyTask | string>(runId: R
265
161
  isSuccess: boolean;
266
162
  isFailed: boolean;
267
163
  isCancelled: boolean;
268
- isTest: boolean;
269
- updatedAt: Date;
270
- costInCents: number;
271
- baseCostInCents: number;
272
- durationMs: number;
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
- createdAt: Date;
326
- tags: string[];
327
- depth: number;
328
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
329
- taskIdentifier: string;
330
- isQueued: boolean;
331
- isExecuting: boolean;
332
- isCompleted: boolean;
333
- isSuccess: boolean;
334
- isFailed: boolean;
335
- isCancelled: boolean;
336
- isTest: boolean;
337
- updatedAt: Date;
338
- costInCents: number;
339
- baseCostInCents: number;
340
- durationMs: number;
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
- createdAt: Date;
346
- tags: string[];
347
- depth: number;
348
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
349
- taskIdentifier: string;
350
- isQueued: boolean;
351
- isExecuting: boolean;
352
- isCompleted: boolean;
353
- isSuccess: boolean;
354
- isFailed: boolean;
355
- isCancelled: boolean;
356
- isTest: boolean;
357
- updatedAt: Date;
358
- costInCents: number;
359
- baseCostInCents: number;
360
- durationMs: number;
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
- createdAt: Date;
375
- tags: string[];
376
- depth: number;
377
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
378
- taskIdentifier: string;
379
- isQueued: boolean;
380
- isExecuting: boolean;
381
- isCompleted: boolean;
382
- isSuccess: boolean;
383
- isFailed: boolean;
384
- isCancelled: boolean;
385
- isTest: boolean;
386
- updatedAt: Date;
387
- costInCents: number;
388
- baseCostInCents: number;
389
- durationMs: number;
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
- createdAt: Date;
404
- tags: string[];
405
- depth: number;
406
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
407
- taskIdentifier: string;
408
- isQueued: boolean;
409
- isExecuting: boolean;
410
- isCompleted: boolean;
411
- isSuccess: boolean;
412
- isFailed: boolean;
413
- isCancelled: boolean;
414
- isTest: boolean;
415
- updatedAt: Date;
416
- costInCents: number;
417
- baseCostInCents: number;
418
- durationMs: number;
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
- createdAt: Date;
470
- tags: string[];
471
- depth: number;
472
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
473
- taskIdentifier: string;
474
- isQueued: boolean;
475
- isExecuting: boolean;
476
- isCompleted: boolean;
477
- isSuccess: boolean;
478
- isFailed: boolean;
479
- isCancelled: boolean;
480
- isTest: boolean;
481
- updatedAt: Date;
482
- costInCents: number;
483
- baseCostInCents: number;
484
- durationMs: number;
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
- createdAt: Date;
490
- tags: string[];
491
- depth: number;
492
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
493
- taskIdentifier: string;
494
- isQueued: boolean;
495
- isExecuting: boolean;
496
- isCompleted: boolean;
497
- isSuccess: boolean;
498
- isFailed: boolean;
499
- isCancelled: boolean;
500
- isTest: boolean;
501
- updatedAt: Date;
502
- costInCents: number;
503
- baseCostInCents: number;
504
- durationMs: number;
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
- createdAt: Date;
519
- tags: string[];
520
- depth: number;
521
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
522
- taskIdentifier: string;
523
- isQueued: boolean;
524
- isExecuting: boolean;
525
- isCompleted: boolean;
526
- isSuccess: boolean;
527
- isFailed: boolean;
528
- isCancelled: boolean;
529
- isTest: boolean;
530
- updatedAt: Date;
531
- costInCents: number;
532
- baseCostInCents: number;
533
- durationMs: number;
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
- createdAt: Date;
548
- tags: string[];
549
- depth: number;
550
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
551
- taskIdentifier: string;
552
- isQueued: boolean;
553
- isExecuting: boolean;
554
- isCompleted: boolean;
555
- isSuccess: boolean;
556
- isFailed: boolean;
557
- isCancelled: boolean;
558
- isTest: boolean;
559
- updatedAt: Date;
560
- costInCents: number;
561
- baseCostInCents: number;
562
- durationMs: number;
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
- createdAt: Date;
616
- tags: string[];
617
- depth: number;
618
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
619
- taskIdentifier: string;
620
- isQueued: boolean;
621
- isExecuting: boolean;
622
- isCompleted: boolean;
623
- isSuccess: boolean;
624
- isFailed: boolean;
625
- isCancelled: boolean;
626
- isTest: boolean;
627
- updatedAt: Date;
628
- costInCents: number;
629
- baseCostInCents: number;
630
- durationMs: number;
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
- createdAt: Date;
636
- tags: string[];
637
- depth: number;
638
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
639
- taskIdentifier: string;
640
- isQueued: boolean;
641
- isExecuting: boolean;
642
- isCompleted: boolean;
643
- isSuccess: boolean;
644
- isFailed: boolean;
645
- isCancelled: boolean;
646
- isTest: boolean;
647
- updatedAt: Date;
648
- costInCents: number;
649
- baseCostInCents: number;
650
- durationMs: number;
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
- createdAt: Date;
665
- tags: string[];
666
- depth: number;
667
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
668
- taskIdentifier: string;
669
- isQueued: boolean;
670
- isExecuting: boolean;
671
- isCompleted: boolean;
672
- isSuccess: boolean;
673
- isFailed: boolean;
674
- isCancelled: boolean;
675
- isTest: boolean;
676
- updatedAt: Date;
677
- costInCents: number;
678
- baseCostInCents: number;
679
- durationMs: number;
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
- createdAt: Date;
694
- tags: string[];
695
- depth: number;
696
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
697
- taskIdentifier: string;
698
- isQueued: boolean;
699
- isExecuting: boolean;
700
- isCompleted: boolean;
701
- isSuccess: boolean;
702
- isFailed: boolean;
703
- isCancelled: boolean;
704
- isTest: boolean;
705
- updatedAt: Date;
706
- costInCents: number;
707
- baseCostInCents: number;
708
- durationMs: number;
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
- createdAt: Date;
762
- tags: string[];
763
- depth: number;
764
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
765
- taskIdentifier: string;
766
- isQueued: boolean;
767
- isExecuting: boolean;
768
- isCompleted: boolean;
769
- isSuccess: boolean;
770
- isFailed: boolean;
771
- isCancelled: boolean;
772
- isTest: boolean;
773
- updatedAt: Date;
774
- costInCents: number;
775
- baseCostInCents: number;
776
- durationMs: number;
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
- createdAt: Date;
782
- tags: string[];
783
- depth: number;
784
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
785
- taskIdentifier: string;
786
- isQueued: boolean;
787
- isExecuting: boolean;
788
- isCompleted: boolean;
789
- isSuccess: boolean;
790
- isFailed: boolean;
791
- isCancelled: boolean;
792
- isTest: boolean;
793
- updatedAt: Date;
794
- costInCents: number;
795
- baseCostInCents: number;
796
- durationMs: number;
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
- createdAt: Date;
811
- tags: string[];
812
- depth: number;
813
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
814
- taskIdentifier: string;
815
- isQueued: boolean;
816
- isExecuting: boolean;
817
- isCompleted: boolean;
818
- isSuccess: boolean;
819
- isFailed: boolean;
820
- isCancelled: boolean;
821
- isTest: boolean;
822
- updatedAt: Date;
823
- costInCents: number;
824
- baseCostInCents: number;
825
- durationMs: number;
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
- createdAt: Date;
840
- tags: string[];
841
- depth: number;
842
- triggerFunction: "triggerAndWait" | "trigger" | "batchTriggerAndWait" | "batchTrigger";
843
- taskIdentifier: string;
844
- isQueued: boolean;
845
- isExecuting: boolean;
846
- isCompleted: boolean;
847
- isSuccess: boolean;
848
- isFailed: boolean;
849
- isCancelled: boolean;
850
- isTest: boolean;
851
- updatedAt: Date;
852
- costInCents: number;
853
- baseCostInCents: number;
854
- durationMs: number;
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 {};