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