@trigger.dev/core 2.2.3 → 2.2.5
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 +5978 -370
- package/dist/index.js +657 -497
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3,7 +3,6 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
6
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
7
|
var __export = (target, all) => {
|
|
9
8
|
for (var name in all)
|
|
@@ -18,10 +17,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
17
|
return to;
|
|
19
18
|
};
|
|
20
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
-
var __publicField = (obj, key, value) => {
|
|
22
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
23
|
-
return value;
|
|
24
|
-
};
|
|
25
20
|
var __accessCheck = (obj, member, msg) => {
|
|
26
21
|
if (!member.has(obj))
|
|
27
22
|
throw TypeError("Cannot " + msg);
|
|
@@ -51,12 +46,13 @@ __export(src_exports, {
|
|
|
51
46
|
API_VERSIONS: () => API_VERSIONS,
|
|
52
47
|
ApiEventLogSchema: () => ApiEventLogSchema,
|
|
53
48
|
AutoYieldConfigSchema: () => AutoYieldConfigSchema,
|
|
54
|
-
|
|
49
|
+
AutoYieldMetadataSchema: () => AutoYieldMetadataSchema,
|
|
55
50
|
CachedTaskSchema: () => CachedTaskSchema,
|
|
56
51
|
CancelRunsForEventSchema: () => CancelRunsForEventSchema,
|
|
57
52
|
CommonMissingConnectionNotificationPayloadSchema: () => CommonMissingConnectionNotificationPayloadSchema,
|
|
58
53
|
CommonMissingConnectionNotificationResolvedPayloadSchema: () => CommonMissingConnectionNotificationResolvedPayloadSchema,
|
|
59
54
|
CompleteTaskBodyInputSchema: () => CompleteTaskBodyInputSchema,
|
|
55
|
+
CompleteTaskBodyV2InputSchema: () => CompleteTaskBodyV2InputSchema,
|
|
60
56
|
ConnectionAuthSchema: () => ConnectionAuthSchema,
|
|
61
57
|
CreateExternalConnectionBodySchema: () => CreateExternalConnectionBodySchema,
|
|
62
58
|
CreateRunResponseBodySchema: () => CreateRunResponseBodySchema,
|
|
@@ -82,14 +78,16 @@ __export(src_exports, {
|
|
|
82
78
|
FetchRetryHeadersStrategySchema: () => FetchRetryHeadersStrategySchema,
|
|
83
79
|
FetchRetryOptionsSchema: () => FetchRetryOptionsSchema,
|
|
84
80
|
FetchRetryStrategySchema: () => FetchRetryStrategySchema,
|
|
81
|
+
FetchTimeoutOptionsSchema: () => FetchTimeoutOptionsSchema,
|
|
85
82
|
GetEndpointIndexResponseSchema: () => GetEndpointIndexResponseSchema,
|
|
86
83
|
GetEventSchema: () => GetEventSchema,
|
|
87
84
|
GetRunSchema: () => GetRunSchema,
|
|
88
85
|
GetRunStatusesSchema: () => GetRunStatusesSchema,
|
|
89
86
|
GetRunsSchema: () => GetRunsSchema,
|
|
87
|
+
HTTPMethodUnionSchema: () => HTTPMethodUnionSchema,
|
|
90
88
|
HandleTriggerSourceSchema: () => HandleTriggerSourceSchema,
|
|
89
|
+
HttpEndpointRequestHeadersSchema: () => HttpEndpointRequestHeadersSchema,
|
|
91
90
|
HttpSourceRequestHeadersSchema: () => HttpSourceRequestHeadersSchema,
|
|
92
|
-
HttpSourceRequestSchema: () => HttpSourceRequestSchema,
|
|
93
91
|
HttpSourceResponseSchema: () => HttpSourceResponseSchema,
|
|
94
92
|
IndexEndpointResponseSchema: () => IndexEndpointResponseSchema,
|
|
95
93
|
InitializeCronScheduleBodySchema: () => InitializeCronScheduleBodySchema,
|
|
@@ -98,6 +96,10 @@ __export(src_exports, {
|
|
|
98
96
|
IntegrationMetadataSchema: () => IntegrationMetadataSchema,
|
|
99
97
|
IntervalMetadataSchema: () => IntervalMetadataSchema,
|
|
100
98
|
IntervalOptionsSchema: () => IntervalOptionsSchema,
|
|
99
|
+
InvokeJobRequestBodySchema: () => InvokeJobRequestBodySchema,
|
|
100
|
+
InvokeJobResponseSchema: () => InvokeJobResponseSchema,
|
|
101
|
+
InvokeOptionsSchema: () => InvokeOptionsSchema,
|
|
102
|
+
InvokeTriggerMetadataSchema: () => InvokeTriggerMetadataSchema,
|
|
101
103
|
JobMetadataSchema: () => JobMetadataSchema,
|
|
102
104
|
JobRunStatusRecordSchema: () => JobRunStatusRecordSchema,
|
|
103
105
|
LogMessageSchema: () => LogMessageSchema,
|
|
@@ -137,14 +139,18 @@ __export(src_exports, {
|
|
|
137
139
|
RegisterTriggerBodySchemaV1: () => RegisterTriggerBodySchemaV1,
|
|
138
140
|
RegisterTriggerBodySchemaV2: () => RegisterTriggerBodySchemaV2,
|
|
139
141
|
RegisterTriggerSourceSchema: () => RegisterTriggerSourceSchema,
|
|
142
|
+
RequestFilterSchema: () => RequestFilterSchema,
|
|
143
|
+
RequestWithRawBodySchema: () => RequestWithRawBodySchema,
|
|
140
144
|
RetryOptionsSchema: () => RetryOptionsSchema,
|
|
141
145
|
RunJobAutoYieldExecutionErrorSchema: () => RunJobAutoYieldExecutionErrorSchema,
|
|
142
146
|
RunJobAutoYieldWithCompletedTaskExecutionErrorSchema: () => RunJobAutoYieldWithCompletedTaskExecutionErrorSchema,
|
|
143
147
|
RunJobBodySchema: () => RunJobBodySchema,
|
|
144
148
|
RunJobCanceledWithTaskSchema: () => RunJobCanceledWithTaskSchema,
|
|
149
|
+
RunJobErrorResponseSchema: () => RunJobErrorResponseSchema,
|
|
145
150
|
RunJobErrorSchema: () => RunJobErrorSchema,
|
|
146
151
|
RunJobInvalidPayloadErrorSchema: () => RunJobInvalidPayloadErrorSchema,
|
|
147
152
|
RunJobResponseSchema: () => RunJobResponseSchema,
|
|
153
|
+
RunJobResumeWithParallelTaskSchema: () => RunJobResumeWithParallelTaskSchema,
|
|
148
154
|
RunJobResumeWithTaskSchema: () => RunJobResumeWithTaskSchema,
|
|
149
155
|
RunJobRetryWithTaskSchema: () => RunJobRetryWithTaskSchema,
|
|
150
156
|
RunJobSuccessSchema: () => RunJobSuccessSchema,
|
|
@@ -175,6 +181,7 @@ __export(src_exports, {
|
|
|
175
181
|
StyleSchema: () => StyleSchema,
|
|
176
182
|
TaskSchema: () => TaskSchema,
|
|
177
183
|
TaskStatusSchema: () => TaskStatusSchema,
|
|
184
|
+
TriggerHelpSchema: () => TriggerHelpSchema,
|
|
178
185
|
TriggerMetadataSchema: () => TriggerMetadataSchema,
|
|
179
186
|
TriggerSourceSchema: () => TriggerSourceSchema,
|
|
180
187
|
UpdateTriggerSourceBodyV1Schema: () => UpdateTriggerSourceBodyV1Schema,
|
|
@@ -191,6 +198,8 @@ __export(src_exports, {
|
|
|
191
198
|
eventFilterMatches: () => eventFilterMatches,
|
|
192
199
|
parseEndpointIndexStats: () => parseEndpointIndexStats,
|
|
193
200
|
replacements: () => replacements,
|
|
201
|
+
requestFilterMatches: () => requestFilterMatches,
|
|
202
|
+
stringPatternMatchers: () => stringPatternMatchers,
|
|
194
203
|
supportsFeature: () => supportsFeature,
|
|
195
204
|
urlWithSearchParams: () => urlWithSearchParams
|
|
196
205
|
});
|
|
@@ -228,27 +237,27 @@ var _Logger = class _Logger {
|
|
|
228
237
|
log(message, ...args) {
|
|
229
238
|
if (__privateGet(this, _level) < 0)
|
|
230
239
|
return;
|
|
231
|
-
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.log, message, ...args);
|
|
240
|
+
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.log, message, "log", ...args);
|
|
232
241
|
}
|
|
233
242
|
error(message, ...args) {
|
|
234
243
|
if (__privateGet(this, _level) < 1)
|
|
235
244
|
return;
|
|
236
|
-
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.error, message, ...args);
|
|
245
|
+
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.error, message, "error", ...args);
|
|
237
246
|
}
|
|
238
247
|
warn(message, ...args) {
|
|
239
248
|
if (__privateGet(this, _level) < 2)
|
|
240
249
|
return;
|
|
241
|
-
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.warn, message, ...args);
|
|
250
|
+
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.warn, message, "warn", ...args);
|
|
242
251
|
}
|
|
243
252
|
info(message, ...args) {
|
|
244
253
|
if (__privateGet(this, _level) < 3)
|
|
245
254
|
return;
|
|
246
|
-
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.info, message, ...args);
|
|
255
|
+
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.info, message, "info", ...args);
|
|
247
256
|
}
|
|
248
257
|
debug(message, ...args) {
|
|
249
258
|
if (__privateGet(this, _level) < 4)
|
|
250
259
|
return;
|
|
251
|
-
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.debug, message, ...args);
|
|
260
|
+
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.debug, message, "debug", ...args);
|
|
252
261
|
}
|
|
253
262
|
};
|
|
254
263
|
_name = new WeakMap();
|
|
@@ -256,12 +265,13 @@ _level = new WeakMap();
|
|
|
256
265
|
_filteredKeys = new WeakMap();
|
|
257
266
|
_jsonReplacer = new WeakMap();
|
|
258
267
|
_structuredLog = new WeakSet();
|
|
259
|
-
structuredLog_fn = /* @__PURE__ */ __name(function(loggerFunction, message, ...args) {
|
|
268
|
+
structuredLog_fn = /* @__PURE__ */ __name(function(loggerFunction, message, level, ...args) {
|
|
260
269
|
const structuredLog = {
|
|
261
270
|
...structureArgs(safeJsonClone(args), __privateGet(this, _filteredKeys)),
|
|
262
271
|
timestamp: /* @__PURE__ */ new Date(),
|
|
263
272
|
name: __privateGet(this, _name),
|
|
264
|
-
message
|
|
273
|
+
message,
|
|
274
|
+
level
|
|
265
275
|
};
|
|
266
276
|
loggerFunction(JSON.stringify(structuredLog, createReplacer(__privateGet(this, _jsonReplacer))));
|
|
267
277
|
}, "#structuredLog");
|
|
@@ -330,7 +340,7 @@ function prettyPrintBytes(value) {
|
|
|
330
340
|
if (process.env.NODE_ENV === "production") {
|
|
331
341
|
return "skipped size";
|
|
332
342
|
}
|
|
333
|
-
const sizeInBytes =
|
|
343
|
+
const sizeInBytes = getSizeInBytes(value);
|
|
334
344
|
if (sizeInBytes < 1024) {
|
|
335
345
|
return `${sizeInBytes} bytes`;
|
|
336
346
|
}
|
|
@@ -343,10 +353,19 @@ function prettyPrintBytes(value) {
|
|
|
343
353
|
return `${(sizeInBytes / (1024 * 1024 * 1024)).toFixed(2)} GB`;
|
|
344
354
|
}
|
|
345
355
|
__name(prettyPrintBytes, "prettyPrintBytes");
|
|
356
|
+
function getSizeInBytes(value) {
|
|
357
|
+
const jsonString = JSON.stringify(value);
|
|
358
|
+
if (typeof window === "undefined") {
|
|
359
|
+
return Buffer.byteLength(jsonString, "utf8");
|
|
360
|
+
} else {
|
|
361
|
+
return new TextEncoder().encode(jsonString).length;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
__name(getSizeInBytes, "getSizeInBytes");
|
|
346
365
|
|
|
347
366
|
// src/schemas/api.ts
|
|
348
367
|
var import_ulid = require("ulid");
|
|
349
|
-
var
|
|
368
|
+
var import_zod12 = require("zod");
|
|
350
369
|
|
|
351
370
|
// src/schemas/addMissingVersionField.ts
|
|
352
371
|
function addMissingVersionField(val) {
|
|
@@ -374,6 +393,17 @@ var SchemaErrorSchema = import_zod.z.object({
|
|
|
374
393
|
|
|
375
394
|
// src/schemas/eventFilter.ts
|
|
376
395
|
var import_zod2 = require("zod");
|
|
396
|
+
var stringPatternMatchers = [
|
|
397
|
+
import_zod2.z.object({
|
|
398
|
+
$endsWith: import_zod2.z.string()
|
|
399
|
+
}),
|
|
400
|
+
import_zod2.z.object({
|
|
401
|
+
$startsWith: import_zod2.z.string()
|
|
402
|
+
}),
|
|
403
|
+
import_zod2.z.object({
|
|
404
|
+
$ignoreCaseEquals: import_zod2.z.string()
|
|
405
|
+
})
|
|
406
|
+
];
|
|
377
407
|
var EventMatcherSchema = import_zod2.z.union([
|
|
378
408
|
/** Match against a string */
|
|
379
409
|
import_zod2.z.array(import_zod2.z.string()),
|
|
@@ -382,12 +412,7 @@ var EventMatcherSchema = import_zod2.z.union([
|
|
|
382
412
|
/** Match against a boolean */
|
|
383
413
|
import_zod2.z.array(import_zod2.z.boolean()),
|
|
384
414
|
import_zod2.z.array(import_zod2.z.union([
|
|
385
|
-
|
|
386
|
-
$endsWith: import_zod2.z.string()
|
|
387
|
-
}),
|
|
388
|
-
import_zod2.z.object({
|
|
389
|
-
$startsWith: import_zod2.z.string()
|
|
390
|
-
}),
|
|
415
|
+
...stringPatternMatchers,
|
|
391
416
|
import_zod2.z.object({
|
|
392
417
|
$exists: import_zod2.z.boolean()
|
|
393
418
|
}),
|
|
@@ -432,9 +457,6 @@ var EventMatcherSchema = import_zod2.z.union([
|
|
|
432
457
|
import_zod2.z.number(),
|
|
433
458
|
import_zod2.z.boolean()
|
|
434
459
|
])
|
|
435
|
-
}),
|
|
436
|
-
import_zod2.z.object({
|
|
437
|
-
$ignoreCaseEquals: import_zod2.z.string()
|
|
438
460
|
})
|
|
439
461
|
]))
|
|
440
462
|
]);
|
|
@@ -598,7 +620,11 @@ var TaskSchema = import_zod7.z.object({
|
|
|
598
620
|
parentId: import_zod7.z.string().optional().nullable(),
|
|
599
621
|
style: StyleSchema.optional().nullable(),
|
|
600
622
|
operation: import_zod7.z.string().optional().nullable(),
|
|
601
|
-
callbackUrl: import_zod7.z.string().optional().nullable()
|
|
623
|
+
callbackUrl: import_zod7.z.string().optional().nullable(),
|
|
624
|
+
childExecutionMode: import_zod7.z.enum([
|
|
625
|
+
"SEQUENTIAL",
|
|
626
|
+
"PARALLEL"
|
|
627
|
+
]).optional().nullable()
|
|
602
628
|
});
|
|
603
629
|
var ServerTaskSchema = TaskSchema.extend({
|
|
604
630
|
idempotencyKey: import_zod7.z.string(),
|
|
@@ -636,6 +662,12 @@ var DynamicTriggerMetadataSchema = import_zod8.z.object({
|
|
|
636
662
|
type: import_zod8.z.literal("dynamic"),
|
|
637
663
|
id: import_zod8.z.string()
|
|
638
664
|
});
|
|
665
|
+
var TriggerHelpSchema = import_zod8.z.object({
|
|
666
|
+
noRuns: import_zod8.z.object({
|
|
667
|
+
text: import_zod8.z.string(),
|
|
668
|
+
link: import_zod8.z.string().optional()
|
|
669
|
+
}).optional()
|
|
670
|
+
});
|
|
639
671
|
var StaticTriggerMetadataSchema = import_zod8.z.object({
|
|
640
672
|
type: import_zod8.z.literal("static"),
|
|
641
673
|
title: import_zod8.z.union([
|
|
@@ -643,7 +675,12 @@ var StaticTriggerMetadataSchema = import_zod8.z.object({
|
|
|
643
675
|
import_zod8.z.array(import_zod8.z.string())
|
|
644
676
|
]),
|
|
645
677
|
properties: import_zod8.z.array(DisplayPropertySchema).optional(),
|
|
646
|
-
rule: EventRuleSchema
|
|
678
|
+
rule: EventRuleSchema,
|
|
679
|
+
link: import_zod8.z.string().optional(),
|
|
680
|
+
help: TriggerHelpSchema.optional()
|
|
681
|
+
});
|
|
682
|
+
var InvokeTriggerMetadataSchema = import_zod8.z.object({
|
|
683
|
+
type: import_zod8.z.literal("invoke")
|
|
647
684
|
});
|
|
648
685
|
var ScheduledTriggerMetadataSchema = import_zod8.z.object({
|
|
649
686
|
type: import_zod8.z.literal("scheduled"),
|
|
@@ -652,7 +689,8 @@ var ScheduledTriggerMetadataSchema = import_zod8.z.object({
|
|
|
652
689
|
var TriggerMetadataSchema = import_zod8.z.discriminatedUnion("type", [
|
|
653
690
|
DynamicTriggerMetadataSchema,
|
|
654
691
|
StaticTriggerMetadataSchema,
|
|
655
|
-
ScheduledTriggerMetadataSchema
|
|
692
|
+
ScheduledTriggerMetadataSchema,
|
|
693
|
+
InvokeTriggerMetadataSchema
|
|
656
694
|
]);
|
|
657
695
|
|
|
658
696
|
// src/schemas/runs.ts
|
|
@@ -763,225 +801,289 @@ var GetRunsSchema = import_zod10.z.object({
|
|
|
763
801
|
nextCursor: import_zod10.z.string().optional()
|
|
764
802
|
});
|
|
765
803
|
|
|
804
|
+
// src/schemas/requestFilter.ts
|
|
805
|
+
var import_zod11 = require("zod");
|
|
806
|
+
var StringMatchSchema = import_zod11.z.union([
|
|
807
|
+
/** Match against a string */
|
|
808
|
+
import_zod11.z.array(import_zod11.z.string()),
|
|
809
|
+
import_zod11.z.array(import_zod11.z.union(stringPatternMatchers))
|
|
810
|
+
]);
|
|
811
|
+
var HTTPMethodUnionSchema = import_zod11.z.union([
|
|
812
|
+
import_zod11.z.literal("GET"),
|
|
813
|
+
import_zod11.z.literal("POST"),
|
|
814
|
+
import_zod11.z.literal("PUT"),
|
|
815
|
+
import_zod11.z.literal("PATCH"),
|
|
816
|
+
import_zod11.z.literal("DELETE"),
|
|
817
|
+
import_zod11.z.literal("HEAD"),
|
|
818
|
+
import_zod11.z.literal("OPTIONS")
|
|
819
|
+
]);
|
|
820
|
+
var RequestFilterSchema = import_zod11.z.object({
|
|
821
|
+
/** An array of HTTP methods to match.
|
|
822
|
+
* For example, `["GET", "POST"]` will match both `GET` and `POST` Requests. */
|
|
823
|
+
method: import_zod11.z.array(HTTPMethodUnionSchema).optional(),
|
|
824
|
+
/** An object of header key/values to match.
|
|
825
|
+
* This uses the [EventFilter matching syntax](https://trigger.dev/docs/documentation/guides/event-filter).
|
|
826
|
+
|
|
827
|
+
@example
|
|
828
|
+
```ts
|
|
829
|
+
filter: {
|
|
830
|
+
header: {
|
|
831
|
+
"content-type": ["application/json"],
|
|
832
|
+
},
|
|
833
|
+
},
|
|
834
|
+
``` */
|
|
835
|
+
headers: import_zod11.z.record(StringMatchSchema).optional(),
|
|
836
|
+
/** An object of query parameters to match.
|
|
837
|
+
* This uses the [EventFilter matching syntax](https://trigger.dev/docs/documentation/guides/event-filter).
|
|
838
|
+
|
|
839
|
+
@example
|
|
840
|
+
```ts
|
|
841
|
+
filter: {
|
|
842
|
+
query: {
|
|
843
|
+
"hub.mode": [{ $startsWith: "sub" }],
|
|
844
|
+
},
|
|
845
|
+
},
|
|
846
|
+
``` */
|
|
847
|
+
query: import_zod11.z.record(StringMatchSchema).optional(),
|
|
848
|
+
/** An object of key/values to match.
|
|
849
|
+
* This uses the [EventFilter matching syntax](https://trigger.dev/docs/documentation/guides/event-filter).
|
|
850
|
+
*/
|
|
851
|
+
body: EventFilterSchema.optional()
|
|
852
|
+
});
|
|
853
|
+
|
|
766
854
|
// src/schemas/api.ts
|
|
767
|
-
var UpdateTriggerSourceBodyV1Schema =
|
|
768
|
-
registeredEvents:
|
|
769
|
-
secret:
|
|
855
|
+
var UpdateTriggerSourceBodyV1Schema = import_zod12.z.object({
|
|
856
|
+
registeredEvents: import_zod12.z.array(import_zod12.z.string()),
|
|
857
|
+
secret: import_zod12.z.string().optional(),
|
|
770
858
|
data: SerializableJsonSchema.optional()
|
|
771
859
|
});
|
|
772
|
-
var UpdateTriggerSourceBodyV2Schema =
|
|
773
|
-
secret:
|
|
860
|
+
var UpdateTriggerSourceBodyV2Schema = import_zod12.z.object({
|
|
861
|
+
secret: import_zod12.z.string().optional(),
|
|
774
862
|
data: SerializableJsonSchema.optional(),
|
|
775
|
-
options:
|
|
776
|
-
event:
|
|
777
|
-
}).and(
|
|
863
|
+
options: import_zod12.z.object({
|
|
864
|
+
event: import_zod12.z.array(import_zod12.z.string())
|
|
865
|
+
}).and(import_zod12.z.record(import_zod12.z.string(), import_zod12.z.array(import_zod12.z.string())).optional())
|
|
778
866
|
});
|
|
779
|
-
var RegisterHTTPTriggerSourceBodySchema =
|
|
780
|
-
type:
|
|
781
|
-
url:
|
|
867
|
+
var RegisterHTTPTriggerSourceBodySchema = import_zod12.z.object({
|
|
868
|
+
type: import_zod12.z.literal("HTTP"),
|
|
869
|
+
url: import_zod12.z.string().url()
|
|
782
870
|
});
|
|
783
|
-
var RegisterSMTPTriggerSourceBodySchema =
|
|
784
|
-
type:
|
|
871
|
+
var RegisterSMTPTriggerSourceBodySchema = import_zod12.z.object({
|
|
872
|
+
type: import_zod12.z.literal("SMTP")
|
|
785
873
|
});
|
|
786
|
-
var RegisterSQSTriggerSourceBodySchema =
|
|
787
|
-
type:
|
|
874
|
+
var RegisterSQSTriggerSourceBodySchema = import_zod12.z.object({
|
|
875
|
+
type: import_zod12.z.literal("SQS")
|
|
788
876
|
});
|
|
789
|
-
var RegisterSourceChannelBodySchema =
|
|
877
|
+
var RegisterSourceChannelBodySchema = import_zod12.z.discriminatedUnion("type", [
|
|
790
878
|
RegisterHTTPTriggerSourceBodySchema,
|
|
791
879
|
RegisterSMTPTriggerSourceBodySchema,
|
|
792
880
|
RegisterSQSTriggerSourceBodySchema
|
|
793
881
|
]);
|
|
794
882
|
var REGISTER_SOURCE_EVENT_V1 = "dev.trigger.source.register";
|
|
795
883
|
var REGISTER_SOURCE_EVENT_V2 = "dev.trigger.source.register.v2";
|
|
796
|
-
var RegisterTriggerSourceSchema =
|
|
797
|
-
key:
|
|
798
|
-
params:
|
|
799
|
-
active:
|
|
800
|
-
secret:
|
|
884
|
+
var RegisterTriggerSourceSchema = import_zod12.z.object({
|
|
885
|
+
key: import_zod12.z.string(),
|
|
886
|
+
params: import_zod12.z.any(),
|
|
887
|
+
active: import_zod12.z.boolean(),
|
|
888
|
+
secret: import_zod12.z.string(),
|
|
801
889
|
data: DeserializedJsonSchema.optional(),
|
|
802
890
|
channel: RegisterSourceChannelBodySchema,
|
|
803
|
-
clientId:
|
|
891
|
+
clientId: import_zod12.z.string().optional()
|
|
804
892
|
});
|
|
805
|
-
var SourceEventOptionSchema =
|
|
806
|
-
name:
|
|
807
|
-
value:
|
|
893
|
+
var SourceEventOptionSchema = import_zod12.z.object({
|
|
894
|
+
name: import_zod12.z.string(),
|
|
895
|
+
value: import_zod12.z.string()
|
|
808
896
|
});
|
|
809
|
-
var RegisterSourceEventSchemaV1 =
|
|
897
|
+
var RegisterSourceEventSchemaV1 = import_zod12.z.object({
|
|
810
898
|
/** The id of the source */
|
|
811
|
-
id:
|
|
899
|
+
id: import_zod12.z.string(),
|
|
812
900
|
source: RegisterTriggerSourceSchema,
|
|
813
|
-
events:
|
|
814
|
-
missingEvents:
|
|
815
|
-
orphanedEvents:
|
|
816
|
-
dynamicTriggerId:
|
|
901
|
+
events: import_zod12.z.array(import_zod12.z.string()),
|
|
902
|
+
missingEvents: import_zod12.z.array(import_zod12.z.string()),
|
|
903
|
+
orphanedEvents: import_zod12.z.array(import_zod12.z.string()),
|
|
904
|
+
dynamicTriggerId: import_zod12.z.string().optional()
|
|
817
905
|
});
|
|
818
|
-
var RegisteredOptionsDiffSchema =
|
|
819
|
-
desired:
|
|
820
|
-
missing:
|
|
821
|
-
orphaned:
|
|
906
|
+
var RegisteredOptionsDiffSchema = import_zod12.z.object({
|
|
907
|
+
desired: import_zod12.z.array(import_zod12.z.string()),
|
|
908
|
+
missing: import_zod12.z.array(import_zod12.z.string()),
|
|
909
|
+
orphaned: import_zod12.z.array(import_zod12.z.string())
|
|
822
910
|
});
|
|
823
|
-
var RegisterSourceEventOptionsSchema =
|
|
911
|
+
var RegisterSourceEventOptionsSchema = import_zod12.z.object({
|
|
824
912
|
event: RegisteredOptionsDiffSchema
|
|
825
|
-
}).and(
|
|
826
|
-
var RegisterSourceEventSchemaV2 =
|
|
913
|
+
}).and(import_zod12.z.record(import_zod12.z.string(), RegisteredOptionsDiffSchema));
|
|
914
|
+
var RegisterSourceEventSchemaV2 = import_zod12.z.object({
|
|
827
915
|
/** The id of the source */
|
|
828
|
-
id:
|
|
916
|
+
id: import_zod12.z.string(),
|
|
829
917
|
source: RegisterTriggerSourceSchema,
|
|
830
918
|
options: RegisterSourceEventOptionsSchema,
|
|
831
|
-
dynamicTriggerId:
|
|
919
|
+
dynamicTriggerId: import_zod12.z.string().optional()
|
|
832
920
|
});
|
|
833
|
-
var TriggerSourceSchema =
|
|
834
|
-
id:
|
|
835
|
-
key:
|
|
921
|
+
var TriggerSourceSchema = import_zod12.z.object({
|
|
922
|
+
id: import_zod12.z.string(),
|
|
923
|
+
key: import_zod12.z.string()
|
|
836
924
|
});
|
|
837
925
|
var HttpSourceResponseMetadataSchema = DeserializedJsonSchema;
|
|
838
|
-
var HandleTriggerSourceSchema =
|
|
839
|
-
key:
|
|
840
|
-
secret:
|
|
841
|
-
data:
|
|
842
|
-
params:
|
|
926
|
+
var HandleTriggerSourceSchema = import_zod12.z.object({
|
|
927
|
+
key: import_zod12.z.string(),
|
|
928
|
+
secret: import_zod12.z.string(),
|
|
929
|
+
data: import_zod12.z.any(),
|
|
930
|
+
params: import_zod12.z.any(),
|
|
843
931
|
auth: ConnectionAuthSchema.optional(),
|
|
844
932
|
metadata: HttpSourceResponseMetadataSchema.optional()
|
|
845
933
|
});
|
|
846
|
-
var
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
"x-ts-
|
|
854
|
-
"x-ts-
|
|
855
|
-
"x-ts-
|
|
856
|
-
"x-ts-data": import_zod11.z.string().transform((s) => JSON.parse(s)),
|
|
857
|
-
"x-ts-params": import_zod11.z.string().transform((s) => JSON.parse(s)),
|
|
858
|
-
"x-ts-http-url": import_zod11.z.string(),
|
|
859
|
-
"x-ts-http-method": import_zod11.z.string(),
|
|
860
|
-
"x-ts-http-headers": import_zod11.z.string().transform((s) => import_zod11.z.record(import_zod11.z.string()).parse(JSON.parse(s))),
|
|
861
|
-
"x-ts-auth": import_zod11.z.string().optional().transform((s) => {
|
|
934
|
+
var HttpSourceRequestHeadersSchema = import_zod12.z.object({
|
|
935
|
+
"x-ts-key": import_zod12.z.string(),
|
|
936
|
+
"x-ts-dynamic-id": import_zod12.z.string().optional(),
|
|
937
|
+
"x-ts-secret": import_zod12.z.string(),
|
|
938
|
+
"x-ts-data": import_zod12.z.string().transform((s) => JSON.parse(s)),
|
|
939
|
+
"x-ts-params": import_zod12.z.string().transform((s) => JSON.parse(s)),
|
|
940
|
+
"x-ts-http-url": import_zod12.z.string(),
|
|
941
|
+
"x-ts-http-method": import_zod12.z.string(),
|
|
942
|
+
"x-ts-http-headers": import_zod12.z.string().transform((s) => import_zod12.z.record(import_zod12.z.string()).parse(JSON.parse(s))),
|
|
943
|
+
"x-ts-auth": import_zod12.z.string().optional().transform((s) => {
|
|
862
944
|
if (s === void 0)
|
|
863
945
|
return;
|
|
864
946
|
const json = JSON.parse(s);
|
|
865
947
|
return ConnectionAuthSchema.parse(json);
|
|
866
948
|
}),
|
|
867
|
-
"x-ts-metadata":
|
|
949
|
+
"x-ts-metadata": import_zod12.z.string().optional().transform((s) => {
|
|
868
950
|
if (s === void 0)
|
|
869
951
|
return;
|
|
870
952
|
const json = JSON.parse(s);
|
|
871
953
|
return DeserializedJsonSchema.parse(json);
|
|
872
954
|
})
|
|
873
955
|
});
|
|
874
|
-
var
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
956
|
+
var HttpEndpointRequestHeadersSchema = import_zod12.z.object({
|
|
957
|
+
"x-ts-key": import_zod12.z.string(),
|
|
958
|
+
"x-ts-http-url": import_zod12.z.string(),
|
|
959
|
+
"x-ts-http-method": import_zod12.z.string(),
|
|
960
|
+
"x-ts-http-headers": import_zod12.z.string().transform((s) => import_zod12.z.record(import_zod12.z.string()).parse(JSON.parse(s)))
|
|
878
961
|
});
|
|
879
|
-
var
|
|
880
|
-
ok:
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
triggerSdkVersion: import_zod11.z.string().optional()
|
|
962
|
+
var PongSuccessResponseSchema = import_zod12.z.object({
|
|
963
|
+
ok: import_zod12.z.literal(true),
|
|
964
|
+
triggerVersion: import_zod12.z.string().optional(),
|
|
965
|
+
triggerSdkVersion: import_zod12.z.string().optional()
|
|
884
966
|
});
|
|
885
|
-
var
|
|
967
|
+
var PongErrorResponseSchema = import_zod12.z.object({
|
|
968
|
+
ok: import_zod12.z.literal(false),
|
|
969
|
+
error: import_zod12.z.string(),
|
|
970
|
+
triggerVersion: import_zod12.z.string().optional(),
|
|
971
|
+
triggerSdkVersion: import_zod12.z.string().optional()
|
|
972
|
+
});
|
|
973
|
+
var PongResponseSchema = import_zod12.z.discriminatedUnion("ok", [
|
|
886
974
|
PongSuccessResponseSchema,
|
|
887
975
|
PongErrorResponseSchema
|
|
888
976
|
]);
|
|
889
|
-
var ValidateSuccessResponseSchema =
|
|
890
|
-
ok:
|
|
891
|
-
endpointId:
|
|
892
|
-
triggerVersion:
|
|
977
|
+
var ValidateSuccessResponseSchema = import_zod12.z.object({
|
|
978
|
+
ok: import_zod12.z.literal(true),
|
|
979
|
+
endpointId: import_zod12.z.string(),
|
|
980
|
+
triggerVersion: import_zod12.z.string().optional()
|
|
893
981
|
});
|
|
894
|
-
var ValidateErrorResponseSchema =
|
|
895
|
-
ok:
|
|
896
|
-
error:
|
|
897
|
-
triggerVersion:
|
|
982
|
+
var ValidateErrorResponseSchema = import_zod12.z.object({
|
|
983
|
+
ok: import_zod12.z.literal(false),
|
|
984
|
+
error: import_zod12.z.string(),
|
|
985
|
+
triggerVersion: import_zod12.z.string().optional()
|
|
898
986
|
});
|
|
899
|
-
var ValidateResponseSchema =
|
|
987
|
+
var ValidateResponseSchema = import_zod12.z.discriminatedUnion("ok", [
|
|
900
988
|
ValidateSuccessResponseSchema,
|
|
901
989
|
ValidateErrorResponseSchema
|
|
902
990
|
]);
|
|
903
|
-
var QueueOptionsSchema =
|
|
904
|
-
name:
|
|
905
|
-
maxConcurrent:
|
|
906
|
-
});
|
|
907
|
-
var JobMetadataSchema =
|
|
908
|
-
id:
|
|
909
|
-
name:
|
|
910
|
-
version:
|
|
991
|
+
var QueueOptionsSchema = import_zod12.z.object({
|
|
992
|
+
name: import_zod12.z.string(),
|
|
993
|
+
maxConcurrent: import_zod12.z.number().optional()
|
|
994
|
+
});
|
|
995
|
+
var JobMetadataSchema = import_zod12.z.object({
|
|
996
|
+
id: import_zod12.z.string(),
|
|
997
|
+
name: import_zod12.z.string(),
|
|
998
|
+
version: import_zod12.z.string(),
|
|
911
999
|
event: EventSpecificationSchema,
|
|
912
1000
|
trigger: TriggerMetadataSchema,
|
|
913
|
-
integrations:
|
|
914
|
-
internal:
|
|
915
|
-
enabled:
|
|
916
|
-
startPosition:
|
|
1001
|
+
integrations: import_zod12.z.record(IntegrationConfigSchema),
|
|
1002
|
+
internal: import_zod12.z.boolean().default(false),
|
|
1003
|
+
enabled: import_zod12.z.boolean(),
|
|
1004
|
+
startPosition: import_zod12.z.enum([
|
|
917
1005
|
"initial",
|
|
918
1006
|
"latest"
|
|
919
1007
|
]),
|
|
920
|
-
preprocessRuns:
|
|
1008
|
+
preprocessRuns: import_zod12.z.boolean()
|
|
921
1009
|
});
|
|
922
|
-
var SourceMetadataV1Schema =
|
|
923
|
-
version:
|
|
924
|
-
channel:
|
|
1010
|
+
var SourceMetadataV1Schema = import_zod12.z.object({
|
|
1011
|
+
version: import_zod12.z.literal("1"),
|
|
1012
|
+
channel: import_zod12.z.enum([
|
|
925
1013
|
"HTTP",
|
|
926
1014
|
"SQS",
|
|
927
1015
|
"SMTP"
|
|
928
1016
|
]),
|
|
929
1017
|
integration: IntegrationConfigSchema,
|
|
930
|
-
key:
|
|
931
|
-
params:
|
|
932
|
-
events:
|
|
933
|
-
registerSourceJob:
|
|
934
|
-
id:
|
|
935
|
-
version:
|
|
1018
|
+
key: import_zod12.z.string(),
|
|
1019
|
+
params: import_zod12.z.any(),
|
|
1020
|
+
events: import_zod12.z.array(import_zod12.z.string()),
|
|
1021
|
+
registerSourceJob: import_zod12.z.object({
|
|
1022
|
+
id: import_zod12.z.string(),
|
|
1023
|
+
version: import_zod12.z.string()
|
|
936
1024
|
}).optional()
|
|
937
1025
|
});
|
|
938
|
-
var SourceMetadataV2Schema =
|
|
939
|
-
version:
|
|
940
|
-
channel:
|
|
1026
|
+
var SourceMetadataV2Schema = import_zod12.z.object({
|
|
1027
|
+
version: import_zod12.z.literal("2"),
|
|
1028
|
+
channel: import_zod12.z.enum([
|
|
941
1029
|
"HTTP",
|
|
942
1030
|
"SQS",
|
|
943
1031
|
"SMTP"
|
|
944
1032
|
]),
|
|
945
1033
|
integration: IntegrationConfigSchema,
|
|
946
|
-
key:
|
|
947
|
-
params:
|
|
948
|
-
options:
|
|
949
|
-
registerSourceJob:
|
|
950
|
-
id:
|
|
951
|
-
version:
|
|
1034
|
+
key: import_zod12.z.string(),
|
|
1035
|
+
params: import_zod12.z.any(),
|
|
1036
|
+
options: import_zod12.z.record(import_zod12.z.array(import_zod12.z.string())),
|
|
1037
|
+
registerSourceJob: import_zod12.z.object({
|
|
1038
|
+
id: import_zod12.z.string(),
|
|
1039
|
+
version: import_zod12.z.string()
|
|
952
1040
|
}).optional()
|
|
953
1041
|
});
|
|
954
|
-
var SourceMetadataSchema =
|
|
1042
|
+
var SourceMetadataSchema = import_zod12.z.preprocess(addMissingVersionField, import_zod12.z.discriminatedUnion("version", [
|
|
955
1043
|
SourceMetadataV1Schema,
|
|
956
1044
|
SourceMetadataV2Schema
|
|
957
1045
|
]));
|
|
958
|
-
var DynamicTriggerEndpointMetadataSchema =
|
|
959
|
-
id:
|
|
960
|
-
jobs:
|
|
1046
|
+
var DynamicTriggerEndpointMetadataSchema = import_zod12.z.object({
|
|
1047
|
+
id: import_zod12.z.string(),
|
|
1048
|
+
jobs: import_zod12.z.array(JobMetadataSchema.pick({
|
|
961
1049
|
id: true,
|
|
962
1050
|
version: true
|
|
963
1051
|
})),
|
|
964
|
-
registerSourceJob:
|
|
965
|
-
id:
|
|
966
|
-
version:
|
|
1052
|
+
registerSourceJob: import_zod12.z.object({
|
|
1053
|
+
id: import_zod12.z.string(),
|
|
1054
|
+
version: import_zod12.z.string()
|
|
967
1055
|
}).optional()
|
|
968
1056
|
});
|
|
969
|
-
var
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
1057
|
+
var HttpEndpointMetadataSchema = import_zod12.z.object({
|
|
1058
|
+
id: import_zod12.z.string(),
|
|
1059
|
+
version: import_zod12.z.string(),
|
|
1060
|
+
enabled: import_zod12.z.boolean(),
|
|
1061
|
+
title: import_zod12.z.string().optional(),
|
|
1062
|
+
icon: import_zod12.z.string().optional(),
|
|
1063
|
+
properties: import_zod12.z.array(DisplayPropertySchema).optional(),
|
|
1064
|
+
event: EventSpecificationSchema,
|
|
1065
|
+
immediateResponseFilter: RequestFilterSchema.optional(),
|
|
1066
|
+
skipTriggeringRuns: import_zod12.z.boolean().optional(),
|
|
1067
|
+
source: import_zod12.z.string()
|
|
1068
|
+
});
|
|
1069
|
+
var IndexEndpointResponseSchema = import_zod12.z.object({
|
|
1070
|
+
jobs: import_zod12.z.array(JobMetadataSchema),
|
|
1071
|
+
sources: import_zod12.z.array(SourceMetadataSchema),
|
|
1072
|
+
dynamicTriggers: import_zod12.z.array(DynamicTriggerEndpointMetadataSchema),
|
|
1073
|
+
dynamicSchedules: import_zod12.z.array(RegisterDynamicSchedulePayloadSchema),
|
|
1074
|
+
httpEndpoints: import_zod12.z.array(HttpEndpointMetadataSchema).optional()
|
|
1075
|
+
});
|
|
1076
|
+
var EndpointIndexErrorSchema = import_zod12.z.object({
|
|
1077
|
+
message: import_zod12.z.string(),
|
|
1078
|
+
raw: import_zod12.z.any().optional()
|
|
1079
|
+
});
|
|
1080
|
+
var IndexEndpointStatsSchema = import_zod12.z.object({
|
|
1081
|
+
jobs: import_zod12.z.number(),
|
|
1082
|
+
sources: import_zod12.z.number(),
|
|
1083
|
+
dynamicTriggers: import_zod12.z.number(),
|
|
1084
|
+
dynamicSchedules: import_zod12.z.number(),
|
|
1085
|
+
disabledJobs: import_zod12.z.number().default(0),
|
|
1086
|
+
httpEndpoints: import_zod12.z.number().default(0)
|
|
985
1087
|
});
|
|
986
1088
|
function parseEndpointIndexStats(stats) {
|
|
987
1089
|
if (stats === null || stats === void 0) {
|
|
@@ -990,208 +1092,216 @@ function parseEndpointIndexStats(stats) {
|
|
|
990
1092
|
return IndexEndpointStatsSchema.parse(stats);
|
|
991
1093
|
}
|
|
992
1094
|
__name(parseEndpointIndexStats, "parseEndpointIndexStats");
|
|
993
|
-
var GetEndpointIndexResponseSchema =
|
|
994
|
-
|
|
995
|
-
status:
|
|
996
|
-
updatedAt:
|
|
1095
|
+
var GetEndpointIndexResponseSchema = import_zod12.z.discriminatedUnion("status", [
|
|
1096
|
+
import_zod12.z.object({
|
|
1097
|
+
status: import_zod12.z.literal("PENDING"),
|
|
1098
|
+
updatedAt: import_zod12.z.coerce.date()
|
|
997
1099
|
}),
|
|
998
|
-
|
|
999
|
-
status:
|
|
1000
|
-
updatedAt:
|
|
1100
|
+
import_zod12.z.object({
|
|
1101
|
+
status: import_zod12.z.literal("STARTED"),
|
|
1102
|
+
updatedAt: import_zod12.z.coerce.date()
|
|
1001
1103
|
}),
|
|
1002
|
-
|
|
1003
|
-
status:
|
|
1104
|
+
import_zod12.z.object({
|
|
1105
|
+
status: import_zod12.z.literal("SUCCESS"),
|
|
1004
1106
|
stats: IndexEndpointStatsSchema,
|
|
1005
|
-
updatedAt:
|
|
1107
|
+
updatedAt: import_zod12.z.coerce.date()
|
|
1006
1108
|
}),
|
|
1007
|
-
|
|
1008
|
-
status:
|
|
1109
|
+
import_zod12.z.object({
|
|
1110
|
+
status: import_zod12.z.literal("FAILURE"),
|
|
1009
1111
|
error: EndpointIndexErrorSchema,
|
|
1010
|
-
updatedAt:
|
|
1112
|
+
updatedAt: import_zod12.z.coerce.date()
|
|
1011
1113
|
})
|
|
1012
1114
|
]);
|
|
1013
|
-
var EndpointHeadersSchema =
|
|
1014
|
-
"trigger-version":
|
|
1015
|
-
"trigger-sdk-version":
|
|
1115
|
+
var EndpointHeadersSchema = import_zod12.z.object({
|
|
1116
|
+
"trigger-version": import_zod12.z.string().optional(),
|
|
1117
|
+
"trigger-sdk-version": import_zod12.z.string().optional()
|
|
1016
1118
|
});
|
|
1017
|
-
var RawEventSchema =
|
|
1119
|
+
var RawEventSchema = import_zod12.z.object({
|
|
1018
1120
|
/** The `name` property must exactly match any subscriptions you want to
|
|
1019
1121
|
trigger. */
|
|
1020
|
-
name:
|
|
1122
|
+
name: import_zod12.z.string(),
|
|
1021
1123
|
/** The `payload` property will be sent to any matching Jobs and will appear
|
|
1022
1124
|
as the `payload` param of the `run()` function. You can leave this
|
|
1023
1125
|
parameter out if you just want to trigger a Job without any input data. */
|
|
1024
|
-
payload:
|
|
1126
|
+
payload: import_zod12.z.any(),
|
|
1025
1127
|
/** The optional `context` property will be sent to any matching Jobs and will
|
|
1026
1128
|
be passed through as the `context.event.context` param of the `run()`
|
|
1027
1129
|
function. This is optional but can be useful if you want to pass through
|
|
1028
1130
|
some additional context to the Job. */
|
|
1029
|
-
context:
|
|
1131
|
+
context: import_zod12.z.any().optional(),
|
|
1030
1132
|
/** The `id` property uniquely identify this particular event. If unset it
|
|
1031
1133
|
will be set automatically using `ulid`. */
|
|
1032
|
-
id:
|
|
1134
|
+
id: import_zod12.z.string().default(() => (0, import_ulid.ulid)()),
|
|
1033
1135
|
/** This is optional, it defaults to the current timestamp. Usually you would
|
|
1034
1136
|
only set this if you have a timestamp that you wish to pass through, e.g.
|
|
1035
1137
|
you receive a timestamp from a service and you want the same timestamp to
|
|
1036
1138
|
be used in your Job. */
|
|
1037
|
-
timestamp:
|
|
1139
|
+
timestamp: import_zod12.z.coerce.date().optional(),
|
|
1038
1140
|
/** This is optional, it defaults to "trigger.dev". It can be useful to set
|
|
1039
1141
|
this as you can filter events using this in the `eventTrigger()`. */
|
|
1040
|
-
source:
|
|
1142
|
+
source: import_zod12.z.string().optional(),
|
|
1143
|
+
/** This is optional, it defaults to "JSON". If your event is actually a request,
|
|
1144
|
+
with a url, headers, method and rawBody you can use "REQUEST" */
|
|
1145
|
+
payloadType: import_zod12.z.union([
|
|
1146
|
+
import_zod12.z.literal("JSON"),
|
|
1147
|
+
import_zod12.z.literal("REQUEST")
|
|
1148
|
+
]).optional()
|
|
1041
1149
|
});
|
|
1042
|
-
var ApiEventLogSchema =
|
|
1150
|
+
var ApiEventLogSchema = import_zod12.z.object({
|
|
1043
1151
|
/** The `id` of the event that was sent.
|
|
1044
1152
|
*/
|
|
1045
|
-
id:
|
|
1153
|
+
id: import_zod12.z.string(),
|
|
1046
1154
|
/** The `name` of the event that was sent. */
|
|
1047
|
-
name:
|
|
1155
|
+
name: import_zod12.z.string(),
|
|
1048
1156
|
/** The `payload` of the event that was sent */
|
|
1049
1157
|
payload: DeserializedJsonSchema,
|
|
1050
1158
|
/** The `context` of the event that was sent. Is `undefined` if no context was
|
|
1051
1159
|
set when sending the event. */
|
|
1052
1160
|
context: DeserializedJsonSchema.optional().nullable(),
|
|
1053
1161
|
/** The `timestamp` of the event that was sent */
|
|
1054
|
-
timestamp:
|
|
1162
|
+
timestamp: import_zod12.z.coerce.date(),
|
|
1055
1163
|
/** The timestamp when the event will be delivered to any matching Jobs. Is
|
|
1056
1164
|
`undefined` if `deliverAt` or `deliverAfter` wasn't set when sending the
|
|
1057
1165
|
event. */
|
|
1058
|
-
deliverAt:
|
|
1166
|
+
deliverAt: import_zod12.z.coerce.date().optional().nullable(),
|
|
1059
1167
|
/** The timestamp when the event was delivered. Is `undefined` if `deliverAt`
|
|
1060
1168
|
or `deliverAfter` were set when sending the event. */
|
|
1061
|
-
deliveredAt:
|
|
1169
|
+
deliveredAt: import_zod12.z.coerce.date().optional().nullable(),
|
|
1062
1170
|
/** The timestamp when the event was cancelled. Is `undefined` if the event
|
|
1063
1171
|
* wasn't cancelled. */
|
|
1064
|
-
cancelledAt:
|
|
1172
|
+
cancelledAt: import_zod12.z.coerce.date().optional().nullable()
|
|
1065
1173
|
});
|
|
1066
|
-
var SendEventOptionsSchema =
|
|
1174
|
+
var SendEventOptionsSchema = import_zod12.z.object({
|
|
1067
1175
|
/** An optional Date when you want the event to trigger Jobs. The event will
|
|
1068
1176
|
be sent to the platform immediately but won't be acted upon until the
|
|
1069
1177
|
specified time. */
|
|
1070
|
-
deliverAt:
|
|
1178
|
+
deliverAt: import_zod12.z.coerce.date().optional(),
|
|
1071
1179
|
/** An optional number of seconds you want to wait for the event to trigger
|
|
1072
1180
|
any relevant Jobs. The event will be sent to the platform immediately but
|
|
1073
1181
|
won't be delivered until after the elapsed number of seconds. */
|
|
1074
|
-
deliverAfter:
|
|
1182
|
+
deliverAfter: import_zod12.z.number().int().optional(),
|
|
1075
1183
|
/** This optional param will be used by Trigger.dev Connect, which
|
|
1076
1184
|
is coming soon. */
|
|
1077
|
-
accountId:
|
|
1185
|
+
accountId: import_zod12.z.string().optional()
|
|
1078
1186
|
});
|
|
1079
|
-
var SendEventBodySchema =
|
|
1187
|
+
var SendEventBodySchema = import_zod12.z.object({
|
|
1080
1188
|
event: RawEventSchema,
|
|
1081
1189
|
options: SendEventOptionsSchema.optional()
|
|
1082
1190
|
});
|
|
1083
|
-
var DeliverEventResponseSchema =
|
|
1084
|
-
deliveredAt:
|
|
1191
|
+
var DeliverEventResponseSchema = import_zod12.z.object({
|
|
1192
|
+
deliveredAt: import_zod12.z.string().datetime()
|
|
1085
1193
|
});
|
|
1086
|
-
var RuntimeEnvironmentTypeSchema =
|
|
1194
|
+
var RuntimeEnvironmentTypeSchema = import_zod12.z.enum([
|
|
1087
1195
|
"PRODUCTION",
|
|
1088
1196
|
"STAGING",
|
|
1089
1197
|
"DEVELOPMENT",
|
|
1090
1198
|
"PREVIEW"
|
|
1091
1199
|
]);
|
|
1092
|
-
var RunSourceContextSchema =
|
|
1093
|
-
id:
|
|
1094
|
-
metadata:
|
|
1200
|
+
var RunSourceContextSchema = import_zod12.z.object({
|
|
1201
|
+
id: import_zod12.z.string(),
|
|
1202
|
+
metadata: import_zod12.z.any()
|
|
1095
1203
|
});
|
|
1096
|
-
var AutoYieldConfigSchema =
|
|
1097
|
-
startTaskThreshold:
|
|
1098
|
-
beforeExecuteTaskThreshold:
|
|
1099
|
-
beforeCompleteTaskThreshold:
|
|
1100
|
-
afterCompleteTaskThreshold:
|
|
1204
|
+
var AutoYieldConfigSchema = import_zod12.z.object({
|
|
1205
|
+
startTaskThreshold: import_zod12.z.number(),
|
|
1206
|
+
beforeExecuteTaskThreshold: import_zod12.z.number(),
|
|
1207
|
+
beforeCompleteTaskThreshold: import_zod12.z.number(),
|
|
1208
|
+
afterCompleteTaskThreshold: import_zod12.z.number()
|
|
1101
1209
|
});
|
|
1102
|
-
var RunJobBodySchema =
|
|
1210
|
+
var RunJobBodySchema = import_zod12.z.object({
|
|
1103
1211
|
event: ApiEventLogSchema,
|
|
1104
|
-
job:
|
|
1105
|
-
id:
|
|
1106
|
-
version:
|
|
1212
|
+
job: import_zod12.z.object({
|
|
1213
|
+
id: import_zod12.z.string(),
|
|
1214
|
+
version: import_zod12.z.string()
|
|
1107
1215
|
}),
|
|
1108
|
-
run:
|
|
1109
|
-
id:
|
|
1110
|
-
isTest:
|
|
1111
|
-
isRetry:
|
|
1112
|
-
startedAt:
|
|
1216
|
+
run: import_zod12.z.object({
|
|
1217
|
+
id: import_zod12.z.string(),
|
|
1218
|
+
isTest: import_zod12.z.boolean(),
|
|
1219
|
+
isRetry: import_zod12.z.boolean().default(false),
|
|
1220
|
+
startedAt: import_zod12.z.coerce.date()
|
|
1113
1221
|
}),
|
|
1114
|
-
environment:
|
|
1115
|
-
id:
|
|
1116
|
-
slug:
|
|
1222
|
+
environment: import_zod12.z.object({
|
|
1223
|
+
id: import_zod12.z.string(),
|
|
1224
|
+
slug: import_zod12.z.string(),
|
|
1117
1225
|
type: RuntimeEnvironmentTypeSchema
|
|
1118
1226
|
}),
|
|
1119
|
-
organization:
|
|
1120
|
-
id:
|
|
1121
|
-
title:
|
|
1122
|
-
slug:
|
|
1227
|
+
organization: import_zod12.z.object({
|
|
1228
|
+
id: import_zod12.z.string(),
|
|
1229
|
+
title: import_zod12.z.string(),
|
|
1230
|
+
slug: import_zod12.z.string()
|
|
1123
1231
|
}),
|
|
1124
|
-
|
|
1125
|
-
id:
|
|
1126
|
-
|
|
1232
|
+
project: import_zod12.z.object({
|
|
1233
|
+
id: import_zod12.z.string(),
|
|
1234
|
+
name: import_zod12.z.string(),
|
|
1235
|
+
slug: import_zod12.z.string()
|
|
1236
|
+
}).optional(),
|
|
1237
|
+
account: import_zod12.z.object({
|
|
1238
|
+
id: import_zod12.z.string(),
|
|
1239
|
+
metadata: import_zod12.z.any()
|
|
1127
1240
|
}).optional(),
|
|
1128
1241
|
source: RunSourceContextSchema.optional(),
|
|
1129
|
-
tasks:
|
|
1130
|
-
cachedTaskCursor:
|
|
1131
|
-
noopTasksSet:
|
|
1132
|
-
connections:
|
|
1133
|
-
yieldedExecutions:
|
|
1134
|
-
runChunkExecutionLimit:
|
|
1242
|
+
tasks: import_zod12.z.array(CachedTaskSchema).optional(),
|
|
1243
|
+
cachedTaskCursor: import_zod12.z.string().optional(),
|
|
1244
|
+
noopTasksSet: import_zod12.z.string().optional(),
|
|
1245
|
+
connections: import_zod12.z.record(ConnectionAuthSchema).optional(),
|
|
1246
|
+
yieldedExecutions: import_zod12.z.string().array().optional(),
|
|
1247
|
+
runChunkExecutionLimit: import_zod12.z.number().optional(),
|
|
1135
1248
|
autoYieldConfig: AutoYieldConfigSchema.optional()
|
|
1136
1249
|
});
|
|
1137
|
-
var RunJobErrorSchema =
|
|
1138
|
-
status:
|
|
1250
|
+
var RunJobErrorSchema = import_zod12.z.object({
|
|
1251
|
+
status: import_zod12.z.literal("ERROR"),
|
|
1139
1252
|
error: ErrorWithStackSchema,
|
|
1140
1253
|
task: TaskSchema.optional()
|
|
1141
1254
|
});
|
|
1142
|
-
var RunJobYieldExecutionErrorSchema =
|
|
1143
|
-
status:
|
|
1144
|
-
key:
|
|
1145
|
-
});
|
|
1146
|
-
var RunJobAutoYieldExecutionErrorSchema = import_zod11.z.object({
|
|
1147
|
-
status: import_zod11.z.literal("AUTO_YIELD_EXECUTION"),
|
|
1148
|
-
location: import_zod11.z.string(),
|
|
1149
|
-
timeRemaining: import_zod11.z.number(),
|
|
1150
|
-
timeElapsed: import_zod11.z.number(),
|
|
1151
|
-
limit: import_zod11.z.number().optional()
|
|
1152
|
-
});
|
|
1153
|
-
var RunJobAutoYieldWithCompletedTaskExecutionErrorSchema = import_zod11.z.object({
|
|
1154
|
-
status: import_zod11.z.literal("AUTO_YIELD_EXECUTION_WITH_COMPLETED_TASK"),
|
|
1155
|
-
id: import_zod11.z.string(),
|
|
1156
|
-
properties: import_zod11.z.array(DisplayPropertySchema).optional(),
|
|
1157
|
-
output: import_zod11.z.any(),
|
|
1158
|
-
data: import_zod11.z.object({
|
|
1159
|
-
location: import_zod11.z.string(),
|
|
1160
|
-
timeRemaining: import_zod11.z.number(),
|
|
1161
|
-
timeElapsed: import_zod11.z.number(),
|
|
1162
|
-
limit: import_zod11.z.number().optional()
|
|
1163
|
-
})
|
|
1255
|
+
var RunJobYieldExecutionErrorSchema = import_zod12.z.object({
|
|
1256
|
+
status: import_zod12.z.literal("YIELD_EXECUTION"),
|
|
1257
|
+
key: import_zod12.z.string()
|
|
1164
1258
|
});
|
|
1165
|
-
var
|
|
1166
|
-
|
|
1167
|
-
|
|
1259
|
+
var AutoYieldMetadataSchema = import_zod12.z.object({
|
|
1260
|
+
location: import_zod12.z.string(),
|
|
1261
|
+
timeRemaining: import_zod12.z.number(),
|
|
1262
|
+
timeElapsed: import_zod12.z.number(),
|
|
1263
|
+
limit: import_zod12.z.number().optional()
|
|
1168
1264
|
});
|
|
1169
|
-
var
|
|
1170
|
-
status:
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1265
|
+
var RunJobAutoYieldExecutionErrorSchema = AutoYieldMetadataSchema.extend({
|
|
1266
|
+
status: import_zod12.z.literal("AUTO_YIELD_EXECUTION")
|
|
1267
|
+
});
|
|
1268
|
+
var RunJobAutoYieldWithCompletedTaskExecutionErrorSchema = import_zod12.z.object({
|
|
1269
|
+
status: import_zod12.z.literal("AUTO_YIELD_EXECUTION_WITH_COMPLETED_TASK"),
|
|
1270
|
+
id: import_zod12.z.string(),
|
|
1271
|
+
properties: import_zod12.z.array(DisplayPropertySchema).optional(),
|
|
1272
|
+
output: import_zod12.z.string().optional(),
|
|
1273
|
+
data: AutoYieldMetadataSchema
|
|
1274
|
+
});
|
|
1275
|
+
var RunJobInvalidPayloadErrorSchema = import_zod12.z.object({
|
|
1276
|
+
status: import_zod12.z.literal("INVALID_PAYLOAD"),
|
|
1277
|
+
errors: import_zod12.z.array(SchemaErrorSchema)
|
|
1278
|
+
});
|
|
1279
|
+
var RunJobUnresolvedAuthErrorSchema = import_zod12.z.object({
|
|
1280
|
+
status: import_zod12.z.literal("UNRESOLVED_AUTH_ERROR"),
|
|
1281
|
+
issues: import_zod12.z.record(import_zod12.z.object({
|
|
1282
|
+
id: import_zod12.z.string(),
|
|
1283
|
+
error: import_zod12.z.string()
|
|
1174
1284
|
}))
|
|
1175
1285
|
});
|
|
1176
|
-
var RunJobResumeWithTaskSchema =
|
|
1177
|
-
status:
|
|
1286
|
+
var RunJobResumeWithTaskSchema = import_zod12.z.object({
|
|
1287
|
+
status: import_zod12.z.literal("RESUME_WITH_TASK"),
|
|
1178
1288
|
task: TaskSchema
|
|
1179
1289
|
});
|
|
1180
|
-
var RunJobRetryWithTaskSchema =
|
|
1181
|
-
status:
|
|
1290
|
+
var RunJobRetryWithTaskSchema = import_zod12.z.object({
|
|
1291
|
+
status: import_zod12.z.literal("RETRY_WITH_TASK"),
|
|
1182
1292
|
task: TaskSchema,
|
|
1183
1293
|
error: ErrorWithStackSchema,
|
|
1184
|
-
retryAt:
|
|
1294
|
+
retryAt: import_zod12.z.coerce.date()
|
|
1185
1295
|
});
|
|
1186
|
-
var RunJobCanceledWithTaskSchema =
|
|
1187
|
-
status:
|
|
1296
|
+
var RunJobCanceledWithTaskSchema = import_zod12.z.object({
|
|
1297
|
+
status: import_zod12.z.literal("CANCELED"),
|
|
1188
1298
|
task: TaskSchema
|
|
1189
1299
|
});
|
|
1190
|
-
var RunJobSuccessSchema =
|
|
1191
|
-
status:
|
|
1300
|
+
var RunJobSuccessSchema = import_zod12.z.object({
|
|
1301
|
+
status: import_zod12.z.literal("SUCCESS"),
|
|
1192
1302
|
output: DeserializedJsonSchema.optional()
|
|
1193
1303
|
});
|
|
1194
|
-
var
|
|
1304
|
+
var RunJobErrorResponseSchema = import_zod12.z.union([
|
|
1195
1305
|
RunJobAutoYieldExecutionErrorSchema,
|
|
1196
1306
|
RunJobAutoYieldWithCompletedTaskExecutionErrorSchema,
|
|
1197
1307
|
RunJobYieldExecutionErrorSchema,
|
|
@@ -1200,138 +1310,156 @@ var RunJobResponseSchema = import_zod11.z.discriminatedUnion("status", [
|
|
|
1200
1310
|
RunJobInvalidPayloadErrorSchema,
|
|
1201
1311
|
RunJobResumeWithTaskSchema,
|
|
1202
1312
|
RunJobRetryWithTaskSchema,
|
|
1313
|
+
RunJobCanceledWithTaskSchema
|
|
1314
|
+
]);
|
|
1315
|
+
var RunJobResumeWithParallelTaskSchema = import_zod12.z.object({
|
|
1316
|
+
status: import_zod12.z.literal("RESUME_WITH_PARALLEL_TASK"),
|
|
1317
|
+
task: TaskSchema,
|
|
1318
|
+
childErrors: import_zod12.z.array(RunJobErrorResponseSchema)
|
|
1319
|
+
});
|
|
1320
|
+
var RunJobResponseSchema = import_zod12.z.discriminatedUnion("status", [
|
|
1321
|
+
RunJobAutoYieldExecutionErrorSchema,
|
|
1322
|
+
RunJobAutoYieldWithCompletedTaskExecutionErrorSchema,
|
|
1323
|
+
RunJobYieldExecutionErrorSchema,
|
|
1324
|
+
RunJobErrorSchema,
|
|
1325
|
+
RunJobUnresolvedAuthErrorSchema,
|
|
1326
|
+
RunJobInvalidPayloadErrorSchema,
|
|
1327
|
+
RunJobResumeWithTaskSchema,
|
|
1328
|
+
RunJobResumeWithParallelTaskSchema,
|
|
1329
|
+
RunJobRetryWithTaskSchema,
|
|
1203
1330
|
RunJobCanceledWithTaskSchema,
|
|
1204
1331
|
RunJobSuccessSchema
|
|
1205
1332
|
]);
|
|
1206
|
-
var PreprocessRunBodySchema =
|
|
1333
|
+
var PreprocessRunBodySchema = import_zod12.z.object({
|
|
1207
1334
|
event: ApiEventLogSchema,
|
|
1208
|
-
job:
|
|
1209
|
-
id:
|
|
1210
|
-
version:
|
|
1335
|
+
job: import_zod12.z.object({
|
|
1336
|
+
id: import_zod12.z.string(),
|
|
1337
|
+
version: import_zod12.z.string()
|
|
1211
1338
|
}),
|
|
1212
|
-
run:
|
|
1213
|
-
id:
|
|
1214
|
-
isTest:
|
|
1339
|
+
run: import_zod12.z.object({
|
|
1340
|
+
id: import_zod12.z.string(),
|
|
1341
|
+
isTest: import_zod12.z.boolean()
|
|
1215
1342
|
}),
|
|
1216
|
-
environment:
|
|
1217
|
-
id:
|
|
1218
|
-
slug:
|
|
1343
|
+
environment: import_zod12.z.object({
|
|
1344
|
+
id: import_zod12.z.string(),
|
|
1345
|
+
slug: import_zod12.z.string(),
|
|
1219
1346
|
type: RuntimeEnvironmentTypeSchema
|
|
1220
1347
|
}),
|
|
1221
|
-
organization:
|
|
1222
|
-
id:
|
|
1223
|
-
title:
|
|
1224
|
-
slug:
|
|
1348
|
+
organization: import_zod12.z.object({
|
|
1349
|
+
id: import_zod12.z.string(),
|
|
1350
|
+
title: import_zod12.z.string(),
|
|
1351
|
+
slug: import_zod12.z.string()
|
|
1225
1352
|
}),
|
|
1226
|
-
account:
|
|
1227
|
-
id:
|
|
1228
|
-
metadata:
|
|
1353
|
+
account: import_zod12.z.object({
|
|
1354
|
+
id: import_zod12.z.string(),
|
|
1355
|
+
metadata: import_zod12.z.any()
|
|
1229
1356
|
}).optional()
|
|
1230
1357
|
});
|
|
1231
|
-
var PreprocessRunResponseSchema =
|
|
1232
|
-
abort:
|
|
1233
|
-
properties:
|
|
1358
|
+
var PreprocessRunResponseSchema = import_zod12.z.object({
|
|
1359
|
+
abort: import_zod12.z.boolean(),
|
|
1360
|
+
properties: import_zod12.z.array(DisplayPropertySchema).optional()
|
|
1234
1361
|
});
|
|
1235
|
-
var CreateRunResponseOkSchema =
|
|
1236
|
-
ok:
|
|
1237
|
-
data:
|
|
1238
|
-
id:
|
|
1362
|
+
var CreateRunResponseOkSchema = import_zod12.z.object({
|
|
1363
|
+
ok: import_zod12.z.literal(true),
|
|
1364
|
+
data: import_zod12.z.object({
|
|
1365
|
+
id: import_zod12.z.string()
|
|
1239
1366
|
})
|
|
1240
1367
|
});
|
|
1241
|
-
var CreateRunResponseErrorSchema =
|
|
1242
|
-
ok:
|
|
1243
|
-
error:
|
|
1368
|
+
var CreateRunResponseErrorSchema = import_zod12.z.object({
|
|
1369
|
+
ok: import_zod12.z.literal(false),
|
|
1370
|
+
error: import_zod12.z.string()
|
|
1244
1371
|
});
|
|
1245
|
-
var CreateRunResponseBodySchema =
|
|
1372
|
+
var CreateRunResponseBodySchema = import_zod12.z.discriminatedUnion("ok", [
|
|
1246
1373
|
CreateRunResponseOkSchema,
|
|
1247
1374
|
CreateRunResponseErrorSchema
|
|
1248
1375
|
]);
|
|
1249
|
-
var RedactStringSchema =
|
|
1250
|
-
__redactedString:
|
|
1251
|
-
strings:
|
|
1252
|
-
interpolations:
|
|
1376
|
+
var RedactStringSchema = import_zod12.z.object({
|
|
1377
|
+
__redactedString: import_zod12.z.literal(true),
|
|
1378
|
+
strings: import_zod12.z.array(import_zod12.z.string()),
|
|
1379
|
+
interpolations: import_zod12.z.array(import_zod12.z.string())
|
|
1253
1380
|
});
|
|
1254
|
-
var LogMessageSchema =
|
|
1255
|
-
level:
|
|
1381
|
+
var LogMessageSchema = import_zod12.z.object({
|
|
1382
|
+
level: import_zod12.z.enum([
|
|
1256
1383
|
"DEBUG",
|
|
1257
1384
|
"INFO",
|
|
1258
1385
|
"WARN",
|
|
1259
1386
|
"ERROR"
|
|
1260
1387
|
]),
|
|
1261
|
-
message:
|
|
1388
|
+
message: import_zod12.z.string(),
|
|
1262
1389
|
data: SerializableJsonSchema.optional()
|
|
1263
1390
|
});
|
|
1264
|
-
var RedactSchema =
|
|
1265
|
-
paths:
|
|
1391
|
+
var RedactSchema = import_zod12.z.object({
|
|
1392
|
+
paths: import_zod12.z.array(import_zod12.z.string())
|
|
1266
1393
|
});
|
|
1267
|
-
var RetryOptionsSchema =
|
|
1394
|
+
var RetryOptionsSchema = import_zod12.z.object({
|
|
1268
1395
|
/** The maximum number of times to retry the request. */
|
|
1269
|
-
limit:
|
|
1396
|
+
limit: import_zod12.z.number().optional(),
|
|
1270
1397
|
/** The exponential factor to use when calculating the next retry time. */
|
|
1271
|
-
factor:
|
|
1398
|
+
factor: import_zod12.z.number().optional(),
|
|
1272
1399
|
/** The minimum amount of time to wait before retrying the request. */
|
|
1273
|
-
minTimeoutInMs:
|
|
1400
|
+
minTimeoutInMs: import_zod12.z.number().optional(),
|
|
1274
1401
|
/** The maximum amount of time to wait before retrying the request. */
|
|
1275
|
-
maxTimeoutInMs:
|
|
1402
|
+
maxTimeoutInMs: import_zod12.z.number().optional(),
|
|
1276
1403
|
/** Whether to randomize the retry time. */
|
|
1277
|
-
randomize:
|
|
1404
|
+
randomize: import_zod12.z.boolean().optional()
|
|
1278
1405
|
});
|
|
1279
|
-
var RunTaskOptionsSchema =
|
|
1406
|
+
var RunTaskOptionsSchema = import_zod12.z.object({
|
|
1280
1407
|
/** The name of the Task is required. This is displayed on the Task in the logs. */
|
|
1281
|
-
name:
|
|
1408
|
+
name: import_zod12.z.string().optional(),
|
|
1282
1409
|
/** The Task will wait and only start at the specified Date */
|
|
1283
|
-
delayUntil:
|
|
1410
|
+
delayUntil: import_zod12.z.coerce.date().optional(),
|
|
1284
1411
|
/** Retry options */
|
|
1285
1412
|
retry: RetryOptionsSchema.optional(),
|
|
1286
1413
|
/** The icon for the Task, it will appear in the logs.
|
|
1287
1414
|
* You can use the name of a company in lowercase, e.g. "github".
|
|
1288
1415
|
* Or any icon name that [Tabler Icons](https://tabler-icons.io/) supports. */
|
|
1289
|
-
icon:
|
|
1416
|
+
icon: import_zod12.z.string().optional(),
|
|
1290
1417
|
/** The key for the Task that you want to appear in the logs */
|
|
1291
|
-
displayKey:
|
|
1418
|
+
displayKey: import_zod12.z.string().optional(),
|
|
1292
1419
|
/** A description of the Task */
|
|
1293
|
-
description:
|
|
1420
|
+
description: import_zod12.z.string().optional(),
|
|
1294
1421
|
/** Properties that are displayed in the logs */
|
|
1295
|
-
properties:
|
|
1422
|
+
properties: import_zod12.z.array(DisplayPropertySchema).optional(),
|
|
1296
1423
|
/** The input params to the Task, will be displayed in the logs */
|
|
1297
|
-
params:
|
|
1424
|
+
params: import_zod12.z.any(),
|
|
1298
1425
|
/** The style of the log entry. */
|
|
1299
1426
|
style: StyleSchema.optional(),
|
|
1300
1427
|
/** 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. */
|
|
1301
|
-
callback:
|
|
1428
|
+
callback: import_zod12.z.object({
|
|
1302
1429
|
/** Causes the task to wait for and return the data of the first request sent to `task.callbackUrl`. */
|
|
1303
|
-
enabled:
|
|
1430
|
+
enabled: import_zod12.z.boolean(),
|
|
1304
1431
|
/** Time to wait for the first request to `task.callbackUrl`. Default: One hour. */
|
|
1305
|
-
timeoutInSeconds:
|
|
1432
|
+
timeoutInSeconds: import_zod12.z.number()
|
|
1306
1433
|
}).partial().optional(),
|
|
1307
1434
|
/** Allows you to link the Integration connection in the logs. This is handled automatically in integrations. */
|
|
1308
|
-
connectionKey:
|
|
1435
|
+
connectionKey: import_zod12.z.string().optional(),
|
|
1309
1436
|
/** 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. */
|
|
1310
|
-
operation:
|
|
1437
|
+
operation: import_zod12.z.enum([
|
|
1311
1438
|
"fetch"
|
|
1312
1439
|
]).optional(),
|
|
1313
1440
|
/** 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). */
|
|
1314
|
-
noop:
|
|
1441
|
+
noop: import_zod12.z.boolean().default(false),
|
|
1315
1442
|
redact: RedactSchema.optional(),
|
|
1316
|
-
trigger: TriggerMetadataSchema.optional()
|
|
1443
|
+
trigger: TriggerMetadataSchema.optional(),
|
|
1444
|
+
parallel: import_zod12.z.boolean().optional()
|
|
1317
1445
|
});
|
|
1318
1446
|
var RunTaskBodyInputSchema = RunTaskOptionsSchema.extend({
|
|
1319
|
-
idempotencyKey:
|
|
1320
|
-
parentId:
|
|
1447
|
+
idempotencyKey: import_zod12.z.string(),
|
|
1448
|
+
parentId: import_zod12.z.string().optional()
|
|
1321
1449
|
});
|
|
1322
1450
|
var RunTaskBodyOutputSchema = RunTaskBodyInputSchema.extend({
|
|
1323
|
-
properties:
|
|
1451
|
+
properties: import_zod12.z.array(DisplayPropertySchema.partial()).optional(),
|
|
1324
1452
|
params: DeserializedJsonSchema.optional().nullable(),
|
|
1325
|
-
callback:
|
|
1326
|
-
enabled:
|
|
1327
|
-
timeoutInSeconds:
|
|
1453
|
+
callback: import_zod12.z.object({
|
|
1454
|
+
enabled: import_zod12.z.boolean(),
|
|
1455
|
+
timeoutInSeconds: import_zod12.z.number().default(3600)
|
|
1328
1456
|
}).optional()
|
|
1329
1457
|
});
|
|
1330
|
-
var RunTaskResponseWithCachedTasksBodySchema =
|
|
1458
|
+
var RunTaskResponseWithCachedTasksBodySchema = import_zod12.z.object({
|
|
1331
1459
|
task: ServerTaskSchema,
|
|
1332
|
-
cachedTasks:
|
|
1333
|
-
tasks:
|
|
1334
|
-
cursor:
|
|
1460
|
+
cachedTasks: import_zod12.z.object({
|
|
1461
|
+
tasks: import_zod12.z.array(CachedTaskSchema),
|
|
1462
|
+
cursor: import_zod12.z.string().optional()
|
|
1335
1463
|
}).optional()
|
|
1336
1464
|
});
|
|
1337
1465
|
var CompleteTaskBodyInputSchema = RunTaskBodyInputSchema.pick({
|
|
@@ -1341,202 +1469,240 @@ var CompleteTaskBodyInputSchema = RunTaskBodyInputSchema.pick({
|
|
|
1341
1469
|
}).extend({
|
|
1342
1470
|
output: SerializableJsonSchema.optional().transform((v) => v ? DeserializedJsonSchema.parse(JSON.parse(JSON.stringify(v))) : {})
|
|
1343
1471
|
});
|
|
1344
|
-
var
|
|
1472
|
+
var CompleteTaskBodyV2InputSchema = RunTaskBodyInputSchema.pick({
|
|
1473
|
+
properties: true,
|
|
1474
|
+
description: true,
|
|
1475
|
+
params: true
|
|
1476
|
+
}).extend({
|
|
1477
|
+
output: import_zod12.z.string().optional()
|
|
1478
|
+
});
|
|
1479
|
+
var FailTaskBodyInputSchema = import_zod12.z.object({
|
|
1345
1480
|
error: ErrorWithStackSchema
|
|
1346
1481
|
});
|
|
1347
|
-
var NormalizedRequestSchema =
|
|
1348
|
-
headers:
|
|
1349
|
-
method:
|
|
1350
|
-
query:
|
|
1351
|
-
url:
|
|
1352
|
-
body:
|
|
1482
|
+
var NormalizedRequestSchema = import_zod12.z.object({
|
|
1483
|
+
headers: import_zod12.z.record(import_zod12.z.string()),
|
|
1484
|
+
method: import_zod12.z.string(),
|
|
1485
|
+
query: import_zod12.z.record(import_zod12.z.string()),
|
|
1486
|
+
url: import_zod12.z.string(),
|
|
1487
|
+
body: import_zod12.z.any()
|
|
1353
1488
|
});
|
|
1354
|
-
var NormalizedResponseSchema =
|
|
1355
|
-
status:
|
|
1356
|
-
body:
|
|
1357
|
-
headers:
|
|
1489
|
+
var NormalizedResponseSchema = import_zod12.z.object({
|
|
1490
|
+
status: import_zod12.z.number(),
|
|
1491
|
+
body: import_zod12.z.any(),
|
|
1492
|
+
headers: import_zod12.z.record(import_zod12.z.string()).optional()
|
|
1358
1493
|
});
|
|
1359
|
-
var HttpSourceResponseSchema =
|
|
1494
|
+
var HttpSourceResponseSchema = import_zod12.z.object({
|
|
1360
1495
|
response: NormalizedResponseSchema,
|
|
1361
|
-
events:
|
|
1496
|
+
events: import_zod12.z.array(RawEventSchema),
|
|
1362
1497
|
metadata: HttpSourceResponseMetadataSchema.optional()
|
|
1363
1498
|
});
|
|
1364
|
-
var RegisterTriggerBodySchemaV1 =
|
|
1499
|
+
var RegisterTriggerBodySchemaV1 = import_zod12.z.object({
|
|
1365
1500
|
rule: EventRuleSchema,
|
|
1366
1501
|
source: SourceMetadataV1Schema
|
|
1367
1502
|
});
|
|
1368
|
-
var RegisterTriggerBodySchemaV2 =
|
|
1503
|
+
var RegisterTriggerBodySchemaV2 = import_zod12.z.object({
|
|
1369
1504
|
rule: EventRuleSchema,
|
|
1370
1505
|
source: SourceMetadataV2Schema,
|
|
1371
|
-
accountId:
|
|
1506
|
+
accountId: import_zod12.z.string().optional()
|
|
1372
1507
|
});
|
|
1373
|
-
var InitializeTriggerBodySchema =
|
|
1374
|
-
id:
|
|
1375
|
-
params:
|
|
1376
|
-
accountId:
|
|
1377
|
-
metadata:
|
|
1508
|
+
var InitializeTriggerBodySchema = import_zod12.z.object({
|
|
1509
|
+
id: import_zod12.z.string(),
|
|
1510
|
+
params: import_zod12.z.any(),
|
|
1511
|
+
accountId: import_zod12.z.string().optional(),
|
|
1512
|
+
metadata: import_zod12.z.any().optional()
|
|
1378
1513
|
});
|
|
1379
|
-
var RegisterCommonScheduleBodySchema =
|
|
1514
|
+
var RegisterCommonScheduleBodySchema = import_zod12.z.object({
|
|
1380
1515
|
/** A unique id for the schedule. This is used to identify and unregister the schedule later. */
|
|
1381
|
-
id:
|
|
1516
|
+
id: import_zod12.z.string(),
|
|
1382
1517
|
/** Any additional metadata about the schedule. */
|
|
1383
|
-
metadata:
|
|
1518
|
+
metadata: import_zod12.z.any(),
|
|
1384
1519
|
/** An optional Account ID to associate with runs triggered by this schedule */
|
|
1385
|
-
accountId:
|
|
1520
|
+
accountId: import_zod12.z.string().optional()
|
|
1386
1521
|
});
|
|
1387
1522
|
var RegisterIntervalScheduleBodySchema = RegisterCommonScheduleBodySchema.merge(IntervalMetadataSchema);
|
|
1388
1523
|
var InitializeCronScheduleBodySchema = RegisterCommonScheduleBodySchema.merge(CronMetadataSchema);
|
|
1389
|
-
var RegisterScheduleBodySchema =
|
|
1524
|
+
var RegisterScheduleBodySchema = import_zod12.z.discriminatedUnion("type", [
|
|
1390
1525
|
RegisterIntervalScheduleBodySchema,
|
|
1391
1526
|
InitializeCronScheduleBodySchema
|
|
1392
1527
|
]);
|
|
1393
|
-
var RegisterScheduleResponseBodySchema =
|
|
1394
|
-
id:
|
|
1528
|
+
var RegisterScheduleResponseBodySchema = import_zod12.z.object({
|
|
1529
|
+
id: import_zod12.z.string(),
|
|
1395
1530
|
schedule: ScheduleMetadataSchema,
|
|
1396
|
-
metadata:
|
|
1397
|
-
active:
|
|
1531
|
+
metadata: import_zod12.z.any(),
|
|
1532
|
+
active: import_zod12.z.boolean()
|
|
1398
1533
|
});
|
|
1399
|
-
var CreateExternalConnectionBodySchema =
|
|
1400
|
-
accessToken:
|
|
1401
|
-
type:
|
|
1534
|
+
var CreateExternalConnectionBodySchema = import_zod12.z.object({
|
|
1535
|
+
accessToken: import_zod12.z.string(),
|
|
1536
|
+
type: import_zod12.z.enum([
|
|
1402
1537
|
"oauth2"
|
|
1403
1538
|
]),
|
|
1404
|
-
scopes:
|
|
1405
|
-
metadata:
|
|
1539
|
+
scopes: import_zod12.z.array(import_zod12.z.string()).optional(),
|
|
1540
|
+
metadata: import_zod12.z.any()
|
|
1406
1541
|
});
|
|
1407
|
-
var GetRunStatusesSchema =
|
|
1408
|
-
run:
|
|
1409
|
-
id:
|
|
1542
|
+
var GetRunStatusesSchema = import_zod12.z.object({
|
|
1543
|
+
run: import_zod12.z.object({
|
|
1544
|
+
id: import_zod12.z.string(),
|
|
1410
1545
|
status: RunStatusSchema,
|
|
1411
|
-
output:
|
|
1546
|
+
output: import_zod12.z.any().optional()
|
|
1412
1547
|
}),
|
|
1413
|
-
statuses:
|
|
1548
|
+
statuses: import_zod12.z.array(JobRunStatusRecordSchema)
|
|
1549
|
+
});
|
|
1550
|
+
var InvokeJobResponseSchema = import_zod12.z.object({
|
|
1551
|
+
id: import_zod12.z.string()
|
|
1552
|
+
});
|
|
1553
|
+
var InvokeJobRequestBodySchema = import_zod12.z.object({
|
|
1554
|
+
payload: import_zod12.z.any(),
|
|
1555
|
+
context: import_zod12.z.any().optional(),
|
|
1556
|
+
options: import_zod12.z.object({
|
|
1557
|
+
accountId: import_zod12.z.string().optional(),
|
|
1558
|
+
callbackUrl: import_zod12.z.string().optional()
|
|
1559
|
+
}).optional()
|
|
1560
|
+
});
|
|
1561
|
+
var InvokeOptionsSchema = import_zod12.z.object({
|
|
1562
|
+
accountId: import_zod12.z.string().optional(),
|
|
1563
|
+
idempotencyKey: import_zod12.z.string().optional(),
|
|
1564
|
+
context: import_zod12.z.any().optional(),
|
|
1565
|
+
callbackUrl: import_zod12.z.string().optional()
|
|
1414
1566
|
});
|
|
1415
1567
|
|
|
1416
1568
|
// src/schemas/notifications.ts
|
|
1417
|
-
var
|
|
1569
|
+
var import_zod13 = require("zod");
|
|
1418
1570
|
var MISSING_CONNECTION_NOTIFICATION = "dev.trigger.notifications.missingConnection";
|
|
1419
1571
|
var MISSING_CONNECTION_RESOLVED_NOTIFICATION = "dev.trigger.notifications.missingConnectionResolved";
|
|
1420
|
-
var CommonMissingConnectionNotificationPayloadSchema =
|
|
1421
|
-
id:
|
|
1422
|
-
client:
|
|
1423
|
-
id:
|
|
1424
|
-
title:
|
|
1425
|
-
scopes:
|
|
1426
|
-
createdAt:
|
|
1427
|
-
updatedAt:
|
|
1572
|
+
var CommonMissingConnectionNotificationPayloadSchema = import_zod13.z.object({
|
|
1573
|
+
id: import_zod13.z.string(),
|
|
1574
|
+
client: import_zod13.z.object({
|
|
1575
|
+
id: import_zod13.z.string(),
|
|
1576
|
+
title: import_zod13.z.string(),
|
|
1577
|
+
scopes: import_zod13.z.array(import_zod13.z.string()),
|
|
1578
|
+
createdAt: import_zod13.z.coerce.date(),
|
|
1579
|
+
updatedAt: import_zod13.z.coerce.date()
|
|
1428
1580
|
}),
|
|
1429
|
-
authorizationUrl:
|
|
1581
|
+
authorizationUrl: import_zod13.z.string()
|
|
1430
1582
|
});
|
|
1431
1583
|
var MissingDeveloperConnectionNotificationPayloadSchema = CommonMissingConnectionNotificationPayloadSchema.extend({
|
|
1432
|
-
type:
|
|
1584
|
+
type: import_zod13.z.literal("DEVELOPER")
|
|
1433
1585
|
});
|
|
1434
1586
|
var MissingExternalConnectionNotificationPayloadSchema = CommonMissingConnectionNotificationPayloadSchema.extend({
|
|
1435
|
-
type:
|
|
1436
|
-
account:
|
|
1437
|
-
id:
|
|
1438
|
-
metadata:
|
|
1587
|
+
type: import_zod13.z.literal("EXTERNAL"),
|
|
1588
|
+
account: import_zod13.z.object({
|
|
1589
|
+
id: import_zod13.z.string(),
|
|
1590
|
+
metadata: import_zod13.z.any()
|
|
1439
1591
|
})
|
|
1440
1592
|
});
|
|
1441
|
-
var MissingConnectionNotificationPayloadSchema =
|
|
1593
|
+
var MissingConnectionNotificationPayloadSchema = import_zod13.z.discriminatedUnion("type", [
|
|
1442
1594
|
MissingDeveloperConnectionNotificationPayloadSchema,
|
|
1443
1595
|
MissingExternalConnectionNotificationPayloadSchema
|
|
1444
1596
|
]);
|
|
1445
|
-
var CommonMissingConnectionNotificationResolvedPayloadSchema =
|
|
1446
|
-
id:
|
|
1447
|
-
client:
|
|
1448
|
-
id:
|
|
1449
|
-
title:
|
|
1450
|
-
scopes:
|
|
1451
|
-
createdAt:
|
|
1452
|
-
updatedAt:
|
|
1453
|
-
integrationIdentifier:
|
|
1454
|
-
integrationAuthMethod:
|
|
1597
|
+
var CommonMissingConnectionNotificationResolvedPayloadSchema = import_zod13.z.object({
|
|
1598
|
+
id: import_zod13.z.string(),
|
|
1599
|
+
client: import_zod13.z.object({
|
|
1600
|
+
id: import_zod13.z.string(),
|
|
1601
|
+
title: import_zod13.z.string(),
|
|
1602
|
+
scopes: import_zod13.z.array(import_zod13.z.string()),
|
|
1603
|
+
createdAt: import_zod13.z.coerce.date(),
|
|
1604
|
+
updatedAt: import_zod13.z.coerce.date(),
|
|
1605
|
+
integrationIdentifier: import_zod13.z.string(),
|
|
1606
|
+
integrationAuthMethod: import_zod13.z.string()
|
|
1455
1607
|
}),
|
|
1456
|
-
expiresAt:
|
|
1608
|
+
expiresAt: import_zod13.z.coerce.date()
|
|
1457
1609
|
});
|
|
1458
1610
|
var MissingDeveloperConnectionResolvedNotificationPayloadSchema = CommonMissingConnectionNotificationResolvedPayloadSchema.extend({
|
|
1459
|
-
type:
|
|
1611
|
+
type: import_zod13.z.literal("DEVELOPER")
|
|
1460
1612
|
});
|
|
1461
1613
|
var MissingExternalConnectionResolvedNotificationPayloadSchema = CommonMissingConnectionNotificationResolvedPayloadSchema.extend({
|
|
1462
|
-
type:
|
|
1463
|
-
account:
|
|
1464
|
-
id:
|
|
1465
|
-
metadata:
|
|
1614
|
+
type: import_zod13.z.literal("EXTERNAL"),
|
|
1615
|
+
account: import_zod13.z.object({
|
|
1616
|
+
id: import_zod13.z.string(),
|
|
1617
|
+
metadata: import_zod13.z.any()
|
|
1466
1618
|
})
|
|
1467
1619
|
});
|
|
1468
|
-
var MissingConnectionResolvedNotificationPayloadSchema =
|
|
1620
|
+
var MissingConnectionResolvedNotificationPayloadSchema = import_zod13.z.discriminatedUnion("type", [
|
|
1469
1621
|
MissingDeveloperConnectionResolvedNotificationPayloadSchema,
|
|
1470
1622
|
MissingExternalConnectionResolvedNotificationPayloadSchema
|
|
1471
1623
|
]);
|
|
1472
1624
|
|
|
1473
1625
|
// src/schemas/fetch.ts
|
|
1474
|
-
var
|
|
1475
|
-
var FetchRetryHeadersStrategySchema =
|
|
1626
|
+
var import_zod14 = require("zod");
|
|
1627
|
+
var FetchRetryHeadersStrategySchema = import_zod14.z.object({
|
|
1476
1628
|
/** The `headers` strategy retries the request using info from the response headers. */
|
|
1477
|
-
strategy:
|
|
1629
|
+
strategy: import_zod14.z.literal("headers"),
|
|
1478
1630
|
/** The header to use to determine the maximum number of times to retry the request. */
|
|
1479
|
-
limitHeader:
|
|
1631
|
+
limitHeader: import_zod14.z.string(),
|
|
1480
1632
|
/** The header to use to determine the number of remaining retries. */
|
|
1481
|
-
remainingHeader:
|
|
1633
|
+
remainingHeader: import_zod14.z.string(),
|
|
1482
1634
|
/** The header to use to determine the time when the number of remaining retries will be reset. */
|
|
1483
|
-
resetHeader:
|
|
1635
|
+
resetHeader: import_zod14.z.string()
|
|
1484
1636
|
});
|
|
1485
1637
|
var FetchRetryBackoffStrategySchema = RetryOptionsSchema.extend({
|
|
1486
1638
|
/** The `backoff` strategy retries the request with an exponential backoff. */
|
|
1487
|
-
strategy:
|
|
1639
|
+
strategy: import_zod14.z.literal("backoff")
|
|
1488
1640
|
});
|
|
1489
|
-
var FetchRetryStrategySchema =
|
|
1641
|
+
var FetchRetryStrategySchema = import_zod14.z.discriminatedUnion("strategy", [
|
|
1490
1642
|
FetchRetryHeadersStrategySchema,
|
|
1491
1643
|
FetchRetryBackoffStrategySchema
|
|
1492
1644
|
]);
|
|
1493
|
-
var FetchRequestInitSchema =
|
|
1645
|
+
var FetchRequestInitSchema = import_zod14.z.object({
|
|
1494
1646
|
/** The HTTP method to use for the request. */
|
|
1495
|
-
method:
|
|
1647
|
+
method: import_zod14.z.string().optional(),
|
|
1496
1648
|
/** 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. */
|
|
1497
|
-
headers:
|
|
1498
|
-
|
|
1649
|
+
headers: import_zod14.z.record(import_zod14.z.union([
|
|
1650
|
+
import_zod14.z.string(),
|
|
1499
1651
|
RedactStringSchema
|
|
1500
1652
|
])).optional(),
|
|
1501
1653
|
/** The body of the request. */
|
|
1502
|
-
body:
|
|
1503
|
-
|
|
1504
|
-
|
|
1654
|
+
body: import_zod14.z.union([
|
|
1655
|
+
import_zod14.z.string(),
|
|
1656
|
+
import_zod14.z.instanceof(ArrayBuffer)
|
|
1505
1657
|
]).optional()
|
|
1506
1658
|
});
|
|
1507
|
-
var FetchRetryOptionsSchema =
|
|
1508
|
-
var
|
|
1509
|
-
|
|
1659
|
+
var FetchRetryOptionsSchema = import_zod14.z.record(FetchRetryStrategySchema);
|
|
1660
|
+
var FetchTimeoutOptionsSchema = import_zod14.z.object({
|
|
1661
|
+
durationInMs: import_zod14.z.number(),
|
|
1662
|
+
retry: RetryOptionsSchema.optional()
|
|
1663
|
+
});
|
|
1664
|
+
var FetchOperationSchema = import_zod14.z.object({
|
|
1665
|
+
url: import_zod14.z.string(),
|
|
1510
1666
|
requestInit: FetchRequestInitSchema.optional(),
|
|
1511
|
-
retry:
|
|
1667
|
+
retry: import_zod14.z.record(FetchRetryStrategySchema).optional(),
|
|
1668
|
+
timeout: FetchTimeoutOptionsSchema.optional()
|
|
1512
1669
|
});
|
|
1513
1670
|
|
|
1514
1671
|
// src/schemas/events.ts
|
|
1515
|
-
var
|
|
1516
|
-
var GetEventSchema =
|
|
1672
|
+
var import_zod15 = require("zod");
|
|
1673
|
+
var GetEventSchema = import_zod15.z.object({
|
|
1517
1674
|
/** The event id */
|
|
1518
|
-
id:
|
|
1675
|
+
id: import_zod15.z.string(),
|
|
1519
1676
|
/** The event name */
|
|
1520
|
-
name:
|
|
1677
|
+
name: import_zod15.z.string(),
|
|
1521
1678
|
/** When the event was created */
|
|
1522
|
-
createdAt:
|
|
1679
|
+
createdAt: import_zod15.z.coerce.date(),
|
|
1523
1680
|
/** When the event was last updated */
|
|
1524
|
-
updatedAt:
|
|
1681
|
+
updatedAt: import_zod15.z.coerce.date(),
|
|
1525
1682
|
/** The runs that were triggered by the event */
|
|
1526
|
-
runs:
|
|
1683
|
+
runs: import_zod15.z.array(import_zod15.z.object({
|
|
1527
1684
|
/** The Run id */
|
|
1528
|
-
id:
|
|
1685
|
+
id: import_zod15.z.string(),
|
|
1529
1686
|
/** The Run status */
|
|
1530
1687
|
status: RunStatusSchema,
|
|
1531
1688
|
/** When the run started */
|
|
1532
|
-
startedAt:
|
|
1689
|
+
startedAt: import_zod15.z.coerce.date().optional().nullable(),
|
|
1533
1690
|
/** When the run completed */
|
|
1534
|
-
completedAt:
|
|
1691
|
+
completedAt: import_zod15.z.coerce.date().optional().nullable()
|
|
1535
1692
|
}))
|
|
1536
1693
|
});
|
|
1537
|
-
var CancelRunsForEventSchema =
|
|
1538
|
-
cancelledRunIds:
|
|
1539
|
-
failedToCancelRunIds:
|
|
1694
|
+
var CancelRunsForEventSchema = import_zod15.z.object({
|
|
1695
|
+
cancelledRunIds: import_zod15.z.array(import_zod15.z.string()),
|
|
1696
|
+
failedToCancelRunIds: import_zod15.z.array(import_zod15.z.string())
|
|
1697
|
+
});
|
|
1698
|
+
|
|
1699
|
+
// src/schemas/request.ts
|
|
1700
|
+
var import_zod16 = require("zod");
|
|
1701
|
+
var RequestWithRawBodySchema = import_zod16.z.object({
|
|
1702
|
+
url: import_zod16.z.string(),
|
|
1703
|
+
method: import_zod16.z.string(),
|
|
1704
|
+
headers: import_zod16.z.record(import_zod16.z.string()),
|
|
1705
|
+
rawBody: import_zod16.z.string()
|
|
1540
1706
|
});
|
|
1541
1707
|
|
|
1542
1708
|
// src/utils.ts
|
|
@@ -1623,6 +1789,13 @@ __name(urlWithSearchParams, "urlWithSearchParams");
|
|
|
1623
1789
|
|
|
1624
1790
|
// src/eventFilterMatches.ts
|
|
1625
1791
|
function eventFilterMatches(payload, filter) {
|
|
1792
|
+
if (payload === void 0 || payload === null) {
|
|
1793
|
+
if (Object.entries(filter).length === 0) {
|
|
1794
|
+
return true;
|
|
1795
|
+
} else {
|
|
1796
|
+
return false;
|
|
1797
|
+
}
|
|
1798
|
+
}
|
|
1626
1799
|
for (const [patternKey, patternValue] of Object.entries(filter)) {
|
|
1627
1800
|
const payloadValue = payload[patternKey];
|
|
1628
1801
|
if (Array.isArray(patternValue)) {
|
|
@@ -1763,61 +1936,48 @@ function contentFilterMatches(actualValue, contentFilter) {
|
|
|
1763
1936
|
}
|
|
1764
1937
|
__name(contentFilterMatches, "contentFilterMatches");
|
|
1765
1938
|
|
|
1766
|
-
// src/
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
this.bitArray = new Uint8Array(Math.ceil(size / 8));
|
|
1939
|
+
// src/requestFilterMatches.ts
|
|
1940
|
+
async function requestFilterMatches(request, filter) {
|
|
1941
|
+
const clonedRequest = request.clone();
|
|
1942
|
+
if (!requestMethodMatches(clonedRequest.method, filter.method)) {
|
|
1943
|
+
return false;
|
|
1772
1944
|
}
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
this.bitArray[Math.floor(index / 8)] |= 1 << index % 8;
|
|
1945
|
+
if (filter.headers && !eventFilterMatches(clonedRequest.headers, filter.headers)) {
|
|
1946
|
+
return false;
|
|
1776
1947
|
}
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1948
|
+
const searchParams = new URL(clonedRequest.url).searchParams;
|
|
1949
|
+
const searchParamsObject = {};
|
|
1950
|
+
for (const [key, value] of searchParams.entries()) {
|
|
1951
|
+
searchParamsObject[key] = value;
|
|
1780
1952
|
}
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
return import_node_buffer.Buffer.from(this.bitArray).toString("base64");
|
|
1953
|
+
if (filter.query && !eventFilterMatches(searchParamsObject, filter.query)) {
|
|
1954
|
+
return false;
|
|
1784
1955
|
}
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1956
|
+
try {
|
|
1957
|
+
const json = await clonedRequest.json();
|
|
1958
|
+
if (filter.body && !eventFilterMatches(json, filter.body)) {
|
|
1959
|
+
return false;
|
|
1960
|
+
}
|
|
1961
|
+
} catch (e) {
|
|
1962
|
+
if (filter.body) {
|
|
1963
|
+
return false;
|
|
1964
|
+
}
|
|
1790
1965
|
}
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
for (let i = 0, ch; i < str.length; i++) {
|
|
1798
|
-
ch = str.charCodeAt(i);
|
|
1799
|
-
h1 = Math.imul(h1 ^ ch, 3432918353);
|
|
1800
|
-
h1 = h1 << 15 | h1 >>> 17;
|
|
1801
|
-
h1 = Math.imul(h1, 461845907);
|
|
1802
|
-
h2 = Math.imul(h2 ^ ch, 2246822507);
|
|
1803
|
-
h2 = h2 << 13 | h2 >>> 19;
|
|
1804
|
-
h2 = Math.imul(h2, 3266489909);
|
|
1966
|
+
return true;
|
|
1967
|
+
}
|
|
1968
|
+
__name(requestFilterMatches, "requestFilterMatches");
|
|
1969
|
+
function requestMethodMatches(method, filter) {
|
|
1970
|
+
if (!filter) {
|
|
1971
|
+
return true;
|
|
1805
1972
|
}
|
|
1806
|
-
|
|
1807
|
-
h2 ^= str.length;
|
|
1808
|
-
h1 = Math.imul(h1 ^ h1 >>> 16, 2246822507);
|
|
1809
|
-
h1 = Math.imul(h1 ^ h1 >>> 13, 3266489909);
|
|
1810
|
-
h1 ^= h1 >>> 16;
|
|
1811
|
-
h2 = Math.imul(h2 ^ h2 >>> 16, 2246822507);
|
|
1812
|
-
h2 = Math.imul(h2 ^ h2 >>> 13, 3266489909);
|
|
1813
|
-
h2 ^= h2 >>> 16;
|
|
1814
|
-
return 4294967296 * (2097151 & h2) + (h1 >>> 0);
|
|
1973
|
+
return filter.includes(method);
|
|
1815
1974
|
}
|
|
1816
|
-
__name(
|
|
1975
|
+
__name(requestMethodMatches, "requestMethodMatches");
|
|
1817
1976
|
|
|
1818
1977
|
// src/index.ts
|
|
1819
1978
|
var API_VERSIONS = {
|
|
1820
|
-
LAZY_LOADED_CACHED_TASKS: "2023-09-29"
|
|
1979
|
+
LAZY_LOADED_CACHED_TASKS: "2023-09-29",
|
|
1980
|
+
SERIALIZED_TASK_OUTPUT: "2023-11-01"
|
|
1821
1981
|
};
|
|
1822
1982
|
var PLATFORM_FEATURES = {
|
|
1823
1983
|
yieldExecution: API_VERSIONS.LAZY_LOADED_CACHED_TASKS,
|