@trigger.dev/sdk 2.1.6 → 2.1.8
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 +398 -10
- package/dist/index.js +244 -75
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
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,7 @@ 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[];
|
|
208
|
-
|
|
209
|
-
statuses?: {
|
|
557
|
+
statuses: {
|
|
210
558
|
label: string;
|
|
211
559
|
key: string;
|
|
212
560
|
history: {
|
|
@@ -216,7 +564,8 @@ declare class ApiClient {
|
|
|
216
564
|
}[];
|
|
217
565
|
data?: Record<string, _trigger_dev_core.SerializableJson> | undefined;
|
|
218
566
|
state?: "loading" | "success" | "failure" | undefined;
|
|
219
|
-
}[]
|
|
567
|
+
}[];
|
|
568
|
+
output?: any;
|
|
220
569
|
nextCursor?: string | undefined;
|
|
221
570
|
}>;
|
|
222
571
|
getRunStatuses(runId: string): Promise<{
|
|
@@ -248,6 +597,18 @@ declare class ApiClient {
|
|
|
248
597
|
nextCursor?: string | undefined;
|
|
249
598
|
}>;
|
|
250
599
|
}
|
|
600
|
+
type VersionedResponseBodyMap = {
|
|
601
|
+
[key: string]: z.ZodTypeAny;
|
|
602
|
+
};
|
|
603
|
+
type VersionedResponseBody<TVersions extends VersionedResponseBodyMap, TUnversioned extends z.ZodTypeAny> = {
|
|
604
|
+
[TVersion in keyof TVersions]: {
|
|
605
|
+
version: TVersion;
|
|
606
|
+
body: z.infer<TVersions[TVersion]>;
|
|
607
|
+
};
|
|
608
|
+
}[keyof TVersions] | {
|
|
609
|
+
version: "unversioned";
|
|
610
|
+
body: z.infer<TUnversioned>;
|
|
611
|
+
};
|
|
251
612
|
|
|
252
613
|
interface TriggerContext {
|
|
253
614
|
/** Job metadata */
|
|
@@ -788,7 +1149,7 @@ declare class TriggerClient {
|
|
|
788
1149
|
scopes?: string[] | undefined;
|
|
789
1150
|
additionalFields?: Record<string, string> | undefined;
|
|
790
1151
|
} | undefined>;
|
|
791
|
-
/** You can call this function from anywhere in your
|
|
1152
|
+
/** You can call this function from anywhere in your backend to send an event. The other way to send an event is by using [`io.sendEvent()`](https://trigger.dev/docs/sdk/io/sendevent) from inside a `run()` function.
|
|
792
1153
|
* @param event The event to send.
|
|
793
1154
|
* @param options Options for sending the event.
|
|
794
1155
|
* @returns A promise that resolves to the event details
|
|
@@ -874,8 +1235,7 @@ declare class TriggerClient {
|
|
|
874
1235
|
status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD";
|
|
875
1236
|
updatedAt: Date | null;
|
|
876
1237
|
tasks: _trigger_dev_core.RunTaskWithSubtasks[];
|
|
877
|
-
|
|
878
|
-
statuses?: {
|
|
1238
|
+
statuses: {
|
|
879
1239
|
label: string;
|
|
880
1240
|
key: string;
|
|
881
1241
|
history: {
|
|
@@ -885,7 +1245,8 @@ declare class TriggerClient {
|
|
|
885
1245
|
}[];
|
|
886
1246
|
data?: Record<string, _trigger_dev_core.SerializableJson> | undefined;
|
|
887
1247
|
state?: "loading" | "success" | "failure" | undefined;
|
|
888
|
-
}[]
|
|
1248
|
+
}[];
|
|
1249
|
+
output?: any;
|
|
889
1250
|
nextCursor?: string | undefined;
|
|
890
1251
|
}>;
|
|
891
1252
|
getRuns(jobSlug: string, options?: GetRunsOptions): Promise<{
|
|
@@ -948,6 +1309,10 @@ type IOOptions = {
|
|
|
948
1309
|
jobLogger?: Logger;
|
|
949
1310
|
jobLogLevel: LogLevel;
|
|
950
1311
|
cachedTasks?: Array<CachedTask>;
|
|
1312
|
+
cachedTasksCursor?: string;
|
|
1313
|
+
yieldedExecutions?: Array<string>;
|
|
1314
|
+
noopTasksSet?: string;
|
|
1315
|
+
serverVersion?: string | null;
|
|
951
1316
|
};
|
|
952
1317
|
type JsonPrimitive = string | number | boolean | null | undefined | Date | symbol;
|
|
953
1318
|
type JsonArray = Json[];
|
|
@@ -961,6 +1326,15 @@ type RunTaskErrorCallback = (error: unknown, task: IOTask, io: IO) => {
|
|
|
961
1326
|
jitter?: number;
|
|
962
1327
|
skipRetrying?: boolean;
|
|
963
1328
|
} | Error | undefined | void;
|
|
1329
|
+
type IOStats = {
|
|
1330
|
+
initialCachedTasks: number;
|
|
1331
|
+
lazyLoadedCachedTasks: number;
|
|
1332
|
+
executedTasks: number;
|
|
1333
|
+
cachedTaskHits: number;
|
|
1334
|
+
cachedTaskMisses: number;
|
|
1335
|
+
noopCachedTaskHits: number;
|
|
1336
|
+
noopCachedTaskMisses: number;
|
|
1337
|
+
};
|
|
964
1338
|
declare class IO {
|
|
965
1339
|
#private;
|
|
966
1340
|
private _id;
|
|
@@ -971,7 +1345,13 @@ declare class IO {
|
|
|
971
1345
|
private _jobLogLevel;
|
|
972
1346
|
private _cachedTasks;
|
|
973
1347
|
private _taskStorage;
|
|
1348
|
+
private _cachedTasksCursor?;
|
|
974
1349
|
private _context;
|
|
1350
|
+
private _yieldedExecutions;
|
|
1351
|
+
private _noopTasksBloomFilter;
|
|
1352
|
+
private _stats;
|
|
1353
|
+
private _serverVersion;
|
|
1354
|
+
get stats(): IOStats;
|
|
975
1355
|
constructor(options: IOOptions);
|
|
976
1356
|
/** Used to send log messages to the [Run log](https://trigger.dev/docs/documentation/guides/viewing-runs). */
|
|
977
1357
|
get logger(): IOLogger;
|
|
@@ -1175,6 +1555,14 @@ declare class IO {
|
|
|
1175
1555
|
* @returns A Promise that resolves with the returned value of the callback.
|
|
1176
1556
|
*/
|
|
1177
1557
|
runTask<T extends Json<T> | void>(key: string | any[], callback: (task: ServerTask, io: IO) => Promise<T>, options?: RunTaskOptions, onError?: RunTaskErrorCallback): Promise<T>;
|
|
1558
|
+
/**
|
|
1559
|
+
* `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.
|
|
1560
|
+
*/
|
|
1561
|
+
yield(key: string): void;
|
|
1562
|
+
/**
|
|
1563
|
+
* `io.brb()` is an alias of `io.yield()`
|
|
1564
|
+
*/
|
|
1565
|
+
brb: (key: string) => void;
|
|
1178
1566
|
/** `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
1567
|
* 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
1568
|
* @param tryCallback The code you wish to run
|
|
@@ -1465,4 +1853,4 @@ type Task = ServerTask;
|
|
|
1465
1853
|
type SentEvent = ApiEventLog;
|
|
1466
1854
|
declare function redactString(strings: TemplateStringsArray, ...interpolations: string[]): RedactString;
|
|
1467
1855
|
|
|
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 };
|
|
1856
|
+
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 };
|