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