@trigger.dev/core 0.0.0-buffer-import-20231031135043 → 0.0.0-buffer-fix-20231206151546
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.mts +16770 -0
- package/dist/index.d.ts +7580 -1188
- package/dist/index.js +1274 -1032
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1841 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +13 -7
package/dist/index.js
CHANGED
|
@@ -1,346 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
var __accessCheck = (obj, member, msg) => {
|
|
21
|
-
if (!member.has(obj))
|
|
22
|
-
throw TypeError("Cannot " + msg);
|
|
23
|
-
};
|
|
24
|
-
var __privateGet = (obj, member, getter) => {
|
|
25
|
-
__accessCheck(obj, member, "read from private field");
|
|
26
|
-
return getter ? getter.call(obj) : member.get(obj);
|
|
27
|
-
};
|
|
28
|
-
var __privateAdd = (obj, member, value) => {
|
|
29
|
-
if (member.has(obj))
|
|
30
|
-
throw TypeError("Cannot add the same private member more than once");
|
|
31
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
32
|
-
};
|
|
33
|
-
var __privateSet = (obj, member, value, setter) => {
|
|
34
|
-
__accessCheck(obj, member, "write to private field");
|
|
35
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
36
|
-
return value;
|
|
37
|
-
};
|
|
38
|
-
var __privateMethod = (obj, member, method) => {
|
|
39
|
-
__accessCheck(obj, member, "access private method");
|
|
40
|
-
return method;
|
|
41
|
-
};
|
|
1
|
+
'use strict';
|
|
42
2
|
|
|
43
|
-
|
|
44
|
-
var
|
|
45
|
-
__export(src_exports, {
|
|
46
|
-
API_VERSIONS: () => API_VERSIONS,
|
|
47
|
-
ApiEventLogSchema: () => ApiEventLogSchema,
|
|
48
|
-
AutoYieldConfigSchema: () => AutoYieldConfigSchema,
|
|
49
|
-
CachedTaskSchema: () => CachedTaskSchema,
|
|
50
|
-
CancelRunsForEventSchema: () => CancelRunsForEventSchema,
|
|
51
|
-
CommonMissingConnectionNotificationPayloadSchema: () => CommonMissingConnectionNotificationPayloadSchema,
|
|
52
|
-
CommonMissingConnectionNotificationResolvedPayloadSchema: () => CommonMissingConnectionNotificationResolvedPayloadSchema,
|
|
53
|
-
CompleteTaskBodyInputSchema: () => CompleteTaskBodyInputSchema,
|
|
54
|
-
ConnectionAuthSchema: () => ConnectionAuthSchema,
|
|
55
|
-
CreateExternalConnectionBodySchema: () => CreateExternalConnectionBodySchema,
|
|
56
|
-
CreateRunResponseBodySchema: () => CreateRunResponseBodySchema,
|
|
57
|
-
CronMetadataSchema: () => CronMetadataSchema,
|
|
58
|
-
CronOptionsSchema: () => CronOptionsSchema,
|
|
59
|
-
DeliverEventResponseSchema: () => DeliverEventResponseSchema,
|
|
60
|
-
DeserializedJsonSchema: () => DeserializedJsonSchema,
|
|
61
|
-
DisplayPropertiesSchema: () => DisplayPropertiesSchema,
|
|
62
|
-
DisplayPropertySchema: () => DisplayPropertySchema,
|
|
63
|
-
DynamicTriggerEndpointMetadataSchema: () => DynamicTriggerEndpointMetadataSchema,
|
|
64
|
-
DynamicTriggerMetadataSchema: () => DynamicTriggerMetadataSchema,
|
|
65
|
-
EndpointHeadersSchema: () => EndpointHeadersSchema,
|
|
66
|
-
EndpointIndexErrorSchema: () => EndpointIndexErrorSchema,
|
|
67
|
-
ErrorWithStackSchema: () => ErrorWithStackSchema,
|
|
68
|
-
EventExampleSchema: () => EventExampleSchema,
|
|
69
|
-
EventFilterSchema: () => EventFilterSchema,
|
|
70
|
-
EventRuleSchema: () => EventRuleSchema,
|
|
71
|
-
EventSpecificationSchema: () => EventSpecificationSchema,
|
|
72
|
-
FailTaskBodyInputSchema: () => FailTaskBodyInputSchema,
|
|
73
|
-
FetchOperationSchema: () => FetchOperationSchema,
|
|
74
|
-
FetchRequestInitSchema: () => FetchRequestInitSchema,
|
|
75
|
-
FetchRetryBackoffStrategySchema: () => FetchRetryBackoffStrategySchema,
|
|
76
|
-
FetchRetryHeadersStrategySchema: () => FetchRetryHeadersStrategySchema,
|
|
77
|
-
FetchRetryOptionsSchema: () => FetchRetryOptionsSchema,
|
|
78
|
-
FetchRetryStrategySchema: () => FetchRetryStrategySchema,
|
|
79
|
-
GetEndpointIndexResponseSchema: () => GetEndpointIndexResponseSchema,
|
|
80
|
-
GetEventSchema: () => GetEventSchema,
|
|
81
|
-
GetRunSchema: () => GetRunSchema,
|
|
82
|
-
GetRunStatusesSchema: () => GetRunStatusesSchema,
|
|
83
|
-
GetRunsSchema: () => GetRunsSchema,
|
|
84
|
-
HandleTriggerSourceSchema: () => HandleTriggerSourceSchema,
|
|
85
|
-
HttpSourceRequestHeadersSchema: () => HttpSourceRequestHeadersSchema,
|
|
86
|
-
HttpSourceRequestSchema: () => HttpSourceRequestSchema,
|
|
87
|
-
HttpSourceResponseSchema: () => HttpSourceResponseSchema,
|
|
88
|
-
IndexEndpointResponseSchema: () => IndexEndpointResponseSchema,
|
|
89
|
-
InitializeCronScheduleBodySchema: () => InitializeCronScheduleBodySchema,
|
|
90
|
-
InitializeTriggerBodySchema: () => InitializeTriggerBodySchema,
|
|
91
|
-
IntegrationConfigSchema: () => IntegrationConfigSchema,
|
|
92
|
-
IntegrationMetadataSchema: () => IntegrationMetadataSchema,
|
|
93
|
-
IntervalMetadataSchema: () => IntervalMetadataSchema,
|
|
94
|
-
IntervalOptionsSchema: () => IntervalOptionsSchema,
|
|
95
|
-
JobMetadataSchema: () => JobMetadataSchema,
|
|
96
|
-
JobRunStatusRecordSchema: () => JobRunStatusRecordSchema,
|
|
97
|
-
LogMessageSchema: () => LogMessageSchema,
|
|
98
|
-
Logger: () => Logger,
|
|
99
|
-
MISSING_CONNECTION_NOTIFICATION: () => MISSING_CONNECTION_NOTIFICATION,
|
|
100
|
-
MISSING_CONNECTION_RESOLVED_NOTIFICATION: () => MISSING_CONNECTION_RESOLVED_NOTIFICATION,
|
|
101
|
-
MissingConnectionNotificationPayloadSchema: () => MissingConnectionNotificationPayloadSchema,
|
|
102
|
-
MissingConnectionResolvedNotificationPayloadSchema: () => MissingConnectionResolvedNotificationPayloadSchema,
|
|
103
|
-
MissingDeveloperConnectionNotificationPayloadSchema: () => MissingDeveloperConnectionNotificationPayloadSchema,
|
|
104
|
-
MissingDeveloperConnectionResolvedNotificationPayloadSchema: () => MissingDeveloperConnectionResolvedNotificationPayloadSchema,
|
|
105
|
-
MissingExternalConnectionNotificationPayloadSchema: () => MissingExternalConnectionNotificationPayloadSchema,
|
|
106
|
-
MissingExternalConnectionResolvedNotificationPayloadSchema: () => MissingExternalConnectionResolvedNotificationPayloadSchema,
|
|
107
|
-
NormalizedRequestSchema: () => NormalizedRequestSchema,
|
|
108
|
-
NormalizedResponseSchema: () => NormalizedResponseSchema,
|
|
109
|
-
PLATFORM_FEATURES: () => PLATFORM_FEATURES,
|
|
110
|
-
PongErrorResponseSchema: () => PongErrorResponseSchema,
|
|
111
|
-
PongResponseSchema: () => PongResponseSchema,
|
|
112
|
-
PongSuccessResponseSchema: () => PongSuccessResponseSchema,
|
|
113
|
-
PreprocessRunBodySchema: () => PreprocessRunBodySchema,
|
|
114
|
-
PreprocessRunResponseSchema: () => PreprocessRunResponseSchema,
|
|
115
|
-
QueueOptionsSchema: () => QueueOptionsSchema,
|
|
116
|
-
REGISTER_SOURCE_EVENT_V1: () => REGISTER_SOURCE_EVENT_V1,
|
|
117
|
-
REGISTER_SOURCE_EVENT_V2: () => REGISTER_SOURCE_EVENT_V2,
|
|
118
|
-
RawEventSchema: () => RawEventSchema,
|
|
119
|
-
RedactSchema: () => RedactSchema,
|
|
120
|
-
RedactStringSchema: () => RedactStringSchema,
|
|
121
|
-
RegisterDynamicSchedulePayloadSchema: () => RegisterDynamicSchedulePayloadSchema,
|
|
122
|
-
RegisterHTTPTriggerSourceBodySchema: () => RegisterHTTPTriggerSourceBodySchema,
|
|
123
|
-
RegisterIntervalScheduleBodySchema: () => RegisterIntervalScheduleBodySchema,
|
|
124
|
-
RegisterSMTPTriggerSourceBodySchema: () => RegisterSMTPTriggerSourceBodySchema,
|
|
125
|
-
RegisterSQSTriggerSourceBodySchema: () => RegisterSQSTriggerSourceBodySchema,
|
|
126
|
-
RegisterScheduleBodySchema: () => RegisterScheduleBodySchema,
|
|
127
|
-
RegisterScheduleResponseBodySchema: () => RegisterScheduleResponseBodySchema,
|
|
128
|
-
RegisterSourceChannelBodySchema: () => RegisterSourceChannelBodySchema,
|
|
129
|
-
RegisterSourceEventSchemaV1: () => RegisterSourceEventSchemaV1,
|
|
130
|
-
RegisterSourceEventSchemaV2: () => RegisterSourceEventSchemaV2,
|
|
131
|
-
RegisterTriggerBodySchemaV1: () => RegisterTriggerBodySchemaV1,
|
|
132
|
-
RegisterTriggerBodySchemaV2: () => RegisterTriggerBodySchemaV2,
|
|
133
|
-
RegisterTriggerSourceSchema: () => RegisterTriggerSourceSchema,
|
|
134
|
-
RetryOptionsSchema: () => RetryOptionsSchema,
|
|
135
|
-
RunJobAutoYieldExecutionErrorSchema: () => RunJobAutoYieldExecutionErrorSchema,
|
|
136
|
-
RunJobAutoYieldWithCompletedTaskExecutionErrorSchema: () => RunJobAutoYieldWithCompletedTaskExecutionErrorSchema,
|
|
137
|
-
RunJobBodySchema: () => RunJobBodySchema,
|
|
138
|
-
RunJobCanceledWithTaskSchema: () => RunJobCanceledWithTaskSchema,
|
|
139
|
-
RunJobErrorSchema: () => RunJobErrorSchema,
|
|
140
|
-
RunJobInvalidPayloadErrorSchema: () => RunJobInvalidPayloadErrorSchema,
|
|
141
|
-
RunJobResponseSchema: () => RunJobResponseSchema,
|
|
142
|
-
RunJobResumeWithTaskSchema: () => RunJobResumeWithTaskSchema,
|
|
143
|
-
RunJobRetryWithTaskSchema: () => RunJobRetryWithTaskSchema,
|
|
144
|
-
RunJobSuccessSchema: () => RunJobSuccessSchema,
|
|
145
|
-
RunJobUnresolvedAuthErrorSchema: () => RunJobUnresolvedAuthErrorSchema,
|
|
146
|
-
RunJobYieldExecutionErrorSchema: () => RunJobYieldExecutionErrorSchema,
|
|
147
|
-
RunSourceContextSchema: () => RunSourceContextSchema,
|
|
148
|
-
RunStatusSchema: () => RunStatusSchema,
|
|
149
|
-
RunTaskBodyInputSchema: () => RunTaskBodyInputSchema,
|
|
150
|
-
RunTaskBodyOutputSchema: () => RunTaskBodyOutputSchema,
|
|
151
|
-
RunTaskOptionsSchema: () => RunTaskOptionsSchema,
|
|
152
|
-
RunTaskResponseWithCachedTasksBodySchema: () => RunTaskResponseWithCachedTasksBodySchema,
|
|
153
|
-
RunTaskSchema: () => RunTaskSchema,
|
|
154
|
-
RuntimeEnvironmentTypeSchema: () => RuntimeEnvironmentTypeSchema,
|
|
155
|
-
SCHEDULED_EVENT: () => SCHEDULED_EVENT,
|
|
156
|
-
ScheduleMetadataSchema: () => ScheduleMetadataSchema,
|
|
157
|
-
ScheduledPayloadSchema: () => ScheduledPayloadSchema,
|
|
158
|
-
ScheduledTriggerMetadataSchema: () => ScheduledTriggerMetadataSchema,
|
|
159
|
-
SchemaErrorSchema: () => SchemaErrorSchema,
|
|
160
|
-
SendEventBodySchema: () => SendEventBodySchema,
|
|
161
|
-
SendEventOptionsSchema: () => SendEventOptionsSchema,
|
|
162
|
-
SerializableJsonSchema: () => SerializableJsonSchema,
|
|
163
|
-
ServerTaskSchema: () => ServerTaskSchema,
|
|
164
|
-
SourceMetadataV2Schema: () => SourceMetadataV2Schema,
|
|
165
|
-
StaticTriggerMetadataSchema: () => StaticTriggerMetadataSchema,
|
|
166
|
-
StatusHistorySchema: () => StatusHistorySchema,
|
|
167
|
-
StatusUpdateSchema: () => StatusUpdateSchema,
|
|
168
|
-
StatusUpdateStateSchema: () => StatusUpdateStateSchema,
|
|
169
|
-
StyleSchema: () => StyleSchema,
|
|
170
|
-
TaskSchema: () => TaskSchema,
|
|
171
|
-
TaskStatusSchema: () => TaskStatusSchema,
|
|
172
|
-
TriggerMetadataSchema: () => TriggerMetadataSchema,
|
|
173
|
-
TriggerSourceSchema: () => TriggerSourceSchema,
|
|
174
|
-
UpdateTriggerSourceBodyV1Schema: () => UpdateTriggerSourceBodyV1Schema,
|
|
175
|
-
UpdateTriggerSourceBodyV2Schema: () => UpdateTriggerSourceBodyV2Schema,
|
|
176
|
-
ValidateErrorResponseSchema: () => ValidateErrorResponseSchema,
|
|
177
|
-
ValidateResponseSchema: () => ValidateResponseSchema,
|
|
178
|
-
ValidateSuccessResponseSchema: () => ValidateSuccessResponseSchema,
|
|
179
|
-
addMissingVersionField: () => addMissingVersionField,
|
|
180
|
-
calculateRetryAt: () => calculateRetryAt,
|
|
181
|
-
currentDate: () => currentDate,
|
|
182
|
-
currentTimestampMilliseconds: () => currentTimestampMilliseconds,
|
|
183
|
-
currentTimestampSeconds: () => currentTimestampSeconds,
|
|
184
|
-
deepMergeFilters: () => deepMergeFilters,
|
|
185
|
-
eventFilterMatches: () => eventFilterMatches,
|
|
186
|
-
parseEndpointIndexStats: () => parseEndpointIndexStats,
|
|
187
|
-
replacements: () => replacements,
|
|
188
|
-
supportsFeature: () => supportsFeature,
|
|
189
|
-
urlWithSearchParams: () => urlWithSearchParams
|
|
190
|
-
});
|
|
191
|
-
module.exports = __toCommonJS(src_exports);
|
|
192
|
-
|
|
193
|
-
// src/logger.ts
|
|
194
|
-
var logLevels = [
|
|
195
|
-
"log",
|
|
196
|
-
"error",
|
|
197
|
-
"warn",
|
|
198
|
-
"info",
|
|
199
|
-
"debug"
|
|
200
|
-
];
|
|
201
|
-
var _name, _level, _filteredKeys, _jsonReplacer, _structuredLog, structuredLog_fn;
|
|
202
|
-
var _Logger = class _Logger {
|
|
203
|
-
constructor(name, level = "info", filteredKeys = [], jsonReplacer) {
|
|
204
|
-
__privateAdd(this, _structuredLog);
|
|
205
|
-
__privateAdd(this, _name, void 0);
|
|
206
|
-
__privateAdd(this, _level, void 0);
|
|
207
|
-
__privateAdd(this, _filteredKeys, []);
|
|
208
|
-
__privateAdd(this, _jsonReplacer, void 0);
|
|
209
|
-
__privateSet(this, _name, name);
|
|
210
|
-
__privateSet(this, _level, logLevels.indexOf(process.env.TRIGGER_LOG_LEVEL ?? level));
|
|
211
|
-
__privateSet(this, _filteredKeys, filteredKeys);
|
|
212
|
-
__privateSet(this, _jsonReplacer, jsonReplacer);
|
|
213
|
-
}
|
|
214
|
-
// Return a new Logger instance with the same name and a new log level
|
|
215
|
-
// but filter out the keys from the log messages (at any level)
|
|
216
|
-
filter(...keys) {
|
|
217
|
-
return new _Logger(__privateGet(this, _name), logLevels[__privateGet(this, _level)], keys, __privateGet(this, _jsonReplacer));
|
|
218
|
-
}
|
|
219
|
-
static satisfiesLogLevel(logLevel, setLevel) {
|
|
220
|
-
return logLevels.indexOf(logLevel) <= logLevels.indexOf(setLevel);
|
|
221
|
-
}
|
|
222
|
-
log(message, ...args) {
|
|
223
|
-
if (__privateGet(this, _level) < 0)
|
|
224
|
-
return;
|
|
225
|
-
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.log, message, ...args);
|
|
226
|
-
}
|
|
227
|
-
error(message, ...args) {
|
|
228
|
-
if (__privateGet(this, _level) < 1)
|
|
229
|
-
return;
|
|
230
|
-
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.error, message, ...args);
|
|
231
|
-
}
|
|
232
|
-
warn(message, ...args) {
|
|
233
|
-
if (__privateGet(this, _level) < 2)
|
|
234
|
-
return;
|
|
235
|
-
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.warn, message, ...args);
|
|
236
|
-
}
|
|
237
|
-
info(message, ...args) {
|
|
238
|
-
if (__privateGet(this, _level) < 3)
|
|
239
|
-
return;
|
|
240
|
-
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.info, message, ...args);
|
|
241
|
-
}
|
|
242
|
-
debug(message, ...args) {
|
|
243
|
-
if (__privateGet(this, _level) < 4)
|
|
244
|
-
return;
|
|
245
|
-
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.debug, message, ...args);
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
_name = new WeakMap();
|
|
249
|
-
_level = new WeakMap();
|
|
250
|
-
_filteredKeys = new WeakMap();
|
|
251
|
-
_jsonReplacer = new WeakMap();
|
|
252
|
-
_structuredLog = new WeakSet();
|
|
253
|
-
structuredLog_fn = /* @__PURE__ */ __name(function(loggerFunction, message, ...args) {
|
|
254
|
-
const structuredLog = {
|
|
255
|
-
...structureArgs(safeJsonClone(args), __privateGet(this, _filteredKeys)),
|
|
256
|
-
timestamp: /* @__PURE__ */ new Date(),
|
|
257
|
-
name: __privateGet(this, _name),
|
|
258
|
-
message
|
|
259
|
-
};
|
|
260
|
-
loggerFunction(JSON.stringify(structuredLog, createReplacer(__privateGet(this, _jsonReplacer))));
|
|
261
|
-
}, "#structuredLog");
|
|
262
|
-
__name(_Logger, "Logger");
|
|
263
|
-
var Logger = _Logger;
|
|
264
|
-
function createReplacer(replacer) {
|
|
265
|
-
return (key, value) => {
|
|
266
|
-
if (typeof value === "bigint") {
|
|
267
|
-
return value.toString();
|
|
268
|
-
}
|
|
269
|
-
if (replacer) {
|
|
270
|
-
return replacer(key, value);
|
|
271
|
-
}
|
|
272
|
-
return value;
|
|
273
|
-
};
|
|
274
|
-
}
|
|
275
|
-
__name(createReplacer, "createReplacer");
|
|
276
|
-
function bigIntReplacer(_key, value) {
|
|
277
|
-
if (typeof value === "bigint") {
|
|
278
|
-
return value.toString();
|
|
279
|
-
}
|
|
280
|
-
return value;
|
|
281
|
-
}
|
|
282
|
-
__name(bigIntReplacer, "bigIntReplacer");
|
|
283
|
-
function safeJsonClone(obj) {
|
|
284
|
-
try {
|
|
285
|
-
return JSON.parse(JSON.stringify(obj, bigIntReplacer));
|
|
286
|
-
} catch (e) {
|
|
287
|
-
return obj;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
__name(safeJsonClone, "safeJsonClone");
|
|
291
|
-
function structureArgs(args, filteredKeys = []) {
|
|
292
|
-
if (args.length === 0) {
|
|
293
|
-
return;
|
|
294
|
-
}
|
|
295
|
-
if (args.length === 1 && typeof args[0] === "object") {
|
|
296
|
-
return filterKeys(JSON.parse(JSON.stringify(args[0], bigIntReplacer)), filteredKeys);
|
|
297
|
-
}
|
|
298
|
-
return args;
|
|
299
|
-
}
|
|
300
|
-
__name(structureArgs, "structureArgs");
|
|
301
|
-
function filterKeys(obj, keys) {
|
|
302
|
-
if (typeof obj !== "object" || obj === null) {
|
|
303
|
-
return obj;
|
|
304
|
-
}
|
|
305
|
-
if (Array.isArray(obj)) {
|
|
306
|
-
return obj.map((item) => filterKeys(item, keys));
|
|
307
|
-
}
|
|
308
|
-
const filteredObj = {};
|
|
309
|
-
for (const [key, value] of Object.entries(obj)) {
|
|
310
|
-
if (keys.includes(key)) {
|
|
311
|
-
if (value) {
|
|
312
|
-
filteredObj[key] = `[filtered ${prettyPrintBytes(value)}]`;
|
|
313
|
-
} else {
|
|
314
|
-
filteredObj[key] = value;
|
|
315
|
-
}
|
|
316
|
-
continue;
|
|
317
|
-
}
|
|
318
|
-
filteredObj[key] = filterKeys(value, keys);
|
|
319
|
-
}
|
|
320
|
-
return filteredObj;
|
|
321
|
-
}
|
|
322
|
-
__name(filterKeys, "filterKeys");
|
|
323
|
-
function prettyPrintBytes(value) {
|
|
324
|
-
if (process.env.NODE_ENV === "production") {
|
|
325
|
-
return "skipped size";
|
|
326
|
-
}
|
|
327
|
-
const sizeInBytes = Buffer.byteLength(JSON.stringify(value), "utf8");
|
|
328
|
-
if (sizeInBytes < 1024) {
|
|
329
|
-
return `${sizeInBytes} bytes`;
|
|
330
|
-
}
|
|
331
|
-
if (sizeInBytes < 1024 * 1024) {
|
|
332
|
-
return `${(sizeInBytes / 1024).toFixed(2)} KB`;
|
|
333
|
-
}
|
|
334
|
-
if (sizeInBytes < 1024 * 1024 * 1024) {
|
|
335
|
-
return `${(sizeInBytes / (1024 * 1024)).toFixed(2)} MB`;
|
|
336
|
-
}
|
|
337
|
-
return `${(sizeInBytes / (1024 * 1024 * 1024)).toFixed(2)} GB`;
|
|
338
|
-
}
|
|
339
|
-
__name(prettyPrintBytes, "prettyPrintBytes");
|
|
3
|
+
var ulidx = require('ulidx');
|
|
4
|
+
var zod = require('zod');
|
|
340
5
|
|
|
341
|
-
|
|
342
|
-
var
|
|
343
|
-
var import_zod11 = require("zod");
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
344
8
|
|
|
345
9
|
// src/schemas/addMissingVersionField.ts
|
|
346
10
|
function addMissingVersionField(val) {
|
|
@@ -353,220 +17,204 @@ function addMissingVersionField(val) {
|
|
|
353
17
|
return val;
|
|
354
18
|
}
|
|
355
19
|
__name(addMissingVersionField, "addMissingVersionField");
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
20
|
+
var ErrorWithStackSchema = zod.z.object({
|
|
21
|
+
message: zod.z.string(),
|
|
22
|
+
name: zod.z.string().optional(),
|
|
23
|
+
stack: zod.z.string().optional()
|
|
24
|
+
});
|
|
25
|
+
var SchemaErrorSchema = zod.z.object({
|
|
26
|
+
path: zod.z.array(zod.z.string()),
|
|
27
|
+
message: zod.z.string()
|
|
28
|
+
});
|
|
29
|
+
var stringPatternMatchers = [
|
|
30
|
+
zod.z.object({
|
|
31
|
+
$endsWith: zod.z.string()
|
|
32
|
+
}),
|
|
33
|
+
zod.z.object({
|
|
34
|
+
$startsWith: zod.z.string()
|
|
35
|
+
}),
|
|
36
|
+
zod.z.object({
|
|
37
|
+
$ignoreCaseEquals: zod.z.string()
|
|
38
|
+
})
|
|
39
|
+
];
|
|
40
|
+
var EventMatcherSchema = zod.z.union([
|
|
372
41
|
/** Match against a string */
|
|
373
|
-
|
|
42
|
+
zod.z.array(zod.z.string()),
|
|
374
43
|
/** Match against a number */
|
|
375
|
-
|
|
44
|
+
zod.z.array(zod.z.number()),
|
|
376
45
|
/** Match against a boolean */
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
import_zod2.z.object({
|
|
383
|
-
$startsWith: import_zod2.z.string()
|
|
384
|
-
}),
|
|
385
|
-
import_zod2.z.object({
|
|
386
|
-
$exists: import_zod2.z.boolean()
|
|
46
|
+
zod.z.array(zod.z.boolean()),
|
|
47
|
+
zod.z.array(zod.z.union([
|
|
48
|
+
...stringPatternMatchers,
|
|
49
|
+
zod.z.object({
|
|
50
|
+
$exists: zod.z.boolean()
|
|
387
51
|
}),
|
|
388
|
-
|
|
389
|
-
$isNull:
|
|
52
|
+
zod.z.object({
|
|
53
|
+
$isNull: zod.z.boolean()
|
|
390
54
|
}),
|
|
391
|
-
|
|
392
|
-
$anythingBut:
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
55
|
+
zod.z.object({
|
|
56
|
+
$anythingBut: zod.z.union([
|
|
57
|
+
zod.z.string(),
|
|
58
|
+
zod.z.number(),
|
|
59
|
+
zod.z.boolean()
|
|
396
60
|
])
|
|
397
61
|
}),
|
|
398
|
-
|
|
399
|
-
$anythingBut:
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
62
|
+
zod.z.object({
|
|
63
|
+
$anythingBut: zod.z.union([
|
|
64
|
+
zod.z.array(zod.z.string()),
|
|
65
|
+
zod.z.array(zod.z.number()),
|
|
66
|
+
zod.z.array(zod.z.boolean())
|
|
403
67
|
])
|
|
404
68
|
}),
|
|
405
|
-
|
|
406
|
-
$gt:
|
|
69
|
+
zod.z.object({
|
|
70
|
+
$gt: zod.z.number()
|
|
407
71
|
}),
|
|
408
|
-
|
|
409
|
-
$lt:
|
|
72
|
+
zod.z.object({
|
|
73
|
+
$lt: zod.z.number()
|
|
410
74
|
}),
|
|
411
|
-
|
|
412
|
-
$gte:
|
|
75
|
+
zod.z.object({
|
|
76
|
+
$gte: zod.z.number()
|
|
413
77
|
}),
|
|
414
|
-
|
|
415
|
-
$lte:
|
|
78
|
+
zod.z.object({
|
|
79
|
+
$lte: zod.z.number()
|
|
416
80
|
}),
|
|
417
|
-
|
|
418
|
-
$between:
|
|
419
|
-
|
|
420
|
-
|
|
81
|
+
zod.z.object({
|
|
82
|
+
$between: zod.z.tuple([
|
|
83
|
+
zod.z.number(),
|
|
84
|
+
zod.z.number()
|
|
421
85
|
])
|
|
422
86
|
}),
|
|
423
|
-
|
|
424
|
-
$includes:
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
87
|
+
zod.z.object({
|
|
88
|
+
$includes: zod.z.union([
|
|
89
|
+
zod.z.string(),
|
|
90
|
+
zod.z.number(),
|
|
91
|
+
zod.z.boolean()
|
|
428
92
|
])
|
|
429
|
-
}),
|
|
430
|
-
import_zod2.z.object({
|
|
431
|
-
$ignoreCaseEquals: import_zod2.z.string()
|
|
432
93
|
})
|
|
433
94
|
]))
|
|
434
95
|
]);
|
|
435
|
-
var EventFilterSchema =
|
|
96
|
+
var EventFilterSchema = zod.z.lazy(() => zod.z.record(zod.z.union([
|
|
436
97
|
EventMatcherSchema,
|
|
437
98
|
EventFilterSchema
|
|
438
99
|
])));
|
|
439
|
-
var EventRuleSchema =
|
|
440
|
-
event:
|
|
441
|
-
source:
|
|
100
|
+
var EventRuleSchema = zod.z.object({
|
|
101
|
+
event: zod.z.string().or(zod.z.array(zod.z.string())),
|
|
102
|
+
source: zod.z.string(),
|
|
442
103
|
payload: EventFilterSchema.optional(),
|
|
443
104
|
context: EventFilterSchema.optional()
|
|
444
105
|
});
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
var import_zod3 = require("zod");
|
|
448
|
-
var ConnectionAuthSchema = import_zod3.z.object({
|
|
449
|
-
type: import_zod3.z.enum([
|
|
106
|
+
var ConnectionAuthSchema = zod.z.object({
|
|
107
|
+
type: zod.z.enum([
|
|
450
108
|
"oauth2",
|
|
451
109
|
"apiKey"
|
|
452
110
|
]),
|
|
453
|
-
accessToken:
|
|
454
|
-
scopes:
|
|
455
|
-
additionalFields:
|
|
111
|
+
accessToken: zod.z.string(),
|
|
112
|
+
scopes: zod.z.array(zod.z.string()).optional(),
|
|
113
|
+
additionalFields: zod.z.record(zod.z.string()).optional()
|
|
456
114
|
});
|
|
457
|
-
var IntegrationMetadataSchema =
|
|
458
|
-
id:
|
|
459
|
-
name:
|
|
460
|
-
instructions:
|
|
115
|
+
var IntegrationMetadataSchema = zod.z.object({
|
|
116
|
+
id: zod.z.string(),
|
|
117
|
+
name: zod.z.string(),
|
|
118
|
+
instructions: zod.z.string().optional()
|
|
461
119
|
});
|
|
462
|
-
var IntegrationConfigSchema =
|
|
463
|
-
id:
|
|
120
|
+
var IntegrationConfigSchema = zod.z.object({
|
|
121
|
+
id: zod.z.string(),
|
|
464
122
|
metadata: IntegrationMetadataSchema,
|
|
465
|
-
authSource:
|
|
123
|
+
authSource: zod.z.enum([
|
|
466
124
|
"HOSTED",
|
|
467
125
|
"LOCAL",
|
|
468
126
|
"RESOLVER"
|
|
469
127
|
])
|
|
470
128
|
});
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
import_zod4.z.number(),
|
|
477
|
-
import_zod4.z.boolean(),
|
|
478
|
-
import_zod4.z.null()
|
|
129
|
+
var LiteralSchema = zod.z.union([
|
|
130
|
+
zod.z.string(),
|
|
131
|
+
zod.z.number(),
|
|
132
|
+
zod.z.boolean(),
|
|
133
|
+
zod.z.null()
|
|
479
134
|
]);
|
|
480
|
-
var DeserializedJsonSchema =
|
|
135
|
+
var DeserializedJsonSchema = zod.z.lazy(() => zod.z.union([
|
|
481
136
|
LiteralSchema,
|
|
482
|
-
|
|
483
|
-
|
|
137
|
+
zod.z.array(DeserializedJsonSchema),
|
|
138
|
+
zod.z.record(DeserializedJsonSchema)
|
|
484
139
|
]));
|
|
485
|
-
var SerializableSchema =
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
140
|
+
var SerializableSchema = zod.z.union([
|
|
141
|
+
zod.z.string(),
|
|
142
|
+
zod.z.number(),
|
|
143
|
+
zod.z.boolean(),
|
|
144
|
+
zod.z.null(),
|
|
145
|
+
zod.z.date(),
|
|
146
|
+
zod.z.undefined(),
|
|
147
|
+
zod.z.symbol()
|
|
493
148
|
]);
|
|
494
|
-
var SerializableJsonSchema =
|
|
149
|
+
var SerializableJsonSchema = zod.z.lazy(() => zod.z.union([
|
|
495
150
|
SerializableSchema,
|
|
496
|
-
|
|
497
|
-
|
|
151
|
+
zod.z.array(SerializableJsonSchema),
|
|
152
|
+
zod.z.record(SerializableJsonSchema)
|
|
498
153
|
]));
|
|
499
|
-
|
|
500
|
-
// src/schemas/properties.ts
|
|
501
|
-
var import_zod5 = require("zod");
|
|
502
|
-
var DisplayPropertySchema = import_zod5.z.object({
|
|
154
|
+
var DisplayPropertySchema = zod.z.object({
|
|
503
155
|
/** The label for the property */
|
|
504
|
-
label:
|
|
156
|
+
label: zod.z.string(),
|
|
505
157
|
/** The value of the property */
|
|
506
|
-
text:
|
|
158
|
+
text: zod.z.string(),
|
|
507
159
|
/** The URL to link to when the property is clicked */
|
|
508
|
-
url:
|
|
160
|
+
url: zod.z.string().optional(),
|
|
161
|
+
/** The URL to a list of images to display next to the property */
|
|
162
|
+
imageUrl: zod.z.array(zod.z.string()).optional()
|
|
509
163
|
});
|
|
510
|
-
var DisplayPropertiesSchema =
|
|
511
|
-
var StyleSchema =
|
|
164
|
+
var DisplayPropertiesSchema = zod.z.array(DisplayPropertySchema);
|
|
165
|
+
var StyleSchema = zod.z.object({
|
|
512
166
|
/** The style, `normal` or `minimal` */
|
|
513
|
-
style:
|
|
167
|
+
style: zod.z.enum([
|
|
514
168
|
"normal",
|
|
515
169
|
"minimal"
|
|
516
170
|
]),
|
|
517
171
|
/** A variant of the style. */
|
|
518
|
-
variant:
|
|
172
|
+
variant: zod.z.string().optional()
|
|
519
173
|
});
|
|
520
|
-
|
|
521
|
-
// src/schemas/schedules.ts
|
|
522
|
-
var import_zod6 = require("zod");
|
|
523
174
|
var SCHEDULED_EVENT = "dev.trigger.scheduled";
|
|
524
|
-
var ScheduledPayloadSchema =
|
|
525
|
-
ts:
|
|
526
|
-
lastTimestamp:
|
|
175
|
+
var ScheduledPayloadSchema = zod.z.object({
|
|
176
|
+
ts: zod.z.coerce.date(),
|
|
177
|
+
lastTimestamp: zod.z.coerce.date().optional()
|
|
527
178
|
});
|
|
528
|
-
var IntervalOptionsSchema =
|
|
179
|
+
var IntervalOptionsSchema = zod.z.object({
|
|
529
180
|
/** The number of seconds for the interval. Min = 60, Max = 2_592_000 (30 days) */
|
|
530
|
-
seconds:
|
|
181
|
+
seconds: zod.z.number().int().positive().min(60).max(2592e3)
|
|
531
182
|
});
|
|
532
|
-
var CronOptionsSchema =
|
|
183
|
+
var CronOptionsSchema = zod.z.object({
|
|
533
184
|
/** A CRON expression that defines the schedule. A useful tool when writing CRON
|
|
534
185
|
expressions is [crontab guru](https://crontab.guru). Note that the timezone
|
|
535
186
|
used is UTC. */
|
|
536
|
-
cron:
|
|
187
|
+
cron: zod.z.string()
|
|
537
188
|
});
|
|
538
|
-
var CronMetadataSchema =
|
|
539
|
-
type:
|
|
189
|
+
var CronMetadataSchema = zod.z.object({
|
|
190
|
+
type: zod.z.literal("cron"),
|
|
540
191
|
options: CronOptionsSchema,
|
|
541
192
|
/** An optional Account ID to associate with runs triggered by this interval */
|
|
542
|
-
accountId:
|
|
543
|
-
metadata:
|
|
193
|
+
accountId: zod.z.string().optional(),
|
|
194
|
+
metadata: zod.z.any()
|
|
544
195
|
});
|
|
545
|
-
var IntervalMetadataSchema =
|
|
196
|
+
var IntervalMetadataSchema = zod.z.object({
|
|
546
197
|
/** An interval reoccurs at the specified number of seconds */
|
|
547
|
-
type:
|
|
198
|
+
type: zod.z.literal("interval"),
|
|
548
199
|
/** An object containing options about the interval. */
|
|
549
200
|
options: IntervalOptionsSchema,
|
|
550
201
|
/** An optional Account ID to associate with runs triggered by this interval */
|
|
551
|
-
accountId:
|
|
202
|
+
accountId: zod.z.string().optional(),
|
|
552
203
|
/** Any additional metadata about the schedule. */
|
|
553
|
-
metadata:
|
|
204
|
+
metadata: zod.z.any()
|
|
554
205
|
});
|
|
555
|
-
var ScheduleMetadataSchema =
|
|
206
|
+
var ScheduleMetadataSchema = zod.z.discriminatedUnion("type", [
|
|
556
207
|
IntervalMetadataSchema,
|
|
557
208
|
CronMetadataSchema
|
|
558
209
|
]);
|
|
559
|
-
var RegisterDynamicSchedulePayloadSchema =
|
|
560
|
-
id:
|
|
561
|
-
jobs:
|
|
562
|
-
id:
|
|
563
|
-
version:
|
|
210
|
+
var RegisterDynamicSchedulePayloadSchema = zod.z.object({
|
|
211
|
+
id: zod.z.string(),
|
|
212
|
+
jobs: zod.z.array(zod.z.object({
|
|
213
|
+
id: zod.z.string(),
|
|
214
|
+
version: zod.z.string()
|
|
564
215
|
}))
|
|
565
216
|
});
|
|
566
|
-
|
|
567
|
-
// src/schemas/tasks.ts
|
|
568
|
-
var import_zod7 = require("zod");
|
|
569
|
-
var TaskStatusSchema = import_zod7.z.enum([
|
|
217
|
+
var TaskStatusSchema = zod.z.enum([
|
|
570
218
|
"PENDING",
|
|
571
219
|
"WAITING",
|
|
572
220
|
"RUNNING",
|
|
@@ -574,408 +222,548 @@ var TaskStatusSchema = import_zod7.z.enum([
|
|
|
574
222
|
"ERRORED",
|
|
575
223
|
"CANCELED"
|
|
576
224
|
]);
|
|
577
|
-
var TaskSchema =
|
|
578
|
-
id:
|
|
579
|
-
name:
|
|
580
|
-
icon:
|
|
581
|
-
noop:
|
|
582
|
-
startedAt:
|
|
583
|
-
completedAt:
|
|
584
|
-
delayUntil:
|
|
225
|
+
var TaskSchema = zod.z.object({
|
|
226
|
+
id: zod.z.string(),
|
|
227
|
+
name: zod.z.string(),
|
|
228
|
+
icon: zod.z.string().optional().nullable(),
|
|
229
|
+
noop: zod.z.boolean(),
|
|
230
|
+
startedAt: zod.z.coerce.date().optional().nullable(),
|
|
231
|
+
completedAt: zod.z.coerce.date().optional().nullable(),
|
|
232
|
+
delayUntil: zod.z.coerce.date().optional().nullable(),
|
|
585
233
|
status: TaskStatusSchema,
|
|
586
|
-
description:
|
|
587
|
-
properties:
|
|
588
|
-
outputProperties:
|
|
234
|
+
description: zod.z.string().optional().nullable(),
|
|
235
|
+
properties: zod.z.array(DisplayPropertySchema).optional().nullable(),
|
|
236
|
+
outputProperties: zod.z.array(DisplayPropertySchema).optional().nullable(),
|
|
589
237
|
params: DeserializedJsonSchema.optional().nullable(),
|
|
590
238
|
output: DeserializedJsonSchema.optional().nullable(),
|
|
591
|
-
|
|
592
|
-
|
|
239
|
+
context: DeserializedJsonSchema.optional().nullable(),
|
|
240
|
+
error: zod.z.string().optional().nullable(),
|
|
241
|
+
parentId: zod.z.string().optional().nullable(),
|
|
593
242
|
style: StyleSchema.optional().nullable(),
|
|
594
|
-
operation:
|
|
595
|
-
callbackUrl:
|
|
243
|
+
operation: zod.z.string().optional().nullable(),
|
|
244
|
+
callbackUrl: zod.z.string().optional().nullable(),
|
|
245
|
+
childExecutionMode: zod.z.enum([
|
|
246
|
+
"SEQUENTIAL",
|
|
247
|
+
"PARALLEL"
|
|
248
|
+
]).optional().nullable()
|
|
596
249
|
});
|
|
597
250
|
var ServerTaskSchema = TaskSchema.extend({
|
|
598
|
-
idempotencyKey:
|
|
599
|
-
attempts:
|
|
600
|
-
forceYield:
|
|
251
|
+
idempotencyKey: zod.z.string(),
|
|
252
|
+
attempts: zod.z.number(),
|
|
253
|
+
forceYield: zod.z.boolean().optional().nullable()
|
|
601
254
|
});
|
|
602
|
-
var CachedTaskSchema =
|
|
603
|
-
id:
|
|
604
|
-
idempotencyKey:
|
|
255
|
+
var CachedTaskSchema = zod.z.object({
|
|
256
|
+
id: zod.z.string(),
|
|
257
|
+
idempotencyKey: zod.z.string(),
|
|
605
258
|
status: TaskStatusSchema,
|
|
606
|
-
noop:
|
|
259
|
+
noop: zod.z.boolean().default(false),
|
|
607
260
|
output: DeserializedJsonSchema.optional().nullable(),
|
|
608
|
-
parentId:
|
|
609
|
-
});
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
title: import_zod8.z.string(),
|
|
622
|
-
source: import_zod8.z.string(),
|
|
623
|
-
icon: import_zod8.z.string(),
|
|
261
|
+
parentId: zod.z.string().optional().nullable()
|
|
262
|
+
});
|
|
263
|
+
var EventExampleSchema = zod.z.object({
|
|
264
|
+
id: zod.z.string(),
|
|
265
|
+
icon: zod.z.string().optional(),
|
|
266
|
+
name: zod.z.string(),
|
|
267
|
+
payload: zod.z.any()
|
|
268
|
+
});
|
|
269
|
+
var EventSpecificationSchema = zod.z.object({
|
|
270
|
+
name: zod.z.string().or(zod.z.array(zod.z.string())),
|
|
271
|
+
title: zod.z.string(),
|
|
272
|
+
source: zod.z.string(),
|
|
273
|
+
icon: zod.z.string(),
|
|
624
274
|
filter: EventFilterSchema.optional(),
|
|
625
|
-
properties:
|
|
626
|
-
schema:
|
|
627
|
-
examples:
|
|
628
|
-
});
|
|
629
|
-
var DynamicTriggerMetadataSchema =
|
|
630
|
-
type:
|
|
631
|
-
id:
|
|
632
|
-
});
|
|
633
|
-
var
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
275
|
+
properties: zod.z.array(DisplayPropertySchema).optional(),
|
|
276
|
+
schema: zod.z.any().optional(),
|
|
277
|
+
examples: zod.z.array(EventExampleSchema).optional()
|
|
278
|
+
});
|
|
279
|
+
var DynamicTriggerMetadataSchema = zod.z.object({
|
|
280
|
+
type: zod.z.literal("dynamic"),
|
|
281
|
+
id: zod.z.string()
|
|
282
|
+
});
|
|
283
|
+
var TriggerHelpSchema = zod.z.object({
|
|
284
|
+
noRuns: zod.z.object({
|
|
285
|
+
text: zod.z.string(),
|
|
286
|
+
link: zod.z.string().optional()
|
|
287
|
+
}).optional()
|
|
288
|
+
});
|
|
289
|
+
var StaticTriggerMetadataSchema = zod.z.object({
|
|
290
|
+
type: zod.z.literal("static"),
|
|
291
|
+
title: zod.z.union([
|
|
292
|
+
zod.z.string(),
|
|
293
|
+
zod.z.array(zod.z.string())
|
|
638
294
|
]),
|
|
639
|
-
properties:
|
|
640
|
-
rule: EventRuleSchema
|
|
295
|
+
properties: zod.z.array(DisplayPropertySchema).optional(),
|
|
296
|
+
rule: EventRuleSchema,
|
|
297
|
+
link: zod.z.string().optional(),
|
|
298
|
+
help: TriggerHelpSchema.optional()
|
|
641
299
|
});
|
|
642
|
-
var
|
|
643
|
-
type:
|
|
300
|
+
var InvokeTriggerMetadataSchema = zod.z.object({
|
|
301
|
+
type: zod.z.literal("invoke")
|
|
302
|
+
});
|
|
303
|
+
var ScheduledTriggerMetadataSchema = zod.z.object({
|
|
304
|
+
type: zod.z.literal("scheduled"),
|
|
644
305
|
schedule: ScheduleMetadataSchema
|
|
645
306
|
});
|
|
646
|
-
var TriggerMetadataSchema =
|
|
307
|
+
var TriggerMetadataSchema = zod.z.discriminatedUnion("type", [
|
|
647
308
|
DynamicTriggerMetadataSchema,
|
|
648
309
|
StaticTriggerMetadataSchema,
|
|
649
|
-
ScheduledTriggerMetadataSchema
|
|
310
|
+
ScheduledTriggerMetadataSchema,
|
|
311
|
+
InvokeTriggerMetadataSchema
|
|
650
312
|
]);
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
// src/schemas/statuses.ts
|
|
656
|
-
var import_zod9 = require("zod");
|
|
657
|
-
var StatusUpdateStateSchema = import_zod9.z.union([
|
|
658
|
-
import_zod9.z.literal("loading"),
|
|
659
|
-
import_zod9.z.literal("success"),
|
|
660
|
-
import_zod9.z.literal("failure")
|
|
313
|
+
var StatusUpdateStateSchema = zod.z.union([
|
|
314
|
+
zod.z.literal("loading"),
|
|
315
|
+
zod.z.literal("success"),
|
|
316
|
+
zod.z.literal("failure")
|
|
661
317
|
]);
|
|
662
|
-
var StatusUpdateDataSchema =
|
|
663
|
-
var StatusUpdateSchema =
|
|
664
|
-
label:
|
|
318
|
+
var StatusUpdateDataSchema = zod.z.record(SerializableJsonSchema);
|
|
319
|
+
var StatusUpdateSchema = zod.z.object({
|
|
320
|
+
label: zod.z.string().optional(),
|
|
665
321
|
state: StatusUpdateStateSchema.optional(),
|
|
666
322
|
data: StatusUpdateDataSchema.optional()
|
|
667
323
|
});
|
|
668
324
|
var InitalStatusUpdateSchema = StatusUpdateSchema.required({
|
|
669
325
|
label: true
|
|
670
326
|
});
|
|
671
|
-
var StatusHistorySchema =
|
|
327
|
+
var StatusHistorySchema = zod.z.array(StatusUpdateSchema);
|
|
672
328
|
var JobRunStatusRecordSchema = InitalStatusUpdateSchema.extend({
|
|
673
|
-
key:
|
|
329
|
+
key: zod.z.string(),
|
|
674
330
|
history: StatusHistorySchema
|
|
675
331
|
});
|
|
676
332
|
|
|
677
333
|
// src/schemas/runs.ts
|
|
678
|
-
var RunStatusSchema =
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
334
|
+
var RunStatusSchema = zod.z.union([
|
|
335
|
+
zod.z.literal("PENDING"),
|
|
336
|
+
zod.z.literal("QUEUED"),
|
|
337
|
+
zod.z.literal("WAITING_ON_CONNECTIONS"),
|
|
338
|
+
zod.z.literal("PREPROCESSING"),
|
|
339
|
+
zod.z.literal("STARTED"),
|
|
340
|
+
zod.z.literal("SUCCESS"),
|
|
341
|
+
zod.z.literal("FAILURE"),
|
|
342
|
+
zod.z.literal("TIMED_OUT"),
|
|
343
|
+
zod.z.literal("ABORTED"),
|
|
344
|
+
zod.z.literal("CANCELED"),
|
|
345
|
+
zod.z.literal("UNRESOLVED_AUTH"),
|
|
346
|
+
zod.z.literal("INVALID_PAYLOAD"),
|
|
347
|
+
zod.z.literal("EXECUTING"),
|
|
348
|
+
zod.z.literal("WAITING_TO_CONTINUE"),
|
|
349
|
+
zod.z.literal("WAITING_TO_EXECUTE")
|
|
691
350
|
]);
|
|
692
|
-
var RunTaskSchema =
|
|
351
|
+
var RunTaskSchema = zod.z.object({
|
|
693
352
|
/** The Task id */
|
|
694
|
-
id:
|
|
353
|
+
id: zod.z.string(),
|
|
695
354
|
/** The key that you defined when creating the Task, the first param in any task. */
|
|
696
|
-
displayKey:
|
|
355
|
+
displayKey: zod.z.string().nullable(),
|
|
697
356
|
/** The Task status */
|
|
698
357
|
status: TaskStatusSchema,
|
|
699
358
|
/** The name of the Task */
|
|
700
|
-
name:
|
|
359
|
+
name: zod.z.string(),
|
|
701
360
|
/** The icon of the Task, a string.
|
|
702
361
|
* For integrations, this will be a lowercase name of the company.
|
|
703
362
|
* Can be used with the [@trigger.dev/companyicons](https://www.npmjs.com/package/@trigger.dev/companyicons) package to display an svg. */
|
|
704
|
-
icon:
|
|
363
|
+
icon: zod.z.string().nullable(),
|
|
705
364
|
/** When the task started */
|
|
706
|
-
startedAt:
|
|
365
|
+
startedAt: zod.z.coerce.date().nullable(),
|
|
707
366
|
/** When the task completed */
|
|
708
|
-
completedAt:
|
|
367
|
+
completedAt: zod.z.coerce.date().nullable()
|
|
709
368
|
});
|
|
710
369
|
var RunTaskWithSubtasksSchema = RunTaskSchema.extend({
|
|
711
|
-
subtasks:
|
|
370
|
+
subtasks: zod.z.lazy(() => RunTaskWithSubtasksSchema.array()).optional()
|
|
712
371
|
});
|
|
713
|
-
var GetRunOptionsSchema =
|
|
372
|
+
var GetRunOptionsSchema = zod.z.object({
|
|
714
373
|
/** Return subtasks, which appear in a `subtasks` array on a task. @default false */
|
|
715
|
-
subtasks:
|
|
374
|
+
subtasks: zod.z.boolean().optional(),
|
|
716
375
|
/** You can use this to get more tasks, if there are more than are returned in a single batch @default undefined */
|
|
717
|
-
cursor:
|
|
376
|
+
cursor: zod.z.string().optional(),
|
|
718
377
|
/** How many tasks you want to return in one go, max 50. @default 20 */
|
|
719
|
-
take:
|
|
378
|
+
take: zod.z.number().optional()
|
|
720
379
|
});
|
|
721
|
-
|
|
380
|
+
GetRunOptionsSchema.extend({
|
|
722
381
|
/** If `true`, it returns the `params` and `output` of all tasks. @default false */
|
|
723
|
-
taskdetails:
|
|
382
|
+
taskdetails: zod.z.boolean().optional()
|
|
724
383
|
});
|
|
725
|
-
var RunSchema =
|
|
384
|
+
var RunSchema = zod.z.object({
|
|
726
385
|
/** The Run id */
|
|
727
|
-
id:
|
|
386
|
+
id: zod.z.string(),
|
|
728
387
|
/** The Run status */
|
|
729
388
|
status: RunStatusSchema,
|
|
730
389
|
/** When the run started */
|
|
731
|
-
startedAt:
|
|
390
|
+
startedAt: zod.z.coerce.date().nullable(),
|
|
732
391
|
/** When the run was last updated */
|
|
733
|
-
updatedAt:
|
|
392
|
+
updatedAt: zod.z.coerce.date().nullable(),
|
|
734
393
|
/** When the run was completed */
|
|
735
|
-
completedAt:
|
|
394
|
+
completedAt: zod.z.coerce.date().nullable()
|
|
736
395
|
});
|
|
737
396
|
var GetRunSchema = RunSchema.extend({
|
|
738
397
|
/** The output of the run */
|
|
739
|
-
output:
|
|
398
|
+
output: zod.z.any().optional(),
|
|
740
399
|
/** The tasks from the run */
|
|
741
|
-
tasks:
|
|
400
|
+
tasks: zod.z.array(RunTaskWithSubtasksSchema),
|
|
742
401
|
/** Any status updates that were published from the run */
|
|
743
|
-
statuses:
|
|
402
|
+
statuses: zod.z.array(JobRunStatusRecordSchema).default([]),
|
|
744
403
|
/** If there are more tasks, you can use this to get them */
|
|
745
|
-
nextCursor:
|
|
404
|
+
nextCursor: zod.z.string().optional()
|
|
746
405
|
});
|
|
747
|
-
|
|
406
|
+
zod.z.object({
|
|
748
407
|
/** You can use this to get more tasks, if there are more than are returned in a single batch @default undefined */
|
|
749
|
-
cursor:
|
|
408
|
+
cursor: zod.z.string().optional(),
|
|
750
409
|
/** How many runs you want to return in one go, max 50. @default 20 */
|
|
751
|
-
take:
|
|
410
|
+
take: zod.z.number().optional()
|
|
752
411
|
});
|
|
753
|
-
var GetRunsSchema =
|
|
412
|
+
var GetRunsSchema = zod.z.object({
|
|
754
413
|
/** The runs from the query */
|
|
755
414
|
runs: RunSchema.array(),
|
|
756
415
|
/** If there are more runs, you can use this to get them */
|
|
757
|
-
nextCursor:
|
|
416
|
+
nextCursor: zod.z.string().optional()
|
|
417
|
+
});
|
|
418
|
+
var StringMatchSchema = zod.z.union([
|
|
419
|
+
/** Match against a string */
|
|
420
|
+
zod.z.array(zod.z.string()),
|
|
421
|
+
zod.z.array(zod.z.union(stringPatternMatchers))
|
|
422
|
+
]);
|
|
423
|
+
var HTTPMethodUnionSchema = zod.z.union([
|
|
424
|
+
zod.z.literal("GET"),
|
|
425
|
+
zod.z.literal("POST"),
|
|
426
|
+
zod.z.literal("PUT"),
|
|
427
|
+
zod.z.literal("PATCH"),
|
|
428
|
+
zod.z.literal("DELETE"),
|
|
429
|
+
zod.z.literal("HEAD"),
|
|
430
|
+
zod.z.literal("OPTIONS")
|
|
431
|
+
]);
|
|
432
|
+
var RequestFilterSchema = zod.z.object({
|
|
433
|
+
/** An array of HTTP methods to match.
|
|
434
|
+
* For example, `["GET", "POST"]` will match both `GET` and `POST` Requests. */
|
|
435
|
+
method: zod.z.array(HTTPMethodUnionSchema).optional(),
|
|
436
|
+
/** An object of header key/values to match.
|
|
437
|
+
* This uses the [EventFilter matching syntax](https://trigger.dev/docs/documentation/guides/event-filter).
|
|
438
|
+
|
|
439
|
+
@example
|
|
440
|
+
```ts
|
|
441
|
+
filter: {
|
|
442
|
+
header: {
|
|
443
|
+
"content-type": ["application/json"],
|
|
444
|
+
},
|
|
445
|
+
},
|
|
446
|
+
``` */
|
|
447
|
+
headers: zod.z.record(StringMatchSchema).optional(),
|
|
448
|
+
/** An object of query parameters to match.
|
|
449
|
+
* This uses the [EventFilter matching syntax](https://trigger.dev/docs/documentation/guides/event-filter).
|
|
450
|
+
|
|
451
|
+
@example
|
|
452
|
+
```ts
|
|
453
|
+
filter: {
|
|
454
|
+
query: {
|
|
455
|
+
"hub.mode": [{ $startsWith: "sub" }],
|
|
456
|
+
},
|
|
457
|
+
},
|
|
458
|
+
``` */
|
|
459
|
+
query: zod.z.record(StringMatchSchema).optional(),
|
|
460
|
+
/** An object of key/values to match.
|
|
461
|
+
* This uses the [EventFilter matching syntax](https://trigger.dev/docs/documentation/guides/event-filter).
|
|
462
|
+
*/
|
|
463
|
+
body: EventFilterSchema.optional()
|
|
464
|
+
});
|
|
465
|
+
var ResponseFilterSchema = RequestFilterSchema.omit({
|
|
466
|
+
method: true,
|
|
467
|
+
query: true
|
|
468
|
+
}).extend({
|
|
469
|
+
status: zod.z.array(zod.z.number()).optional()
|
|
758
470
|
});
|
|
759
471
|
|
|
760
472
|
// src/schemas/api.ts
|
|
761
|
-
var UpdateTriggerSourceBodyV1Schema =
|
|
762
|
-
registeredEvents:
|
|
763
|
-
secret:
|
|
473
|
+
var UpdateTriggerSourceBodyV1Schema = zod.z.object({
|
|
474
|
+
registeredEvents: zod.z.array(zod.z.string()),
|
|
475
|
+
secret: zod.z.string().optional(),
|
|
764
476
|
data: SerializableJsonSchema.optional()
|
|
765
477
|
});
|
|
766
|
-
var UpdateTriggerSourceBodyV2Schema =
|
|
767
|
-
secret:
|
|
478
|
+
var UpdateTriggerSourceBodyV2Schema = zod.z.object({
|
|
479
|
+
secret: zod.z.string().optional(),
|
|
768
480
|
data: SerializableJsonSchema.optional(),
|
|
769
|
-
options:
|
|
770
|
-
event:
|
|
771
|
-
}).and(
|
|
481
|
+
options: zod.z.object({
|
|
482
|
+
event: zod.z.array(zod.z.string())
|
|
483
|
+
}).and(zod.z.record(zod.z.string(), zod.z.array(zod.z.string())).optional())
|
|
772
484
|
});
|
|
773
|
-
var
|
|
774
|
-
|
|
775
|
-
|
|
485
|
+
var UpdateWebhookBodySchema = zod.z.discriminatedUnion("active", [
|
|
486
|
+
zod.z.object({
|
|
487
|
+
active: zod.z.literal(false)
|
|
488
|
+
}),
|
|
489
|
+
zod.z.object({
|
|
490
|
+
active: zod.z.literal(true),
|
|
491
|
+
config: zod.z.record(zod.z.string().array())
|
|
492
|
+
})
|
|
493
|
+
]);
|
|
494
|
+
var RegisterHTTPTriggerSourceBodySchema = zod.z.object({
|
|
495
|
+
type: zod.z.literal("HTTP"),
|
|
496
|
+
url: zod.z.string().url()
|
|
776
497
|
});
|
|
777
|
-
var RegisterSMTPTriggerSourceBodySchema =
|
|
778
|
-
type:
|
|
498
|
+
var RegisterSMTPTriggerSourceBodySchema = zod.z.object({
|
|
499
|
+
type: zod.z.literal("SMTP")
|
|
779
500
|
});
|
|
780
|
-
var RegisterSQSTriggerSourceBodySchema =
|
|
781
|
-
type:
|
|
501
|
+
var RegisterSQSTriggerSourceBodySchema = zod.z.object({
|
|
502
|
+
type: zod.z.literal("SQS")
|
|
782
503
|
});
|
|
783
|
-
var RegisterSourceChannelBodySchema =
|
|
504
|
+
var RegisterSourceChannelBodySchema = zod.z.discriminatedUnion("type", [
|
|
784
505
|
RegisterHTTPTriggerSourceBodySchema,
|
|
785
506
|
RegisterSMTPTriggerSourceBodySchema,
|
|
786
507
|
RegisterSQSTriggerSourceBodySchema
|
|
787
508
|
]);
|
|
509
|
+
var REGISTER_WEBHOOK = "dev.trigger.webhook.register";
|
|
510
|
+
var DELIVER_WEBHOOK_REQUEST = "dev.trigger.webhook.deliver";
|
|
511
|
+
var RegisterWebhookSourceSchema = zod.z.object({
|
|
512
|
+
key: zod.z.string(),
|
|
513
|
+
params: zod.z.any(),
|
|
514
|
+
config: zod.z.any(),
|
|
515
|
+
active: zod.z.boolean(),
|
|
516
|
+
secret: zod.z.string(),
|
|
517
|
+
url: zod.z.string(),
|
|
518
|
+
data: DeserializedJsonSchema.optional(),
|
|
519
|
+
clientId: zod.z.string().optional()
|
|
520
|
+
});
|
|
521
|
+
var RegisterWebhookPayloadSchema = zod.z.object({
|
|
522
|
+
active: zod.z.boolean(),
|
|
523
|
+
params: zod.z.any().optional(),
|
|
524
|
+
config: zod.z.object({
|
|
525
|
+
current: zod.z.record(zod.z.string().array()),
|
|
526
|
+
desired: zod.z.record(zod.z.string().array())
|
|
527
|
+
}),
|
|
528
|
+
// from HTTP Endpoint
|
|
529
|
+
url: zod.z.string(),
|
|
530
|
+
secret: zod.z.string()
|
|
531
|
+
});
|
|
788
532
|
var REGISTER_SOURCE_EVENT_V1 = "dev.trigger.source.register";
|
|
789
533
|
var REGISTER_SOURCE_EVENT_V2 = "dev.trigger.source.register.v2";
|
|
790
|
-
var RegisterTriggerSourceSchema =
|
|
791
|
-
key:
|
|
792
|
-
params:
|
|
793
|
-
active:
|
|
794
|
-
secret:
|
|
534
|
+
var RegisterTriggerSourceSchema = zod.z.object({
|
|
535
|
+
key: zod.z.string(),
|
|
536
|
+
params: zod.z.any(),
|
|
537
|
+
active: zod.z.boolean(),
|
|
538
|
+
secret: zod.z.string(),
|
|
795
539
|
data: DeserializedJsonSchema.optional(),
|
|
796
540
|
channel: RegisterSourceChannelBodySchema,
|
|
797
|
-
clientId:
|
|
541
|
+
clientId: zod.z.string().optional()
|
|
798
542
|
});
|
|
799
|
-
|
|
800
|
-
name:
|
|
801
|
-
value:
|
|
543
|
+
zod.z.object({
|
|
544
|
+
name: zod.z.string(),
|
|
545
|
+
value: zod.z.string()
|
|
802
546
|
});
|
|
803
|
-
var RegisterSourceEventSchemaV1 =
|
|
547
|
+
var RegisterSourceEventSchemaV1 = zod.z.object({
|
|
804
548
|
/** The id of the source */
|
|
805
|
-
id:
|
|
549
|
+
id: zod.z.string(),
|
|
806
550
|
source: RegisterTriggerSourceSchema,
|
|
807
|
-
events:
|
|
808
|
-
missingEvents:
|
|
809
|
-
orphanedEvents:
|
|
810
|
-
dynamicTriggerId:
|
|
551
|
+
events: zod.z.array(zod.z.string()),
|
|
552
|
+
missingEvents: zod.z.array(zod.z.string()),
|
|
553
|
+
orphanedEvents: zod.z.array(zod.z.string()),
|
|
554
|
+
dynamicTriggerId: zod.z.string().optional()
|
|
811
555
|
});
|
|
812
|
-
var RegisteredOptionsDiffSchema =
|
|
813
|
-
desired:
|
|
814
|
-
missing:
|
|
815
|
-
orphaned:
|
|
556
|
+
var RegisteredOptionsDiffSchema = zod.z.object({
|
|
557
|
+
desired: zod.z.array(zod.z.string()),
|
|
558
|
+
missing: zod.z.array(zod.z.string()),
|
|
559
|
+
orphaned: zod.z.array(zod.z.string())
|
|
816
560
|
});
|
|
817
|
-
var RegisterSourceEventOptionsSchema =
|
|
561
|
+
var RegisterSourceEventOptionsSchema = zod.z.object({
|
|
818
562
|
event: RegisteredOptionsDiffSchema
|
|
819
|
-
}).and(
|
|
820
|
-
var RegisterSourceEventSchemaV2 =
|
|
563
|
+
}).and(zod.z.record(zod.z.string(), RegisteredOptionsDiffSchema));
|
|
564
|
+
var RegisterSourceEventSchemaV2 = zod.z.object({
|
|
821
565
|
/** The id of the source */
|
|
822
|
-
id:
|
|
566
|
+
id: zod.z.string(),
|
|
823
567
|
source: RegisterTriggerSourceSchema,
|
|
824
568
|
options: RegisterSourceEventOptionsSchema,
|
|
825
|
-
dynamicTriggerId:
|
|
569
|
+
dynamicTriggerId: zod.z.string().optional()
|
|
826
570
|
});
|
|
827
|
-
var TriggerSourceSchema =
|
|
828
|
-
id:
|
|
829
|
-
key:
|
|
571
|
+
var TriggerSourceSchema = zod.z.object({
|
|
572
|
+
id: zod.z.string(),
|
|
573
|
+
key: zod.z.string()
|
|
830
574
|
});
|
|
831
575
|
var HttpSourceResponseMetadataSchema = DeserializedJsonSchema;
|
|
832
|
-
var HandleTriggerSourceSchema =
|
|
833
|
-
key:
|
|
834
|
-
secret:
|
|
835
|
-
data:
|
|
836
|
-
params:
|
|
576
|
+
var HandleTriggerSourceSchema = zod.z.object({
|
|
577
|
+
key: zod.z.string(),
|
|
578
|
+
secret: zod.z.string(),
|
|
579
|
+
data: zod.z.any(),
|
|
580
|
+
params: zod.z.any(),
|
|
837
581
|
auth: ConnectionAuthSchema.optional(),
|
|
838
582
|
metadata: HttpSourceResponseMetadataSchema.optional()
|
|
839
583
|
});
|
|
840
|
-
var
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
"x-ts-
|
|
848
|
-
"x-ts-
|
|
849
|
-
"x-ts-
|
|
850
|
-
"x-ts-data": import_zod11.z.string().transform((s) => JSON.parse(s)),
|
|
851
|
-
"x-ts-params": import_zod11.z.string().transform((s) => JSON.parse(s)),
|
|
852
|
-
"x-ts-http-url": import_zod11.z.string(),
|
|
853
|
-
"x-ts-http-method": import_zod11.z.string(),
|
|
854
|
-
"x-ts-http-headers": import_zod11.z.string().transform((s) => import_zod11.z.record(import_zod11.z.string()).parse(JSON.parse(s))),
|
|
855
|
-
"x-ts-auth": import_zod11.z.string().optional().transform((s) => {
|
|
584
|
+
var HttpSourceRequestHeadersSchema = zod.z.object({
|
|
585
|
+
"x-ts-key": zod.z.string(),
|
|
586
|
+
"x-ts-dynamic-id": zod.z.string().optional(),
|
|
587
|
+
"x-ts-secret": zod.z.string(),
|
|
588
|
+
"x-ts-data": zod.z.string().transform((s) => JSON.parse(s)),
|
|
589
|
+
"x-ts-params": zod.z.string().transform((s) => JSON.parse(s)),
|
|
590
|
+
"x-ts-http-url": zod.z.string(),
|
|
591
|
+
"x-ts-http-method": zod.z.string(),
|
|
592
|
+
"x-ts-http-headers": zod.z.string().transform((s) => zod.z.record(zod.z.string()).parse(JSON.parse(s))),
|
|
593
|
+
"x-ts-auth": zod.z.string().optional().transform((s) => {
|
|
856
594
|
if (s === void 0)
|
|
857
595
|
return;
|
|
858
596
|
const json = JSON.parse(s);
|
|
859
597
|
return ConnectionAuthSchema.parse(json);
|
|
860
598
|
}),
|
|
861
|
-
"x-ts-metadata":
|
|
599
|
+
"x-ts-metadata": zod.z.string().optional().transform((s) => {
|
|
862
600
|
if (s === void 0)
|
|
863
601
|
return;
|
|
864
602
|
const json = JSON.parse(s);
|
|
865
603
|
return DeserializedJsonSchema.parse(json);
|
|
866
604
|
})
|
|
867
605
|
});
|
|
868
|
-
var
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
606
|
+
var HttpEndpointRequestHeadersSchema = zod.z.object({
|
|
607
|
+
"x-ts-key": zod.z.string(),
|
|
608
|
+
"x-ts-http-url": zod.z.string(),
|
|
609
|
+
"x-ts-http-method": zod.z.string(),
|
|
610
|
+
"x-ts-http-headers": zod.z.string().transform((s) => zod.z.record(zod.z.string()).parse(JSON.parse(s)))
|
|
611
|
+
});
|
|
612
|
+
var WebhookSourceRequestHeadersSchema = zod.z.object({
|
|
613
|
+
"x-ts-key": zod.z.string(),
|
|
614
|
+
"x-ts-dynamic-id": zod.z.string().optional(),
|
|
615
|
+
"x-ts-secret": zod.z.string(),
|
|
616
|
+
"x-ts-params": zod.z.string().transform((s) => JSON.parse(s)),
|
|
617
|
+
"x-ts-http-url": zod.z.string(),
|
|
618
|
+
"x-ts-http-method": zod.z.string(),
|
|
619
|
+
"x-ts-http-headers": zod.z.string().transform((s) => zod.z.record(zod.z.string()).parse(JSON.parse(s)))
|
|
620
|
+
});
|
|
621
|
+
var PongSuccessResponseSchema = zod.z.object({
|
|
622
|
+
ok: zod.z.literal(true),
|
|
623
|
+
triggerVersion: zod.z.string().optional(),
|
|
624
|
+
triggerSdkVersion: zod.z.string().optional()
|
|
625
|
+
});
|
|
626
|
+
var PongErrorResponseSchema = zod.z.object({
|
|
627
|
+
ok: zod.z.literal(false),
|
|
628
|
+
error: zod.z.string(),
|
|
629
|
+
triggerVersion: zod.z.string().optional(),
|
|
630
|
+
triggerSdkVersion: zod.z.string().optional()
|
|
631
|
+
});
|
|
632
|
+
var PongResponseSchema = zod.z.discriminatedUnion("ok", [
|
|
880
633
|
PongSuccessResponseSchema,
|
|
881
634
|
PongErrorResponseSchema
|
|
882
635
|
]);
|
|
883
|
-
var ValidateSuccessResponseSchema =
|
|
884
|
-
ok:
|
|
885
|
-
endpointId:
|
|
886
|
-
triggerVersion:
|
|
636
|
+
var ValidateSuccessResponseSchema = zod.z.object({
|
|
637
|
+
ok: zod.z.literal(true),
|
|
638
|
+
endpointId: zod.z.string(),
|
|
639
|
+
triggerVersion: zod.z.string().optional()
|
|
887
640
|
});
|
|
888
|
-
var ValidateErrorResponseSchema =
|
|
889
|
-
ok:
|
|
890
|
-
error:
|
|
891
|
-
triggerVersion:
|
|
641
|
+
var ValidateErrorResponseSchema = zod.z.object({
|
|
642
|
+
ok: zod.z.literal(false),
|
|
643
|
+
error: zod.z.string(),
|
|
644
|
+
triggerVersion: zod.z.string().optional()
|
|
892
645
|
});
|
|
893
|
-
var ValidateResponseSchema =
|
|
646
|
+
var ValidateResponseSchema = zod.z.discriminatedUnion("ok", [
|
|
894
647
|
ValidateSuccessResponseSchema,
|
|
895
648
|
ValidateErrorResponseSchema
|
|
896
649
|
]);
|
|
897
|
-
var QueueOptionsSchema =
|
|
898
|
-
name:
|
|
899
|
-
maxConcurrent:
|
|
900
|
-
});
|
|
901
|
-
var
|
|
902
|
-
id:
|
|
903
|
-
|
|
904
|
-
|
|
650
|
+
var QueueOptionsSchema = zod.z.object({
|
|
651
|
+
name: zod.z.string(),
|
|
652
|
+
maxConcurrent: zod.z.number().optional()
|
|
653
|
+
});
|
|
654
|
+
var ConcurrencyLimitOptionsSchema = zod.z.object({
|
|
655
|
+
id: zod.z.string(),
|
|
656
|
+
limit: zod.z.number()
|
|
657
|
+
});
|
|
658
|
+
var JobMetadataSchema = zod.z.object({
|
|
659
|
+
id: zod.z.string(),
|
|
660
|
+
name: zod.z.string(),
|
|
661
|
+
version: zod.z.string(),
|
|
905
662
|
event: EventSpecificationSchema,
|
|
906
663
|
trigger: TriggerMetadataSchema,
|
|
907
|
-
integrations:
|
|
908
|
-
internal:
|
|
909
|
-
enabled:
|
|
910
|
-
startPosition:
|
|
664
|
+
integrations: zod.z.record(IntegrationConfigSchema),
|
|
665
|
+
internal: zod.z.boolean().default(false),
|
|
666
|
+
enabled: zod.z.boolean(),
|
|
667
|
+
startPosition: zod.z.enum([
|
|
911
668
|
"initial",
|
|
912
669
|
"latest"
|
|
913
670
|
]),
|
|
914
|
-
preprocessRuns:
|
|
671
|
+
preprocessRuns: zod.z.boolean(),
|
|
672
|
+
concurrencyLimit: ConcurrencyLimitOptionsSchema.or(zod.z.number().int().positive()).optional()
|
|
915
673
|
});
|
|
916
|
-
var SourceMetadataV1Schema =
|
|
917
|
-
version:
|
|
918
|
-
channel:
|
|
674
|
+
var SourceMetadataV1Schema = zod.z.object({
|
|
675
|
+
version: zod.z.literal("1"),
|
|
676
|
+
channel: zod.z.enum([
|
|
919
677
|
"HTTP",
|
|
920
678
|
"SQS",
|
|
921
679
|
"SMTP"
|
|
922
680
|
]),
|
|
923
681
|
integration: IntegrationConfigSchema,
|
|
924
|
-
key:
|
|
925
|
-
params:
|
|
926
|
-
events:
|
|
927
|
-
registerSourceJob:
|
|
928
|
-
id:
|
|
929
|
-
version:
|
|
682
|
+
key: zod.z.string(),
|
|
683
|
+
params: zod.z.any(),
|
|
684
|
+
events: zod.z.array(zod.z.string()),
|
|
685
|
+
registerSourceJob: zod.z.object({
|
|
686
|
+
id: zod.z.string(),
|
|
687
|
+
version: zod.z.string()
|
|
930
688
|
}).optional()
|
|
931
689
|
});
|
|
932
|
-
var SourceMetadataV2Schema =
|
|
933
|
-
version:
|
|
934
|
-
channel:
|
|
690
|
+
var SourceMetadataV2Schema = zod.z.object({
|
|
691
|
+
version: zod.z.literal("2"),
|
|
692
|
+
channel: zod.z.enum([
|
|
935
693
|
"HTTP",
|
|
936
694
|
"SQS",
|
|
937
695
|
"SMTP"
|
|
938
696
|
]),
|
|
939
697
|
integration: IntegrationConfigSchema,
|
|
940
|
-
key:
|
|
941
|
-
params:
|
|
942
|
-
options:
|
|
943
|
-
registerSourceJob:
|
|
944
|
-
id:
|
|
945
|
-
version:
|
|
698
|
+
key: zod.z.string(),
|
|
699
|
+
params: zod.z.any(),
|
|
700
|
+
options: zod.z.record(zod.z.array(zod.z.string())),
|
|
701
|
+
registerSourceJob: zod.z.object({
|
|
702
|
+
id: zod.z.string(),
|
|
703
|
+
version: zod.z.string()
|
|
946
704
|
}).optional()
|
|
947
705
|
});
|
|
948
|
-
var SourceMetadataSchema =
|
|
706
|
+
var SourceMetadataSchema = zod.z.preprocess(addMissingVersionField, zod.z.discriminatedUnion("version", [
|
|
949
707
|
SourceMetadataV1Schema,
|
|
950
708
|
SourceMetadataV2Schema
|
|
951
709
|
]));
|
|
952
|
-
var
|
|
953
|
-
|
|
954
|
-
|
|
710
|
+
var WebhookMetadataSchema = zod.z.object({
|
|
711
|
+
key: zod.z.string(),
|
|
712
|
+
params: zod.z.any(),
|
|
713
|
+
config: zod.z.record(zod.z.array(zod.z.string())),
|
|
714
|
+
integration: IntegrationConfigSchema,
|
|
715
|
+
httpEndpoint: zod.z.object({
|
|
716
|
+
id: zod.z.string()
|
|
717
|
+
})
|
|
718
|
+
});
|
|
719
|
+
var WebhookContextMetadataSchema = zod.z.object({
|
|
720
|
+
params: zod.z.any(),
|
|
721
|
+
config: zod.z.record(zod.z.string().array()),
|
|
722
|
+
secret: zod.z.string()
|
|
723
|
+
});
|
|
724
|
+
var DynamicTriggerEndpointMetadataSchema = zod.z.object({
|
|
725
|
+
id: zod.z.string(),
|
|
726
|
+
jobs: zod.z.array(JobMetadataSchema.pick({
|
|
955
727
|
id: true,
|
|
956
728
|
version: true
|
|
957
729
|
})),
|
|
958
|
-
registerSourceJob:
|
|
959
|
-
id:
|
|
960
|
-
version:
|
|
730
|
+
registerSourceJob: zod.z.object({
|
|
731
|
+
id: zod.z.string(),
|
|
732
|
+
version: zod.z.string()
|
|
961
733
|
}).optional()
|
|
962
734
|
});
|
|
963
|
-
var
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
735
|
+
var HttpEndpointMetadataSchema = zod.z.object({
|
|
736
|
+
id: zod.z.string(),
|
|
737
|
+
version: zod.z.string(),
|
|
738
|
+
enabled: zod.z.boolean(),
|
|
739
|
+
title: zod.z.string().optional(),
|
|
740
|
+
icon: zod.z.string().optional(),
|
|
741
|
+
properties: zod.z.array(DisplayPropertySchema).optional(),
|
|
742
|
+
event: EventSpecificationSchema,
|
|
743
|
+
immediateResponseFilter: RequestFilterSchema.optional(),
|
|
744
|
+
skipTriggeringRuns: zod.z.boolean().optional(),
|
|
745
|
+
source: zod.z.string()
|
|
746
|
+
});
|
|
747
|
+
var IndexEndpointResponseSchema = zod.z.object({
|
|
748
|
+
jobs: zod.z.array(JobMetadataSchema),
|
|
749
|
+
sources: zod.z.array(SourceMetadataSchema),
|
|
750
|
+
webhooks: zod.z.array(WebhookMetadataSchema).optional(),
|
|
751
|
+
dynamicTriggers: zod.z.array(DynamicTriggerEndpointMetadataSchema),
|
|
752
|
+
dynamicSchedules: zod.z.array(RegisterDynamicSchedulePayloadSchema),
|
|
753
|
+
httpEndpoints: zod.z.array(HttpEndpointMetadataSchema).optional()
|
|
754
|
+
});
|
|
755
|
+
var EndpointIndexErrorSchema = zod.z.object({
|
|
756
|
+
message: zod.z.string(),
|
|
757
|
+
raw: zod.z.any().optional()
|
|
758
|
+
});
|
|
759
|
+
var IndexEndpointStatsSchema = zod.z.object({
|
|
760
|
+
jobs: zod.z.number(),
|
|
761
|
+
sources: zod.z.number(),
|
|
762
|
+
webhooks: zod.z.number().optional(),
|
|
763
|
+
dynamicTriggers: zod.z.number(),
|
|
764
|
+
dynamicSchedules: zod.z.number(),
|
|
765
|
+
disabledJobs: zod.z.number().default(0),
|
|
766
|
+
httpEndpoints: zod.z.number().default(0)
|
|
979
767
|
});
|
|
980
768
|
function parseEndpointIndexStats(stats) {
|
|
981
769
|
if (stats === null || stats === void 0) {
|
|
@@ -984,208 +772,227 @@ function parseEndpointIndexStats(stats) {
|
|
|
984
772
|
return IndexEndpointStatsSchema.parse(stats);
|
|
985
773
|
}
|
|
986
774
|
__name(parseEndpointIndexStats, "parseEndpointIndexStats");
|
|
987
|
-
var GetEndpointIndexResponseSchema =
|
|
988
|
-
|
|
989
|
-
status:
|
|
990
|
-
updatedAt:
|
|
775
|
+
var GetEndpointIndexResponseSchema = zod.z.discriminatedUnion("status", [
|
|
776
|
+
zod.z.object({
|
|
777
|
+
status: zod.z.literal("PENDING"),
|
|
778
|
+
updatedAt: zod.z.coerce.date()
|
|
991
779
|
}),
|
|
992
|
-
|
|
993
|
-
status:
|
|
994
|
-
updatedAt:
|
|
780
|
+
zod.z.object({
|
|
781
|
+
status: zod.z.literal("STARTED"),
|
|
782
|
+
updatedAt: zod.z.coerce.date()
|
|
995
783
|
}),
|
|
996
|
-
|
|
997
|
-
status:
|
|
784
|
+
zod.z.object({
|
|
785
|
+
status: zod.z.literal("SUCCESS"),
|
|
998
786
|
stats: IndexEndpointStatsSchema,
|
|
999
|
-
updatedAt:
|
|
787
|
+
updatedAt: zod.z.coerce.date()
|
|
1000
788
|
}),
|
|
1001
|
-
|
|
1002
|
-
status:
|
|
789
|
+
zod.z.object({
|
|
790
|
+
status: zod.z.literal("FAILURE"),
|
|
1003
791
|
error: EndpointIndexErrorSchema,
|
|
1004
|
-
updatedAt:
|
|
792
|
+
updatedAt: zod.z.coerce.date()
|
|
1005
793
|
})
|
|
1006
794
|
]);
|
|
1007
|
-
var EndpointHeadersSchema =
|
|
1008
|
-
"trigger-version":
|
|
1009
|
-
"trigger-sdk-version":
|
|
795
|
+
var EndpointHeadersSchema = zod.z.object({
|
|
796
|
+
"trigger-version": zod.z.string().optional(),
|
|
797
|
+
"trigger-sdk-version": zod.z.string().optional()
|
|
798
|
+
});
|
|
799
|
+
var ExecuteJobRunMetadataSchema = zod.z.object({
|
|
800
|
+
successSubscription: zod.z.boolean().optional(),
|
|
801
|
+
failedSubscription: zod.z.boolean().optional()
|
|
802
|
+
});
|
|
803
|
+
var ExecuteJobHeadersSchema = EndpointHeadersSchema.extend({
|
|
804
|
+
"x-trigger-run-metadata": zod.z.preprocess((val) => typeof val === "string" && JSON.parse(val), ExecuteJobRunMetadataSchema).optional()
|
|
1010
805
|
});
|
|
1011
|
-
var RawEventSchema =
|
|
806
|
+
var RawEventSchema = zod.z.object({
|
|
1012
807
|
/** The `name` property must exactly match any subscriptions you want to
|
|
1013
808
|
trigger. */
|
|
1014
|
-
name:
|
|
809
|
+
name: zod.z.string(),
|
|
1015
810
|
/** The `payload` property will be sent to any matching Jobs and will appear
|
|
1016
811
|
as the `payload` param of the `run()` function. You can leave this
|
|
1017
812
|
parameter out if you just want to trigger a Job without any input data. */
|
|
1018
|
-
payload:
|
|
813
|
+
payload: zod.z.any(),
|
|
1019
814
|
/** The optional `context` property will be sent to any matching Jobs and will
|
|
1020
815
|
be passed through as the `context.event.context` param of the `run()`
|
|
1021
816
|
function. This is optional but can be useful if you want to pass through
|
|
1022
817
|
some additional context to the Job. */
|
|
1023
|
-
context:
|
|
818
|
+
context: zod.z.any().optional(),
|
|
1024
819
|
/** The `id` property uniquely identify this particular event. If unset it
|
|
1025
820
|
will be set automatically using `ulid`. */
|
|
1026
|
-
id:
|
|
821
|
+
id: zod.z.string().default(() => ulidx.ulid()),
|
|
1027
822
|
/** This is optional, it defaults to the current timestamp. Usually you would
|
|
1028
823
|
only set this if you have a timestamp that you wish to pass through, e.g.
|
|
1029
824
|
you receive a timestamp from a service and you want the same timestamp to
|
|
1030
825
|
be used in your Job. */
|
|
1031
|
-
timestamp:
|
|
826
|
+
timestamp: zod.z.coerce.date().optional(),
|
|
1032
827
|
/** This is optional, it defaults to "trigger.dev". It can be useful to set
|
|
1033
828
|
this as you can filter events using this in the `eventTrigger()`. */
|
|
1034
|
-
source:
|
|
829
|
+
source: zod.z.string().optional(),
|
|
830
|
+
/** This is optional, it defaults to "JSON". If your event is actually a request,
|
|
831
|
+
with a url, headers, method and rawBody you can use "REQUEST" */
|
|
832
|
+
payloadType: zod.z.union([
|
|
833
|
+
zod.z.literal("JSON"),
|
|
834
|
+
zod.z.literal("REQUEST")
|
|
835
|
+
]).optional()
|
|
1035
836
|
});
|
|
1036
|
-
var ApiEventLogSchema =
|
|
837
|
+
var ApiEventLogSchema = zod.z.object({
|
|
1037
838
|
/** The `id` of the event that was sent.
|
|
1038
839
|
*/
|
|
1039
|
-
id:
|
|
840
|
+
id: zod.z.string(),
|
|
1040
841
|
/** The `name` of the event that was sent. */
|
|
1041
|
-
name:
|
|
842
|
+
name: zod.z.string(),
|
|
1042
843
|
/** The `payload` of the event that was sent */
|
|
1043
844
|
payload: DeserializedJsonSchema,
|
|
1044
845
|
/** The `context` of the event that was sent. Is `undefined` if no context was
|
|
1045
846
|
set when sending the event. */
|
|
1046
847
|
context: DeserializedJsonSchema.optional().nullable(),
|
|
1047
848
|
/** The `timestamp` of the event that was sent */
|
|
1048
|
-
timestamp:
|
|
849
|
+
timestamp: zod.z.coerce.date(),
|
|
1049
850
|
/** The timestamp when the event will be delivered to any matching Jobs. Is
|
|
1050
851
|
`undefined` if `deliverAt` or `deliverAfter` wasn't set when sending the
|
|
1051
852
|
event. */
|
|
1052
|
-
deliverAt:
|
|
853
|
+
deliverAt: zod.z.coerce.date().optional().nullable(),
|
|
1053
854
|
/** The timestamp when the event was delivered. Is `undefined` if `deliverAt`
|
|
1054
855
|
or `deliverAfter` were set when sending the event. */
|
|
1055
|
-
deliveredAt:
|
|
856
|
+
deliveredAt: zod.z.coerce.date().optional().nullable(),
|
|
1056
857
|
/** The timestamp when the event was cancelled. Is `undefined` if the event
|
|
1057
858
|
* wasn't cancelled. */
|
|
1058
|
-
cancelledAt:
|
|
859
|
+
cancelledAt: zod.z.coerce.date().optional().nullable()
|
|
1059
860
|
});
|
|
1060
|
-
var SendEventOptionsSchema =
|
|
861
|
+
var SendEventOptionsSchema = zod.z.object({
|
|
1061
862
|
/** An optional Date when you want the event to trigger Jobs. The event will
|
|
1062
863
|
be sent to the platform immediately but won't be acted upon until the
|
|
1063
864
|
specified time. */
|
|
1064
|
-
deliverAt:
|
|
865
|
+
deliverAt: zod.z.coerce.date().optional(),
|
|
1065
866
|
/** An optional number of seconds you want to wait for the event to trigger
|
|
1066
867
|
any relevant Jobs. The event will be sent to the platform immediately but
|
|
1067
868
|
won't be delivered until after the elapsed number of seconds. */
|
|
1068
|
-
deliverAfter:
|
|
869
|
+
deliverAfter: zod.z.number().int().optional(),
|
|
1069
870
|
/** This optional param will be used by Trigger.dev Connect, which
|
|
1070
871
|
is coming soon. */
|
|
1071
|
-
accountId:
|
|
872
|
+
accountId: zod.z.string().optional()
|
|
1072
873
|
});
|
|
1073
|
-
var SendEventBodySchema =
|
|
874
|
+
var SendEventBodySchema = zod.z.object({
|
|
1074
875
|
event: RawEventSchema,
|
|
1075
876
|
options: SendEventOptionsSchema.optional()
|
|
1076
877
|
});
|
|
1077
|
-
var
|
|
1078
|
-
|
|
878
|
+
var SendBulkEventsBodySchema = zod.z.object({
|
|
879
|
+
events: RawEventSchema.array(),
|
|
880
|
+
options: SendEventOptionsSchema.optional()
|
|
881
|
+
});
|
|
882
|
+
var DeliverEventResponseSchema = zod.z.object({
|
|
883
|
+
deliveredAt: zod.z.string().datetime()
|
|
1079
884
|
});
|
|
1080
|
-
var RuntimeEnvironmentTypeSchema =
|
|
885
|
+
var RuntimeEnvironmentTypeSchema = zod.z.enum([
|
|
1081
886
|
"PRODUCTION",
|
|
1082
887
|
"STAGING",
|
|
1083
888
|
"DEVELOPMENT",
|
|
1084
889
|
"PREVIEW"
|
|
1085
890
|
]);
|
|
1086
|
-
var RunSourceContextSchema =
|
|
1087
|
-
id:
|
|
1088
|
-
metadata:
|
|
891
|
+
var RunSourceContextSchema = zod.z.object({
|
|
892
|
+
id: zod.z.string(),
|
|
893
|
+
metadata: zod.z.any()
|
|
1089
894
|
});
|
|
1090
|
-
var AutoYieldConfigSchema =
|
|
1091
|
-
startTaskThreshold:
|
|
1092
|
-
beforeExecuteTaskThreshold:
|
|
1093
|
-
beforeCompleteTaskThreshold:
|
|
1094
|
-
afterCompleteTaskThreshold:
|
|
895
|
+
var AutoYieldConfigSchema = zod.z.object({
|
|
896
|
+
startTaskThreshold: zod.z.number(),
|
|
897
|
+
beforeExecuteTaskThreshold: zod.z.number(),
|
|
898
|
+
beforeCompleteTaskThreshold: zod.z.number(),
|
|
899
|
+
afterCompleteTaskThreshold: zod.z.number()
|
|
1095
900
|
});
|
|
1096
|
-
var RunJobBodySchema =
|
|
901
|
+
var RunJobBodySchema = zod.z.object({
|
|
1097
902
|
event: ApiEventLogSchema,
|
|
1098
|
-
job:
|
|
1099
|
-
id:
|
|
1100
|
-
version:
|
|
903
|
+
job: zod.z.object({
|
|
904
|
+
id: zod.z.string(),
|
|
905
|
+
version: zod.z.string()
|
|
1101
906
|
}),
|
|
1102
|
-
run:
|
|
1103
|
-
id:
|
|
1104
|
-
isTest:
|
|
1105
|
-
isRetry:
|
|
1106
|
-
startedAt:
|
|
907
|
+
run: zod.z.object({
|
|
908
|
+
id: zod.z.string(),
|
|
909
|
+
isTest: zod.z.boolean(),
|
|
910
|
+
isRetry: zod.z.boolean().default(false),
|
|
911
|
+
startedAt: zod.z.coerce.date()
|
|
1107
912
|
}),
|
|
1108
|
-
environment:
|
|
1109
|
-
id:
|
|
1110
|
-
slug:
|
|
913
|
+
environment: zod.z.object({
|
|
914
|
+
id: zod.z.string(),
|
|
915
|
+
slug: zod.z.string(),
|
|
1111
916
|
type: RuntimeEnvironmentTypeSchema
|
|
1112
917
|
}),
|
|
1113
|
-
organization:
|
|
1114
|
-
id:
|
|
1115
|
-
title:
|
|
1116
|
-
slug:
|
|
918
|
+
organization: zod.z.object({
|
|
919
|
+
id: zod.z.string(),
|
|
920
|
+
title: zod.z.string(),
|
|
921
|
+
slug: zod.z.string()
|
|
1117
922
|
}),
|
|
1118
|
-
|
|
1119
|
-
id:
|
|
1120
|
-
|
|
923
|
+
project: zod.z.object({
|
|
924
|
+
id: zod.z.string(),
|
|
925
|
+
name: zod.z.string(),
|
|
926
|
+
slug: zod.z.string()
|
|
927
|
+
}).optional(),
|
|
928
|
+
account: zod.z.object({
|
|
929
|
+
id: zod.z.string(),
|
|
930
|
+
metadata: zod.z.any()
|
|
1121
931
|
}).optional(),
|
|
1122
932
|
source: RunSourceContextSchema.optional(),
|
|
1123
|
-
tasks:
|
|
1124
|
-
cachedTaskCursor:
|
|
1125
|
-
noopTasksSet:
|
|
1126
|
-
connections:
|
|
1127
|
-
yieldedExecutions:
|
|
1128
|
-
runChunkExecutionLimit:
|
|
933
|
+
tasks: zod.z.array(CachedTaskSchema).optional(),
|
|
934
|
+
cachedTaskCursor: zod.z.string().optional(),
|
|
935
|
+
noopTasksSet: zod.z.string().optional(),
|
|
936
|
+
connections: zod.z.record(ConnectionAuthSchema).optional(),
|
|
937
|
+
yieldedExecutions: zod.z.string().array().optional(),
|
|
938
|
+
runChunkExecutionLimit: zod.z.number().optional(),
|
|
1129
939
|
autoYieldConfig: AutoYieldConfigSchema.optional()
|
|
1130
940
|
});
|
|
1131
|
-
var RunJobErrorSchema =
|
|
1132
|
-
status:
|
|
941
|
+
var RunJobErrorSchema = zod.z.object({
|
|
942
|
+
status: zod.z.literal("ERROR"),
|
|
1133
943
|
error: ErrorWithStackSchema,
|
|
1134
944
|
task: TaskSchema.optional()
|
|
1135
945
|
});
|
|
1136
|
-
var RunJobYieldExecutionErrorSchema =
|
|
1137
|
-
status:
|
|
1138
|
-
key:
|
|
1139
|
-
});
|
|
1140
|
-
var
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
issues: import_zod11.z.record(import_zod11.z.object({
|
|
1166
|
-
id: import_zod11.z.string(),
|
|
1167
|
-
error: import_zod11.z.string()
|
|
946
|
+
var RunJobYieldExecutionErrorSchema = zod.z.object({
|
|
947
|
+
status: zod.z.literal("YIELD_EXECUTION"),
|
|
948
|
+
key: zod.z.string()
|
|
949
|
+
});
|
|
950
|
+
var AutoYieldMetadataSchema = zod.z.object({
|
|
951
|
+
location: zod.z.string(),
|
|
952
|
+
timeRemaining: zod.z.number(),
|
|
953
|
+
timeElapsed: zod.z.number(),
|
|
954
|
+
limit: zod.z.number().optional()
|
|
955
|
+
});
|
|
956
|
+
var RunJobAutoYieldExecutionErrorSchema = AutoYieldMetadataSchema.extend({
|
|
957
|
+
status: zod.z.literal("AUTO_YIELD_EXECUTION")
|
|
958
|
+
});
|
|
959
|
+
var RunJobAutoYieldWithCompletedTaskExecutionErrorSchema = zod.z.object({
|
|
960
|
+
status: zod.z.literal("AUTO_YIELD_EXECUTION_WITH_COMPLETED_TASK"),
|
|
961
|
+
id: zod.z.string(),
|
|
962
|
+
properties: zod.z.array(DisplayPropertySchema).optional(),
|
|
963
|
+
output: zod.z.string().optional(),
|
|
964
|
+
data: AutoYieldMetadataSchema
|
|
965
|
+
});
|
|
966
|
+
var RunJobInvalidPayloadErrorSchema = zod.z.object({
|
|
967
|
+
status: zod.z.literal("INVALID_PAYLOAD"),
|
|
968
|
+
errors: zod.z.array(SchemaErrorSchema)
|
|
969
|
+
});
|
|
970
|
+
var RunJobUnresolvedAuthErrorSchema = zod.z.object({
|
|
971
|
+
status: zod.z.literal("UNRESOLVED_AUTH_ERROR"),
|
|
972
|
+
issues: zod.z.record(zod.z.object({
|
|
973
|
+
id: zod.z.string(),
|
|
974
|
+
error: zod.z.string()
|
|
1168
975
|
}))
|
|
1169
976
|
});
|
|
1170
|
-
var RunJobResumeWithTaskSchema =
|
|
1171
|
-
status:
|
|
977
|
+
var RunJobResumeWithTaskSchema = zod.z.object({
|
|
978
|
+
status: zod.z.literal("RESUME_WITH_TASK"),
|
|
1172
979
|
task: TaskSchema
|
|
1173
980
|
});
|
|
1174
|
-
var RunJobRetryWithTaskSchema =
|
|
1175
|
-
status:
|
|
981
|
+
var RunJobRetryWithTaskSchema = zod.z.object({
|
|
982
|
+
status: zod.z.literal("RETRY_WITH_TASK"),
|
|
1176
983
|
task: TaskSchema,
|
|
1177
984
|
error: ErrorWithStackSchema,
|
|
1178
|
-
retryAt:
|
|
985
|
+
retryAt: zod.z.coerce.date()
|
|
1179
986
|
});
|
|
1180
|
-
var RunJobCanceledWithTaskSchema =
|
|
1181
|
-
status:
|
|
987
|
+
var RunJobCanceledWithTaskSchema = zod.z.object({
|
|
988
|
+
status: zod.z.literal("CANCELED"),
|
|
1182
989
|
task: TaskSchema
|
|
1183
990
|
});
|
|
1184
|
-
var RunJobSuccessSchema =
|
|
1185
|
-
status:
|
|
991
|
+
var RunJobSuccessSchema = zod.z.object({
|
|
992
|
+
status: zod.z.literal("SUCCESS"),
|
|
1186
993
|
output: DeserializedJsonSchema.optional()
|
|
1187
994
|
});
|
|
1188
|
-
var
|
|
995
|
+
var RunJobErrorResponseSchema = zod.z.union([
|
|
1189
996
|
RunJobAutoYieldExecutionErrorSchema,
|
|
1190
997
|
RunJobAutoYieldWithCompletedTaskExecutionErrorSchema,
|
|
1191
998
|
RunJobYieldExecutionErrorSchema,
|
|
@@ -1194,138 +1001,157 @@ var RunJobResponseSchema = import_zod11.z.discriminatedUnion("status", [
|
|
|
1194
1001
|
RunJobInvalidPayloadErrorSchema,
|
|
1195
1002
|
RunJobResumeWithTaskSchema,
|
|
1196
1003
|
RunJobRetryWithTaskSchema,
|
|
1004
|
+
RunJobCanceledWithTaskSchema
|
|
1005
|
+
]);
|
|
1006
|
+
var RunJobResumeWithParallelTaskSchema = zod.z.object({
|
|
1007
|
+
status: zod.z.literal("RESUME_WITH_PARALLEL_TASK"),
|
|
1008
|
+
task: TaskSchema,
|
|
1009
|
+
childErrors: zod.z.array(RunJobErrorResponseSchema)
|
|
1010
|
+
});
|
|
1011
|
+
var RunJobResponseSchema = zod.z.discriminatedUnion("status", [
|
|
1012
|
+
RunJobAutoYieldExecutionErrorSchema,
|
|
1013
|
+
RunJobAutoYieldWithCompletedTaskExecutionErrorSchema,
|
|
1014
|
+
RunJobYieldExecutionErrorSchema,
|
|
1015
|
+
RunJobErrorSchema,
|
|
1016
|
+
RunJobUnresolvedAuthErrorSchema,
|
|
1017
|
+
RunJobInvalidPayloadErrorSchema,
|
|
1018
|
+
RunJobResumeWithTaskSchema,
|
|
1019
|
+
RunJobResumeWithParallelTaskSchema,
|
|
1020
|
+
RunJobRetryWithTaskSchema,
|
|
1197
1021
|
RunJobCanceledWithTaskSchema,
|
|
1198
1022
|
RunJobSuccessSchema
|
|
1199
1023
|
]);
|
|
1200
|
-
var PreprocessRunBodySchema =
|
|
1024
|
+
var PreprocessRunBodySchema = zod.z.object({
|
|
1201
1025
|
event: ApiEventLogSchema,
|
|
1202
|
-
job:
|
|
1203
|
-
id:
|
|
1204
|
-
version:
|
|
1026
|
+
job: zod.z.object({
|
|
1027
|
+
id: zod.z.string(),
|
|
1028
|
+
version: zod.z.string()
|
|
1205
1029
|
}),
|
|
1206
|
-
run:
|
|
1207
|
-
id:
|
|
1208
|
-
isTest:
|
|
1030
|
+
run: zod.z.object({
|
|
1031
|
+
id: zod.z.string(),
|
|
1032
|
+
isTest: zod.z.boolean()
|
|
1209
1033
|
}),
|
|
1210
|
-
environment:
|
|
1211
|
-
id:
|
|
1212
|
-
slug:
|
|
1034
|
+
environment: zod.z.object({
|
|
1035
|
+
id: zod.z.string(),
|
|
1036
|
+
slug: zod.z.string(),
|
|
1213
1037
|
type: RuntimeEnvironmentTypeSchema
|
|
1214
1038
|
}),
|
|
1215
|
-
organization:
|
|
1216
|
-
id:
|
|
1217
|
-
title:
|
|
1218
|
-
slug:
|
|
1039
|
+
organization: zod.z.object({
|
|
1040
|
+
id: zod.z.string(),
|
|
1041
|
+
title: zod.z.string(),
|
|
1042
|
+
slug: zod.z.string()
|
|
1219
1043
|
}),
|
|
1220
|
-
account:
|
|
1221
|
-
id:
|
|
1222
|
-
metadata:
|
|
1044
|
+
account: zod.z.object({
|
|
1045
|
+
id: zod.z.string(),
|
|
1046
|
+
metadata: zod.z.any()
|
|
1223
1047
|
}).optional()
|
|
1224
1048
|
});
|
|
1225
|
-
var PreprocessRunResponseSchema =
|
|
1226
|
-
abort:
|
|
1227
|
-
properties:
|
|
1049
|
+
var PreprocessRunResponseSchema = zod.z.object({
|
|
1050
|
+
abort: zod.z.boolean(),
|
|
1051
|
+
properties: zod.z.array(DisplayPropertySchema).optional()
|
|
1228
1052
|
});
|
|
1229
|
-
var CreateRunResponseOkSchema =
|
|
1230
|
-
ok:
|
|
1231
|
-
data:
|
|
1232
|
-
id:
|
|
1053
|
+
var CreateRunResponseOkSchema = zod.z.object({
|
|
1054
|
+
ok: zod.z.literal(true),
|
|
1055
|
+
data: zod.z.object({
|
|
1056
|
+
id: zod.z.string()
|
|
1233
1057
|
})
|
|
1234
1058
|
});
|
|
1235
|
-
var CreateRunResponseErrorSchema =
|
|
1236
|
-
ok:
|
|
1237
|
-
error:
|
|
1059
|
+
var CreateRunResponseErrorSchema = zod.z.object({
|
|
1060
|
+
ok: zod.z.literal(false),
|
|
1061
|
+
error: zod.z.string()
|
|
1238
1062
|
});
|
|
1239
|
-
var CreateRunResponseBodySchema =
|
|
1063
|
+
var CreateRunResponseBodySchema = zod.z.discriminatedUnion("ok", [
|
|
1240
1064
|
CreateRunResponseOkSchema,
|
|
1241
1065
|
CreateRunResponseErrorSchema
|
|
1242
1066
|
]);
|
|
1243
|
-
var RedactStringSchema =
|
|
1244
|
-
__redactedString:
|
|
1245
|
-
strings:
|
|
1246
|
-
interpolations:
|
|
1067
|
+
var RedactStringSchema = zod.z.object({
|
|
1068
|
+
__redactedString: zod.z.literal(true),
|
|
1069
|
+
strings: zod.z.array(zod.z.string()),
|
|
1070
|
+
interpolations: zod.z.array(zod.z.string())
|
|
1247
1071
|
});
|
|
1248
|
-
var LogMessageSchema =
|
|
1249
|
-
level:
|
|
1072
|
+
var LogMessageSchema = zod.z.object({
|
|
1073
|
+
level: zod.z.enum([
|
|
1250
1074
|
"DEBUG",
|
|
1251
1075
|
"INFO",
|
|
1252
1076
|
"WARN",
|
|
1253
1077
|
"ERROR"
|
|
1254
1078
|
]),
|
|
1255
|
-
message:
|
|
1079
|
+
message: zod.z.string(),
|
|
1256
1080
|
data: SerializableJsonSchema.optional()
|
|
1257
1081
|
});
|
|
1258
|
-
var RedactSchema =
|
|
1259
|
-
paths:
|
|
1082
|
+
var RedactSchema = zod.z.object({
|
|
1083
|
+
paths: zod.z.array(zod.z.string())
|
|
1260
1084
|
});
|
|
1261
|
-
var RetryOptionsSchema =
|
|
1085
|
+
var RetryOptionsSchema = zod.z.object({
|
|
1262
1086
|
/** The maximum number of times to retry the request. */
|
|
1263
|
-
limit:
|
|
1087
|
+
limit: zod.z.number().optional(),
|
|
1264
1088
|
/** The exponential factor to use when calculating the next retry time. */
|
|
1265
|
-
factor:
|
|
1089
|
+
factor: zod.z.number().optional(),
|
|
1266
1090
|
/** The minimum amount of time to wait before retrying the request. */
|
|
1267
|
-
minTimeoutInMs:
|
|
1091
|
+
minTimeoutInMs: zod.z.number().optional(),
|
|
1268
1092
|
/** The maximum amount of time to wait before retrying the request. */
|
|
1269
|
-
maxTimeoutInMs:
|
|
1093
|
+
maxTimeoutInMs: zod.z.number().optional(),
|
|
1270
1094
|
/** Whether to randomize the retry time. */
|
|
1271
|
-
randomize:
|
|
1095
|
+
randomize: zod.z.boolean().optional()
|
|
1272
1096
|
});
|
|
1273
|
-
var RunTaskOptionsSchema =
|
|
1097
|
+
var RunTaskOptionsSchema = zod.z.object({
|
|
1274
1098
|
/** The name of the Task is required. This is displayed on the Task in the logs. */
|
|
1275
|
-
name:
|
|
1099
|
+
name: zod.z.string().optional(),
|
|
1276
1100
|
/** The Task will wait and only start at the specified Date */
|
|
1277
|
-
delayUntil:
|
|
1101
|
+
delayUntil: zod.z.coerce.date().optional(),
|
|
1278
1102
|
/** Retry options */
|
|
1279
1103
|
retry: RetryOptionsSchema.optional(),
|
|
1280
1104
|
/** The icon for the Task, it will appear in the logs.
|
|
1281
1105
|
* You can use the name of a company in lowercase, e.g. "github".
|
|
1282
1106
|
* Or any icon name that [Tabler Icons](https://tabler-icons.io/) supports. */
|
|
1283
|
-
icon:
|
|
1107
|
+
icon: zod.z.string().optional(),
|
|
1284
1108
|
/** The key for the Task that you want to appear in the logs */
|
|
1285
|
-
displayKey:
|
|
1109
|
+
displayKey: zod.z.string().optional(),
|
|
1286
1110
|
/** A description of the Task */
|
|
1287
|
-
description:
|
|
1111
|
+
description: zod.z.string().optional(),
|
|
1288
1112
|
/** Properties that are displayed in the logs */
|
|
1289
|
-
properties:
|
|
1113
|
+
properties: zod.z.array(DisplayPropertySchema).optional(),
|
|
1290
1114
|
/** The input params to the Task, will be displayed in the logs */
|
|
1291
|
-
params:
|
|
1115
|
+
params: zod.z.any(),
|
|
1292
1116
|
/** The style of the log entry. */
|
|
1293
1117
|
style: StyleSchema.optional(),
|
|
1294
1118
|
/** Allows you to expose a `task.callbackUrl` to use in your tasks. Enabling this feature will cause the task to return the data sent to the callbackUrl instead of the usual async callback result. */
|
|
1295
|
-
callback:
|
|
1119
|
+
callback: zod.z.object({
|
|
1296
1120
|
/** Causes the task to wait for and return the data of the first request sent to `task.callbackUrl`. */
|
|
1297
|
-
enabled:
|
|
1121
|
+
enabled: zod.z.boolean(),
|
|
1298
1122
|
/** Time to wait for the first request to `task.callbackUrl`. Default: One hour. */
|
|
1299
|
-
timeoutInSeconds:
|
|
1123
|
+
timeoutInSeconds: zod.z.number()
|
|
1300
1124
|
}).partial().optional(),
|
|
1301
1125
|
/** Allows you to link the Integration connection in the logs. This is handled automatically in integrations. */
|
|
1302
|
-
connectionKey:
|
|
1303
|
-
/** An operation you want to perform on the Trigger.dev platform, current only "fetch" is supported. If you wish to `fetch` use [`io.backgroundFetch()`](https://trigger.dev/docs/sdk/io/backgroundfetch) instead. */
|
|
1304
|
-
operation:
|
|
1305
|
-
"fetch"
|
|
1126
|
+
connectionKey: zod.z.string().optional(),
|
|
1127
|
+
/** 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. */
|
|
1128
|
+
operation: zod.z.enum([
|
|
1129
|
+
"fetch",
|
|
1130
|
+
"fetch-response",
|
|
1131
|
+
"fetch-poll"
|
|
1306
1132
|
]).optional(),
|
|
1307
1133
|
/** A No Operation means that the code won't be executed. This is used internally to implement features like [io.wait()](https://trigger.dev/docs/sdk/io/wait). */
|
|
1308
|
-
noop:
|
|
1134
|
+
noop: zod.z.boolean().default(false),
|
|
1309
1135
|
redact: RedactSchema.optional(),
|
|
1310
|
-
|
|
1136
|
+
parallel: zod.z.boolean().optional()
|
|
1311
1137
|
});
|
|
1312
1138
|
var RunTaskBodyInputSchema = RunTaskOptionsSchema.extend({
|
|
1313
|
-
idempotencyKey:
|
|
1314
|
-
parentId:
|
|
1139
|
+
idempotencyKey: zod.z.string(),
|
|
1140
|
+
parentId: zod.z.string().optional()
|
|
1315
1141
|
});
|
|
1316
1142
|
var RunTaskBodyOutputSchema = RunTaskBodyInputSchema.extend({
|
|
1317
|
-
properties:
|
|
1143
|
+
properties: zod.z.array(DisplayPropertySchema.partial()).optional(),
|
|
1318
1144
|
params: DeserializedJsonSchema.optional().nullable(),
|
|
1319
|
-
callback:
|
|
1320
|
-
enabled:
|
|
1321
|
-
timeoutInSeconds:
|
|
1145
|
+
callback: zod.z.object({
|
|
1146
|
+
enabled: zod.z.boolean(),
|
|
1147
|
+
timeoutInSeconds: zod.z.number().default(3600)
|
|
1322
1148
|
}).optional()
|
|
1323
1149
|
});
|
|
1324
|
-
var RunTaskResponseWithCachedTasksBodySchema =
|
|
1150
|
+
var RunTaskResponseWithCachedTasksBodySchema = zod.z.object({
|
|
1325
1151
|
task: ServerTaskSchema,
|
|
1326
|
-
cachedTasks:
|
|
1327
|
-
tasks:
|
|
1328
|
-
cursor:
|
|
1152
|
+
cachedTasks: zod.z.object({
|
|
1153
|
+
tasks: zod.z.array(CachedTaskSchema),
|
|
1154
|
+
cursor: zod.z.string().optional()
|
|
1329
1155
|
}).optional()
|
|
1330
1156
|
});
|
|
1331
1157
|
var CompleteTaskBodyInputSchema = RunTaskBodyInputSchema.pick({
|
|
@@ -1335,202 +1161,286 @@ var CompleteTaskBodyInputSchema = RunTaskBodyInputSchema.pick({
|
|
|
1335
1161
|
}).extend({
|
|
1336
1162
|
output: SerializableJsonSchema.optional().transform((v) => v ? DeserializedJsonSchema.parse(JSON.parse(JSON.stringify(v))) : {})
|
|
1337
1163
|
});
|
|
1338
|
-
var
|
|
1164
|
+
var CompleteTaskBodyV2InputSchema = RunTaskBodyInputSchema.pick({
|
|
1165
|
+
properties: true,
|
|
1166
|
+
description: true,
|
|
1167
|
+
params: true
|
|
1168
|
+
}).extend({
|
|
1169
|
+
output: zod.z.string().optional()
|
|
1170
|
+
});
|
|
1171
|
+
var FailTaskBodyInputSchema = zod.z.object({
|
|
1339
1172
|
error: ErrorWithStackSchema
|
|
1340
1173
|
});
|
|
1341
|
-
var NormalizedRequestSchema =
|
|
1342
|
-
headers:
|
|
1343
|
-
method:
|
|
1344
|
-
query:
|
|
1345
|
-
url:
|
|
1346
|
-
body:
|
|
1174
|
+
var NormalizedRequestSchema = zod.z.object({
|
|
1175
|
+
headers: zod.z.record(zod.z.string()),
|
|
1176
|
+
method: zod.z.string(),
|
|
1177
|
+
query: zod.z.record(zod.z.string()),
|
|
1178
|
+
url: zod.z.string(),
|
|
1179
|
+
body: zod.z.any()
|
|
1347
1180
|
});
|
|
1348
|
-
var NormalizedResponseSchema =
|
|
1349
|
-
status:
|
|
1350
|
-
body:
|
|
1351
|
-
headers:
|
|
1181
|
+
var NormalizedResponseSchema = zod.z.object({
|
|
1182
|
+
status: zod.z.number(),
|
|
1183
|
+
body: zod.z.any(),
|
|
1184
|
+
headers: zod.z.record(zod.z.string()).optional()
|
|
1352
1185
|
});
|
|
1353
|
-
var HttpSourceResponseSchema =
|
|
1186
|
+
var HttpSourceResponseSchema = zod.z.object({
|
|
1354
1187
|
response: NormalizedResponseSchema,
|
|
1355
|
-
events:
|
|
1188
|
+
events: zod.z.array(RawEventSchema),
|
|
1356
1189
|
metadata: HttpSourceResponseMetadataSchema.optional()
|
|
1357
1190
|
});
|
|
1358
|
-
var
|
|
1191
|
+
var WebhookDeliveryResponseSchema = zod.z.object({
|
|
1192
|
+
response: NormalizedResponseSchema,
|
|
1193
|
+
verified: zod.z.boolean(),
|
|
1194
|
+
error: zod.z.string().optional()
|
|
1195
|
+
});
|
|
1196
|
+
var RegisterTriggerBodySchemaV1 = zod.z.object({
|
|
1359
1197
|
rule: EventRuleSchema,
|
|
1360
1198
|
source: SourceMetadataV1Schema
|
|
1361
1199
|
});
|
|
1362
|
-
var RegisterTriggerBodySchemaV2 =
|
|
1200
|
+
var RegisterTriggerBodySchemaV2 = zod.z.object({
|
|
1363
1201
|
rule: EventRuleSchema,
|
|
1364
1202
|
source: SourceMetadataV2Schema,
|
|
1365
|
-
accountId:
|
|
1203
|
+
accountId: zod.z.string().optional()
|
|
1366
1204
|
});
|
|
1367
|
-
var InitializeTriggerBodySchema =
|
|
1368
|
-
id:
|
|
1369
|
-
params:
|
|
1370
|
-
accountId:
|
|
1371
|
-
metadata:
|
|
1205
|
+
var InitializeTriggerBodySchema = zod.z.object({
|
|
1206
|
+
id: zod.z.string(),
|
|
1207
|
+
params: zod.z.any(),
|
|
1208
|
+
accountId: zod.z.string().optional(),
|
|
1209
|
+
metadata: zod.z.any().optional()
|
|
1372
1210
|
});
|
|
1373
|
-
var RegisterCommonScheduleBodySchema =
|
|
1211
|
+
var RegisterCommonScheduleBodySchema = zod.z.object({
|
|
1374
1212
|
/** A unique id for the schedule. This is used to identify and unregister the schedule later. */
|
|
1375
|
-
id:
|
|
1213
|
+
id: zod.z.string(),
|
|
1376
1214
|
/** Any additional metadata about the schedule. */
|
|
1377
|
-
metadata:
|
|
1215
|
+
metadata: zod.z.any(),
|
|
1378
1216
|
/** An optional Account ID to associate with runs triggered by this schedule */
|
|
1379
|
-
accountId:
|
|
1217
|
+
accountId: zod.z.string().optional()
|
|
1380
1218
|
});
|
|
1381
1219
|
var RegisterIntervalScheduleBodySchema = RegisterCommonScheduleBodySchema.merge(IntervalMetadataSchema);
|
|
1382
1220
|
var InitializeCronScheduleBodySchema = RegisterCommonScheduleBodySchema.merge(CronMetadataSchema);
|
|
1383
|
-
var RegisterScheduleBodySchema =
|
|
1221
|
+
var RegisterScheduleBodySchema = zod.z.discriminatedUnion("type", [
|
|
1384
1222
|
RegisterIntervalScheduleBodySchema,
|
|
1385
1223
|
InitializeCronScheduleBodySchema
|
|
1386
1224
|
]);
|
|
1387
|
-
var RegisterScheduleResponseBodySchema =
|
|
1388
|
-
id:
|
|
1225
|
+
var RegisterScheduleResponseBodySchema = zod.z.object({
|
|
1226
|
+
id: zod.z.string(),
|
|
1389
1227
|
schedule: ScheduleMetadataSchema,
|
|
1390
|
-
metadata:
|
|
1391
|
-
active:
|
|
1228
|
+
metadata: zod.z.any(),
|
|
1229
|
+
active: zod.z.boolean()
|
|
1392
1230
|
});
|
|
1393
|
-
var CreateExternalConnectionBodySchema =
|
|
1394
|
-
accessToken:
|
|
1395
|
-
type:
|
|
1231
|
+
var CreateExternalConnectionBodySchema = zod.z.object({
|
|
1232
|
+
accessToken: zod.z.string(),
|
|
1233
|
+
type: zod.z.enum([
|
|
1396
1234
|
"oauth2"
|
|
1397
1235
|
]),
|
|
1398
|
-
scopes:
|
|
1399
|
-
metadata:
|
|
1236
|
+
scopes: zod.z.array(zod.z.string()).optional(),
|
|
1237
|
+
metadata: zod.z.any()
|
|
1400
1238
|
});
|
|
1401
|
-
var GetRunStatusesSchema =
|
|
1402
|
-
run:
|
|
1403
|
-
id:
|
|
1239
|
+
var GetRunStatusesSchema = zod.z.object({
|
|
1240
|
+
run: zod.z.object({
|
|
1241
|
+
id: zod.z.string(),
|
|
1404
1242
|
status: RunStatusSchema,
|
|
1405
|
-
output:
|
|
1243
|
+
output: zod.z.any().optional()
|
|
1406
1244
|
}),
|
|
1407
|
-
statuses:
|
|
1245
|
+
statuses: zod.z.array(JobRunStatusRecordSchema)
|
|
1408
1246
|
});
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1247
|
+
var InvokeJobResponseSchema = zod.z.object({
|
|
1248
|
+
id: zod.z.string()
|
|
1249
|
+
});
|
|
1250
|
+
var InvokeJobRequestBodySchema = zod.z.object({
|
|
1251
|
+
payload: zod.z.any(),
|
|
1252
|
+
context: zod.z.any().optional(),
|
|
1253
|
+
options: zod.z.object({
|
|
1254
|
+
accountId: zod.z.string().optional(),
|
|
1255
|
+
callbackUrl: zod.z.string().optional()
|
|
1256
|
+
}).optional()
|
|
1257
|
+
});
|
|
1258
|
+
var InvokeOptionsSchema = zod.z.object({
|
|
1259
|
+
accountId: zod.z.string().optional(),
|
|
1260
|
+
idempotencyKey: zod.z.string().optional(),
|
|
1261
|
+
context: zod.z.any().optional(),
|
|
1262
|
+
callbackUrl: zod.z.string().optional()
|
|
1263
|
+
});
|
|
1264
|
+
var EphemeralEventDispatcherRequestBodySchema = zod.z.object({
|
|
1265
|
+
url: zod.z.string(),
|
|
1266
|
+
name: zod.z.string().or(zod.z.array(zod.z.string())),
|
|
1267
|
+
source: zod.z.string().optional(),
|
|
1268
|
+
filter: EventFilterSchema.optional(),
|
|
1269
|
+
contextFilter: EventFilterSchema.optional(),
|
|
1270
|
+
accountId: zod.z.string().optional(),
|
|
1271
|
+
timeoutInSeconds: zod.z.number().int().positive().min(10).max(60 * 60 * 24 * 365).default(3600)
|
|
1272
|
+
});
|
|
1273
|
+
var EphemeralEventDispatcherResponseBodySchema = zod.z.object({
|
|
1274
|
+
id: zod.z.string()
|
|
1275
|
+
});
|
|
1276
|
+
var KeyValueStoreResponseBodySchema = zod.z.discriminatedUnion("action", [
|
|
1277
|
+
zod.z.object({
|
|
1278
|
+
action: zod.z.literal("DELETE"),
|
|
1279
|
+
key: zod.z.string(),
|
|
1280
|
+
deleted: zod.z.boolean()
|
|
1281
|
+
}),
|
|
1282
|
+
zod.z.object({
|
|
1283
|
+
action: zod.z.literal("GET"),
|
|
1284
|
+
key: zod.z.string(),
|
|
1285
|
+
value: zod.z.string().optional()
|
|
1286
|
+
}),
|
|
1287
|
+
zod.z.object({
|
|
1288
|
+
action: zod.z.literal("HAS"),
|
|
1289
|
+
key: zod.z.string(),
|
|
1290
|
+
has: zod.z.boolean()
|
|
1291
|
+
}),
|
|
1292
|
+
zod.z.object({
|
|
1293
|
+
action: zod.z.literal("SET"),
|
|
1294
|
+
key: zod.z.string(),
|
|
1295
|
+
value: zod.z.string().optional()
|
|
1296
|
+
})
|
|
1297
|
+
]);
|
|
1412
1298
|
var MISSING_CONNECTION_NOTIFICATION = "dev.trigger.notifications.missingConnection";
|
|
1413
1299
|
var MISSING_CONNECTION_RESOLVED_NOTIFICATION = "dev.trigger.notifications.missingConnectionResolved";
|
|
1414
|
-
var CommonMissingConnectionNotificationPayloadSchema =
|
|
1415
|
-
id:
|
|
1416
|
-
client:
|
|
1417
|
-
id:
|
|
1418
|
-
title:
|
|
1419
|
-
scopes:
|
|
1420
|
-
createdAt:
|
|
1421
|
-
updatedAt:
|
|
1300
|
+
var CommonMissingConnectionNotificationPayloadSchema = zod.z.object({
|
|
1301
|
+
id: zod.z.string(),
|
|
1302
|
+
client: zod.z.object({
|
|
1303
|
+
id: zod.z.string(),
|
|
1304
|
+
title: zod.z.string(),
|
|
1305
|
+
scopes: zod.z.array(zod.z.string()),
|
|
1306
|
+
createdAt: zod.z.coerce.date(),
|
|
1307
|
+
updatedAt: zod.z.coerce.date()
|
|
1422
1308
|
}),
|
|
1423
|
-
authorizationUrl:
|
|
1309
|
+
authorizationUrl: zod.z.string()
|
|
1424
1310
|
});
|
|
1425
1311
|
var MissingDeveloperConnectionNotificationPayloadSchema = CommonMissingConnectionNotificationPayloadSchema.extend({
|
|
1426
|
-
type:
|
|
1312
|
+
type: zod.z.literal("DEVELOPER")
|
|
1427
1313
|
});
|
|
1428
1314
|
var MissingExternalConnectionNotificationPayloadSchema = CommonMissingConnectionNotificationPayloadSchema.extend({
|
|
1429
|
-
type:
|
|
1430
|
-
account:
|
|
1431
|
-
id:
|
|
1432
|
-
metadata:
|
|
1315
|
+
type: zod.z.literal("EXTERNAL"),
|
|
1316
|
+
account: zod.z.object({
|
|
1317
|
+
id: zod.z.string(),
|
|
1318
|
+
metadata: zod.z.any()
|
|
1433
1319
|
})
|
|
1434
1320
|
});
|
|
1435
|
-
var MissingConnectionNotificationPayloadSchema =
|
|
1321
|
+
var MissingConnectionNotificationPayloadSchema = zod.z.discriminatedUnion("type", [
|
|
1436
1322
|
MissingDeveloperConnectionNotificationPayloadSchema,
|
|
1437
1323
|
MissingExternalConnectionNotificationPayloadSchema
|
|
1438
1324
|
]);
|
|
1439
|
-
var CommonMissingConnectionNotificationResolvedPayloadSchema =
|
|
1440
|
-
id:
|
|
1441
|
-
client:
|
|
1442
|
-
id:
|
|
1443
|
-
title:
|
|
1444
|
-
scopes:
|
|
1445
|
-
createdAt:
|
|
1446
|
-
updatedAt:
|
|
1447
|
-
integrationIdentifier:
|
|
1448
|
-
integrationAuthMethod:
|
|
1325
|
+
var CommonMissingConnectionNotificationResolvedPayloadSchema = zod.z.object({
|
|
1326
|
+
id: zod.z.string(),
|
|
1327
|
+
client: zod.z.object({
|
|
1328
|
+
id: zod.z.string(),
|
|
1329
|
+
title: zod.z.string(),
|
|
1330
|
+
scopes: zod.z.array(zod.z.string()),
|
|
1331
|
+
createdAt: zod.z.coerce.date(),
|
|
1332
|
+
updatedAt: zod.z.coerce.date(),
|
|
1333
|
+
integrationIdentifier: zod.z.string(),
|
|
1334
|
+
integrationAuthMethod: zod.z.string()
|
|
1449
1335
|
}),
|
|
1450
|
-
expiresAt:
|
|
1336
|
+
expiresAt: zod.z.coerce.date()
|
|
1451
1337
|
});
|
|
1452
1338
|
var MissingDeveloperConnectionResolvedNotificationPayloadSchema = CommonMissingConnectionNotificationResolvedPayloadSchema.extend({
|
|
1453
|
-
type:
|
|
1339
|
+
type: zod.z.literal("DEVELOPER")
|
|
1454
1340
|
});
|
|
1455
1341
|
var MissingExternalConnectionResolvedNotificationPayloadSchema = CommonMissingConnectionNotificationResolvedPayloadSchema.extend({
|
|
1456
|
-
type:
|
|
1457
|
-
account:
|
|
1458
|
-
id:
|
|
1459
|
-
metadata:
|
|
1342
|
+
type: zod.z.literal("EXTERNAL"),
|
|
1343
|
+
account: zod.z.object({
|
|
1344
|
+
id: zod.z.string(),
|
|
1345
|
+
metadata: zod.z.any()
|
|
1460
1346
|
})
|
|
1461
1347
|
});
|
|
1462
|
-
var MissingConnectionResolvedNotificationPayloadSchema =
|
|
1348
|
+
var MissingConnectionResolvedNotificationPayloadSchema = zod.z.discriminatedUnion("type", [
|
|
1463
1349
|
MissingDeveloperConnectionResolvedNotificationPayloadSchema,
|
|
1464
1350
|
MissingExternalConnectionResolvedNotificationPayloadSchema
|
|
1465
1351
|
]);
|
|
1466
|
-
|
|
1467
|
-
// src/schemas/fetch.ts
|
|
1468
|
-
var import_zod13 = require("zod");
|
|
1469
|
-
var FetchRetryHeadersStrategySchema = import_zod13.z.object({
|
|
1352
|
+
var FetchRetryHeadersStrategySchema = zod.z.object({
|
|
1470
1353
|
/** The `headers` strategy retries the request using info from the response headers. */
|
|
1471
|
-
strategy:
|
|
1354
|
+
strategy: zod.z.literal("headers"),
|
|
1472
1355
|
/** The header to use to determine the maximum number of times to retry the request. */
|
|
1473
|
-
limitHeader:
|
|
1356
|
+
limitHeader: zod.z.string(),
|
|
1474
1357
|
/** The header to use to determine the number of remaining retries. */
|
|
1475
|
-
remainingHeader:
|
|
1358
|
+
remainingHeader: zod.z.string(),
|
|
1476
1359
|
/** The header to use to determine the time when the number of remaining retries will be reset. */
|
|
1477
|
-
resetHeader:
|
|
1360
|
+
resetHeader: zod.z.string(),
|
|
1361
|
+
/** The event filter to use to determine if the request should be retried. */
|
|
1362
|
+
bodyFilter: EventFilterSchema.optional(),
|
|
1363
|
+
/** The format of the `resetHeader` value. */
|
|
1364
|
+
resetFormat: zod.z.enum([
|
|
1365
|
+
"unix_timestamp",
|
|
1366
|
+
"unix_timestamp_in_ms",
|
|
1367
|
+
"iso_8601",
|
|
1368
|
+
"iso_8601_duration_openai_variant"
|
|
1369
|
+
]).default("unix_timestamp")
|
|
1478
1370
|
});
|
|
1479
1371
|
var FetchRetryBackoffStrategySchema = RetryOptionsSchema.extend({
|
|
1480
1372
|
/** The `backoff` strategy retries the request with an exponential backoff. */
|
|
1481
|
-
strategy:
|
|
1373
|
+
strategy: zod.z.literal("backoff"),
|
|
1374
|
+
/** The event filter to use to determine if the request should be retried. */
|
|
1375
|
+
bodyFilter: EventFilterSchema.optional()
|
|
1482
1376
|
});
|
|
1483
|
-
var FetchRetryStrategySchema =
|
|
1377
|
+
var FetchRetryStrategySchema = zod.z.discriminatedUnion("strategy", [
|
|
1484
1378
|
FetchRetryHeadersStrategySchema,
|
|
1485
1379
|
FetchRetryBackoffStrategySchema
|
|
1486
1380
|
]);
|
|
1487
|
-
var FetchRequestInitSchema =
|
|
1381
|
+
var FetchRequestInitSchema = zod.z.object({
|
|
1488
1382
|
/** The HTTP method to use for the request. */
|
|
1489
|
-
method:
|
|
1383
|
+
method: zod.z.string().optional(),
|
|
1490
1384
|
/** Any headers to send with the request. Note that you can use [redactString](https://trigger.dev/docs/sdk/redactString) to prevent sensitive information from being stored (e.g. in the logs), like API keys and tokens. */
|
|
1491
|
-
headers:
|
|
1492
|
-
|
|
1385
|
+
headers: zod.z.record(zod.z.union([
|
|
1386
|
+
zod.z.string(),
|
|
1493
1387
|
RedactStringSchema
|
|
1494
1388
|
])).optional(),
|
|
1495
1389
|
/** The body of the request. */
|
|
1496
|
-
body:
|
|
1497
|
-
|
|
1498
|
-
|
|
1390
|
+
body: zod.z.union([
|
|
1391
|
+
zod.z.string(),
|
|
1392
|
+
zod.z.instanceof(ArrayBuffer)
|
|
1499
1393
|
]).optional()
|
|
1500
1394
|
});
|
|
1501
|
-
var FetchRetryOptionsSchema =
|
|
1502
|
-
var
|
|
1503
|
-
|
|
1395
|
+
var FetchRetryOptionsSchema = zod.z.record(FetchRetryStrategySchema);
|
|
1396
|
+
var FetchTimeoutOptionsSchema = zod.z.object({
|
|
1397
|
+
durationInMs: zod.z.number(),
|
|
1398
|
+
retry: RetryOptionsSchema.optional()
|
|
1399
|
+
});
|
|
1400
|
+
var FetchOperationSchema = zod.z.object({
|
|
1401
|
+
url: zod.z.string(),
|
|
1402
|
+
requestInit: FetchRequestInitSchema.optional(),
|
|
1403
|
+
retry: zod.z.record(FetchRetryStrategySchema).optional(),
|
|
1404
|
+
timeout: FetchTimeoutOptionsSchema.optional()
|
|
1405
|
+
});
|
|
1406
|
+
var FetchPollOperationSchema = zod.z.object({
|
|
1407
|
+
url: zod.z.string(),
|
|
1408
|
+
interval: zod.z.number().int().positive().min(10).max(600).default(10),
|
|
1409
|
+
timeout: zod.z.number().int().positive().min(30).max(3600).default(600),
|
|
1410
|
+
responseFilter: ResponseFilterSchema,
|
|
1504
1411
|
requestInit: FetchRequestInitSchema.optional(),
|
|
1505
|
-
|
|
1412
|
+
requestTimeout: FetchTimeoutOptionsSchema.optional()
|
|
1506
1413
|
});
|
|
1507
|
-
|
|
1508
|
-
// src/schemas/events.ts
|
|
1509
|
-
var import_zod14 = require("zod");
|
|
1510
|
-
var GetEventSchema = import_zod14.z.object({
|
|
1414
|
+
var GetEventSchema = zod.z.object({
|
|
1511
1415
|
/** The event id */
|
|
1512
|
-
id:
|
|
1416
|
+
id: zod.z.string(),
|
|
1513
1417
|
/** The event name */
|
|
1514
|
-
name:
|
|
1418
|
+
name: zod.z.string(),
|
|
1515
1419
|
/** When the event was created */
|
|
1516
|
-
createdAt:
|
|
1420
|
+
createdAt: zod.z.coerce.date(),
|
|
1517
1421
|
/** When the event was last updated */
|
|
1518
|
-
updatedAt:
|
|
1422
|
+
updatedAt: zod.z.coerce.date(),
|
|
1519
1423
|
/** The runs that were triggered by the event */
|
|
1520
|
-
runs:
|
|
1424
|
+
runs: zod.z.array(zod.z.object({
|
|
1521
1425
|
/** The Run id */
|
|
1522
|
-
id:
|
|
1426
|
+
id: zod.z.string(),
|
|
1523
1427
|
/** The Run status */
|
|
1524
1428
|
status: RunStatusSchema,
|
|
1525
1429
|
/** When the run started */
|
|
1526
|
-
startedAt:
|
|
1430
|
+
startedAt: zod.z.coerce.date().optional().nullable(),
|
|
1527
1431
|
/** When the run completed */
|
|
1528
|
-
completedAt:
|
|
1432
|
+
completedAt: zod.z.coerce.date().optional().nullable()
|
|
1529
1433
|
}))
|
|
1530
1434
|
});
|
|
1531
|
-
var CancelRunsForEventSchema =
|
|
1532
|
-
cancelledRunIds:
|
|
1533
|
-
failedToCancelRunIds:
|
|
1435
|
+
var CancelRunsForEventSchema = zod.z.object({
|
|
1436
|
+
cancelledRunIds: zod.z.array(zod.z.string()),
|
|
1437
|
+
failedToCancelRunIds: zod.z.array(zod.z.string())
|
|
1438
|
+
});
|
|
1439
|
+
var RequestWithRawBodySchema = zod.z.object({
|
|
1440
|
+
url: zod.z.string(),
|
|
1441
|
+
method: zod.z.string(),
|
|
1442
|
+
headers: zod.z.record(zod.z.string()),
|
|
1443
|
+
rawBody: zod.z.string()
|
|
1534
1444
|
});
|
|
1535
1445
|
|
|
1536
1446
|
// src/utils.ts
|
|
@@ -1552,6 +1462,10 @@ function deepMergeFilters(...filters) {
|
|
|
1552
1462
|
return result;
|
|
1553
1463
|
}
|
|
1554
1464
|
__name(deepMergeFilters, "deepMergeFilters");
|
|
1465
|
+
function assertExhaustive(x) {
|
|
1466
|
+
throw new Error("Unexpected object: " + x);
|
|
1467
|
+
}
|
|
1468
|
+
__name(assertExhaustive, "assertExhaustive");
|
|
1555
1469
|
|
|
1556
1470
|
// src/retry.ts
|
|
1557
1471
|
var DEFAULT_RETRY_OPTIONS = {
|
|
@@ -1576,6 +1490,73 @@ function calculateRetryAt(retryOptions, attempts) {
|
|
|
1576
1490
|
return new Date(Date.now() + timeoutInMs);
|
|
1577
1491
|
}
|
|
1578
1492
|
__name(calculateRetryAt, "calculateRetryAt");
|
|
1493
|
+
function calculateResetAt(resets, format, now = /* @__PURE__ */ new Date()) {
|
|
1494
|
+
if (!resets)
|
|
1495
|
+
return;
|
|
1496
|
+
switch (format) {
|
|
1497
|
+
case "iso_8601_duration_openai_variant": {
|
|
1498
|
+
return calculateISO8601DurationOpenAIVariantResetAt(resets, now);
|
|
1499
|
+
}
|
|
1500
|
+
case "iso_8601": {
|
|
1501
|
+
return calculateISO8601ResetAt(resets, now);
|
|
1502
|
+
}
|
|
1503
|
+
case "unix_timestamp": {
|
|
1504
|
+
return calculateUnixTimestampResetAt(resets, now);
|
|
1505
|
+
}
|
|
1506
|
+
case "unix_timestamp_in_ms": {
|
|
1507
|
+
return calculateUnixTimestampInMsResetAt(resets, now);
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
}
|
|
1511
|
+
__name(calculateResetAt, "calculateResetAt");
|
|
1512
|
+
function calculateUnixTimestampResetAt(resets, now = /* @__PURE__ */ new Date()) {
|
|
1513
|
+
if (!resets)
|
|
1514
|
+
return void 0;
|
|
1515
|
+
const resetAt = parseInt(resets, 10);
|
|
1516
|
+
if (isNaN(resetAt))
|
|
1517
|
+
return void 0;
|
|
1518
|
+
return new Date(resetAt * 1e3);
|
|
1519
|
+
}
|
|
1520
|
+
__name(calculateUnixTimestampResetAt, "calculateUnixTimestampResetAt");
|
|
1521
|
+
function calculateUnixTimestampInMsResetAt(resets, now = /* @__PURE__ */ new Date()) {
|
|
1522
|
+
if (!resets)
|
|
1523
|
+
return void 0;
|
|
1524
|
+
const resetAt = parseInt(resets, 10);
|
|
1525
|
+
if (isNaN(resetAt))
|
|
1526
|
+
return void 0;
|
|
1527
|
+
return new Date(resetAt);
|
|
1528
|
+
}
|
|
1529
|
+
__name(calculateUnixTimestampInMsResetAt, "calculateUnixTimestampInMsResetAt");
|
|
1530
|
+
function calculateISO8601ResetAt(resets, now = /* @__PURE__ */ new Date()) {
|
|
1531
|
+
if (!resets)
|
|
1532
|
+
return void 0;
|
|
1533
|
+
const resetAt = new Date(resets);
|
|
1534
|
+
if (isNaN(resetAt.getTime()))
|
|
1535
|
+
return void 0;
|
|
1536
|
+
return resetAt;
|
|
1537
|
+
}
|
|
1538
|
+
__name(calculateISO8601ResetAt, "calculateISO8601ResetAt");
|
|
1539
|
+
function calculateISO8601DurationOpenAIVariantResetAt(resets, now = /* @__PURE__ */ new Date()) {
|
|
1540
|
+
if (!resets)
|
|
1541
|
+
return void 0;
|
|
1542
|
+
const pattern = /^(?:(\d+)d)?(?:(\d+)h)?(?:(\d+)m)?(?:(\d+(?:\.\d+)?)s)?(?:(\d+)ms)?$/;
|
|
1543
|
+
const match = resets.match(pattern);
|
|
1544
|
+
if (!match)
|
|
1545
|
+
return void 0;
|
|
1546
|
+
const days = parseInt(match[1], 10) || 0;
|
|
1547
|
+
const hours = parseInt(match[2], 10) || 0;
|
|
1548
|
+
const minutes = parseInt(match[3], 10) || 0;
|
|
1549
|
+
const seconds = parseFloat(match[4]) || 0;
|
|
1550
|
+
const milliseconds = parseInt(match[5], 10) || 0;
|
|
1551
|
+
const resetAt = new Date(now);
|
|
1552
|
+
resetAt.setDate(resetAt.getDate() + days);
|
|
1553
|
+
resetAt.setHours(resetAt.getHours() + hours);
|
|
1554
|
+
resetAt.setMinutes(resetAt.getMinutes() + minutes);
|
|
1555
|
+
resetAt.setSeconds(resetAt.getSeconds() + Math.floor(seconds));
|
|
1556
|
+
resetAt.setMilliseconds(resetAt.getMilliseconds() + (seconds - Math.floor(seconds)) * 1e3 + milliseconds);
|
|
1557
|
+
return resetAt;
|
|
1558
|
+
}
|
|
1559
|
+
__name(calculateISO8601DurationOpenAIVariantResetAt, "calculateISO8601DurationOpenAIVariantResetAt");
|
|
1579
1560
|
|
|
1580
1561
|
// src/replacements.ts
|
|
1581
1562
|
var currentDate = {
|
|
@@ -1617,6 +1598,13 @@ __name(urlWithSearchParams, "urlWithSearchParams");
|
|
|
1617
1598
|
|
|
1618
1599
|
// src/eventFilterMatches.ts
|
|
1619
1600
|
function eventFilterMatches(payload, filter) {
|
|
1601
|
+
if (payload === void 0 || payload === null) {
|
|
1602
|
+
if (Object.entries(filter).length === 0) {
|
|
1603
|
+
return true;
|
|
1604
|
+
} else {
|
|
1605
|
+
return false;
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1620
1608
|
for (const [patternKey, patternValue] of Object.entries(filter)) {
|
|
1621
1609
|
const payloadValue = payload[patternKey];
|
|
1622
1610
|
if (Array.isArray(patternValue)) {
|
|
@@ -1664,7 +1652,7 @@ __name(eventFilterMatches, "eventFilterMatches");
|
|
|
1664
1652
|
function contentFiltersMatches(actualValue, contentFilters) {
|
|
1665
1653
|
for (const contentFilter of contentFilters) {
|
|
1666
1654
|
if (typeof contentFilter === "object") {
|
|
1667
|
-
|
|
1655
|
+
Object.entries(contentFilter)[0];
|
|
1668
1656
|
if (!contentFilterMatches(actualValue, contentFilter)) {
|
|
1669
1657
|
return false;
|
|
1670
1658
|
}
|
|
@@ -1757,9 +1745,82 @@ function contentFilterMatches(actualValue, contentFilter) {
|
|
|
1757
1745
|
}
|
|
1758
1746
|
__name(contentFilterMatches, "contentFilterMatches");
|
|
1759
1747
|
|
|
1748
|
+
// src/requestFilterMatches.ts
|
|
1749
|
+
async function requestFilterMatches(request, filter) {
|
|
1750
|
+
const clonedRequest = request.clone();
|
|
1751
|
+
if (!requestMethodMatches(clonedRequest.method, filter.method)) {
|
|
1752
|
+
return false;
|
|
1753
|
+
}
|
|
1754
|
+
const headersObj = Object.fromEntries(clonedRequest.headers.entries());
|
|
1755
|
+
if (filter.headers && !eventFilterMatches(headersObj, filter.headers)) {
|
|
1756
|
+
return false;
|
|
1757
|
+
}
|
|
1758
|
+
const searchParams = new URL(clonedRequest.url).searchParams;
|
|
1759
|
+
const searchParamsObject = {};
|
|
1760
|
+
for (const [key, value] of searchParams.entries()) {
|
|
1761
|
+
searchParamsObject[key] = value;
|
|
1762
|
+
}
|
|
1763
|
+
if (filter.query && !eventFilterMatches(searchParamsObject, filter.query)) {
|
|
1764
|
+
return false;
|
|
1765
|
+
}
|
|
1766
|
+
try {
|
|
1767
|
+
const json = await clonedRequest.json();
|
|
1768
|
+
if (filter.body && !eventFilterMatches(json, filter.body)) {
|
|
1769
|
+
return false;
|
|
1770
|
+
}
|
|
1771
|
+
} catch (e) {
|
|
1772
|
+
if (filter.body) {
|
|
1773
|
+
return false;
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1776
|
+
return true;
|
|
1777
|
+
}
|
|
1778
|
+
__name(requestFilterMatches, "requestFilterMatches");
|
|
1779
|
+
async function responseFilterMatches(response, filter) {
|
|
1780
|
+
if (filter.headers && !eventFilterMatches(response.headers, filter.headers)) {
|
|
1781
|
+
return {
|
|
1782
|
+
match: false
|
|
1783
|
+
};
|
|
1784
|
+
}
|
|
1785
|
+
try {
|
|
1786
|
+
const json = await response.json();
|
|
1787
|
+
if (filter.body && !eventFilterMatches(json, filter.body)) {
|
|
1788
|
+
return {
|
|
1789
|
+
match: false,
|
|
1790
|
+
body: json
|
|
1791
|
+
};
|
|
1792
|
+
} else {
|
|
1793
|
+
return {
|
|
1794
|
+
match: true,
|
|
1795
|
+
body: json
|
|
1796
|
+
};
|
|
1797
|
+
}
|
|
1798
|
+
} catch (e) {
|
|
1799
|
+
if (filter.body) {
|
|
1800
|
+
return {
|
|
1801
|
+
match: false,
|
|
1802
|
+
body: void 0
|
|
1803
|
+
};
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1806
|
+
return {
|
|
1807
|
+
match: true,
|
|
1808
|
+
body: void 0
|
|
1809
|
+
};
|
|
1810
|
+
}
|
|
1811
|
+
__name(responseFilterMatches, "responseFilterMatches");
|
|
1812
|
+
function requestMethodMatches(method, filter) {
|
|
1813
|
+
if (!filter) {
|
|
1814
|
+
return true;
|
|
1815
|
+
}
|
|
1816
|
+
return filter.includes(method);
|
|
1817
|
+
}
|
|
1818
|
+
__name(requestMethodMatches, "requestMethodMatches");
|
|
1819
|
+
|
|
1760
1820
|
// src/index.ts
|
|
1761
1821
|
var API_VERSIONS = {
|
|
1762
|
-
LAZY_LOADED_CACHED_TASKS: "2023-09-29"
|
|
1822
|
+
LAZY_LOADED_CACHED_TASKS: "2023-09-29",
|
|
1823
|
+
SERIALIZED_TASK_OUTPUT: "2023-11-01"
|
|
1763
1824
|
};
|
|
1764
1825
|
var PLATFORM_FEATURES = {
|
|
1765
1826
|
yieldExecution: API_VERSIONS.LAZY_LOADED_CACHED_TASKS,
|
|
@@ -1776,4 +1837,185 @@ function supportsFeature(featureName, version) {
|
|
|
1776
1837
|
return version >= supportedVersion;
|
|
1777
1838
|
}
|
|
1778
1839
|
__name(supportsFeature, "supportsFeature");
|
|
1840
|
+
|
|
1841
|
+
exports.API_VERSIONS = API_VERSIONS;
|
|
1842
|
+
exports.ApiEventLogSchema = ApiEventLogSchema;
|
|
1843
|
+
exports.AutoYieldConfigSchema = AutoYieldConfigSchema;
|
|
1844
|
+
exports.AutoYieldMetadataSchema = AutoYieldMetadataSchema;
|
|
1845
|
+
exports.CachedTaskSchema = CachedTaskSchema;
|
|
1846
|
+
exports.CancelRunsForEventSchema = CancelRunsForEventSchema;
|
|
1847
|
+
exports.CommonMissingConnectionNotificationPayloadSchema = CommonMissingConnectionNotificationPayloadSchema;
|
|
1848
|
+
exports.CommonMissingConnectionNotificationResolvedPayloadSchema = CommonMissingConnectionNotificationResolvedPayloadSchema;
|
|
1849
|
+
exports.CompleteTaskBodyInputSchema = CompleteTaskBodyInputSchema;
|
|
1850
|
+
exports.CompleteTaskBodyV2InputSchema = CompleteTaskBodyV2InputSchema;
|
|
1851
|
+
exports.ConcurrencyLimitOptionsSchema = ConcurrencyLimitOptionsSchema;
|
|
1852
|
+
exports.ConnectionAuthSchema = ConnectionAuthSchema;
|
|
1853
|
+
exports.CreateExternalConnectionBodySchema = CreateExternalConnectionBodySchema;
|
|
1854
|
+
exports.CreateRunResponseBodySchema = CreateRunResponseBodySchema;
|
|
1855
|
+
exports.CronMetadataSchema = CronMetadataSchema;
|
|
1856
|
+
exports.CronOptionsSchema = CronOptionsSchema;
|
|
1857
|
+
exports.DELIVER_WEBHOOK_REQUEST = DELIVER_WEBHOOK_REQUEST;
|
|
1858
|
+
exports.DeliverEventResponseSchema = DeliverEventResponseSchema;
|
|
1859
|
+
exports.DeserializedJsonSchema = DeserializedJsonSchema;
|
|
1860
|
+
exports.DisplayPropertiesSchema = DisplayPropertiesSchema;
|
|
1861
|
+
exports.DisplayPropertySchema = DisplayPropertySchema;
|
|
1862
|
+
exports.DynamicTriggerEndpointMetadataSchema = DynamicTriggerEndpointMetadataSchema;
|
|
1863
|
+
exports.DynamicTriggerMetadataSchema = DynamicTriggerMetadataSchema;
|
|
1864
|
+
exports.EndpointHeadersSchema = EndpointHeadersSchema;
|
|
1865
|
+
exports.EndpointIndexErrorSchema = EndpointIndexErrorSchema;
|
|
1866
|
+
exports.EphemeralEventDispatcherRequestBodySchema = EphemeralEventDispatcherRequestBodySchema;
|
|
1867
|
+
exports.EphemeralEventDispatcherResponseBodySchema = EphemeralEventDispatcherResponseBodySchema;
|
|
1868
|
+
exports.ErrorWithStackSchema = ErrorWithStackSchema;
|
|
1869
|
+
exports.EventExampleSchema = EventExampleSchema;
|
|
1870
|
+
exports.EventFilterSchema = EventFilterSchema;
|
|
1871
|
+
exports.EventRuleSchema = EventRuleSchema;
|
|
1872
|
+
exports.EventSpecificationSchema = EventSpecificationSchema;
|
|
1873
|
+
exports.ExecuteJobHeadersSchema = ExecuteJobHeadersSchema;
|
|
1874
|
+
exports.ExecuteJobRunMetadataSchema = ExecuteJobRunMetadataSchema;
|
|
1875
|
+
exports.FailTaskBodyInputSchema = FailTaskBodyInputSchema;
|
|
1876
|
+
exports.FetchOperationSchema = FetchOperationSchema;
|
|
1877
|
+
exports.FetchPollOperationSchema = FetchPollOperationSchema;
|
|
1878
|
+
exports.FetchRequestInitSchema = FetchRequestInitSchema;
|
|
1879
|
+
exports.FetchRetryBackoffStrategySchema = FetchRetryBackoffStrategySchema;
|
|
1880
|
+
exports.FetchRetryHeadersStrategySchema = FetchRetryHeadersStrategySchema;
|
|
1881
|
+
exports.FetchRetryOptionsSchema = FetchRetryOptionsSchema;
|
|
1882
|
+
exports.FetchRetryStrategySchema = FetchRetryStrategySchema;
|
|
1883
|
+
exports.FetchTimeoutOptionsSchema = FetchTimeoutOptionsSchema;
|
|
1884
|
+
exports.GetEndpointIndexResponseSchema = GetEndpointIndexResponseSchema;
|
|
1885
|
+
exports.GetEventSchema = GetEventSchema;
|
|
1886
|
+
exports.GetRunSchema = GetRunSchema;
|
|
1887
|
+
exports.GetRunStatusesSchema = GetRunStatusesSchema;
|
|
1888
|
+
exports.GetRunsSchema = GetRunsSchema;
|
|
1889
|
+
exports.HTTPMethodUnionSchema = HTTPMethodUnionSchema;
|
|
1890
|
+
exports.HandleTriggerSourceSchema = HandleTriggerSourceSchema;
|
|
1891
|
+
exports.HttpEndpointRequestHeadersSchema = HttpEndpointRequestHeadersSchema;
|
|
1892
|
+
exports.HttpSourceRequestHeadersSchema = HttpSourceRequestHeadersSchema;
|
|
1893
|
+
exports.HttpSourceResponseSchema = HttpSourceResponseSchema;
|
|
1894
|
+
exports.IndexEndpointResponseSchema = IndexEndpointResponseSchema;
|
|
1895
|
+
exports.InitializeCronScheduleBodySchema = InitializeCronScheduleBodySchema;
|
|
1896
|
+
exports.InitializeTriggerBodySchema = InitializeTriggerBodySchema;
|
|
1897
|
+
exports.IntegrationConfigSchema = IntegrationConfigSchema;
|
|
1898
|
+
exports.IntegrationMetadataSchema = IntegrationMetadataSchema;
|
|
1899
|
+
exports.IntervalMetadataSchema = IntervalMetadataSchema;
|
|
1900
|
+
exports.IntervalOptionsSchema = IntervalOptionsSchema;
|
|
1901
|
+
exports.InvokeJobRequestBodySchema = InvokeJobRequestBodySchema;
|
|
1902
|
+
exports.InvokeJobResponseSchema = InvokeJobResponseSchema;
|
|
1903
|
+
exports.InvokeOptionsSchema = InvokeOptionsSchema;
|
|
1904
|
+
exports.InvokeTriggerMetadataSchema = InvokeTriggerMetadataSchema;
|
|
1905
|
+
exports.JobMetadataSchema = JobMetadataSchema;
|
|
1906
|
+
exports.JobRunStatusRecordSchema = JobRunStatusRecordSchema;
|
|
1907
|
+
exports.KeyValueStoreResponseBodySchema = KeyValueStoreResponseBodySchema;
|
|
1908
|
+
exports.LogMessageSchema = LogMessageSchema;
|
|
1909
|
+
exports.MISSING_CONNECTION_NOTIFICATION = MISSING_CONNECTION_NOTIFICATION;
|
|
1910
|
+
exports.MISSING_CONNECTION_RESOLVED_NOTIFICATION = MISSING_CONNECTION_RESOLVED_NOTIFICATION;
|
|
1911
|
+
exports.MissingConnectionNotificationPayloadSchema = MissingConnectionNotificationPayloadSchema;
|
|
1912
|
+
exports.MissingConnectionResolvedNotificationPayloadSchema = MissingConnectionResolvedNotificationPayloadSchema;
|
|
1913
|
+
exports.MissingDeveloperConnectionNotificationPayloadSchema = MissingDeveloperConnectionNotificationPayloadSchema;
|
|
1914
|
+
exports.MissingDeveloperConnectionResolvedNotificationPayloadSchema = MissingDeveloperConnectionResolvedNotificationPayloadSchema;
|
|
1915
|
+
exports.MissingExternalConnectionNotificationPayloadSchema = MissingExternalConnectionNotificationPayloadSchema;
|
|
1916
|
+
exports.MissingExternalConnectionResolvedNotificationPayloadSchema = MissingExternalConnectionResolvedNotificationPayloadSchema;
|
|
1917
|
+
exports.NormalizedRequestSchema = NormalizedRequestSchema;
|
|
1918
|
+
exports.NormalizedResponseSchema = NormalizedResponseSchema;
|
|
1919
|
+
exports.PLATFORM_FEATURES = PLATFORM_FEATURES;
|
|
1920
|
+
exports.PongErrorResponseSchema = PongErrorResponseSchema;
|
|
1921
|
+
exports.PongResponseSchema = PongResponseSchema;
|
|
1922
|
+
exports.PongSuccessResponseSchema = PongSuccessResponseSchema;
|
|
1923
|
+
exports.PreprocessRunBodySchema = PreprocessRunBodySchema;
|
|
1924
|
+
exports.PreprocessRunResponseSchema = PreprocessRunResponseSchema;
|
|
1925
|
+
exports.QueueOptionsSchema = QueueOptionsSchema;
|
|
1926
|
+
exports.REGISTER_SOURCE_EVENT_V1 = REGISTER_SOURCE_EVENT_V1;
|
|
1927
|
+
exports.REGISTER_SOURCE_EVENT_V2 = REGISTER_SOURCE_EVENT_V2;
|
|
1928
|
+
exports.REGISTER_WEBHOOK = REGISTER_WEBHOOK;
|
|
1929
|
+
exports.RawEventSchema = RawEventSchema;
|
|
1930
|
+
exports.RedactSchema = RedactSchema;
|
|
1931
|
+
exports.RedactStringSchema = RedactStringSchema;
|
|
1932
|
+
exports.RegisterDynamicSchedulePayloadSchema = RegisterDynamicSchedulePayloadSchema;
|
|
1933
|
+
exports.RegisterHTTPTriggerSourceBodySchema = RegisterHTTPTriggerSourceBodySchema;
|
|
1934
|
+
exports.RegisterIntervalScheduleBodySchema = RegisterIntervalScheduleBodySchema;
|
|
1935
|
+
exports.RegisterSMTPTriggerSourceBodySchema = RegisterSMTPTriggerSourceBodySchema;
|
|
1936
|
+
exports.RegisterSQSTriggerSourceBodySchema = RegisterSQSTriggerSourceBodySchema;
|
|
1937
|
+
exports.RegisterScheduleBodySchema = RegisterScheduleBodySchema;
|
|
1938
|
+
exports.RegisterScheduleResponseBodySchema = RegisterScheduleResponseBodySchema;
|
|
1939
|
+
exports.RegisterSourceChannelBodySchema = RegisterSourceChannelBodySchema;
|
|
1940
|
+
exports.RegisterSourceEventSchemaV1 = RegisterSourceEventSchemaV1;
|
|
1941
|
+
exports.RegisterSourceEventSchemaV2 = RegisterSourceEventSchemaV2;
|
|
1942
|
+
exports.RegisterTriggerBodySchemaV1 = RegisterTriggerBodySchemaV1;
|
|
1943
|
+
exports.RegisterTriggerBodySchemaV2 = RegisterTriggerBodySchemaV2;
|
|
1944
|
+
exports.RegisterTriggerSourceSchema = RegisterTriggerSourceSchema;
|
|
1945
|
+
exports.RegisterWebhookPayloadSchema = RegisterWebhookPayloadSchema;
|
|
1946
|
+
exports.RegisterWebhookSourceSchema = RegisterWebhookSourceSchema;
|
|
1947
|
+
exports.RequestFilterSchema = RequestFilterSchema;
|
|
1948
|
+
exports.RequestWithRawBodySchema = RequestWithRawBodySchema;
|
|
1949
|
+
exports.ResponseFilterSchema = ResponseFilterSchema;
|
|
1950
|
+
exports.RetryOptionsSchema = RetryOptionsSchema;
|
|
1951
|
+
exports.RunJobAutoYieldExecutionErrorSchema = RunJobAutoYieldExecutionErrorSchema;
|
|
1952
|
+
exports.RunJobAutoYieldWithCompletedTaskExecutionErrorSchema = RunJobAutoYieldWithCompletedTaskExecutionErrorSchema;
|
|
1953
|
+
exports.RunJobBodySchema = RunJobBodySchema;
|
|
1954
|
+
exports.RunJobCanceledWithTaskSchema = RunJobCanceledWithTaskSchema;
|
|
1955
|
+
exports.RunJobErrorResponseSchema = RunJobErrorResponseSchema;
|
|
1956
|
+
exports.RunJobErrorSchema = RunJobErrorSchema;
|
|
1957
|
+
exports.RunJobInvalidPayloadErrorSchema = RunJobInvalidPayloadErrorSchema;
|
|
1958
|
+
exports.RunJobResponseSchema = RunJobResponseSchema;
|
|
1959
|
+
exports.RunJobResumeWithParallelTaskSchema = RunJobResumeWithParallelTaskSchema;
|
|
1960
|
+
exports.RunJobResumeWithTaskSchema = RunJobResumeWithTaskSchema;
|
|
1961
|
+
exports.RunJobRetryWithTaskSchema = RunJobRetryWithTaskSchema;
|
|
1962
|
+
exports.RunJobSuccessSchema = RunJobSuccessSchema;
|
|
1963
|
+
exports.RunJobUnresolvedAuthErrorSchema = RunJobUnresolvedAuthErrorSchema;
|
|
1964
|
+
exports.RunJobYieldExecutionErrorSchema = RunJobYieldExecutionErrorSchema;
|
|
1965
|
+
exports.RunSourceContextSchema = RunSourceContextSchema;
|
|
1966
|
+
exports.RunStatusSchema = RunStatusSchema;
|
|
1967
|
+
exports.RunTaskBodyInputSchema = RunTaskBodyInputSchema;
|
|
1968
|
+
exports.RunTaskBodyOutputSchema = RunTaskBodyOutputSchema;
|
|
1969
|
+
exports.RunTaskOptionsSchema = RunTaskOptionsSchema;
|
|
1970
|
+
exports.RunTaskResponseWithCachedTasksBodySchema = RunTaskResponseWithCachedTasksBodySchema;
|
|
1971
|
+
exports.RunTaskSchema = RunTaskSchema;
|
|
1972
|
+
exports.RuntimeEnvironmentTypeSchema = RuntimeEnvironmentTypeSchema;
|
|
1973
|
+
exports.SCHEDULED_EVENT = SCHEDULED_EVENT;
|
|
1974
|
+
exports.ScheduleMetadataSchema = ScheduleMetadataSchema;
|
|
1975
|
+
exports.ScheduledPayloadSchema = ScheduledPayloadSchema;
|
|
1976
|
+
exports.ScheduledTriggerMetadataSchema = ScheduledTriggerMetadataSchema;
|
|
1977
|
+
exports.SchemaErrorSchema = SchemaErrorSchema;
|
|
1978
|
+
exports.SendBulkEventsBodySchema = SendBulkEventsBodySchema;
|
|
1979
|
+
exports.SendEventBodySchema = SendEventBodySchema;
|
|
1980
|
+
exports.SendEventOptionsSchema = SendEventOptionsSchema;
|
|
1981
|
+
exports.SerializableJsonSchema = SerializableJsonSchema;
|
|
1982
|
+
exports.ServerTaskSchema = ServerTaskSchema;
|
|
1983
|
+
exports.SourceMetadataV2Schema = SourceMetadataV2Schema;
|
|
1984
|
+
exports.StaticTriggerMetadataSchema = StaticTriggerMetadataSchema;
|
|
1985
|
+
exports.StatusHistorySchema = StatusHistorySchema;
|
|
1986
|
+
exports.StatusUpdateSchema = StatusUpdateSchema;
|
|
1987
|
+
exports.StatusUpdateStateSchema = StatusUpdateStateSchema;
|
|
1988
|
+
exports.StyleSchema = StyleSchema;
|
|
1989
|
+
exports.TaskSchema = TaskSchema;
|
|
1990
|
+
exports.TaskStatusSchema = TaskStatusSchema;
|
|
1991
|
+
exports.TriggerHelpSchema = TriggerHelpSchema;
|
|
1992
|
+
exports.TriggerMetadataSchema = TriggerMetadataSchema;
|
|
1993
|
+
exports.TriggerSourceSchema = TriggerSourceSchema;
|
|
1994
|
+
exports.UpdateTriggerSourceBodyV1Schema = UpdateTriggerSourceBodyV1Schema;
|
|
1995
|
+
exports.UpdateTriggerSourceBodyV2Schema = UpdateTriggerSourceBodyV2Schema;
|
|
1996
|
+
exports.UpdateWebhookBodySchema = UpdateWebhookBodySchema;
|
|
1997
|
+
exports.ValidateErrorResponseSchema = ValidateErrorResponseSchema;
|
|
1998
|
+
exports.ValidateResponseSchema = ValidateResponseSchema;
|
|
1999
|
+
exports.ValidateSuccessResponseSchema = ValidateSuccessResponseSchema;
|
|
2000
|
+
exports.WebhookContextMetadataSchema = WebhookContextMetadataSchema;
|
|
2001
|
+
exports.WebhookDeliveryResponseSchema = WebhookDeliveryResponseSchema;
|
|
2002
|
+
exports.WebhookMetadataSchema = WebhookMetadataSchema;
|
|
2003
|
+
exports.WebhookSourceRequestHeadersSchema = WebhookSourceRequestHeadersSchema;
|
|
2004
|
+
exports.addMissingVersionField = addMissingVersionField;
|
|
2005
|
+
exports.assertExhaustive = assertExhaustive;
|
|
2006
|
+
exports.calculateResetAt = calculateResetAt;
|
|
2007
|
+
exports.calculateRetryAt = calculateRetryAt;
|
|
2008
|
+
exports.currentDate = currentDate;
|
|
2009
|
+
exports.currentTimestampMilliseconds = currentTimestampMilliseconds;
|
|
2010
|
+
exports.currentTimestampSeconds = currentTimestampSeconds;
|
|
2011
|
+
exports.deepMergeFilters = deepMergeFilters;
|
|
2012
|
+
exports.eventFilterMatches = eventFilterMatches;
|
|
2013
|
+
exports.parseEndpointIndexStats = parseEndpointIndexStats;
|
|
2014
|
+
exports.replacements = replacements;
|
|
2015
|
+
exports.requestFilterMatches = requestFilterMatches;
|
|
2016
|
+
exports.responseFilterMatches = responseFilterMatches;
|
|
2017
|
+
exports.stringPatternMatchers = stringPatternMatchers;
|
|
2018
|
+
exports.supportsFeature = supportsFeature;
|
|
2019
|
+
exports.urlWithSearchParams = urlWithSearchParams;
|
|
2020
|
+
//# sourceMappingURL=out.js.map
|
|
1779
2021
|
//# sourceMappingURL=index.js.map
|