@trigger.dev/core 2.2.4 → 2.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +7125 -386
- package/dist/index.js +827 -453
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -46,11 +46,13 @@ __export(src_exports, {
|
|
|
46
46
|
API_VERSIONS: () => API_VERSIONS,
|
|
47
47
|
ApiEventLogSchema: () => ApiEventLogSchema,
|
|
48
48
|
AutoYieldConfigSchema: () => AutoYieldConfigSchema,
|
|
49
|
+
AutoYieldMetadataSchema: () => AutoYieldMetadataSchema,
|
|
49
50
|
CachedTaskSchema: () => CachedTaskSchema,
|
|
50
51
|
CancelRunsForEventSchema: () => CancelRunsForEventSchema,
|
|
51
52
|
CommonMissingConnectionNotificationPayloadSchema: () => CommonMissingConnectionNotificationPayloadSchema,
|
|
52
53
|
CommonMissingConnectionNotificationResolvedPayloadSchema: () => CommonMissingConnectionNotificationResolvedPayloadSchema,
|
|
53
54
|
CompleteTaskBodyInputSchema: () => CompleteTaskBodyInputSchema,
|
|
55
|
+
CompleteTaskBodyV2InputSchema: () => CompleteTaskBodyV2InputSchema,
|
|
54
56
|
ConnectionAuthSchema: () => ConnectionAuthSchema,
|
|
55
57
|
CreateExternalConnectionBodySchema: () => CreateExternalConnectionBodySchema,
|
|
56
58
|
CreateRunResponseBodySchema: () => CreateRunResponseBodySchema,
|
|
@@ -64,6 +66,8 @@ __export(src_exports, {
|
|
|
64
66
|
DynamicTriggerMetadataSchema: () => DynamicTriggerMetadataSchema,
|
|
65
67
|
EndpointHeadersSchema: () => EndpointHeadersSchema,
|
|
66
68
|
EndpointIndexErrorSchema: () => EndpointIndexErrorSchema,
|
|
69
|
+
EphemeralEventDispatcherRequestBodySchema: () => EphemeralEventDispatcherRequestBodySchema,
|
|
70
|
+
EphemeralEventDispatcherResponseBodySchema: () => EphemeralEventDispatcherResponseBodySchema,
|
|
67
71
|
ErrorWithStackSchema: () => ErrorWithStackSchema,
|
|
68
72
|
EventExampleSchema: () => EventExampleSchema,
|
|
69
73
|
EventFilterSchema: () => EventFilterSchema,
|
|
@@ -71,19 +75,22 @@ __export(src_exports, {
|
|
|
71
75
|
EventSpecificationSchema: () => EventSpecificationSchema,
|
|
72
76
|
FailTaskBodyInputSchema: () => FailTaskBodyInputSchema,
|
|
73
77
|
FetchOperationSchema: () => FetchOperationSchema,
|
|
78
|
+
FetchPollOperationSchema: () => FetchPollOperationSchema,
|
|
74
79
|
FetchRequestInitSchema: () => FetchRequestInitSchema,
|
|
75
80
|
FetchRetryBackoffStrategySchema: () => FetchRetryBackoffStrategySchema,
|
|
76
81
|
FetchRetryHeadersStrategySchema: () => FetchRetryHeadersStrategySchema,
|
|
77
82
|
FetchRetryOptionsSchema: () => FetchRetryOptionsSchema,
|
|
78
83
|
FetchRetryStrategySchema: () => FetchRetryStrategySchema,
|
|
84
|
+
FetchTimeoutOptionsSchema: () => FetchTimeoutOptionsSchema,
|
|
79
85
|
GetEndpointIndexResponseSchema: () => GetEndpointIndexResponseSchema,
|
|
80
86
|
GetEventSchema: () => GetEventSchema,
|
|
81
87
|
GetRunSchema: () => GetRunSchema,
|
|
82
88
|
GetRunStatusesSchema: () => GetRunStatusesSchema,
|
|
83
89
|
GetRunsSchema: () => GetRunsSchema,
|
|
90
|
+
HTTPMethodUnionSchema: () => HTTPMethodUnionSchema,
|
|
84
91
|
HandleTriggerSourceSchema: () => HandleTriggerSourceSchema,
|
|
92
|
+
HttpEndpointRequestHeadersSchema: () => HttpEndpointRequestHeadersSchema,
|
|
85
93
|
HttpSourceRequestHeadersSchema: () => HttpSourceRequestHeadersSchema,
|
|
86
|
-
HttpSourceRequestSchema: () => HttpSourceRequestSchema,
|
|
87
94
|
HttpSourceResponseSchema: () => HttpSourceResponseSchema,
|
|
88
95
|
IndexEndpointResponseSchema: () => IndexEndpointResponseSchema,
|
|
89
96
|
InitializeCronScheduleBodySchema: () => InitializeCronScheduleBodySchema,
|
|
@@ -92,6 +99,10 @@ __export(src_exports, {
|
|
|
92
99
|
IntegrationMetadataSchema: () => IntegrationMetadataSchema,
|
|
93
100
|
IntervalMetadataSchema: () => IntervalMetadataSchema,
|
|
94
101
|
IntervalOptionsSchema: () => IntervalOptionsSchema,
|
|
102
|
+
InvokeJobRequestBodySchema: () => InvokeJobRequestBodySchema,
|
|
103
|
+
InvokeJobResponseSchema: () => InvokeJobResponseSchema,
|
|
104
|
+
InvokeOptionsSchema: () => InvokeOptionsSchema,
|
|
105
|
+
InvokeTriggerMetadataSchema: () => InvokeTriggerMetadataSchema,
|
|
95
106
|
JobMetadataSchema: () => JobMetadataSchema,
|
|
96
107
|
JobRunStatusRecordSchema: () => JobRunStatusRecordSchema,
|
|
97
108
|
LogMessageSchema: () => LogMessageSchema,
|
|
@@ -131,14 +142,19 @@ __export(src_exports, {
|
|
|
131
142
|
RegisterTriggerBodySchemaV1: () => RegisterTriggerBodySchemaV1,
|
|
132
143
|
RegisterTriggerBodySchemaV2: () => RegisterTriggerBodySchemaV2,
|
|
133
144
|
RegisterTriggerSourceSchema: () => RegisterTriggerSourceSchema,
|
|
145
|
+
RequestFilterSchema: () => RequestFilterSchema,
|
|
146
|
+
RequestWithRawBodySchema: () => RequestWithRawBodySchema,
|
|
147
|
+
ResponseFilterSchema: () => ResponseFilterSchema,
|
|
134
148
|
RetryOptionsSchema: () => RetryOptionsSchema,
|
|
135
149
|
RunJobAutoYieldExecutionErrorSchema: () => RunJobAutoYieldExecutionErrorSchema,
|
|
136
150
|
RunJobAutoYieldWithCompletedTaskExecutionErrorSchema: () => RunJobAutoYieldWithCompletedTaskExecutionErrorSchema,
|
|
137
151
|
RunJobBodySchema: () => RunJobBodySchema,
|
|
138
152
|
RunJobCanceledWithTaskSchema: () => RunJobCanceledWithTaskSchema,
|
|
153
|
+
RunJobErrorResponseSchema: () => RunJobErrorResponseSchema,
|
|
139
154
|
RunJobErrorSchema: () => RunJobErrorSchema,
|
|
140
155
|
RunJobInvalidPayloadErrorSchema: () => RunJobInvalidPayloadErrorSchema,
|
|
141
156
|
RunJobResponseSchema: () => RunJobResponseSchema,
|
|
157
|
+
RunJobResumeWithParallelTaskSchema: () => RunJobResumeWithParallelTaskSchema,
|
|
142
158
|
RunJobResumeWithTaskSchema: () => RunJobResumeWithTaskSchema,
|
|
143
159
|
RunJobRetryWithTaskSchema: () => RunJobRetryWithTaskSchema,
|
|
144
160
|
RunJobSuccessSchema: () => RunJobSuccessSchema,
|
|
@@ -157,6 +173,7 @@ __export(src_exports, {
|
|
|
157
173
|
ScheduledPayloadSchema: () => ScheduledPayloadSchema,
|
|
158
174
|
ScheduledTriggerMetadataSchema: () => ScheduledTriggerMetadataSchema,
|
|
159
175
|
SchemaErrorSchema: () => SchemaErrorSchema,
|
|
176
|
+
SendBulkEventsBodySchema: () => SendBulkEventsBodySchema,
|
|
160
177
|
SendEventBodySchema: () => SendEventBodySchema,
|
|
161
178
|
SendEventOptionsSchema: () => SendEventOptionsSchema,
|
|
162
179
|
SerializableJsonSchema: () => SerializableJsonSchema,
|
|
@@ -169,6 +186,7 @@ __export(src_exports, {
|
|
|
169
186
|
StyleSchema: () => StyleSchema,
|
|
170
187
|
TaskSchema: () => TaskSchema,
|
|
171
188
|
TaskStatusSchema: () => TaskStatusSchema,
|
|
189
|
+
TriggerHelpSchema: () => TriggerHelpSchema,
|
|
172
190
|
TriggerMetadataSchema: () => TriggerMetadataSchema,
|
|
173
191
|
TriggerSourceSchema: () => TriggerSourceSchema,
|
|
174
192
|
UpdateTriggerSourceBodyV1Schema: () => UpdateTriggerSourceBodyV1Schema,
|
|
@@ -177,6 +195,7 @@ __export(src_exports, {
|
|
|
177
195
|
ValidateResponseSchema: () => ValidateResponseSchema,
|
|
178
196
|
ValidateSuccessResponseSchema: () => ValidateSuccessResponseSchema,
|
|
179
197
|
addMissingVersionField: () => addMissingVersionField,
|
|
198
|
+
calculateResetAt: () => calculateResetAt,
|
|
180
199
|
calculateRetryAt: () => calculateRetryAt,
|
|
181
200
|
currentDate: () => currentDate,
|
|
182
201
|
currentTimestampMilliseconds: () => currentTimestampMilliseconds,
|
|
@@ -185,6 +204,9 @@ __export(src_exports, {
|
|
|
185
204
|
eventFilterMatches: () => eventFilterMatches,
|
|
186
205
|
parseEndpointIndexStats: () => parseEndpointIndexStats,
|
|
187
206
|
replacements: () => replacements,
|
|
207
|
+
requestFilterMatches: () => requestFilterMatches,
|
|
208
|
+
responseFilterMatches: () => responseFilterMatches,
|
|
209
|
+
stringPatternMatchers: () => stringPatternMatchers,
|
|
188
210
|
supportsFeature: () => supportsFeature,
|
|
189
211
|
urlWithSearchParams: () => urlWithSearchParams
|
|
190
212
|
});
|
|
@@ -209,7 +231,7 @@ var _Logger = class _Logger {
|
|
|
209
231
|
__privateSet(this, _name, name);
|
|
210
232
|
__privateSet(this, _level, logLevels.indexOf(process.env.TRIGGER_LOG_LEVEL ?? level));
|
|
211
233
|
__privateSet(this, _filteredKeys, filteredKeys);
|
|
212
|
-
__privateSet(this, _jsonReplacer, jsonReplacer);
|
|
234
|
+
__privateSet(this, _jsonReplacer, createReplacer(jsonReplacer));
|
|
213
235
|
}
|
|
214
236
|
// Return a new Logger instance with the same name and a new log level
|
|
215
237
|
// but filter out the keys from the log messages (at any level)
|
|
@@ -222,27 +244,27 @@ var _Logger = class _Logger {
|
|
|
222
244
|
log(message, ...args) {
|
|
223
245
|
if (__privateGet(this, _level) < 0)
|
|
224
246
|
return;
|
|
225
|
-
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.log, message, ...args);
|
|
247
|
+
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.log, message, "log", ...args);
|
|
226
248
|
}
|
|
227
249
|
error(message, ...args) {
|
|
228
250
|
if (__privateGet(this, _level) < 1)
|
|
229
251
|
return;
|
|
230
|
-
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.error, message, ...args);
|
|
252
|
+
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.error, message, "error", ...args);
|
|
231
253
|
}
|
|
232
254
|
warn(message, ...args) {
|
|
233
255
|
if (__privateGet(this, _level) < 2)
|
|
234
256
|
return;
|
|
235
|
-
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.warn, message, ...args);
|
|
257
|
+
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.warn, message, "warn", ...args);
|
|
236
258
|
}
|
|
237
259
|
info(message, ...args) {
|
|
238
260
|
if (__privateGet(this, _level) < 3)
|
|
239
261
|
return;
|
|
240
|
-
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.info, message, ...args);
|
|
262
|
+
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.info, message, "info", ...args);
|
|
241
263
|
}
|
|
242
264
|
debug(message, ...args) {
|
|
243
265
|
if (__privateGet(this, _level) < 4)
|
|
244
266
|
return;
|
|
245
|
-
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.debug, message, ...args);
|
|
267
|
+
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.debug, message, "debug", ...args);
|
|
246
268
|
}
|
|
247
269
|
};
|
|
248
270
|
_name = new WeakMap();
|
|
@@ -250,14 +272,15 @@ _level = new WeakMap();
|
|
|
250
272
|
_filteredKeys = new WeakMap();
|
|
251
273
|
_jsonReplacer = new WeakMap();
|
|
252
274
|
_structuredLog = new WeakSet();
|
|
253
|
-
structuredLog_fn = /* @__PURE__ */ __name(function(loggerFunction, message, ...args) {
|
|
275
|
+
structuredLog_fn = /* @__PURE__ */ __name(function(loggerFunction, message, level, ...args) {
|
|
254
276
|
const structuredLog = {
|
|
255
277
|
...structureArgs(safeJsonClone(args), __privateGet(this, _filteredKeys)),
|
|
256
278
|
timestamp: /* @__PURE__ */ new Date(),
|
|
257
279
|
name: __privateGet(this, _name),
|
|
258
|
-
message
|
|
280
|
+
message,
|
|
281
|
+
level
|
|
259
282
|
};
|
|
260
|
-
loggerFunction(JSON.stringify(structuredLog,
|
|
283
|
+
loggerFunction(JSON.stringify(structuredLog, __privateGet(this, _jsonReplacer)));
|
|
261
284
|
}, "#structuredLog");
|
|
262
285
|
__name(_Logger, "Logger");
|
|
263
286
|
var Logger = _Logger;
|
|
@@ -284,11 +307,14 @@ function safeJsonClone(obj) {
|
|
|
284
307
|
try {
|
|
285
308
|
return JSON.parse(JSON.stringify(obj, bigIntReplacer));
|
|
286
309
|
} catch (e) {
|
|
287
|
-
return
|
|
310
|
+
return;
|
|
288
311
|
}
|
|
289
312
|
}
|
|
290
313
|
__name(safeJsonClone, "safeJsonClone");
|
|
291
314
|
function structureArgs(args, filteredKeys = []) {
|
|
315
|
+
if (!args) {
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
292
318
|
if (args.length === 0) {
|
|
293
319
|
return;
|
|
294
320
|
}
|
|
@@ -324,7 +350,7 @@ function prettyPrintBytes(value) {
|
|
|
324
350
|
if (process.env.NODE_ENV === "production") {
|
|
325
351
|
return "skipped size";
|
|
326
352
|
}
|
|
327
|
-
const sizeInBytes =
|
|
353
|
+
const sizeInBytes = getSizeInBytes(value);
|
|
328
354
|
if (sizeInBytes < 1024) {
|
|
329
355
|
return `${sizeInBytes} bytes`;
|
|
330
356
|
}
|
|
@@ -337,10 +363,19 @@ function prettyPrintBytes(value) {
|
|
|
337
363
|
return `${(sizeInBytes / (1024 * 1024 * 1024)).toFixed(2)} GB`;
|
|
338
364
|
}
|
|
339
365
|
__name(prettyPrintBytes, "prettyPrintBytes");
|
|
366
|
+
function getSizeInBytes(value) {
|
|
367
|
+
const jsonString = JSON.stringify(value);
|
|
368
|
+
if (typeof window === "undefined") {
|
|
369
|
+
return Buffer.byteLength(jsonString, "utf8");
|
|
370
|
+
} else {
|
|
371
|
+
return new TextEncoder().encode(jsonString).length;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
__name(getSizeInBytes, "getSizeInBytes");
|
|
340
375
|
|
|
341
376
|
// src/schemas/api.ts
|
|
342
377
|
var import_ulid = require("ulid");
|
|
343
|
-
var
|
|
378
|
+
var import_zod12 = require("zod");
|
|
344
379
|
|
|
345
380
|
// src/schemas/addMissingVersionField.ts
|
|
346
381
|
function addMissingVersionField(val) {
|
|
@@ -368,6 +403,17 @@ var SchemaErrorSchema = import_zod.z.object({
|
|
|
368
403
|
|
|
369
404
|
// src/schemas/eventFilter.ts
|
|
370
405
|
var import_zod2 = require("zod");
|
|
406
|
+
var stringPatternMatchers = [
|
|
407
|
+
import_zod2.z.object({
|
|
408
|
+
$endsWith: import_zod2.z.string()
|
|
409
|
+
}),
|
|
410
|
+
import_zod2.z.object({
|
|
411
|
+
$startsWith: import_zod2.z.string()
|
|
412
|
+
}),
|
|
413
|
+
import_zod2.z.object({
|
|
414
|
+
$ignoreCaseEquals: import_zod2.z.string()
|
|
415
|
+
})
|
|
416
|
+
];
|
|
371
417
|
var EventMatcherSchema = import_zod2.z.union([
|
|
372
418
|
/** Match against a string */
|
|
373
419
|
import_zod2.z.array(import_zod2.z.string()),
|
|
@@ -376,12 +422,7 @@ var EventMatcherSchema = import_zod2.z.union([
|
|
|
376
422
|
/** Match against a boolean */
|
|
377
423
|
import_zod2.z.array(import_zod2.z.boolean()),
|
|
378
424
|
import_zod2.z.array(import_zod2.z.union([
|
|
379
|
-
|
|
380
|
-
$endsWith: import_zod2.z.string()
|
|
381
|
-
}),
|
|
382
|
-
import_zod2.z.object({
|
|
383
|
-
$startsWith: import_zod2.z.string()
|
|
384
|
-
}),
|
|
425
|
+
...stringPatternMatchers,
|
|
385
426
|
import_zod2.z.object({
|
|
386
427
|
$exists: import_zod2.z.boolean()
|
|
387
428
|
}),
|
|
@@ -426,9 +467,6 @@ var EventMatcherSchema = import_zod2.z.union([
|
|
|
426
467
|
import_zod2.z.number(),
|
|
427
468
|
import_zod2.z.boolean()
|
|
428
469
|
])
|
|
429
|
-
}),
|
|
430
|
-
import_zod2.z.object({
|
|
431
|
-
$ignoreCaseEquals: import_zod2.z.string()
|
|
432
470
|
})
|
|
433
471
|
]))
|
|
434
472
|
]);
|
|
@@ -505,7 +543,9 @@ var DisplayPropertySchema = import_zod5.z.object({
|
|
|
505
543
|
/** The value of the property */
|
|
506
544
|
text: import_zod5.z.string(),
|
|
507
545
|
/** The URL to link to when the property is clicked */
|
|
508
|
-
url: import_zod5.z.string().optional()
|
|
546
|
+
url: import_zod5.z.string().optional(),
|
|
547
|
+
/** The URL to a list of images to display next to the property */
|
|
548
|
+
imageUrl: import_zod5.z.array(import_zod5.z.string()).optional()
|
|
509
549
|
});
|
|
510
550
|
var DisplayPropertiesSchema = import_zod5.z.array(DisplayPropertySchema);
|
|
511
551
|
var StyleSchema = import_zod5.z.object({
|
|
@@ -588,11 +628,16 @@ var TaskSchema = import_zod7.z.object({
|
|
|
588
628
|
outputProperties: import_zod7.z.array(DisplayPropertySchema).optional().nullable(),
|
|
589
629
|
params: DeserializedJsonSchema.optional().nullable(),
|
|
590
630
|
output: DeserializedJsonSchema.optional().nullable(),
|
|
631
|
+
context: DeserializedJsonSchema.optional().nullable(),
|
|
591
632
|
error: import_zod7.z.string().optional().nullable(),
|
|
592
633
|
parentId: import_zod7.z.string().optional().nullable(),
|
|
593
634
|
style: StyleSchema.optional().nullable(),
|
|
594
635
|
operation: import_zod7.z.string().optional().nullable(),
|
|
595
|
-
callbackUrl: import_zod7.z.string().optional().nullable()
|
|
636
|
+
callbackUrl: import_zod7.z.string().optional().nullable(),
|
|
637
|
+
childExecutionMode: import_zod7.z.enum([
|
|
638
|
+
"SEQUENTIAL",
|
|
639
|
+
"PARALLEL"
|
|
640
|
+
]).optional().nullable()
|
|
596
641
|
});
|
|
597
642
|
var ServerTaskSchema = TaskSchema.extend({
|
|
598
643
|
idempotencyKey: import_zod7.z.string(),
|
|
@@ -630,6 +675,12 @@ var DynamicTriggerMetadataSchema = import_zod8.z.object({
|
|
|
630
675
|
type: import_zod8.z.literal("dynamic"),
|
|
631
676
|
id: import_zod8.z.string()
|
|
632
677
|
});
|
|
678
|
+
var TriggerHelpSchema = import_zod8.z.object({
|
|
679
|
+
noRuns: import_zod8.z.object({
|
|
680
|
+
text: import_zod8.z.string(),
|
|
681
|
+
link: import_zod8.z.string().optional()
|
|
682
|
+
}).optional()
|
|
683
|
+
});
|
|
633
684
|
var StaticTriggerMetadataSchema = import_zod8.z.object({
|
|
634
685
|
type: import_zod8.z.literal("static"),
|
|
635
686
|
title: import_zod8.z.union([
|
|
@@ -637,7 +688,12 @@ var StaticTriggerMetadataSchema = import_zod8.z.object({
|
|
|
637
688
|
import_zod8.z.array(import_zod8.z.string())
|
|
638
689
|
]),
|
|
639
690
|
properties: import_zod8.z.array(DisplayPropertySchema).optional(),
|
|
640
|
-
rule: EventRuleSchema
|
|
691
|
+
rule: EventRuleSchema,
|
|
692
|
+
link: import_zod8.z.string().optional(),
|
|
693
|
+
help: TriggerHelpSchema.optional()
|
|
694
|
+
});
|
|
695
|
+
var InvokeTriggerMetadataSchema = import_zod8.z.object({
|
|
696
|
+
type: import_zod8.z.literal("invoke")
|
|
641
697
|
});
|
|
642
698
|
var ScheduledTriggerMetadataSchema = import_zod8.z.object({
|
|
643
699
|
type: import_zod8.z.literal("scheduled"),
|
|
@@ -646,7 +702,8 @@ var ScheduledTriggerMetadataSchema = import_zod8.z.object({
|
|
|
646
702
|
var TriggerMetadataSchema = import_zod8.z.discriminatedUnion("type", [
|
|
647
703
|
DynamicTriggerMetadataSchema,
|
|
648
704
|
StaticTriggerMetadataSchema,
|
|
649
|
-
ScheduledTriggerMetadataSchema
|
|
705
|
+
ScheduledTriggerMetadataSchema,
|
|
706
|
+
InvokeTriggerMetadataSchema
|
|
650
707
|
]);
|
|
651
708
|
|
|
652
709
|
// src/schemas/runs.ts
|
|
@@ -757,225 +814,295 @@ var GetRunsSchema = import_zod10.z.object({
|
|
|
757
814
|
nextCursor: import_zod10.z.string().optional()
|
|
758
815
|
});
|
|
759
816
|
|
|
817
|
+
// src/schemas/requestFilter.ts
|
|
818
|
+
var import_zod11 = require("zod");
|
|
819
|
+
var StringMatchSchema = import_zod11.z.union([
|
|
820
|
+
/** Match against a string */
|
|
821
|
+
import_zod11.z.array(import_zod11.z.string()),
|
|
822
|
+
import_zod11.z.array(import_zod11.z.union(stringPatternMatchers))
|
|
823
|
+
]);
|
|
824
|
+
var HTTPMethodUnionSchema = import_zod11.z.union([
|
|
825
|
+
import_zod11.z.literal("GET"),
|
|
826
|
+
import_zod11.z.literal("POST"),
|
|
827
|
+
import_zod11.z.literal("PUT"),
|
|
828
|
+
import_zod11.z.literal("PATCH"),
|
|
829
|
+
import_zod11.z.literal("DELETE"),
|
|
830
|
+
import_zod11.z.literal("HEAD"),
|
|
831
|
+
import_zod11.z.literal("OPTIONS")
|
|
832
|
+
]);
|
|
833
|
+
var RequestFilterSchema = import_zod11.z.object({
|
|
834
|
+
/** An array of HTTP methods to match.
|
|
835
|
+
* For example, `["GET", "POST"]` will match both `GET` and `POST` Requests. */
|
|
836
|
+
method: import_zod11.z.array(HTTPMethodUnionSchema).optional(),
|
|
837
|
+
/** An object of header key/values to match.
|
|
838
|
+
* This uses the [EventFilter matching syntax](https://trigger.dev/docs/documentation/guides/event-filter).
|
|
839
|
+
|
|
840
|
+
@example
|
|
841
|
+
```ts
|
|
842
|
+
filter: {
|
|
843
|
+
header: {
|
|
844
|
+
"content-type": ["application/json"],
|
|
845
|
+
},
|
|
846
|
+
},
|
|
847
|
+
``` */
|
|
848
|
+
headers: import_zod11.z.record(StringMatchSchema).optional(),
|
|
849
|
+
/** An object of query parameters to match.
|
|
850
|
+
* This uses the [EventFilter matching syntax](https://trigger.dev/docs/documentation/guides/event-filter).
|
|
851
|
+
|
|
852
|
+
@example
|
|
853
|
+
```ts
|
|
854
|
+
filter: {
|
|
855
|
+
query: {
|
|
856
|
+
"hub.mode": [{ $startsWith: "sub" }],
|
|
857
|
+
},
|
|
858
|
+
},
|
|
859
|
+
``` */
|
|
860
|
+
query: import_zod11.z.record(StringMatchSchema).optional(),
|
|
861
|
+
/** An object of key/values to match.
|
|
862
|
+
* This uses the [EventFilter matching syntax](https://trigger.dev/docs/documentation/guides/event-filter).
|
|
863
|
+
*/
|
|
864
|
+
body: EventFilterSchema.optional()
|
|
865
|
+
});
|
|
866
|
+
var ResponseFilterSchema = RequestFilterSchema.omit({
|
|
867
|
+
method: true,
|
|
868
|
+
query: true
|
|
869
|
+
}).extend({
|
|
870
|
+
status: import_zod11.z.array(import_zod11.z.number()).optional()
|
|
871
|
+
});
|
|
872
|
+
|
|
760
873
|
// src/schemas/api.ts
|
|
761
|
-
var UpdateTriggerSourceBodyV1Schema =
|
|
762
|
-
registeredEvents:
|
|
763
|
-
secret:
|
|
874
|
+
var UpdateTriggerSourceBodyV1Schema = import_zod12.z.object({
|
|
875
|
+
registeredEvents: import_zod12.z.array(import_zod12.z.string()),
|
|
876
|
+
secret: import_zod12.z.string().optional(),
|
|
764
877
|
data: SerializableJsonSchema.optional()
|
|
765
878
|
});
|
|
766
|
-
var UpdateTriggerSourceBodyV2Schema =
|
|
767
|
-
secret:
|
|
879
|
+
var UpdateTriggerSourceBodyV2Schema = import_zod12.z.object({
|
|
880
|
+
secret: import_zod12.z.string().optional(),
|
|
768
881
|
data: SerializableJsonSchema.optional(),
|
|
769
|
-
options:
|
|
770
|
-
event:
|
|
771
|
-
}).and(
|
|
882
|
+
options: import_zod12.z.object({
|
|
883
|
+
event: import_zod12.z.array(import_zod12.z.string())
|
|
884
|
+
}).and(import_zod12.z.record(import_zod12.z.string(), import_zod12.z.array(import_zod12.z.string())).optional())
|
|
772
885
|
});
|
|
773
|
-
var RegisterHTTPTriggerSourceBodySchema =
|
|
774
|
-
type:
|
|
775
|
-
url:
|
|
886
|
+
var RegisterHTTPTriggerSourceBodySchema = import_zod12.z.object({
|
|
887
|
+
type: import_zod12.z.literal("HTTP"),
|
|
888
|
+
url: import_zod12.z.string().url()
|
|
776
889
|
});
|
|
777
|
-
var RegisterSMTPTriggerSourceBodySchema =
|
|
778
|
-
type:
|
|
890
|
+
var RegisterSMTPTriggerSourceBodySchema = import_zod12.z.object({
|
|
891
|
+
type: import_zod12.z.literal("SMTP")
|
|
779
892
|
});
|
|
780
|
-
var RegisterSQSTriggerSourceBodySchema =
|
|
781
|
-
type:
|
|
893
|
+
var RegisterSQSTriggerSourceBodySchema = import_zod12.z.object({
|
|
894
|
+
type: import_zod12.z.literal("SQS")
|
|
782
895
|
});
|
|
783
|
-
var RegisterSourceChannelBodySchema =
|
|
896
|
+
var RegisterSourceChannelBodySchema = import_zod12.z.discriminatedUnion("type", [
|
|
784
897
|
RegisterHTTPTriggerSourceBodySchema,
|
|
785
898
|
RegisterSMTPTriggerSourceBodySchema,
|
|
786
899
|
RegisterSQSTriggerSourceBodySchema
|
|
787
900
|
]);
|
|
788
901
|
var REGISTER_SOURCE_EVENT_V1 = "dev.trigger.source.register";
|
|
789
902
|
var REGISTER_SOURCE_EVENT_V2 = "dev.trigger.source.register.v2";
|
|
790
|
-
var RegisterTriggerSourceSchema =
|
|
791
|
-
key:
|
|
792
|
-
params:
|
|
793
|
-
active:
|
|
794
|
-
secret:
|
|
903
|
+
var RegisterTriggerSourceSchema = import_zod12.z.object({
|
|
904
|
+
key: import_zod12.z.string(),
|
|
905
|
+
params: import_zod12.z.any(),
|
|
906
|
+
active: import_zod12.z.boolean(),
|
|
907
|
+
secret: import_zod12.z.string(),
|
|
795
908
|
data: DeserializedJsonSchema.optional(),
|
|
796
909
|
channel: RegisterSourceChannelBodySchema,
|
|
797
|
-
clientId:
|
|
910
|
+
clientId: import_zod12.z.string().optional()
|
|
798
911
|
});
|
|
799
|
-
var SourceEventOptionSchema =
|
|
800
|
-
name:
|
|
801
|
-
value:
|
|
912
|
+
var SourceEventOptionSchema = import_zod12.z.object({
|
|
913
|
+
name: import_zod12.z.string(),
|
|
914
|
+
value: import_zod12.z.string()
|
|
802
915
|
});
|
|
803
|
-
var RegisterSourceEventSchemaV1 =
|
|
916
|
+
var RegisterSourceEventSchemaV1 = import_zod12.z.object({
|
|
804
917
|
/** The id of the source */
|
|
805
|
-
id:
|
|
918
|
+
id: import_zod12.z.string(),
|
|
806
919
|
source: RegisterTriggerSourceSchema,
|
|
807
|
-
events:
|
|
808
|
-
missingEvents:
|
|
809
|
-
orphanedEvents:
|
|
810
|
-
dynamicTriggerId:
|
|
920
|
+
events: import_zod12.z.array(import_zod12.z.string()),
|
|
921
|
+
missingEvents: import_zod12.z.array(import_zod12.z.string()),
|
|
922
|
+
orphanedEvents: import_zod12.z.array(import_zod12.z.string()),
|
|
923
|
+
dynamicTriggerId: import_zod12.z.string().optional()
|
|
811
924
|
});
|
|
812
|
-
var RegisteredOptionsDiffSchema =
|
|
813
|
-
desired:
|
|
814
|
-
missing:
|
|
815
|
-
orphaned:
|
|
925
|
+
var RegisteredOptionsDiffSchema = import_zod12.z.object({
|
|
926
|
+
desired: import_zod12.z.array(import_zod12.z.string()),
|
|
927
|
+
missing: import_zod12.z.array(import_zod12.z.string()),
|
|
928
|
+
orphaned: import_zod12.z.array(import_zod12.z.string())
|
|
816
929
|
});
|
|
817
|
-
var RegisterSourceEventOptionsSchema =
|
|
930
|
+
var RegisterSourceEventOptionsSchema = import_zod12.z.object({
|
|
818
931
|
event: RegisteredOptionsDiffSchema
|
|
819
|
-
}).and(
|
|
820
|
-
var RegisterSourceEventSchemaV2 =
|
|
932
|
+
}).and(import_zod12.z.record(import_zod12.z.string(), RegisteredOptionsDiffSchema));
|
|
933
|
+
var RegisterSourceEventSchemaV2 = import_zod12.z.object({
|
|
821
934
|
/** The id of the source */
|
|
822
|
-
id:
|
|
935
|
+
id: import_zod12.z.string(),
|
|
823
936
|
source: RegisterTriggerSourceSchema,
|
|
824
937
|
options: RegisterSourceEventOptionsSchema,
|
|
825
|
-
dynamicTriggerId:
|
|
938
|
+
dynamicTriggerId: import_zod12.z.string().optional()
|
|
826
939
|
});
|
|
827
|
-
var TriggerSourceSchema =
|
|
828
|
-
id:
|
|
829
|
-
key:
|
|
940
|
+
var TriggerSourceSchema = import_zod12.z.object({
|
|
941
|
+
id: import_zod12.z.string(),
|
|
942
|
+
key: import_zod12.z.string()
|
|
830
943
|
});
|
|
831
944
|
var HttpSourceResponseMetadataSchema = DeserializedJsonSchema;
|
|
832
|
-
var HandleTriggerSourceSchema =
|
|
833
|
-
key:
|
|
834
|
-
secret:
|
|
835
|
-
data:
|
|
836
|
-
params:
|
|
945
|
+
var HandleTriggerSourceSchema = import_zod12.z.object({
|
|
946
|
+
key: import_zod12.z.string(),
|
|
947
|
+
secret: import_zod12.z.string(),
|
|
948
|
+
data: import_zod12.z.any(),
|
|
949
|
+
params: import_zod12.z.any(),
|
|
837
950
|
auth: ConnectionAuthSchema.optional(),
|
|
838
951
|
metadata: HttpSourceResponseMetadataSchema.optional()
|
|
839
952
|
});
|
|
840
|
-
var
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
"x-ts-
|
|
848
|
-
"x-ts-
|
|
849
|
-
"x-ts-
|
|
850
|
-
"x-ts-data": import_zod11.z.string().transform((s) => JSON.parse(s)),
|
|
851
|
-
"x-ts-params": import_zod11.z.string().transform((s) => JSON.parse(s)),
|
|
852
|
-
"x-ts-http-url": import_zod11.z.string(),
|
|
853
|
-
"x-ts-http-method": import_zod11.z.string(),
|
|
854
|
-
"x-ts-http-headers": import_zod11.z.string().transform((s) => import_zod11.z.record(import_zod11.z.string()).parse(JSON.parse(s))),
|
|
855
|
-
"x-ts-auth": import_zod11.z.string().optional().transform((s) => {
|
|
953
|
+
var HttpSourceRequestHeadersSchema = import_zod12.z.object({
|
|
954
|
+
"x-ts-key": import_zod12.z.string(),
|
|
955
|
+
"x-ts-dynamic-id": import_zod12.z.string().optional(),
|
|
956
|
+
"x-ts-secret": import_zod12.z.string(),
|
|
957
|
+
"x-ts-data": import_zod12.z.string().transform((s) => JSON.parse(s)),
|
|
958
|
+
"x-ts-params": import_zod12.z.string().transform((s) => JSON.parse(s)),
|
|
959
|
+
"x-ts-http-url": import_zod12.z.string(),
|
|
960
|
+
"x-ts-http-method": import_zod12.z.string(),
|
|
961
|
+
"x-ts-http-headers": import_zod12.z.string().transform((s) => import_zod12.z.record(import_zod12.z.string()).parse(JSON.parse(s))),
|
|
962
|
+
"x-ts-auth": import_zod12.z.string().optional().transform((s) => {
|
|
856
963
|
if (s === void 0)
|
|
857
964
|
return;
|
|
858
965
|
const json = JSON.parse(s);
|
|
859
966
|
return ConnectionAuthSchema.parse(json);
|
|
860
967
|
}),
|
|
861
|
-
"x-ts-metadata":
|
|
968
|
+
"x-ts-metadata": import_zod12.z.string().optional().transform((s) => {
|
|
862
969
|
if (s === void 0)
|
|
863
970
|
return;
|
|
864
971
|
const json = JSON.parse(s);
|
|
865
972
|
return DeserializedJsonSchema.parse(json);
|
|
866
973
|
})
|
|
867
974
|
});
|
|
868
|
-
var
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
975
|
+
var HttpEndpointRequestHeadersSchema = import_zod12.z.object({
|
|
976
|
+
"x-ts-key": import_zod12.z.string(),
|
|
977
|
+
"x-ts-http-url": import_zod12.z.string(),
|
|
978
|
+
"x-ts-http-method": import_zod12.z.string(),
|
|
979
|
+
"x-ts-http-headers": import_zod12.z.string().transform((s) => import_zod12.z.record(import_zod12.z.string()).parse(JSON.parse(s)))
|
|
980
|
+
});
|
|
981
|
+
var PongSuccessResponseSchema = import_zod12.z.object({
|
|
982
|
+
ok: import_zod12.z.literal(true),
|
|
983
|
+
triggerVersion: import_zod12.z.string().optional(),
|
|
984
|
+
triggerSdkVersion: import_zod12.z.string().optional()
|
|
872
985
|
});
|
|
873
|
-
var PongErrorResponseSchema =
|
|
874
|
-
ok:
|
|
875
|
-
error:
|
|
876
|
-
triggerVersion:
|
|
877
|
-
triggerSdkVersion:
|
|
986
|
+
var PongErrorResponseSchema = import_zod12.z.object({
|
|
987
|
+
ok: import_zod12.z.literal(false),
|
|
988
|
+
error: import_zod12.z.string(),
|
|
989
|
+
triggerVersion: import_zod12.z.string().optional(),
|
|
990
|
+
triggerSdkVersion: import_zod12.z.string().optional()
|
|
878
991
|
});
|
|
879
|
-
var PongResponseSchema =
|
|
992
|
+
var PongResponseSchema = import_zod12.z.discriminatedUnion("ok", [
|
|
880
993
|
PongSuccessResponseSchema,
|
|
881
994
|
PongErrorResponseSchema
|
|
882
995
|
]);
|
|
883
|
-
var ValidateSuccessResponseSchema =
|
|
884
|
-
ok:
|
|
885
|
-
endpointId:
|
|
886
|
-
triggerVersion:
|
|
996
|
+
var ValidateSuccessResponseSchema = import_zod12.z.object({
|
|
997
|
+
ok: import_zod12.z.literal(true),
|
|
998
|
+
endpointId: import_zod12.z.string(),
|
|
999
|
+
triggerVersion: import_zod12.z.string().optional()
|
|
887
1000
|
});
|
|
888
|
-
var ValidateErrorResponseSchema =
|
|
889
|
-
ok:
|
|
890
|
-
error:
|
|
891
|
-
triggerVersion:
|
|
1001
|
+
var ValidateErrorResponseSchema = import_zod12.z.object({
|
|
1002
|
+
ok: import_zod12.z.literal(false),
|
|
1003
|
+
error: import_zod12.z.string(),
|
|
1004
|
+
triggerVersion: import_zod12.z.string().optional()
|
|
892
1005
|
});
|
|
893
|
-
var ValidateResponseSchema =
|
|
1006
|
+
var ValidateResponseSchema = import_zod12.z.discriminatedUnion("ok", [
|
|
894
1007
|
ValidateSuccessResponseSchema,
|
|
895
1008
|
ValidateErrorResponseSchema
|
|
896
1009
|
]);
|
|
897
|
-
var QueueOptionsSchema =
|
|
898
|
-
name:
|
|
899
|
-
maxConcurrent:
|
|
900
|
-
});
|
|
901
|
-
var JobMetadataSchema =
|
|
902
|
-
id:
|
|
903
|
-
name:
|
|
904
|
-
version:
|
|
1010
|
+
var QueueOptionsSchema = import_zod12.z.object({
|
|
1011
|
+
name: import_zod12.z.string(),
|
|
1012
|
+
maxConcurrent: import_zod12.z.number().optional()
|
|
1013
|
+
});
|
|
1014
|
+
var JobMetadataSchema = import_zod12.z.object({
|
|
1015
|
+
id: import_zod12.z.string(),
|
|
1016
|
+
name: import_zod12.z.string(),
|
|
1017
|
+
version: import_zod12.z.string(),
|
|
905
1018
|
event: EventSpecificationSchema,
|
|
906
1019
|
trigger: TriggerMetadataSchema,
|
|
907
|
-
integrations:
|
|
908
|
-
internal:
|
|
909
|
-
enabled:
|
|
910
|
-
startPosition:
|
|
1020
|
+
integrations: import_zod12.z.record(IntegrationConfigSchema),
|
|
1021
|
+
internal: import_zod12.z.boolean().default(false),
|
|
1022
|
+
enabled: import_zod12.z.boolean(),
|
|
1023
|
+
startPosition: import_zod12.z.enum([
|
|
911
1024
|
"initial",
|
|
912
1025
|
"latest"
|
|
913
1026
|
]),
|
|
914
|
-
preprocessRuns:
|
|
1027
|
+
preprocessRuns: import_zod12.z.boolean()
|
|
915
1028
|
});
|
|
916
|
-
var SourceMetadataV1Schema =
|
|
917
|
-
version:
|
|
918
|
-
channel:
|
|
1029
|
+
var SourceMetadataV1Schema = import_zod12.z.object({
|
|
1030
|
+
version: import_zod12.z.literal("1"),
|
|
1031
|
+
channel: import_zod12.z.enum([
|
|
919
1032
|
"HTTP",
|
|
920
1033
|
"SQS",
|
|
921
1034
|
"SMTP"
|
|
922
1035
|
]),
|
|
923
1036
|
integration: IntegrationConfigSchema,
|
|
924
|
-
key:
|
|
925
|
-
params:
|
|
926
|
-
events:
|
|
927
|
-
registerSourceJob:
|
|
928
|
-
id:
|
|
929
|
-
version:
|
|
1037
|
+
key: import_zod12.z.string(),
|
|
1038
|
+
params: import_zod12.z.any(),
|
|
1039
|
+
events: import_zod12.z.array(import_zod12.z.string()),
|
|
1040
|
+
registerSourceJob: import_zod12.z.object({
|
|
1041
|
+
id: import_zod12.z.string(),
|
|
1042
|
+
version: import_zod12.z.string()
|
|
930
1043
|
}).optional()
|
|
931
1044
|
});
|
|
932
|
-
var SourceMetadataV2Schema =
|
|
933
|
-
version:
|
|
934
|
-
channel:
|
|
1045
|
+
var SourceMetadataV2Schema = import_zod12.z.object({
|
|
1046
|
+
version: import_zod12.z.literal("2"),
|
|
1047
|
+
channel: import_zod12.z.enum([
|
|
935
1048
|
"HTTP",
|
|
936
1049
|
"SQS",
|
|
937
1050
|
"SMTP"
|
|
938
1051
|
]),
|
|
939
1052
|
integration: IntegrationConfigSchema,
|
|
940
|
-
key:
|
|
941
|
-
params:
|
|
942
|
-
options:
|
|
943
|
-
registerSourceJob:
|
|
944
|
-
id:
|
|
945
|
-
version:
|
|
1053
|
+
key: import_zod12.z.string(),
|
|
1054
|
+
params: import_zod12.z.any(),
|
|
1055
|
+
options: import_zod12.z.record(import_zod12.z.array(import_zod12.z.string())),
|
|
1056
|
+
registerSourceJob: import_zod12.z.object({
|
|
1057
|
+
id: import_zod12.z.string(),
|
|
1058
|
+
version: import_zod12.z.string()
|
|
946
1059
|
}).optional()
|
|
947
1060
|
});
|
|
948
|
-
var SourceMetadataSchema =
|
|
1061
|
+
var SourceMetadataSchema = import_zod12.z.preprocess(addMissingVersionField, import_zod12.z.discriminatedUnion("version", [
|
|
949
1062
|
SourceMetadataV1Schema,
|
|
950
1063
|
SourceMetadataV2Schema
|
|
951
1064
|
]));
|
|
952
|
-
var DynamicTriggerEndpointMetadataSchema =
|
|
953
|
-
id:
|
|
954
|
-
jobs:
|
|
1065
|
+
var DynamicTriggerEndpointMetadataSchema = import_zod12.z.object({
|
|
1066
|
+
id: import_zod12.z.string(),
|
|
1067
|
+
jobs: import_zod12.z.array(JobMetadataSchema.pick({
|
|
955
1068
|
id: true,
|
|
956
1069
|
version: true
|
|
957
1070
|
})),
|
|
958
|
-
registerSourceJob:
|
|
959
|
-
id:
|
|
960
|
-
version:
|
|
1071
|
+
registerSourceJob: import_zod12.z.object({
|
|
1072
|
+
id: import_zod12.z.string(),
|
|
1073
|
+
version: import_zod12.z.string()
|
|
961
1074
|
}).optional()
|
|
962
1075
|
});
|
|
963
|
-
var
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
1076
|
+
var HttpEndpointMetadataSchema = import_zod12.z.object({
|
|
1077
|
+
id: import_zod12.z.string(),
|
|
1078
|
+
version: import_zod12.z.string(),
|
|
1079
|
+
enabled: import_zod12.z.boolean(),
|
|
1080
|
+
title: import_zod12.z.string().optional(),
|
|
1081
|
+
icon: import_zod12.z.string().optional(),
|
|
1082
|
+
properties: import_zod12.z.array(DisplayPropertySchema).optional(),
|
|
1083
|
+
event: EventSpecificationSchema,
|
|
1084
|
+
immediateResponseFilter: RequestFilterSchema.optional(),
|
|
1085
|
+
skipTriggeringRuns: import_zod12.z.boolean().optional(),
|
|
1086
|
+
source: import_zod12.z.string()
|
|
1087
|
+
});
|
|
1088
|
+
var IndexEndpointResponseSchema = import_zod12.z.object({
|
|
1089
|
+
jobs: import_zod12.z.array(JobMetadataSchema),
|
|
1090
|
+
sources: import_zod12.z.array(SourceMetadataSchema),
|
|
1091
|
+
dynamicTriggers: import_zod12.z.array(DynamicTriggerEndpointMetadataSchema),
|
|
1092
|
+
dynamicSchedules: import_zod12.z.array(RegisterDynamicSchedulePayloadSchema),
|
|
1093
|
+
httpEndpoints: import_zod12.z.array(HttpEndpointMetadataSchema).optional()
|
|
1094
|
+
});
|
|
1095
|
+
var EndpointIndexErrorSchema = import_zod12.z.object({
|
|
1096
|
+
message: import_zod12.z.string(),
|
|
1097
|
+
raw: import_zod12.z.any().optional()
|
|
1098
|
+
});
|
|
1099
|
+
var IndexEndpointStatsSchema = import_zod12.z.object({
|
|
1100
|
+
jobs: import_zod12.z.number(),
|
|
1101
|
+
sources: import_zod12.z.number(),
|
|
1102
|
+
dynamicTriggers: import_zod12.z.number(),
|
|
1103
|
+
dynamicSchedules: import_zod12.z.number(),
|
|
1104
|
+
disabledJobs: import_zod12.z.number().default(0),
|
|
1105
|
+
httpEndpoints: import_zod12.z.number().default(0)
|
|
979
1106
|
});
|
|
980
1107
|
function parseEndpointIndexStats(stats) {
|
|
981
1108
|
if (stats === null || stats === void 0) {
|
|
@@ -984,208 +1111,220 @@ function parseEndpointIndexStats(stats) {
|
|
|
984
1111
|
return IndexEndpointStatsSchema.parse(stats);
|
|
985
1112
|
}
|
|
986
1113
|
__name(parseEndpointIndexStats, "parseEndpointIndexStats");
|
|
987
|
-
var GetEndpointIndexResponseSchema =
|
|
988
|
-
|
|
989
|
-
status:
|
|
990
|
-
updatedAt:
|
|
1114
|
+
var GetEndpointIndexResponseSchema = import_zod12.z.discriminatedUnion("status", [
|
|
1115
|
+
import_zod12.z.object({
|
|
1116
|
+
status: import_zod12.z.literal("PENDING"),
|
|
1117
|
+
updatedAt: import_zod12.z.coerce.date()
|
|
991
1118
|
}),
|
|
992
|
-
|
|
993
|
-
status:
|
|
994
|
-
updatedAt:
|
|
1119
|
+
import_zod12.z.object({
|
|
1120
|
+
status: import_zod12.z.literal("STARTED"),
|
|
1121
|
+
updatedAt: import_zod12.z.coerce.date()
|
|
995
1122
|
}),
|
|
996
|
-
|
|
997
|
-
status:
|
|
1123
|
+
import_zod12.z.object({
|
|
1124
|
+
status: import_zod12.z.literal("SUCCESS"),
|
|
998
1125
|
stats: IndexEndpointStatsSchema,
|
|
999
|
-
updatedAt:
|
|
1126
|
+
updatedAt: import_zod12.z.coerce.date()
|
|
1000
1127
|
}),
|
|
1001
|
-
|
|
1002
|
-
status:
|
|
1128
|
+
import_zod12.z.object({
|
|
1129
|
+
status: import_zod12.z.literal("FAILURE"),
|
|
1003
1130
|
error: EndpointIndexErrorSchema,
|
|
1004
|
-
updatedAt:
|
|
1131
|
+
updatedAt: import_zod12.z.coerce.date()
|
|
1005
1132
|
})
|
|
1006
1133
|
]);
|
|
1007
|
-
var EndpointHeadersSchema =
|
|
1008
|
-
"trigger-version":
|
|
1009
|
-
"trigger-sdk-version":
|
|
1134
|
+
var EndpointHeadersSchema = import_zod12.z.object({
|
|
1135
|
+
"trigger-version": import_zod12.z.string().optional(),
|
|
1136
|
+
"trigger-sdk-version": import_zod12.z.string().optional()
|
|
1010
1137
|
});
|
|
1011
|
-
var RawEventSchema =
|
|
1138
|
+
var RawEventSchema = import_zod12.z.object({
|
|
1012
1139
|
/** The `name` property must exactly match any subscriptions you want to
|
|
1013
1140
|
trigger. */
|
|
1014
|
-
name:
|
|
1141
|
+
name: import_zod12.z.string(),
|
|
1015
1142
|
/** The `payload` property will be sent to any matching Jobs and will appear
|
|
1016
1143
|
as the `payload` param of the `run()` function. You can leave this
|
|
1017
1144
|
parameter out if you just want to trigger a Job without any input data. */
|
|
1018
|
-
payload:
|
|
1145
|
+
payload: import_zod12.z.any(),
|
|
1019
1146
|
/** The optional `context` property will be sent to any matching Jobs and will
|
|
1020
1147
|
be passed through as the `context.event.context` param of the `run()`
|
|
1021
1148
|
function. This is optional but can be useful if you want to pass through
|
|
1022
1149
|
some additional context to the Job. */
|
|
1023
|
-
context:
|
|
1150
|
+
context: import_zod12.z.any().optional(),
|
|
1024
1151
|
/** The `id` property uniquely identify this particular event. If unset it
|
|
1025
1152
|
will be set automatically using `ulid`. */
|
|
1026
|
-
id:
|
|
1153
|
+
id: import_zod12.z.string().default(() => (0, import_ulid.ulid)()),
|
|
1027
1154
|
/** This is optional, it defaults to the current timestamp. Usually you would
|
|
1028
1155
|
only set this if you have a timestamp that you wish to pass through, e.g.
|
|
1029
1156
|
you receive a timestamp from a service and you want the same timestamp to
|
|
1030
1157
|
be used in your Job. */
|
|
1031
|
-
timestamp:
|
|
1158
|
+
timestamp: import_zod12.z.coerce.date().optional(),
|
|
1032
1159
|
/** This is optional, it defaults to "trigger.dev". It can be useful to set
|
|
1033
1160
|
this as you can filter events using this in the `eventTrigger()`. */
|
|
1034
|
-
source:
|
|
1161
|
+
source: import_zod12.z.string().optional(),
|
|
1162
|
+
/** This is optional, it defaults to "JSON". If your event is actually a request,
|
|
1163
|
+
with a url, headers, method and rawBody you can use "REQUEST" */
|
|
1164
|
+
payloadType: import_zod12.z.union([
|
|
1165
|
+
import_zod12.z.literal("JSON"),
|
|
1166
|
+
import_zod12.z.literal("REQUEST")
|
|
1167
|
+
]).optional()
|
|
1035
1168
|
});
|
|
1036
|
-
var ApiEventLogSchema =
|
|
1169
|
+
var ApiEventLogSchema = import_zod12.z.object({
|
|
1037
1170
|
/** The `id` of the event that was sent.
|
|
1038
1171
|
*/
|
|
1039
|
-
id:
|
|
1172
|
+
id: import_zod12.z.string(),
|
|
1040
1173
|
/** The `name` of the event that was sent. */
|
|
1041
|
-
name:
|
|
1174
|
+
name: import_zod12.z.string(),
|
|
1042
1175
|
/** The `payload` of the event that was sent */
|
|
1043
1176
|
payload: DeserializedJsonSchema,
|
|
1044
1177
|
/** The `context` of the event that was sent. Is `undefined` if no context was
|
|
1045
1178
|
set when sending the event. */
|
|
1046
1179
|
context: DeserializedJsonSchema.optional().nullable(),
|
|
1047
1180
|
/** The `timestamp` of the event that was sent */
|
|
1048
|
-
timestamp:
|
|
1181
|
+
timestamp: import_zod12.z.coerce.date(),
|
|
1049
1182
|
/** The timestamp when the event will be delivered to any matching Jobs. Is
|
|
1050
1183
|
`undefined` if `deliverAt` or `deliverAfter` wasn't set when sending the
|
|
1051
1184
|
event. */
|
|
1052
|
-
deliverAt:
|
|
1185
|
+
deliverAt: import_zod12.z.coerce.date().optional().nullable(),
|
|
1053
1186
|
/** The timestamp when the event was delivered. Is `undefined` if `deliverAt`
|
|
1054
1187
|
or `deliverAfter` were set when sending the event. */
|
|
1055
|
-
deliveredAt:
|
|
1188
|
+
deliveredAt: import_zod12.z.coerce.date().optional().nullable(),
|
|
1056
1189
|
/** The timestamp when the event was cancelled. Is `undefined` if the event
|
|
1057
1190
|
* wasn't cancelled. */
|
|
1058
|
-
cancelledAt:
|
|
1191
|
+
cancelledAt: import_zod12.z.coerce.date().optional().nullable()
|
|
1059
1192
|
});
|
|
1060
|
-
var SendEventOptionsSchema =
|
|
1193
|
+
var SendEventOptionsSchema = import_zod12.z.object({
|
|
1061
1194
|
/** An optional Date when you want the event to trigger Jobs. The event will
|
|
1062
1195
|
be sent to the platform immediately but won't be acted upon until the
|
|
1063
1196
|
specified time. */
|
|
1064
|
-
deliverAt:
|
|
1197
|
+
deliverAt: import_zod12.z.coerce.date().optional(),
|
|
1065
1198
|
/** An optional number of seconds you want to wait for the event to trigger
|
|
1066
1199
|
any relevant Jobs. The event will be sent to the platform immediately but
|
|
1067
1200
|
won't be delivered until after the elapsed number of seconds. */
|
|
1068
|
-
deliverAfter:
|
|
1201
|
+
deliverAfter: import_zod12.z.number().int().optional(),
|
|
1069
1202
|
/** This optional param will be used by Trigger.dev Connect, which
|
|
1070
1203
|
is coming soon. */
|
|
1071
|
-
accountId:
|
|
1204
|
+
accountId: import_zod12.z.string().optional()
|
|
1072
1205
|
});
|
|
1073
|
-
var SendEventBodySchema =
|
|
1206
|
+
var SendEventBodySchema = import_zod12.z.object({
|
|
1074
1207
|
event: RawEventSchema,
|
|
1075
1208
|
options: SendEventOptionsSchema.optional()
|
|
1076
1209
|
});
|
|
1077
|
-
var
|
|
1078
|
-
|
|
1210
|
+
var SendBulkEventsBodySchema = import_zod12.z.object({
|
|
1211
|
+
events: RawEventSchema.array(),
|
|
1212
|
+
options: SendEventOptionsSchema.optional()
|
|
1213
|
+
});
|
|
1214
|
+
var DeliverEventResponseSchema = import_zod12.z.object({
|
|
1215
|
+
deliveredAt: import_zod12.z.string().datetime()
|
|
1079
1216
|
});
|
|
1080
|
-
var RuntimeEnvironmentTypeSchema =
|
|
1217
|
+
var RuntimeEnvironmentTypeSchema = import_zod12.z.enum([
|
|
1081
1218
|
"PRODUCTION",
|
|
1082
1219
|
"STAGING",
|
|
1083
1220
|
"DEVELOPMENT",
|
|
1084
1221
|
"PREVIEW"
|
|
1085
1222
|
]);
|
|
1086
|
-
var RunSourceContextSchema =
|
|
1087
|
-
id:
|
|
1088
|
-
metadata:
|
|
1223
|
+
var RunSourceContextSchema = import_zod12.z.object({
|
|
1224
|
+
id: import_zod12.z.string(),
|
|
1225
|
+
metadata: import_zod12.z.any()
|
|
1089
1226
|
});
|
|
1090
|
-
var AutoYieldConfigSchema =
|
|
1091
|
-
startTaskThreshold:
|
|
1092
|
-
beforeExecuteTaskThreshold:
|
|
1093
|
-
beforeCompleteTaskThreshold:
|
|
1094
|
-
afterCompleteTaskThreshold:
|
|
1227
|
+
var AutoYieldConfigSchema = import_zod12.z.object({
|
|
1228
|
+
startTaskThreshold: import_zod12.z.number(),
|
|
1229
|
+
beforeExecuteTaskThreshold: import_zod12.z.number(),
|
|
1230
|
+
beforeCompleteTaskThreshold: import_zod12.z.number(),
|
|
1231
|
+
afterCompleteTaskThreshold: import_zod12.z.number()
|
|
1095
1232
|
});
|
|
1096
|
-
var RunJobBodySchema =
|
|
1233
|
+
var RunJobBodySchema = import_zod12.z.object({
|
|
1097
1234
|
event: ApiEventLogSchema,
|
|
1098
|
-
job:
|
|
1099
|
-
id:
|
|
1100
|
-
version:
|
|
1235
|
+
job: import_zod12.z.object({
|
|
1236
|
+
id: import_zod12.z.string(),
|
|
1237
|
+
version: import_zod12.z.string()
|
|
1101
1238
|
}),
|
|
1102
|
-
run:
|
|
1103
|
-
id:
|
|
1104
|
-
isTest:
|
|
1105
|
-
isRetry:
|
|
1106
|
-
startedAt:
|
|
1239
|
+
run: import_zod12.z.object({
|
|
1240
|
+
id: import_zod12.z.string(),
|
|
1241
|
+
isTest: import_zod12.z.boolean(),
|
|
1242
|
+
isRetry: import_zod12.z.boolean().default(false),
|
|
1243
|
+
startedAt: import_zod12.z.coerce.date()
|
|
1107
1244
|
}),
|
|
1108
|
-
environment:
|
|
1109
|
-
id:
|
|
1110
|
-
slug:
|
|
1245
|
+
environment: import_zod12.z.object({
|
|
1246
|
+
id: import_zod12.z.string(),
|
|
1247
|
+
slug: import_zod12.z.string(),
|
|
1111
1248
|
type: RuntimeEnvironmentTypeSchema
|
|
1112
1249
|
}),
|
|
1113
|
-
organization:
|
|
1114
|
-
id:
|
|
1115
|
-
title:
|
|
1116
|
-
slug:
|
|
1250
|
+
organization: import_zod12.z.object({
|
|
1251
|
+
id: import_zod12.z.string(),
|
|
1252
|
+
title: import_zod12.z.string(),
|
|
1253
|
+
slug: import_zod12.z.string()
|
|
1117
1254
|
}),
|
|
1118
|
-
|
|
1119
|
-
id:
|
|
1120
|
-
|
|
1255
|
+
project: import_zod12.z.object({
|
|
1256
|
+
id: import_zod12.z.string(),
|
|
1257
|
+
name: import_zod12.z.string(),
|
|
1258
|
+
slug: import_zod12.z.string()
|
|
1259
|
+
}).optional(),
|
|
1260
|
+
account: import_zod12.z.object({
|
|
1261
|
+
id: import_zod12.z.string(),
|
|
1262
|
+
metadata: import_zod12.z.any()
|
|
1121
1263
|
}).optional(),
|
|
1122
1264
|
source: RunSourceContextSchema.optional(),
|
|
1123
|
-
tasks:
|
|
1124
|
-
cachedTaskCursor:
|
|
1125
|
-
noopTasksSet:
|
|
1126
|
-
connections:
|
|
1127
|
-
yieldedExecutions:
|
|
1128
|
-
runChunkExecutionLimit:
|
|
1265
|
+
tasks: import_zod12.z.array(CachedTaskSchema).optional(),
|
|
1266
|
+
cachedTaskCursor: import_zod12.z.string().optional(),
|
|
1267
|
+
noopTasksSet: import_zod12.z.string().optional(),
|
|
1268
|
+
connections: import_zod12.z.record(ConnectionAuthSchema).optional(),
|
|
1269
|
+
yieldedExecutions: import_zod12.z.string().array().optional(),
|
|
1270
|
+
runChunkExecutionLimit: import_zod12.z.number().optional(),
|
|
1129
1271
|
autoYieldConfig: AutoYieldConfigSchema.optional()
|
|
1130
1272
|
});
|
|
1131
|
-
var RunJobErrorSchema =
|
|
1132
|
-
status:
|
|
1273
|
+
var RunJobErrorSchema = import_zod12.z.object({
|
|
1274
|
+
status: import_zod12.z.literal("ERROR"),
|
|
1133
1275
|
error: ErrorWithStackSchema,
|
|
1134
1276
|
task: TaskSchema.optional()
|
|
1135
1277
|
});
|
|
1136
|
-
var RunJobYieldExecutionErrorSchema =
|
|
1137
|
-
status:
|
|
1138
|
-
key:
|
|
1139
|
-
});
|
|
1140
|
-
var
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
status: import_zod11.z.literal("AUTO_YIELD_EXECUTION_WITH_COMPLETED_TASK"),
|
|
1149
|
-
id: import_zod11.z.string(),
|
|
1150
|
-
properties: import_zod11.z.array(DisplayPropertySchema).optional(),
|
|
1151
|
-
output: import_zod11.z.any(),
|
|
1152
|
-
data: import_zod11.z.object({
|
|
1153
|
-
location: import_zod11.z.string(),
|
|
1154
|
-
timeRemaining: import_zod11.z.number(),
|
|
1155
|
-
timeElapsed: import_zod11.z.number(),
|
|
1156
|
-
limit: import_zod11.z.number().optional()
|
|
1157
|
-
})
|
|
1278
|
+
var RunJobYieldExecutionErrorSchema = import_zod12.z.object({
|
|
1279
|
+
status: import_zod12.z.literal("YIELD_EXECUTION"),
|
|
1280
|
+
key: import_zod12.z.string()
|
|
1281
|
+
});
|
|
1282
|
+
var AutoYieldMetadataSchema = import_zod12.z.object({
|
|
1283
|
+
location: import_zod12.z.string(),
|
|
1284
|
+
timeRemaining: import_zod12.z.number(),
|
|
1285
|
+
timeElapsed: import_zod12.z.number(),
|
|
1286
|
+
limit: import_zod12.z.number().optional()
|
|
1287
|
+
});
|
|
1288
|
+
var RunJobAutoYieldExecutionErrorSchema = AutoYieldMetadataSchema.extend({
|
|
1289
|
+
status: import_zod12.z.literal("AUTO_YIELD_EXECUTION")
|
|
1158
1290
|
});
|
|
1159
|
-
var
|
|
1160
|
-
status:
|
|
1161
|
-
|
|
1291
|
+
var RunJobAutoYieldWithCompletedTaskExecutionErrorSchema = import_zod12.z.object({
|
|
1292
|
+
status: import_zod12.z.literal("AUTO_YIELD_EXECUTION_WITH_COMPLETED_TASK"),
|
|
1293
|
+
id: import_zod12.z.string(),
|
|
1294
|
+
properties: import_zod12.z.array(DisplayPropertySchema).optional(),
|
|
1295
|
+
output: import_zod12.z.string().optional(),
|
|
1296
|
+
data: AutoYieldMetadataSchema
|
|
1297
|
+
});
|
|
1298
|
+
var RunJobInvalidPayloadErrorSchema = import_zod12.z.object({
|
|
1299
|
+
status: import_zod12.z.literal("INVALID_PAYLOAD"),
|
|
1300
|
+
errors: import_zod12.z.array(SchemaErrorSchema)
|
|
1162
1301
|
});
|
|
1163
|
-
var RunJobUnresolvedAuthErrorSchema =
|
|
1164
|
-
status:
|
|
1165
|
-
issues:
|
|
1166
|
-
id:
|
|
1167
|
-
error:
|
|
1302
|
+
var RunJobUnresolvedAuthErrorSchema = import_zod12.z.object({
|
|
1303
|
+
status: import_zod12.z.literal("UNRESOLVED_AUTH_ERROR"),
|
|
1304
|
+
issues: import_zod12.z.record(import_zod12.z.object({
|
|
1305
|
+
id: import_zod12.z.string(),
|
|
1306
|
+
error: import_zod12.z.string()
|
|
1168
1307
|
}))
|
|
1169
1308
|
});
|
|
1170
|
-
var RunJobResumeWithTaskSchema =
|
|
1171
|
-
status:
|
|
1309
|
+
var RunJobResumeWithTaskSchema = import_zod12.z.object({
|
|
1310
|
+
status: import_zod12.z.literal("RESUME_WITH_TASK"),
|
|
1172
1311
|
task: TaskSchema
|
|
1173
1312
|
});
|
|
1174
|
-
var RunJobRetryWithTaskSchema =
|
|
1175
|
-
status:
|
|
1313
|
+
var RunJobRetryWithTaskSchema = import_zod12.z.object({
|
|
1314
|
+
status: import_zod12.z.literal("RETRY_WITH_TASK"),
|
|
1176
1315
|
task: TaskSchema,
|
|
1177
1316
|
error: ErrorWithStackSchema,
|
|
1178
|
-
retryAt:
|
|
1317
|
+
retryAt: import_zod12.z.coerce.date()
|
|
1179
1318
|
});
|
|
1180
|
-
var RunJobCanceledWithTaskSchema =
|
|
1181
|
-
status:
|
|
1319
|
+
var RunJobCanceledWithTaskSchema = import_zod12.z.object({
|
|
1320
|
+
status: import_zod12.z.literal("CANCELED"),
|
|
1182
1321
|
task: TaskSchema
|
|
1183
1322
|
});
|
|
1184
|
-
var RunJobSuccessSchema =
|
|
1185
|
-
status:
|
|
1323
|
+
var RunJobSuccessSchema = import_zod12.z.object({
|
|
1324
|
+
status: import_zod12.z.literal("SUCCESS"),
|
|
1186
1325
|
output: DeserializedJsonSchema.optional()
|
|
1187
1326
|
});
|
|
1188
|
-
var
|
|
1327
|
+
var RunJobErrorResponseSchema = import_zod12.z.union([
|
|
1189
1328
|
RunJobAutoYieldExecutionErrorSchema,
|
|
1190
1329
|
RunJobAutoYieldWithCompletedTaskExecutionErrorSchema,
|
|
1191
1330
|
RunJobYieldExecutionErrorSchema,
|
|
@@ -1194,138 +1333,158 @@ var RunJobResponseSchema = import_zod11.z.discriminatedUnion("status", [
|
|
|
1194
1333
|
RunJobInvalidPayloadErrorSchema,
|
|
1195
1334
|
RunJobResumeWithTaskSchema,
|
|
1196
1335
|
RunJobRetryWithTaskSchema,
|
|
1336
|
+
RunJobCanceledWithTaskSchema
|
|
1337
|
+
]);
|
|
1338
|
+
var RunJobResumeWithParallelTaskSchema = import_zod12.z.object({
|
|
1339
|
+
status: import_zod12.z.literal("RESUME_WITH_PARALLEL_TASK"),
|
|
1340
|
+
task: TaskSchema,
|
|
1341
|
+
childErrors: import_zod12.z.array(RunJobErrorResponseSchema)
|
|
1342
|
+
});
|
|
1343
|
+
var RunJobResponseSchema = import_zod12.z.discriminatedUnion("status", [
|
|
1344
|
+
RunJobAutoYieldExecutionErrorSchema,
|
|
1345
|
+
RunJobAutoYieldWithCompletedTaskExecutionErrorSchema,
|
|
1346
|
+
RunJobYieldExecutionErrorSchema,
|
|
1347
|
+
RunJobErrorSchema,
|
|
1348
|
+
RunJobUnresolvedAuthErrorSchema,
|
|
1349
|
+
RunJobInvalidPayloadErrorSchema,
|
|
1350
|
+
RunJobResumeWithTaskSchema,
|
|
1351
|
+
RunJobResumeWithParallelTaskSchema,
|
|
1352
|
+
RunJobRetryWithTaskSchema,
|
|
1197
1353
|
RunJobCanceledWithTaskSchema,
|
|
1198
1354
|
RunJobSuccessSchema
|
|
1199
1355
|
]);
|
|
1200
|
-
var PreprocessRunBodySchema =
|
|
1356
|
+
var PreprocessRunBodySchema = import_zod12.z.object({
|
|
1201
1357
|
event: ApiEventLogSchema,
|
|
1202
|
-
job:
|
|
1203
|
-
id:
|
|
1204
|
-
version:
|
|
1358
|
+
job: import_zod12.z.object({
|
|
1359
|
+
id: import_zod12.z.string(),
|
|
1360
|
+
version: import_zod12.z.string()
|
|
1205
1361
|
}),
|
|
1206
|
-
run:
|
|
1207
|
-
id:
|
|
1208
|
-
isTest:
|
|
1362
|
+
run: import_zod12.z.object({
|
|
1363
|
+
id: import_zod12.z.string(),
|
|
1364
|
+
isTest: import_zod12.z.boolean()
|
|
1209
1365
|
}),
|
|
1210
|
-
environment:
|
|
1211
|
-
id:
|
|
1212
|
-
slug:
|
|
1366
|
+
environment: import_zod12.z.object({
|
|
1367
|
+
id: import_zod12.z.string(),
|
|
1368
|
+
slug: import_zod12.z.string(),
|
|
1213
1369
|
type: RuntimeEnvironmentTypeSchema
|
|
1214
1370
|
}),
|
|
1215
|
-
organization:
|
|
1216
|
-
id:
|
|
1217
|
-
title:
|
|
1218
|
-
slug:
|
|
1371
|
+
organization: import_zod12.z.object({
|
|
1372
|
+
id: import_zod12.z.string(),
|
|
1373
|
+
title: import_zod12.z.string(),
|
|
1374
|
+
slug: import_zod12.z.string()
|
|
1219
1375
|
}),
|
|
1220
|
-
account:
|
|
1221
|
-
id:
|
|
1222
|
-
metadata:
|
|
1376
|
+
account: import_zod12.z.object({
|
|
1377
|
+
id: import_zod12.z.string(),
|
|
1378
|
+
metadata: import_zod12.z.any()
|
|
1223
1379
|
}).optional()
|
|
1224
1380
|
});
|
|
1225
|
-
var PreprocessRunResponseSchema =
|
|
1226
|
-
abort:
|
|
1227
|
-
properties:
|
|
1381
|
+
var PreprocessRunResponseSchema = import_zod12.z.object({
|
|
1382
|
+
abort: import_zod12.z.boolean(),
|
|
1383
|
+
properties: import_zod12.z.array(DisplayPropertySchema).optional()
|
|
1228
1384
|
});
|
|
1229
|
-
var CreateRunResponseOkSchema =
|
|
1230
|
-
ok:
|
|
1231
|
-
data:
|
|
1232
|
-
id:
|
|
1385
|
+
var CreateRunResponseOkSchema = import_zod12.z.object({
|
|
1386
|
+
ok: import_zod12.z.literal(true),
|
|
1387
|
+
data: import_zod12.z.object({
|
|
1388
|
+
id: import_zod12.z.string()
|
|
1233
1389
|
})
|
|
1234
1390
|
});
|
|
1235
|
-
var CreateRunResponseErrorSchema =
|
|
1236
|
-
ok:
|
|
1237
|
-
error:
|
|
1391
|
+
var CreateRunResponseErrorSchema = import_zod12.z.object({
|
|
1392
|
+
ok: import_zod12.z.literal(false),
|
|
1393
|
+
error: import_zod12.z.string()
|
|
1238
1394
|
});
|
|
1239
|
-
var CreateRunResponseBodySchema =
|
|
1395
|
+
var CreateRunResponseBodySchema = import_zod12.z.discriminatedUnion("ok", [
|
|
1240
1396
|
CreateRunResponseOkSchema,
|
|
1241
1397
|
CreateRunResponseErrorSchema
|
|
1242
1398
|
]);
|
|
1243
|
-
var RedactStringSchema =
|
|
1244
|
-
__redactedString:
|
|
1245
|
-
strings:
|
|
1246
|
-
interpolations:
|
|
1399
|
+
var RedactStringSchema = import_zod12.z.object({
|
|
1400
|
+
__redactedString: import_zod12.z.literal(true),
|
|
1401
|
+
strings: import_zod12.z.array(import_zod12.z.string()),
|
|
1402
|
+
interpolations: import_zod12.z.array(import_zod12.z.string())
|
|
1247
1403
|
});
|
|
1248
|
-
var LogMessageSchema =
|
|
1249
|
-
level:
|
|
1404
|
+
var LogMessageSchema = import_zod12.z.object({
|
|
1405
|
+
level: import_zod12.z.enum([
|
|
1250
1406
|
"DEBUG",
|
|
1251
1407
|
"INFO",
|
|
1252
1408
|
"WARN",
|
|
1253
1409
|
"ERROR"
|
|
1254
1410
|
]),
|
|
1255
|
-
message:
|
|
1411
|
+
message: import_zod12.z.string(),
|
|
1256
1412
|
data: SerializableJsonSchema.optional()
|
|
1257
1413
|
});
|
|
1258
|
-
var RedactSchema =
|
|
1259
|
-
paths:
|
|
1414
|
+
var RedactSchema = import_zod12.z.object({
|
|
1415
|
+
paths: import_zod12.z.array(import_zod12.z.string())
|
|
1260
1416
|
});
|
|
1261
|
-
var RetryOptionsSchema =
|
|
1417
|
+
var RetryOptionsSchema = import_zod12.z.object({
|
|
1262
1418
|
/** The maximum number of times to retry the request. */
|
|
1263
|
-
limit:
|
|
1419
|
+
limit: import_zod12.z.number().optional(),
|
|
1264
1420
|
/** The exponential factor to use when calculating the next retry time. */
|
|
1265
|
-
factor:
|
|
1421
|
+
factor: import_zod12.z.number().optional(),
|
|
1266
1422
|
/** The minimum amount of time to wait before retrying the request. */
|
|
1267
|
-
minTimeoutInMs:
|
|
1423
|
+
minTimeoutInMs: import_zod12.z.number().optional(),
|
|
1268
1424
|
/** The maximum amount of time to wait before retrying the request. */
|
|
1269
|
-
maxTimeoutInMs:
|
|
1425
|
+
maxTimeoutInMs: import_zod12.z.number().optional(),
|
|
1270
1426
|
/** Whether to randomize the retry time. */
|
|
1271
|
-
randomize:
|
|
1427
|
+
randomize: import_zod12.z.boolean().optional()
|
|
1272
1428
|
});
|
|
1273
|
-
var RunTaskOptionsSchema =
|
|
1429
|
+
var RunTaskOptionsSchema = import_zod12.z.object({
|
|
1274
1430
|
/** The name of the Task is required. This is displayed on the Task in the logs. */
|
|
1275
|
-
name:
|
|
1431
|
+
name: import_zod12.z.string().optional(),
|
|
1276
1432
|
/** The Task will wait and only start at the specified Date */
|
|
1277
|
-
delayUntil:
|
|
1433
|
+
delayUntil: import_zod12.z.coerce.date().optional(),
|
|
1278
1434
|
/** Retry options */
|
|
1279
1435
|
retry: RetryOptionsSchema.optional(),
|
|
1280
1436
|
/** The icon for the Task, it will appear in the logs.
|
|
1281
1437
|
* You can use the name of a company in lowercase, e.g. "github".
|
|
1282
1438
|
* Or any icon name that [Tabler Icons](https://tabler-icons.io/) supports. */
|
|
1283
|
-
icon:
|
|
1439
|
+
icon: import_zod12.z.string().optional(),
|
|
1284
1440
|
/** The key for the Task that you want to appear in the logs */
|
|
1285
|
-
displayKey:
|
|
1441
|
+
displayKey: import_zod12.z.string().optional(),
|
|
1286
1442
|
/** A description of the Task */
|
|
1287
|
-
description:
|
|
1443
|
+
description: import_zod12.z.string().optional(),
|
|
1288
1444
|
/** Properties that are displayed in the logs */
|
|
1289
|
-
properties:
|
|
1445
|
+
properties: import_zod12.z.array(DisplayPropertySchema).optional(),
|
|
1290
1446
|
/** The input params to the Task, will be displayed in the logs */
|
|
1291
|
-
params:
|
|
1447
|
+
params: import_zod12.z.any(),
|
|
1292
1448
|
/** The style of the log entry. */
|
|
1293
1449
|
style: StyleSchema.optional(),
|
|
1294
1450
|
/** Allows you to expose a `task.callbackUrl` to use in your tasks. Enabling this feature will cause the task to return the data sent to the callbackUrl instead of the usual async callback result. */
|
|
1295
|
-
callback:
|
|
1451
|
+
callback: import_zod12.z.object({
|
|
1296
1452
|
/** Causes the task to wait for and return the data of the first request sent to `task.callbackUrl`. */
|
|
1297
|
-
enabled:
|
|
1453
|
+
enabled: import_zod12.z.boolean(),
|
|
1298
1454
|
/** Time to wait for the first request to `task.callbackUrl`. Default: One hour. */
|
|
1299
|
-
timeoutInSeconds:
|
|
1455
|
+
timeoutInSeconds: import_zod12.z.number()
|
|
1300
1456
|
}).partial().optional(),
|
|
1301
1457
|
/** Allows you to link the Integration connection in the logs. This is handled automatically in integrations. */
|
|
1302
|
-
connectionKey:
|
|
1303
|
-
/** An operation you want to perform on the Trigger.dev platform, current only "fetch" is supported. If you wish to `fetch` use [`io.backgroundFetch()`](https://trigger.dev/docs/sdk/io/backgroundfetch) instead. */
|
|
1304
|
-
operation:
|
|
1305
|
-
"fetch"
|
|
1458
|
+
connectionKey: import_zod12.z.string().optional(),
|
|
1459
|
+
/** An operation you want to perform on the Trigger.dev platform, current only "fetch", "fetch-response", and "fetch-poll" is supported. If you wish to `fetch` use [`io.backgroundFetch()`](https://trigger.dev/docs/sdk/io/backgroundfetch) instead. */
|
|
1460
|
+
operation: import_zod12.z.enum([
|
|
1461
|
+
"fetch",
|
|
1462
|
+
"fetch-response",
|
|
1463
|
+
"fetch-poll"
|
|
1306
1464
|
]).optional(),
|
|
1307
1465
|
/** A No Operation means that the code won't be executed. This is used internally to implement features like [io.wait()](https://trigger.dev/docs/sdk/io/wait). */
|
|
1308
|
-
noop:
|
|
1466
|
+
noop: import_zod12.z.boolean().default(false),
|
|
1309
1467
|
redact: RedactSchema.optional(),
|
|
1310
|
-
trigger: TriggerMetadataSchema.optional()
|
|
1468
|
+
trigger: TriggerMetadataSchema.optional(),
|
|
1469
|
+
parallel: import_zod12.z.boolean().optional()
|
|
1311
1470
|
});
|
|
1312
1471
|
var RunTaskBodyInputSchema = RunTaskOptionsSchema.extend({
|
|
1313
|
-
idempotencyKey:
|
|
1314
|
-
parentId:
|
|
1472
|
+
idempotencyKey: import_zod12.z.string(),
|
|
1473
|
+
parentId: import_zod12.z.string().optional()
|
|
1315
1474
|
});
|
|
1316
1475
|
var RunTaskBodyOutputSchema = RunTaskBodyInputSchema.extend({
|
|
1317
|
-
properties:
|
|
1476
|
+
properties: import_zod12.z.array(DisplayPropertySchema.partial()).optional(),
|
|
1318
1477
|
params: DeserializedJsonSchema.optional().nullable(),
|
|
1319
|
-
callback:
|
|
1320
|
-
enabled:
|
|
1321
|
-
timeoutInSeconds:
|
|
1478
|
+
callback: import_zod12.z.object({
|
|
1479
|
+
enabled: import_zod12.z.boolean(),
|
|
1480
|
+
timeoutInSeconds: import_zod12.z.number().default(3600)
|
|
1322
1481
|
}).optional()
|
|
1323
1482
|
});
|
|
1324
|
-
var RunTaskResponseWithCachedTasksBodySchema =
|
|
1483
|
+
var RunTaskResponseWithCachedTasksBodySchema = import_zod12.z.object({
|
|
1325
1484
|
task: ServerTaskSchema,
|
|
1326
|
-
cachedTasks:
|
|
1327
|
-
tasks:
|
|
1328
|
-
cursor:
|
|
1485
|
+
cachedTasks: import_zod12.z.object({
|
|
1486
|
+
tasks: import_zod12.z.array(CachedTaskSchema),
|
|
1487
|
+
cursor: import_zod12.z.string().optional()
|
|
1329
1488
|
}).optional()
|
|
1330
1489
|
});
|
|
1331
1490
|
var CompleteTaskBodyInputSchema = RunTaskBodyInputSchema.pick({
|
|
@@ -1335,202 +1494,271 @@ var CompleteTaskBodyInputSchema = RunTaskBodyInputSchema.pick({
|
|
|
1335
1494
|
}).extend({
|
|
1336
1495
|
output: SerializableJsonSchema.optional().transform((v) => v ? DeserializedJsonSchema.parse(JSON.parse(JSON.stringify(v))) : {})
|
|
1337
1496
|
});
|
|
1338
|
-
var
|
|
1497
|
+
var CompleteTaskBodyV2InputSchema = RunTaskBodyInputSchema.pick({
|
|
1498
|
+
properties: true,
|
|
1499
|
+
description: true,
|
|
1500
|
+
params: true
|
|
1501
|
+
}).extend({
|
|
1502
|
+
output: import_zod12.z.string().optional()
|
|
1503
|
+
});
|
|
1504
|
+
var FailTaskBodyInputSchema = import_zod12.z.object({
|
|
1339
1505
|
error: ErrorWithStackSchema
|
|
1340
1506
|
});
|
|
1341
|
-
var NormalizedRequestSchema =
|
|
1342
|
-
headers:
|
|
1343
|
-
method:
|
|
1344
|
-
query:
|
|
1345
|
-
url:
|
|
1346
|
-
body:
|
|
1507
|
+
var NormalizedRequestSchema = import_zod12.z.object({
|
|
1508
|
+
headers: import_zod12.z.record(import_zod12.z.string()),
|
|
1509
|
+
method: import_zod12.z.string(),
|
|
1510
|
+
query: import_zod12.z.record(import_zod12.z.string()),
|
|
1511
|
+
url: import_zod12.z.string(),
|
|
1512
|
+
body: import_zod12.z.any()
|
|
1347
1513
|
});
|
|
1348
|
-
var NormalizedResponseSchema =
|
|
1349
|
-
status:
|
|
1350
|
-
body:
|
|
1351
|
-
headers:
|
|
1514
|
+
var NormalizedResponseSchema = import_zod12.z.object({
|
|
1515
|
+
status: import_zod12.z.number(),
|
|
1516
|
+
body: import_zod12.z.any(),
|
|
1517
|
+
headers: import_zod12.z.record(import_zod12.z.string()).optional()
|
|
1352
1518
|
});
|
|
1353
|
-
var HttpSourceResponseSchema =
|
|
1519
|
+
var HttpSourceResponseSchema = import_zod12.z.object({
|
|
1354
1520
|
response: NormalizedResponseSchema,
|
|
1355
|
-
events:
|
|
1521
|
+
events: import_zod12.z.array(RawEventSchema),
|
|
1356
1522
|
metadata: HttpSourceResponseMetadataSchema.optional()
|
|
1357
1523
|
});
|
|
1358
|
-
var RegisterTriggerBodySchemaV1 =
|
|
1524
|
+
var RegisterTriggerBodySchemaV1 = import_zod12.z.object({
|
|
1359
1525
|
rule: EventRuleSchema,
|
|
1360
1526
|
source: SourceMetadataV1Schema
|
|
1361
1527
|
});
|
|
1362
|
-
var RegisterTriggerBodySchemaV2 =
|
|
1528
|
+
var RegisterTriggerBodySchemaV2 = import_zod12.z.object({
|
|
1363
1529
|
rule: EventRuleSchema,
|
|
1364
1530
|
source: SourceMetadataV2Schema,
|
|
1365
|
-
accountId:
|
|
1531
|
+
accountId: import_zod12.z.string().optional()
|
|
1366
1532
|
});
|
|
1367
|
-
var InitializeTriggerBodySchema =
|
|
1368
|
-
id:
|
|
1369
|
-
params:
|
|
1370
|
-
accountId:
|
|
1371
|
-
metadata:
|
|
1533
|
+
var InitializeTriggerBodySchema = import_zod12.z.object({
|
|
1534
|
+
id: import_zod12.z.string(),
|
|
1535
|
+
params: import_zod12.z.any(),
|
|
1536
|
+
accountId: import_zod12.z.string().optional(),
|
|
1537
|
+
metadata: import_zod12.z.any().optional()
|
|
1372
1538
|
});
|
|
1373
|
-
var RegisterCommonScheduleBodySchema =
|
|
1539
|
+
var RegisterCommonScheduleBodySchema = import_zod12.z.object({
|
|
1374
1540
|
/** A unique id for the schedule. This is used to identify and unregister the schedule later. */
|
|
1375
|
-
id:
|
|
1541
|
+
id: import_zod12.z.string(),
|
|
1376
1542
|
/** Any additional metadata about the schedule. */
|
|
1377
|
-
metadata:
|
|
1543
|
+
metadata: import_zod12.z.any(),
|
|
1378
1544
|
/** An optional Account ID to associate with runs triggered by this schedule */
|
|
1379
|
-
accountId:
|
|
1545
|
+
accountId: import_zod12.z.string().optional()
|
|
1380
1546
|
});
|
|
1381
1547
|
var RegisterIntervalScheduleBodySchema = RegisterCommonScheduleBodySchema.merge(IntervalMetadataSchema);
|
|
1382
1548
|
var InitializeCronScheduleBodySchema = RegisterCommonScheduleBodySchema.merge(CronMetadataSchema);
|
|
1383
|
-
var RegisterScheduleBodySchema =
|
|
1549
|
+
var RegisterScheduleBodySchema = import_zod12.z.discriminatedUnion("type", [
|
|
1384
1550
|
RegisterIntervalScheduleBodySchema,
|
|
1385
1551
|
InitializeCronScheduleBodySchema
|
|
1386
1552
|
]);
|
|
1387
|
-
var RegisterScheduleResponseBodySchema =
|
|
1388
|
-
id:
|
|
1553
|
+
var RegisterScheduleResponseBodySchema = import_zod12.z.object({
|
|
1554
|
+
id: import_zod12.z.string(),
|
|
1389
1555
|
schedule: ScheduleMetadataSchema,
|
|
1390
|
-
metadata:
|
|
1391
|
-
active:
|
|
1556
|
+
metadata: import_zod12.z.any(),
|
|
1557
|
+
active: import_zod12.z.boolean()
|
|
1392
1558
|
});
|
|
1393
|
-
var CreateExternalConnectionBodySchema =
|
|
1394
|
-
accessToken:
|
|
1395
|
-
type:
|
|
1559
|
+
var CreateExternalConnectionBodySchema = import_zod12.z.object({
|
|
1560
|
+
accessToken: import_zod12.z.string(),
|
|
1561
|
+
type: import_zod12.z.enum([
|
|
1396
1562
|
"oauth2"
|
|
1397
1563
|
]),
|
|
1398
|
-
scopes:
|
|
1399
|
-
metadata:
|
|
1564
|
+
scopes: import_zod12.z.array(import_zod12.z.string()).optional(),
|
|
1565
|
+
metadata: import_zod12.z.any()
|
|
1400
1566
|
});
|
|
1401
|
-
var GetRunStatusesSchema =
|
|
1402
|
-
run:
|
|
1403
|
-
id:
|
|
1567
|
+
var GetRunStatusesSchema = import_zod12.z.object({
|
|
1568
|
+
run: import_zod12.z.object({
|
|
1569
|
+
id: import_zod12.z.string(),
|
|
1404
1570
|
status: RunStatusSchema,
|
|
1405
|
-
output:
|
|
1571
|
+
output: import_zod12.z.any().optional()
|
|
1406
1572
|
}),
|
|
1407
|
-
statuses:
|
|
1573
|
+
statuses: import_zod12.z.array(JobRunStatusRecordSchema)
|
|
1574
|
+
});
|
|
1575
|
+
var InvokeJobResponseSchema = import_zod12.z.object({
|
|
1576
|
+
id: import_zod12.z.string()
|
|
1577
|
+
});
|
|
1578
|
+
var InvokeJobRequestBodySchema = import_zod12.z.object({
|
|
1579
|
+
payload: import_zod12.z.any(),
|
|
1580
|
+
context: import_zod12.z.any().optional(),
|
|
1581
|
+
options: import_zod12.z.object({
|
|
1582
|
+
accountId: import_zod12.z.string().optional(),
|
|
1583
|
+
callbackUrl: import_zod12.z.string().optional()
|
|
1584
|
+
}).optional()
|
|
1585
|
+
});
|
|
1586
|
+
var InvokeOptionsSchema = import_zod12.z.object({
|
|
1587
|
+
accountId: import_zod12.z.string().optional(),
|
|
1588
|
+
idempotencyKey: import_zod12.z.string().optional(),
|
|
1589
|
+
context: import_zod12.z.any().optional(),
|
|
1590
|
+
callbackUrl: import_zod12.z.string().optional()
|
|
1591
|
+
});
|
|
1592
|
+
var EphemeralEventDispatcherRequestBodySchema = import_zod12.z.object({
|
|
1593
|
+
url: import_zod12.z.string(),
|
|
1594
|
+
name: import_zod12.z.string().or(import_zod12.z.array(import_zod12.z.string())),
|
|
1595
|
+
source: import_zod12.z.string().optional(),
|
|
1596
|
+
filter: EventFilterSchema.optional(),
|
|
1597
|
+
contextFilter: EventFilterSchema.optional(),
|
|
1598
|
+
accountId: import_zod12.z.string().optional(),
|
|
1599
|
+
timeoutInSeconds: import_zod12.z.number().int().positive().min(10).max(60 * 60 * 24 * 365).default(3600)
|
|
1600
|
+
});
|
|
1601
|
+
var EphemeralEventDispatcherResponseBodySchema = import_zod12.z.object({
|
|
1602
|
+
id: import_zod12.z.string()
|
|
1408
1603
|
});
|
|
1409
1604
|
|
|
1410
1605
|
// src/schemas/notifications.ts
|
|
1411
|
-
var
|
|
1606
|
+
var import_zod13 = require("zod");
|
|
1412
1607
|
var MISSING_CONNECTION_NOTIFICATION = "dev.trigger.notifications.missingConnection";
|
|
1413
1608
|
var MISSING_CONNECTION_RESOLVED_NOTIFICATION = "dev.trigger.notifications.missingConnectionResolved";
|
|
1414
|
-
var CommonMissingConnectionNotificationPayloadSchema =
|
|
1415
|
-
id:
|
|
1416
|
-
client:
|
|
1417
|
-
id:
|
|
1418
|
-
title:
|
|
1419
|
-
scopes:
|
|
1420
|
-
createdAt:
|
|
1421
|
-
updatedAt:
|
|
1609
|
+
var CommonMissingConnectionNotificationPayloadSchema = import_zod13.z.object({
|
|
1610
|
+
id: import_zod13.z.string(),
|
|
1611
|
+
client: import_zod13.z.object({
|
|
1612
|
+
id: import_zod13.z.string(),
|
|
1613
|
+
title: import_zod13.z.string(),
|
|
1614
|
+
scopes: import_zod13.z.array(import_zod13.z.string()),
|
|
1615
|
+
createdAt: import_zod13.z.coerce.date(),
|
|
1616
|
+
updatedAt: import_zod13.z.coerce.date()
|
|
1422
1617
|
}),
|
|
1423
|
-
authorizationUrl:
|
|
1618
|
+
authorizationUrl: import_zod13.z.string()
|
|
1424
1619
|
});
|
|
1425
1620
|
var MissingDeveloperConnectionNotificationPayloadSchema = CommonMissingConnectionNotificationPayloadSchema.extend({
|
|
1426
|
-
type:
|
|
1621
|
+
type: import_zod13.z.literal("DEVELOPER")
|
|
1427
1622
|
});
|
|
1428
1623
|
var MissingExternalConnectionNotificationPayloadSchema = CommonMissingConnectionNotificationPayloadSchema.extend({
|
|
1429
|
-
type:
|
|
1430
|
-
account:
|
|
1431
|
-
id:
|
|
1432
|
-
metadata:
|
|
1624
|
+
type: import_zod13.z.literal("EXTERNAL"),
|
|
1625
|
+
account: import_zod13.z.object({
|
|
1626
|
+
id: import_zod13.z.string(),
|
|
1627
|
+
metadata: import_zod13.z.any()
|
|
1433
1628
|
})
|
|
1434
1629
|
});
|
|
1435
|
-
var MissingConnectionNotificationPayloadSchema =
|
|
1630
|
+
var MissingConnectionNotificationPayloadSchema = import_zod13.z.discriminatedUnion("type", [
|
|
1436
1631
|
MissingDeveloperConnectionNotificationPayloadSchema,
|
|
1437
1632
|
MissingExternalConnectionNotificationPayloadSchema
|
|
1438
1633
|
]);
|
|
1439
|
-
var CommonMissingConnectionNotificationResolvedPayloadSchema =
|
|
1440
|
-
id:
|
|
1441
|
-
client:
|
|
1442
|
-
id:
|
|
1443
|
-
title:
|
|
1444
|
-
scopes:
|
|
1445
|
-
createdAt:
|
|
1446
|
-
updatedAt:
|
|
1447
|
-
integrationIdentifier:
|
|
1448
|
-
integrationAuthMethod:
|
|
1634
|
+
var CommonMissingConnectionNotificationResolvedPayloadSchema = import_zod13.z.object({
|
|
1635
|
+
id: import_zod13.z.string(),
|
|
1636
|
+
client: import_zod13.z.object({
|
|
1637
|
+
id: import_zod13.z.string(),
|
|
1638
|
+
title: import_zod13.z.string(),
|
|
1639
|
+
scopes: import_zod13.z.array(import_zod13.z.string()),
|
|
1640
|
+
createdAt: import_zod13.z.coerce.date(),
|
|
1641
|
+
updatedAt: import_zod13.z.coerce.date(),
|
|
1642
|
+
integrationIdentifier: import_zod13.z.string(),
|
|
1643
|
+
integrationAuthMethod: import_zod13.z.string()
|
|
1449
1644
|
}),
|
|
1450
|
-
expiresAt:
|
|
1645
|
+
expiresAt: import_zod13.z.coerce.date()
|
|
1451
1646
|
});
|
|
1452
1647
|
var MissingDeveloperConnectionResolvedNotificationPayloadSchema = CommonMissingConnectionNotificationResolvedPayloadSchema.extend({
|
|
1453
|
-
type:
|
|
1648
|
+
type: import_zod13.z.literal("DEVELOPER")
|
|
1454
1649
|
});
|
|
1455
1650
|
var MissingExternalConnectionResolvedNotificationPayloadSchema = CommonMissingConnectionNotificationResolvedPayloadSchema.extend({
|
|
1456
|
-
type:
|
|
1457
|
-
account:
|
|
1458
|
-
id:
|
|
1459
|
-
metadata:
|
|
1651
|
+
type: import_zod13.z.literal("EXTERNAL"),
|
|
1652
|
+
account: import_zod13.z.object({
|
|
1653
|
+
id: import_zod13.z.string(),
|
|
1654
|
+
metadata: import_zod13.z.any()
|
|
1460
1655
|
})
|
|
1461
1656
|
});
|
|
1462
|
-
var MissingConnectionResolvedNotificationPayloadSchema =
|
|
1657
|
+
var MissingConnectionResolvedNotificationPayloadSchema = import_zod13.z.discriminatedUnion("type", [
|
|
1463
1658
|
MissingDeveloperConnectionResolvedNotificationPayloadSchema,
|
|
1464
1659
|
MissingExternalConnectionResolvedNotificationPayloadSchema
|
|
1465
1660
|
]);
|
|
1466
1661
|
|
|
1467
1662
|
// src/schemas/fetch.ts
|
|
1468
|
-
var
|
|
1469
|
-
var FetchRetryHeadersStrategySchema =
|
|
1663
|
+
var import_zod14 = require("zod");
|
|
1664
|
+
var FetchRetryHeadersStrategySchema = import_zod14.z.object({
|
|
1470
1665
|
/** The `headers` strategy retries the request using info from the response headers. */
|
|
1471
|
-
strategy:
|
|
1666
|
+
strategy: import_zod14.z.literal("headers"),
|
|
1472
1667
|
/** The header to use to determine the maximum number of times to retry the request. */
|
|
1473
|
-
limitHeader:
|
|
1668
|
+
limitHeader: import_zod14.z.string(),
|
|
1474
1669
|
/** The header to use to determine the number of remaining retries. */
|
|
1475
|
-
remainingHeader:
|
|
1670
|
+
remainingHeader: import_zod14.z.string(),
|
|
1476
1671
|
/** The header to use to determine the time when the number of remaining retries will be reset. */
|
|
1477
|
-
resetHeader:
|
|
1672
|
+
resetHeader: import_zod14.z.string(),
|
|
1673
|
+
/** The event filter to use to determine if the request should be retried. */
|
|
1674
|
+
bodyFilter: EventFilterSchema.optional(),
|
|
1675
|
+
/** The format of the `resetHeader` value. */
|
|
1676
|
+
resetFormat: import_zod14.z.enum([
|
|
1677
|
+
"unix_timestamp",
|
|
1678
|
+
"unix_timestamp_in_ms",
|
|
1679
|
+
"iso_8601",
|
|
1680
|
+
"iso_8601_duration_openai_variant"
|
|
1681
|
+
]).default("unix_timestamp")
|
|
1478
1682
|
});
|
|
1479
1683
|
var FetchRetryBackoffStrategySchema = RetryOptionsSchema.extend({
|
|
1480
1684
|
/** The `backoff` strategy retries the request with an exponential backoff. */
|
|
1481
|
-
strategy:
|
|
1685
|
+
strategy: import_zod14.z.literal("backoff"),
|
|
1686
|
+
/** The event filter to use to determine if the request should be retried. */
|
|
1687
|
+
bodyFilter: EventFilterSchema.optional()
|
|
1482
1688
|
});
|
|
1483
|
-
var FetchRetryStrategySchema =
|
|
1689
|
+
var FetchRetryStrategySchema = import_zod14.z.discriminatedUnion("strategy", [
|
|
1484
1690
|
FetchRetryHeadersStrategySchema,
|
|
1485
1691
|
FetchRetryBackoffStrategySchema
|
|
1486
1692
|
]);
|
|
1487
|
-
var FetchRequestInitSchema =
|
|
1693
|
+
var FetchRequestInitSchema = import_zod14.z.object({
|
|
1488
1694
|
/** The HTTP method to use for the request. */
|
|
1489
|
-
method:
|
|
1695
|
+
method: import_zod14.z.string().optional(),
|
|
1490
1696
|
/** Any headers to send with the request. Note that you can use [redactString](https://trigger.dev/docs/sdk/redactString) to prevent sensitive information from being stored (e.g. in the logs), like API keys and tokens. */
|
|
1491
|
-
headers:
|
|
1492
|
-
|
|
1697
|
+
headers: import_zod14.z.record(import_zod14.z.union([
|
|
1698
|
+
import_zod14.z.string(),
|
|
1493
1699
|
RedactStringSchema
|
|
1494
1700
|
])).optional(),
|
|
1495
1701
|
/** The body of the request. */
|
|
1496
|
-
body:
|
|
1497
|
-
|
|
1498
|
-
|
|
1702
|
+
body: import_zod14.z.union([
|
|
1703
|
+
import_zod14.z.string(),
|
|
1704
|
+
import_zod14.z.instanceof(ArrayBuffer)
|
|
1499
1705
|
]).optional()
|
|
1500
1706
|
});
|
|
1501
|
-
var FetchRetryOptionsSchema =
|
|
1502
|
-
var
|
|
1503
|
-
|
|
1707
|
+
var FetchRetryOptionsSchema = import_zod14.z.record(FetchRetryStrategySchema);
|
|
1708
|
+
var FetchTimeoutOptionsSchema = import_zod14.z.object({
|
|
1709
|
+
durationInMs: import_zod14.z.number(),
|
|
1710
|
+
retry: RetryOptionsSchema.optional()
|
|
1711
|
+
});
|
|
1712
|
+
var FetchOperationSchema = import_zod14.z.object({
|
|
1713
|
+
url: import_zod14.z.string(),
|
|
1504
1714
|
requestInit: FetchRequestInitSchema.optional(),
|
|
1505
|
-
retry:
|
|
1715
|
+
retry: import_zod14.z.record(FetchRetryStrategySchema).optional(),
|
|
1716
|
+
timeout: FetchTimeoutOptionsSchema.optional()
|
|
1717
|
+
});
|
|
1718
|
+
var FetchPollOperationSchema = import_zod14.z.object({
|
|
1719
|
+
url: import_zod14.z.string(),
|
|
1720
|
+
interval: import_zod14.z.number().int().positive().min(10).max(600).default(10),
|
|
1721
|
+
timeout: import_zod14.z.number().int().positive().min(30).max(3600).default(600),
|
|
1722
|
+
responseFilter: ResponseFilterSchema,
|
|
1723
|
+
requestInit: FetchRequestInitSchema.optional(),
|
|
1724
|
+
requestTimeout: FetchTimeoutOptionsSchema.optional()
|
|
1506
1725
|
});
|
|
1507
1726
|
|
|
1508
1727
|
// src/schemas/events.ts
|
|
1509
|
-
var
|
|
1510
|
-
var GetEventSchema =
|
|
1728
|
+
var import_zod15 = require("zod");
|
|
1729
|
+
var GetEventSchema = import_zod15.z.object({
|
|
1511
1730
|
/** The event id */
|
|
1512
|
-
id:
|
|
1731
|
+
id: import_zod15.z.string(),
|
|
1513
1732
|
/** The event name */
|
|
1514
|
-
name:
|
|
1733
|
+
name: import_zod15.z.string(),
|
|
1515
1734
|
/** When the event was created */
|
|
1516
|
-
createdAt:
|
|
1735
|
+
createdAt: import_zod15.z.coerce.date(),
|
|
1517
1736
|
/** When the event was last updated */
|
|
1518
|
-
updatedAt:
|
|
1737
|
+
updatedAt: import_zod15.z.coerce.date(),
|
|
1519
1738
|
/** The runs that were triggered by the event */
|
|
1520
|
-
runs:
|
|
1739
|
+
runs: import_zod15.z.array(import_zod15.z.object({
|
|
1521
1740
|
/** The Run id */
|
|
1522
|
-
id:
|
|
1741
|
+
id: import_zod15.z.string(),
|
|
1523
1742
|
/** The Run status */
|
|
1524
1743
|
status: RunStatusSchema,
|
|
1525
1744
|
/** When the run started */
|
|
1526
|
-
startedAt:
|
|
1745
|
+
startedAt: import_zod15.z.coerce.date().optional().nullable(),
|
|
1527
1746
|
/** When the run completed */
|
|
1528
|
-
completedAt:
|
|
1747
|
+
completedAt: import_zod15.z.coerce.date().optional().nullable()
|
|
1529
1748
|
}))
|
|
1530
1749
|
});
|
|
1531
|
-
var CancelRunsForEventSchema =
|
|
1532
|
-
cancelledRunIds:
|
|
1533
|
-
failedToCancelRunIds:
|
|
1750
|
+
var CancelRunsForEventSchema = import_zod15.z.object({
|
|
1751
|
+
cancelledRunIds: import_zod15.z.array(import_zod15.z.string()),
|
|
1752
|
+
failedToCancelRunIds: import_zod15.z.array(import_zod15.z.string())
|
|
1753
|
+
});
|
|
1754
|
+
|
|
1755
|
+
// src/schemas/request.ts
|
|
1756
|
+
var import_zod16 = require("zod");
|
|
1757
|
+
var RequestWithRawBodySchema = import_zod16.z.object({
|
|
1758
|
+
url: import_zod16.z.string(),
|
|
1759
|
+
method: import_zod16.z.string(),
|
|
1760
|
+
headers: import_zod16.z.record(import_zod16.z.string()),
|
|
1761
|
+
rawBody: import_zod16.z.string()
|
|
1534
1762
|
});
|
|
1535
1763
|
|
|
1536
1764
|
// src/utils.ts
|
|
@@ -1576,6 +1804,73 @@ function calculateRetryAt(retryOptions, attempts) {
|
|
|
1576
1804
|
return new Date(Date.now() + timeoutInMs);
|
|
1577
1805
|
}
|
|
1578
1806
|
__name(calculateRetryAt, "calculateRetryAt");
|
|
1807
|
+
function calculateResetAt(resets, format, now = /* @__PURE__ */ new Date()) {
|
|
1808
|
+
if (!resets)
|
|
1809
|
+
return;
|
|
1810
|
+
switch (format) {
|
|
1811
|
+
case "iso_8601_duration_openai_variant": {
|
|
1812
|
+
return calculateISO8601DurationOpenAIVariantResetAt(resets, now);
|
|
1813
|
+
}
|
|
1814
|
+
case "iso_8601": {
|
|
1815
|
+
return calculateISO8601ResetAt(resets, now);
|
|
1816
|
+
}
|
|
1817
|
+
case "unix_timestamp": {
|
|
1818
|
+
return calculateUnixTimestampResetAt(resets, now);
|
|
1819
|
+
}
|
|
1820
|
+
case "unix_timestamp_in_ms": {
|
|
1821
|
+
return calculateUnixTimestampInMsResetAt(resets, now);
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
__name(calculateResetAt, "calculateResetAt");
|
|
1826
|
+
function calculateUnixTimestampResetAt(resets, now = /* @__PURE__ */ new Date()) {
|
|
1827
|
+
if (!resets)
|
|
1828
|
+
return void 0;
|
|
1829
|
+
const resetAt = parseInt(resets, 10);
|
|
1830
|
+
if (isNaN(resetAt))
|
|
1831
|
+
return void 0;
|
|
1832
|
+
return new Date(resetAt * 1e3);
|
|
1833
|
+
}
|
|
1834
|
+
__name(calculateUnixTimestampResetAt, "calculateUnixTimestampResetAt");
|
|
1835
|
+
function calculateUnixTimestampInMsResetAt(resets, now = /* @__PURE__ */ new Date()) {
|
|
1836
|
+
if (!resets)
|
|
1837
|
+
return void 0;
|
|
1838
|
+
const resetAt = parseInt(resets, 10);
|
|
1839
|
+
if (isNaN(resetAt))
|
|
1840
|
+
return void 0;
|
|
1841
|
+
return new Date(resetAt);
|
|
1842
|
+
}
|
|
1843
|
+
__name(calculateUnixTimestampInMsResetAt, "calculateUnixTimestampInMsResetAt");
|
|
1844
|
+
function calculateISO8601ResetAt(resets, now = /* @__PURE__ */ new Date()) {
|
|
1845
|
+
if (!resets)
|
|
1846
|
+
return void 0;
|
|
1847
|
+
const resetAt = new Date(resets);
|
|
1848
|
+
if (isNaN(resetAt.getTime()))
|
|
1849
|
+
return void 0;
|
|
1850
|
+
return resetAt;
|
|
1851
|
+
}
|
|
1852
|
+
__name(calculateISO8601ResetAt, "calculateISO8601ResetAt");
|
|
1853
|
+
function calculateISO8601DurationOpenAIVariantResetAt(resets, now = /* @__PURE__ */ new Date()) {
|
|
1854
|
+
if (!resets)
|
|
1855
|
+
return void 0;
|
|
1856
|
+
const pattern = /^(?:(\d+)d)?(?:(\d+)h)?(?:(\d+)m)?(?:(\d+(?:\.\d+)?)s)?(?:(\d+)ms)?$/;
|
|
1857
|
+
const match = resets.match(pattern);
|
|
1858
|
+
if (!match)
|
|
1859
|
+
return void 0;
|
|
1860
|
+
const days = parseInt(match[1], 10) || 0;
|
|
1861
|
+
const hours = parseInt(match[2], 10) || 0;
|
|
1862
|
+
const minutes = parseInt(match[3], 10) || 0;
|
|
1863
|
+
const seconds = parseFloat(match[4]) || 0;
|
|
1864
|
+
const milliseconds = parseInt(match[5], 10) || 0;
|
|
1865
|
+
const resetAt = new Date(now);
|
|
1866
|
+
resetAt.setDate(resetAt.getDate() + days);
|
|
1867
|
+
resetAt.setHours(resetAt.getHours() + hours);
|
|
1868
|
+
resetAt.setMinutes(resetAt.getMinutes() + minutes);
|
|
1869
|
+
resetAt.setSeconds(resetAt.getSeconds() + Math.floor(seconds));
|
|
1870
|
+
resetAt.setMilliseconds(resetAt.getMilliseconds() + (seconds - Math.floor(seconds)) * 1e3 + milliseconds);
|
|
1871
|
+
return resetAt;
|
|
1872
|
+
}
|
|
1873
|
+
__name(calculateISO8601DurationOpenAIVariantResetAt, "calculateISO8601DurationOpenAIVariantResetAt");
|
|
1579
1874
|
|
|
1580
1875
|
// src/replacements.ts
|
|
1581
1876
|
var currentDate = {
|
|
@@ -1617,6 +1912,13 @@ __name(urlWithSearchParams, "urlWithSearchParams");
|
|
|
1617
1912
|
|
|
1618
1913
|
// src/eventFilterMatches.ts
|
|
1619
1914
|
function eventFilterMatches(payload, filter) {
|
|
1915
|
+
if (payload === void 0 || payload === null) {
|
|
1916
|
+
if (Object.entries(filter).length === 0) {
|
|
1917
|
+
return true;
|
|
1918
|
+
} else {
|
|
1919
|
+
return false;
|
|
1920
|
+
}
|
|
1921
|
+
}
|
|
1620
1922
|
for (const [patternKey, patternValue] of Object.entries(filter)) {
|
|
1621
1923
|
const payloadValue = payload[patternKey];
|
|
1622
1924
|
if (Array.isArray(patternValue)) {
|
|
@@ -1757,9 +2059,81 @@ function contentFilterMatches(actualValue, contentFilter) {
|
|
|
1757
2059
|
}
|
|
1758
2060
|
__name(contentFilterMatches, "contentFilterMatches");
|
|
1759
2061
|
|
|
2062
|
+
// src/requestFilterMatches.ts
|
|
2063
|
+
async function requestFilterMatches(request, filter) {
|
|
2064
|
+
const clonedRequest = request.clone();
|
|
2065
|
+
if (!requestMethodMatches(clonedRequest.method, filter.method)) {
|
|
2066
|
+
return false;
|
|
2067
|
+
}
|
|
2068
|
+
if (filter.headers && !eventFilterMatches(clonedRequest.headers, filter.headers)) {
|
|
2069
|
+
return false;
|
|
2070
|
+
}
|
|
2071
|
+
const searchParams = new URL(clonedRequest.url).searchParams;
|
|
2072
|
+
const searchParamsObject = {};
|
|
2073
|
+
for (const [key, value] of searchParams.entries()) {
|
|
2074
|
+
searchParamsObject[key] = value;
|
|
2075
|
+
}
|
|
2076
|
+
if (filter.query && !eventFilterMatches(searchParamsObject, filter.query)) {
|
|
2077
|
+
return false;
|
|
2078
|
+
}
|
|
2079
|
+
try {
|
|
2080
|
+
const json = await clonedRequest.json();
|
|
2081
|
+
if (filter.body && !eventFilterMatches(json, filter.body)) {
|
|
2082
|
+
return false;
|
|
2083
|
+
}
|
|
2084
|
+
} catch (e) {
|
|
2085
|
+
if (filter.body) {
|
|
2086
|
+
return false;
|
|
2087
|
+
}
|
|
2088
|
+
}
|
|
2089
|
+
return true;
|
|
2090
|
+
}
|
|
2091
|
+
__name(requestFilterMatches, "requestFilterMatches");
|
|
2092
|
+
async function responseFilterMatches(response, filter) {
|
|
2093
|
+
if (filter.headers && !eventFilterMatches(response.headers, filter.headers)) {
|
|
2094
|
+
return {
|
|
2095
|
+
match: false
|
|
2096
|
+
};
|
|
2097
|
+
}
|
|
2098
|
+
try {
|
|
2099
|
+
const json = await response.json();
|
|
2100
|
+
if (filter.body && !eventFilterMatches(json, filter.body)) {
|
|
2101
|
+
return {
|
|
2102
|
+
match: false,
|
|
2103
|
+
body: json
|
|
2104
|
+
};
|
|
2105
|
+
} else {
|
|
2106
|
+
return {
|
|
2107
|
+
match: true,
|
|
2108
|
+
body: json
|
|
2109
|
+
};
|
|
2110
|
+
}
|
|
2111
|
+
} catch (e) {
|
|
2112
|
+
if (filter.body) {
|
|
2113
|
+
return {
|
|
2114
|
+
match: false,
|
|
2115
|
+
body: void 0
|
|
2116
|
+
};
|
|
2117
|
+
}
|
|
2118
|
+
}
|
|
2119
|
+
return {
|
|
2120
|
+
match: true,
|
|
2121
|
+
body: void 0
|
|
2122
|
+
};
|
|
2123
|
+
}
|
|
2124
|
+
__name(responseFilterMatches, "responseFilterMatches");
|
|
2125
|
+
function requestMethodMatches(method, filter) {
|
|
2126
|
+
if (!filter) {
|
|
2127
|
+
return true;
|
|
2128
|
+
}
|
|
2129
|
+
return filter.includes(method);
|
|
2130
|
+
}
|
|
2131
|
+
__name(requestMethodMatches, "requestMethodMatches");
|
|
2132
|
+
|
|
1760
2133
|
// src/index.ts
|
|
1761
2134
|
var API_VERSIONS = {
|
|
1762
|
-
LAZY_LOADED_CACHED_TASKS: "2023-09-29"
|
|
2135
|
+
LAZY_LOADED_CACHED_TASKS: "2023-09-29",
|
|
2136
|
+
SERIALIZED_TASK_OUTPUT: "2023-11-01"
|
|
1763
2137
|
};
|
|
1764
2138
|
var PLATFORM_FEATURES = {
|
|
1765
2139
|
yieldExecution: API_VERSIONS.LAZY_LOADED_CACHED_TASKS,
|