@trigger.dev/sdk 2.1.7 → 2.1.9
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 +437 -7
- package/dist/index.js +260 -75
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import * as _trigger_dev_core from '@trigger.dev/core';
|
|
|
2
2
|
import { RunTaskBodyInput, CompleteTaskBodyInput, FailTaskBodyInput, SendEvent, SendEventOptions, StatusUpdate, UpdateTriggerSourceBodyV2, TriggerSource, RegisterTriggerBodyV2, RegisterSourceEventV2, ScheduleMetadata, GetRunOptionsWithTaskDetails, GetRunsOptions, LogLevel, RuntimeEnvironmentType, DisplayProperty, TriggerMetadata, EventFilter, Prettify, HandleTriggerSource, Logger, RegisterTriggerSource, SerializableJson, ConnectionAuth, NormalizedResponse, HttpSourceResponseMetadata, IntervalOptions, CronOptions, ScheduledPayload, DeserializedJson, ServerTask, CachedTask, InitialStatusUpdate, FetchRequestInit, FetchRetryOptions, RunTaskOptions, IntegrationMetadata, QueueOptions, IntegrationConfig, JobMetadata, MissingConnectionNotificationPayload, MissingConnectionResolvedNotificationPayload, ErrorWithStack, ApiEventLog, RedactString } from '@trigger.dev/core';
|
|
3
3
|
export { ConnectionAuth, DisplayProperty, EventFilter, Logger, NormalizedRequest, OverridableRunTaskOptions, Prettify, RedactString, RegisteredOptionsDiff, RunTaskOptions, SourceEventOption } from '@trigger.dev/core';
|
|
4
4
|
import * as zod from 'zod';
|
|
5
|
+
import { z } from 'zod';
|
|
5
6
|
|
|
6
7
|
type ApiClientOptions = {
|
|
7
8
|
apiKey?: string;
|
|
@@ -20,7 +21,320 @@ declare class ApiClient {
|
|
|
20
21
|
url: string;
|
|
21
22
|
name: string;
|
|
22
23
|
}): Promise<EndpointRecord>;
|
|
23
|
-
runTask(runId: string, task: RunTaskBodyInput
|
|
24
|
+
runTask(runId: string, task: RunTaskBodyInput, options?: {
|
|
25
|
+
cachedTasksCursor?: string;
|
|
26
|
+
}): Promise<VersionedResponseBody<{
|
|
27
|
+
"2023-09-29": z.ZodObject<{
|
|
28
|
+
task: z.ZodObject<{
|
|
29
|
+
id: z.ZodString;
|
|
30
|
+
name: z.ZodString;
|
|
31
|
+
icon: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
32
|
+
noop: z.ZodBoolean;
|
|
33
|
+
startedAt: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
|
|
34
|
+
completedAt: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
|
|
35
|
+
delayUntil: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
|
|
36
|
+
status: z.ZodEnum<["PENDING", "WAITING", "RUNNING", "COMPLETED", "ERRORED", "CANCELED"]>;
|
|
37
|
+
description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
38
|
+
params: z.ZodNullable<z.ZodOptional<z.ZodType<_trigger_dev_core.DeserializedJson, z.ZodTypeDef, _trigger_dev_core.DeserializedJson>>>;
|
|
39
|
+
properties: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
40
|
+
label: z.ZodString;
|
|
41
|
+
text: z.ZodString;
|
|
42
|
+
url: z.ZodOptional<z.ZodString>;
|
|
43
|
+
}, "strip", z.ZodTypeAny, {
|
|
44
|
+
label: string;
|
|
45
|
+
text: string;
|
|
46
|
+
url?: string | undefined;
|
|
47
|
+
}, {
|
|
48
|
+
label: string;
|
|
49
|
+
text: string;
|
|
50
|
+
url?: string | undefined;
|
|
51
|
+
}>, "many">>>;
|
|
52
|
+
outputProperties: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
53
|
+
label: z.ZodString;
|
|
54
|
+
text: z.ZodString;
|
|
55
|
+
url: z.ZodOptional<z.ZodString>;
|
|
56
|
+
}, "strip", z.ZodTypeAny, {
|
|
57
|
+
label: string;
|
|
58
|
+
text: string;
|
|
59
|
+
url?: string | undefined;
|
|
60
|
+
}, {
|
|
61
|
+
label: string;
|
|
62
|
+
text: string;
|
|
63
|
+
url?: string | undefined;
|
|
64
|
+
}>, "many">>>;
|
|
65
|
+
output: z.ZodNullable<z.ZodOptional<z.ZodType<_trigger_dev_core.DeserializedJson, z.ZodTypeDef, _trigger_dev_core.DeserializedJson>>>;
|
|
66
|
+
error: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
67
|
+
parentId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
68
|
+
style: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
69
|
+
style: z.ZodEnum<["normal", "minimal"]>;
|
|
70
|
+
variant: z.ZodOptional<z.ZodString>;
|
|
71
|
+
}, "strip", z.ZodTypeAny, {
|
|
72
|
+
style: "normal" | "minimal";
|
|
73
|
+
variant?: string | undefined;
|
|
74
|
+
}, {
|
|
75
|
+
style: "normal" | "minimal";
|
|
76
|
+
variant?: string | undefined;
|
|
77
|
+
}>>>;
|
|
78
|
+
operation: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
79
|
+
callbackUrl: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
80
|
+
idempotencyKey: z.ZodString;
|
|
81
|
+
attempts: z.ZodNumber;
|
|
82
|
+
}, "strip", z.ZodTypeAny, {
|
|
83
|
+
id: string;
|
|
84
|
+
name: string;
|
|
85
|
+
noop: boolean;
|
|
86
|
+
status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED" | "CANCELED";
|
|
87
|
+
idempotencyKey: string;
|
|
88
|
+
attempts: number;
|
|
89
|
+
icon?: string | null | undefined;
|
|
90
|
+
startedAt?: Date | null | undefined;
|
|
91
|
+
completedAt?: Date | null | undefined;
|
|
92
|
+
delayUntil?: Date | null | undefined;
|
|
93
|
+
description?: string | null | undefined;
|
|
94
|
+
params?: _trigger_dev_core.DeserializedJson | undefined;
|
|
95
|
+
properties?: {
|
|
96
|
+
label: string;
|
|
97
|
+
text: string;
|
|
98
|
+
url?: string | undefined;
|
|
99
|
+
}[] | null | undefined;
|
|
100
|
+
outputProperties?: {
|
|
101
|
+
label: string;
|
|
102
|
+
text: string;
|
|
103
|
+
url?: string | undefined;
|
|
104
|
+
}[] | null | undefined;
|
|
105
|
+
output?: _trigger_dev_core.DeserializedJson | undefined;
|
|
106
|
+
error?: string | null | undefined;
|
|
107
|
+
parentId?: string | null | undefined;
|
|
108
|
+
style?: {
|
|
109
|
+
style: "normal" | "minimal";
|
|
110
|
+
variant?: string | undefined;
|
|
111
|
+
} | null | undefined;
|
|
112
|
+
operation?: string | null | undefined;
|
|
113
|
+
callbackUrl?: string | null | undefined;
|
|
114
|
+
}, {
|
|
115
|
+
id: string;
|
|
116
|
+
name: string;
|
|
117
|
+
noop: boolean;
|
|
118
|
+
status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED" | "CANCELED";
|
|
119
|
+
idempotencyKey: string;
|
|
120
|
+
attempts: number;
|
|
121
|
+
icon?: string | null | undefined;
|
|
122
|
+
startedAt?: Date | null | undefined;
|
|
123
|
+
completedAt?: Date | null | undefined;
|
|
124
|
+
delayUntil?: Date | null | undefined;
|
|
125
|
+
description?: string | null | undefined;
|
|
126
|
+
params?: _trigger_dev_core.DeserializedJson | undefined;
|
|
127
|
+
properties?: {
|
|
128
|
+
label: string;
|
|
129
|
+
text: string;
|
|
130
|
+
url?: string | undefined;
|
|
131
|
+
}[] | null | undefined;
|
|
132
|
+
outputProperties?: {
|
|
133
|
+
label: string;
|
|
134
|
+
text: string;
|
|
135
|
+
url?: string | undefined;
|
|
136
|
+
}[] | null | undefined;
|
|
137
|
+
output?: _trigger_dev_core.DeserializedJson | undefined;
|
|
138
|
+
error?: string | null | undefined;
|
|
139
|
+
parentId?: string | null | undefined;
|
|
140
|
+
style?: {
|
|
141
|
+
style: "normal" | "minimal";
|
|
142
|
+
variant?: string | undefined;
|
|
143
|
+
} | null | undefined;
|
|
144
|
+
operation?: string | null | undefined;
|
|
145
|
+
callbackUrl?: string | null | undefined;
|
|
146
|
+
}>;
|
|
147
|
+
cachedTasks: z.ZodOptional<z.ZodObject<{
|
|
148
|
+
tasks: z.ZodArray<z.ZodObject<{
|
|
149
|
+
id: z.ZodString;
|
|
150
|
+
idempotencyKey: z.ZodString;
|
|
151
|
+
status: z.ZodEnum<["PENDING", "WAITING", "RUNNING", "COMPLETED", "ERRORED", "CANCELED"]>;
|
|
152
|
+
noop: z.ZodDefault<z.ZodBoolean>;
|
|
153
|
+
output: z.ZodNullable<z.ZodOptional<z.ZodType<_trigger_dev_core.DeserializedJson, z.ZodTypeDef, _trigger_dev_core.DeserializedJson>>>;
|
|
154
|
+
parentId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
155
|
+
}, "strip", z.ZodTypeAny, {
|
|
156
|
+
id: string;
|
|
157
|
+
noop: boolean;
|
|
158
|
+
status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED" | "CANCELED";
|
|
159
|
+
idempotencyKey: string;
|
|
160
|
+
output?: _trigger_dev_core.DeserializedJson | undefined;
|
|
161
|
+
parentId?: string | null | undefined;
|
|
162
|
+
}, {
|
|
163
|
+
id: string;
|
|
164
|
+
status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED" | "CANCELED";
|
|
165
|
+
idempotencyKey: string;
|
|
166
|
+
noop?: boolean | undefined;
|
|
167
|
+
output?: _trigger_dev_core.DeserializedJson | undefined;
|
|
168
|
+
parentId?: string | null | undefined;
|
|
169
|
+
}>, "many">;
|
|
170
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
171
|
+
}, "strip", z.ZodTypeAny, {
|
|
172
|
+
tasks: {
|
|
173
|
+
id: string;
|
|
174
|
+
noop: boolean;
|
|
175
|
+
status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED" | "CANCELED";
|
|
176
|
+
idempotencyKey: string;
|
|
177
|
+
output?: _trigger_dev_core.DeserializedJson | undefined;
|
|
178
|
+
parentId?: string | null | undefined;
|
|
179
|
+
}[];
|
|
180
|
+
cursor?: string | undefined;
|
|
181
|
+
}, {
|
|
182
|
+
tasks: {
|
|
183
|
+
id: string;
|
|
184
|
+
status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED" | "CANCELED";
|
|
185
|
+
idempotencyKey: string;
|
|
186
|
+
noop?: boolean | undefined;
|
|
187
|
+
output?: _trigger_dev_core.DeserializedJson | undefined;
|
|
188
|
+
parentId?: string | null | undefined;
|
|
189
|
+
}[];
|
|
190
|
+
cursor?: string | undefined;
|
|
191
|
+
}>>;
|
|
192
|
+
}, "strip", z.ZodTypeAny, {
|
|
193
|
+
task: {
|
|
194
|
+
id: string;
|
|
195
|
+
name: string;
|
|
196
|
+
noop: boolean;
|
|
197
|
+
status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED" | "CANCELED";
|
|
198
|
+
idempotencyKey: string;
|
|
199
|
+
attempts: number;
|
|
200
|
+
icon?: string | null | undefined;
|
|
201
|
+
startedAt?: Date | null | undefined;
|
|
202
|
+
completedAt?: Date | null | undefined;
|
|
203
|
+
delayUntil?: Date | null | undefined;
|
|
204
|
+
description?: string | null | undefined;
|
|
205
|
+
params?: _trigger_dev_core.DeserializedJson | undefined;
|
|
206
|
+
properties?: {
|
|
207
|
+
label: string;
|
|
208
|
+
text: string;
|
|
209
|
+
url?: string | undefined;
|
|
210
|
+
}[] | null | undefined;
|
|
211
|
+
outputProperties?: {
|
|
212
|
+
label: string;
|
|
213
|
+
text: string;
|
|
214
|
+
url?: string | undefined;
|
|
215
|
+
}[] | null | undefined;
|
|
216
|
+
output?: _trigger_dev_core.DeserializedJson | undefined;
|
|
217
|
+
error?: string | null | undefined;
|
|
218
|
+
parentId?: string | null | undefined;
|
|
219
|
+
style?: {
|
|
220
|
+
style: "normal" | "minimal";
|
|
221
|
+
variant?: string | undefined;
|
|
222
|
+
} | null | undefined;
|
|
223
|
+
operation?: string | null | undefined;
|
|
224
|
+
callbackUrl?: string | null | undefined;
|
|
225
|
+
};
|
|
226
|
+
cachedTasks?: {
|
|
227
|
+
tasks: {
|
|
228
|
+
id: string;
|
|
229
|
+
noop: boolean;
|
|
230
|
+
status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED" | "CANCELED";
|
|
231
|
+
idempotencyKey: string;
|
|
232
|
+
output?: _trigger_dev_core.DeserializedJson | undefined;
|
|
233
|
+
parentId?: string | null | undefined;
|
|
234
|
+
}[];
|
|
235
|
+
cursor?: string | undefined;
|
|
236
|
+
} | undefined;
|
|
237
|
+
}, {
|
|
238
|
+
task: {
|
|
239
|
+
id: string;
|
|
240
|
+
name: string;
|
|
241
|
+
noop: boolean;
|
|
242
|
+
status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED" | "CANCELED";
|
|
243
|
+
idempotencyKey: string;
|
|
244
|
+
attempts: number;
|
|
245
|
+
icon?: string | null | undefined;
|
|
246
|
+
startedAt?: Date | null | undefined;
|
|
247
|
+
completedAt?: Date | null | undefined;
|
|
248
|
+
delayUntil?: Date | null | undefined;
|
|
249
|
+
description?: string | null | undefined;
|
|
250
|
+
params?: _trigger_dev_core.DeserializedJson | undefined;
|
|
251
|
+
properties?: {
|
|
252
|
+
label: string;
|
|
253
|
+
text: string;
|
|
254
|
+
url?: string | undefined;
|
|
255
|
+
}[] | null | undefined;
|
|
256
|
+
outputProperties?: {
|
|
257
|
+
label: string;
|
|
258
|
+
text: string;
|
|
259
|
+
url?: string | undefined;
|
|
260
|
+
}[] | null | undefined;
|
|
261
|
+
output?: _trigger_dev_core.DeserializedJson | undefined;
|
|
262
|
+
error?: string | null | undefined;
|
|
263
|
+
parentId?: string | null | undefined;
|
|
264
|
+
style?: {
|
|
265
|
+
style: "normal" | "minimal";
|
|
266
|
+
variant?: string | undefined;
|
|
267
|
+
} | null | undefined;
|
|
268
|
+
operation?: string | null | undefined;
|
|
269
|
+
callbackUrl?: string | null | undefined;
|
|
270
|
+
};
|
|
271
|
+
cachedTasks?: {
|
|
272
|
+
tasks: {
|
|
273
|
+
id: string;
|
|
274
|
+
status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED" | "CANCELED";
|
|
275
|
+
idempotencyKey: string;
|
|
276
|
+
noop?: boolean | undefined;
|
|
277
|
+
output?: _trigger_dev_core.DeserializedJson | undefined;
|
|
278
|
+
parentId?: string | null | undefined;
|
|
279
|
+
}[];
|
|
280
|
+
cursor?: string | undefined;
|
|
281
|
+
} | undefined;
|
|
282
|
+
}>;
|
|
283
|
+
}, z.ZodObject<{
|
|
284
|
+
id: z.ZodString;
|
|
285
|
+
name: z.ZodString;
|
|
286
|
+
icon: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
287
|
+
noop: z.ZodBoolean;
|
|
288
|
+
startedAt: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
|
|
289
|
+
completedAt: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
|
|
290
|
+
delayUntil: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
|
|
291
|
+
status: z.ZodEnum<["PENDING", "WAITING", "RUNNING", "COMPLETED", "ERRORED", "CANCELED"]>;
|
|
292
|
+
description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
293
|
+
params: z.ZodNullable<z.ZodOptional<z.ZodType<_trigger_dev_core.DeserializedJson, z.ZodTypeDef, _trigger_dev_core.DeserializedJson>>>;
|
|
294
|
+
properties: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
295
|
+
label: z.ZodString;
|
|
296
|
+
text: z.ZodString;
|
|
297
|
+
url: z.ZodOptional<z.ZodString>;
|
|
298
|
+
}, "strip", z.ZodTypeAny, {
|
|
299
|
+
label: string;
|
|
300
|
+
text: string;
|
|
301
|
+
url?: string | undefined;
|
|
302
|
+
}, {
|
|
303
|
+
label: string;
|
|
304
|
+
text: string;
|
|
305
|
+
url?: string | undefined;
|
|
306
|
+
}>, "many">>>;
|
|
307
|
+
outputProperties: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
308
|
+
label: z.ZodString;
|
|
309
|
+
text: z.ZodString;
|
|
310
|
+
url: z.ZodOptional<z.ZodString>;
|
|
311
|
+
}, "strip", z.ZodTypeAny, {
|
|
312
|
+
label: string;
|
|
313
|
+
text: string;
|
|
314
|
+
url?: string | undefined;
|
|
315
|
+
}, {
|
|
316
|
+
label: string;
|
|
317
|
+
text: string;
|
|
318
|
+
url?: string | undefined;
|
|
319
|
+
}>, "many">>>;
|
|
320
|
+
output: z.ZodNullable<z.ZodOptional<z.ZodType<_trigger_dev_core.DeserializedJson, z.ZodTypeDef, _trigger_dev_core.DeserializedJson>>>;
|
|
321
|
+
error: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
322
|
+
parentId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
323
|
+
style: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
324
|
+
style: z.ZodEnum<["normal", "minimal"]>;
|
|
325
|
+
variant: z.ZodOptional<z.ZodString>;
|
|
326
|
+
}, "strip", z.ZodTypeAny, {
|
|
327
|
+
style: "normal" | "minimal";
|
|
328
|
+
variant?: string | undefined;
|
|
329
|
+
}, {
|
|
330
|
+
style: "normal" | "minimal";
|
|
331
|
+
variant?: string | undefined;
|
|
332
|
+
}>>>;
|
|
333
|
+
operation: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
334
|
+
callbackUrl: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
335
|
+
idempotencyKey: z.ZodString;
|
|
336
|
+
attempts: z.ZodNumber;
|
|
337
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
338
|
id: string;
|
|
25
339
|
name: string;
|
|
26
340
|
noop: boolean;
|
|
@@ -51,7 +365,40 @@ declare class ApiClient {
|
|
|
51
365
|
variant?: string | undefined;
|
|
52
366
|
} | null | undefined;
|
|
53
367
|
operation?: string | null | undefined;
|
|
54
|
-
|
|
368
|
+
callbackUrl?: string | null | undefined;
|
|
369
|
+
}, {
|
|
370
|
+
id: string;
|
|
371
|
+
name: string;
|
|
372
|
+
noop: boolean;
|
|
373
|
+
status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED" | "CANCELED";
|
|
374
|
+
idempotencyKey: string;
|
|
375
|
+
attempts: number;
|
|
376
|
+
icon?: string | null | undefined;
|
|
377
|
+
startedAt?: Date | null | undefined;
|
|
378
|
+
completedAt?: Date | null | undefined;
|
|
379
|
+
delayUntil?: Date | null | undefined;
|
|
380
|
+
description?: string | null | undefined;
|
|
381
|
+
params?: _trigger_dev_core.DeserializedJson | undefined;
|
|
382
|
+
properties?: {
|
|
383
|
+
label: string;
|
|
384
|
+
text: string;
|
|
385
|
+
url?: string | undefined;
|
|
386
|
+
}[] | null | undefined;
|
|
387
|
+
outputProperties?: {
|
|
388
|
+
label: string;
|
|
389
|
+
text: string;
|
|
390
|
+
url?: string | undefined;
|
|
391
|
+
}[] | null | undefined;
|
|
392
|
+
output?: _trigger_dev_core.DeserializedJson | undefined;
|
|
393
|
+
error?: string | null | undefined;
|
|
394
|
+
parentId?: string | null | undefined;
|
|
395
|
+
style?: {
|
|
396
|
+
style: "normal" | "minimal";
|
|
397
|
+
variant?: string | undefined;
|
|
398
|
+
} | null | undefined;
|
|
399
|
+
operation?: string | null | undefined;
|
|
400
|
+
callbackUrl?: string | null | undefined;
|
|
401
|
+
}>>>;
|
|
55
402
|
completeTask(runId: string, id: string, task: CompleteTaskBodyInput): Promise<{
|
|
56
403
|
id: string;
|
|
57
404
|
name: string;
|
|
@@ -83,6 +430,7 @@ declare class ApiClient {
|
|
|
83
430
|
variant?: string | undefined;
|
|
84
431
|
} | null | undefined;
|
|
85
432
|
operation?: string | null | undefined;
|
|
433
|
+
callbackUrl?: string | null | undefined;
|
|
86
434
|
}>;
|
|
87
435
|
failTask(runId: string, id: string, body: FailTaskBodyInput): Promise<{
|
|
88
436
|
id: string;
|
|
@@ -115,6 +463,7 @@ declare class ApiClient {
|
|
|
115
463
|
variant?: string | undefined;
|
|
116
464
|
} | null | undefined;
|
|
117
465
|
operation?: string | null | undefined;
|
|
466
|
+
callbackUrl?: string | null | undefined;
|
|
118
467
|
}>;
|
|
119
468
|
sendEvent(event: SendEvent, options?: SendEventOptions): Promise<{
|
|
120
469
|
id: string;
|
|
@@ -205,8 +554,28 @@ declare class ApiClient {
|
|
|
205
554
|
status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD";
|
|
206
555
|
updatedAt: Date | null;
|
|
207
556
|
tasks: _trigger_dev_core.RunTaskWithSubtasks[];
|
|
557
|
+
statuses: {
|
|
558
|
+
label: string;
|
|
559
|
+
key: string;
|
|
560
|
+
history: {
|
|
561
|
+
label?: string | undefined;
|
|
562
|
+
state?: "loading" | "success" | "failure" | undefined;
|
|
563
|
+
data?: Record<string, _trigger_dev_core.SerializableJson> | undefined;
|
|
564
|
+
}[];
|
|
565
|
+
data?: Record<string, _trigger_dev_core.SerializableJson> | undefined;
|
|
566
|
+
state?: "loading" | "success" | "failure" | undefined;
|
|
567
|
+
}[];
|
|
208
568
|
output?: any;
|
|
209
|
-
|
|
569
|
+
nextCursor?: string | undefined;
|
|
570
|
+
}>;
|
|
571
|
+
cancelRun(runId: string): Promise<{
|
|
572
|
+
id: string;
|
|
573
|
+
startedAt: Date | null;
|
|
574
|
+
completedAt: Date | null;
|
|
575
|
+
status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD";
|
|
576
|
+
updatedAt: Date | null;
|
|
577
|
+
tasks: _trigger_dev_core.RunTaskWithSubtasks[];
|
|
578
|
+
statuses: {
|
|
210
579
|
label: string;
|
|
211
580
|
key: string;
|
|
212
581
|
history: {
|
|
@@ -216,7 +585,8 @@ declare class ApiClient {
|
|
|
216
585
|
}[];
|
|
217
586
|
data?: Record<string, _trigger_dev_core.SerializableJson> | undefined;
|
|
218
587
|
state?: "loading" | "success" | "failure" | undefined;
|
|
219
|
-
}[]
|
|
588
|
+
}[];
|
|
589
|
+
output?: any;
|
|
220
590
|
nextCursor?: string | undefined;
|
|
221
591
|
}>;
|
|
222
592
|
getRunStatuses(runId: string): Promise<{
|
|
@@ -248,6 +618,18 @@ declare class ApiClient {
|
|
|
248
618
|
nextCursor?: string | undefined;
|
|
249
619
|
}>;
|
|
250
620
|
}
|
|
621
|
+
type VersionedResponseBodyMap = {
|
|
622
|
+
[key: string]: z.ZodTypeAny;
|
|
623
|
+
};
|
|
624
|
+
type VersionedResponseBody<TVersions extends VersionedResponseBodyMap, TUnversioned extends z.ZodTypeAny> = {
|
|
625
|
+
[TVersion in keyof TVersions]: {
|
|
626
|
+
version: TVersion;
|
|
627
|
+
body: z.infer<TVersions[TVersion]>;
|
|
628
|
+
};
|
|
629
|
+
}[keyof TVersions] | {
|
|
630
|
+
version: "unversioned";
|
|
631
|
+
body: z.infer<TUnversioned>;
|
|
632
|
+
};
|
|
251
633
|
|
|
252
634
|
interface TriggerContext {
|
|
253
635
|
/** Job metadata */
|
|
@@ -874,8 +1256,28 @@ declare class TriggerClient {
|
|
|
874
1256
|
status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD";
|
|
875
1257
|
updatedAt: Date | null;
|
|
876
1258
|
tasks: _trigger_dev_core.RunTaskWithSubtasks[];
|
|
1259
|
+
statuses: {
|
|
1260
|
+
label: string;
|
|
1261
|
+
key: string;
|
|
1262
|
+
history: {
|
|
1263
|
+
label?: string | undefined;
|
|
1264
|
+
state?: "loading" | "success" | "failure" | undefined;
|
|
1265
|
+
data?: Record<string, _trigger_dev_core.SerializableJson> | undefined;
|
|
1266
|
+
}[];
|
|
1267
|
+
data?: Record<string, _trigger_dev_core.SerializableJson> | undefined;
|
|
1268
|
+
state?: "loading" | "success" | "failure" | undefined;
|
|
1269
|
+
}[];
|
|
877
1270
|
output?: any;
|
|
878
|
-
|
|
1271
|
+
nextCursor?: string | undefined;
|
|
1272
|
+
}>;
|
|
1273
|
+
cancelRun(runId: string): Promise<{
|
|
1274
|
+
id: string;
|
|
1275
|
+
startedAt: Date | null;
|
|
1276
|
+
completedAt: Date | null;
|
|
1277
|
+
status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD";
|
|
1278
|
+
updatedAt: Date | null;
|
|
1279
|
+
tasks: _trigger_dev_core.RunTaskWithSubtasks[];
|
|
1280
|
+
statuses: {
|
|
879
1281
|
label: string;
|
|
880
1282
|
key: string;
|
|
881
1283
|
history: {
|
|
@@ -885,7 +1287,8 @@ declare class TriggerClient {
|
|
|
885
1287
|
}[];
|
|
886
1288
|
data?: Record<string, _trigger_dev_core.SerializableJson> | undefined;
|
|
887
1289
|
state?: "loading" | "success" | "failure" | undefined;
|
|
888
|
-
}[]
|
|
1290
|
+
}[];
|
|
1291
|
+
output?: any;
|
|
889
1292
|
nextCursor?: string | undefined;
|
|
890
1293
|
}>;
|
|
891
1294
|
getRuns(jobSlug: string, options?: GetRunsOptions): Promise<{
|
|
@@ -948,6 +1351,10 @@ type IOOptions = {
|
|
|
948
1351
|
jobLogger?: Logger;
|
|
949
1352
|
jobLogLevel: LogLevel;
|
|
950
1353
|
cachedTasks?: Array<CachedTask>;
|
|
1354
|
+
cachedTasksCursor?: string;
|
|
1355
|
+
yieldedExecutions?: Array<string>;
|
|
1356
|
+
noopTasksSet?: string;
|
|
1357
|
+
serverVersion?: string | null;
|
|
951
1358
|
};
|
|
952
1359
|
type JsonPrimitive = string | number | boolean | null | undefined | Date | symbol;
|
|
953
1360
|
type JsonArray = Json[];
|
|
@@ -961,6 +1368,15 @@ type RunTaskErrorCallback = (error: unknown, task: IOTask, io: IO) => {
|
|
|
961
1368
|
jitter?: number;
|
|
962
1369
|
skipRetrying?: boolean;
|
|
963
1370
|
} | Error | undefined | void;
|
|
1371
|
+
type IOStats = {
|
|
1372
|
+
initialCachedTasks: number;
|
|
1373
|
+
lazyLoadedCachedTasks: number;
|
|
1374
|
+
executedTasks: number;
|
|
1375
|
+
cachedTaskHits: number;
|
|
1376
|
+
cachedTaskMisses: number;
|
|
1377
|
+
noopCachedTaskHits: number;
|
|
1378
|
+
noopCachedTaskMisses: number;
|
|
1379
|
+
};
|
|
964
1380
|
declare class IO {
|
|
965
1381
|
#private;
|
|
966
1382
|
private _id;
|
|
@@ -971,7 +1387,13 @@ declare class IO {
|
|
|
971
1387
|
private _jobLogLevel;
|
|
972
1388
|
private _cachedTasks;
|
|
973
1389
|
private _taskStorage;
|
|
1390
|
+
private _cachedTasksCursor?;
|
|
974
1391
|
private _context;
|
|
1392
|
+
private _yieldedExecutions;
|
|
1393
|
+
private _noopTasksBloomFilter;
|
|
1394
|
+
private _stats;
|
|
1395
|
+
private _serverVersion;
|
|
1396
|
+
get stats(): IOStats;
|
|
975
1397
|
constructor(options: IOOptions);
|
|
976
1398
|
/** Used to send log messages to the [Run log](https://trigger.dev/docs/documentation/guides/viewing-runs). */
|
|
977
1399
|
get logger(): IOLogger;
|
|
@@ -1175,6 +1597,14 @@ declare class IO {
|
|
|
1175
1597
|
* @returns A Promise that resolves with the returned value of the callback.
|
|
1176
1598
|
*/
|
|
1177
1599
|
runTask<T extends Json<T> | void>(key: string | any[], callback: (task: ServerTask, io: IO) => Promise<T>, options?: RunTaskOptions, onError?: RunTaskErrorCallback): Promise<T>;
|
|
1600
|
+
/**
|
|
1601
|
+
* `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.
|
|
1602
|
+
*/
|
|
1603
|
+
yield(key: string): void;
|
|
1604
|
+
/**
|
|
1605
|
+
* `io.brb()` is an alias of `io.yield()`
|
|
1606
|
+
*/
|
|
1607
|
+
brb: (key: string) => void;
|
|
1178
1608
|
/** `io.try()` allows you to run Tasks and catch any errors that are thrown, it's similar to a normal `try/catch` block but works with [io.runTask()](/sdk/io/runtask).
|
|
1179
1609
|
* A regular `try/catch` block on its own won't work as expected with Tasks. Internally `runTask()` throws some special errors to control flow execution. This is necessary to deal with resumability, serverless timeouts, and retrying Tasks.
|
|
1180
1610
|
* @param tryCallback The code you wish to run
|
|
@@ -1465,4 +1895,4 @@ type Task = ServerTask;
|
|
|
1465
1895
|
type SentEvent = ApiEventLog;
|
|
1466
1896
|
declare function redactString(strings: TemplateStringsArray, ...interpolations: string[]): RedactString;
|
|
1467
1897
|
|
|
1468
|
-
export { AuthResolverResult, CronTrigger, DynamicIntervalOptions, DynamicSchedule, DynamicTrigger, DynamicTriggerOptions, EventSpecification, EventSpecificationExample, EventTrigger, EventTypeFromSpecification, ExternalSource, ExternalSourceParams, ExternalSourceTrigger, ExternalSourceTriggerOptions, HandlerEvent, HttpSourceEvent, IO, IOLogger, IOOptions, IOTask, IOWithIntegrations, IntegrationTaskKey, IntervalTrigger, Job, JobIO, JobOptions, JobPayload, Json, MissingConnectionNotification, MissingConnectionResolvedNotification, PreprocessResults, RunTaskErrorCallback, SchemaParser, SchemaParserIssue, SchemaParserResult, SentEvent, Task, TaskLogger, Trigger, TriggerAuthResolver, TriggerClient, TriggerClientOptions, TriggerContext, TriggerEventType, TriggerIntegration, TriggerOptionRecord, TriggerPayload, TriggerPreprocessContext, cronTrigger, eventTrigger, intervalTrigger, isTriggerError, missingConnectionNotification, missingConnectionResolvedNotification, omit, redactString, retry };
|
|
1898
|
+
export { AuthResolverResult, CronTrigger, DynamicIntervalOptions, DynamicSchedule, DynamicTrigger, DynamicTriggerOptions, EventSpecification, EventSpecificationExample, EventTrigger, EventTypeFromSpecification, ExternalSource, ExternalSourceParams, ExternalSourceTrigger, ExternalSourceTriggerOptions, HandlerEvent, HttpSourceEvent, IO, IOLogger, IOOptions, IOStats, IOTask, IOWithIntegrations, IntegrationTaskKey, IntervalTrigger, Job, JobIO, JobOptions, JobPayload, Json, MissingConnectionNotification, MissingConnectionResolvedNotification, PreprocessResults, RunTaskErrorCallback, SchemaParser, SchemaParserIssue, SchemaParserResult, SentEvent, Task, TaskLogger, Trigger, TriggerAuthResolver, TriggerClient, TriggerClientOptions, TriggerContext, TriggerEventType, TriggerIntegration, TriggerOptionRecord, TriggerPayload, TriggerPreprocessContext, cronTrigger, eventTrigger, intervalTrigger, isTriggerError, missingConnectionNotification, missingConnectionResolvedNotification, omit, redactString, retry };
|