@trigger.dev/core 0.0.0-cliframeworks-20230929110149 → 0.0.0-cross-runtime-20231201102436
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 +8285 -1075
- package/dist/index.js +1022 -384
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -43,41 +43,58 @@ var __privateMethod = (obj, member, method) => {
|
|
|
43
43
|
// src/index.ts
|
|
44
44
|
var src_exports = {};
|
|
45
45
|
__export(src_exports, {
|
|
46
|
+
API_VERSIONS: () => API_VERSIONS,
|
|
46
47
|
ApiEventLogSchema: () => ApiEventLogSchema,
|
|
48
|
+
AutoYieldConfigSchema: () => AutoYieldConfigSchema,
|
|
49
|
+
AutoYieldMetadataSchema: () => AutoYieldMetadataSchema,
|
|
47
50
|
CachedTaskSchema: () => CachedTaskSchema,
|
|
51
|
+
CancelRunsForEventSchema: () => CancelRunsForEventSchema,
|
|
48
52
|
CommonMissingConnectionNotificationPayloadSchema: () => CommonMissingConnectionNotificationPayloadSchema,
|
|
49
53
|
CommonMissingConnectionNotificationResolvedPayloadSchema: () => CommonMissingConnectionNotificationResolvedPayloadSchema,
|
|
50
54
|
CompleteTaskBodyInputSchema: () => CompleteTaskBodyInputSchema,
|
|
55
|
+
CompleteTaskBodyV2InputSchema: () => CompleteTaskBodyV2InputSchema,
|
|
56
|
+
ConcurrencyLimitOptionsSchema: () => ConcurrencyLimitOptionsSchema,
|
|
51
57
|
ConnectionAuthSchema: () => ConnectionAuthSchema,
|
|
52
58
|
CreateExternalConnectionBodySchema: () => CreateExternalConnectionBodySchema,
|
|
53
59
|
CreateRunResponseBodySchema: () => CreateRunResponseBodySchema,
|
|
54
60
|
CronMetadataSchema: () => CronMetadataSchema,
|
|
55
61
|
CronOptionsSchema: () => CronOptionsSchema,
|
|
62
|
+
DELIVER_WEBHOOK_REQUEST: () => DELIVER_WEBHOOK_REQUEST,
|
|
56
63
|
DeliverEventResponseSchema: () => DeliverEventResponseSchema,
|
|
57
64
|
DeserializedJsonSchema: () => DeserializedJsonSchema,
|
|
58
65
|
DisplayPropertiesSchema: () => DisplayPropertiesSchema,
|
|
59
66
|
DisplayPropertySchema: () => DisplayPropertySchema,
|
|
60
67
|
DynamicTriggerEndpointMetadataSchema: () => DynamicTriggerEndpointMetadataSchema,
|
|
61
68
|
DynamicTriggerMetadataSchema: () => DynamicTriggerMetadataSchema,
|
|
69
|
+
EndpointHeadersSchema: () => EndpointHeadersSchema,
|
|
70
|
+
EndpointIndexErrorSchema: () => EndpointIndexErrorSchema,
|
|
71
|
+
EphemeralEventDispatcherRequestBodySchema: () => EphemeralEventDispatcherRequestBodySchema,
|
|
72
|
+
EphemeralEventDispatcherResponseBodySchema: () => EphemeralEventDispatcherResponseBodySchema,
|
|
62
73
|
ErrorWithStackSchema: () => ErrorWithStackSchema,
|
|
63
74
|
EventExampleSchema: () => EventExampleSchema,
|
|
64
75
|
EventFilterSchema: () => EventFilterSchema,
|
|
65
76
|
EventRuleSchema: () => EventRuleSchema,
|
|
66
77
|
EventSpecificationSchema: () => EventSpecificationSchema,
|
|
78
|
+
ExecuteJobHeadersSchema: () => ExecuteJobHeadersSchema,
|
|
79
|
+
ExecuteJobRunMetadataSchema: () => ExecuteJobRunMetadataSchema,
|
|
67
80
|
FailTaskBodyInputSchema: () => FailTaskBodyInputSchema,
|
|
68
81
|
FetchOperationSchema: () => FetchOperationSchema,
|
|
82
|
+
FetchPollOperationSchema: () => FetchPollOperationSchema,
|
|
69
83
|
FetchRequestInitSchema: () => FetchRequestInitSchema,
|
|
70
84
|
FetchRetryBackoffStrategySchema: () => FetchRetryBackoffStrategySchema,
|
|
71
85
|
FetchRetryHeadersStrategySchema: () => FetchRetryHeadersStrategySchema,
|
|
72
86
|
FetchRetryOptionsSchema: () => FetchRetryOptionsSchema,
|
|
73
87
|
FetchRetryStrategySchema: () => FetchRetryStrategySchema,
|
|
88
|
+
FetchTimeoutOptionsSchema: () => FetchTimeoutOptionsSchema,
|
|
89
|
+
GetEndpointIndexResponseSchema: () => GetEndpointIndexResponseSchema,
|
|
74
90
|
GetEventSchema: () => GetEventSchema,
|
|
75
91
|
GetRunSchema: () => GetRunSchema,
|
|
76
92
|
GetRunStatusesSchema: () => GetRunStatusesSchema,
|
|
77
93
|
GetRunsSchema: () => GetRunsSchema,
|
|
94
|
+
HTTPMethodUnionSchema: () => HTTPMethodUnionSchema,
|
|
78
95
|
HandleTriggerSourceSchema: () => HandleTriggerSourceSchema,
|
|
96
|
+
HttpEndpointRequestHeadersSchema: () => HttpEndpointRequestHeadersSchema,
|
|
79
97
|
HttpSourceRequestHeadersSchema: () => HttpSourceRequestHeadersSchema,
|
|
80
|
-
HttpSourceRequestSchema: () => HttpSourceRequestSchema,
|
|
81
98
|
HttpSourceResponseSchema: () => HttpSourceResponseSchema,
|
|
82
99
|
IndexEndpointResponseSchema: () => IndexEndpointResponseSchema,
|
|
83
100
|
InitializeCronScheduleBodySchema: () => InitializeCronScheduleBodySchema,
|
|
@@ -86,8 +103,13 @@ __export(src_exports, {
|
|
|
86
103
|
IntegrationMetadataSchema: () => IntegrationMetadataSchema,
|
|
87
104
|
IntervalMetadataSchema: () => IntervalMetadataSchema,
|
|
88
105
|
IntervalOptionsSchema: () => IntervalOptionsSchema,
|
|
106
|
+
InvokeJobRequestBodySchema: () => InvokeJobRequestBodySchema,
|
|
107
|
+
InvokeJobResponseSchema: () => InvokeJobResponseSchema,
|
|
108
|
+
InvokeOptionsSchema: () => InvokeOptionsSchema,
|
|
109
|
+
InvokeTriggerMetadataSchema: () => InvokeTriggerMetadataSchema,
|
|
89
110
|
JobMetadataSchema: () => JobMetadataSchema,
|
|
90
111
|
JobRunStatusRecordSchema: () => JobRunStatusRecordSchema,
|
|
112
|
+
KeyValueStoreResponseBodySchema: () => KeyValueStoreResponseBodySchema,
|
|
91
113
|
LogMessageSchema: () => LogMessageSchema,
|
|
92
114
|
Logger: () => Logger,
|
|
93
115
|
MISSING_CONNECTION_NOTIFICATION: () => MISSING_CONNECTION_NOTIFICATION,
|
|
@@ -100,6 +122,7 @@ __export(src_exports, {
|
|
|
100
122
|
MissingExternalConnectionResolvedNotificationPayloadSchema: () => MissingExternalConnectionResolvedNotificationPayloadSchema,
|
|
101
123
|
NormalizedRequestSchema: () => NormalizedRequestSchema,
|
|
102
124
|
NormalizedResponseSchema: () => NormalizedResponseSchema,
|
|
125
|
+
PLATFORM_FEATURES: () => PLATFORM_FEATURES,
|
|
103
126
|
PongErrorResponseSchema: () => PongErrorResponseSchema,
|
|
104
127
|
PongResponseSchema: () => PongResponseSchema,
|
|
105
128
|
PongSuccessResponseSchema: () => PongSuccessResponseSchema,
|
|
@@ -108,6 +131,7 @@ __export(src_exports, {
|
|
|
108
131
|
QueueOptionsSchema: () => QueueOptionsSchema,
|
|
109
132
|
REGISTER_SOURCE_EVENT_V1: () => REGISTER_SOURCE_EVENT_V1,
|
|
110
133
|
REGISTER_SOURCE_EVENT_V2: () => REGISTER_SOURCE_EVENT_V2,
|
|
134
|
+
REGISTER_WEBHOOK: () => REGISTER_WEBHOOK,
|
|
111
135
|
RawEventSchema: () => RawEventSchema,
|
|
112
136
|
RedactSchema: () => RedactSchema,
|
|
113
137
|
RedactStringSchema: () => RedactStringSchema,
|
|
@@ -124,21 +148,32 @@ __export(src_exports, {
|
|
|
124
148
|
RegisterTriggerBodySchemaV1: () => RegisterTriggerBodySchemaV1,
|
|
125
149
|
RegisterTriggerBodySchemaV2: () => RegisterTriggerBodySchemaV2,
|
|
126
150
|
RegisterTriggerSourceSchema: () => RegisterTriggerSourceSchema,
|
|
151
|
+
RegisterWebhookPayloadSchema: () => RegisterWebhookPayloadSchema,
|
|
152
|
+
RegisterWebhookSourceSchema: () => RegisterWebhookSourceSchema,
|
|
153
|
+
RequestFilterSchema: () => RequestFilterSchema,
|
|
154
|
+
RequestWithRawBodySchema: () => RequestWithRawBodySchema,
|
|
155
|
+
ResponseFilterSchema: () => ResponseFilterSchema,
|
|
127
156
|
RetryOptionsSchema: () => RetryOptionsSchema,
|
|
157
|
+
RunJobAutoYieldExecutionErrorSchema: () => RunJobAutoYieldExecutionErrorSchema,
|
|
158
|
+
RunJobAutoYieldWithCompletedTaskExecutionErrorSchema: () => RunJobAutoYieldWithCompletedTaskExecutionErrorSchema,
|
|
128
159
|
RunJobBodySchema: () => RunJobBodySchema,
|
|
129
160
|
RunJobCanceledWithTaskSchema: () => RunJobCanceledWithTaskSchema,
|
|
161
|
+
RunJobErrorResponseSchema: () => RunJobErrorResponseSchema,
|
|
130
162
|
RunJobErrorSchema: () => RunJobErrorSchema,
|
|
131
163
|
RunJobInvalidPayloadErrorSchema: () => RunJobInvalidPayloadErrorSchema,
|
|
132
164
|
RunJobResponseSchema: () => RunJobResponseSchema,
|
|
165
|
+
RunJobResumeWithParallelTaskSchema: () => RunJobResumeWithParallelTaskSchema,
|
|
133
166
|
RunJobResumeWithTaskSchema: () => RunJobResumeWithTaskSchema,
|
|
134
167
|
RunJobRetryWithTaskSchema: () => RunJobRetryWithTaskSchema,
|
|
135
168
|
RunJobSuccessSchema: () => RunJobSuccessSchema,
|
|
136
169
|
RunJobUnresolvedAuthErrorSchema: () => RunJobUnresolvedAuthErrorSchema,
|
|
170
|
+
RunJobYieldExecutionErrorSchema: () => RunJobYieldExecutionErrorSchema,
|
|
137
171
|
RunSourceContextSchema: () => RunSourceContextSchema,
|
|
138
172
|
RunStatusSchema: () => RunStatusSchema,
|
|
139
173
|
RunTaskBodyInputSchema: () => RunTaskBodyInputSchema,
|
|
140
174
|
RunTaskBodyOutputSchema: () => RunTaskBodyOutputSchema,
|
|
141
175
|
RunTaskOptionsSchema: () => RunTaskOptionsSchema,
|
|
176
|
+
RunTaskResponseWithCachedTasksBodySchema: () => RunTaskResponseWithCachedTasksBodySchema,
|
|
142
177
|
RunTaskSchema: () => RunTaskSchema,
|
|
143
178
|
RuntimeEnvironmentTypeSchema: () => RuntimeEnvironmentTypeSchema,
|
|
144
179
|
SCHEDULED_EVENT: () => SCHEDULED_EVENT,
|
|
@@ -146,6 +181,7 @@ __export(src_exports, {
|
|
|
146
181
|
ScheduledPayloadSchema: () => ScheduledPayloadSchema,
|
|
147
182
|
ScheduledTriggerMetadataSchema: () => ScheduledTriggerMetadataSchema,
|
|
148
183
|
SchemaErrorSchema: () => SchemaErrorSchema,
|
|
184
|
+
SendBulkEventsBodySchema: () => SendBulkEventsBodySchema,
|
|
149
185
|
SendEventBodySchema: () => SendEventBodySchema,
|
|
150
186
|
SendEventOptionsSchema: () => SendEventOptionsSchema,
|
|
151
187
|
SerializableJsonSchema: () => SerializableJsonSchema,
|
|
@@ -158,21 +194,34 @@ __export(src_exports, {
|
|
|
158
194
|
StyleSchema: () => StyleSchema,
|
|
159
195
|
TaskSchema: () => TaskSchema,
|
|
160
196
|
TaskStatusSchema: () => TaskStatusSchema,
|
|
197
|
+
TriggerHelpSchema: () => TriggerHelpSchema,
|
|
161
198
|
TriggerMetadataSchema: () => TriggerMetadataSchema,
|
|
162
199
|
TriggerSourceSchema: () => TriggerSourceSchema,
|
|
163
200
|
UpdateTriggerSourceBodyV1Schema: () => UpdateTriggerSourceBodyV1Schema,
|
|
164
201
|
UpdateTriggerSourceBodyV2Schema: () => UpdateTriggerSourceBodyV2Schema,
|
|
202
|
+
UpdateWebhookBodySchema: () => UpdateWebhookBodySchema,
|
|
165
203
|
ValidateErrorResponseSchema: () => ValidateErrorResponseSchema,
|
|
166
204
|
ValidateResponseSchema: () => ValidateResponseSchema,
|
|
167
205
|
ValidateSuccessResponseSchema: () => ValidateSuccessResponseSchema,
|
|
206
|
+
WebhookContextMetadataSchema: () => WebhookContextMetadataSchema,
|
|
207
|
+
WebhookDeliveryResponseSchema: () => WebhookDeliveryResponseSchema,
|
|
208
|
+
WebhookMetadataSchema: () => WebhookMetadataSchema,
|
|
209
|
+
WebhookSourceRequestHeadersSchema: () => WebhookSourceRequestHeadersSchema,
|
|
168
210
|
addMissingVersionField: () => addMissingVersionField,
|
|
211
|
+
assertExhaustive: () => assertExhaustive,
|
|
212
|
+
calculateResetAt: () => calculateResetAt,
|
|
169
213
|
calculateRetryAt: () => calculateRetryAt,
|
|
170
214
|
currentDate: () => currentDate,
|
|
171
215
|
currentTimestampMilliseconds: () => currentTimestampMilliseconds,
|
|
172
216
|
currentTimestampSeconds: () => currentTimestampSeconds,
|
|
173
217
|
deepMergeFilters: () => deepMergeFilters,
|
|
174
218
|
eventFilterMatches: () => eventFilterMatches,
|
|
219
|
+
parseEndpointIndexStats: () => parseEndpointIndexStats,
|
|
175
220
|
replacements: () => replacements,
|
|
221
|
+
requestFilterMatches: () => requestFilterMatches,
|
|
222
|
+
responseFilterMatches: () => responseFilterMatches,
|
|
223
|
+
stringPatternMatchers: () => stringPatternMatchers,
|
|
224
|
+
supportsFeature: () => supportsFeature,
|
|
176
225
|
urlWithSearchParams: () => urlWithSearchParams
|
|
177
226
|
});
|
|
178
227
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -185,18 +234,20 @@ var logLevels = [
|
|
|
185
234
|
"info",
|
|
186
235
|
"debug"
|
|
187
236
|
];
|
|
188
|
-
var _name, _level, _filteredKeys, _jsonReplacer, _structuredLog, structuredLog_fn;
|
|
237
|
+
var _name, _level, _filteredKeys, _jsonReplacer, _additionalFields, _structuredLog, structuredLog_fn;
|
|
189
238
|
var _Logger = class _Logger {
|
|
190
|
-
constructor(name, level = "info", filteredKeys = [], jsonReplacer) {
|
|
239
|
+
constructor(name, level = "info", filteredKeys = [], jsonReplacer, additionalFields) {
|
|
191
240
|
__privateAdd(this, _structuredLog);
|
|
192
241
|
__privateAdd(this, _name, void 0);
|
|
193
242
|
__privateAdd(this, _level, void 0);
|
|
194
243
|
__privateAdd(this, _filteredKeys, []);
|
|
195
244
|
__privateAdd(this, _jsonReplacer, void 0);
|
|
245
|
+
__privateAdd(this, _additionalFields, void 0);
|
|
196
246
|
__privateSet(this, _name, name);
|
|
197
247
|
__privateSet(this, _level, logLevels.indexOf(process.env.TRIGGER_LOG_LEVEL ?? level));
|
|
198
248
|
__privateSet(this, _filteredKeys, filteredKeys);
|
|
199
|
-
__privateSet(this, _jsonReplacer, jsonReplacer);
|
|
249
|
+
__privateSet(this, _jsonReplacer, createReplacer(jsonReplacer));
|
|
250
|
+
__privateSet(this, _additionalFields, additionalFields ?? (() => ({})));
|
|
200
251
|
}
|
|
201
252
|
// Return a new Logger instance with the same name and a new log level
|
|
202
253
|
// but filter out the keys from the log messages (at any level)
|
|
@@ -209,42 +260,45 @@ var _Logger = class _Logger {
|
|
|
209
260
|
log(message, ...args) {
|
|
210
261
|
if (__privateGet(this, _level) < 0)
|
|
211
262
|
return;
|
|
212
|
-
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.log, message, ...args);
|
|
263
|
+
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.log, message, "log", ...args);
|
|
213
264
|
}
|
|
214
265
|
error(message, ...args) {
|
|
215
266
|
if (__privateGet(this, _level) < 1)
|
|
216
267
|
return;
|
|
217
|
-
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.error, message, ...args);
|
|
268
|
+
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.error, message, "error", ...args);
|
|
218
269
|
}
|
|
219
270
|
warn(message, ...args) {
|
|
220
271
|
if (__privateGet(this, _level) < 2)
|
|
221
272
|
return;
|
|
222
|
-
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.warn, message, ...args);
|
|
273
|
+
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.warn, message, "warn", ...args);
|
|
223
274
|
}
|
|
224
275
|
info(message, ...args) {
|
|
225
276
|
if (__privateGet(this, _level) < 3)
|
|
226
277
|
return;
|
|
227
|
-
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.info, message, ...args);
|
|
278
|
+
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.info, message, "info", ...args);
|
|
228
279
|
}
|
|
229
280
|
debug(message, ...args) {
|
|
230
281
|
if (__privateGet(this, _level) < 4)
|
|
231
282
|
return;
|
|
232
|
-
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.debug, message, ...args);
|
|
283
|
+
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.debug, message, "debug", ...args);
|
|
233
284
|
}
|
|
234
285
|
};
|
|
235
286
|
_name = new WeakMap();
|
|
236
287
|
_level = new WeakMap();
|
|
237
288
|
_filteredKeys = new WeakMap();
|
|
238
289
|
_jsonReplacer = new WeakMap();
|
|
290
|
+
_additionalFields = new WeakMap();
|
|
239
291
|
_structuredLog = new WeakSet();
|
|
240
|
-
structuredLog_fn = /* @__PURE__ */ __name(function(loggerFunction, message, ...args) {
|
|
292
|
+
structuredLog_fn = /* @__PURE__ */ __name(function(loggerFunction, message, level, ...args) {
|
|
241
293
|
const structuredLog = {
|
|
242
294
|
...structureArgs(safeJsonClone(args), __privateGet(this, _filteredKeys)),
|
|
295
|
+
...__privateGet(this, _additionalFields).call(this),
|
|
243
296
|
timestamp: /* @__PURE__ */ new Date(),
|
|
244
297
|
name: __privateGet(this, _name),
|
|
245
|
-
message
|
|
298
|
+
message,
|
|
299
|
+
level
|
|
246
300
|
};
|
|
247
|
-
loggerFunction(JSON.stringify(structuredLog,
|
|
301
|
+
loggerFunction(JSON.stringify(structuredLog, __privateGet(this, _jsonReplacer)));
|
|
248
302
|
}, "#structuredLog");
|
|
249
303
|
__name(_Logger, "Logger");
|
|
250
304
|
var Logger = _Logger;
|
|
@@ -271,11 +325,14 @@ function safeJsonClone(obj) {
|
|
|
271
325
|
try {
|
|
272
326
|
return JSON.parse(JSON.stringify(obj, bigIntReplacer));
|
|
273
327
|
} catch (e) {
|
|
274
|
-
return
|
|
328
|
+
return;
|
|
275
329
|
}
|
|
276
330
|
}
|
|
277
331
|
__name(safeJsonClone, "safeJsonClone");
|
|
278
332
|
function structureArgs(args, filteredKeys = []) {
|
|
333
|
+
if (!args) {
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
279
336
|
if (args.length === 0) {
|
|
280
337
|
return;
|
|
281
338
|
}
|
|
@@ -311,7 +368,7 @@ function prettyPrintBytes(value) {
|
|
|
311
368
|
if (process.env.NODE_ENV === "production") {
|
|
312
369
|
return "skipped size";
|
|
313
370
|
}
|
|
314
|
-
const sizeInBytes =
|
|
371
|
+
const sizeInBytes = getSizeInBytes(value);
|
|
315
372
|
if (sizeInBytes < 1024) {
|
|
316
373
|
return `${sizeInBytes} bytes`;
|
|
317
374
|
}
|
|
@@ -324,10 +381,19 @@ function prettyPrintBytes(value) {
|
|
|
324
381
|
return `${(sizeInBytes / (1024 * 1024 * 1024)).toFixed(2)} GB`;
|
|
325
382
|
}
|
|
326
383
|
__name(prettyPrintBytes, "prettyPrintBytes");
|
|
384
|
+
function getSizeInBytes(value) {
|
|
385
|
+
const jsonString = JSON.stringify(value);
|
|
386
|
+
if (typeof window === "undefined") {
|
|
387
|
+
return Buffer.byteLength(jsonString, "utf8");
|
|
388
|
+
} else {
|
|
389
|
+
return new TextEncoder().encode(jsonString).length;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
__name(getSizeInBytes, "getSizeInBytes");
|
|
327
393
|
|
|
328
394
|
// src/schemas/api.ts
|
|
329
|
-
var
|
|
330
|
-
var
|
|
395
|
+
var import_ulidx = require("ulidx");
|
|
396
|
+
var import_zod12 = require("zod");
|
|
331
397
|
|
|
332
398
|
// src/schemas/addMissingVersionField.ts
|
|
333
399
|
function addMissingVersionField(val) {
|
|
@@ -355,6 +421,17 @@ var SchemaErrorSchema = import_zod.z.object({
|
|
|
355
421
|
|
|
356
422
|
// src/schemas/eventFilter.ts
|
|
357
423
|
var import_zod2 = require("zod");
|
|
424
|
+
var stringPatternMatchers = [
|
|
425
|
+
import_zod2.z.object({
|
|
426
|
+
$endsWith: import_zod2.z.string()
|
|
427
|
+
}),
|
|
428
|
+
import_zod2.z.object({
|
|
429
|
+
$startsWith: import_zod2.z.string()
|
|
430
|
+
}),
|
|
431
|
+
import_zod2.z.object({
|
|
432
|
+
$ignoreCaseEquals: import_zod2.z.string()
|
|
433
|
+
})
|
|
434
|
+
];
|
|
358
435
|
var EventMatcherSchema = import_zod2.z.union([
|
|
359
436
|
/** Match against a string */
|
|
360
437
|
import_zod2.z.array(import_zod2.z.string()),
|
|
@@ -363,12 +440,7 @@ var EventMatcherSchema = import_zod2.z.union([
|
|
|
363
440
|
/** Match against a boolean */
|
|
364
441
|
import_zod2.z.array(import_zod2.z.boolean()),
|
|
365
442
|
import_zod2.z.array(import_zod2.z.union([
|
|
366
|
-
|
|
367
|
-
$endsWith: import_zod2.z.string()
|
|
368
|
-
}),
|
|
369
|
-
import_zod2.z.object({
|
|
370
|
-
$startsWith: import_zod2.z.string()
|
|
371
|
-
}),
|
|
443
|
+
...stringPatternMatchers,
|
|
372
444
|
import_zod2.z.object({
|
|
373
445
|
$exists: import_zod2.z.boolean()
|
|
374
446
|
}),
|
|
@@ -413,9 +485,6 @@ var EventMatcherSchema = import_zod2.z.union([
|
|
|
413
485
|
import_zod2.z.number(),
|
|
414
486
|
import_zod2.z.boolean()
|
|
415
487
|
])
|
|
416
|
-
}),
|
|
417
|
-
import_zod2.z.object({
|
|
418
|
-
$ignoreCaseEquals: import_zod2.z.string()
|
|
419
488
|
})
|
|
420
489
|
]))
|
|
421
490
|
]);
|
|
@@ -492,7 +561,9 @@ var DisplayPropertySchema = import_zod5.z.object({
|
|
|
492
561
|
/** The value of the property */
|
|
493
562
|
text: import_zod5.z.string(),
|
|
494
563
|
/** The URL to link to when the property is clicked */
|
|
495
|
-
url: import_zod5.z.string().optional()
|
|
564
|
+
url: import_zod5.z.string().optional(),
|
|
565
|
+
/** The URL to a list of images to display next to the property */
|
|
566
|
+
imageUrl: import_zod5.z.array(import_zod5.z.string()).optional()
|
|
496
567
|
});
|
|
497
568
|
var DisplayPropertiesSchema = import_zod5.z.array(DisplayPropertySchema);
|
|
498
569
|
var StyleSchema = import_zod5.z.object({
|
|
@@ -575,14 +646,21 @@ var TaskSchema = import_zod7.z.object({
|
|
|
575
646
|
outputProperties: import_zod7.z.array(DisplayPropertySchema).optional().nullable(),
|
|
576
647
|
params: DeserializedJsonSchema.optional().nullable(),
|
|
577
648
|
output: DeserializedJsonSchema.optional().nullable(),
|
|
649
|
+
context: DeserializedJsonSchema.optional().nullable(),
|
|
578
650
|
error: import_zod7.z.string().optional().nullable(),
|
|
579
651
|
parentId: import_zod7.z.string().optional().nullable(),
|
|
580
652
|
style: StyleSchema.optional().nullable(),
|
|
581
|
-
operation: import_zod7.z.string().optional().nullable()
|
|
653
|
+
operation: import_zod7.z.string().optional().nullable(),
|
|
654
|
+
callbackUrl: import_zod7.z.string().optional().nullable(),
|
|
655
|
+
childExecutionMode: import_zod7.z.enum([
|
|
656
|
+
"SEQUENTIAL",
|
|
657
|
+
"PARALLEL"
|
|
658
|
+
]).optional().nullable()
|
|
582
659
|
});
|
|
583
660
|
var ServerTaskSchema = TaskSchema.extend({
|
|
584
661
|
idempotencyKey: import_zod7.z.string(),
|
|
585
|
-
attempts: import_zod7.z.number()
|
|
662
|
+
attempts: import_zod7.z.number(),
|
|
663
|
+
forceYield: import_zod7.z.boolean().optional().nullable()
|
|
586
664
|
});
|
|
587
665
|
var CachedTaskSchema = import_zod7.z.object({
|
|
588
666
|
id: import_zod7.z.string(),
|
|
@@ -615,6 +693,12 @@ var DynamicTriggerMetadataSchema = import_zod8.z.object({
|
|
|
615
693
|
type: import_zod8.z.literal("dynamic"),
|
|
616
694
|
id: import_zod8.z.string()
|
|
617
695
|
});
|
|
696
|
+
var TriggerHelpSchema = import_zod8.z.object({
|
|
697
|
+
noRuns: import_zod8.z.object({
|
|
698
|
+
text: import_zod8.z.string(),
|
|
699
|
+
link: import_zod8.z.string().optional()
|
|
700
|
+
}).optional()
|
|
701
|
+
});
|
|
618
702
|
var StaticTriggerMetadataSchema = import_zod8.z.object({
|
|
619
703
|
type: import_zod8.z.literal("static"),
|
|
620
704
|
title: import_zod8.z.union([
|
|
@@ -622,7 +706,12 @@ var StaticTriggerMetadataSchema = import_zod8.z.object({
|
|
|
622
706
|
import_zod8.z.array(import_zod8.z.string())
|
|
623
707
|
]),
|
|
624
708
|
properties: import_zod8.z.array(DisplayPropertySchema).optional(),
|
|
625
|
-
rule: EventRuleSchema
|
|
709
|
+
rule: EventRuleSchema,
|
|
710
|
+
link: import_zod8.z.string().optional(),
|
|
711
|
+
help: TriggerHelpSchema.optional()
|
|
712
|
+
});
|
|
713
|
+
var InvokeTriggerMetadataSchema = import_zod8.z.object({
|
|
714
|
+
type: import_zod8.z.literal("invoke")
|
|
626
715
|
});
|
|
627
716
|
var ScheduledTriggerMetadataSchema = import_zod8.z.object({
|
|
628
717
|
type: import_zod8.z.literal("scheduled"),
|
|
@@ -631,7 +720,8 @@ var ScheduledTriggerMetadataSchema = import_zod8.z.object({
|
|
|
631
720
|
var TriggerMetadataSchema = import_zod8.z.discriminatedUnion("type", [
|
|
632
721
|
DynamicTriggerMetadataSchema,
|
|
633
722
|
StaticTriggerMetadataSchema,
|
|
634
|
-
ScheduledTriggerMetadataSchema
|
|
723
|
+
ScheduledTriggerMetadataSchema,
|
|
724
|
+
InvokeTriggerMetadataSchema
|
|
635
725
|
]);
|
|
636
726
|
|
|
637
727
|
// src/schemas/runs.ts
|
|
@@ -672,7 +762,10 @@ var RunStatusSchema = import_zod10.z.union([
|
|
|
672
762
|
import_zod10.z.literal("ABORTED"),
|
|
673
763
|
import_zod10.z.literal("CANCELED"),
|
|
674
764
|
import_zod10.z.literal("UNRESOLVED_AUTH"),
|
|
675
|
-
import_zod10.z.literal("INVALID_PAYLOAD")
|
|
765
|
+
import_zod10.z.literal("INVALID_PAYLOAD"),
|
|
766
|
+
import_zod10.z.literal("EXECUTING"),
|
|
767
|
+
import_zod10.z.literal("WAITING_TO_CONTINUE"),
|
|
768
|
+
import_zod10.z.literal("WAITING_TO_EXECUTE")
|
|
676
769
|
]);
|
|
677
770
|
var RunTaskSchema = import_zod10.z.object({
|
|
678
771
|
/** The Task id */
|
|
@@ -742,472 +835,746 @@ var GetRunsSchema = import_zod10.z.object({
|
|
|
742
835
|
nextCursor: import_zod10.z.string().optional()
|
|
743
836
|
});
|
|
744
837
|
|
|
838
|
+
// src/schemas/requestFilter.ts
|
|
839
|
+
var import_zod11 = require("zod");
|
|
840
|
+
var StringMatchSchema = import_zod11.z.union([
|
|
841
|
+
/** Match against a string */
|
|
842
|
+
import_zod11.z.array(import_zod11.z.string()),
|
|
843
|
+
import_zod11.z.array(import_zod11.z.union(stringPatternMatchers))
|
|
844
|
+
]);
|
|
845
|
+
var HTTPMethodUnionSchema = import_zod11.z.union([
|
|
846
|
+
import_zod11.z.literal("GET"),
|
|
847
|
+
import_zod11.z.literal("POST"),
|
|
848
|
+
import_zod11.z.literal("PUT"),
|
|
849
|
+
import_zod11.z.literal("PATCH"),
|
|
850
|
+
import_zod11.z.literal("DELETE"),
|
|
851
|
+
import_zod11.z.literal("HEAD"),
|
|
852
|
+
import_zod11.z.literal("OPTIONS")
|
|
853
|
+
]);
|
|
854
|
+
var RequestFilterSchema = import_zod11.z.object({
|
|
855
|
+
/** An array of HTTP methods to match.
|
|
856
|
+
* For example, `["GET", "POST"]` will match both `GET` and `POST` Requests. */
|
|
857
|
+
method: import_zod11.z.array(HTTPMethodUnionSchema).optional(),
|
|
858
|
+
/** An object of header key/values to match.
|
|
859
|
+
* This uses the [EventFilter matching syntax](https://trigger.dev/docs/documentation/guides/event-filter).
|
|
860
|
+
|
|
861
|
+
@example
|
|
862
|
+
```ts
|
|
863
|
+
filter: {
|
|
864
|
+
header: {
|
|
865
|
+
"content-type": ["application/json"],
|
|
866
|
+
},
|
|
867
|
+
},
|
|
868
|
+
``` */
|
|
869
|
+
headers: import_zod11.z.record(StringMatchSchema).optional(),
|
|
870
|
+
/** An object of query parameters to match.
|
|
871
|
+
* This uses the [EventFilter matching syntax](https://trigger.dev/docs/documentation/guides/event-filter).
|
|
872
|
+
|
|
873
|
+
@example
|
|
874
|
+
```ts
|
|
875
|
+
filter: {
|
|
876
|
+
query: {
|
|
877
|
+
"hub.mode": [{ $startsWith: "sub" }],
|
|
878
|
+
},
|
|
879
|
+
},
|
|
880
|
+
``` */
|
|
881
|
+
query: import_zod11.z.record(StringMatchSchema).optional(),
|
|
882
|
+
/** An object of key/values to match.
|
|
883
|
+
* This uses the [EventFilter matching syntax](https://trigger.dev/docs/documentation/guides/event-filter).
|
|
884
|
+
*/
|
|
885
|
+
body: EventFilterSchema.optional()
|
|
886
|
+
});
|
|
887
|
+
var ResponseFilterSchema = RequestFilterSchema.omit({
|
|
888
|
+
method: true,
|
|
889
|
+
query: true
|
|
890
|
+
}).extend({
|
|
891
|
+
status: import_zod11.z.array(import_zod11.z.number()).optional()
|
|
892
|
+
});
|
|
893
|
+
|
|
745
894
|
// src/schemas/api.ts
|
|
746
|
-
var UpdateTriggerSourceBodyV1Schema =
|
|
747
|
-
registeredEvents:
|
|
748
|
-
secret:
|
|
895
|
+
var UpdateTriggerSourceBodyV1Schema = import_zod12.z.object({
|
|
896
|
+
registeredEvents: import_zod12.z.array(import_zod12.z.string()),
|
|
897
|
+
secret: import_zod12.z.string().optional(),
|
|
749
898
|
data: SerializableJsonSchema.optional()
|
|
750
899
|
});
|
|
751
|
-
var UpdateTriggerSourceBodyV2Schema =
|
|
752
|
-
secret:
|
|
900
|
+
var UpdateTriggerSourceBodyV2Schema = import_zod12.z.object({
|
|
901
|
+
secret: import_zod12.z.string().optional(),
|
|
753
902
|
data: SerializableJsonSchema.optional(),
|
|
754
|
-
options:
|
|
755
|
-
event:
|
|
756
|
-
}).and(
|
|
903
|
+
options: import_zod12.z.object({
|
|
904
|
+
event: import_zod12.z.array(import_zod12.z.string())
|
|
905
|
+
}).and(import_zod12.z.record(import_zod12.z.string(), import_zod12.z.array(import_zod12.z.string())).optional())
|
|
757
906
|
});
|
|
758
|
-
var
|
|
759
|
-
|
|
760
|
-
|
|
907
|
+
var UpdateWebhookBodySchema = import_zod12.z.discriminatedUnion("active", [
|
|
908
|
+
import_zod12.z.object({
|
|
909
|
+
active: import_zod12.z.literal(false)
|
|
910
|
+
}),
|
|
911
|
+
import_zod12.z.object({
|
|
912
|
+
active: import_zod12.z.literal(true),
|
|
913
|
+
config: import_zod12.z.record(import_zod12.z.string().array())
|
|
914
|
+
})
|
|
915
|
+
]);
|
|
916
|
+
var RegisterHTTPTriggerSourceBodySchema = import_zod12.z.object({
|
|
917
|
+
type: import_zod12.z.literal("HTTP"),
|
|
918
|
+
url: import_zod12.z.string().url()
|
|
761
919
|
});
|
|
762
|
-
var RegisterSMTPTriggerSourceBodySchema =
|
|
763
|
-
type:
|
|
920
|
+
var RegisterSMTPTriggerSourceBodySchema = import_zod12.z.object({
|
|
921
|
+
type: import_zod12.z.literal("SMTP")
|
|
764
922
|
});
|
|
765
|
-
var RegisterSQSTriggerSourceBodySchema =
|
|
766
|
-
type:
|
|
923
|
+
var RegisterSQSTriggerSourceBodySchema = import_zod12.z.object({
|
|
924
|
+
type: import_zod12.z.literal("SQS")
|
|
767
925
|
});
|
|
768
|
-
var RegisterSourceChannelBodySchema =
|
|
926
|
+
var RegisterSourceChannelBodySchema = import_zod12.z.discriminatedUnion("type", [
|
|
769
927
|
RegisterHTTPTriggerSourceBodySchema,
|
|
770
928
|
RegisterSMTPTriggerSourceBodySchema,
|
|
771
929
|
RegisterSQSTriggerSourceBodySchema
|
|
772
930
|
]);
|
|
931
|
+
var REGISTER_WEBHOOK = "dev.trigger.webhook.register";
|
|
932
|
+
var DELIVER_WEBHOOK_REQUEST = "dev.trigger.webhook.deliver";
|
|
933
|
+
var RegisterWebhookSourceSchema = import_zod12.z.object({
|
|
934
|
+
key: import_zod12.z.string(),
|
|
935
|
+
params: import_zod12.z.any(),
|
|
936
|
+
config: import_zod12.z.any(),
|
|
937
|
+
active: import_zod12.z.boolean(),
|
|
938
|
+
secret: import_zod12.z.string(),
|
|
939
|
+
url: import_zod12.z.string(),
|
|
940
|
+
data: DeserializedJsonSchema.optional(),
|
|
941
|
+
clientId: import_zod12.z.string().optional()
|
|
942
|
+
});
|
|
943
|
+
var RegisterWebhookPayloadSchema = import_zod12.z.object({
|
|
944
|
+
active: import_zod12.z.boolean(),
|
|
945
|
+
params: import_zod12.z.any().optional(),
|
|
946
|
+
config: import_zod12.z.object({
|
|
947
|
+
current: import_zod12.z.record(import_zod12.z.string().array()),
|
|
948
|
+
desired: import_zod12.z.record(import_zod12.z.string().array())
|
|
949
|
+
}),
|
|
950
|
+
// from HTTP Endpoint
|
|
951
|
+
url: import_zod12.z.string(),
|
|
952
|
+
secret: import_zod12.z.string()
|
|
953
|
+
});
|
|
773
954
|
var REGISTER_SOURCE_EVENT_V1 = "dev.trigger.source.register";
|
|
774
955
|
var REGISTER_SOURCE_EVENT_V2 = "dev.trigger.source.register.v2";
|
|
775
|
-
var RegisterTriggerSourceSchema =
|
|
776
|
-
key:
|
|
777
|
-
params:
|
|
778
|
-
active:
|
|
779
|
-
secret:
|
|
956
|
+
var RegisterTriggerSourceSchema = import_zod12.z.object({
|
|
957
|
+
key: import_zod12.z.string(),
|
|
958
|
+
params: import_zod12.z.any(),
|
|
959
|
+
active: import_zod12.z.boolean(),
|
|
960
|
+
secret: import_zod12.z.string(),
|
|
780
961
|
data: DeserializedJsonSchema.optional(),
|
|
781
962
|
channel: RegisterSourceChannelBodySchema,
|
|
782
|
-
clientId:
|
|
963
|
+
clientId: import_zod12.z.string().optional()
|
|
783
964
|
});
|
|
784
|
-
var SourceEventOptionSchema =
|
|
785
|
-
name:
|
|
786
|
-
value:
|
|
965
|
+
var SourceEventOptionSchema = import_zod12.z.object({
|
|
966
|
+
name: import_zod12.z.string(),
|
|
967
|
+
value: import_zod12.z.string()
|
|
787
968
|
});
|
|
788
|
-
var RegisterSourceEventSchemaV1 =
|
|
969
|
+
var RegisterSourceEventSchemaV1 = import_zod12.z.object({
|
|
789
970
|
/** The id of the source */
|
|
790
|
-
id:
|
|
971
|
+
id: import_zod12.z.string(),
|
|
791
972
|
source: RegisterTriggerSourceSchema,
|
|
792
|
-
events:
|
|
793
|
-
missingEvents:
|
|
794
|
-
orphanedEvents:
|
|
795
|
-
dynamicTriggerId:
|
|
973
|
+
events: import_zod12.z.array(import_zod12.z.string()),
|
|
974
|
+
missingEvents: import_zod12.z.array(import_zod12.z.string()),
|
|
975
|
+
orphanedEvents: import_zod12.z.array(import_zod12.z.string()),
|
|
976
|
+
dynamicTriggerId: import_zod12.z.string().optional()
|
|
796
977
|
});
|
|
797
|
-
var RegisteredOptionsDiffSchema =
|
|
798
|
-
desired:
|
|
799
|
-
missing:
|
|
800
|
-
orphaned:
|
|
978
|
+
var RegisteredOptionsDiffSchema = import_zod12.z.object({
|
|
979
|
+
desired: import_zod12.z.array(import_zod12.z.string()),
|
|
980
|
+
missing: import_zod12.z.array(import_zod12.z.string()),
|
|
981
|
+
orphaned: import_zod12.z.array(import_zod12.z.string())
|
|
801
982
|
});
|
|
802
|
-
var RegisterSourceEventOptionsSchema =
|
|
983
|
+
var RegisterSourceEventOptionsSchema = import_zod12.z.object({
|
|
803
984
|
event: RegisteredOptionsDiffSchema
|
|
804
|
-
}).and(
|
|
805
|
-
var RegisterSourceEventSchemaV2 =
|
|
985
|
+
}).and(import_zod12.z.record(import_zod12.z.string(), RegisteredOptionsDiffSchema));
|
|
986
|
+
var RegisterSourceEventSchemaV2 = import_zod12.z.object({
|
|
806
987
|
/** The id of the source */
|
|
807
|
-
id:
|
|
988
|
+
id: import_zod12.z.string(),
|
|
808
989
|
source: RegisterTriggerSourceSchema,
|
|
809
990
|
options: RegisterSourceEventOptionsSchema,
|
|
810
|
-
dynamicTriggerId:
|
|
991
|
+
dynamicTriggerId: import_zod12.z.string().optional()
|
|
811
992
|
});
|
|
812
|
-
var TriggerSourceSchema =
|
|
813
|
-
id:
|
|
814
|
-
key:
|
|
993
|
+
var TriggerSourceSchema = import_zod12.z.object({
|
|
994
|
+
id: import_zod12.z.string(),
|
|
995
|
+
key: import_zod12.z.string()
|
|
815
996
|
});
|
|
816
997
|
var HttpSourceResponseMetadataSchema = DeserializedJsonSchema;
|
|
817
|
-
var HandleTriggerSourceSchema =
|
|
818
|
-
key:
|
|
819
|
-
secret:
|
|
820
|
-
data:
|
|
821
|
-
params:
|
|
998
|
+
var HandleTriggerSourceSchema = import_zod12.z.object({
|
|
999
|
+
key: import_zod12.z.string(),
|
|
1000
|
+
secret: import_zod12.z.string(),
|
|
1001
|
+
data: import_zod12.z.any(),
|
|
1002
|
+
params: import_zod12.z.any(),
|
|
822
1003
|
auth: ConnectionAuthSchema.optional(),
|
|
823
1004
|
metadata: HttpSourceResponseMetadataSchema.optional()
|
|
824
1005
|
});
|
|
825
|
-
var
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
"x-ts-
|
|
833
|
-
"x-ts-
|
|
834
|
-
"x-ts-
|
|
835
|
-
"x-ts-data": import_zod11.z.string().transform((s) => JSON.parse(s)),
|
|
836
|
-
"x-ts-params": import_zod11.z.string().transform((s) => JSON.parse(s)),
|
|
837
|
-
"x-ts-http-url": import_zod11.z.string(),
|
|
838
|
-
"x-ts-http-method": import_zod11.z.string(),
|
|
839
|
-
"x-ts-http-headers": import_zod11.z.string().transform((s) => import_zod11.z.record(import_zod11.z.string()).parse(JSON.parse(s))),
|
|
840
|
-
"x-ts-auth": import_zod11.z.string().optional().transform((s) => {
|
|
1006
|
+
var HttpSourceRequestHeadersSchema = import_zod12.z.object({
|
|
1007
|
+
"x-ts-key": import_zod12.z.string(),
|
|
1008
|
+
"x-ts-dynamic-id": import_zod12.z.string().optional(),
|
|
1009
|
+
"x-ts-secret": import_zod12.z.string(),
|
|
1010
|
+
"x-ts-data": import_zod12.z.string().transform((s) => JSON.parse(s)),
|
|
1011
|
+
"x-ts-params": import_zod12.z.string().transform((s) => JSON.parse(s)),
|
|
1012
|
+
"x-ts-http-url": import_zod12.z.string(),
|
|
1013
|
+
"x-ts-http-method": import_zod12.z.string(),
|
|
1014
|
+
"x-ts-http-headers": import_zod12.z.string().transform((s) => import_zod12.z.record(import_zod12.z.string()).parse(JSON.parse(s))),
|
|
1015
|
+
"x-ts-auth": import_zod12.z.string().optional().transform((s) => {
|
|
841
1016
|
if (s === void 0)
|
|
842
1017
|
return;
|
|
843
1018
|
const json = JSON.parse(s);
|
|
844
1019
|
return ConnectionAuthSchema.parse(json);
|
|
845
1020
|
}),
|
|
846
|
-
"x-ts-metadata":
|
|
1021
|
+
"x-ts-metadata": import_zod12.z.string().optional().transform((s) => {
|
|
847
1022
|
if (s === void 0)
|
|
848
1023
|
return;
|
|
849
1024
|
const json = JSON.parse(s);
|
|
850
1025
|
return DeserializedJsonSchema.parse(json);
|
|
851
1026
|
})
|
|
852
1027
|
});
|
|
853
|
-
var
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
1028
|
+
var HttpEndpointRequestHeadersSchema = import_zod12.z.object({
|
|
1029
|
+
"x-ts-key": import_zod12.z.string(),
|
|
1030
|
+
"x-ts-http-url": import_zod12.z.string(),
|
|
1031
|
+
"x-ts-http-method": import_zod12.z.string(),
|
|
1032
|
+
"x-ts-http-headers": import_zod12.z.string().transform((s) => import_zod12.z.record(import_zod12.z.string()).parse(JSON.parse(s)))
|
|
1033
|
+
});
|
|
1034
|
+
var WebhookSourceRequestHeadersSchema = import_zod12.z.object({
|
|
1035
|
+
"x-ts-key": import_zod12.z.string(),
|
|
1036
|
+
"x-ts-dynamic-id": import_zod12.z.string().optional(),
|
|
1037
|
+
"x-ts-secret": import_zod12.z.string(),
|
|
1038
|
+
"x-ts-params": import_zod12.z.string().transform((s) => JSON.parse(s)),
|
|
1039
|
+
"x-ts-http-url": import_zod12.z.string(),
|
|
1040
|
+
"x-ts-http-method": import_zod12.z.string(),
|
|
1041
|
+
"x-ts-http-headers": import_zod12.z.string().transform((s) => import_zod12.z.record(import_zod12.z.string()).parse(JSON.parse(s)))
|
|
1042
|
+
});
|
|
1043
|
+
var PongSuccessResponseSchema = import_zod12.z.object({
|
|
1044
|
+
ok: import_zod12.z.literal(true),
|
|
1045
|
+
triggerVersion: import_zod12.z.string().optional(),
|
|
1046
|
+
triggerSdkVersion: import_zod12.z.string().optional()
|
|
1047
|
+
});
|
|
1048
|
+
var PongErrorResponseSchema = import_zod12.z.object({
|
|
1049
|
+
ok: import_zod12.z.literal(false),
|
|
1050
|
+
error: import_zod12.z.string(),
|
|
1051
|
+
triggerVersion: import_zod12.z.string().optional(),
|
|
1052
|
+
triggerSdkVersion: import_zod12.z.string().optional()
|
|
1053
|
+
});
|
|
1054
|
+
var PongResponseSchema = import_zod12.z.discriminatedUnion("ok", [
|
|
861
1055
|
PongSuccessResponseSchema,
|
|
862
1056
|
PongErrorResponseSchema
|
|
863
1057
|
]);
|
|
864
|
-
var ValidateSuccessResponseSchema =
|
|
865
|
-
ok:
|
|
866
|
-
endpointId:
|
|
1058
|
+
var ValidateSuccessResponseSchema = import_zod12.z.object({
|
|
1059
|
+
ok: import_zod12.z.literal(true),
|
|
1060
|
+
endpointId: import_zod12.z.string(),
|
|
1061
|
+
triggerVersion: import_zod12.z.string().optional()
|
|
867
1062
|
});
|
|
868
|
-
var ValidateErrorResponseSchema =
|
|
869
|
-
ok:
|
|
870
|
-
error:
|
|
1063
|
+
var ValidateErrorResponseSchema = import_zod12.z.object({
|
|
1064
|
+
ok: import_zod12.z.literal(false),
|
|
1065
|
+
error: import_zod12.z.string(),
|
|
1066
|
+
triggerVersion: import_zod12.z.string().optional()
|
|
871
1067
|
});
|
|
872
|
-
var ValidateResponseSchema =
|
|
1068
|
+
var ValidateResponseSchema = import_zod12.z.discriminatedUnion("ok", [
|
|
873
1069
|
ValidateSuccessResponseSchema,
|
|
874
1070
|
ValidateErrorResponseSchema
|
|
875
1071
|
]);
|
|
876
|
-
var QueueOptionsSchema =
|
|
877
|
-
name:
|
|
878
|
-
maxConcurrent:
|
|
879
|
-
});
|
|
880
|
-
var
|
|
881
|
-
id:
|
|
882
|
-
|
|
883
|
-
|
|
1072
|
+
var QueueOptionsSchema = import_zod12.z.object({
|
|
1073
|
+
name: import_zod12.z.string(),
|
|
1074
|
+
maxConcurrent: import_zod12.z.number().optional()
|
|
1075
|
+
});
|
|
1076
|
+
var ConcurrencyLimitOptionsSchema = import_zod12.z.object({
|
|
1077
|
+
id: import_zod12.z.string(),
|
|
1078
|
+
limit: import_zod12.z.number()
|
|
1079
|
+
});
|
|
1080
|
+
var JobMetadataSchema = import_zod12.z.object({
|
|
1081
|
+
id: import_zod12.z.string(),
|
|
1082
|
+
name: import_zod12.z.string(),
|
|
1083
|
+
version: import_zod12.z.string(),
|
|
884
1084
|
event: EventSpecificationSchema,
|
|
885
1085
|
trigger: TriggerMetadataSchema,
|
|
886
|
-
integrations:
|
|
887
|
-
internal:
|
|
888
|
-
enabled:
|
|
889
|
-
startPosition:
|
|
1086
|
+
integrations: import_zod12.z.record(IntegrationConfigSchema),
|
|
1087
|
+
internal: import_zod12.z.boolean().default(false),
|
|
1088
|
+
enabled: import_zod12.z.boolean(),
|
|
1089
|
+
startPosition: import_zod12.z.enum([
|
|
890
1090
|
"initial",
|
|
891
1091
|
"latest"
|
|
892
1092
|
]),
|
|
893
|
-
preprocessRuns:
|
|
1093
|
+
preprocessRuns: import_zod12.z.boolean(),
|
|
1094
|
+
concurrencyLimit: ConcurrencyLimitOptionsSchema.or(import_zod12.z.number().int().positive()).optional()
|
|
894
1095
|
});
|
|
895
|
-
var SourceMetadataV1Schema =
|
|
896
|
-
version:
|
|
897
|
-
channel:
|
|
1096
|
+
var SourceMetadataV1Schema = import_zod12.z.object({
|
|
1097
|
+
version: import_zod12.z.literal("1"),
|
|
1098
|
+
channel: import_zod12.z.enum([
|
|
898
1099
|
"HTTP",
|
|
899
1100
|
"SQS",
|
|
900
1101
|
"SMTP"
|
|
901
1102
|
]),
|
|
902
1103
|
integration: IntegrationConfigSchema,
|
|
903
|
-
key:
|
|
904
|
-
params:
|
|
905
|
-
events:
|
|
906
|
-
registerSourceJob:
|
|
907
|
-
id:
|
|
908
|
-
version:
|
|
1104
|
+
key: import_zod12.z.string(),
|
|
1105
|
+
params: import_zod12.z.any(),
|
|
1106
|
+
events: import_zod12.z.array(import_zod12.z.string()),
|
|
1107
|
+
registerSourceJob: import_zod12.z.object({
|
|
1108
|
+
id: import_zod12.z.string(),
|
|
1109
|
+
version: import_zod12.z.string()
|
|
909
1110
|
}).optional()
|
|
910
1111
|
});
|
|
911
|
-
var SourceMetadataV2Schema =
|
|
912
|
-
version:
|
|
913
|
-
channel:
|
|
1112
|
+
var SourceMetadataV2Schema = import_zod12.z.object({
|
|
1113
|
+
version: import_zod12.z.literal("2"),
|
|
1114
|
+
channel: import_zod12.z.enum([
|
|
914
1115
|
"HTTP",
|
|
915
1116
|
"SQS",
|
|
916
1117
|
"SMTP"
|
|
917
1118
|
]),
|
|
918
1119
|
integration: IntegrationConfigSchema,
|
|
919
|
-
key:
|
|
920
|
-
params:
|
|
921
|
-
options:
|
|
922
|
-
registerSourceJob:
|
|
923
|
-
id:
|
|
924
|
-
version:
|
|
1120
|
+
key: import_zod12.z.string(),
|
|
1121
|
+
params: import_zod12.z.any(),
|
|
1122
|
+
options: import_zod12.z.record(import_zod12.z.array(import_zod12.z.string())),
|
|
1123
|
+
registerSourceJob: import_zod12.z.object({
|
|
1124
|
+
id: import_zod12.z.string(),
|
|
1125
|
+
version: import_zod12.z.string()
|
|
925
1126
|
}).optional()
|
|
926
1127
|
});
|
|
927
|
-
var SourceMetadataSchema =
|
|
1128
|
+
var SourceMetadataSchema = import_zod12.z.preprocess(addMissingVersionField, import_zod12.z.discriminatedUnion("version", [
|
|
928
1129
|
SourceMetadataV1Schema,
|
|
929
1130
|
SourceMetadataV2Schema
|
|
930
1131
|
]));
|
|
931
|
-
var
|
|
932
|
-
|
|
933
|
-
|
|
1132
|
+
var WebhookMetadataSchema = import_zod12.z.object({
|
|
1133
|
+
key: import_zod12.z.string(),
|
|
1134
|
+
params: import_zod12.z.any(),
|
|
1135
|
+
config: import_zod12.z.record(import_zod12.z.array(import_zod12.z.string())),
|
|
1136
|
+
integration: IntegrationConfigSchema,
|
|
1137
|
+
httpEndpoint: import_zod12.z.object({
|
|
1138
|
+
id: import_zod12.z.string()
|
|
1139
|
+
})
|
|
1140
|
+
});
|
|
1141
|
+
var WebhookContextMetadataSchema = import_zod12.z.object({
|
|
1142
|
+
params: import_zod12.z.any(),
|
|
1143
|
+
config: import_zod12.z.record(import_zod12.z.string().array()),
|
|
1144
|
+
secret: import_zod12.z.string()
|
|
1145
|
+
});
|
|
1146
|
+
var DynamicTriggerEndpointMetadataSchema = import_zod12.z.object({
|
|
1147
|
+
id: import_zod12.z.string(),
|
|
1148
|
+
jobs: import_zod12.z.array(JobMetadataSchema.pick({
|
|
934
1149
|
id: true,
|
|
935
1150
|
version: true
|
|
936
1151
|
})),
|
|
937
|
-
registerSourceJob:
|
|
938
|
-
id:
|
|
939
|
-
version:
|
|
1152
|
+
registerSourceJob: import_zod12.z.object({
|
|
1153
|
+
id: import_zod12.z.string(),
|
|
1154
|
+
version: import_zod12.z.string()
|
|
940
1155
|
}).optional()
|
|
941
1156
|
});
|
|
942
|
-
var
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
1157
|
+
var HttpEndpointMetadataSchema = import_zod12.z.object({
|
|
1158
|
+
id: import_zod12.z.string(),
|
|
1159
|
+
version: import_zod12.z.string(),
|
|
1160
|
+
enabled: import_zod12.z.boolean(),
|
|
1161
|
+
title: import_zod12.z.string().optional(),
|
|
1162
|
+
icon: import_zod12.z.string().optional(),
|
|
1163
|
+
properties: import_zod12.z.array(DisplayPropertySchema).optional(),
|
|
1164
|
+
event: EventSpecificationSchema,
|
|
1165
|
+
immediateResponseFilter: RequestFilterSchema.optional(),
|
|
1166
|
+
skipTriggeringRuns: import_zod12.z.boolean().optional(),
|
|
1167
|
+
source: import_zod12.z.string()
|
|
1168
|
+
});
|
|
1169
|
+
var IndexEndpointResponseSchema = import_zod12.z.object({
|
|
1170
|
+
jobs: import_zod12.z.array(JobMetadataSchema),
|
|
1171
|
+
sources: import_zod12.z.array(SourceMetadataSchema),
|
|
1172
|
+
webhooks: import_zod12.z.array(WebhookMetadataSchema).optional(),
|
|
1173
|
+
dynamicTriggers: import_zod12.z.array(DynamicTriggerEndpointMetadataSchema),
|
|
1174
|
+
dynamicSchedules: import_zod12.z.array(RegisterDynamicSchedulePayloadSchema),
|
|
1175
|
+
httpEndpoints: import_zod12.z.array(HttpEndpointMetadataSchema).optional()
|
|
1176
|
+
});
|
|
1177
|
+
var EndpointIndexErrorSchema = import_zod12.z.object({
|
|
1178
|
+
message: import_zod12.z.string(),
|
|
1179
|
+
raw: import_zod12.z.any().optional()
|
|
1180
|
+
});
|
|
1181
|
+
var IndexEndpointStatsSchema = import_zod12.z.object({
|
|
1182
|
+
jobs: import_zod12.z.number(),
|
|
1183
|
+
sources: import_zod12.z.number(),
|
|
1184
|
+
webhooks: import_zod12.z.number().optional(),
|
|
1185
|
+
dynamicTriggers: import_zod12.z.number(),
|
|
1186
|
+
dynamicSchedules: import_zod12.z.number(),
|
|
1187
|
+
disabledJobs: import_zod12.z.number().default(0),
|
|
1188
|
+
httpEndpoints: import_zod12.z.number().default(0)
|
|
1189
|
+
});
|
|
1190
|
+
function parseEndpointIndexStats(stats) {
|
|
1191
|
+
if (stats === null || stats === void 0) {
|
|
1192
|
+
return;
|
|
1193
|
+
}
|
|
1194
|
+
return IndexEndpointStatsSchema.parse(stats);
|
|
1195
|
+
}
|
|
1196
|
+
__name(parseEndpointIndexStats, "parseEndpointIndexStats");
|
|
1197
|
+
var GetEndpointIndexResponseSchema = import_zod12.z.discriminatedUnion("status", [
|
|
1198
|
+
import_zod12.z.object({
|
|
1199
|
+
status: import_zod12.z.literal("PENDING"),
|
|
1200
|
+
updatedAt: import_zod12.z.coerce.date()
|
|
1201
|
+
}),
|
|
1202
|
+
import_zod12.z.object({
|
|
1203
|
+
status: import_zod12.z.literal("STARTED"),
|
|
1204
|
+
updatedAt: import_zod12.z.coerce.date()
|
|
1205
|
+
}),
|
|
1206
|
+
import_zod12.z.object({
|
|
1207
|
+
status: import_zod12.z.literal("SUCCESS"),
|
|
1208
|
+
stats: IndexEndpointStatsSchema,
|
|
1209
|
+
updatedAt: import_zod12.z.coerce.date()
|
|
1210
|
+
}),
|
|
1211
|
+
import_zod12.z.object({
|
|
1212
|
+
status: import_zod12.z.literal("FAILURE"),
|
|
1213
|
+
error: EndpointIndexErrorSchema,
|
|
1214
|
+
updatedAt: import_zod12.z.coerce.date()
|
|
1215
|
+
})
|
|
1216
|
+
]);
|
|
1217
|
+
var EndpointHeadersSchema = import_zod12.z.object({
|
|
1218
|
+
"trigger-version": import_zod12.z.string().optional(),
|
|
1219
|
+
"trigger-sdk-version": import_zod12.z.string().optional()
|
|
1220
|
+
});
|
|
1221
|
+
var ExecuteJobRunMetadataSchema = import_zod12.z.object({
|
|
1222
|
+
successSubscription: import_zod12.z.boolean().optional(),
|
|
1223
|
+
failedSubscription: import_zod12.z.boolean().optional()
|
|
1224
|
+
});
|
|
1225
|
+
var ExecuteJobHeadersSchema = EndpointHeadersSchema.extend({
|
|
1226
|
+
"x-trigger-run-metadata": import_zod12.z.preprocess((val) => typeof val === "string" && JSON.parse(val), ExecuteJobRunMetadataSchema).optional()
|
|
947
1227
|
});
|
|
948
|
-
var RawEventSchema =
|
|
1228
|
+
var RawEventSchema = import_zod12.z.object({
|
|
949
1229
|
/** The `name` property must exactly match any subscriptions you want to
|
|
950
1230
|
trigger. */
|
|
951
|
-
name:
|
|
1231
|
+
name: import_zod12.z.string(),
|
|
952
1232
|
/** The `payload` property will be sent to any matching Jobs and will appear
|
|
953
1233
|
as the `payload` param of the `run()` function. You can leave this
|
|
954
1234
|
parameter out if you just want to trigger a Job without any input data. */
|
|
955
|
-
payload:
|
|
1235
|
+
payload: import_zod12.z.any(),
|
|
956
1236
|
/** The optional `context` property will be sent to any matching Jobs and will
|
|
957
1237
|
be passed through as the `context.event.context` param of the `run()`
|
|
958
1238
|
function. This is optional but can be useful if you want to pass through
|
|
959
1239
|
some additional context to the Job. */
|
|
960
|
-
context:
|
|
1240
|
+
context: import_zod12.z.any().optional(),
|
|
961
1241
|
/** The `id` property uniquely identify this particular event. If unset it
|
|
962
1242
|
will be set automatically using `ulid`. */
|
|
963
|
-
id:
|
|
1243
|
+
id: import_zod12.z.string().default(() => (0, import_ulidx.ulid)()),
|
|
964
1244
|
/** This is optional, it defaults to the current timestamp. Usually you would
|
|
965
1245
|
only set this if you have a timestamp that you wish to pass through, e.g.
|
|
966
1246
|
you receive a timestamp from a service and you want the same timestamp to
|
|
967
1247
|
be used in your Job. */
|
|
968
|
-
timestamp:
|
|
1248
|
+
timestamp: import_zod12.z.coerce.date().optional(),
|
|
969
1249
|
/** This is optional, it defaults to "trigger.dev". It can be useful to set
|
|
970
1250
|
this as you can filter events using this in the `eventTrigger()`. */
|
|
971
|
-
source:
|
|
1251
|
+
source: import_zod12.z.string().optional(),
|
|
1252
|
+
/** This is optional, it defaults to "JSON". If your event is actually a request,
|
|
1253
|
+
with a url, headers, method and rawBody you can use "REQUEST" */
|
|
1254
|
+
payloadType: import_zod12.z.union([
|
|
1255
|
+
import_zod12.z.literal("JSON"),
|
|
1256
|
+
import_zod12.z.literal("REQUEST")
|
|
1257
|
+
]).optional()
|
|
972
1258
|
});
|
|
973
|
-
var ApiEventLogSchema =
|
|
1259
|
+
var ApiEventLogSchema = import_zod12.z.object({
|
|
974
1260
|
/** The `id` of the event that was sent.
|
|
975
1261
|
*/
|
|
976
|
-
id:
|
|
1262
|
+
id: import_zod12.z.string(),
|
|
977
1263
|
/** The `name` of the event that was sent. */
|
|
978
|
-
name:
|
|
1264
|
+
name: import_zod12.z.string(),
|
|
979
1265
|
/** The `payload` of the event that was sent */
|
|
980
1266
|
payload: DeserializedJsonSchema,
|
|
981
1267
|
/** The `context` of the event that was sent. Is `undefined` if no context was
|
|
982
1268
|
set when sending the event. */
|
|
983
1269
|
context: DeserializedJsonSchema.optional().nullable(),
|
|
984
1270
|
/** The `timestamp` of the event that was sent */
|
|
985
|
-
timestamp:
|
|
1271
|
+
timestamp: import_zod12.z.coerce.date(),
|
|
986
1272
|
/** The timestamp when the event will be delivered to any matching Jobs. Is
|
|
987
1273
|
`undefined` if `deliverAt` or `deliverAfter` wasn't set when sending the
|
|
988
1274
|
event. */
|
|
989
|
-
deliverAt:
|
|
1275
|
+
deliverAt: import_zod12.z.coerce.date().optional().nullable(),
|
|
990
1276
|
/** The timestamp when the event was delivered. Is `undefined` if `deliverAt`
|
|
991
1277
|
or `deliverAfter` were set when sending the event. */
|
|
992
|
-
deliveredAt:
|
|
1278
|
+
deliveredAt: import_zod12.z.coerce.date().optional().nullable(),
|
|
993
1279
|
/** The timestamp when the event was cancelled. Is `undefined` if the event
|
|
994
1280
|
* wasn't cancelled. */
|
|
995
|
-
cancelledAt:
|
|
1281
|
+
cancelledAt: import_zod12.z.coerce.date().optional().nullable()
|
|
996
1282
|
});
|
|
997
|
-
var SendEventOptionsSchema =
|
|
1283
|
+
var SendEventOptionsSchema = import_zod12.z.object({
|
|
998
1284
|
/** An optional Date when you want the event to trigger Jobs. The event will
|
|
999
1285
|
be sent to the platform immediately but won't be acted upon until the
|
|
1000
1286
|
specified time. */
|
|
1001
|
-
deliverAt:
|
|
1287
|
+
deliverAt: import_zod12.z.coerce.date().optional(),
|
|
1002
1288
|
/** An optional number of seconds you want to wait for the event to trigger
|
|
1003
1289
|
any relevant Jobs. The event will be sent to the platform immediately but
|
|
1004
1290
|
won't be delivered until after the elapsed number of seconds. */
|
|
1005
|
-
deliverAfter:
|
|
1291
|
+
deliverAfter: import_zod12.z.number().int().optional(),
|
|
1006
1292
|
/** This optional param will be used by Trigger.dev Connect, which
|
|
1007
1293
|
is coming soon. */
|
|
1008
|
-
accountId:
|
|
1294
|
+
accountId: import_zod12.z.string().optional()
|
|
1009
1295
|
});
|
|
1010
|
-
var SendEventBodySchema =
|
|
1296
|
+
var SendEventBodySchema = import_zod12.z.object({
|
|
1011
1297
|
event: RawEventSchema,
|
|
1012
1298
|
options: SendEventOptionsSchema.optional()
|
|
1013
1299
|
});
|
|
1014
|
-
var
|
|
1015
|
-
|
|
1300
|
+
var SendBulkEventsBodySchema = import_zod12.z.object({
|
|
1301
|
+
events: RawEventSchema.array(),
|
|
1302
|
+
options: SendEventOptionsSchema.optional()
|
|
1016
1303
|
});
|
|
1017
|
-
var
|
|
1304
|
+
var DeliverEventResponseSchema = import_zod12.z.object({
|
|
1305
|
+
deliveredAt: import_zod12.z.string().datetime()
|
|
1306
|
+
});
|
|
1307
|
+
var RuntimeEnvironmentTypeSchema = import_zod12.z.enum([
|
|
1018
1308
|
"PRODUCTION",
|
|
1019
1309
|
"STAGING",
|
|
1020
1310
|
"DEVELOPMENT",
|
|
1021
1311
|
"PREVIEW"
|
|
1022
1312
|
]);
|
|
1023
|
-
var RunSourceContextSchema =
|
|
1024
|
-
id:
|
|
1025
|
-
metadata:
|
|
1313
|
+
var RunSourceContextSchema = import_zod12.z.object({
|
|
1314
|
+
id: import_zod12.z.string(),
|
|
1315
|
+
metadata: import_zod12.z.any()
|
|
1316
|
+
});
|
|
1317
|
+
var AutoYieldConfigSchema = import_zod12.z.object({
|
|
1318
|
+
startTaskThreshold: import_zod12.z.number(),
|
|
1319
|
+
beforeExecuteTaskThreshold: import_zod12.z.number(),
|
|
1320
|
+
beforeCompleteTaskThreshold: import_zod12.z.number(),
|
|
1321
|
+
afterCompleteTaskThreshold: import_zod12.z.number()
|
|
1026
1322
|
});
|
|
1027
|
-
var RunJobBodySchema =
|
|
1323
|
+
var RunJobBodySchema = import_zod12.z.object({
|
|
1028
1324
|
event: ApiEventLogSchema,
|
|
1029
|
-
job:
|
|
1030
|
-
id:
|
|
1031
|
-
version:
|
|
1325
|
+
job: import_zod12.z.object({
|
|
1326
|
+
id: import_zod12.z.string(),
|
|
1327
|
+
version: import_zod12.z.string()
|
|
1032
1328
|
}),
|
|
1033
|
-
run:
|
|
1034
|
-
id:
|
|
1035
|
-
isTest:
|
|
1036
|
-
isRetry:
|
|
1037
|
-
startedAt:
|
|
1329
|
+
run: import_zod12.z.object({
|
|
1330
|
+
id: import_zod12.z.string(),
|
|
1331
|
+
isTest: import_zod12.z.boolean(),
|
|
1332
|
+
isRetry: import_zod12.z.boolean().default(false),
|
|
1333
|
+
startedAt: import_zod12.z.coerce.date()
|
|
1038
1334
|
}),
|
|
1039
|
-
environment:
|
|
1040
|
-
id:
|
|
1041
|
-
slug:
|
|
1335
|
+
environment: import_zod12.z.object({
|
|
1336
|
+
id: import_zod12.z.string(),
|
|
1337
|
+
slug: import_zod12.z.string(),
|
|
1042
1338
|
type: RuntimeEnvironmentTypeSchema
|
|
1043
1339
|
}),
|
|
1044
|
-
organization:
|
|
1045
|
-
id:
|
|
1046
|
-
title:
|
|
1047
|
-
slug:
|
|
1340
|
+
organization: import_zod12.z.object({
|
|
1341
|
+
id: import_zod12.z.string(),
|
|
1342
|
+
title: import_zod12.z.string(),
|
|
1343
|
+
slug: import_zod12.z.string()
|
|
1048
1344
|
}),
|
|
1049
|
-
|
|
1050
|
-
id:
|
|
1051
|
-
|
|
1345
|
+
project: import_zod12.z.object({
|
|
1346
|
+
id: import_zod12.z.string(),
|
|
1347
|
+
name: import_zod12.z.string(),
|
|
1348
|
+
slug: import_zod12.z.string()
|
|
1349
|
+
}).optional(),
|
|
1350
|
+
account: import_zod12.z.object({
|
|
1351
|
+
id: import_zod12.z.string(),
|
|
1352
|
+
metadata: import_zod12.z.any()
|
|
1052
1353
|
}).optional(),
|
|
1053
1354
|
source: RunSourceContextSchema.optional(),
|
|
1054
|
-
tasks:
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1355
|
+
tasks: import_zod12.z.array(CachedTaskSchema).optional(),
|
|
1356
|
+
cachedTaskCursor: import_zod12.z.string().optional(),
|
|
1357
|
+
noopTasksSet: import_zod12.z.string().optional(),
|
|
1358
|
+
connections: import_zod12.z.record(ConnectionAuthSchema).optional(),
|
|
1359
|
+
yieldedExecutions: import_zod12.z.string().array().optional(),
|
|
1360
|
+
runChunkExecutionLimit: import_zod12.z.number().optional(),
|
|
1361
|
+
autoYieldConfig: AutoYieldConfigSchema.optional()
|
|
1362
|
+
});
|
|
1363
|
+
var RunJobErrorSchema = import_zod12.z.object({
|
|
1364
|
+
status: import_zod12.z.literal("ERROR"),
|
|
1059
1365
|
error: ErrorWithStackSchema,
|
|
1060
1366
|
task: TaskSchema.optional()
|
|
1061
1367
|
});
|
|
1062
|
-
var
|
|
1063
|
-
status:
|
|
1064
|
-
|
|
1368
|
+
var RunJobYieldExecutionErrorSchema = import_zod12.z.object({
|
|
1369
|
+
status: import_zod12.z.literal("YIELD_EXECUTION"),
|
|
1370
|
+
key: import_zod12.z.string()
|
|
1371
|
+
});
|
|
1372
|
+
var AutoYieldMetadataSchema = import_zod12.z.object({
|
|
1373
|
+
location: import_zod12.z.string(),
|
|
1374
|
+
timeRemaining: import_zod12.z.number(),
|
|
1375
|
+
timeElapsed: import_zod12.z.number(),
|
|
1376
|
+
limit: import_zod12.z.number().optional()
|
|
1377
|
+
});
|
|
1378
|
+
var RunJobAutoYieldExecutionErrorSchema = AutoYieldMetadataSchema.extend({
|
|
1379
|
+
status: import_zod12.z.literal("AUTO_YIELD_EXECUTION")
|
|
1380
|
+
});
|
|
1381
|
+
var RunJobAutoYieldWithCompletedTaskExecutionErrorSchema = import_zod12.z.object({
|
|
1382
|
+
status: import_zod12.z.literal("AUTO_YIELD_EXECUTION_WITH_COMPLETED_TASK"),
|
|
1383
|
+
id: import_zod12.z.string(),
|
|
1384
|
+
properties: import_zod12.z.array(DisplayPropertySchema).optional(),
|
|
1385
|
+
output: import_zod12.z.string().optional(),
|
|
1386
|
+
data: AutoYieldMetadataSchema
|
|
1387
|
+
});
|
|
1388
|
+
var RunJobInvalidPayloadErrorSchema = import_zod12.z.object({
|
|
1389
|
+
status: import_zod12.z.literal("INVALID_PAYLOAD"),
|
|
1390
|
+
errors: import_zod12.z.array(SchemaErrorSchema)
|
|
1065
1391
|
});
|
|
1066
|
-
var RunJobUnresolvedAuthErrorSchema =
|
|
1067
|
-
status:
|
|
1068
|
-
issues:
|
|
1069
|
-
id:
|
|
1070
|
-
error:
|
|
1392
|
+
var RunJobUnresolvedAuthErrorSchema = import_zod12.z.object({
|
|
1393
|
+
status: import_zod12.z.literal("UNRESOLVED_AUTH_ERROR"),
|
|
1394
|
+
issues: import_zod12.z.record(import_zod12.z.object({
|
|
1395
|
+
id: import_zod12.z.string(),
|
|
1396
|
+
error: import_zod12.z.string()
|
|
1071
1397
|
}))
|
|
1072
1398
|
});
|
|
1073
|
-
var RunJobResumeWithTaskSchema =
|
|
1074
|
-
status:
|
|
1399
|
+
var RunJobResumeWithTaskSchema = import_zod12.z.object({
|
|
1400
|
+
status: import_zod12.z.literal("RESUME_WITH_TASK"),
|
|
1075
1401
|
task: TaskSchema
|
|
1076
1402
|
});
|
|
1077
|
-
var RunJobRetryWithTaskSchema =
|
|
1078
|
-
status:
|
|
1403
|
+
var RunJobRetryWithTaskSchema = import_zod12.z.object({
|
|
1404
|
+
status: import_zod12.z.literal("RETRY_WITH_TASK"),
|
|
1079
1405
|
task: TaskSchema,
|
|
1080
1406
|
error: ErrorWithStackSchema,
|
|
1081
|
-
retryAt:
|
|
1407
|
+
retryAt: import_zod12.z.coerce.date()
|
|
1082
1408
|
});
|
|
1083
|
-
var RunJobCanceledWithTaskSchema =
|
|
1084
|
-
status:
|
|
1409
|
+
var RunJobCanceledWithTaskSchema = import_zod12.z.object({
|
|
1410
|
+
status: import_zod12.z.literal("CANCELED"),
|
|
1085
1411
|
task: TaskSchema
|
|
1086
1412
|
});
|
|
1087
|
-
var RunJobSuccessSchema =
|
|
1088
|
-
status:
|
|
1413
|
+
var RunJobSuccessSchema = import_zod12.z.object({
|
|
1414
|
+
status: import_zod12.z.literal("SUCCESS"),
|
|
1089
1415
|
output: DeserializedJsonSchema.optional()
|
|
1090
1416
|
});
|
|
1091
|
-
var
|
|
1417
|
+
var RunJobErrorResponseSchema = import_zod12.z.union([
|
|
1418
|
+
RunJobAutoYieldExecutionErrorSchema,
|
|
1419
|
+
RunJobAutoYieldWithCompletedTaskExecutionErrorSchema,
|
|
1420
|
+
RunJobYieldExecutionErrorSchema,
|
|
1092
1421
|
RunJobErrorSchema,
|
|
1093
1422
|
RunJobUnresolvedAuthErrorSchema,
|
|
1094
1423
|
RunJobInvalidPayloadErrorSchema,
|
|
1095
1424
|
RunJobResumeWithTaskSchema,
|
|
1096
1425
|
RunJobRetryWithTaskSchema,
|
|
1426
|
+
RunJobCanceledWithTaskSchema
|
|
1427
|
+
]);
|
|
1428
|
+
var RunJobResumeWithParallelTaskSchema = import_zod12.z.object({
|
|
1429
|
+
status: import_zod12.z.literal("RESUME_WITH_PARALLEL_TASK"),
|
|
1430
|
+
task: TaskSchema,
|
|
1431
|
+
childErrors: import_zod12.z.array(RunJobErrorResponseSchema)
|
|
1432
|
+
});
|
|
1433
|
+
var RunJobResponseSchema = import_zod12.z.discriminatedUnion("status", [
|
|
1434
|
+
RunJobAutoYieldExecutionErrorSchema,
|
|
1435
|
+
RunJobAutoYieldWithCompletedTaskExecutionErrorSchema,
|
|
1436
|
+
RunJobYieldExecutionErrorSchema,
|
|
1437
|
+
RunJobErrorSchema,
|
|
1438
|
+
RunJobUnresolvedAuthErrorSchema,
|
|
1439
|
+
RunJobInvalidPayloadErrorSchema,
|
|
1440
|
+
RunJobResumeWithTaskSchema,
|
|
1441
|
+
RunJobResumeWithParallelTaskSchema,
|
|
1442
|
+
RunJobRetryWithTaskSchema,
|
|
1097
1443
|
RunJobCanceledWithTaskSchema,
|
|
1098
1444
|
RunJobSuccessSchema
|
|
1099
1445
|
]);
|
|
1100
|
-
var PreprocessRunBodySchema =
|
|
1446
|
+
var PreprocessRunBodySchema = import_zod12.z.object({
|
|
1101
1447
|
event: ApiEventLogSchema,
|
|
1102
|
-
job:
|
|
1103
|
-
id:
|
|
1104
|
-
version:
|
|
1448
|
+
job: import_zod12.z.object({
|
|
1449
|
+
id: import_zod12.z.string(),
|
|
1450
|
+
version: import_zod12.z.string()
|
|
1105
1451
|
}),
|
|
1106
|
-
run:
|
|
1107
|
-
id:
|
|
1108
|
-
isTest:
|
|
1452
|
+
run: import_zod12.z.object({
|
|
1453
|
+
id: import_zod12.z.string(),
|
|
1454
|
+
isTest: import_zod12.z.boolean()
|
|
1109
1455
|
}),
|
|
1110
|
-
environment:
|
|
1111
|
-
id:
|
|
1112
|
-
slug:
|
|
1456
|
+
environment: import_zod12.z.object({
|
|
1457
|
+
id: import_zod12.z.string(),
|
|
1458
|
+
slug: import_zod12.z.string(),
|
|
1113
1459
|
type: RuntimeEnvironmentTypeSchema
|
|
1114
1460
|
}),
|
|
1115
|
-
organization:
|
|
1116
|
-
id:
|
|
1117
|
-
title:
|
|
1118
|
-
slug:
|
|
1461
|
+
organization: import_zod12.z.object({
|
|
1462
|
+
id: import_zod12.z.string(),
|
|
1463
|
+
title: import_zod12.z.string(),
|
|
1464
|
+
slug: import_zod12.z.string()
|
|
1119
1465
|
}),
|
|
1120
|
-
account:
|
|
1121
|
-
id:
|
|
1122
|
-
metadata:
|
|
1466
|
+
account: import_zod12.z.object({
|
|
1467
|
+
id: import_zod12.z.string(),
|
|
1468
|
+
metadata: import_zod12.z.any()
|
|
1123
1469
|
}).optional()
|
|
1124
1470
|
});
|
|
1125
|
-
var PreprocessRunResponseSchema =
|
|
1126
|
-
abort:
|
|
1127
|
-
properties:
|
|
1471
|
+
var PreprocessRunResponseSchema = import_zod12.z.object({
|
|
1472
|
+
abort: import_zod12.z.boolean(),
|
|
1473
|
+
properties: import_zod12.z.array(DisplayPropertySchema).optional()
|
|
1128
1474
|
});
|
|
1129
|
-
var CreateRunResponseOkSchema =
|
|
1130
|
-
ok:
|
|
1131
|
-
data:
|
|
1132
|
-
id:
|
|
1475
|
+
var CreateRunResponseOkSchema = import_zod12.z.object({
|
|
1476
|
+
ok: import_zod12.z.literal(true),
|
|
1477
|
+
data: import_zod12.z.object({
|
|
1478
|
+
id: import_zod12.z.string()
|
|
1133
1479
|
})
|
|
1134
1480
|
});
|
|
1135
|
-
var CreateRunResponseErrorSchema =
|
|
1136
|
-
ok:
|
|
1137
|
-
error:
|
|
1481
|
+
var CreateRunResponseErrorSchema = import_zod12.z.object({
|
|
1482
|
+
ok: import_zod12.z.literal(false),
|
|
1483
|
+
error: import_zod12.z.string()
|
|
1138
1484
|
});
|
|
1139
|
-
var CreateRunResponseBodySchema =
|
|
1485
|
+
var CreateRunResponseBodySchema = import_zod12.z.discriminatedUnion("ok", [
|
|
1140
1486
|
CreateRunResponseOkSchema,
|
|
1141
1487
|
CreateRunResponseErrorSchema
|
|
1142
1488
|
]);
|
|
1143
|
-
var RedactStringSchema =
|
|
1144
|
-
__redactedString:
|
|
1145
|
-
strings:
|
|
1146
|
-
interpolations:
|
|
1489
|
+
var RedactStringSchema = import_zod12.z.object({
|
|
1490
|
+
__redactedString: import_zod12.z.literal(true),
|
|
1491
|
+
strings: import_zod12.z.array(import_zod12.z.string()),
|
|
1492
|
+
interpolations: import_zod12.z.array(import_zod12.z.string())
|
|
1147
1493
|
});
|
|
1148
|
-
var LogMessageSchema =
|
|
1149
|
-
level:
|
|
1494
|
+
var LogMessageSchema = import_zod12.z.object({
|
|
1495
|
+
level: import_zod12.z.enum([
|
|
1150
1496
|
"DEBUG",
|
|
1151
1497
|
"INFO",
|
|
1152
1498
|
"WARN",
|
|
1153
1499
|
"ERROR"
|
|
1154
1500
|
]),
|
|
1155
|
-
message:
|
|
1501
|
+
message: import_zod12.z.string(),
|
|
1156
1502
|
data: SerializableJsonSchema.optional()
|
|
1157
1503
|
});
|
|
1158
|
-
var RedactSchema =
|
|
1159
|
-
paths:
|
|
1504
|
+
var RedactSchema = import_zod12.z.object({
|
|
1505
|
+
paths: import_zod12.z.array(import_zod12.z.string())
|
|
1160
1506
|
});
|
|
1161
|
-
var RetryOptionsSchema =
|
|
1507
|
+
var RetryOptionsSchema = import_zod12.z.object({
|
|
1162
1508
|
/** The maximum number of times to retry the request. */
|
|
1163
|
-
limit:
|
|
1509
|
+
limit: import_zod12.z.number().optional(),
|
|
1164
1510
|
/** The exponential factor to use when calculating the next retry time. */
|
|
1165
|
-
factor:
|
|
1511
|
+
factor: import_zod12.z.number().optional(),
|
|
1166
1512
|
/** The minimum amount of time to wait before retrying the request. */
|
|
1167
|
-
minTimeoutInMs:
|
|
1513
|
+
minTimeoutInMs: import_zod12.z.number().optional(),
|
|
1168
1514
|
/** The maximum amount of time to wait before retrying the request. */
|
|
1169
|
-
maxTimeoutInMs:
|
|
1515
|
+
maxTimeoutInMs: import_zod12.z.number().optional(),
|
|
1170
1516
|
/** Whether to randomize the retry time. */
|
|
1171
|
-
randomize:
|
|
1517
|
+
randomize: import_zod12.z.boolean().optional()
|
|
1172
1518
|
});
|
|
1173
|
-
var RunTaskOptionsSchema =
|
|
1519
|
+
var RunTaskOptionsSchema = import_zod12.z.object({
|
|
1174
1520
|
/** The name of the Task is required. This is displayed on the Task in the logs. */
|
|
1175
|
-
name:
|
|
1521
|
+
name: import_zod12.z.string().optional(),
|
|
1176
1522
|
/** The Task will wait and only start at the specified Date */
|
|
1177
|
-
delayUntil:
|
|
1523
|
+
delayUntil: import_zod12.z.coerce.date().optional(),
|
|
1178
1524
|
/** Retry options */
|
|
1179
1525
|
retry: RetryOptionsSchema.optional(),
|
|
1180
1526
|
/** The icon for the Task, it will appear in the logs.
|
|
1181
1527
|
* You can use the name of a company in lowercase, e.g. "github".
|
|
1182
|
-
* Or any icon name that [
|
|
1183
|
-
icon:
|
|
1528
|
+
* Or any icon name that [Tabler Icons](https://tabler-icons.io/) supports. */
|
|
1529
|
+
icon: import_zod12.z.string().optional(),
|
|
1184
1530
|
/** The key for the Task that you want to appear in the logs */
|
|
1185
|
-
displayKey:
|
|
1531
|
+
displayKey: import_zod12.z.string().optional(),
|
|
1186
1532
|
/** A description of the Task */
|
|
1187
|
-
description:
|
|
1533
|
+
description: import_zod12.z.string().optional(),
|
|
1188
1534
|
/** Properties that are displayed in the logs */
|
|
1189
|
-
properties:
|
|
1535
|
+
properties: import_zod12.z.array(DisplayPropertySchema).optional(),
|
|
1190
1536
|
/** The input params to the Task, will be displayed in the logs */
|
|
1191
|
-
params:
|
|
1537
|
+
params: import_zod12.z.any(),
|
|
1192
1538
|
/** The style of the log entry. */
|
|
1193
1539
|
style: StyleSchema.optional(),
|
|
1540
|
+
/** 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. */
|
|
1541
|
+
callback: import_zod12.z.object({
|
|
1542
|
+
/** Causes the task to wait for and return the data of the first request sent to `task.callbackUrl`. */
|
|
1543
|
+
enabled: import_zod12.z.boolean(),
|
|
1544
|
+
/** Time to wait for the first request to `task.callbackUrl`. Default: One hour. */
|
|
1545
|
+
timeoutInSeconds: import_zod12.z.number()
|
|
1546
|
+
}).partial().optional(),
|
|
1194
1547
|
/** Allows you to link the Integration connection in the logs. This is handled automatically in integrations. */
|
|
1195
|
-
connectionKey:
|
|
1196
|
-
/** 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. */
|
|
1197
|
-
operation:
|
|
1198
|
-
"fetch"
|
|
1548
|
+
connectionKey: import_zod12.z.string().optional(),
|
|
1549
|
+
/** 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. */
|
|
1550
|
+
operation: import_zod12.z.enum([
|
|
1551
|
+
"fetch",
|
|
1552
|
+
"fetch-response",
|
|
1553
|
+
"fetch-poll"
|
|
1199
1554
|
]).optional(),
|
|
1200
1555
|
/** 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). */
|
|
1201
|
-
noop:
|
|
1556
|
+
noop: import_zod12.z.boolean().default(false),
|
|
1202
1557
|
redact: RedactSchema.optional(),
|
|
1203
|
-
|
|
1558
|
+
parallel: import_zod12.z.boolean().optional()
|
|
1204
1559
|
});
|
|
1205
1560
|
var RunTaskBodyInputSchema = RunTaskOptionsSchema.extend({
|
|
1206
|
-
idempotencyKey:
|
|
1207
|
-
parentId:
|
|
1561
|
+
idempotencyKey: import_zod12.z.string(),
|
|
1562
|
+
parentId: import_zod12.z.string().optional()
|
|
1208
1563
|
});
|
|
1209
1564
|
var RunTaskBodyOutputSchema = RunTaskBodyInputSchema.extend({
|
|
1210
|
-
|
|
1565
|
+
properties: import_zod12.z.array(DisplayPropertySchema.partial()).optional(),
|
|
1566
|
+
params: DeserializedJsonSchema.optional().nullable(),
|
|
1567
|
+
callback: import_zod12.z.object({
|
|
1568
|
+
enabled: import_zod12.z.boolean(),
|
|
1569
|
+
timeoutInSeconds: import_zod12.z.number().default(3600)
|
|
1570
|
+
}).optional()
|
|
1571
|
+
});
|
|
1572
|
+
var RunTaskResponseWithCachedTasksBodySchema = import_zod12.z.object({
|
|
1573
|
+
task: ServerTaskSchema,
|
|
1574
|
+
cachedTasks: import_zod12.z.object({
|
|
1575
|
+
tasks: import_zod12.z.array(CachedTaskSchema),
|
|
1576
|
+
cursor: import_zod12.z.string().optional()
|
|
1577
|
+
}).optional()
|
|
1211
1578
|
});
|
|
1212
1579
|
var CompleteTaskBodyInputSchema = RunTaskBodyInputSchema.pick({
|
|
1213
1580
|
properties: true,
|
|
@@ -1216,199 +1583,299 @@ var CompleteTaskBodyInputSchema = RunTaskBodyInputSchema.pick({
|
|
|
1216
1583
|
}).extend({
|
|
1217
1584
|
output: SerializableJsonSchema.optional().transform((v) => v ? DeserializedJsonSchema.parse(JSON.parse(JSON.stringify(v))) : {})
|
|
1218
1585
|
});
|
|
1219
|
-
var
|
|
1586
|
+
var CompleteTaskBodyV2InputSchema = RunTaskBodyInputSchema.pick({
|
|
1587
|
+
properties: true,
|
|
1588
|
+
description: true,
|
|
1589
|
+
params: true
|
|
1590
|
+
}).extend({
|
|
1591
|
+
output: import_zod12.z.string().optional()
|
|
1592
|
+
});
|
|
1593
|
+
var FailTaskBodyInputSchema = import_zod12.z.object({
|
|
1220
1594
|
error: ErrorWithStackSchema
|
|
1221
1595
|
});
|
|
1222
|
-
var NormalizedRequestSchema =
|
|
1223
|
-
headers:
|
|
1224
|
-
method:
|
|
1225
|
-
query:
|
|
1226
|
-
url:
|
|
1227
|
-
body:
|
|
1596
|
+
var NormalizedRequestSchema = import_zod12.z.object({
|
|
1597
|
+
headers: import_zod12.z.record(import_zod12.z.string()),
|
|
1598
|
+
method: import_zod12.z.string(),
|
|
1599
|
+
query: import_zod12.z.record(import_zod12.z.string()),
|
|
1600
|
+
url: import_zod12.z.string(),
|
|
1601
|
+
body: import_zod12.z.any()
|
|
1228
1602
|
});
|
|
1229
|
-
var NormalizedResponseSchema =
|
|
1230
|
-
status:
|
|
1231
|
-
body:
|
|
1232
|
-
headers:
|
|
1603
|
+
var NormalizedResponseSchema = import_zod12.z.object({
|
|
1604
|
+
status: import_zod12.z.number(),
|
|
1605
|
+
body: import_zod12.z.any(),
|
|
1606
|
+
headers: import_zod12.z.record(import_zod12.z.string()).optional()
|
|
1233
1607
|
});
|
|
1234
|
-
var HttpSourceResponseSchema =
|
|
1608
|
+
var HttpSourceResponseSchema = import_zod12.z.object({
|
|
1235
1609
|
response: NormalizedResponseSchema,
|
|
1236
|
-
events:
|
|
1610
|
+
events: import_zod12.z.array(RawEventSchema),
|
|
1237
1611
|
metadata: HttpSourceResponseMetadataSchema.optional()
|
|
1238
1612
|
});
|
|
1239
|
-
var
|
|
1613
|
+
var WebhookDeliveryResponseSchema = import_zod12.z.object({
|
|
1614
|
+
response: NormalizedResponseSchema,
|
|
1615
|
+
verified: import_zod12.z.boolean(),
|
|
1616
|
+
error: import_zod12.z.string().optional()
|
|
1617
|
+
});
|
|
1618
|
+
var RegisterTriggerBodySchemaV1 = import_zod12.z.object({
|
|
1240
1619
|
rule: EventRuleSchema,
|
|
1241
1620
|
source: SourceMetadataV1Schema
|
|
1242
1621
|
});
|
|
1243
|
-
var RegisterTriggerBodySchemaV2 =
|
|
1622
|
+
var RegisterTriggerBodySchemaV2 = import_zod12.z.object({
|
|
1244
1623
|
rule: EventRuleSchema,
|
|
1245
1624
|
source: SourceMetadataV2Schema,
|
|
1246
|
-
accountId:
|
|
1625
|
+
accountId: import_zod12.z.string().optional()
|
|
1247
1626
|
});
|
|
1248
|
-
var InitializeTriggerBodySchema =
|
|
1249
|
-
id:
|
|
1250
|
-
params:
|
|
1251
|
-
accountId:
|
|
1252
|
-
metadata:
|
|
1627
|
+
var InitializeTriggerBodySchema = import_zod12.z.object({
|
|
1628
|
+
id: import_zod12.z.string(),
|
|
1629
|
+
params: import_zod12.z.any(),
|
|
1630
|
+
accountId: import_zod12.z.string().optional(),
|
|
1631
|
+
metadata: import_zod12.z.any().optional()
|
|
1253
1632
|
});
|
|
1254
|
-
var RegisterCommonScheduleBodySchema =
|
|
1633
|
+
var RegisterCommonScheduleBodySchema = import_zod12.z.object({
|
|
1255
1634
|
/** A unique id for the schedule. This is used to identify and unregister the schedule later. */
|
|
1256
|
-
id:
|
|
1635
|
+
id: import_zod12.z.string(),
|
|
1257
1636
|
/** Any additional metadata about the schedule. */
|
|
1258
|
-
metadata:
|
|
1637
|
+
metadata: import_zod12.z.any(),
|
|
1259
1638
|
/** An optional Account ID to associate with runs triggered by this schedule */
|
|
1260
|
-
accountId:
|
|
1639
|
+
accountId: import_zod12.z.string().optional()
|
|
1261
1640
|
});
|
|
1262
1641
|
var RegisterIntervalScheduleBodySchema = RegisterCommonScheduleBodySchema.merge(IntervalMetadataSchema);
|
|
1263
1642
|
var InitializeCronScheduleBodySchema = RegisterCommonScheduleBodySchema.merge(CronMetadataSchema);
|
|
1264
|
-
var RegisterScheduleBodySchema =
|
|
1643
|
+
var RegisterScheduleBodySchema = import_zod12.z.discriminatedUnion("type", [
|
|
1265
1644
|
RegisterIntervalScheduleBodySchema,
|
|
1266
1645
|
InitializeCronScheduleBodySchema
|
|
1267
1646
|
]);
|
|
1268
|
-
var RegisterScheduleResponseBodySchema =
|
|
1269
|
-
id:
|
|
1647
|
+
var RegisterScheduleResponseBodySchema = import_zod12.z.object({
|
|
1648
|
+
id: import_zod12.z.string(),
|
|
1270
1649
|
schedule: ScheduleMetadataSchema,
|
|
1271
|
-
metadata:
|
|
1272
|
-
active:
|
|
1650
|
+
metadata: import_zod12.z.any(),
|
|
1651
|
+
active: import_zod12.z.boolean()
|
|
1273
1652
|
});
|
|
1274
|
-
var CreateExternalConnectionBodySchema =
|
|
1275
|
-
accessToken:
|
|
1276
|
-
type:
|
|
1653
|
+
var CreateExternalConnectionBodySchema = import_zod12.z.object({
|
|
1654
|
+
accessToken: import_zod12.z.string(),
|
|
1655
|
+
type: import_zod12.z.enum([
|
|
1277
1656
|
"oauth2"
|
|
1278
1657
|
]),
|
|
1279
|
-
scopes:
|
|
1280
|
-
metadata:
|
|
1658
|
+
scopes: import_zod12.z.array(import_zod12.z.string()).optional(),
|
|
1659
|
+
metadata: import_zod12.z.any()
|
|
1281
1660
|
});
|
|
1282
|
-
var GetRunStatusesSchema =
|
|
1283
|
-
run:
|
|
1284
|
-
id:
|
|
1661
|
+
var GetRunStatusesSchema = import_zod12.z.object({
|
|
1662
|
+
run: import_zod12.z.object({
|
|
1663
|
+
id: import_zod12.z.string(),
|
|
1285
1664
|
status: RunStatusSchema,
|
|
1286
|
-
output:
|
|
1665
|
+
output: import_zod12.z.any().optional()
|
|
1287
1666
|
}),
|
|
1288
|
-
statuses:
|
|
1667
|
+
statuses: import_zod12.z.array(JobRunStatusRecordSchema)
|
|
1668
|
+
});
|
|
1669
|
+
var InvokeJobResponseSchema = import_zod12.z.object({
|
|
1670
|
+
id: import_zod12.z.string()
|
|
1289
1671
|
});
|
|
1672
|
+
var InvokeJobRequestBodySchema = import_zod12.z.object({
|
|
1673
|
+
payload: import_zod12.z.any(),
|
|
1674
|
+
context: import_zod12.z.any().optional(),
|
|
1675
|
+
options: import_zod12.z.object({
|
|
1676
|
+
accountId: import_zod12.z.string().optional(),
|
|
1677
|
+
callbackUrl: import_zod12.z.string().optional()
|
|
1678
|
+
}).optional()
|
|
1679
|
+
});
|
|
1680
|
+
var InvokeOptionsSchema = import_zod12.z.object({
|
|
1681
|
+
accountId: import_zod12.z.string().optional(),
|
|
1682
|
+
idempotencyKey: import_zod12.z.string().optional(),
|
|
1683
|
+
context: import_zod12.z.any().optional(),
|
|
1684
|
+
callbackUrl: import_zod12.z.string().optional()
|
|
1685
|
+
});
|
|
1686
|
+
var EphemeralEventDispatcherRequestBodySchema = import_zod12.z.object({
|
|
1687
|
+
url: import_zod12.z.string(),
|
|
1688
|
+
name: import_zod12.z.string().or(import_zod12.z.array(import_zod12.z.string())),
|
|
1689
|
+
source: import_zod12.z.string().optional(),
|
|
1690
|
+
filter: EventFilterSchema.optional(),
|
|
1691
|
+
contextFilter: EventFilterSchema.optional(),
|
|
1692
|
+
accountId: import_zod12.z.string().optional(),
|
|
1693
|
+
timeoutInSeconds: import_zod12.z.number().int().positive().min(10).max(60 * 60 * 24 * 365).default(3600)
|
|
1694
|
+
});
|
|
1695
|
+
var EphemeralEventDispatcherResponseBodySchema = import_zod12.z.object({
|
|
1696
|
+
id: import_zod12.z.string()
|
|
1697
|
+
});
|
|
1698
|
+
var KeyValueStoreResponseBodySchema = import_zod12.z.discriminatedUnion("action", [
|
|
1699
|
+
import_zod12.z.object({
|
|
1700
|
+
action: import_zod12.z.literal("DELETE"),
|
|
1701
|
+
key: import_zod12.z.string(),
|
|
1702
|
+
deleted: import_zod12.z.boolean()
|
|
1703
|
+
}),
|
|
1704
|
+
import_zod12.z.object({
|
|
1705
|
+
action: import_zod12.z.literal("GET"),
|
|
1706
|
+
key: import_zod12.z.string(),
|
|
1707
|
+
value: import_zod12.z.string().optional()
|
|
1708
|
+
}),
|
|
1709
|
+
import_zod12.z.object({
|
|
1710
|
+
action: import_zod12.z.literal("HAS"),
|
|
1711
|
+
key: import_zod12.z.string(),
|
|
1712
|
+
has: import_zod12.z.boolean()
|
|
1713
|
+
}),
|
|
1714
|
+
import_zod12.z.object({
|
|
1715
|
+
action: import_zod12.z.literal("SET"),
|
|
1716
|
+
key: import_zod12.z.string(),
|
|
1717
|
+
value: import_zod12.z.string().optional()
|
|
1718
|
+
})
|
|
1719
|
+
]);
|
|
1290
1720
|
|
|
1291
1721
|
// src/schemas/notifications.ts
|
|
1292
|
-
var
|
|
1722
|
+
var import_zod13 = require("zod");
|
|
1293
1723
|
var MISSING_CONNECTION_NOTIFICATION = "dev.trigger.notifications.missingConnection";
|
|
1294
1724
|
var MISSING_CONNECTION_RESOLVED_NOTIFICATION = "dev.trigger.notifications.missingConnectionResolved";
|
|
1295
|
-
var CommonMissingConnectionNotificationPayloadSchema =
|
|
1296
|
-
id:
|
|
1297
|
-
client:
|
|
1298
|
-
id:
|
|
1299
|
-
title:
|
|
1300
|
-
scopes:
|
|
1301
|
-
createdAt:
|
|
1302
|
-
updatedAt:
|
|
1725
|
+
var CommonMissingConnectionNotificationPayloadSchema = import_zod13.z.object({
|
|
1726
|
+
id: import_zod13.z.string(),
|
|
1727
|
+
client: import_zod13.z.object({
|
|
1728
|
+
id: import_zod13.z.string(),
|
|
1729
|
+
title: import_zod13.z.string(),
|
|
1730
|
+
scopes: import_zod13.z.array(import_zod13.z.string()),
|
|
1731
|
+
createdAt: import_zod13.z.coerce.date(),
|
|
1732
|
+
updatedAt: import_zod13.z.coerce.date()
|
|
1303
1733
|
}),
|
|
1304
|
-
authorizationUrl:
|
|
1734
|
+
authorizationUrl: import_zod13.z.string()
|
|
1305
1735
|
});
|
|
1306
1736
|
var MissingDeveloperConnectionNotificationPayloadSchema = CommonMissingConnectionNotificationPayloadSchema.extend({
|
|
1307
|
-
type:
|
|
1737
|
+
type: import_zod13.z.literal("DEVELOPER")
|
|
1308
1738
|
});
|
|
1309
1739
|
var MissingExternalConnectionNotificationPayloadSchema = CommonMissingConnectionNotificationPayloadSchema.extend({
|
|
1310
|
-
type:
|
|
1311
|
-
account:
|
|
1312
|
-
id:
|
|
1313
|
-
metadata:
|
|
1740
|
+
type: import_zod13.z.literal("EXTERNAL"),
|
|
1741
|
+
account: import_zod13.z.object({
|
|
1742
|
+
id: import_zod13.z.string(),
|
|
1743
|
+
metadata: import_zod13.z.any()
|
|
1314
1744
|
})
|
|
1315
1745
|
});
|
|
1316
|
-
var MissingConnectionNotificationPayloadSchema =
|
|
1746
|
+
var MissingConnectionNotificationPayloadSchema = import_zod13.z.discriminatedUnion("type", [
|
|
1317
1747
|
MissingDeveloperConnectionNotificationPayloadSchema,
|
|
1318
1748
|
MissingExternalConnectionNotificationPayloadSchema
|
|
1319
1749
|
]);
|
|
1320
|
-
var CommonMissingConnectionNotificationResolvedPayloadSchema =
|
|
1321
|
-
id:
|
|
1322
|
-
client:
|
|
1323
|
-
id:
|
|
1324
|
-
title:
|
|
1325
|
-
scopes:
|
|
1326
|
-
createdAt:
|
|
1327
|
-
updatedAt:
|
|
1328
|
-
integrationIdentifier:
|
|
1329
|
-
integrationAuthMethod:
|
|
1750
|
+
var CommonMissingConnectionNotificationResolvedPayloadSchema = import_zod13.z.object({
|
|
1751
|
+
id: import_zod13.z.string(),
|
|
1752
|
+
client: import_zod13.z.object({
|
|
1753
|
+
id: import_zod13.z.string(),
|
|
1754
|
+
title: import_zod13.z.string(),
|
|
1755
|
+
scopes: import_zod13.z.array(import_zod13.z.string()),
|
|
1756
|
+
createdAt: import_zod13.z.coerce.date(),
|
|
1757
|
+
updatedAt: import_zod13.z.coerce.date(),
|
|
1758
|
+
integrationIdentifier: import_zod13.z.string(),
|
|
1759
|
+
integrationAuthMethod: import_zod13.z.string()
|
|
1330
1760
|
}),
|
|
1331
|
-
expiresAt:
|
|
1761
|
+
expiresAt: import_zod13.z.coerce.date()
|
|
1332
1762
|
});
|
|
1333
1763
|
var MissingDeveloperConnectionResolvedNotificationPayloadSchema = CommonMissingConnectionNotificationResolvedPayloadSchema.extend({
|
|
1334
|
-
type:
|
|
1764
|
+
type: import_zod13.z.literal("DEVELOPER")
|
|
1335
1765
|
});
|
|
1336
1766
|
var MissingExternalConnectionResolvedNotificationPayloadSchema = CommonMissingConnectionNotificationResolvedPayloadSchema.extend({
|
|
1337
|
-
type:
|
|
1338
|
-
account:
|
|
1339
|
-
id:
|
|
1340
|
-
metadata:
|
|
1767
|
+
type: import_zod13.z.literal("EXTERNAL"),
|
|
1768
|
+
account: import_zod13.z.object({
|
|
1769
|
+
id: import_zod13.z.string(),
|
|
1770
|
+
metadata: import_zod13.z.any()
|
|
1341
1771
|
})
|
|
1342
1772
|
});
|
|
1343
|
-
var MissingConnectionResolvedNotificationPayloadSchema =
|
|
1773
|
+
var MissingConnectionResolvedNotificationPayloadSchema = import_zod13.z.discriminatedUnion("type", [
|
|
1344
1774
|
MissingDeveloperConnectionResolvedNotificationPayloadSchema,
|
|
1345
1775
|
MissingExternalConnectionResolvedNotificationPayloadSchema
|
|
1346
1776
|
]);
|
|
1347
1777
|
|
|
1348
1778
|
// src/schemas/fetch.ts
|
|
1349
|
-
var
|
|
1350
|
-
var FetchRetryHeadersStrategySchema =
|
|
1779
|
+
var import_zod14 = require("zod");
|
|
1780
|
+
var FetchRetryHeadersStrategySchema = import_zod14.z.object({
|
|
1351
1781
|
/** The `headers` strategy retries the request using info from the response headers. */
|
|
1352
|
-
strategy:
|
|
1782
|
+
strategy: import_zod14.z.literal("headers"),
|
|
1353
1783
|
/** The header to use to determine the maximum number of times to retry the request. */
|
|
1354
|
-
limitHeader:
|
|
1784
|
+
limitHeader: import_zod14.z.string(),
|
|
1355
1785
|
/** The header to use to determine the number of remaining retries. */
|
|
1356
|
-
remainingHeader:
|
|
1786
|
+
remainingHeader: import_zod14.z.string(),
|
|
1357
1787
|
/** The header to use to determine the time when the number of remaining retries will be reset. */
|
|
1358
|
-
resetHeader:
|
|
1788
|
+
resetHeader: import_zod14.z.string(),
|
|
1789
|
+
/** The event filter to use to determine if the request should be retried. */
|
|
1790
|
+
bodyFilter: EventFilterSchema.optional(),
|
|
1791
|
+
/** The format of the `resetHeader` value. */
|
|
1792
|
+
resetFormat: import_zod14.z.enum([
|
|
1793
|
+
"unix_timestamp",
|
|
1794
|
+
"unix_timestamp_in_ms",
|
|
1795
|
+
"iso_8601",
|
|
1796
|
+
"iso_8601_duration_openai_variant"
|
|
1797
|
+
]).default("unix_timestamp")
|
|
1359
1798
|
});
|
|
1360
1799
|
var FetchRetryBackoffStrategySchema = RetryOptionsSchema.extend({
|
|
1361
1800
|
/** The `backoff` strategy retries the request with an exponential backoff. */
|
|
1362
|
-
strategy:
|
|
1801
|
+
strategy: import_zod14.z.literal("backoff"),
|
|
1802
|
+
/** The event filter to use to determine if the request should be retried. */
|
|
1803
|
+
bodyFilter: EventFilterSchema.optional()
|
|
1363
1804
|
});
|
|
1364
|
-
var FetchRetryStrategySchema =
|
|
1805
|
+
var FetchRetryStrategySchema = import_zod14.z.discriminatedUnion("strategy", [
|
|
1365
1806
|
FetchRetryHeadersStrategySchema,
|
|
1366
1807
|
FetchRetryBackoffStrategySchema
|
|
1367
1808
|
]);
|
|
1368
|
-
var FetchRequestInitSchema =
|
|
1809
|
+
var FetchRequestInitSchema = import_zod14.z.object({
|
|
1369
1810
|
/** The HTTP method to use for the request. */
|
|
1370
|
-
method:
|
|
1811
|
+
method: import_zod14.z.string().optional(),
|
|
1371
1812
|
/** 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. */
|
|
1372
|
-
headers:
|
|
1373
|
-
|
|
1813
|
+
headers: import_zod14.z.record(import_zod14.z.union([
|
|
1814
|
+
import_zod14.z.string(),
|
|
1374
1815
|
RedactStringSchema
|
|
1375
1816
|
])).optional(),
|
|
1376
1817
|
/** The body of the request. */
|
|
1377
|
-
body:
|
|
1378
|
-
|
|
1379
|
-
|
|
1818
|
+
body: import_zod14.z.union([
|
|
1819
|
+
import_zod14.z.string(),
|
|
1820
|
+
import_zod14.z.instanceof(ArrayBuffer)
|
|
1380
1821
|
]).optional()
|
|
1381
1822
|
});
|
|
1382
|
-
var FetchRetryOptionsSchema =
|
|
1383
|
-
var
|
|
1384
|
-
|
|
1823
|
+
var FetchRetryOptionsSchema = import_zod14.z.record(FetchRetryStrategySchema);
|
|
1824
|
+
var FetchTimeoutOptionsSchema = import_zod14.z.object({
|
|
1825
|
+
durationInMs: import_zod14.z.number(),
|
|
1826
|
+
retry: RetryOptionsSchema.optional()
|
|
1827
|
+
});
|
|
1828
|
+
var FetchOperationSchema = import_zod14.z.object({
|
|
1829
|
+
url: import_zod14.z.string(),
|
|
1385
1830
|
requestInit: FetchRequestInitSchema.optional(),
|
|
1386
|
-
retry:
|
|
1831
|
+
retry: import_zod14.z.record(FetchRetryStrategySchema).optional(),
|
|
1832
|
+
timeout: FetchTimeoutOptionsSchema.optional()
|
|
1833
|
+
});
|
|
1834
|
+
var FetchPollOperationSchema = import_zod14.z.object({
|
|
1835
|
+
url: import_zod14.z.string(),
|
|
1836
|
+
interval: import_zod14.z.number().int().positive().min(10).max(600).default(10),
|
|
1837
|
+
timeout: import_zod14.z.number().int().positive().min(30).max(3600).default(600),
|
|
1838
|
+
responseFilter: ResponseFilterSchema,
|
|
1839
|
+
requestInit: FetchRequestInitSchema.optional(),
|
|
1840
|
+
requestTimeout: FetchTimeoutOptionsSchema.optional()
|
|
1387
1841
|
});
|
|
1388
1842
|
|
|
1389
1843
|
// src/schemas/events.ts
|
|
1390
|
-
var
|
|
1391
|
-
var GetEventSchema =
|
|
1844
|
+
var import_zod15 = require("zod");
|
|
1845
|
+
var GetEventSchema = import_zod15.z.object({
|
|
1392
1846
|
/** The event id */
|
|
1393
|
-
id:
|
|
1847
|
+
id: import_zod15.z.string(),
|
|
1394
1848
|
/** The event name */
|
|
1395
|
-
name:
|
|
1849
|
+
name: import_zod15.z.string(),
|
|
1396
1850
|
/** When the event was created */
|
|
1397
|
-
createdAt:
|
|
1851
|
+
createdAt: import_zod15.z.coerce.date(),
|
|
1398
1852
|
/** When the event was last updated */
|
|
1399
|
-
updatedAt:
|
|
1853
|
+
updatedAt: import_zod15.z.coerce.date(),
|
|
1400
1854
|
/** The runs that were triggered by the event */
|
|
1401
|
-
runs:
|
|
1855
|
+
runs: import_zod15.z.array(import_zod15.z.object({
|
|
1402
1856
|
/** The Run id */
|
|
1403
|
-
id:
|
|
1857
|
+
id: import_zod15.z.string(),
|
|
1404
1858
|
/** The Run status */
|
|
1405
1859
|
status: RunStatusSchema,
|
|
1406
1860
|
/** When the run started */
|
|
1407
|
-
startedAt:
|
|
1861
|
+
startedAt: import_zod15.z.coerce.date().optional().nullable(),
|
|
1408
1862
|
/** When the run completed */
|
|
1409
|
-
completedAt:
|
|
1863
|
+
completedAt: import_zod15.z.coerce.date().optional().nullable()
|
|
1410
1864
|
}))
|
|
1411
1865
|
});
|
|
1866
|
+
var CancelRunsForEventSchema = import_zod15.z.object({
|
|
1867
|
+
cancelledRunIds: import_zod15.z.array(import_zod15.z.string()),
|
|
1868
|
+
failedToCancelRunIds: import_zod15.z.array(import_zod15.z.string())
|
|
1869
|
+
});
|
|
1870
|
+
|
|
1871
|
+
// src/schemas/request.ts
|
|
1872
|
+
var import_zod16 = require("zod");
|
|
1873
|
+
var RequestWithRawBodySchema = import_zod16.z.object({
|
|
1874
|
+
url: import_zod16.z.string(),
|
|
1875
|
+
method: import_zod16.z.string(),
|
|
1876
|
+
headers: import_zod16.z.record(import_zod16.z.string()),
|
|
1877
|
+
rawBody: import_zod16.z.string()
|
|
1878
|
+
});
|
|
1412
1879
|
|
|
1413
1880
|
// src/utils.ts
|
|
1414
1881
|
function deepMergeFilters(...filters) {
|
|
@@ -1429,6 +1896,10 @@ function deepMergeFilters(...filters) {
|
|
|
1429
1896
|
return result;
|
|
1430
1897
|
}
|
|
1431
1898
|
__name(deepMergeFilters, "deepMergeFilters");
|
|
1899
|
+
function assertExhaustive(x) {
|
|
1900
|
+
throw new Error("Unexpected object: " + x);
|
|
1901
|
+
}
|
|
1902
|
+
__name(assertExhaustive, "assertExhaustive");
|
|
1432
1903
|
|
|
1433
1904
|
// src/retry.ts
|
|
1434
1905
|
var DEFAULT_RETRY_OPTIONS = {
|
|
@@ -1453,6 +1924,73 @@ function calculateRetryAt(retryOptions, attempts) {
|
|
|
1453
1924
|
return new Date(Date.now() + timeoutInMs);
|
|
1454
1925
|
}
|
|
1455
1926
|
__name(calculateRetryAt, "calculateRetryAt");
|
|
1927
|
+
function calculateResetAt(resets, format, now = /* @__PURE__ */ new Date()) {
|
|
1928
|
+
if (!resets)
|
|
1929
|
+
return;
|
|
1930
|
+
switch (format) {
|
|
1931
|
+
case "iso_8601_duration_openai_variant": {
|
|
1932
|
+
return calculateISO8601DurationOpenAIVariantResetAt(resets, now);
|
|
1933
|
+
}
|
|
1934
|
+
case "iso_8601": {
|
|
1935
|
+
return calculateISO8601ResetAt(resets, now);
|
|
1936
|
+
}
|
|
1937
|
+
case "unix_timestamp": {
|
|
1938
|
+
return calculateUnixTimestampResetAt(resets, now);
|
|
1939
|
+
}
|
|
1940
|
+
case "unix_timestamp_in_ms": {
|
|
1941
|
+
return calculateUnixTimestampInMsResetAt(resets, now);
|
|
1942
|
+
}
|
|
1943
|
+
}
|
|
1944
|
+
}
|
|
1945
|
+
__name(calculateResetAt, "calculateResetAt");
|
|
1946
|
+
function calculateUnixTimestampResetAt(resets, now = /* @__PURE__ */ new Date()) {
|
|
1947
|
+
if (!resets)
|
|
1948
|
+
return void 0;
|
|
1949
|
+
const resetAt = parseInt(resets, 10);
|
|
1950
|
+
if (isNaN(resetAt))
|
|
1951
|
+
return void 0;
|
|
1952
|
+
return new Date(resetAt * 1e3);
|
|
1953
|
+
}
|
|
1954
|
+
__name(calculateUnixTimestampResetAt, "calculateUnixTimestampResetAt");
|
|
1955
|
+
function calculateUnixTimestampInMsResetAt(resets, now = /* @__PURE__ */ new Date()) {
|
|
1956
|
+
if (!resets)
|
|
1957
|
+
return void 0;
|
|
1958
|
+
const resetAt = parseInt(resets, 10);
|
|
1959
|
+
if (isNaN(resetAt))
|
|
1960
|
+
return void 0;
|
|
1961
|
+
return new Date(resetAt);
|
|
1962
|
+
}
|
|
1963
|
+
__name(calculateUnixTimestampInMsResetAt, "calculateUnixTimestampInMsResetAt");
|
|
1964
|
+
function calculateISO8601ResetAt(resets, now = /* @__PURE__ */ new Date()) {
|
|
1965
|
+
if (!resets)
|
|
1966
|
+
return void 0;
|
|
1967
|
+
const resetAt = new Date(resets);
|
|
1968
|
+
if (isNaN(resetAt.getTime()))
|
|
1969
|
+
return void 0;
|
|
1970
|
+
return resetAt;
|
|
1971
|
+
}
|
|
1972
|
+
__name(calculateISO8601ResetAt, "calculateISO8601ResetAt");
|
|
1973
|
+
function calculateISO8601DurationOpenAIVariantResetAt(resets, now = /* @__PURE__ */ new Date()) {
|
|
1974
|
+
if (!resets)
|
|
1975
|
+
return void 0;
|
|
1976
|
+
const pattern = /^(?:(\d+)d)?(?:(\d+)h)?(?:(\d+)m)?(?:(\d+(?:\.\d+)?)s)?(?:(\d+)ms)?$/;
|
|
1977
|
+
const match = resets.match(pattern);
|
|
1978
|
+
if (!match)
|
|
1979
|
+
return void 0;
|
|
1980
|
+
const days = parseInt(match[1], 10) || 0;
|
|
1981
|
+
const hours = parseInt(match[2], 10) || 0;
|
|
1982
|
+
const minutes = parseInt(match[3], 10) || 0;
|
|
1983
|
+
const seconds = parseFloat(match[4]) || 0;
|
|
1984
|
+
const milliseconds = parseInt(match[5], 10) || 0;
|
|
1985
|
+
const resetAt = new Date(now);
|
|
1986
|
+
resetAt.setDate(resetAt.getDate() + days);
|
|
1987
|
+
resetAt.setHours(resetAt.getHours() + hours);
|
|
1988
|
+
resetAt.setMinutes(resetAt.getMinutes() + minutes);
|
|
1989
|
+
resetAt.setSeconds(resetAt.getSeconds() + Math.floor(seconds));
|
|
1990
|
+
resetAt.setMilliseconds(resetAt.getMilliseconds() + (seconds - Math.floor(seconds)) * 1e3 + milliseconds);
|
|
1991
|
+
return resetAt;
|
|
1992
|
+
}
|
|
1993
|
+
__name(calculateISO8601DurationOpenAIVariantResetAt, "calculateISO8601DurationOpenAIVariantResetAt");
|
|
1456
1994
|
|
|
1457
1995
|
// src/replacements.ts
|
|
1458
1996
|
var currentDate = {
|
|
@@ -1494,6 +2032,13 @@ __name(urlWithSearchParams, "urlWithSearchParams");
|
|
|
1494
2032
|
|
|
1495
2033
|
// src/eventFilterMatches.ts
|
|
1496
2034
|
function eventFilterMatches(payload, filter) {
|
|
2035
|
+
if (payload === void 0 || payload === null) {
|
|
2036
|
+
if (Object.entries(filter).length === 0) {
|
|
2037
|
+
return true;
|
|
2038
|
+
} else {
|
|
2039
|
+
return false;
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
1497
2042
|
for (const [patternKey, patternValue] of Object.entries(filter)) {
|
|
1498
2043
|
const payloadValue = payload[patternKey];
|
|
1499
2044
|
if (Array.isArray(patternValue)) {
|
|
@@ -1633,4 +2178,97 @@ function contentFilterMatches(actualValue, contentFilter) {
|
|
|
1633
2178
|
return true;
|
|
1634
2179
|
}
|
|
1635
2180
|
__name(contentFilterMatches, "contentFilterMatches");
|
|
2181
|
+
|
|
2182
|
+
// src/requestFilterMatches.ts
|
|
2183
|
+
async function requestFilterMatches(request, filter) {
|
|
2184
|
+
const clonedRequest = request.clone();
|
|
2185
|
+
if (!requestMethodMatches(clonedRequest.method, filter.method)) {
|
|
2186
|
+
return false;
|
|
2187
|
+
}
|
|
2188
|
+
const headersObj = Object.fromEntries(clonedRequest.headers.entries());
|
|
2189
|
+
if (filter.headers && !eventFilterMatches(headersObj, filter.headers)) {
|
|
2190
|
+
return false;
|
|
2191
|
+
}
|
|
2192
|
+
const searchParams = new URL(clonedRequest.url).searchParams;
|
|
2193
|
+
const searchParamsObject = {};
|
|
2194
|
+
for (const [key, value] of searchParams.entries()) {
|
|
2195
|
+
searchParamsObject[key] = value;
|
|
2196
|
+
}
|
|
2197
|
+
if (filter.query && !eventFilterMatches(searchParamsObject, filter.query)) {
|
|
2198
|
+
return false;
|
|
2199
|
+
}
|
|
2200
|
+
try {
|
|
2201
|
+
const json = await clonedRequest.json();
|
|
2202
|
+
if (filter.body && !eventFilterMatches(json, filter.body)) {
|
|
2203
|
+
return false;
|
|
2204
|
+
}
|
|
2205
|
+
} catch (e) {
|
|
2206
|
+
if (filter.body) {
|
|
2207
|
+
return false;
|
|
2208
|
+
}
|
|
2209
|
+
}
|
|
2210
|
+
return true;
|
|
2211
|
+
}
|
|
2212
|
+
__name(requestFilterMatches, "requestFilterMatches");
|
|
2213
|
+
async function responseFilterMatches(response, filter) {
|
|
2214
|
+
if (filter.headers && !eventFilterMatches(response.headers, filter.headers)) {
|
|
2215
|
+
return {
|
|
2216
|
+
match: false
|
|
2217
|
+
};
|
|
2218
|
+
}
|
|
2219
|
+
try {
|
|
2220
|
+
const json = await response.json();
|
|
2221
|
+
if (filter.body && !eventFilterMatches(json, filter.body)) {
|
|
2222
|
+
return {
|
|
2223
|
+
match: false,
|
|
2224
|
+
body: json
|
|
2225
|
+
};
|
|
2226
|
+
} else {
|
|
2227
|
+
return {
|
|
2228
|
+
match: true,
|
|
2229
|
+
body: json
|
|
2230
|
+
};
|
|
2231
|
+
}
|
|
2232
|
+
} catch (e) {
|
|
2233
|
+
if (filter.body) {
|
|
2234
|
+
return {
|
|
2235
|
+
match: false,
|
|
2236
|
+
body: void 0
|
|
2237
|
+
};
|
|
2238
|
+
}
|
|
2239
|
+
}
|
|
2240
|
+
return {
|
|
2241
|
+
match: true,
|
|
2242
|
+
body: void 0
|
|
2243
|
+
};
|
|
2244
|
+
}
|
|
2245
|
+
__name(responseFilterMatches, "responseFilterMatches");
|
|
2246
|
+
function requestMethodMatches(method, filter) {
|
|
2247
|
+
if (!filter) {
|
|
2248
|
+
return true;
|
|
2249
|
+
}
|
|
2250
|
+
return filter.includes(method);
|
|
2251
|
+
}
|
|
2252
|
+
__name(requestMethodMatches, "requestMethodMatches");
|
|
2253
|
+
|
|
2254
|
+
// src/index.ts
|
|
2255
|
+
var API_VERSIONS = {
|
|
2256
|
+
LAZY_LOADED_CACHED_TASKS: "2023-09-29",
|
|
2257
|
+
SERIALIZED_TASK_OUTPUT: "2023-11-01"
|
|
2258
|
+
};
|
|
2259
|
+
var PLATFORM_FEATURES = {
|
|
2260
|
+
yieldExecution: API_VERSIONS.LAZY_LOADED_CACHED_TASKS,
|
|
2261
|
+
lazyLoadedCachedTasks: API_VERSIONS.LAZY_LOADED_CACHED_TASKS
|
|
2262
|
+
};
|
|
2263
|
+
function supportsFeature(featureName, version) {
|
|
2264
|
+
if (version === "unversioned" || version === "unknown") {
|
|
2265
|
+
return false;
|
|
2266
|
+
}
|
|
2267
|
+
const supportedVersion = PLATFORM_FEATURES[featureName];
|
|
2268
|
+
if (!supportedVersion) {
|
|
2269
|
+
return false;
|
|
2270
|
+
}
|
|
2271
|
+
return version >= supportedVersion;
|
|
2272
|
+
}
|
|
2273
|
+
__name(supportsFeature, "supportsFeature");
|
|
1636
2274
|
//# sourceMappingURL=index.js.map
|