@opentabs-dev/opentabs-plugin-fiverr 0.0.109 → 0.0.110
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/adapter.iife.js +1723 -1722
- package/dist/adapter.iife.js.map +4 -4
- package/dist/tools.json +1 -1
- package/package.json +3 -3
package/dist/adapter.iife.js
CHANGED
|
@@ -6,451 +6,6 @@
|
|
|
6
6
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
// node_modules/@opentabs-dev/shared/dist/error.js
|
|
10
|
-
var toErrorMessage = (err2) => err2 instanceof Error ? err2.message : String(err2);
|
|
11
|
-
|
|
12
|
-
// node_modules/@opentabs-dev/plugin-sdk/dist/errors.js
|
|
13
|
-
var ToolError = class _ToolError extends Error {
|
|
14
|
-
code;
|
|
15
|
-
/** Whether this error is retryable (defaults to false). */
|
|
16
|
-
retryable;
|
|
17
|
-
/** Suggested delay before retrying, in milliseconds. */
|
|
18
|
-
retryAfterMs;
|
|
19
|
-
/** Error category for structured error classification. */
|
|
20
|
-
category;
|
|
21
|
-
constructor(message, code, opts) {
|
|
22
|
-
super(message);
|
|
23
|
-
this.code = code;
|
|
24
|
-
this.name = "ToolError";
|
|
25
|
-
this.retryable = opts?.retryable ?? false;
|
|
26
|
-
this.retryAfterMs = opts?.retryAfterMs;
|
|
27
|
-
this.category = opts?.category;
|
|
28
|
-
}
|
|
29
|
-
/** Authentication or authorization error (not retryable). Accepts an optional domain-specific code. */
|
|
30
|
-
static auth(message, code) {
|
|
31
|
-
return new _ToolError(message, code ?? "AUTH_ERROR", { category: "auth", retryable: false });
|
|
32
|
-
}
|
|
33
|
-
/** Resource not found (not retryable). Accepts an optional domain-specific code. */
|
|
34
|
-
static notFound(message, code) {
|
|
35
|
-
return new _ToolError(message, code ?? "NOT_FOUND", { category: "not_found", retryable: false });
|
|
36
|
-
}
|
|
37
|
-
/** Rate limited (retryable). Accepts an optional retry delay in milliseconds and an optional domain-specific code. */
|
|
38
|
-
static rateLimited(message, retryAfterMs, code) {
|
|
39
|
-
return new _ToolError(message, code ?? "RATE_LIMITED", { category: "rate_limit", retryable: true, retryAfterMs });
|
|
40
|
-
}
|
|
41
|
-
/** Input validation error (not retryable). Accepts an optional domain-specific code. */
|
|
42
|
-
static validation(message, code) {
|
|
43
|
-
return new _ToolError(message, code ?? "VALIDATION_ERROR", { category: "validation", retryable: false });
|
|
44
|
-
}
|
|
45
|
-
/** Operation timed out (retryable). Accepts an optional domain-specific code. */
|
|
46
|
-
static timeout(message, code) {
|
|
47
|
-
return new _ToolError(message, code ?? "TIMEOUT", { category: "timeout", retryable: true });
|
|
48
|
-
}
|
|
49
|
-
/** Internal/unexpected error (not retryable). Accepts an optional domain-specific code. */
|
|
50
|
-
static internal(message, code) {
|
|
51
|
-
return new _ToolError(message, code ?? "INTERNAL_ERROR", { category: "internal", retryable: false });
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
// node_modules/@opentabs-dev/plugin-sdk/dist/fetch.js
|
|
56
|
-
var MAX_ERROR_BODY_LENGTH = 512;
|
|
57
|
-
var httpStatusToToolError = (response, message) => {
|
|
58
|
-
const status = response.status;
|
|
59
|
-
if (status === 401 || status === 403) {
|
|
60
|
-
return ToolError.auth(message);
|
|
61
|
-
}
|
|
62
|
-
if (status === 404) {
|
|
63
|
-
return ToolError.notFound(message);
|
|
64
|
-
}
|
|
65
|
-
if (status === 429) {
|
|
66
|
-
const retryAfter = response.headers.get("Retry-After");
|
|
67
|
-
const retryAfterMs = retryAfter !== null ? parseRetryAfterMs(retryAfter) : void 0;
|
|
68
|
-
return ToolError.rateLimited(message, retryAfterMs);
|
|
69
|
-
}
|
|
70
|
-
if (status === 400 || status === 422) {
|
|
71
|
-
return ToolError.validation(message);
|
|
72
|
-
}
|
|
73
|
-
if (status === 408) {
|
|
74
|
-
return ToolError.timeout(message);
|
|
75
|
-
}
|
|
76
|
-
if (status >= 500) {
|
|
77
|
-
const TRANSIENT_5XX = /* @__PURE__ */ new Set([500, 502, 503, 504]);
|
|
78
|
-
const retryable = TRANSIENT_5XX.has(status);
|
|
79
|
-
const retryAfter = status === 503 ? response.headers.get("Retry-After") : null;
|
|
80
|
-
const retryAfterMs = retryAfter !== null ? parseRetryAfterMs(retryAfter) : void 0;
|
|
81
|
-
return new ToolError(message, "http_error", { category: "internal", retryable, retryAfterMs });
|
|
82
|
-
}
|
|
83
|
-
if (status >= 400 && status < 500) {
|
|
84
|
-
return new ToolError(message, "http_error", { retryable: false });
|
|
85
|
-
}
|
|
86
|
-
return new ToolError(message, "http_error", { category: "internal" });
|
|
87
|
-
};
|
|
88
|
-
var parseRetryAfterMs = (value) => {
|
|
89
|
-
const seconds = Number(value);
|
|
90
|
-
if (!Number.isNaN(seconds) && seconds >= 0) {
|
|
91
|
-
return seconds * 1e3;
|
|
92
|
-
}
|
|
93
|
-
const date5 = Date.parse(value);
|
|
94
|
-
if (!Number.isNaN(date5)) {
|
|
95
|
-
const ms = date5 - Date.now();
|
|
96
|
-
return ms > 0 ? ms : void 0;
|
|
97
|
-
}
|
|
98
|
-
return void 0;
|
|
99
|
-
};
|
|
100
|
-
var buildQueryString = (params) => {
|
|
101
|
-
const searchParams = new URLSearchParams();
|
|
102
|
-
for (const [key, value] of Object.entries(params)) {
|
|
103
|
-
if (value === void 0)
|
|
104
|
-
continue;
|
|
105
|
-
if (Array.isArray(value)) {
|
|
106
|
-
for (const item of value) {
|
|
107
|
-
searchParams.append(key, String(item));
|
|
108
|
-
}
|
|
109
|
-
} else {
|
|
110
|
-
searchParams.append(key, String(value));
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
return searchParams.toString();
|
|
114
|
-
};
|
|
115
|
-
var fetchFromPage = async (url2, init) => {
|
|
116
|
-
const { timeout = 3e4, signal, ...rest } = init ?? {};
|
|
117
|
-
const timeoutSignal = AbortSignal.timeout(timeout);
|
|
118
|
-
const combinedSignal = signal ? AbortSignal.any([signal, timeoutSignal]) : timeoutSignal;
|
|
119
|
-
let response;
|
|
120
|
-
try {
|
|
121
|
-
response = await fetch(url2, {
|
|
122
|
-
credentials: "include",
|
|
123
|
-
...rest,
|
|
124
|
-
signal: combinedSignal
|
|
125
|
-
});
|
|
126
|
-
} catch (error51) {
|
|
127
|
-
if (error51 instanceof DOMException && error51.name === "TimeoutError") {
|
|
128
|
-
throw ToolError.timeout(`fetchFromPage: request timed out after ${timeout}ms for ${url2}`);
|
|
129
|
-
}
|
|
130
|
-
if (combinedSignal.aborted) {
|
|
131
|
-
throw new ToolError(`fetchFromPage: request aborted for ${url2}`, "aborted");
|
|
132
|
-
}
|
|
133
|
-
throw new ToolError(`fetchFromPage: network error for ${url2}: ${toErrorMessage(error51)}`, "network_error", {
|
|
134
|
-
category: "internal",
|
|
135
|
-
retryable: true
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
if (!response.ok) {
|
|
139
|
-
const rawText = await response.text().catch(() => response.statusText);
|
|
140
|
-
const errorText = rawText.length > MAX_ERROR_BODY_LENGTH ? `${rawText.slice(0, MAX_ERROR_BODY_LENGTH)}\u2026` : rawText;
|
|
141
|
-
const msg = `fetchFromPage: HTTP ${response.status} for ${url2}: ${errorText}`;
|
|
142
|
-
throw httpStatusToToolError(response, msg);
|
|
143
|
-
}
|
|
144
|
-
return response;
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
// node_modules/@opentabs-dev/plugin-sdk/dist/timing.js
|
|
148
|
-
var waitUntil = (predicate, opts) => {
|
|
149
|
-
const interval = opts?.interval ?? 200;
|
|
150
|
-
const timeout = opts?.timeout ?? 1e4;
|
|
151
|
-
const signal = opts?.signal;
|
|
152
|
-
const abortReason = () => signal?.reason instanceof Error ? signal.reason : new Error("waitUntil: aborted");
|
|
153
|
-
if (signal?.aborted)
|
|
154
|
-
return Promise.reject(abortReason());
|
|
155
|
-
return new Promise((resolve, reject) => {
|
|
156
|
-
let settled = false;
|
|
157
|
-
let poller;
|
|
158
|
-
let lastPredicateError;
|
|
159
|
-
const isSettled = () => settled;
|
|
160
|
-
const cleanup = () => {
|
|
161
|
-
settled = true;
|
|
162
|
-
clearTimeout(timer);
|
|
163
|
-
clearTimeout(poller);
|
|
164
|
-
signal?.removeEventListener("abort", onAbort);
|
|
165
|
-
};
|
|
166
|
-
const onAbort = () => {
|
|
167
|
-
if (isSettled())
|
|
168
|
-
return;
|
|
169
|
-
cleanup();
|
|
170
|
-
reject(abortReason());
|
|
171
|
-
};
|
|
172
|
-
signal?.addEventListener("abort", onAbort, { once: true });
|
|
173
|
-
const timer = setTimeout(() => {
|
|
174
|
-
if (isSettled())
|
|
175
|
-
return;
|
|
176
|
-
cleanup();
|
|
177
|
-
const errorContext = lastPredicateError instanceof Error ? `: predicate last threw \u2014 ${lastPredicateError.message}` : "";
|
|
178
|
-
reject(new Error(`waitUntil: timed out after ${timeout}ms waiting for predicate to return true${errorContext}`));
|
|
179
|
-
}, timeout);
|
|
180
|
-
const check2 = async () => {
|
|
181
|
-
if (isSettled())
|
|
182
|
-
return;
|
|
183
|
-
try {
|
|
184
|
-
const result = await predicate();
|
|
185
|
-
if (result) {
|
|
186
|
-
cleanup();
|
|
187
|
-
resolve();
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
} catch (err2) {
|
|
191
|
-
lastPredicateError = err2;
|
|
192
|
-
}
|
|
193
|
-
if (!isSettled()) {
|
|
194
|
-
poller = setTimeout(() => void check2(), interval);
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
void check2();
|
|
198
|
-
});
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
// node_modules/@opentabs-dev/plugin-sdk/dist/log.js
|
|
202
|
-
var MAX_DATA_LENGTH = 10;
|
|
203
|
-
var MAX_STRING_LENGTH = 4096;
|
|
204
|
-
var MAX_SERIALIZED_SIZE = 64 * 1024;
|
|
205
|
-
var safeSerializeArg = (value) => {
|
|
206
|
-
try {
|
|
207
|
-
if (value === null || value === void 0)
|
|
208
|
-
return value;
|
|
209
|
-
const type = typeof value;
|
|
210
|
-
if (type === "boolean" || type === "number")
|
|
211
|
-
return value;
|
|
212
|
-
if (type === "string") {
|
|
213
|
-
return value.length > MAX_STRING_LENGTH ? `${value.slice(0, MAX_STRING_LENGTH)}\u2026` : value;
|
|
214
|
-
}
|
|
215
|
-
if (type === "function")
|
|
216
|
-
return `[Function: ${value.name || "anonymous"}]`;
|
|
217
|
-
if (type === "symbol")
|
|
218
|
-
return `[Symbol: ${value.description ?? ""}]`;
|
|
219
|
-
if (type === "bigint")
|
|
220
|
-
return `[BigInt: ${value.toString()}]`;
|
|
221
|
-
if (typeof value.nodeType === "number" && typeof value.nodeName === "string") {
|
|
222
|
-
try {
|
|
223
|
-
const node = value;
|
|
224
|
-
let classStr = "";
|
|
225
|
-
if (typeof node.className === "string") {
|
|
226
|
-
classStr = node.className ? `.${node.className.split(" ")[0] ?? ""}` : "";
|
|
227
|
-
} else if (node.className !== null && typeof node.className === "object") {
|
|
228
|
-
const baseVal = node.className.baseVal;
|
|
229
|
-
if (typeof baseVal === "string") {
|
|
230
|
-
classStr = baseVal ? `.${baseVal.split(" ")[0] ?? ""}` : "";
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
return `[${node.nodeName}${node.id ? `#${node.id}` : ""}${classStr}]`;
|
|
234
|
-
} catch {
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
if (value instanceof Error) {
|
|
238
|
-
return { name: value.name, message: value.message, stack: value.stack };
|
|
239
|
-
}
|
|
240
|
-
if (value instanceof WeakRef)
|
|
241
|
-
return "[WeakRef]";
|
|
242
|
-
if (value instanceof WeakMap)
|
|
243
|
-
return "[WeakMap]";
|
|
244
|
-
if (value instanceof WeakSet)
|
|
245
|
-
return "[WeakSet]";
|
|
246
|
-
if (value instanceof ArrayBuffer)
|
|
247
|
-
return "[ArrayBuffer]";
|
|
248
|
-
if (typeof SharedArrayBuffer !== "undefined" && value instanceof SharedArrayBuffer)
|
|
249
|
-
return "[SharedArrayBuffer]";
|
|
250
|
-
try {
|
|
251
|
-
const seen = /* @__PURE__ */ new WeakSet();
|
|
252
|
-
const json2 = JSON.stringify(value, (_key, v) => {
|
|
253
|
-
if (typeof v === "object" && v !== null) {
|
|
254
|
-
if (seen.has(v))
|
|
255
|
-
return "[Circular]";
|
|
256
|
-
seen.add(v);
|
|
257
|
-
}
|
|
258
|
-
if (typeof v === "function")
|
|
259
|
-
return `[Function: ${v.name || "anonymous"}]`;
|
|
260
|
-
if (typeof v === "bigint")
|
|
261
|
-
return `[BigInt: ${v.toString()}]`;
|
|
262
|
-
if (typeof v === "symbol")
|
|
263
|
-
return `[Symbol: ${v.description ?? ""}]`;
|
|
264
|
-
if (v instanceof WeakRef)
|
|
265
|
-
return "[WeakRef]";
|
|
266
|
-
if (v instanceof WeakMap)
|
|
267
|
-
return "[WeakMap]";
|
|
268
|
-
if (v instanceof WeakSet)
|
|
269
|
-
return "[WeakSet]";
|
|
270
|
-
if (v instanceof ArrayBuffer)
|
|
271
|
-
return "[ArrayBuffer]";
|
|
272
|
-
if (typeof SharedArrayBuffer !== "undefined" && v instanceof SharedArrayBuffer)
|
|
273
|
-
return "[SharedArrayBuffer]";
|
|
274
|
-
return v;
|
|
275
|
-
});
|
|
276
|
-
if (json2.length > MAX_SERIALIZED_SIZE) {
|
|
277
|
-
return `[Object truncated: ${json2.length} chars]`;
|
|
278
|
-
}
|
|
279
|
-
return JSON.parse(json2);
|
|
280
|
-
} catch {
|
|
281
|
-
return `[Unserializable: ${typeof value}]`;
|
|
282
|
-
}
|
|
283
|
-
} catch {
|
|
284
|
-
return `[Unserializable: ${typeof value}]`;
|
|
285
|
-
}
|
|
286
|
-
};
|
|
287
|
-
var safeSerialize = (args) => {
|
|
288
|
-
const capped = args.length > MAX_DATA_LENGTH ? args.slice(0, MAX_DATA_LENGTH) : args;
|
|
289
|
-
return capped.map(safeSerializeArg);
|
|
290
|
-
};
|
|
291
|
-
var CONSOLE_METHODS = {
|
|
292
|
-
debug: "debug",
|
|
293
|
-
info: "info",
|
|
294
|
-
warning: "warn",
|
|
295
|
-
error: "error"
|
|
296
|
-
};
|
|
297
|
-
var defaultTransport = (entry) => {
|
|
298
|
-
const method = CONSOLE_METHODS[entry.level];
|
|
299
|
-
console[method](`[sdk.log] ${entry.message}`, ...entry.data);
|
|
300
|
-
};
|
|
301
|
-
var activeTransport = defaultTransport;
|
|
302
|
-
var _setLogTransport = (transport) => {
|
|
303
|
-
const previous = activeTransport;
|
|
304
|
-
activeTransport = transport;
|
|
305
|
-
return () => {
|
|
306
|
-
if (activeTransport === transport)
|
|
307
|
-
activeTransport = previous;
|
|
308
|
-
};
|
|
309
|
-
};
|
|
310
|
-
var makeLogMethod = (level) => (message, ...args) => {
|
|
311
|
-
const entry = {
|
|
312
|
-
level,
|
|
313
|
-
message,
|
|
314
|
-
data: safeSerialize(args),
|
|
315
|
-
ts: (/* @__PURE__ */ new Date()).toISOString()
|
|
316
|
-
};
|
|
317
|
-
activeTransport(entry);
|
|
318
|
-
};
|
|
319
|
-
var log = Object.freeze({
|
|
320
|
-
debug: makeLogMethod("debug"),
|
|
321
|
-
info: makeLogMethod("info"),
|
|
322
|
-
warn: makeLogMethod("warning"),
|
|
323
|
-
error: makeLogMethod("error")
|
|
324
|
-
});
|
|
325
|
-
var ot = globalThis.__openTabs ?? {};
|
|
326
|
-
globalThis.__openTabs = ot;
|
|
327
|
-
ot._setLogTransport = _setLogTransport;
|
|
328
|
-
ot.log = log;
|
|
329
|
-
|
|
330
|
-
// node_modules/@opentabs-dev/plugin-sdk/dist/page-state.js
|
|
331
|
-
var BLOCKED_SEGMENTS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
332
|
-
var getPageGlobal = (path) => {
|
|
333
|
-
try {
|
|
334
|
-
const segments = path.split(".");
|
|
335
|
-
let current = globalThis;
|
|
336
|
-
for (const segment of segments) {
|
|
337
|
-
if (current === null || current === void 0)
|
|
338
|
-
return void 0;
|
|
339
|
-
if (typeof current !== "object" && typeof current !== "function")
|
|
340
|
-
return void 0;
|
|
341
|
-
if (BLOCKED_SEGMENTS.has(segment))
|
|
342
|
-
return void 0;
|
|
343
|
-
current = current[segment];
|
|
344
|
-
}
|
|
345
|
-
return current;
|
|
346
|
-
} catch {
|
|
347
|
-
return void 0;
|
|
348
|
-
}
|
|
349
|
-
};
|
|
350
|
-
var getCurrentUrl = () => window.location.href;
|
|
351
|
-
var getPageTitle = () => document.title;
|
|
352
|
-
|
|
353
|
-
// node_modules/@opentabs-dev/plugin-sdk/dist/index.js
|
|
354
|
-
var defineTool = (config2) => config2;
|
|
355
|
-
var OpenTabsPlugin = class {
|
|
356
|
-
/**
|
|
357
|
-
* Chrome match patterns for URLs that should NOT match this plugin.
|
|
358
|
-
* Tabs matching both urlPatterns and excludePatterns are excluded.
|
|
359
|
-
* Useful when a broad urlPattern overlaps with another plugin's domain.
|
|
360
|
-
* @see https://developer.chrome.com/docs/extensions/develop/concepts/match-patterns
|
|
361
|
-
*/
|
|
362
|
-
excludePatterns;
|
|
363
|
-
/**
|
|
364
|
-
* URL to open when no matching tab exists and the user triggers an
|
|
365
|
-
* 'open tab' action from the side panel. Should be a concrete URL
|
|
366
|
-
* (e.g., 'https://github.com'), not a match pattern.
|
|
367
|
-
*/
|
|
368
|
-
homepage;
|
|
369
|
-
/** Typed configuration schema — declares settings that users provide via config.json or the side panel. */
|
|
370
|
-
configSchema;
|
|
371
|
-
};
|
|
372
|
-
|
|
373
|
-
// src/fiverr-api.ts
|
|
374
|
-
var getContext = () => {
|
|
375
|
-
const userId = getPageGlobal("initialData.FiverrContext.userId");
|
|
376
|
-
if (!userId || userId <= 0) return null;
|
|
377
|
-
return {
|
|
378
|
-
userId,
|
|
379
|
-
userGuid: getPageGlobal("initialData.FiverrContext.userGuid") ?? "",
|
|
380
|
-
csrfToken: getPageGlobal("initialData.FiverrContext.csrfToken") ?? "",
|
|
381
|
-
currency: getPageGlobal("initialData.FiverrContext.currency") ?? "USD",
|
|
382
|
-
countryCode: getPageGlobal("initialData.FiverrContext.countryCode") ?? "",
|
|
383
|
-
locale: getPageGlobal("initialData.FiverrContext.locale") ?? "",
|
|
384
|
-
isPro: getPageGlobal("initialData.FiverrContext.isPro") ?? false
|
|
385
|
-
};
|
|
386
|
-
};
|
|
387
|
-
var getUsername = () => getPageGlobal("initialData.UserActivationMessage.username") ?? getPageGlobal("initialData.FloatingChat.currentUsername") ?? "";
|
|
388
|
-
var isAuthenticated = () => getContext() !== null;
|
|
389
|
-
var waitForAuth = () => waitUntil(() => isAuthenticated(), { interval: 500, timeout: 5e3 }).then(
|
|
390
|
-
() => true,
|
|
391
|
-
() => false
|
|
392
|
-
);
|
|
393
|
-
var requireContext = () => {
|
|
394
|
-
const ctx = getContext();
|
|
395
|
-
if (!ctx) throw ToolError.auth("Not authenticated \u2014 please log in to Fiverr.");
|
|
396
|
-
return ctx;
|
|
397
|
-
};
|
|
398
|
-
var normalizeFiverrUsername = (value, fieldName = "username") => {
|
|
399
|
-
const username = value.trim().replace(/^[@/]+/, "");
|
|
400
|
-
if (!username) throw ToolError.validation(`${fieldName} is required.`);
|
|
401
|
-
if (username.includes("/")) {
|
|
402
|
-
throw ToolError.validation(`${fieldName} must be a single Fiverr username with no slashes.`);
|
|
403
|
-
}
|
|
404
|
-
return username;
|
|
405
|
-
};
|
|
406
|
-
var PERSEUS_ISLAND_RE = /<script[^>]*id="perseus-initial-props"[^>]*>([\s\S]*?)<\/script>/;
|
|
407
|
-
var fetchPerseusProps = async (path) => {
|
|
408
|
-
requireContext();
|
|
409
|
-
const response = await fetchFromPage(path, { headers: { Accept: "text/html" } });
|
|
410
|
-
if (!response.ok) throw httpStatusToToolError(response, `Failed to load ${path}`);
|
|
411
|
-
const html = await response.text();
|
|
412
|
-
const match = html.match(PERSEUS_ISLAND_RE);
|
|
413
|
-
if (!match?.[1]) throw ToolError.notFound(`No page data found at ${path} \u2014 it may not exist or require login.`);
|
|
414
|
-
try {
|
|
415
|
-
return JSON.parse(match[1]);
|
|
416
|
-
} catch {
|
|
417
|
-
throw ToolError.internal(`Failed to parse page data at ${path}`);
|
|
418
|
-
}
|
|
419
|
-
};
|
|
420
|
-
var fetchInboxJson = async (path) => {
|
|
421
|
-
requireContext();
|
|
422
|
-
const response = await fetchFromPage(path, {
|
|
423
|
-
headers: { Accept: "application/json", "X-Requested-With": "XMLHttpRequest" }
|
|
424
|
-
});
|
|
425
|
-
if (!response.ok) throw httpStatusToToolError(response, `Failed to load ${path}`);
|
|
426
|
-
if (response.status === 204) return null;
|
|
427
|
-
return await response.json();
|
|
428
|
-
};
|
|
429
|
-
var SEND_MESSAGE_PATH = "/inbox/conversations/messages";
|
|
430
|
-
var sendInboxMessage = async (recipientUsername, body) => {
|
|
431
|
-
const ctx = requireContext();
|
|
432
|
-
const response = await fetchFromPage(SEND_MESSAGE_PATH, {
|
|
433
|
-
method: "POST",
|
|
434
|
-
headers: {
|
|
435
|
-
Accept: "application/json",
|
|
436
|
-
"Content-Type": "application/json",
|
|
437
|
-
"X-Requested-With": "XMLHttpRequest",
|
|
438
|
-
"X-CSRF-Token": ctx.csrfToken
|
|
439
|
-
},
|
|
440
|
-
body: JSON.stringify({
|
|
441
|
-
content_blocks: [{ type: "text", plain_text: body, plain_text_format: null }],
|
|
442
|
-
content_type: "text",
|
|
443
|
-
participants_usernames: [recipientUsername],
|
|
444
|
-
channel_id: null,
|
|
445
|
-
pending_attachment_ids: []
|
|
446
|
-
})
|
|
447
|
-
});
|
|
448
|
-
if (!response.ok) throw httpStatusToToolError(response, "Failed to send message");
|
|
449
|
-
if (response.status === 204) return { messageId: "" };
|
|
450
|
-
const data = await response.json();
|
|
451
|
-
return { messageId: data.id ?? data.message?.id ?? "" };
|
|
452
|
-
};
|
|
453
|
-
|
|
454
9
|
// node_modules/zod/v4/classic/external.js
|
|
455
10
|
var external_exports = {};
|
|
456
11
|
__export(external_exports, {
|
|
@@ -13527,1443 +13082,1888 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
13527
13082
|
$ZodCIDRv6.init(inst, def);
|
|
13528
13083
|
ZodStringFormat.init(inst, def);
|
|
13529
13084
|
});
|
|
13530
|
-
function cidrv62(params) {
|
|
13531
|
-
return _cidrv6(ZodCIDRv6, params);
|
|
13085
|
+
function cidrv62(params) {
|
|
13086
|
+
return _cidrv6(ZodCIDRv6, params);
|
|
13087
|
+
}
|
|
13088
|
+
var ZodBase64 = /* @__PURE__ */ $constructor("ZodBase64", (inst, def) => {
|
|
13089
|
+
$ZodBase64.init(inst, def);
|
|
13090
|
+
ZodStringFormat.init(inst, def);
|
|
13091
|
+
});
|
|
13092
|
+
function base642(params) {
|
|
13093
|
+
return _base64(ZodBase64, params);
|
|
13094
|
+
}
|
|
13095
|
+
var ZodBase64URL = /* @__PURE__ */ $constructor("ZodBase64URL", (inst, def) => {
|
|
13096
|
+
$ZodBase64URL.init(inst, def);
|
|
13097
|
+
ZodStringFormat.init(inst, def);
|
|
13098
|
+
});
|
|
13099
|
+
function base64url2(params) {
|
|
13100
|
+
return _base64url(ZodBase64URL, params);
|
|
13101
|
+
}
|
|
13102
|
+
var ZodE164 = /* @__PURE__ */ $constructor("ZodE164", (inst, def) => {
|
|
13103
|
+
$ZodE164.init(inst, def);
|
|
13104
|
+
ZodStringFormat.init(inst, def);
|
|
13105
|
+
});
|
|
13106
|
+
function e1642(params) {
|
|
13107
|
+
return _e164(ZodE164, params);
|
|
13108
|
+
}
|
|
13109
|
+
var ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
|
|
13110
|
+
$ZodJWT.init(inst, def);
|
|
13111
|
+
ZodStringFormat.init(inst, def);
|
|
13112
|
+
});
|
|
13113
|
+
function jwt(params) {
|
|
13114
|
+
return _jwt(ZodJWT, params);
|
|
13115
|
+
}
|
|
13116
|
+
var ZodCustomStringFormat = /* @__PURE__ */ $constructor("ZodCustomStringFormat", (inst, def) => {
|
|
13117
|
+
$ZodCustomStringFormat.init(inst, def);
|
|
13118
|
+
ZodStringFormat.init(inst, def);
|
|
13119
|
+
});
|
|
13120
|
+
function stringFormat(format, fnOrRegex, _params = {}) {
|
|
13121
|
+
return _stringFormat(ZodCustomStringFormat, format, fnOrRegex, _params);
|
|
13122
|
+
}
|
|
13123
|
+
function hostname2(_params) {
|
|
13124
|
+
return _stringFormat(ZodCustomStringFormat, "hostname", regexes_exports.hostname, _params);
|
|
13125
|
+
}
|
|
13126
|
+
function hex2(_params) {
|
|
13127
|
+
return _stringFormat(ZodCustomStringFormat, "hex", regexes_exports.hex, _params);
|
|
13128
|
+
}
|
|
13129
|
+
function hash(alg, params) {
|
|
13130
|
+
const enc = params?.enc ?? "hex";
|
|
13131
|
+
const format = `${alg}_${enc}`;
|
|
13132
|
+
const regex = regexes_exports[format];
|
|
13133
|
+
if (!regex)
|
|
13134
|
+
throw new Error(`Unrecognized hash format: ${format}`);
|
|
13135
|
+
return _stringFormat(ZodCustomStringFormat, format, regex, params);
|
|
13136
|
+
}
|
|
13137
|
+
var ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
|
|
13138
|
+
$ZodNumber.init(inst, def);
|
|
13139
|
+
ZodType.init(inst, def);
|
|
13140
|
+
inst._zod.processJSONSchema = (ctx, json2, params) => numberProcessor(inst, ctx, json2, params);
|
|
13141
|
+
_installLazyMethods(inst, "ZodNumber", {
|
|
13142
|
+
gt(value, params) {
|
|
13143
|
+
return this.check(_gt(value, params));
|
|
13144
|
+
},
|
|
13145
|
+
gte(value, params) {
|
|
13146
|
+
return this.check(_gte(value, params));
|
|
13147
|
+
},
|
|
13148
|
+
min(value, params) {
|
|
13149
|
+
return this.check(_gte(value, params));
|
|
13150
|
+
},
|
|
13151
|
+
lt(value, params) {
|
|
13152
|
+
return this.check(_lt(value, params));
|
|
13153
|
+
},
|
|
13154
|
+
lte(value, params) {
|
|
13155
|
+
return this.check(_lte(value, params));
|
|
13156
|
+
},
|
|
13157
|
+
max(value, params) {
|
|
13158
|
+
return this.check(_lte(value, params));
|
|
13159
|
+
},
|
|
13160
|
+
int(params) {
|
|
13161
|
+
return this.check(int(params));
|
|
13162
|
+
},
|
|
13163
|
+
safe(params) {
|
|
13164
|
+
return this.check(int(params));
|
|
13165
|
+
},
|
|
13166
|
+
positive(params) {
|
|
13167
|
+
return this.check(_gt(0, params));
|
|
13168
|
+
},
|
|
13169
|
+
nonnegative(params) {
|
|
13170
|
+
return this.check(_gte(0, params));
|
|
13171
|
+
},
|
|
13172
|
+
negative(params) {
|
|
13173
|
+
return this.check(_lt(0, params));
|
|
13174
|
+
},
|
|
13175
|
+
nonpositive(params) {
|
|
13176
|
+
return this.check(_lte(0, params));
|
|
13177
|
+
},
|
|
13178
|
+
multipleOf(value, params) {
|
|
13179
|
+
return this.check(_multipleOf(value, params));
|
|
13180
|
+
},
|
|
13181
|
+
step(value, params) {
|
|
13182
|
+
return this.check(_multipleOf(value, params));
|
|
13183
|
+
},
|
|
13184
|
+
finite() {
|
|
13185
|
+
return this;
|
|
13186
|
+
}
|
|
13187
|
+
});
|
|
13188
|
+
const bag = inst._zod.bag;
|
|
13189
|
+
inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
|
|
13190
|
+
inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
|
|
13191
|
+
inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? 0.5);
|
|
13192
|
+
inst.isFinite = true;
|
|
13193
|
+
inst.format = bag.format ?? null;
|
|
13194
|
+
});
|
|
13195
|
+
function number2(params) {
|
|
13196
|
+
return _number(ZodNumber, params);
|
|
13197
|
+
}
|
|
13198
|
+
var ZodNumberFormat = /* @__PURE__ */ $constructor("ZodNumberFormat", (inst, def) => {
|
|
13199
|
+
$ZodNumberFormat.init(inst, def);
|
|
13200
|
+
ZodNumber.init(inst, def);
|
|
13201
|
+
});
|
|
13202
|
+
function int(params) {
|
|
13203
|
+
return _int(ZodNumberFormat, params);
|
|
13204
|
+
}
|
|
13205
|
+
function float32(params) {
|
|
13206
|
+
return _float32(ZodNumberFormat, params);
|
|
13207
|
+
}
|
|
13208
|
+
function float64(params) {
|
|
13209
|
+
return _float64(ZodNumberFormat, params);
|
|
13210
|
+
}
|
|
13211
|
+
function int32(params) {
|
|
13212
|
+
return _int32(ZodNumberFormat, params);
|
|
13213
|
+
}
|
|
13214
|
+
function uint32(params) {
|
|
13215
|
+
return _uint32(ZodNumberFormat, params);
|
|
13216
|
+
}
|
|
13217
|
+
var ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
|
|
13218
|
+
$ZodBoolean.init(inst, def);
|
|
13219
|
+
ZodType.init(inst, def);
|
|
13220
|
+
inst._zod.processJSONSchema = (ctx, json2, params) => booleanProcessor(inst, ctx, json2, params);
|
|
13221
|
+
});
|
|
13222
|
+
function boolean2(params) {
|
|
13223
|
+
return _boolean(ZodBoolean, params);
|
|
13224
|
+
}
|
|
13225
|
+
var ZodBigInt = /* @__PURE__ */ $constructor("ZodBigInt", (inst, def) => {
|
|
13226
|
+
$ZodBigInt.init(inst, def);
|
|
13227
|
+
ZodType.init(inst, def);
|
|
13228
|
+
inst._zod.processJSONSchema = (ctx, json2, params) => bigintProcessor(inst, ctx, json2, params);
|
|
13229
|
+
inst.gte = (value, params) => inst.check(_gte(value, params));
|
|
13230
|
+
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
13231
|
+
inst.gt = (value, params) => inst.check(_gt(value, params));
|
|
13232
|
+
inst.gte = (value, params) => inst.check(_gte(value, params));
|
|
13233
|
+
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
13234
|
+
inst.lt = (value, params) => inst.check(_lt(value, params));
|
|
13235
|
+
inst.lte = (value, params) => inst.check(_lte(value, params));
|
|
13236
|
+
inst.max = (value, params) => inst.check(_lte(value, params));
|
|
13237
|
+
inst.positive = (params) => inst.check(_gt(BigInt(0), params));
|
|
13238
|
+
inst.negative = (params) => inst.check(_lt(BigInt(0), params));
|
|
13239
|
+
inst.nonpositive = (params) => inst.check(_lte(BigInt(0), params));
|
|
13240
|
+
inst.nonnegative = (params) => inst.check(_gte(BigInt(0), params));
|
|
13241
|
+
inst.multipleOf = (value, params) => inst.check(_multipleOf(value, params));
|
|
13242
|
+
const bag = inst._zod.bag;
|
|
13243
|
+
inst.minValue = bag.minimum ?? null;
|
|
13244
|
+
inst.maxValue = bag.maximum ?? null;
|
|
13245
|
+
inst.format = bag.format ?? null;
|
|
13246
|
+
});
|
|
13247
|
+
function bigint2(params) {
|
|
13248
|
+
return _bigint(ZodBigInt, params);
|
|
13249
|
+
}
|
|
13250
|
+
var ZodBigIntFormat = /* @__PURE__ */ $constructor("ZodBigIntFormat", (inst, def) => {
|
|
13251
|
+
$ZodBigIntFormat.init(inst, def);
|
|
13252
|
+
ZodBigInt.init(inst, def);
|
|
13253
|
+
});
|
|
13254
|
+
function int64(params) {
|
|
13255
|
+
return _int64(ZodBigIntFormat, params);
|
|
13256
|
+
}
|
|
13257
|
+
function uint64(params) {
|
|
13258
|
+
return _uint64(ZodBigIntFormat, params);
|
|
13259
|
+
}
|
|
13260
|
+
var ZodSymbol = /* @__PURE__ */ $constructor("ZodSymbol", (inst, def) => {
|
|
13261
|
+
$ZodSymbol.init(inst, def);
|
|
13262
|
+
ZodType.init(inst, def);
|
|
13263
|
+
inst._zod.processJSONSchema = (ctx, json2, params) => symbolProcessor(inst, ctx, json2, params);
|
|
13264
|
+
});
|
|
13265
|
+
function symbol(params) {
|
|
13266
|
+
return _symbol(ZodSymbol, params);
|
|
13532
13267
|
}
|
|
13533
|
-
var
|
|
13534
|
-
$
|
|
13535
|
-
|
|
13268
|
+
var ZodUndefined = /* @__PURE__ */ $constructor("ZodUndefined", (inst, def) => {
|
|
13269
|
+
$ZodUndefined.init(inst, def);
|
|
13270
|
+
ZodType.init(inst, def);
|
|
13271
|
+
inst._zod.processJSONSchema = (ctx, json2, params) => undefinedProcessor(inst, ctx, json2, params);
|
|
13536
13272
|
});
|
|
13537
|
-
function
|
|
13538
|
-
return
|
|
13273
|
+
function _undefined3(params) {
|
|
13274
|
+
return _undefined2(ZodUndefined, params);
|
|
13539
13275
|
}
|
|
13540
|
-
var
|
|
13541
|
-
$
|
|
13542
|
-
|
|
13276
|
+
var ZodNull = /* @__PURE__ */ $constructor("ZodNull", (inst, def) => {
|
|
13277
|
+
$ZodNull.init(inst, def);
|
|
13278
|
+
ZodType.init(inst, def);
|
|
13279
|
+
inst._zod.processJSONSchema = (ctx, json2, params) => nullProcessor(inst, ctx, json2, params);
|
|
13543
13280
|
});
|
|
13544
|
-
function
|
|
13545
|
-
return
|
|
13281
|
+
function _null3(params) {
|
|
13282
|
+
return _null2(ZodNull, params);
|
|
13546
13283
|
}
|
|
13547
|
-
var
|
|
13548
|
-
$
|
|
13549
|
-
|
|
13284
|
+
var ZodAny = /* @__PURE__ */ $constructor("ZodAny", (inst, def) => {
|
|
13285
|
+
$ZodAny.init(inst, def);
|
|
13286
|
+
ZodType.init(inst, def);
|
|
13287
|
+
inst._zod.processJSONSchema = (ctx, json2, params) => anyProcessor(inst, ctx, json2, params);
|
|
13550
13288
|
});
|
|
13551
|
-
function
|
|
13552
|
-
return
|
|
13289
|
+
function any() {
|
|
13290
|
+
return _any(ZodAny);
|
|
13553
13291
|
}
|
|
13554
|
-
var
|
|
13555
|
-
$
|
|
13556
|
-
|
|
13292
|
+
var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
|
|
13293
|
+
$ZodUnknown.init(inst, def);
|
|
13294
|
+
ZodType.init(inst, def);
|
|
13295
|
+
inst._zod.processJSONSchema = (ctx, json2, params) => unknownProcessor(inst, ctx, json2, params);
|
|
13557
13296
|
});
|
|
13558
|
-
function
|
|
13559
|
-
return
|
|
13297
|
+
function unknown() {
|
|
13298
|
+
return _unknown(ZodUnknown);
|
|
13560
13299
|
}
|
|
13561
|
-
var
|
|
13562
|
-
$
|
|
13563
|
-
|
|
13300
|
+
var ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
|
|
13301
|
+
$ZodNever.init(inst, def);
|
|
13302
|
+
ZodType.init(inst, def);
|
|
13303
|
+
inst._zod.processJSONSchema = (ctx, json2, params) => neverProcessor(inst, ctx, json2, params);
|
|
13564
13304
|
});
|
|
13565
|
-
function
|
|
13566
|
-
return
|
|
13567
|
-
}
|
|
13568
|
-
function hostname2(_params) {
|
|
13569
|
-
return _stringFormat(ZodCustomStringFormat, "hostname", regexes_exports.hostname, _params);
|
|
13305
|
+
function never(params) {
|
|
13306
|
+
return _never(ZodNever, params);
|
|
13570
13307
|
}
|
|
13571
|
-
|
|
13572
|
-
|
|
13308
|
+
var ZodVoid = /* @__PURE__ */ $constructor("ZodVoid", (inst, def) => {
|
|
13309
|
+
$ZodVoid.init(inst, def);
|
|
13310
|
+
ZodType.init(inst, def);
|
|
13311
|
+
inst._zod.processJSONSchema = (ctx, json2, params) => voidProcessor(inst, ctx, json2, params);
|
|
13312
|
+
});
|
|
13313
|
+
function _void2(params) {
|
|
13314
|
+
return _void(ZodVoid, params);
|
|
13573
13315
|
}
|
|
13574
|
-
|
|
13575
|
-
|
|
13576
|
-
|
|
13577
|
-
|
|
13578
|
-
|
|
13579
|
-
|
|
13580
|
-
|
|
13316
|
+
var ZodDate = /* @__PURE__ */ $constructor("ZodDate", (inst, def) => {
|
|
13317
|
+
$ZodDate.init(inst, def);
|
|
13318
|
+
ZodType.init(inst, def);
|
|
13319
|
+
inst._zod.processJSONSchema = (ctx, json2, params) => dateProcessor(inst, ctx, json2, params);
|
|
13320
|
+
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
13321
|
+
inst.max = (value, params) => inst.check(_lte(value, params));
|
|
13322
|
+
const c = inst._zod.bag;
|
|
13323
|
+
inst.minDate = c.minimum ? new Date(c.minimum) : null;
|
|
13324
|
+
inst.maxDate = c.maximum ? new Date(c.maximum) : null;
|
|
13325
|
+
});
|
|
13326
|
+
function date3(params) {
|
|
13327
|
+
return _date(ZodDate, params);
|
|
13581
13328
|
}
|
|
13582
|
-
var
|
|
13583
|
-
$
|
|
13329
|
+
var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
|
|
13330
|
+
$ZodArray.init(inst, def);
|
|
13584
13331
|
ZodType.init(inst, def);
|
|
13585
|
-
inst._zod.processJSONSchema = (ctx, json2, params) =>
|
|
13586
|
-
|
|
13587
|
-
|
|
13588
|
-
|
|
13332
|
+
inst._zod.processJSONSchema = (ctx, json2, params) => arrayProcessor(inst, ctx, json2, params);
|
|
13333
|
+
inst.element = def.element;
|
|
13334
|
+
_installLazyMethods(inst, "ZodArray", {
|
|
13335
|
+
min(n, params) {
|
|
13336
|
+
return this.check(_minLength(n, params));
|
|
13589
13337
|
},
|
|
13590
|
-
|
|
13591
|
-
return this.check(
|
|
13338
|
+
nonempty(params) {
|
|
13339
|
+
return this.check(_minLength(1, params));
|
|
13592
13340
|
},
|
|
13593
|
-
|
|
13594
|
-
return this.check(
|
|
13341
|
+
max(n, params) {
|
|
13342
|
+
return this.check(_maxLength(n, params));
|
|
13595
13343
|
},
|
|
13596
|
-
|
|
13597
|
-
return this.check(
|
|
13344
|
+
length(n, params) {
|
|
13345
|
+
return this.check(_length(n, params));
|
|
13598
13346
|
},
|
|
13599
|
-
|
|
13600
|
-
return this.
|
|
13347
|
+
unwrap() {
|
|
13348
|
+
return this.element;
|
|
13349
|
+
}
|
|
13350
|
+
});
|
|
13351
|
+
});
|
|
13352
|
+
function array(element, params) {
|
|
13353
|
+
return _array(ZodArray, element, params);
|
|
13354
|
+
}
|
|
13355
|
+
function keyof(schema) {
|
|
13356
|
+
const shape = schema._zod.def.shape;
|
|
13357
|
+
return _enum2(Object.keys(shape));
|
|
13358
|
+
}
|
|
13359
|
+
var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
13360
|
+
$ZodObjectJIT.init(inst, def);
|
|
13361
|
+
ZodType.init(inst, def);
|
|
13362
|
+
inst._zod.processJSONSchema = (ctx, json2, params) => objectProcessor(inst, ctx, json2, params);
|
|
13363
|
+
util_exports.defineLazy(inst, "shape", () => {
|
|
13364
|
+
return def.shape;
|
|
13365
|
+
});
|
|
13366
|
+
_installLazyMethods(inst, "ZodObject", {
|
|
13367
|
+
keyof() {
|
|
13368
|
+
return _enum2(Object.keys(this._zod.def.shape));
|
|
13601
13369
|
},
|
|
13602
|
-
|
|
13603
|
-
return this.
|
|
13370
|
+
catchall(catchall) {
|
|
13371
|
+
return this.clone({ ...this._zod.def, catchall });
|
|
13604
13372
|
},
|
|
13605
|
-
|
|
13606
|
-
return this.
|
|
13373
|
+
passthrough() {
|
|
13374
|
+
return this.clone({ ...this._zod.def, catchall: unknown() });
|
|
13607
13375
|
},
|
|
13608
|
-
|
|
13609
|
-
return this.
|
|
13376
|
+
loose() {
|
|
13377
|
+
return this.clone({ ...this._zod.def, catchall: unknown() });
|
|
13610
13378
|
},
|
|
13611
|
-
|
|
13612
|
-
return this.
|
|
13379
|
+
strict() {
|
|
13380
|
+
return this.clone({ ...this._zod.def, catchall: never() });
|
|
13613
13381
|
},
|
|
13614
|
-
|
|
13615
|
-
return this.
|
|
13382
|
+
strip() {
|
|
13383
|
+
return this.clone({ ...this._zod.def, catchall: void 0 });
|
|
13616
13384
|
},
|
|
13617
|
-
|
|
13618
|
-
return
|
|
13385
|
+
extend(incoming) {
|
|
13386
|
+
return util_exports.extend(this, incoming);
|
|
13619
13387
|
},
|
|
13620
|
-
|
|
13621
|
-
return
|
|
13388
|
+
safeExtend(incoming) {
|
|
13389
|
+
return util_exports.safeExtend(this, incoming);
|
|
13622
13390
|
},
|
|
13623
|
-
|
|
13624
|
-
return
|
|
13391
|
+
merge(other) {
|
|
13392
|
+
return util_exports.merge(this, other);
|
|
13625
13393
|
},
|
|
13626
|
-
|
|
13627
|
-
return
|
|
13394
|
+
pick(mask) {
|
|
13395
|
+
return util_exports.pick(this, mask);
|
|
13628
13396
|
},
|
|
13629
|
-
|
|
13630
|
-
return this;
|
|
13397
|
+
omit(mask) {
|
|
13398
|
+
return util_exports.omit(this, mask);
|
|
13399
|
+
},
|
|
13400
|
+
partial(...args) {
|
|
13401
|
+
return util_exports.partial(ZodOptional, this, args[0]);
|
|
13402
|
+
},
|
|
13403
|
+
required(...args) {
|
|
13404
|
+
return util_exports.required(ZodNonOptional, this, args[0]);
|
|
13631
13405
|
}
|
|
13632
13406
|
});
|
|
13633
|
-
const bag = inst._zod.bag;
|
|
13634
|
-
inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
|
|
13635
|
-
inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
|
|
13636
|
-
inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? 0.5);
|
|
13637
|
-
inst.isFinite = true;
|
|
13638
|
-
inst.format = bag.format ?? null;
|
|
13639
13407
|
});
|
|
13640
|
-
function
|
|
13641
|
-
|
|
13408
|
+
function object(shape, params) {
|
|
13409
|
+
const def = {
|
|
13410
|
+
type: "object",
|
|
13411
|
+
shape: shape ?? {},
|
|
13412
|
+
...util_exports.normalizeParams(params)
|
|
13413
|
+
};
|
|
13414
|
+
return new ZodObject(def);
|
|
13415
|
+
}
|
|
13416
|
+
function strictObject(shape, params) {
|
|
13417
|
+
return new ZodObject({
|
|
13418
|
+
type: "object",
|
|
13419
|
+
shape,
|
|
13420
|
+
catchall: never(),
|
|
13421
|
+
...util_exports.normalizeParams(params)
|
|
13422
|
+
});
|
|
13423
|
+
}
|
|
13424
|
+
function looseObject(shape, params) {
|
|
13425
|
+
return new ZodObject({
|
|
13426
|
+
type: "object",
|
|
13427
|
+
shape,
|
|
13428
|
+
catchall: unknown(),
|
|
13429
|
+
...util_exports.normalizeParams(params)
|
|
13430
|
+
});
|
|
13431
|
+
}
|
|
13432
|
+
var ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
|
|
13433
|
+
$ZodUnion.init(inst, def);
|
|
13434
|
+
ZodType.init(inst, def);
|
|
13435
|
+
inst._zod.processJSONSchema = (ctx, json2, params) => unionProcessor(inst, ctx, json2, params);
|
|
13436
|
+
inst.options = def.options;
|
|
13437
|
+
});
|
|
13438
|
+
function union(options, params) {
|
|
13439
|
+
return new ZodUnion({
|
|
13440
|
+
type: "union",
|
|
13441
|
+
options,
|
|
13442
|
+
...util_exports.normalizeParams(params)
|
|
13443
|
+
});
|
|
13444
|
+
}
|
|
13445
|
+
var ZodXor = /* @__PURE__ */ $constructor("ZodXor", (inst, def) => {
|
|
13446
|
+
ZodUnion.init(inst, def);
|
|
13447
|
+
$ZodXor.init(inst, def);
|
|
13448
|
+
inst._zod.processJSONSchema = (ctx, json2, params) => unionProcessor(inst, ctx, json2, params);
|
|
13449
|
+
inst.options = def.options;
|
|
13450
|
+
});
|
|
13451
|
+
function xor(options, params) {
|
|
13452
|
+
return new ZodXor({
|
|
13453
|
+
type: "union",
|
|
13454
|
+
options,
|
|
13455
|
+
inclusive: false,
|
|
13456
|
+
...util_exports.normalizeParams(params)
|
|
13457
|
+
});
|
|
13458
|
+
}
|
|
13459
|
+
var ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("ZodDiscriminatedUnion", (inst, def) => {
|
|
13460
|
+
ZodUnion.init(inst, def);
|
|
13461
|
+
$ZodDiscriminatedUnion.init(inst, def);
|
|
13462
|
+
});
|
|
13463
|
+
function discriminatedUnion(discriminator, options, params) {
|
|
13464
|
+
return new ZodDiscriminatedUnion({
|
|
13465
|
+
type: "union",
|
|
13466
|
+
options,
|
|
13467
|
+
discriminator,
|
|
13468
|
+
...util_exports.normalizeParams(params)
|
|
13469
|
+
});
|
|
13470
|
+
}
|
|
13471
|
+
var ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
|
|
13472
|
+
$ZodIntersection.init(inst, def);
|
|
13473
|
+
ZodType.init(inst, def);
|
|
13474
|
+
inst._zod.processJSONSchema = (ctx, json2, params) => intersectionProcessor(inst, ctx, json2, params);
|
|
13475
|
+
});
|
|
13476
|
+
function intersection(left, right) {
|
|
13477
|
+
return new ZodIntersection({
|
|
13478
|
+
type: "intersection",
|
|
13479
|
+
left,
|
|
13480
|
+
right
|
|
13481
|
+
});
|
|
13482
|
+
}
|
|
13483
|
+
var ZodTuple = /* @__PURE__ */ $constructor("ZodTuple", (inst, def) => {
|
|
13484
|
+
$ZodTuple.init(inst, def);
|
|
13485
|
+
ZodType.init(inst, def);
|
|
13486
|
+
inst._zod.processJSONSchema = (ctx, json2, params) => tupleProcessor(inst, ctx, json2, params);
|
|
13487
|
+
inst.rest = (rest) => inst.clone({
|
|
13488
|
+
...inst._zod.def,
|
|
13489
|
+
rest
|
|
13490
|
+
});
|
|
13491
|
+
});
|
|
13492
|
+
function tuple(items, _paramsOrRest, _params) {
|
|
13493
|
+
const hasRest = _paramsOrRest instanceof $ZodType;
|
|
13494
|
+
const params = hasRest ? _params : _paramsOrRest;
|
|
13495
|
+
const rest = hasRest ? _paramsOrRest : null;
|
|
13496
|
+
return new ZodTuple({
|
|
13497
|
+
type: "tuple",
|
|
13498
|
+
items,
|
|
13499
|
+
rest,
|
|
13500
|
+
...util_exports.normalizeParams(params)
|
|
13501
|
+
});
|
|
13642
13502
|
}
|
|
13643
|
-
var
|
|
13644
|
-
$
|
|
13645
|
-
|
|
13503
|
+
var ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
|
|
13504
|
+
$ZodRecord.init(inst, def);
|
|
13505
|
+
ZodType.init(inst, def);
|
|
13506
|
+
inst._zod.processJSONSchema = (ctx, json2, params) => recordProcessor(inst, ctx, json2, params);
|
|
13507
|
+
inst.keyType = def.keyType;
|
|
13508
|
+
inst.valueType = def.valueType;
|
|
13646
13509
|
});
|
|
13647
|
-
function
|
|
13648
|
-
|
|
13510
|
+
function record(keyType, valueType, params) {
|
|
13511
|
+
if (!valueType || !valueType._zod) {
|
|
13512
|
+
return new ZodRecord({
|
|
13513
|
+
type: "record",
|
|
13514
|
+
keyType: string2(),
|
|
13515
|
+
valueType: keyType,
|
|
13516
|
+
...util_exports.normalizeParams(valueType)
|
|
13517
|
+
});
|
|
13518
|
+
}
|
|
13519
|
+
return new ZodRecord({
|
|
13520
|
+
type: "record",
|
|
13521
|
+
keyType,
|
|
13522
|
+
valueType,
|
|
13523
|
+
...util_exports.normalizeParams(params)
|
|
13524
|
+
});
|
|
13649
13525
|
}
|
|
13650
|
-
function
|
|
13651
|
-
|
|
13526
|
+
function partialRecord(keyType, valueType, params) {
|
|
13527
|
+
const k = clone(keyType);
|
|
13528
|
+
k._zod.values = void 0;
|
|
13529
|
+
return new ZodRecord({
|
|
13530
|
+
type: "record",
|
|
13531
|
+
keyType: k,
|
|
13532
|
+
valueType,
|
|
13533
|
+
...util_exports.normalizeParams(params)
|
|
13534
|
+
});
|
|
13652
13535
|
}
|
|
13653
|
-
function
|
|
13654
|
-
return
|
|
13536
|
+
function looseRecord(keyType, valueType, params) {
|
|
13537
|
+
return new ZodRecord({
|
|
13538
|
+
type: "record",
|
|
13539
|
+
keyType,
|
|
13540
|
+
valueType,
|
|
13541
|
+
mode: "loose",
|
|
13542
|
+
...util_exports.normalizeParams(params)
|
|
13543
|
+
});
|
|
13655
13544
|
}
|
|
13656
|
-
|
|
13657
|
-
|
|
13545
|
+
var ZodMap = /* @__PURE__ */ $constructor("ZodMap", (inst, def) => {
|
|
13546
|
+
$ZodMap.init(inst, def);
|
|
13547
|
+
ZodType.init(inst, def);
|
|
13548
|
+
inst._zod.processJSONSchema = (ctx, json2, params) => mapProcessor(inst, ctx, json2, params);
|
|
13549
|
+
inst.keyType = def.keyType;
|
|
13550
|
+
inst.valueType = def.valueType;
|
|
13551
|
+
inst.min = (...args) => inst.check(_minSize(...args));
|
|
13552
|
+
inst.nonempty = (params) => inst.check(_minSize(1, params));
|
|
13553
|
+
inst.max = (...args) => inst.check(_maxSize(...args));
|
|
13554
|
+
inst.size = (...args) => inst.check(_size(...args));
|
|
13555
|
+
});
|
|
13556
|
+
function map(keyType, valueType, params) {
|
|
13557
|
+
return new ZodMap({
|
|
13558
|
+
type: "map",
|
|
13559
|
+
keyType,
|
|
13560
|
+
valueType,
|
|
13561
|
+
...util_exports.normalizeParams(params)
|
|
13562
|
+
});
|
|
13658
13563
|
}
|
|
13659
|
-
|
|
13660
|
-
|
|
13564
|
+
var ZodSet = /* @__PURE__ */ $constructor("ZodSet", (inst, def) => {
|
|
13565
|
+
$ZodSet.init(inst, def);
|
|
13566
|
+
ZodType.init(inst, def);
|
|
13567
|
+
inst._zod.processJSONSchema = (ctx, json2, params) => setProcessor(inst, ctx, json2, params);
|
|
13568
|
+
inst.min = (...args) => inst.check(_minSize(...args));
|
|
13569
|
+
inst.nonempty = (params) => inst.check(_minSize(1, params));
|
|
13570
|
+
inst.max = (...args) => inst.check(_maxSize(...args));
|
|
13571
|
+
inst.size = (...args) => inst.check(_size(...args));
|
|
13572
|
+
});
|
|
13573
|
+
function set(valueType, params) {
|
|
13574
|
+
return new ZodSet({
|
|
13575
|
+
type: "set",
|
|
13576
|
+
valueType,
|
|
13577
|
+
...util_exports.normalizeParams(params)
|
|
13578
|
+
});
|
|
13661
13579
|
}
|
|
13662
|
-
var
|
|
13663
|
-
$
|
|
13580
|
+
var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
13581
|
+
$ZodEnum.init(inst, def);
|
|
13664
13582
|
ZodType.init(inst, def);
|
|
13665
|
-
inst._zod.processJSONSchema = (ctx, json2, params) =>
|
|
13583
|
+
inst._zod.processJSONSchema = (ctx, json2, params) => enumProcessor(inst, ctx, json2, params);
|
|
13584
|
+
inst.enum = def.entries;
|
|
13585
|
+
inst.options = Object.values(def.entries);
|
|
13586
|
+
const keys = new Set(Object.keys(def.entries));
|
|
13587
|
+
inst.extract = (values, params) => {
|
|
13588
|
+
const newEntries = {};
|
|
13589
|
+
for (const value of values) {
|
|
13590
|
+
if (keys.has(value)) {
|
|
13591
|
+
newEntries[value] = def.entries[value];
|
|
13592
|
+
} else
|
|
13593
|
+
throw new Error(`Key ${value} not found in enum`);
|
|
13594
|
+
}
|
|
13595
|
+
return new ZodEnum({
|
|
13596
|
+
...def,
|
|
13597
|
+
checks: [],
|
|
13598
|
+
...util_exports.normalizeParams(params),
|
|
13599
|
+
entries: newEntries
|
|
13600
|
+
});
|
|
13601
|
+
};
|
|
13602
|
+
inst.exclude = (values, params) => {
|
|
13603
|
+
const newEntries = { ...def.entries };
|
|
13604
|
+
for (const value of values) {
|
|
13605
|
+
if (keys.has(value)) {
|
|
13606
|
+
delete newEntries[value];
|
|
13607
|
+
} else
|
|
13608
|
+
throw new Error(`Key ${value} not found in enum`);
|
|
13609
|
+
}
|
|
13610
|
+
return new ZodEnum({
|
|
13611
|
+
...def,
|
|
13612
|
+
checks: [],
|
|
13613
|
+
...util_exports.normalizeParams(params),
|
|
13614
|
+
entries: newEntries
|
|
13615
|
+
});
|
|
13616
|
+
};
|
|
13666
13617
|
});
|
|
13667
|
-
function
|
|
13668
|
-
|
|
13618
|
+
function _enum2(values, params) {
|
|
13619
|
+
const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
|
|
13620
|
+
return new ZodEnum({
|
|
13621
|
+
type: "enum",
|
|
13622
|
+
entries,
|
|
13623
|
+
...util_exports.normalizeParams(params)
|
|
13624
|
+
});
|
|
13669
13625
|
}
|
|
13670
|
-
|
|
13671
|
-
|
|
13626
|
+
function nativeEnum(entries, params) {
|
|
13627
|
+
return new ZodEnum({
|
|
13628
|
+
type: "enum",
|
|
13629
|
+
entries,
|
|
13630
|
+
...util_exports.normalizeParams(params)
|
|
13631
|
+
});
|
|
13632
|
+
}
|
|
13633
|
+
var ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
|
|
13634
|
+
$ZodLiteral.init(inst, def);
|
|
13672
13635
|
ZodType.init(inst, def);
|
|
13673
|
-
inst._zod.processJSONSchema = (ctx, json2, params) =>
|
|
13674
|
-
inst.
|
|
13675
|
-
|
|
13676
|
-
|
|
13677
|
-
|
|
13678
|
-
|
|
13679
|
-
|
|
13680
|
-
|
|
13681
|
-
|
|
13682
|
-
|
|
13683
|
-
inst.negative = (params) => inst.check(_lt(BigInt(0), params));
|
|
13684
|
-
inst.nonpositive = (params) => inst.check(_lte(BigInt(0), params));
|
|
13685
|
-
inst.nonnegative = (params) => inst.check(_gte(BigInt(0), params));
|
|
13686
|
-
inst.multipleOf = (value, params) => inst.check(_multipleOf(value, params));
|
|
13687
|
-
const bag = inst._zod.bag;
|
|
13688
|
-
inst.minValue = bag.minimum ?? null;
|
|
13689
|
-
inst.maxValue = bag.maximum ?? null;
|
|
13690
|
-
inst.format = bag.format ?? null;
|
|
13636
|
+
inst._zod.processJSONSchema = (ctx, json2, params) => literalProcessor(inst, ctx, json2, params);
|
|
13637
|
+
inst.values = new Set(def.values);
|
|
13638
|
+
Object.defineProperty(inst, "value", {
|
|
13639
|
+
get() {
|
|
13640
|
+
if (def.values.length > 1) {
|
|
13641
|
+
throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
|
|
13642
|
+
}
|
|
13643
|
+
return def.values[0];
|
|
13644
|
+
}
|
|
13645
|
+
});
|
|
13691
13646
|
});
|
|
13692
|
-
function
|
|
13693
|
-
return
|
|
13647
|
+
function literal(value, params) {
|
|
13648
|
+
return new ZodLiteral({
|
|
13649
|
+
type: "literal",
|
|
13650
|
+
values: Array.isArray(value) ? value : [value],
|
|
13651
|
+
...util_exports.normalizeParams(params)
|
|
13652
|
+
});
|
|
13694
13653
|
}
|
|
13695
|
-
var
|
|
13696
|
-
$
|
|
13697
|
-
|
|
13654
|
+
var ZodFile = /* @__PURE__ */ $constructor("ZodFile", (inst, def) => {
|
|
13655
|
+
$ZodFile.init(inst, def);
|
|
13656
|
+
ZodType.init(inst, def);
|
|
13657
|
+
inst._zod.processJSONSchema = (ctx, json2, params) => fileProcessor(inst, ctx, json2, params);
|
|
13658
|
+
inst.min = (size, params) => inst.check(_minSize(size, params));
|
|
13659
|
+
inst.max = (size, params) => inst.check(_maxSize(size, params));
|
|
13660
|
+
inst.mime = (types, params) => inst.check(_mime(Array.isArray(types) ? types : [types], params));
|
|
13661
|
+
});
|
|
13662
|
+
function file(params) {
|
|
13663
|
+
return _file(ZodFile, params);
|
|
13664
|
+
}
|
|
13665
|
+
var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
|
|
13666
|
+
$ZodTransform.init(inst, def);
|
|
13667
|
+
ZodType.init(inst, def);
|
|
13668
|
+
inst._zod.processJSONSchema = (ctx, json2, params) => transformProcessor(inst, ctx, json2, params);
|
|
13669
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
13670
|
+
if (_ctx.direction === "backward") {
|
|
13671
|
+
throw new $ZodEncodeError(inst.constructor.name);
|
|
13672
|
+
}
|
|
13673
|
+
payload.addIssue = (issue2) => {
|
|
13674
|
+
if (typeof issue2 === "string") {
|
|
13675
|
+
payload.issues.push(util_exports.issue(issue2, payload.value, def));
|
|
13676
|
+
} else {
|
|
13677
|
+
const _issue = issue2;
|
|
13678
|
+
if (_issue.fatal)
|
|
13679
|
+
_issue.continue = false;
|
|
13680
|
+
_issue.code ?? (_issue.code = "custom");
|
|
13681
|
+
_issue.input ?? (_issue.input = payload.value);
|
|
13682
|
+
_issue.inst ?? (_issue.inst = inst);
|
|
13683
|
+
payload.issues.push(util_exports.issue(_issue));
|
|
13684
|
+
}
|
|
13685
|
+
};
|
|
13686
|
+
const output = def.transform(payload.value, payload);
|
|
13687
|
+
if (output instanceof Promise) {
|
|
13688
|
+
return output.then((output2) => {
|
|
13689
|
+
payload.value = output2;
|
|
13690
|
+
payload.fallback = true;
|
|
13691
|
+
return payload;
|
|
13692
|
+
});
|
|
13693
|
+
}
|
|
13694
|
+
payload.value = output;
|
|
13695
|
+
payload.fallback = true;
|
|
13696
|
+
return payload;
|
|
13697
|
+
};
|
|
13698
13698
|
});
|
|
13699
|
-
function
|
|
13700
|
-
return
|
|
13701
|
-
|
|
13702
|
-
|
|
13703
|
-
|
|
13699
|
+
function transform(fn) {
|
|
13700
|
+
return new ZodTransform({
|
|
13701
|
+
type: "transform",
|
|
13702
|
+
transform: fn
|
|
13703
|
+
});
|
|
13704
13704
|
}
|
|
13705
|
-
var
|
|
13706
|
-
$
|
|
13705
|
+
var ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
|
|
13706
|
+
$ZodOptional.init(inst, def);
|
|
13707
13707
|
ZodType.init(inst, def);
|
|
13708
|
-
inst._zod.processJSONSchema = (ctx, json2, params) =>
|
|
13708
|
+
inst._zod.processJSONSchema = (ctx, json2, params) => optionalProcessor(inst, ctx, json2, params);
|
|
13709
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
13709
13710
|
});
|
|
13710
|
-
function
|
|
13711
|
-
return
|
|
13711
|
+
function optional(innerType) {
|
|
13712
|
+
return new ZodOptional({
|
|
13713
|
+
type: "optional",
|
|
13714
|
+
innerType
|
|
13715
|
+
});
|
|
13712
13716
|
}
|
|
13713
|
-
var
|
|
13714
|
-
$
|
|
13717
|
+
var ZodExactOptional = /* @__PURE__ */ $constructor("ZodExactOptional", (inst, def) => {
|
|
13718
|
+
$ZodExactOptional.init(inst, def);
|
|
13715
13719
|
ZodType.init(inst, def);
|
|
13716
|
-
inst._zod.processJSONSchema = (ctx, json2, params) =>
|
|
13720
|
+
inst._zod.processJSONSchema = (ctx, json2, params) => optionalProcessor(inst, ctx, json2, params);
|
|
13721
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
13717
13722
|
});
|
|
13718
|
-
function
|
|
13719
|
-
return
|
|
13723
|
+
function exactOptional(innerType) {
|
|
13724
|
+
return new ZodExactOptional({
|
|
13725
|
+
type: "optional",
|
|
13726
|
+
innerType
|
|
13727
|
+
});
|
|
13720
13728
|
}
|
|
13721
|
-
var
|
|
13722
|
-
$
|
|
13729
|
+
var ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
|
|
13730
|
+
$ZodNullable.init(inst, def);
|
|
13723
13731
|
ZodType.init(inst, def);
|
|
13724
|
-
inst._zod.processJSONSchema = (ctx, json2, params) =>
|
|
13732
|
+
inst._zod.processJSONSchema = (ctx, json2, params) => nullableProcessor(inst, ctx, json2, params);
|
|
13733
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
13725
13734
|
});
|
|
13726
|
-
function
|
|
13727
|
-
return
|
|
13735
|
+
function nullable(innerType) {
|
|
13736
|
+
return new ZodNullable({
|
|
13737
|
+
type: "nullable",
|
|
13738
|
+
innerType
|
|
13739
|
+
});
|
|
13728
13740
|
}
|
|
13729
|
-
|
|
13730
|
-
|
|
13741
|
+
function nullish2(innerType) {
|
|
13742
|
+
return optional(nullable(innerType));
|
|
13743
|
+
}
|
|
13744
|
+
var ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
|
|
13745
|
+
$ZodDefault.init(inst, def);
|
|
13731
13746
|
ZodType.init(inst, def);
|
|
13732
|
-
inst._zod.processJSONSchema = (ctx, json2, params) =>
|
|
13747
|
+
inst._zod.processJSONSchema = (ctx, json2, params) => defaultProcessor(inst, ctx, json2, params);
|
|
13748
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
13749
|
+
inst.removeDefault = inst.unwrap;
|
|
13733
13750
|
});
|
|
13734
|
-
function
|
|
13735
|
-
return
|
|
13751
|
+
function _default2(innerType, defaultValue) {
|
|
13752
|
+
return new ZodDefault({
|
|
13753
|
+
type: "default",
|
|
13754
|
+
innerType,
|
|
13755
|
+
get defaultValue() {
|
|
13756
|
+
return typeof defaultValue === "function" ? defaultValue() : util_exports.shallowClone(defaultValue);
|
|
13757
|
+
}
|
|
13758
|
+
});
|
|
13736
13759
|
}
|
|
13737
|
-
var
|
|
13738
|
-
$
|
|
13760
|
+
var ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
|
|
13761
|
+
$ZodPrefault.init(inst, def);
|
|
13739
13762
|
ZodType.init(inst, def);
|
|
13740
|
-
inst._zod.processJSONSchema = (ctx, json2, params) =>
|
|
13763
|
+
inst._zod.processJSONSchema = (ctx, json2, params) => prefaultProcessor(inst, ctx, json2, params);
|
|
13764
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
13741
13765
|
});
|
|
13742
|
-
function
|
|
13743
|
-
return
|
|
13766
|
+
function prefault(innerType, defaultValue) {
|
|
13767
|
+
return new ZodPrefault({
|
|
13768
|
+
type: "prefault",
|
|
13769
|
+
innerType,
|
|
13770
|
+
get defaultValue() {
|
|
13771
|
+
return typeof defaultValue === "function" ? defaultValue() : util_exports.shallowClone(defaultValue);
|
|
13772
|
+
}
|
|
13773
|
+
});
|
|
13744
13774
|
}
|
|
13745
|
-
var
|
|
13746
|
-
$
|
|
13775
|
+
var ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
|
|
13776
|
+
$ZodNonOptional.init(inst, def);
|
|
13747
13777
|
ZodType.init(inst, def);
|
|
13748
|
-
inst._zod.processJSONSchema = (ctx, json2, params) =>
|
|
13778
|
+
inst._zod.processJSONSchema = (ctx, json2, params) => nonoptionalProcessor(inst, ctx, json2, params);
|
|
13779
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
13749
13780
|
});
|
|
13750
|
-
function
|
|
13751
|
-
return
|
|
13781
|
+
function nonoptional(innerType, params) {
|
|
13782
|
+
return new ZodNonOptional({
|
|
13783
|
+
type: "nonoptional",
|
|
13784
|
+
innerType,
|
|
13785
|
+
...util_exports.normalizeParams(params)
|
|
13786
|
+
});
|
|
13752
13787
|
}
|
|
13753
|
-
var
|
|
13754
|
-
$
|
|
13788
|
+
var ZodSuccess = /* @__PURE__ */ $constructor("ZodSuccess", (inst, def) => {
|
|
13789
|
+
$ZodSuccess.init(inst, def);
|
|
13755
13790
|
ZodType.init(inst, def);
|
|
13756
|
-
inst._zod.processJSONSchema = (ctx, json2, params) =>
|
|
13791
|
+
inst._zod.processJSONSchema = (ctx, json2, params) => successProcessor(inst, ctx, json2, params);
|
|
13792
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
13757
13793
|
});
|
|
13758
|
-
function
|
|
13759
|
-
return
|
|
13794
|
+
function success(innerType) {
|
|
13795
|
+
return new ZodSuccess({
|
|
13796
|
+
type: "success",
|
|
13797
|
+
innerType
|
|
13798
|
+
});
|
|
13760
13799
|
}
|
|
13761
|
-
var
|
|
13762
|
-
$
|
|
13800
|
+
var ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
|
|
13801
|
+
$ZodCatch.init(inst, def);
|
|
13763
13802
|
ZodType.init(inst, def);
|
|
13764
|
-
inst._zod.processJSONSchema = (ctx, json2, params) =>
|
|
13765
|
-
inst.
|
|
13766
|
-
inst.
|
|
13767
|
-
const c = inst._zod.bag;
|
|
13768
|
-
inst.minDate = c.minimum ? new Date(c.minimum) : null;
|
|
13769
|
-
inst.maxDate = c.maximum ? new Date(c.maximum) : null;
|
|
13803
|
+
inst._zod.processJSONSchema = (ctx, json2, params) => catchProcessor(inst, ctx, json2, params);
|
|
13804
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
13805
|
+
inst.removeCatch = inst.unwrap;
|
|
13770
13806
|
});
|
|
13771
|
-
function
|
|
13772
|
-
return
|
|
13807
|
+
function _catch2(innerType, catchValue) {
|
|
13808
|
+
return new ZodCatch({
|
|
13809
|
+
type: "catch",
|
|
13810
|
+
innerType,
|
|
13811
|
+
catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
|
|
13812
|
+
});
|
|
13773
13813
|
}
|
|
13774
|
-
var
|
|
13775
|
-
$
|
|
13814
|
+
var ZodNaN = /* @__PURE__ */ $constructor("ZodNaN", (inst, def) => {
|
|
13815
|
+
$ZodNaN.init(inst, def);
|
|
13776
13816
|
ZodType.init(inst, def);
|
|
13777
|
-
inst._zod.processJSONSchema = (ctx, json2, params) =>
|
|
13778
|
-
inst.element = def.element;
|
|
13779
|
-
_installLazyMethods(inst, "ZodArray", {
|
|
13780
|
-
min(n, params) {
|
|
13781
|
-
return this.check(_minLength(n, params));
|
|
13782
|
-
},
|
|
13783
|
-
nonempty(params) {
|
|
13784
|
-
return this.check(_minLength(1, params));
|
|
13785
|
-
},
|
|
13786
|
-
max(n, params) {
|
|
13787
|
-
return this.check(_maxLength(n, params));
|
|
13788
|
-
},
|
|
13789
|
-
length(n, params) {
|
|
13790
|
-
return this.check(_length(n, params));
|
|
13791
|
-
},
|
|
13792
|
-
unwrap() {
|
|
13793
|
-
return this.element;
|
|
13794
|
-
}
|
|
13795
|
-
});
|
|
13817
|
+
inst._zod.processJSONSchema = (ctx, json2, params) => nanProcessor(inst, ctx, json2, params);
|
|
13796
13818
|
});
|
|
13797
|
-
function
|
|
13798
|
-
return
|
|
13799
|
-
}
|
|
13800
|
-
function keyof(schema) {
|
|
13801
|
-
const shape = schema._zod.def.shape;
|
|
13802
|
-
return _enum2(Object.keys(shape));
|
|
13819
|
+
function nan(params) {
|
|
13820
|
+
return _nan(ZodNaN, params);
|
|
13803
13821
|
}
|
|
13804
|
-
var
|
|
13805
|
-
$
|
|
13822
|
+
var ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
|
|
13823
|
+
$ZodPipe.init(inst, def);
|
|
13806
13824
|
ZodType.init(inst, def);
|
|
13807
|
-
inst._zod.processJSONSchema = (ctx, json2, params) =>
|
|
13808
|
-
|
|
13809
|
-
|
|
13810
|
-
});
|
|
13811
|
-
_installLazyMethods(inst, "ZodObject", {
|
|
13812
|
-
keyof() {
|
|
13813
|
-
return _enum2(Object.keys(this._zod.def.shape));
|
|
13814
|
-
},
|
|
13815
|
-
catchall(catchall) {
|
|
13816
|
-
return this.clone({ ...this._zod.def, catchall });
|
|
13817
|
-
},
|
|
13818
|
-
passthrough() {
|
|
13819
|
-
return this.clone({ ...this._zod.def, catchall: unknown() });
|
|
13820
|
-
},
|
|
13821
|
-
loose() {
|
|
13822
|
-
return this.clone({ ...this._zod.def, catchall: unknown() });
|
|
13823
|
-
},
|
|
13824
|
-
strict() {
|
|
13825
|
-
return this.clone({ ...this._zod.def, catchall: never() });
|
|
13826
|
-
},
|
|
13827
|
-
strip() {
|
|
13828
|
-
return this.clone({ ...this._zod.def, catchall: void 0 });
|
|
13829
|
-
},
|
|
13830
|
-
extend(incoming) {
|
|
13831
|
-
return util_exports.extend(this, incoming);
|
|
13832
|
-
},
|
|
13833
|
-
safeExtend(incoming) {
|
|
13834
|
-
return util_exports.safeExtend(this, incoming);
|
|
13835
|
-
},
|
|
13836
|
-
merge(other) {
|
|
13837
|
-
return util_exports.merge(this, other);
|
|
13838
|
-
},
|
|
13839
|
-
pick(mask) {
|
|
13840
|
-
return util_exports.pick(this, mask);
|
|
13841
|
-
},
|
|
13842
|
-
omit(mask) {
|
|
13843
|
-
return util_exports.omit(this, mask);
|
|
13844
|
-
},
|
|
13845
|
-
partial(...args) {
|
|
13846
|
-
return util_exports.partial(ZodOptional, this, args[0]);
|
|
13847
|
-
},
|
|
13848
|
-
required(...args) {
|
|
13849
|
-
return util_exports.required(ZodNonOptional, this, args[0]);
|
|
13850
|
-
}
|
|
13851
|
-
});
|
|
13825
|
+
inst._zod.processJSONSchema = (ctx, json2, params) => pipeProcessor(inst, ctx, json2, params);
|
|
13826
|
+
inst.in = def.in;
|
|
13827
|
+
inst.out = def.out;
|
|
13852
13828
|
});
|
|
13853
|
-
function
|
|
13854
|
-
|
|
13855
|
-
type: "
|
|
13856
|
-
|
|
13857
|
-
|
|
13858
|
-
|
|
13859
|
-
|
|
13829
|
+
function pipe(in_, out) {
|
|
13830
|
+
return new ZodPipe({
|
|
13831
|
+
type: "pipe",
|
|
13832
|
+
in: in_,
|
|
13833
|
+
out
|
|
13834
|
+
// ...util.normalizeParams(params),
|
|
13835
|
+
});
|
|
13860
13836
|
}
|
|
13861
|
-
|
|
13862
|
-
|
|
13863
|
-
|
|
13864
|
-
|
|
13865
|
-
|
|
13866
|
-
|
|
13837
|
+
var ZodCodec = /* @__PURE__ */ $constructor("ZodCodec", (inst, def) => {
|
|
13838
|
+
ZodPipe.init(inst, def);
|
|
13839
|
+
$ZodCodec.init(inst, def);
|
|
13840
|
+
});
|
|
13841
|
+
function codec(in_, out, params) {
|
|
13842
|
+
return new ZodCodec({
|
|
13843
|
+
type: "pipe",
|
|
13844
|
+
in: in_,
|
|
13845
|
+
out,
|
|
13846
|
+
transform: params.decode,
|
|
13847
|
+
reverseTransform: params.encode
|
|
13867
13848
|
});
|
|
13868
13849
|
}
|
|
13869
|
-
function
|
|
13870
|
-
|
|
13871
|
-
|
|
13872
|
-
|
|
13873
|
-
|
|
13874
|
-
|
|
13850
|
+
function invertCodec(codec2) {
|
|
13851
|
+
const def = codec2._zod.def;
|
|
13852
|
+
return new ZodCodec({
|
|
13853
|
+
type: "pipe",
|
|
13854
|
+
in: def.out,
|
|
13855
|
+
out: def.in,
|
|
13856
|
+
transform: def.reverseTransform,
|
|
13857
|
+
reverseTransform: def.transform
|
|
13875
13858
|
});
|
|
13876
13859
|
}
|
|
13877
|
-
var
|
|
13878
|
-
|
|
13860
|
+
var ZodPreprocess = /* @__PURE__ */ $constructor("ZodPreprocess", (inst, def) => {
|
|
13861
|
+
ZodPipe.init(inst, def);
|
|
13862
|
+
$ZodPreprocess.init(inst, def);
|
|
13863
|
+
});
|
|
13864
|
+
var ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
|
|
13865
|
+
$ZodReadonly.init(inst, def);
|
|
13879
13866
|
ZodType.init(inst, def);
|
|
13880
|
-
inst._zod.processJSONSchema = (ctx, json2, params) =>
|
|
13881
|
-
inst.
|
|
13867
|
+
inst._zod.processJSONSchema = (ctx, json2, params) => readonlyProcessor(inst, ctx, json2, params);
|
|
13868
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
13882
13869
|
});
|
|
13883
|
-
function
|
|
13884
|
-
return new
|
|
13885
|
-
type: "
|
|
13886
|
-
|
|
13887
|
-
...util_exports.normalizeParams(params)
|
|
13870
|
+
function readonly(innerType) {
|
|
13871
|
+
return new ZodReadonly({
|
|
13872
|
+
type: "readonly",
|
|
13873
|
+
innerType
|
|
13888
13874
|
});
|
|
13889
13875
|
}
|
|
13890
|
-
var
|
|
13891
|
-
|
|
13892
|
-
|
|
13893
|
-
inst._zod.processJSONSchema = (ctx, json2, params) =>
|
|
13894
|
-
inst.options = def.options;
|
|
13876
|
+
var ZodTemplateLiteral = /* @__PURE__ */ $constructor("ZodTemplateLiteral", (inst, def) => {
|
|
13877
|
+
$ZodTemplateLiteral.init(inst, def);
|
|
13878
|
+
ZodType.init(inst, def);
|
|
13879
|
+
inst._zod.processJSONSchema = (ctx, json2, params) => templateLiteralProcessor(inst, ctx, json2, params);
|
|
13895
13880
|
});
|
|
13896
|
-
function
|
|
13897
|
-
return new
|
|
13898
|
-
type: "
|
|
13899
|
-
|
|
13900
|
-
inclusive: false,
|
|
13881
|
+
function templateLiteral(parts, params) {
|
|
13882
|
+
return new ZodTemplateLiteral({
|
|
13883
|
+
type: "template_literal",
|
|
13884
|
+
parts,
|
|
13901
13885
|
...util_exports.normalizeParams(params)
|
|
13902
13886
|
});
|
|
13903
13887
|
}
|
|
13904
|
-
var
|
|
13905
|
-
|
|
13906
|
-
|
|
13888
|
+
var ZodLazy = /* @__PURE__ */ $constructor("ZodLazy", (inst, def) => {
|
|
13889
|
+
$ZodLazy.init(inst, def);
|
|
13890
|
+
ZodType.init(inst, def);
|
|
13891
|
+
inst._zod.processJSONSchema = (ctx, json2, params) => lazyProcessor(inst, ctx, json2, params);
|
|
13892
|
+
inst.unwrap = () => inst._zod.def.getter();
|
|
13907
13893
|
});
|
|
13908
|
-
function
|
|
13909
|
-
return new
|
|
13910
|
-
type: "
|
|
13911
|
-
|
|
13912
|
-
discriminator,
|
|
13913
|
-
...util_exports.normalizeParams(params)
|
|
13894
|
+
function lazy(getter) {
|
|
13895
|
+
return new ZodLazy({
|
|
13896
|
+
type: "lazy",
|
|
13897
|
+
getter
|
|
13914
13898
|
});
|
|
13915
13899
|
}
|
|
13916
|
-
var
|
|
13917
|
-
$
|
|
13900
|
+
var ZodPromise = /* @__PURE__ */ $constructor("ZodPromise", (inst, def) => {
|
|
13901
|
+
$ZodPromise.init(inst, def);
|
|
13918
13902
|
ZodType.init(inst, def);
|
|
13919
|
-
inst._zod.processJSONSchema = (ctx, json2, params) =>
|
|
13903
|
+
inst._zod.processJSONSchema = (ctx, json2, params) => promiseProcessor(inst, ctx, json2, params);
|
|
13904
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
13920
13905
|
});
|
|
13921
|
-
function
|
|
13922
|
-
return new
|
|
13923
|
-
type: "
|
|
13924
|
-
|
|
13925
|
-
right
|
|
13906
|
+
function promise(innerType) {
|
|
13907
|
+
return new ZodPromise({
|
|
13908
|
+
type: "promise",
|
|
13909
|
+
innerType
|
|
13926
13910
|
});
|
|
13927
13911
|
}
|
|
13928
|
-
var
|
|
13929
|
-
$
|
|
13912
|
+
var ZodFunction = /* @__PURE__ */ $constructor("ZodFunction", (inst, def) => {
|
|
13913
|
+
$ZodFunction.init(inst, def);
|
|
13930
13914
|
ZodType.init(inst, def);
|
|
13931
|
-
inst._zod.processJSONSchema = (ctx, json2, params) =>
|
|
13932
|
-
inst.rest = (rest) => inst.clone({
|
|
13933
|
-
...inst._zod.def,
|
|
13934
|
-
rest
|
|
13935
|
-
});
|
|
13915
|
+
inst._zod.processJSONSchema = (ctx, json2, params) => functionProcessor(inst, ctx, json2, params);
|
|
13936
13916
|
});
|
|
13937
|
-
function
|
|
13938
|
-
|
|
13939
|
-
|
|
13940
|
-
|
|
13941
|
-
|
|
13942
|
-
type: "tuple",
|
|
13943
|
-
items,
|
|
13944
|
-
rest,
|
|
13945
|
-
...util_exports.normalizeParams(params)
|
|
13917
|
+
function _function(params) {
|
|
13918
|
+
return new ZodFunction({
|
|
13919
|
+
type: "function",
|
|
13920
|
+
input: Array.isArray(params?.input) ? tuple(params?.input) : params?.input ?? array(unknown()),
|
|
13921
|
+
output: params?.output ?? unknown()
|
|
13946
13922
|
});
|
|
13947
13923
|
}
|
|
13948
|
-
var
|
|
13949
|
-
$
|
|
13924
|
+
var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
|
|
13925
|
+
$ZodCustom.init(inst, def);
|
|
13950
13926
|
ZodType.init(inst, def);
|
|
13951
|
-
inst._zod.processJSONSchema = (ctx, json2, params) =>
|
|
13952
|
-
inst.keyType = def.keyType;
|
|
13953
|
-
inst.valueType = def.valueType;
|
|
13927
|
+
inst._zod.processJSONSchema = (ctx, json2, params) => customProcessor(inst, ctx, json2, params);
|
|
13954
13928
|
});
|
|
13955
|
-
function
|
|
13956
|
-
|
|
13957
|
-
|
|
13958
|
-
|
|
13959
|
-
|
|
13960
|
-
|
|
13961
|
-
|
|
13962
|
-
|
|
13929
|
+
function check(fn) {
|
|
13930
|
+
const ch = new $ZodCheck({
|
|
13931
|
+
check: "custom"
|
|
13932
|
+
// ...util.normalizeParams(params),
|
|
13933
|
+
});
|
|
13934
|
+
ch._zod.check = fn;
|
|
13935
|
+
return ch;
|
|
13936
|
+
}
|
|
13937
|
+
function custom(fn, _params) {
|
|
13938
|
+
return _custom(ZodCustom, fn ?? (() => true), _params);
|
|
13939
|
+
}
|
|
13940
|
+
function refine(fn, _params = {}) {
|
|
13941
|
+
return _refine(ZodCustom, fn, _params);
|
|
13942
|
+
}
|
|
13943
|
+
function superRefine(fn, params) {
|
|
13944
|
+
return _superRefine(fn, params);
|
|
13945
|
+
}
|
|
13946
|
+
var describe2 = describe;
|
|
13947
|
+
var meta2 = meta;
|
|
13948
|
+
function _instanceof(cls, params = {}) {
|
|
13949
|
+
const inst = new ZodCustom({
|
|
13950
|
+
type: "custom",
|
|
13951
|
+
check: "custom",
|
|
13952
|
+
fn: (data) => data instanceof cls,
|
|
13953
|
+
abort: true,
|
|
13954
|
+
...util_exports.normalizeParams(params)
|
|
13955
|
+
});
|
|
13956
|
+
inst._zod.bag.Class = cls;
|
|
13957
|
+
inst._zod.check = (payload) => {
|
|
13958
|
+
if (!(payload.value instanceof cls)) {
|
|
13959
|
+
payload.issues.push({
|
|
13960
|
+
code: "invalid_type",
|
|
13961
|
+
expected: cls.name,
|
|
13962
|
+
input: payload.value,
|
|
13963
|
+
inst,
|
|
13964
|
+
path: [...inst._zod.def.path ?? []]
|
|
13965
|
+
});
|
|
13966
|
+
}
|
|
13967
|
+
};
|
|
13968
|
+
return inst;
|
|
13969
|
+
}
|
|
13970
|
+
var stringbool = (...args) => _stringbool({
|
|
13971
|
+
Codec: ZodCodec,
|
|
13972
|
+
Boolean: ZodBoolean,
|
|
13973
|
+
String: ZodString
|
|
13974
|
+
}, ...args);
|
|
13975
|
+
function json(params) {
|
|
13976
|
+
const jsonSchema = lazy(() => {
|
|
13977
|
+
return union([string2(params), number2(), boolean2(), _null3(), array(jsonSchema), record(string2(), jsonSchema)]);
|
|
13978
|
+
});
|
|
13979
|
+
return jsonSchema;
|
|
13980
|
+
}
|
|
13981
|
+
function preprocess(fn, schema) {
|
|
13982
|
+
return new ZodPreprocess({
|
|
13983
|
+
type: "pipe",
|
|
13984
|
+
in: transform(fn),
|
|
13985
|
+
out: schema
|
|
13986
|
+
});
|
|
13987
|
+
}
|
|
13988
|
+
|
|
13989
|
+
// node_modules/zod/v4/classic/compat.js
|
|
13990
|
+
var ZodIssueCode = {
|
|
13991
|
+
invalid_type: "invalid_type",
|
|
13992
|
+
too_big: "too_big",
|
|
13993
|
+
too_small: "too_small",
|
|
13994
|
+
invalid_format: "invalid_format",
|
|
13995
|
+
not_multiple_of: "not_multiple_of",
|
|
13996
|
+
unrecognized_keys: "unrecognized_keys",
|
|
13997
|
+
invalid_union: "invalid_union",
|
|
13998
|
+
invalid_key: "invalid_key",
|
|
13999
|
+
invalid_element: "invalid_element",
|
|
14000
|
+
invalid_value: "invalid_value",
|
|
14001
|
+
custom: "custom"
|
|
14002
|
+
};
|
|
14003
|
+
function setErrorMap(map2) {
|
|
14004
|
+
config({
|
|
14005
|
+
customError: map2
|
|
14006
|
+
});
|
|
14007
|
+
}
|
|
14008
|
+
function getErrorMap() {
|
|
14009
|
+
return config().customError;
|
|
14010
|
+
}
|
|
14011
|
+
var ZodFirstPartyTypeKind;
|
|
14012
|
+
/* @__PURE__ */ (function(ZodFirstPartyTypeKind2) {
|
|
14013
|
+
})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
|
|
14014
|
+
|
|
14015
|
+
// node_modules/zod/v4/classic/from-json-schema.js
|
|
14016
|
+
var z = {
|
|
14017
|
+
...schemas_exports2,
|
|
14018
|
+
...checks_exports2,
|
|
14019
|
+
iso: iso_exports
|
|
14020
|
+
};
|
|
14021
|
+
var RECOGNIZED_KEYS = /* @__PURE__ */ new Set([
|
|
14022
|
+
// Schema identification
|
|
14023
|
+
"$schema",
|
|
14024
|
+
"$ref",
|
|
14025
|
+
"$defs",
|
|
14026
|
+
"definitions",
|
|
14027
|
+
// Core schema keywords
|
|
14028
|
+
"$id",
|
|
14029
|
+
"id",
|
|
14030
|
+
"$comment",
|
|
14031
|
+
"$anchor",
|
|
14032
|
+
"$vocabulary",
|
|
14033
|
+
"$dynamicRef",
|
|
14034
|
+
"$dynamicAnchor",
|
|
14035
|
+
// Type
|
|
14036
|
+
"type",
|
|
14037
|
+
"enum",
|
|
14038
|
+
"const",
|
|
14039
|
+
// Composition
|
|
14040
|
+
"anyOf",
|
|
14041
|
+
"oneOf",
|
|
14042
|
+
"allOf",
|
|
14043
|
+
"not",
|
|
14044
|
+
// Object
|
|
14045
|
+
"properties",
|
|
14046
|
+
"required",
|
|
14047
|
+
"additionalProperties",
|
|
14048
|
+
"patternProperties",
|
|
14049
|
+
"propertyNames",
|
|
14050
|
+
"minProperties",
|
|
14051
|
+
"maxProperties",
|
|
14052
|
+
// Array
|
|
14053
|
+
"items",
|
|
14054
|
+
"prefixItems",
|
|
14055
|
+
"additionalItems",
|
|
14056
|
+
"minItems",
|
|
14057
|
+
"maxItems",
|
|
14058
|
+
"uniqueItems",
|
|
14059
|
+
"contains",
|
|
14060
|
+
"minContains",
|
|
14061
|
+
"maxContains",
|
|
14062
|
+
// String
|
|
14063
|
+
"minLength",
|
|
14064
|
+
"maxLength",
|
|
14065
|
+
"pattern",
|
|
14066
|
+
"format",
|
|
14067
|
+
// Number
|
|
14068
|
+
"minimum",
|
|
14069
|
+
"maximum",
|
|
14070
|
+
"exclusiveMinimum",
|
|
14071
|
+
"exclusiveMaximum",
|
|
14072
|
+
"multipleOf",
|
|
14073
|
+
// Already handled metadata
|
|
14074
|
+
"description",
|
|
14075
|
+
"default",
|
|
14076
|
+
// Content
|
|
14077
|
+
"contentEncoding",
|
|
14078
|
+
"contentMediaType",
|
|
14079
|
+
"contentSchema",
|
|
14080
|
+
// Unsupported (error-throwing)
|
|
14081
|
+
"unevaluatedItems",
|
|
14082
|
+
"unevaluatedProperties",
|
|
14083
|
+
"if",
|
|
14084
|
+
"then",
|
|
14085
|
+
"else",
|
|
14086
|
+
"dependentSchemas",
|
|
14087
|
+
"dependentRequired",
|
|
14088
|
+
// OpenAPI
|
|
14089
|
+
"nullable",
|
|
14090
|
+
"readOnly"
|
|
14091
|
+
]);
|
|
14092
|
+
function detectVersion(schema, defaultTarget) {
|
|
14093
|
+
const $schema = schema.$schema;
|
|
14094
|
+
if ($schema === "https://json-schema.org/draft/2020-12/schema") {
|
|
14095
|
+
return "draft-2020-12";
|
|
13963
14096
|
}
|
|
13964
|
-
|
|
13965
|
-
|
|
13966
|
-
|
|
13967
|
-
|
|
13968
|
-
|
|
13969
|
-
}
|
|
13970
|
-
|
|
13971
|
-
function partialRecord(keyType, valueType, params) {
|
|
13972
|
-
const k = clone(keyType);
|
|
13973
|
-
k._zod.values = void 0;
|
|
13974
|
-
return new ZodRecord({
|
|
13975
|
-
type: "record",
|
|
13976
|
-
keyType: k,
|
|
13977
|
-
valueType,
|
|
13978
|
-
...util_exports.normalizeParams(params)
|
|
13979
|
-
});
|
|
13980
|
-
}
|
|
13981
|
-
function looseRecord(keyType, valueType, params) {
|
|
13982
|
-
return new ZodRecord({
|
|
13983
|
-
type: "record",
|
|
13984
|
-
keyType,
|
|
13985
|
-
valueType,
|
|
13986
|
-
mode: "loose",
|
|
13987
|
-
...util_exports.normalizeParams(params)
|
|
13988
|
-
});
|
|
13989
|
-
}
|
|
13990
|
-
var ZodMap = /* @__PURE__ */ $constructor("ZodMap", (inst, def) => {
|
|
13991
|
-
$ZodMap.init(inst, def);
|
|
13992
|
-
ZodType.init(inst, def);
|
|
13993
|
-
inst._zod.processJSONSchema = (ctx, json2, params) => mapProcessor(inst, ctx, json2, params);
|
|
13994
|
-
inst.keyType = def.keyType;
|
|
13995
|
-
inst.valueType = def.valueType;
|
|
13996
|
-
inst.min = (...args) => inst.check(_minSize(...args));
|
|
13997
|
-
inst.nonempty = (params) => inst.check(_minSize(1, params));
|
|
13998
|
-
inst.max = (...args) => inst.check(_maxSize(...args));
|
|
13999
|
-
inst.size = (...args) => inst.check(_size(...args));
|
|
14000
|
-
});
|
|
14001
|
-
function map(keyType, valueType, params) {
|
|
14002
|
-
return new ZodMap({
|
|
14003
|
-
type: "map",
|
|
14004
|
-
keyType,
|
|
14005
|
-
valueType,
|
|
14006
|
-
...util_exports.normalizeParams(params)
|
|
14007
|
-
});
|
|
14097
|
+
if ($schema === "http://json-schema.org/draft-07/schema#") {
|
|
14098
|
+
return "draft-7";
|
|
14099
|
+
}
|
|
14100
|
+
if ($schema === "http://json-schema.org/draft-04/schema#") {
|
|
14101
|
+
return "draft-4";
|
|
14102
|
+
}
|
|
14103
|
+
return defaultTarget ?? "draft-2020-12";
|
|
14008
14104
|
}
|
|
14009
|
-
|
|
14010
|
-
|
|
14011
|
-
|
|
14012
|
-
|
|
14013
|
-
|
|
14014
|
-
|
|
14015
|
-
|
|
14016
|
-
|
|
14017
|
-
|
|
14018
|
-
|
|
14019
|
-
|
|
14020
|
-
|
|
14021
|
-
|
|
14022
|
-
|
|
14023
|
-
|
|
14105
|
+
function resolveRef(ref, ctx) {
|
|
14106
|
+
if (!ref.startsWith("#")) {
|
|
14107
|
+
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
14108
|
+
}
|
|
14109
|
+
const path = ref.slice(1).split("/").filter(Boolean);
|
|
14110
|
+
if (path.length === 0) {
|
|
14111
|
+
return ctx.rootSchema;
|
|
14112
|
+
}
|
|
14113
|
+
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
14114
|
+
if (path[0] === defsKey) {
|
|
14115
|
+
const key = path[1];
|
|
14116
|
+
if (!key || !ctx.defs[key]) {
|
|
14117
|
+
throw new Error(`Reference not found: ${ref}`);
|
|
14118
|
+
}
|
|
14119
|
+
return ctx.defs[key];
|
|
14120
|
+
}
|
|
14121
|
+
throw new Error(`Reference not found: ${ref}`);
|
|
14024
14122
|
}
|
|
14025
|
-
|
|
14026
|
-
|
|
14027
|
-
|
|
14028
|
-
|
|
14029
|
-
inst.enum = def.entries;
|
|
14030
|
-
inst.options = Object.values(def.entries);
|
|
14031
|
-
const keys = new Set(Object.keys(def.entries));
|
|
14032
|
-
inst.extract = (values, params) => {
|
|
14033
|
-
const newEntries = {};
|
|
14034
|
-
for (const value of values) {
|
|
14035
|
-
if (keys.has(value)) {
|
|
14036
|
-
newEntries[value] = def.entries[value];
|
|
14037
|
-
} else
|
|
14038
|
-
throw new Error(`Key ${value} not found in enum`);
|
|
14123
|
+
function convertBaseSchema(schema, ctx) {
|
|
14124
|
+
if (schema.not !== void 0) {
|
|
14125
|
+
if (typeof schema.not === "object" && Object.keys(schema.not).length === 0) {
|
|
14126
|
+
return z.never();
|
|
14039
14127
|
}
|
|
14040
|
-
|
|
14041
|
-
|
|
14042
|
-
|
|
14043
|
-
|
|
14044
|
-
|
|
14128
|
+
throw new Error("not is not supported in Zod (except { not: {} } for never)");
|
|
14129
|
+
}
|
|
14130
|
+
if (schema.unevaluatedItems !== void 0) {
|
|
14131
|
+
throw new Error("unevaluatedItems is not supported");
|
|
14132
|
+
}
|
|
14133
|
+
if (schema.unevaluatedProperties !== void 0) {
|
|
14134
|
+
throw new Error("unevaluatedProperties is not supported");
|
|
14135
|
+
}
|
|
14136
|
+
if (schema.if !== void 0 || schema.then !== void 0 || schema.else !== void 0) {
|
|
14137
|
+
throw new Error("Conditional schemas (if/then/else) are not supported");
|
|
14138
|
+
}
|
|
14139
|
+
if (schema.dependentSchemas !== void 0 || schema.dependentRequired !== void 0) {
|
|
14140
|
+
throw new Error("dependentSchemas and dependentRequired are not supported");
|
|
14141
|
+
}
|
|
14142
|
+
if (schema.$ref) {
|
|
14143
|
+
const refPath = schema.$ref;
|
|
14144
|
+
if (ctx.refs.has(refPath)) {
|
|
14145
|
+
return ctx.refs.get(refPath);
|
|
14146
|
+
}
|
|
14147
|
+
if (ctx.processing.has(refPath)) {
|
|
14148
|
+
return z.lazy(() => {
|
|
14149
|
+
if (!ctx.refs.has(refPath)) {
|
|
14150
|
+
throw new Error(`Circular reference not resolved: ${refPath}`);
|
|
14151
|
+
}
|
|
14152
|
+
return ctx.refs.get(refPath);
|
|
14153
|
+
});
|
|
14154
|
+
}
|
|
14155
|
+
ctx.processing.add(refPath);
|
|
14156
|
+
const resolved = resolveRef(refPath, ctx);
|
|
14157
|
+
const zodSchema2 = convertSchema(resolved, ctx);
|
|
14158
|
+
ctx.refs.set(refPath, zodSchema2);
|
|
14159
|
+
ctx.processing.delete(refPath);
|
|
14160
|
+
return zodSchema2;
|
|
14161
|
+
}
|
|
14162
|
+
if (schema.enum !== void 0) {
|
|
14163
|
+
const enumValues = schema.enum;
|
|
14164
|
+
if (ctx.version === "openapi-3.0" && schema.nullable === true && enumValues.length === 1 && enumValues[0] === null) {
|
|
14165
|
+
return z.null();
|
|
14166
|
+
}
|
|
14167
|
+
if (enumValues.length === 0) {
|
|
14168
|
+
return z.never();
|
|
14169
|
+
}
|
|
14170
|
+
if (enumValues.length === 1) {
|
|
14171
|
+
return z.literal(enumValues[0]);
|
|
14172
|
+
}
|
|
14173
|
+
if (enumValues.every((v) => typeof v === "string")) {
|
|
14174
|
+
return z.enum(enumValues);
|
|
14175
|
+
}
|
|
14176
|
+
const literalSchemas = enumValues.map((v) => z.literal(v));
|
|
14177
|
+
if (literalSchemas.length < 2) {
|
|
14178
|
+
return literalSchemas[0];
|
|
14179
|
+
}
|
|
14180
|
+
return z.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
|
|
14181
|
+
}
|
|
14182
|
+
if (schema.const !== void 0) {
|
|
14183
|
+
return z.literal(schema.const);
|
|
14184
|
+
}
|
|
14185
|
+
const type = schema.type;
|
|
14186
|
+
if (Array.isArray(type)) {
|
|
14187
|
+
const typeSchemas = type.map((t) => {
|
|
14188
|
+
const typeSchema = { ...schema, type: t };
|
|
14189
|
+
return convertBaseSchema(typeSchema, ctx);
|
|
14045
14190
|
});
|
|
14046
|
-
|
|
14047
|
-
|
|
14048
|
-
|
|
14049
|
-
|
|
14050
|
-
|
|
14051
|
-
|
|
14052
|
-
|
|
14053
|
-
|
|
14191
|
+
if (typeSchemas.length === 0) {
|
|
14192
|
+
return z.never();
|
|
14193
|
+
}
|
|
14194
|
+
if (typeSchemas.length === 1) {
|
|
14195
|
+
return typeSchemas[0];
|
|
14196
|
+
}
|
|
14197
|
+
return z.union(typeSchemas);
|
|
14198
|
+
}
|
|
14199
|
+
if (!type) {
|
|
14200
|
+
return z.any();
|
|
14201
|
+
}
|
|
14202
|
+
let zodSchema;
|
|
14203
|
+
switch (type) {
|
|
14204
|
+
case "string": {
|
|
14205
|
+
let stringSchema = z.string();
|
|
14206
|
+
if (schema.format) {
|
|
14207
|
+
const format = schema.format;
|
|
14208
|
+
if (format === "email") {
|
|
14209
|
+
stringSchema = stringSchema.check(z.email());
|
|
14210
|
+
} else if (format === "uri" || format === "uri-reference") {
|
|
14211
|
+
stringSchema = stringSchema.check(z.url());
|
|
14212
|
+
} else if (format === "uuid" || format === "guid") {
|
|
14213
|
+
stringSchema = stringSchema.check(z.uuid());
|
|
14214
|
+
} else if (format === "date-time") {
|
|
14215
|
+
stringSchema = stringSchema.check(z.iso.datetime());
|
|
14216
|
+
} else if (format === "date") {
|
|
14217
|
+
stringSchema = stringSchema.check(z.iso.date());
|
|
14218
|
+
} else if (format === "time") {
|
|
14219
|
+
stringSchema = stringSchema.check(z.iso.time());
|
|
14220
|
+
} else if (format === "duration") {
|
|
14221
|
+
stringSchema = stringSchema.check(z.iso.duration());
|
|
14222
|
+
} else if (format === "ipv4") {
|
|
14223
|
+
stringSchema = stringSchema.check(z.ipv4());
|
|
14224
|
+
} else if (format === "ipv6") {
|
|
14225
|
+
stringSchema = stringSchema.check(z.ipv6());
|
|
14226
|
+
} else if (format === "mac") {
|
|
14227
|
+
stringSchema = stringSchema.check(z.mac());
|
|
14228
|
+
} else if (format === "cidr") {
|
|
14229
|
+
stringSchema = stringSchema.check(z.cidrv4());
|
|
14230
|
+
} else if (format === "cidr-v6") {
|
|
14231
|
+
stringSchema = stringSchema.check(z.cidrv6());
|
|
14232
|
+
} else if (format === "base64") {
|
|
14233
|
+
stringSchema = stringSchema.check(z.base64());
|
|
14234
|
+
} else if (format === "base64url") {
|
|
14235
|
+
stringSchema = stringSchema.check(z.base64url());
|
|
14236
|
+
} else if (format === "e164") {
|
|
14237
|
+
stringSchema = stringSchema.check(z.e164());
|
|
14238
|
+
} else if (format === "jwt") {
|
|
14239
|
+
stringSchema = stringSchema.check(z.jwt());
|
|
14240
|
+
} else if (format === "emoji") {
|
|
14241
|
+
stringSchema = stringSchema.check(z.emoji());
|
|
14242
|
+
} else if (format === "nanoid") {
|
|
14243
|
+
stringSchema = stringSchema.check(z.nanoid());
|
|
14244
|
+
} else if (format === "cuid") {
|
|
14245
|
+
stringSchema = stringSchema.check(z.cuid());
|
|
14246
|
+
} else if (format === "cuid2") {
|
|
14247
|
+
stringSchema = stringSchema.check(z.cuid2());
|
|
14248
|
+
} else if (format === "ulid") {
|
|
14249
|
+
stringSchema = stringSchema.check(z.ulid());
|
|
14250
|
+
} else if (format === "xid") {
|
|
14251
|
+
stringSchema = stringSchema.check(z.xid());
|
|
14252
|
+
} else if (format === "ksuid") {
|
|
14253
|
+
stringSchema = stringSchema.check(z.ksuid());
|
|
14254
|
+
}
|
|
14255
|
+
}
|
|
14256
|
+
if (typeof schema.minLength === "number") {
|
|
14257
|
+
stringSchema = stringSchema.min(schema.minLength);
|
|
14258
|
+
}
|
|
14259
|
+
if (typeof schema.maxLength === "number") {
|
|
14260
|
+
stringSchema = stringSchema.max(schema.maxLength);
|
|
14261
|
+
}
|
|
14262
|
+
if (schema.pattern) {
|
|
14263
|
+
stringSchema = stringSchema.regex(new RegExp(schema.pattern));
|
|
14264
|
+
}
|
|
14265
|
+
zodSchema = stringSchema;
|
|
14266
|
+
break;
|
|
14054
14267
|
}
|
|
14055
|
-
|
|
14056
|
-
|
|
14057
|
-
|
|
14058
|
-
|
|
14059
|
-
|
|
14060
|
-
});
|
|
14061
|
-
};
|
|
14062
|
-
});
|
|
14063
|
-
function _enum2(values, params) {
|
|
14064
|
-
const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
|
|
14065
|
-
return new ZodEnum({
|
|
14066
|
-
type: "enum",
|
|
14067
|
-
entries,
|
|
14068
|
-
...util_exports.normalizeParams(params)
|
|
14069
|
-
});
|
|
14070
|
-
}
|
|
14071
|
-
function nativeEnum(entries, params) {
|
|
14072
|
-
return new ZodEnum({
|
|
14073
|
-
type: "enum",
|
|
14074
|
-
entries,
|
|
14075
|
-
...util_exports.normalizeParams(params)
|
|
14076
|
-
});
|
|
14077
|
-
}
|
|
14078
|
-
var ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
|
|
14079
|
-
$ZodLiteral.init(inst, def);
|
|
14080
|
-
ZodType.init(inst, def);
|
|
14081
|
-
inst._zod.processJSONSchema = (ctx, json2, params) => literalProcessor(inst, ctx, json2, params);
|
|
14082
|
-
inst.values = new Set(def.values);
|
|
14083
|
-
Object.defineProperty(inst, "value", {
|
|
14084
|
-
get() {
|
|
14085
|
-
if (def.values.length > 1) {
|
|
14086
|
-
throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
|
|
14268
|
+
case "number":
|
|
14269
|
+
case "integer": {
|
|
14270
|
+
let numberSchema = type === "integer" ? z.number().int() : z.number();
|
|
14271
|
+
if (typeof schema.minimum === "number") {
|
|
14272
|
+
numberSchema = numberSchema.min(schema.minimum);
|
|
14087
14273
|
}
|
|
14088
|
-
|
|
14274
|
+
if (typeof schema.maximum === "number") {
|
|
14275
|
+
numberSchema = numberSchema.max(schema.maximum);
|
|
14276
|
+
}
|
|
14277
|
+
if (typeof schema.exclusiveMinimum === "number") {
|
|
14278
|
+
numberSchema = numberSchema.gt(schema.exclusiveMinimum);
|
|
14279
|
+
} else if (schema.exclusiveMinimum === true && typeof schema.minimum === "number") {
|
|
14280
|
+
numberSchema = numberSchema.gt(schema.minimum);
|
|
14281
|
+
}
|
|
14282
|
+
if (typeof schema.exclusiveMaximum === "number") {
|
|
14283
|
+
numberSchema = numberSchema.lt(schema.exclusiveMaximum);
|
|
14284
|
+
} else if (schema.exclusiveMaximum === true && typeof schema.maximum === "number") {
|
|
14285
|
+
numberSchema = numberSchema.lt(schema.maximum);
|
|
14286
|
+
}
|
|
14287
|
+
if (typeof schema.multipleOf === "number") {
|
|
14288
|
+
numberSchema = numberSchema.multipleOf(schema.multipleOf);
|
|
14289
|
+
}
|
|
14290
|
+
zodSchema = numberSchema;
|
|
14291
|
+
break;
|
|
14089
14292
|
}
|
|
14090
|
-
|
|
14091
|
-
|
|
14092
|
-
|
|
14093
|
-
return new ZodLiteral({
|
|
14094
|
-
type: "literal",
|
|
14095
|
-
values: Array.isArray(value) ? value : [value],
|
|
14096
|
-
...util_exports.normalizeParams(params)
|
|
14097
|
-
});
|
|
14098
|
-
}
|
|
14099
|
-
var ZodFile = /* @__PURE__ */ $constructor("ZodFile", (inst, def) => {
|
|
14100
|
-
$ZodFile.init(inst, def);
|
|
14101
|
-
ZodType.init(inst, def);
|
|
14102
|
-
inst._zod.processJSONSchema = (ctx, json2, params) => fileProcessor(inst, ctx, json2, params);
|
|
14103
|
-
inst.min = (size, params) => inst.check(_minSize(size, params));
|
|
14104
|
-
inst.max = (size, params) => inst.check(_maxSize(size, params));
|
|
14105
|
-
inst.mime = (types, params) => inst.check(_mime(Array.isArray(types) ? types : [types], params));
|
|
14106
|
-
});
|
|
14107
|
-
function file(params) {
|
|
14108
|
-
return _file(ZodFile, params);
|
|
14109
|
-
}
|
|
14110
|
-
var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
|
|
14111
|
-
$ZodTransform.init(inst, def);
|
|
14112
|
-
ZodType.init(inst, def);
|
|
14113
|
-
inst._zod.processJSONSchema = (ctx, json2, params) => transformProcessor(inst, ctx, json2, params);
|
|
14114
|
-
inst._zod.parse = (payload, _ctx) => {
|
|
14115
|
-
if (_ctx.direction === "backward") {
|
|
14116
|
-
throw new $ZodEncodeError(inst.constructor.name);
|
|
14293
|
+
case "boolean": {
|
|
14294
|
+
zodSchema = z.boolean();
|
|
14295
|
+
break;
|
|
14117
14296
|
}
|
|
14118
|
-
|
|
14119
|
-
|
|
14120
|
-
|
|
14297
|
+
case "null": {
|
|
14298
|
+
zodSchema = z.null();
|
|
14299
|
+
break;
|
|
14300
|
+
}
|
|
14301
|
+
case "object": {
|
|
14302
|
+
const shape = {};
|
|
14303
|
+
const properties = schema.properties || {};
|
|
14304
|
+
const requiredSet = new Set(schema.required || []);
|
|
14305
|
+
for (const [key, propSchema] of Object.entries(properties)) {
|
|
14306
|
+
const propZodSchema = convertSchema(propSchema, ctx);
|
|
14307
|
+
shape[key] = requiredSet.has(key) ? propZodSchema : propZodSchema.optional();
|
|
14308
|
+
}
|
|
14309
|
+
if (schema.propertyNames) {
|
|
14310
|
+
const keySchema = convertSchema(schema.propertyNames, ctx);
|
|
14311
|
+
const valueSchema = schema.additionalProperties && typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) : z.any();
|
|
14312
|
+
if (Object.keys(shape).length === 0) {
|
|
14313
|
+
zodSchema = z.record(keySchema, valueSchema);
|
|
14314
|
+
break;
|
|
14315
|
+
}
|
|
14316
|
+
const objectSchema2 = z.object(shape).passthrough();
|
|
14317
|
+
const recordSchema = z.looseRecord(keySchema, valueSchema);
|
|
14318
|
+
zodSchema = z.intersection(objectSchema2, recordSchema);
|
|
14319
|
+
break;
|
|
14320
|
+
}
|
|
14321
|
+
if (schema.patternProperties) {
|
|
14322
|
+
const patternProps = schema.patternProperties;
|
|
14323
|
+
const patternKeys = Object.keys(patternProps);
|
|
14324
|
+
const looseRecords = [];
|
|
14325
|
+
for (const pattern of patternKeys) {
|
|
14326
|
+
const patternValue = convertSchema(patternProps[pattern], ctx);
|
|
14327
|
+
const keySchema = z.string().regex(new RegExp(pattern));
|
|
14328
|
+
looseRecords.push(z.looseRecord(keySchema, patternValue));
|
|
14329
|
+
}
|
|
14330
|
+
const schemasToIntersect = [];
|
|
14331
|
+
if (Object.keys(shape).length > 0) {
|
|
14332
|
+
schemasToIntersect.push(z.object(shape).passthrough());
|
|
14333
|
+
}
|
|
14334
|
+
schemasToIntersect.push(...looseRecords);
|
|
14335
|
+
if (schemasToIntersect.length === 0) {
|
|
14336
|
+
zodSchema = z.object({}).passthrough();
|
|
14337
|
+
} else if (schemasToIntersect.length === 1) {
|
|
14338
|
+
zodSchema = schemasToIntersect[0];
|
|
14339
|
+
} else {
|
|
14340
|
+
let result = z.intersection(schemasToIntersect[0], schemasToIntersect[1]);
|
|
14341
|
+
for (let i = 2; i < schemasToIntersect.length; i++) {
|
|
14342
|
+
result = z.intersection(result, schemasToIntersect[i]);
|
|
14343
|
+
}
|
|
14344
|
+
zodSchema = result;
|
|
14345
|
+
}
|
|
14346
|
+
break;
|
|
14347
|
+
}
|
|
14348
|
+
const objectSchema = z.object(shape);
|
|
14349
|
+
if (schema.additionalProperties === false) {
|
|
14350
|
+
zodSchema = objectSchema.strict();
|
|
14351
|
+
} else if (typeof schema.additionalProperties === "object") {
|
|
14352
|
+
zodSchema = objectSchema.catchall(convertSchema(schema.additionalProperties, ctx));
|
|
14121
14353
|
} else {
|
|
14122
|
-
|
|
14123
|
-
|
|
14124
|
-
|
|
14125
|
-
|
|
14126
|
-
|
|
14127
|
-
|
|
14128
|
-
|
|
14354
|
+
zodSchema = objectSchema.passthrough();
|
|
14355
|
+
}
|
|
14356
|
+
break;
|
|
14357
|
+
}
|
|
14358
|
+
case "array": {
|
|
14359
|
+
const prefixItems = schema.prefixItems;
|
|
14360
|
+
const items = schema.items;
|
|
14361
|
+
if (prefixItems && Array.isArray(prefixItems)) {
|
|
14362
|
+
const tupleItems = prefixItems.map((item) => convertSchema(item, ctx));
|
|
14363
|
+
const rest = items && typeof items === "object" && !Array.isArray(items) ? convertSchema(items, ctx) : void 0;
|
|
14364
|
+
if (rest) {
|
|
14365
|
+
zodSchema = z.tuple(tupleItems).rest(rest);
|
|
14366
|
+
} else {
|
|
14367
|
+
zodSchema = z.tuple(tupleItems);
|
|
14368
|
+
}
|
|
14369
|
+
if (typeof schema.minItems === "number") {
|
|
14370
|
+
zodSchema = zodSchema.check(z.minLength(schema.minItems));
|
|
14371
|
+
}
|
|
14372
|
+
if (typeof schema.maxItems === "number") {
|
|
14373
|
+
zodSchema = zodSchema.check(z.maxLength(schema.maxItems));
|
|
14374
|
+
}
|
|
14375
|
+
} else if (Array.isArray(items)) {
|
|
14376
|
+
const tupleItems = items.map((item) => convertSchema(item, ctx));
|
|
14377
|
+
const rest = schema.additionalItems && typeof schema.additionalItems === "object" ? convertSchema(schema.additionalItems, ctx) : void 0;
|
|
14378
|
+
if (rest) {
|
|
14379
|
+
zodSchema = z.tuple(tupleItems).rest(rest);
|
|
14380
|
+
} else {
|
|
14381
|
+
zodSchema = z.tuple(tupleItems);
|
|
14382
|
+
}
|
|
14383
|
+
if (typeof schema.minItems === "number") {
|
|
14384
|
+
zodSchema = zodSchema.check(z.minLength(schema.minItems));
|
|
14385
|
+
}
|
|
14386
|
+
if (typeof schema.maxItems === "number") {
|
|
14387
|
+
zodSchema = zodSchema.check(z.maxLength(schema.maxItems));
|
|
14388
|
+
}
|
|
14389
|
+
} else if (items !== void 0) {
|
|
14390
|
+
const element = convertSchema(items, ctx);
|
|
14391
|
+
let arraySchema = z.array(element);
|
|
14392
|
+
if (typeof schema.minItems === "number") {
|
|
14393
|
+
arraySchema = arraySchema.min(schema.minItems);
|
|
14394
|
+
}
|
|
14395
|
+
if (typeof schema.maxItems === "number") {
|
|
14396
|
+
arraySchema = arraySchema.max(schema.maxItems);
|
|
14397
|
+
}
|
|
14398
|
+
zodSchema = arraySchema;
|
|
14399
|
+
} else {
|
|
14400
|
+
zodSchema = z.array(z.any());
|
|
14401
|
+
}
|
|
14402
|
+
break;
|
|
14403
|
+
}
|
|
14404
|
+
default:
|
|
14405
|
+
throw new Error(`Unsupported type: ${type}`);
|
|
14406
|
+
}
|
|
14407
|
+
return zodSchema;
|
|
14408
|
+
}
|
|
14409
|
+
function convertSchema(schema, ctx) {
|
|
14410
|
+
if (typeof schema === "boolean") {
|
|
14411
|
+
return schema ? z.any() : z.never();
|
|
14412
|
+
}
|
|
14413
|
+
let baseSchema = convertBaseSchema(schema, ctx);
|
|
14414
|
+
const hasExplicitType = schema.type || schema.enum !== void 0 || schema.const !== void 0;
|
|
14415
|
+
if (schema.anyOf && Array.isArray(schema.anyOf)) {
|
|
14416
|
+
const options = schema.anyOf.map((s) => convertSchema(s, ctx));
|
|
14417
|
+
const anyOfUnion = z.union(options);
|
|
14418
|
+
baseSchema = hasExplicitType ? z.intersection(baseSchema, anyOfUnion) : anyOfUnion;
|
|
14419
|
+
}
|
|
14420
|
+
if (schema.oneOf && Array.isArray(schema.oneOf)) {
|
|
14421
|
+
const options = schema.oneOf.map((s) => convertSchema(s, ctx));
|
|
14422
|
+
const oneOfUnion = z.xor(options);
|
|
14423
|
+
baseSchema = hasExplicitType ? z.intersection(baseSchema, oneOfUnion) : oneOfUnion;
|
|
14424
|
+
}
|
|
14425
|
+
if (schema.allOf && Array.isArray(schema.allOf)) {
|
|
14426
|
+
if (schema.allOf.length === 0) {
|
|
14427
|
+
baseSchema = hasExplicitType ? baseSchema : z.any();
|
|
14428
|
+
} else {
|
|
14429
|
+
let result = hasExplicitType ? baseSchema : convertSchema(schema.allOf[0], ctx);
|
|
14430
|
+
const startIdx = hasExplicitType ? 0 : 1;
|
|
14431
|
+
for (let i = startIdx; i < schema.allOf.length; i++) {
|
|
14432
|
+
result = z.intersection(result, convertSchema(schema.allOf[i], ctx));
|
|
14129
14433
|
}
|
|
14130
|
-
|
|
14131
|
-
const output = def.transform(payload.value, payload);
|
|
14132
|
-
if (output instanceof Promise) {
|
|
14133
|
-
return output.then((output2) => {
|
|
14134
|
-
payload.value = output2;
|
|
14135
|
-
payload.fallback = true;
|
|
14136
|
-
return payload;
|
|
14137
|
-
});
|
|
14434
|
+
baseSchema = result;
|
|
14138
14435
|
}
|
|
14139
|
-
|
|
14140
|
-
|
|
14141
|
-
|
|
14142
|
-
}
|
|
14143
|
-
|
|
14144
|
-
|
|
14145
|
-
|
|
14146
|
-
|
|
14147
|
-
|
|
14148
|
-
}
|
|
14149
|
-
|
|
14150
|
-
|
|
14151
|
-
|
|
14152
|
-
|
|
14153
|
-
|
|
14154
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
14155
|
-
});
|
|
14156
|
-
function optional(innerType) {
|
|
14157
|
-
return new ZodOptional({
|
|
14158
|
-
type: "optional",
|
|
14159
|
-
innerType
|
|
14160
|
-
});
|
|
14161
|
-
}
|
|
14162
|
-
var ZodExactOptional = /* @__PURE__ */ $constructor("ZodExactOptional", (inst, def) => {
|
|
14163
|
-
$ZodExactOptional.init(inst, def);
|
|
14164
|
-
ZodType.init(inst, def);
|
|
14165
|
-
inst._zod.processJSONSchema = (ctx, json2, params) => optionalProcessor(inst, ctx, json2, params);
|
|
14166
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
14167
|
-
});
|
|
14168
|
-
function exactOptional(innerType) {
|
|
14169
|
-
return new ZodExactOptional({
|
|
14170
|
-
type: "optional",
|
|
14171
|
-
innerType
|
|
14172
|
-
});
|
|
14173
|
-
}
|
|
14174
|
-
var ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
|
|
14175
|
-
$ZodNullable.init(inst, def);
|
|
14176
|
-
ZodType.init(inst, def);
|
|
14177
|
-
inst._zod.processJSONSchema = (ctx, json2, params) => nullableProcessor(inst, ctx, json2, params);
|
|
14178
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
14179
|
-
});
|
|
14180
|
-
function nullable(innerType) {
|
|
14181
|
-
return new ZodNullable({
|
|
14182
|
-
type: "nullable",
|
|
14183
|
-
innerType
|
|
14184
|
-
});
|
|
14185
|
-
}
|
|
14186
|
-
function nullish2(innerType) {
|
|
14187
|
-
return optional(nullable(innerType));
|
|
14188
|
-
}
|
|
14189
|
-
var ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
|
|
14190
|
-
$ZodDefault.init(inst, def);
|
|
14191
|
-
ZodType.init(inst, def);
|
|
14192
|
-
inst._zod.processJSONSchema = (ctx, json2, params) => defaultProcessor(inst, ctx, json2, params);
|
|
14193
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
14194
|
-
inst.removeDefault = inst.unwrap;
|
|
14195
|
-
});
|
|
14196
|
-
function _default2(innerType, defaultValue) {
|
|
14197
|
-
return new ZodDefault({
|
|
14198
|
-
type: "default",
|
|
14199
|
-
innerType,
|
|
14200
|
-
get defaultValue() {
|
|
14201
|
-
return typeof defaultValue === "function" ? defaultValue() : util_exports.shallowClone(defaultValue);
|
|
14436
|
+
}
|
|
14437
|
+
if (schema.nullable === true && ctx.version === "openapi-3.0") {
|
|
14438
|
+
baseSchema = z.nullable(baseSchema);
|
|
14439
|
+
}
|
|
14440
|
+
if (schema.readOnly === true) {
|
|
14441
|
+
baseSchema = z.readonly(baseSchema);
|
|
14442
|
+
}
|
|
14443
|
+
if (schema.default !== void 0) {
|
|
14444
|
+
baseSchema = baseSchema.default(schema.default);
|
|
14445
|
+
}
|
|
14446
|
+
const extraMeta = {};
|
|
14447
|
+
const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
|
|
14448
|
+
for (const key of coreMetadataKeys) {
|
|
14449
|
+
if (key in schema) {
|
|
14450
|
+
extraMeta[key] = schema[key];
|
|
14202
14451
|
}
|
|
14203
|
-
}
|
|
14204
|
-
|
|
14205
|
-
|
|
14206
|
-
|
|
14207
|
-
|
|
14208
|
-
inst._zod.processJSONSchema = (ctx, json2, params) => prefaultProcessor(inst, ctx, json2, params);
|
|
14209
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
14210
|
-
});
|
|
14211
|
-
function prefault(innerType, defaultValue) {
|
|
14212
|
-
return new ZodPrefault({
|
|
14213
|
-
type: "prefault",
|
|
14214
|
-
innerType,
|
|
14215
|
-
get defaultValue() {
|
|
14216
|
-
return typeof defaultValue === "function" ? defaultValue() : util_exports.shallowClone(defaultValue);
|
|
14452
|
+
}
|
|
14453
|
+
const contentMetadataKeys = ["contentEncoding", "contentMediaType", "contentSchema"];
|
|
14454
|
+
for (const key of contentMetadataKeys) {
|
|
14455
|
+
if (key in schema) {
|
|
14456
|
+
extraMeta[key] = schema[key];
|
|
14217
14457
|
}
|
|
14218
|
-
}
|
|
14219
|
-
|
|
14220
|
-
|
|
14221
|
-
|
|
14222
|
-
|
|
14223
|
-
|
|
14224
|
-
|
|
14225
|
-
|
|
14226
|
-
|
|
14227
|
-
|
|
14228
|
-
|
|
14229
|
-
|
|
14230
|
-
|
|
14231
|
-
});
|
|
14232
|
-
}
|
|
14233
|
-
var ZodSuccess = /* @__PURE__ */ $constructor("ZodSuccess", (inst, def) => {
|
|
14234
|
-
$ZodSuccess.init(inst, def);
|
|
14235
|
-
ZodType.init(inst, def);
|
|
14236
|
-
inst._zod.processJSONSchema = (ctx, json2, params) => successProcessor(inst, ctx, json2, params);
|
|
14237
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
14238
|
-
});
|
|
14239
|
-
function success(innerType) {
|
|
14240
|
-
return new ZodSuccess({
|
|
14241
|
-
type: "success",
|
|
14242
|
-
innerType
|
|
14243
|
-
});
|
|
14244
|
-
}
|
|
14245
|
-
var ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
|
|
14246
|
-
$ZodCatch.init(inst, def);
|
|
14247
|
-
ZodType.init(inst, def);
|
|
14248
|
-
inst._zod.processJSONSchema = (ctx, json2, params) => catchProcessor(inst, ctx, json2, params);
|
|
14249
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
14250
|
-
inst.removeCatch = inst.unwrap;
|
|
14251
|
-
});
|
|
14252
|
-
function _catch2(innerType, catchValue) {
|
|
14253
|
-
return new ZodCatch({
|
|
14254
|
-
type: "catch",
|
|
14255
|
-
innerType,
|
|
14256
|
-
catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
|
|
14257
|
-
});
|
|
14258
|
-
}
|
|
14259
|
-
var ZodNaN = /* @__PURE__ */ $constructor("ZodNaN", (inst, def) => {
|
|
14260
|
-
$ZodNaN.init(inst, def);
|
|
14261
|
-
ZodType.init(inst, def);
|
|
14262
|
-
inst._zod.processJSONSchema = (ctx, json2, params) => nanProcessor(inst, ctx, json2, params);
|
|
14263
|
-
});
|
|
14264
|
-
function nan(params) {
|
|
14265
|
-
return _nan(ZodNaN, params);
|
|
14266
|
-
}
|
|
14267
|
-
var ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
|
|
14268
|
-
$ZodPipe.init(inst, def);
|
|
14269
|
-
ZodType.init(inst, def);
|
|
14270
|
-
inst._zod.processJSONSchema = (ctx, json2, params) => pipeProcessor(inst, ctx, json2, params);
|
|
14271
|
-
inst.in = def.in;
|
|
14272
|
-
inst.out = def.out;
|
|
14273
|
-
});
|
|
14274
|
-
function pipe(in_, out) {
|
|
14275
|
-
return new ZodPipe({
|
|
14276
|
-
type: "pipe",
|
|
14277
|
-
in: in_,
|
|
14278
|
-
out
|
|
14279
|
-
// ...util.normalizeParams(params),
|
|
14280
|
-
});
|
|
14281
|
-
}
|
|
14282
|
-
var ZodCodec = /* @__PURE__ */ $constructor("ZodCodec", (inst, def) => {
|
|
14283
|
-
ZodPipe.init(inst, def);
|
|
14284
|
-
$ZodCodec.init(inst, def);
|
|
14285
|
-
});
|
|
14286
|
-
function codec(in_, out, params) {
|
|
14287
|
-
return new ZodCodec({
|
|
14288
|
-
type: "pipe",
|
|
14289
|
-
in: in_,
|
|
14290
|
-
out,
|
|
14291
|
-
transform: params.decode,
|
|
14292
|
-
reverseTransform: params.encode
|
|
14293
|
-
});
|
|
14294
|
-
}
|
|
14295
|
-
function invertCodec(codec2) {
|
|
14296
|
-
const def = codec2._zod.def;
|
|
14297
|
-
return new ZodCodec({
|
|
14298
|
-
type: "pipe",
|
|
14299
|
-
in: def.out,
|
|
14300
|
-
out: def.in,
|
|
14301
|
-
transform: def.reverseTransform,
|
|
14302
|
-
reverseTransform: def.transform
|
|
14303
|
-
});
|
|
14304
|
-
}
|
|
14305
|
-
var ZodPreprocess = /* @__PURE__ */ $constructor("ZodPreprocess", (inst, def) => {
|
|
14306
|
-
ZodPipe.init(inst, def);
|
|
14307
|
-
$ZodPreprocess.init(inst, def);
|
|
14308
|
-
});
|
|
14309
|
-
var ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
|
|
14310
|
-
$ZodReadonly.init(inst, def);
|
|
14311
|
-
ZodType.init(inst, def);
|
|
14312
|
-
inst._zod.processJSONSchema = (ctx, json2, params) => readonlyProcessor(inst, ctx, json2, params);
|
|
14313
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
14314
|
-
});
|
|
14315
|
-
function readonly(innerType) {
|
|
14316
|
-
return new ZodReadonly({
|
|
14317
|
-
type: "readonly",
|
|
14318
|
-
innerType
|
|
14319
|
-
});
|
|
14320
|
-
}
|
|
14321
|
-
var ZodTemplateLiteral = /* @__PURE__ */ $constructor("ZodTemplateLiteral", (inst, def) => {
|
|
14322
|
-
$ZodTemplateLiteral.init(inst, def);
|
|
14323
|
-
ZodType.init(inst, def);
|
|
14324
|
-
inst._zod.processJSONSchema = (ctx, json2, params) => templateLiteralProcessor(inst, ctx, json2, params);
|
|
14325
|
-
});
|
|
14326
|
-
function templateLiteral(parts, params) {
|
|
14327
|
-
return new ZodTemplateLiteral({
|
|
14328
|
-
type: "template_literal",
|
|
14329
|
-
parts,
|
|
14330
|
-
...util_exports.normalizeParams(params)
|
|
14331
|
-
});
|
|
14332
|
-
}
|
|
14333
|
-
var ZodLazy = /* @__PURE__ */ $constructor("ZodLazy", (inst, def) => {
|
|
14334
|
-
$ZodLazy.init(inst, def);
|
|
14335
|
-
ZodType.init(inst, def);
|
|
14336
|
-
inst._zod.processJSONSchema = (ctx, json2, params) => lazyProcessor(inst, ctx, json2, params);
|
|
14337
|
-
inst.unwrap = () => inst._zod.def.getter();
|
|
14338
|
-
});
|
|
14339
|
-
function lazy(getter) {
|
|
14340
|
-
return new ZodLazy({
|
|
14341
|
-
type: "lazy",
|
|
14342
|
-
getter
|
|
14343
|
-
});
|
|
14344
|
-
}
|
|
14345
|
-
var ZodPromise = /* @__PURE__ */ $constructor("ZodPromise", (inst, def) => {
|
|
14346
|
-
$ZodPromise.init(inst, def);
|
|
14347
|
-
ZodType.init(inst, def);
|
|
14348
|
-
inst._zod.processJSONSchema = (ctx, json2, params) => promiseProcessor(inst, ctx, json2, params);
|
|
14349
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
14350
|
-
});
|
|
14351
|
-
function promise(innerType) {
|
|
14352
|
-
return new ZodPromise({
|
|
14353
|
-
type: "promise",
|
|
14354
|
-
innerType
|
|
14355
|
-
});
|
|
14458
|
+
}
|
|
14459
|
+
for (const key of Object.keys(schema)) {
|
|
14460
|
+
if (!RECOGNIZED_KEYS.has(key)) {
|
|
14461
|
+
extraMeta[key] = schema[key];
|
|
14462
|
+
}
|
|
14463
|
+
}
|
|
14464
|
+
if (Object.keys(extraMeta).length > 0) {
|
|
14465
|
+
ctx.registry.add(baseSchema, extraMeta);
|
|
14466
|
+
}
|
|
14467
|
+
if (schema.description) {
|
|
14468
|
+
baseSchema = baseSchema.describe(schema.description);
|
|
14469
|
+
}
|
|
14470
|
+
return baseSchema;
|
|
14356
14471
|
}
|
|
14357
|
-
|
|
14358
|
-
|
|
14359
|
-
|
|
14360
|
-
|
|
14361
|
-
|
|
14362
|
-
|
|
14363
|
-
|
|
14364
|
-
|
|
14365
|
-
|
|
14366
|
-
|
|
14367
|
-
|
|
14472
|
+
function fromJSONSchema(schema, params) {
|
|
14473
|
+
if (typeof schema === "boolean") {
|
|
14474
|
+
return schema ? z.any() : z.never();
|
|
14475
|
+
}
|
|
14476
|
+
let normalized;
|
|
14477
|
+
try {
|
|
14478
|
+
normalized = JSON.parse(JSON.stringify(schema));
|
|
14479
|
+
} catch {
|
|
14480
|
+
throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas");
|
|
14481
|
+
}
|
|
14482
|
+
const version2 = detectVersion(normalized, params?.defaultTarget);
|
|
14483
|
+
const defs = normalized.$defs || normalized.definitions || {};
|
|
14484
|
+
const ctx = {
|
|
14485
|
+
version: version2,
|
|
14486
|
+
defs,
|
|
14487
|
+
refs: /* @__PURE__ */ new Map(),
|
|
14488
|
+
processing: /* @__PURE__ */ new Set(),
|
|
14489
|
+
rootSchema: normalized,
|
|
14490
|
+
registry: params?.registry ?? globalRegistry
|
|
14491
|
+
};
|
|
14492
|
+
return convertSchema(normalized, ctx);
|
|
14368
14493
|
}
|
|
14369
|
-
|
|
14370
|
-
|
|
14371
|
-
|
|
14372
|
-
|
|
14494
|
+
|
|
14495
|
+
// node_modules/zod/v4/classic/coerce.js
|
|
14496
|
+
var coerce_exports = {};
|
|
14497
|
+
__export(coerce_exports, {
|
|
14498
|
+
bigint: () => bigint3,
|
|
14499
|
+
boolean: () => boolean3,
|
|
14500
|
+
date: () => date4,
|
|
14501
|
+
number: () => number3,
|
|
14502
|
+
string: () => string3
|
|
14373
14503
|
});
|
|
14374
|
-
function
|
|
14375
|
-
|
|
14376
|
-
check: "custom"
|
|
14377
|
-
// ...util.normalizeParams(params),
|
|
14378
|
-
});
|
|
14379
|
-
ch._zod.check = fn;
|
|
14380
|
-
return ch;
|
|
14381
|
-
}
|
|
14382
|
-
function custom(fn, _params) {
|
|
14383
|
-
return _custom(ZodCustom, fn ?? (() => true), _params);
|
|
14384
|
-
}
|
|
14385
|
-
function refine(fn, _params = {}) {
|
|
14386
|
-
return _refine(ZodCustom, fn, _params);
|
|
14504
|
+
function string3(params) {
|
|
14505
|
+
return _coercedString(ZodString, params);
|
|
14387
14506
|
}
|
|
14388
|
-
function
|
|
14389
|
-
return
|
|
14507
|
+
function number3(params) {
|
|
14508
|
+
return _coercedNumber(ZodNumber, params);
|
|
14390
14509
|
}
|
|
14391
|
-
|
|
14392
|
-
|
|
14393
|
-
function _instanceof(cls, params = {}) {
|
|
14394
|
-
const inst = new ZodCustom({
|
|
14395
|
-
type: "custom",
|
|
14396
|
-
check: "custom",
|
|
14397
|
-
fn: (data) => data instanceof cls,
|
|
14398
|
-
abort: true,
|
|
14399
|
-
...util_exports.normalizeParams(params)
|
|
14400
|
-
});
|
|
14401
|
-
inst._zod.bag.Class = cls;
|
|
14402
|
-
inst._zod.check = (payload) => {
|
|
14403
|
-
if (!(payload.value instanceof cls)) {
|
|
14404
|
-
payload.issues.push({
|
|
14405
|
-
code: "invalid_type",
|
|
14406
|
-
expected: cls.name,
|
|
14407
|
-
input: payload.value,
|
|
14408
|
-
inst,
|
|
14409
|
-
path: [...inst._zod.def.path ?? []]
|
|
14410
|
-
});
|
|
14411
|
-
}
|
|
14412
|
-
};
|
|
14413
|
-
return inst;
|
|
14510
|
+
function boolean3(params) {
|
|
14511
|
+
return _coercedBoolean(ZodBoolean, params);
|
|
14414
14512
|
}
|
|
14415
|
-
|
|
14416
|
-
|
|
14417
|
-
Boolean: ZodBoolean,
|
|
14418
|
-
String: ZodString
|
|
14419
|
-
}, ...args);
|
|
14420
|
-
function json(params) {
|
|
14421
|
-
const jsonSchema = lazy(() => {
|
|
14422
|
-
return union([string2(params), number2(), boolean2(), _null3(), array(jsonSchema), record(string2(), jsonSchema)]);
|
|
14423
|
-
});
|
|
14424
|
-
return jsonSchema;
|
|
14513
|
+
function bigint3(params) {
|
|
14514
|
+
return _coercedBigint(ZodBigInt, params);
|
|
14425
14515
|
}
|
|
14426
|
-
function
|
|
14427
|
-
return
|
|
14428
|
-
type: "pipe",
|
|
14429
|
-
in: transform(fn),
|
|
14430
|
-
out: schema
|
|
14431
|
-
});
|
|
14516
|
+
function date4(params) {
|
|
14517
|
+
return _coercedDate(ZodDate, params);
|
|
14432
14518
|
}
|
|
14433
14519
|
|
|
14434
|
-
// node_modules/zod/v4/classic/
|
|
14435
|
-
|
|
14436
|
-
invalid_type: "invalid_type",
|
|
14437
|
-
too_big: "too_big",
|
|
14438
|
-
too_small: "too_small",
|
|
14439
|
-
invalid_format: "invalid_format",
|
|
14440
|
-
not_multiple_of: "not_multiple_of",
|
|
14441
|
-
unrecognized_keys: "unrecognized_keys",
|
|
14442
|
-
invalid_union: "invalid_union",
|
|
14443
|
-
invalid_key: "invalid_key",
|
|
14444
|
-
invalid_element: "invalid_element",
|
|
14445
|
-
invalid_value: "invalid_value",
|
|
14446
|
-
custom: "custom"
|
|
14447
|
-
};
|
|
14448
|
-
function setErrorMap(map2) {
|
|
14449
|
-
config({
|
|
14450
|
-
customError: map2
|
|
14451
|
-
});
|
|
14452
|
-
}
|
|
14453
|
-
function getErrorMap() {
|
|
14454
|
-
return config().customError;
|
|
14455
|
-
}
|
|
14456
|
-
var ZodFirstPartyTypeKind;
|
|
14457
|
-
/* @__PURE__ */ (function(ZodFirstPartyTypeKind2) {
|
|
14458
|
-
})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
|
|
14520
|
+
// node_modules/zod/v4/classic/external.js
|
|
14521
|
+
config(en_default());
|
|
14459
14522
|
|
|
14460
|
-
// node_modules/
|
|
14461
|
-
var
|
|
14462
|
-
|
|
14463
|
-
|
|
14464
|
-
|
|
14465
|
-
|
|
14466
|
-
|
|
14467
|
-
|
|
14468
|
-
|
|
14469
|
-
|
|
14470
|
-
|
|
14471
|
-
|
|
14472
|
-
|
|
14473
|
-
|
|
14474
|
-
|
|
14475
|
-
|
|
14476
|
-
|
|
14477
|
-
|
|
14478
|
-
|
|
14479
|
-
|
|
14480
|
-
|
|
14481
|
-
|
|
14482
|
-
|
|
14483
|
-
|
|
14484
|
-
|
|
14485
|
-
|
|
14486
|
-
|
|
14487
|
-
|
|
14488
|
-
|
|
14489
|
-
|
|
14490
|
-
|
|
14491
|
-
"required",
|
|
14492
|
-
"additionalProperties",
|
|
14493
|
-
"patternProperties",
|
|
14494
|
-
"propertyNames",
|
|
14495
|
-
"minProperties",
|
|
14496
|
-
"maxProperties",
|
|
14497
|
-
// Array
|
|
14498
|
-
"items",
|
|
14499
|
-
"prefixItems",
|
|
14500
|
-
"additionalItems",
|
|
14501
|
-
"minItems",
|
|
14502
|
-
"maxItems",
|
|
14503
|
-
"uniqueItems",
|
|
14504
|
-
"contains",
|
|
14505
|
-
"minContains",
|
|
14506
|
-
"maxContains",
|
|
14507
|
-
// String
|
|
14508
|
-
"minLength",
|
|
14509
|
-
"maxLength",
|
|
14510
|
-
"pattern",
|
|
14511
|
-
"format",
|
|
14512
|
-
// Number
|
|
14513
|
-
"minimum",
|
|
14514
|
-
"maximum",
|
|
14515
|
-
"exclusiveMinimum",
|
|
14516
|
-
"exclusiveMaximum",
|
|
14517
|
-
"multipleOf",
|
|
14518
|
-
// Already handled metadata
|
|
14519
|
-
"description",
|
|
14520
|
-
"default",
|
|
14521
|
-
// Content
|
|
14522
|
-
"contentEncoding",
|
|
14523
|
-
"contentMediaType",
|
|
14524
|
-
"contentSchema",
|
|
14525
|
-
// Unsupported (error-throwing)
|
|
14526
|
-
"unevaluatedItems",
|
|
14527
|
-
"unevaluatedProperties",
|
|
14528
|
-
"if",
|
|
14529
|
-
"then",
|
|
14530
|
-
"else",
|
|
14531
|
-
"dependentSchemas",
|
|
14532
|
-
"dependentRequired",
|
|
14533
|
-
// OpenAPI
|
|
14534
|
-
"nullable",
|
|
14535
|
-
"readOnly"
|
|
14536
|
-
]);
|
|
14537
|
-
function detectVersion(schema, defaultTarget) {
|
|
14538
|
-
const $schema = schema.$schema;
|
|
14539
|
-
if ($schema === "https://json-schema.org/draft/2020-12/schema") {
|
|
14540
|
-
return "draft-2020-12";
|
|
14523
|
+
// node_modules/@opentabs-dev/shared/dist/error.js
|
|
14524
|
+
var toErrorMessage = (err2) => err2 instanceof Error ? err2.message : String(err2);
|
|
14525
|
+
|
|
14526
|
+
// node_modules/@opentabs-dev/plugin-sdk/dist/errors.js
|
|
14527
|
+
var ToolError = class _ToolError extends Error {
|
|
14528
|
+
code;
|
|
14529
|
+
/** Whether this error is retryable (defaults to false). */
|
|
14530
|
+
retryable;
|
|
14531
|
+
/** Suggested delay before retrying, in milliseconds. */
|
|
14532
|
+
retryAfterMs;
|
|
14533
|
+
/** Error category for structured error classification. */
|
|
14534
|
+
category;
|
|
14535
|
+
constructor(message, code, opts) {
|
|
14536
|
+
super(message);
|
|
14537
|
+
this.code = code;
|
|
14538
|
+
this.name = "ToolError";
|
|
14539
|
+
this.retryable = opts?.retryable ?? false;
|
|
14540
|
+
this.retryAfterMs = opts?.retryAfterMs;
|
|
14541
|
+
this.category = opts?.category;
|
|
14542
|
+
}
|
|
14543
|
+
/** Authentication or authorization error (not retryable). Accepts an optional domain-specific code. */
|
|
14544
|
+
static auth(message, code) {
|
|
14545
|
+
return new _ToolError(message, code ?? "AUTH_ERROR", { category: "auth", retryable: false });
|
|
14546
|
+
}
|
|
14547
|
+
/** Resource not found (not retryable). Accepts an optional domain-specific code. */
|
|
14548
|
+
static notFound(message, code) {
|
|
14549
|
+
return new _ToolError(message, code ?? "NOT_FOUND", { category: "not_found", retryable: false });
|
|
14550
|
+
}
|
|
14551
|
+
/** Rate limited (retryable). Accepts an optional retry delay in milliseconds and an optional domain-specific code. */
|
|
14552
|
+
static rateLimited(message, retryAfterMs, code) {
|
|
14553
|
+
return new _ToolError(message, code ?? "RATE_LIMITED", { category: "rate_limit", retryable: true, retryAfterMs });
|
|
14541
14554
|
}
|
|
14542
|
-
|
|
14543
|
-
|
|
14555
|
+
/** Input validation error (not retryable). Accepts an optional domain-specific code. */
|
|
14556
|
+
static validation(message, code) {
|
|
14557
|
+
return new _ToolError(message, code ?? "VALIDATION_ERROR", { category: "validation", retryable: false });
|
|
14544
14558
|
}
|
|
14545
|
-
|
|
14546
|
-
|
|
14559
|
+
/** Operation timed out (retryable). Accepts an optional domain-specific code. */
|
|
14560
|
+
static timeout(message, code) {
|
|
14561
|
+
return new _ToolError(message, code ?? "TIMEOUT", { category: "timeout", retryable: true });
|
|
14547
14562
|
}
|
|
14548
|
-
|
|
14549
|
-
|
|
14550
|
-
|
|
14551
|
-
if (!ref.startsWith("#")) {
|
|
14552
|
-
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
14563
|
+
/** Internal/unexpected error (not retryable). Accepts an optional domain-specific code. */
|
|
14564
|
+
static internal(message, code) {
|
|
14565
|
+
return new _ToolError(message, code ?? "INTERNAL_ERROR", { category: "internal", retryable: false });
|
|
14553
14566
|
}
|
|
14554
|
-
|
|
14555
|
-
|
|
14556
|
-
|
|
14567
|
+
};
|
|
14568
|
+
|
|
14569
|
+
// node_modules/@opentabs-dev/plugin-sdk/dist/fetch.js
|
|
14570
|
+
var MAX_ERROR_BODY_LENGTH = 512;
|
|
14571
|
+
var httpStatusToToolError = (response, message) => {
|
|
14572
|
+
const status = response.status;
|
|
14573
|
+
if (status === 401 || status === 403) {
|
|
14574
|
+
return ToolError.auth(message);
|
|
14557
14575
|
}
|
|
14558
|
-
|
|
14559
|
-
|
|
14560
|
-
const key = path[1];
|
|
14561
|
-
if (!key || !ctx.defs[key]) {
|
|
14562
|
-
throw new Error(`Reference not found: ${ref}`);
|
|
14563
|
-
}
|
|
14564
|
-
return ctx.defs[key];
|
|
14576
|
+
if (status === 404) {
|
|
14577
|
+
return ToolError.notFound(message);
|
|
14565
14578
|
}
|
|
14566
|
-
|
|
14567
|
-
|
|
14568
|
-
|
|
14569
|
-
|
|
14570
|
-
if (typeof schema.not === "object" && Object.keys(schema.not).length === 0) {
|
|
14571
|
-
return z.never();
|
|
14572
|
-
}
|
|
14573
|
-
throw new Error("not is not supported in Zod (except { not: {} } for never)");
|
|
14579
|
+
if (status === 429) {
|
|
14580
|
+
const retryAfter = response.headers.get("Retry-After");
|
|
14581
|
+
const retryAfterMs = retryAfter !== null ? parseRetryAfterMs(retryAfter) : void 0;
|
|
14582
|
+
return ToolError.rateLimited(message, retryAfterMs);
|
|
14574
14583
|
}
|
|
14575
|
-
if (
|
|
14576
|
-
|
|
14584
|
+
if (status === 400 || status === 422) {
|
|
14585
|
+
return ToolError.validation(message);
|
|
14577
14586
|
}
|
|
14578
|
-
if (
|
|
14579
|
-
|
|
14587
|
+
if (status === 408) {
|
|
14588
|
+
return ToolError.timeout(message);
|
|
14580
14589
|
}
|
|
14581
|
-
if (
|
|
14582
|
-
|
|
14590
|
+
if (status >= 500) {
|
|
14591
|
+
const TRANSIENT_5XX = /* @__PURE__ */ new Set([500, 502, 503, 504]);
|
|
14592
|
+
const retryable = TRANSIENT_5XX.has(status);
|
|
14593
|
+
const retryAfter = status === 503 ? response.headers.get("Retry-After") : null;
|
|
14594
|
+
const retryAfterMs = retryAfter !== null ? parseRetryAfterMs(retryAfter) : void 0;
|
|
14595
|
+
return new ToolError(message, "http_error", { category: "internal", retryable, retryAfterMs });
|
|
14583
14596
|
}
|
|
14584
|
-
if (
|
|
14585
|
-
|
|
14597
|
+
if (status >= 400 && status < 500) {
|
|
14598
|
+
return new ToolError(message, "http_error", { retryable: false });
|
|
14586
14599
|
}
|
|
14587
|
-
|
|
14588
|
-
|
|
14589
|
-
|
|
14590
|
-
|
|
14591
|
-
|
|
14592
|
-
|
|
14593
|
-
return z.lazy(() => {
|
|
14594
|
-
if (!ctx.refs.has(refPath)) {
|
|
14595
|
-
throw new Error(`Circular reference not resolved: ${refPath}`);
|
|
14596
|
-
}
|
|
14597
|
-
return ctx.refs.get(refPath);
|
|
14598
|
-
});
|
|
14599
|
-
}
|
|
14600
|
-
ctx.processing.add(refPath);
|
|
14601
|
-
const resolved = resolveRef(refPath, ctx);
|
|
14602
|
-
const zodSchema2 = convertSchema(resolved, ctx);
|
|
14603
|
-
ctx.refs.set(refPath, zodSchema2);
|
|
14604
|
-
ctx.processing.delete(refPath);
|
|
14605
|
-
return zodSchema2;
|
|
14600
|
+
return new ToolError(message, "http_error", { category: "internal" });
|
|
14601
|
+
};
|
|
14602
|
+
var parseRetryAfterMs = (value) => {
|
|
14603
|
+
const seconds = Number(value);
|
|
14604
|
+
if (!Number.isNaN(seconds) && seconds >= 0) {
|
|
14605
|
+
return seconds * 1e3;
|
|
14606
14606
|
}
|
|
14607
|
-
|
|
14608
|
-
|
|
14609
|
-
|
|
14610
|
-
|
|
14611
|
-
}
|
|
14612
|
-
if (enumValues.length === 0) {
|
|
14613
|
-
return z.never();
|
|
14614
|
-
}
|
|
14615
|
-
if (enumValues.length === 1) {
|
|
14616
|
-
return z.literal(enumValues[0]);
|
|
14617
|
-
}
|
|
14618
|
-
if (enumValues.every((v) => typeof v === "string")) {
|
|
14619
|
-
return z.enum(enumValues);
|
|
14620
|
-
}
|
|
14621
|
-
const literalSchemas = enumValues.map((v) => z.literal(v));
|
|
14622
|
-
if (literalSchemas.length < 2) {
|
|
14623
|
-
return literalSchemas[0];
|
|
14624
|
-
}
|
|
14625
|
-
return z.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
|
|
14607
|
+
const date5 = Date.parse(value);
|
|
14608
|
+
if (!Number.isNaN(date5)) {
|
|
14609
|
+
const ms = date5 - Date.now();
|
|
14610
|
+
return ms > 0 ? ms : void 0;
|
|
14626
14611
|
}
|
|
14627
|
-
|
|
14628
|
-
|
|
14612
|
+
return void 0;
|
|
14613
|
+
};
|
|
14614
|
+
var buildQueryString = (params) => {
|
|
14615
|
+
const searchParams = new URLSearchParams();
|
|
14616
|
+
for (const [key, value] of Object.entries(params)) {
|
|
14617
|
+
if (value === void 0)
|
|
14618
|
+
continue;
|
|
14619
|
+
if (Array.isArray(value)) {
|
|
14620
|
+
for (const item of value) {
|
|
14621
|
+
searchParams.append(key, String(item));
|
|
14622
|
+
}
|
|
14623
|
+
} else {
|
|
14624
|
+
searchParams.append(key, String(value));
|
|
14625
|
+
}
|
|
14629
14626
|
}
|
|
14630
|
-
|
|
14631
|
-
|
|
14632
|
-
|
|
14633
|
-
|
|
14634
|
-
|
|
14627
|
+
return searchParams.toString();
|
|
14628
|
+
};
|
|
14629
|
+
var fetchFromPage = async (url2, init) => {
|
|
14630
|
+
const { timeout = 3e4, signal, ...rest } = init ?? {};
|
|
14631
|
+
const timeoutSignal = AbortSignal.timeout(timeout);
|
|
14632
|
+
const combinedSignal = signal ? AbortSignal.any([signal, timeoutSignal]) : timeoutSignal;
|
|
14633
|
+
let response;
|
|
14634
|
+
try {
|
|
14635
|
+
response = await fetch(url2, {
|
|
14636
|
+
credentials: "include",
|
|
14637
|
+
...rest,
|
|
14638
|
+
signal: combinedSignal
|
|
14635
14639
|
});
|
|
14636
|
-
|
|
14637
|
-
|
|
14640
|
+
} catch (error51) {
|
|
14641
|
+
if (error51 instanceof DOMException && error51.name === "TimeoutError") {
|
|
14642
|
+
throw ToolError.timeout(`fetchFromPage: request timed out after ${timeout}ms for ${url2}`);
|
|
14638
14643
|
}
|
|
14639
|
-
if (
|
|
14640
|
-
|
|
14644
|
+
if (combinedSignal.aborted) {
|
|
14645
|
+
throw new ToolError(`fetchFromPage: request aborted for ${url2}`, "aborted");
|
|
14641
14646
|
}
|
|
14642
|
-
|
|
14647
|
+
throw new ToolError(`fetchFromPage: network error for ${url2}: ${toErrorMessage(error51)}`, "network_error", {
|
|
14648
|
+
category: "internal",
|
|
14649
|
+
retryable: true
|
|
14650
|
+
});
|
|
14643
14651
|
}
|
|
14644
|
-
if (!
|
|
14645
|
-
|
|
14652
|
+
if (!response.ok) {
|
|
14653
|
+
const rawText = await response.text().catch(() => response.statusText);
|
|
14654
|
+
const errorText = rawText.length > MAX_ERROR_BODY_LENGTH ? `${rawText.slice(0, MAX_ERROR_BODY_LENGTH)}\u2026` : rawText;
|
|
14655
|
+
const msg = `fetchFromPage: HTTP ${response.status} for ${url2}: ${errorText}`;
|
|
14656
|
+
throw httpStatusToToolError(response, msg);
|
|
14646
14657
|
}
|
|
14647
|
-
|
|
14648
|
-
|
|
14649
|
-
|
|
14650
|
-
|
|
14651
|
-
|
|
14652
|
-
|
|
14653
|
-
|
|
14654
|
-
|
|
14655
|
-
|
|
14656
|
-
|
|
14657
|
-
|
|
14658
|
-
|
|
14659
|
-
|
|
14660
|
-
|
|
14661
|
-
|
|
14662
|
-
|
|
14663
|
-
|
|
14664
|
-
|
|
14665
|
-
|
|
14666
|
-
|
|
14667
|
-
|
|
14668
|
-
|
|
14669
|
-
|
|
14670
|
-
|
|
14671
|
-
|
|
14672
|
-
|
|
14673
|
-
|
|
14674
|
-
|
|
14675
|
-
|
|
14676
|
-
|
|
14677
|
-
|
|
14678
|
-
|
|
14679
|
-
|
|
14680
|
-
|
|
14681
|
-
|
|
14682
|
-
|
|
14683
|
-
|
|
14684
|
-
|
|
14685
|
-
|
|
14686
|
-
|
|
14687
|
-
|
|
14688
|
-
|
|
14689
|
-
|
|
14690
|
-
|
|
14691
|
-
|
|
14692
|
-
stringSchema = stringSchema.check(z.cuid2());
|
|
14693
|
-
} else if (format === "ulid") {
|
|
14694
|
-
stringSchema = stringSchema.check(z.ulid());
|
|
14695
|
-
} else if (format === "xid") {
|
|
14696
|
-
stringSchema = stringSchema.check(z.xid());
|
|
14697
|
-
} else if (format === "ksuid") {
|
|
14698
|
-
stringSchema = stringSchema.check(z.ksuid());
|
|
14658
|
+
return response;
|
|
14659
|
+
};
|
|
14660
|
+
|
|
14661
|
+
// node_modules/@opentabs-dev/plugin-sdk/dist/timing.js
|
|
14662
|
+
var waitUntil = (predicate, opts) => {
|
|
14663
|
+
const interval = opts?.interval ?? 200;
|
|
14664
|
+
const timeout = opts?.timeout ?? 1e4;
|
|
14665
|
+
const signal = opts?.signal;
|
|
14666
|
+
const abortReason = () => signal?.reason instanceof Error ? signal.reason : new Error("waitUntil: aborted");
|
|
14667
|
+
if (signal?.aborted)
|
|
14668
|
+
return Promise.reject(abortReason());
|
|
14669
|
+
return new Promise((resolve, reject) => {
|
|
14670
|
+
let settled = false;
|
|
14671
|
+
let poller;
|
|
14672
|
+
let lastPredicateError;
|
|
14673
|
+
const isSettled = () => settled;
|
|
14674
|
+
const cleanup = () => {
|
|
14675
|
+
settled = true;
|
|
14676
|
+
clearTimeout(timer);
|
|
14677
|
+
clearTimeout(poller);
|
|
14678
|
+
signal?.removeEventListener("abort", onAbort);
|
|
14679
|
+
};
|
|
14680
|
+
const onAbort = () => {
|
|
14681
|
+
if (isSettled())
|
|
14682
|
+
return;
|
|
14683
|
+
cleanup();
|
|
14684
|
+
reject(abortReason());
|
|
14685
|
+
};
|
|
14686
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
14687
|
+
const timer = setTimeout(() => {
|
|
14688
|
+
if (isSettled())
|
|
14689
|
+
return;
|
|
14690
|
+
cleanup();
|
|
14691
|
+
const errorContext = lastPredicateError instanceof Error ? `: predicate last threw \u2014 ${lastPredicateError.message}` : "";
|
|
14692
|
+
reject(new Error(`waitUntil: timed out after ${timeout}ms waiting for predicate to return true${errorContext}`));
|
|
14693
|
+
}, timeout);
|
|
14694
|
+
const check2 = async () => {
|
|
14695
|
+
if (isSettled())
|
|
14696
|
+
return;
|
|
14697
|
+
try {
|
|
14698
|
+
const result = await predicate();
|
|
14699
|
+
if (result) {
|
|
14700
|
+
cleanup();
|
|
14701
|
+
resolve();
|
|
14702
|
+
return;
|
|
14699
14703
|
}
|
|
14704
|
+
} catch (err2) {
|
|
14705
|
+
lastPredicateError = err2;
|
|
14700
14706
|
}
|
|
14701
|
-
if (
|
|
14702
|
-
|
|
14703
|
-
}
|
|
14704
|
-
if (typeof schema.maxLength === "number") {
|
|
14705
|
-
stringSchema = stringSchema.max(schema.maxLength);
|
|
14706
|
-
}
|
|
14707
|
-
if (schema.pattern) {
|
|
14708
|
-
stringSchema = stringSchema.regex(new RegExp(schema.pattern));
|
|
14709
|
-
}
|
|
14710
|
-
zodSchema = stringSchema;
|
|
14711
|
-
break;
|
|
14712
|
-
}
|
|
14713
|
-
case "number":
|
|
14714
|
-
case "integer": {
|
|
14715
|
-
let numberSchema = type === "integer" ? z.number().int() : z.number();
|
|
14716
|
-
if (typeof schema.minimum === "number") {
|
|
14717
|
-
numberSchema = numberSchema.min(schema.minimum);
|
|
14718
|
-
}
|
|
14719
|
-
if (typeof schema.maximum === "number") {
|
|
14720
|
-
numberSchema = numberSchema.max(schema.maximum);
|
|
14721
|
-
}
|
|
14722
|
-
if (typeof schema.exclusiveMinimum === "number") {
|
|
14723
|
-
numberSchema = numberSchema.gt(schema.exclusiveMinimum);
|
|
14724
|
-
} else if (schema.exclusiveMinimum === true && typeof schema.minimum === "number") {
|
|
14725
|
-
numberSchema = numberSchema.gt(schema.minimum);
|
|
14726
|
-
}
|
|
14727
|
-
if (typeof schema.exclusiveMaximum === "number") {
|
|
14728
|
-
numberSchema = numberSchema.lt(schema.exclusiveMaximum);
|
|
14729
|
-
} else if (schema.exclusiveMaximum === true && typeof schema.maximum === "number") {
|
|
14730
|
-
numberSchema = numberSchema.lt(schema.maximum);
|
|
14731
|
-
}
|
|
14732
|
-
if (typeof schema.multipleOf === "number") {
|
|
14733
|
-
numberSchema = numberSchema.multipleOf(schema.multipleOf);
|
|
14707
|
+
if (!isSettled()) {
|
|
14708
|
+
poller = setTimeout(() => void check2(), interval);
|
|
14734
14709
|
}
|
|
14735
|
-
|
|
14736
|
-
|
|
14737
|
-
|
|
14738
|
-
|
|
14739
|
-
|
|
14740
|
-
|
|
14741
|
-
|
|
14742
|
-
|
|
14743
|
-
|
|
14744
|
-
|
|
14710
|
+
};
|
|
14711
|
+
void check2();
|
|
14712
|
+
});
|
|
14713
|
+
};
|
|
14714
|
+
|
|
14715
|
+
// node_modules/@opentabs-dev/plugin-sdk/dist/log.js
|
|
14716
|
+
var MAX_DATA_LENGTH = 10;
|
|
14717
|
+
var MAX_STRING_LENGTH = 4096;
|
|
14718
|
+
var MAX_SERIALIZED_SIZE = 64 * 1024;
|
|
14719
|
+
var safeSerializeArg = (value) => {
|
|
14720
|
+
try {
|
|
14721
|
+
if (value === null || value === void 0)
|
|
14722
|
+
return value;
|
|
14723
|
+
const type = typeof value;
|
|
14724
|
+
if (type === "boolean" || type === "number")
|
|
14725
|
+
return value;
|
|
14726
|
+
if (type === "string") {
|
|
14727
|
+
return value.length > MAX_STRING_LENGTH ? `${value.slice(0, MAX_STRING_LENGTH)}\u2026` : value;
|
|
14745
14728
|
}
|
|
14746
|
-
|
|
14747
|
-
|
|
14748
|
-
|
|
14749
|
-
|
|
14750
|
-
|
|
14751
|
-
|
|
14752
|
-
|
|
14753
|
-
|
|
14754
|
-
|
|
14755
|
-
|
|
14756
|
-
|
|
14757
|
-
|
|
14758
|
-
|
|
14759
|
-
|
|
14760
|
-
|
|
14761
|
-
|
|
14762
|
-
const recordSchema = z.looseRecord(keySchema, valueSchema);
|
|
14763
|
-
zodSchema = z.intersection(objectSchema2, recordSchema);
|
|
14764
|
-
break;
|
|
14765
|
-
}
|
|
14766
|
-
if (schema.patternProperties) {
|
|
14767
|
-
const patternProps = schema.patternProperties;
|
|
14768
|
-
const patternKeys = Object.keys(patternProps);
|
|
14769
|
-
const looseRecords = [];
|
|
14770
|
-
for (const pattern of patternKeys) {
|
|
14771
|
-
const patternValue = convertSchema(patternProps[pattern], ctx);
|
|
14772
|
-
const keySchema = z.string().regex(new RegExp(pattern));
|
|
14773
|
-
looseRecords.push(z.looseRecord(keySchema, patternValue));
|
|
14774
|
-
}
|
|
14775
|
-
const schemasToIntersect = [];
|
|
14776
|
-
if (Object.keys(shape).length > 0) {
|
|
14777
|
-
schemasToIntersect.push(z.object(shape).passthrough());
|
|
14778
|
-
}
|
|
14779
|
-
schemasToIntersect.push(...looseRecords);
|
|
14780
|
-
if (schemasToIntersect.length === 0) {
|
|
14781
|
-
zodSchema = z.object({}).passthrough();
|
|
14782
|
-
} else if (schemasToIntersect.length === 1) {
|
|
14783
|
-
zodSchema = schemasToIntersect[0];
|
|
14784
|
-
} else {
|
|
14785
|
-
let result = z.intersection(schemasToIntersect[0], schemasToIntersect[1]);
|
|
14786
|
-
for (let i = 2; i < schemasToIntersect.length; i++) {
|
|
14787
|
-
result = z.intersection(result, schemasToIntersect[i]);
|
|
14729
|
+
if (type === "function")
|
|
14730
|
+
return `[Function: ${value.name || "anonymous"}]`;
|
|
14731
|
+
if (type === "symbol")
|
|
14732
|
+
return `[Symbol: ${value.description ?? ""}]`;
|
|
14733
|
+
if (type === "bigint")
|
|
14734
|
+
return `[BigInt: ${value.toString()}]`;
|
|
14735
|
+
if (typeof value.nodeType === "number" && typeof value.nodeName === "string") {
|
|
14736
|
+
try {
|
|
14737
|
+
const node = value;
|
|
14738
|
+
let classStr = "";
|
|
14739
|
+
if (typeof node.className === "string") {
|
|
14740
|
+
classStr = node.className ? `.${node.className.split(" ")[0] ?? ""}` : "";
|
|
14741
|
+
} else if (node.className !== null && typeof node.className === "object") {
|
|
14742
|
+
const baseVal = node.className.baseVal;
|
|
14743
|
+
if (typeof baseVal === "string") {
|
|
14744
|
+
classStr = baseVal ? `.${baseVal.split(" ")[0] ?? ""}` : "";
|
|
14788
14745
|
}
|
|
14789
|
-
zodSchema = result;
|
|
14790
14746
|
}
|
|
14791
|
-
|
|
14792
|
-
}
|
|
14793
|
-
const objectSchema = z.object(shape);
|
|
14794
|
-
if (schema.additionalProperties === false) {
|
|
14795
|
-
zodSchema = objectSchema.strict();
|
|
14796
|
-
} else if (typeof schema.additionalProperties === "object") {
|
|
14797
|
-
zodSchema = objectSchema.catchall(convertSchema(schema.additionalProperties, ctx));
|
|
14798
|
-
} else {
|
|
14799
|
-
zodSchema = objectSchema.passthrough();
|
|
14747
|
+
return `[${node.nodeName}${node.id ? `#${node.id}` : ""}${classStr}]`;
|
|
14748
|
+
} catch {
|
|
14800
14749
|
}
|
|
14801
|
-
break;
|
|
14802
14750
|
}
|
|
14803
|
-
|
|
14804
|
-
|
|
14805
|
-
const items = schema.items;
|
|
14806
|
-
if (prefixItems && Array.isArray(prefixItems)) {
|
|
14807
|
-
const tupleItems = prefixItems.map((item) => convertSchema(item, ctx));
|
|
14808
|
-
const rest = items && typeof items === "object" && !Array.isArray(items) ? convertSchema(items, ctx) : void 0;
|
|
14809
|
-
if (rest) {
|
|
14810
|
-
zodSchema = z.tuple(tupleItems).rest(rest);
|
|
14811
|
-
} else {
|
|
14812
|
-
zodSchema = z.tuple(tupleItems);
|
|
14813
|
-
}
|
|
14814
|
-
if (typeof schema.minItems === "number") {
|
|
14815
|
-
zodSchema = zodSchema.check(z.minLength(schema.minItems));
|
|
14816
|
-
}
|
|
14817
|
-
if (typeof schema.maxItems === "number") {
|
|
14818
|
-
zodSchema = zodSchema.check(z.maxLength(schema.maxItems));
|
|
14819
|
-
}
|
|
14820
|
-
} else if (Array.isArray(items)) {
|
|
14821
|
-
const tupleItems = items.map((item) => convertSchema(item, ctx));
|
|
14822
|
-
const rest = schema.additionalItems && typeof schema.additionalItems === "object" ? convertSchema(schema.additionalItems, ctx) : void 0;
|
|
14823
|
-
if (rest) {
|
|
14824
|
-
zodSchema = z.tuple(tupleItems).rest(rest);
|
|
14825
|
-
} else {
|
|
14826
|
-
zodSchema = z.tuple(tupleItems);
|
|
14827
|
-
}
|
|
14828
|
-
if (typeof schema.minItems === "number") {
|
|
14829
|
-
zodSchema = zodSchema.check(z.minLength(schema.minItems));
|
|
14830
|
-
}
|
|
14831
|
-
if (typeof schema.maxItems === "number") {
|
|
14832
|
-
zodSchema = zodSchema.check(z.maxLength(schema.maxItems));
|
|
14833
|
-
}
|
|
14834
|
-
} else if (items !== void 0) {
|
|
14835
|
-
const element = convertSchema(items, ctx);
|
|
14836
|
-
let arraySchema = z.array(element);
|
|
14837
|
-
if (typeof schema.minItems === "number") {
|
|
14838
|
-
arraySchema = arraySchema.min(schema.minItems);
|
|
14839
|
-
}
|
|
14840
|
-
if (typeof schema.maxItems === "number") {
|
|
14841
|
-
arraySchema = arraySchema.max(schema.maxItems);
|
|
14842
|
-
}
|
|
14843
|
-
zodSchema = arraySchema;
|
|
14844
|
-
} else {
|
|
14845
|
-
zodSchema = z.array(z.any());
|
|
14846
|
-
}
|
|
14847
|
-
break;
|
|
14751
|
+
if (value instanceof Error) {
|
|
14752
|
+
return { name: value.name, message: value.message, stack: value.stack };
|
|
14848
14753
|
}
|
|
14849
|
-
|
|
14850
|
-
|
|
14851
|
-
|
|
14852
|
-
|
|
14853
|
-
|
|
14854
|
-
|
|
14855
|
-
|
|
14856
|
-
|
|
14857
|
-
|
|
14858
|
-
|
|
14859
|
-
|
|
14860
|
-
|
|
14861
|
-
|
|
14862
|
-
|
|
14863
|
-
|
|
14864
|
-
|
|
14865
|
-
|
|
14866
|
-
|
|
14867
|
-
|
|
14868
|
-
|
|
14869
|
-
|
|
14870
|
-
|
|
14871
|
-
|
|
14872
|
-
|
|
14873
|
-
|
|
14874
|
-
|
|
14875
|
-
|
|
14876
|
-
|
|
14877
|
-
|
|
14754
|
+
if (value instanceof WeakRef)
|
|
14755
|
+
return "[WeakRef]";
|
|
14756
|
+
if (value instanceof WeakMap)
|
|
14757
|
+
return "[WeakMap]";
|
|
14758
|
+
if (value instanceof WeakSet)
|
|
14759
|
+
return "[WeakSet]";
|
|
14760
|
+
if (value instanceof ArrayBuffer)
|
|
14761
|
+
return "[ArrayBuffer]";
|
|
14762
|
+
if (typeof SharedArrayBuffer !== "undefined" && value instanceof SharedArrayBuffer)
|
|
14763
|
+
return "[SharedArrayBuffer]";
|
|
14764
|
+
try {
|
|
14765
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
14766
|
+
const json2 = JSON.stringify(value, (_key, v) => {
|
|
14767
|
+
if (typeof v === "object" && v !== null) {
|
|
14768
|
+
if (seen.has(v))
|
|
14769
|
+
return "[Circular]";
|
|
14770
|
+
seen.add(v);
|
|
14771
|
+
}
|
|
14772
|
+
if (typeof v === "function")
|
|
14773
|
+
return `[Function: ${v.name || "anonymous"}]`;
|
|
14774
|
+
if (typeof v === "bigint")
|
|
14775
|
+
return `[BigInt: ${v.toString()}]`;
|
|
14776
|
+
if (typeof v === "symbol")
|
|
14777
|
+
return `[Symbol: ${v.description ?? ""}]`;
|
|
14778
|
+
if (v instanceof WeakRef)
|
|
14779
|
+
return "[WeakRef]";
|
|
14780
|
+
if (v instanceof WeakMap)
|
|
14781
|
+
return "[WeakMap]";
|
|
14782
|
+
if (v instanceof WeakSet)
|
|
14783
|
+
return "[WeakSet]";
|
|
14784
|
+
if (v instanceof ArrayBuffer)
|
|
14785
|
+
return "[ArrayBuffer]";
|
|
14786
|
+
if (typeof SharedArrayBuffer !== "undefined" && v instanceof SharedArrayBuffer)
|
|
14787
|
+
return "[SharedArrayBuffer]";
|
|
14788
|
+
return v;
|
|
14789
|
+
});
|
|
14790
|
+
if (json2.length > MAX_SERIALIZED_SIZE) {
|
|
14791
|
+
return `[Object truncated: ${json2.length} chars]`;
|
|
14878
14792
|
}
|
|
14879
|
-
|
|
14880
|
-
}
|
|
14881
|
-
|
|
14882
|
-
if (schema.nullable === true && ctx.version === "openapi-3.0") {
|
|
14883
|
-
baseSchema = z.nullable(baseSchema);
|
|
14884
|
-
}
|
|
14885
|
-
if (schema.readOnly === true) {
|
|
14886
|
-
baseSchema = z.readonly(baseSchema);
|
|
14887
|
-
}
|
|
14888
|
-
if (schema.default !== void 0) {
|
|
14889
|
-
baseSchema = baseSchema.default(schema.default);
|
|
14890
|
-
}
|
|
14891
|
-
const extraMeta = {};
|
|
14892
|
-
const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
|
|
14893
|
-
for (const key of coreMetadataKeys) {
|
|
14894
|
-
if (key in schema) {
|
|
14895
|
-
extraMeta[key] = schema[key];
|
|
14896
|
-
}
|
|
14897
|
-
}
|
|
14898
|
-
const contentMetadataKeys = ["contentEncoding", "contentMediaType", "contentSchema"];
|
|
14899
|
-
for (const key of contentMetadataKeys) {
|
|
14900
|
-
if (key in schema) {
|
|
14901
|
-
extraMeta[key] = schema[key];
|
|
14793
|
+
return JSON.parse(json2);
|
|
14794
|
+
} catch {
|
|
14795
|
+
return `[Unserializable: ${typeof value}]`;
|
|
14902
14796
|
}
|
|
14797
|
+
} catch {
|
|
14798
|
+
return `[Unserializable: ${typeof value}]`;
|
|
14903
14799
|
}
|
|
14904
|
-
|
|
14905
|
-
|
|
14906
|
-
|
|
14800
|
+
};
|
|
14801
|
+
var safeSerialize = (args) => {
|
|
14802
|
+
const capped = args.length > MAX_DATA_LENGTH ? args.slice(0, MAX_DATA_LENGTH) : args;
|
|
14803
|
+
return capped.map(safeSerializeArg);
|
|
14804
|
+
};
|
|
14805
|
+
var CONSOLE_METHODS = {
|
|
14806
|
+
debug: "debug",
|
|
14807
|
+
info: "info",
|
|
14808
|
+
warning: "warn",
|
|
14809
|
+
error: "error"
|
|
14810
|
+
};
|
|
14811
|
+
var defaultTransport = (entry) => {
|
|
14812
|
+
const method = CONSOLE_METHODS[entry.level];
|
|
14813
|
+
console[method](`[sdk.log] ${entry.message}`, ...entry.data);
|
|
14814
|
+
};
|
|
14815
|
+
var activeTransport = defaultTransport;
|
|
14816
|
+
var _setLogTransport = (transport) => {
|
|
14817
|
+
const previous = activeTransport;
|
|
14818
|
+
activeTransport = transport;
|
|
14819
|
+
return () => {
|
|
14820
|
+
if (activeTransport === transport)
|
|
14821
|
+
activeTransport = previous;
|
|
14822
|
+
};
|
|
14823
|
+
};
|
|
14824
|
+
var makeLogMethod = (level) => (message, ...args) => {
|
|
14825
|
+
const entry = {
|
|
14826
|
+
level,
|
|
14827
|
+
message,
|
|
14828
|
+
data: safeSerialize(args),
|
|
14829
|
+
ts: (/* @__PURE__ */ new Date()).toISOString()
|
|
14830
|
+
};
|
|
14831
|
+
activeTransport(entry);
|
|
14832
|
+
};
|
|
14833
|
+
var log = Object.freeze({
|
|
14834
|
+
debug: makeLogMethod("debug"),
|
|
14835
|
+
info: makeLogMethod("info"),
|
|
14836
|
+
warn: makeLogMethod("warning"),
|
|
14837
|
+
error: makeLogMethod("error")
|
|
14838
|
+
});
|
|
14839
|
+
var ot = globalThis.__openTabs ?? {};
|
|
14840
|
+
globalThis.__openTabs = ot;
|
|
14841
|
+
ot._setLogTransport = _setLogTransport;
|
|
14842
|
+
ot.log = log;
|
|
14843
|
+
|
|
14844
|
+
// node_modules/@opentabs-dev/plugin-sdk/dist/page-state.js
|
|
14845
|
+
var BLOCKED_SEGMENTS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
14846
|
+
var getPageGlobal = (path) => {
|
|
14847
|
+
try {
|
|
14848
|
+
const segments = path.split(".");
|
|
14849
|
+
let current = globalThis;
|
|
14850
|
+
for (const segment of segments) {
|
|
14851
|
+
if (current === null || current === void 0)
|
|
14852
|
+
return void 0;
|
|
14853
|
+
if (typeof current !== "object" && typeof current !== "function")
|
|
14854
|
+
return void 0;
|
|
14855
|
+
if (BLOCKED_SEGMENTS.has(segment))
|
|
14856
|
+
return void 0;
|
|
14857
|
+
current = current[segment];
|
|
14907
14858
|
}
|
|
14859
|
+
return current;
|
|
14860
|
+
} catch {
|
|
14861
|
+
return void 0;
|
|
14908
14862
|
}
|
|
14909
|
-
|
|
14910
|
-
|
|
14911
|
-
|
|
14912
|
-
|
|
14913
|
-
|
|
14914
|
-
|
|
14915
|
-
|
|
14916
|
-
|
|
14917
|
-
|
|
14918
|
-
|
|
14919
|
-
|
|
14863
|
+
};
|
|
14864
|
+
var getCurrentUrl = () => window.location.href;
|
|
14865
|
+
var getPageTitle = () => document.title;
|
|
14866
|
+
|
|
14867
|
+
// node_modules/@opentabs-dev/plugin-sdk/dist/index.js
|
|
14868
|
+
var defineTool = (config2) => config2;
|
|
14869
|
+
var OpenTabsPlugin = class {
|
|
14870
|
+
/**
|
|
14871
|
+
* Chrome match patterns for URLs that should NOT match this plugin.
|
|
14872
|
+
* Tabs matching both urlPatterns and excludePatterns are excluded.
|
|
14873
|
+
* Useful when a broad urlPattern overlaps with another plugin's domain.
|
|
14874
|
+
* @see https://developer.chrome.com/docs/extensions/develop/concepts/match-patterns
|
|
14875
|
+
*/
|
|
14876
|
+
excludePatterns;
|
|
14877
|
+
/**
|
|
14878
|
+
* URL to open when no matching tab exists and the user triggers an
|
|
14879
|
+
* 'open tab' action from the side panel. Should be a concrete URL
|
|
14880
|
+
* (e.g., 'https://github.com'), not a match pattern.
|
|
14881
|
+
*/
|
|
14882
|
+
homepage;
|
|
14883
|
+
/** Typed configuration schema — declares settings that users provide via config.json or the side panel. */
|
|
14884
|
+
configSchema;
|
|
14885
|
+
};
|
|
14886
|
+
|
|
14887
|
+
// src/fiverr-api.ts
|
|
14888
|
+
var getContext = () => {
|
|
14889
|
+
const userId = getPageGlobal("initialData.FiverrContext.userId");
|
|
14890
|
+
if (!userId || userId <= 0) return null;
|
|
14891
|
+
return {
|
|
14892
|
+
userId,
|
|
14893
|
+
userGuid: getPageGlobal("initialData.FiverrContext.userGuid") ?? "",
|
|
14894
|
+
csrfToken: getPageGlobal("initialData.FiverrContext.csrfToken") ?? "",
|
|
14895
|
+
currency: getPageGlobal("initialData.FiverrContext.currency") ?? "USD",
|
|
14896
|
+
countryCode: getPageGlobal("initialData.FiverrContext.countryCode") ?? "",
|
|
14897
|
+
locale: getPageGlobal("initialData.FiverrContext.locale") ?? "",
|
|
14898
|
+
isPro: getPageGlobal("initialData.FiverrContext.isPro") ?? false
|
|
14899
|
+
};
|
|
14900
|
+
};
|
|
14901
|
+
var getUsername = () => getPageGlobal("initialData.UserActivationMessage.username") ?? getPageGlobal("initialData.FloatingChat.currentUsername") ?? "";
|
|
14902
|
+
var isAuthenticated = () => getContext() !== null;
|
|
14903
|
+
var waitForAuth = () => waitUntil(() => isAuthenticated(), { interval: 500, timeout: 5e3 }).then(
|
|
14904
|
+
() => true,
|
|
14905
|
+
() => false
|
|
14906
|
+
);
|
|
14907
|
+
var requireContext = () => {
|
|
14908
|
+
const ctx = getContext();
|
|
14909
|
+
if (!ctx) throw ToolError.auth("Not authenticated \u2014 please log in to Fiverr.");
|
|
14910
|
+
return ctx;
|
|
14911
|
+
};
|
|
14912
|
+
var normalizeFiverrUsername = (value, fieldName = "username") => {
|
|
14913
|
+
const username = value.trim().replace(/^[@/]+/, "");
|
|
14914
|
+
if (!username) throw ToolError.validation(`${fieldName} is required.`);
|
|
14915
|
+
if (username.includes("/")) {
|
|
14916
|
+
throw ToolError.validation(`${fieldName} must be a single Fiverr username with no slashes.`);
|
|
14920
14917
|
}
|
|
14921
|
-
|
|
14918
|
+
return username;
|
|
14919
|
+
};
|
|
14920
|
+
var PERSEUS_ISLAND_RE = /<script[^>]*id="perseus-initial-props"[^>]*>([\s\S]*?)<\/script>/;
|
|
14921
|
+
var fetchPerseusProps = async (path) => {
|
|
14922
|
+
requireContext();
|
|
14923
|
+
const response = await fetchFromPage(path, { headers: { Accept: "text/html" } });
|
|
14924
|
+
if (!response.ok) throw httpStatusToToolError(response, `Failed to load ${path}`);
|
|
14925
|
+
const html = await response.text();
|
|
14926
|
+
const match = html.match(PERSEUS_ISLAND_RE);
|
|
14927
|
+
if (!match?.[1]) throw ToolError.notFound(`No page data found at ${path} \u2014 it may not exist or require login.`);
|
|
14922
14928
|
try {
|
|
14923
|
-
|
|
14929
|
+
return JSON.parse(match[1]);
|
|
14924
14930
|
} catch {
|
|
14925
|
-
throw
|
|
14931
|
+
throw ToolError.internal(`Failed to parse page data at ${path}`);
|
|
14926
14932
|
}
|
|
14927
|
-
|
|
14928
|
-
|
|
14929
|
-
|
|
14930
|
-
|
|
14931
|
-
|
|
14932
|
-
|
|
14933
|
-
|
|
14934
|
-
|
|
14935
|
-
|
|
14936
|
-
|
|
14937
|
-
|
|
14938
|
-
|
|
14939
|
-
|
|
14940
|
-
|
|
14941
|
-
|
|
14942
|
-
|
|
14943
|
-
|
|
14944
|
-
|
|
14945
|
-
|
|
14946
|
-
|
|
14947
|
-
|
|
14948
|
-
|
|
14949
|
-
|
|
14950
|
-
|
|
14951
|
-
|
|
14952
|
-
|
|
14953
|
-
|
|
14954
|
-
|
|
14955
|
-
|
|
14956
|
-
|
|
14957
|
-
|
|
14958
|
-
|
|
14959
|
-
return
|
|
14960
|
-
}
|
|
14961
|
-
function date4(params) {
|
|
14962
|
-
return _coercedDate(ZodDate, params);
|
|
14963
|
-
}
|
|
14964
|
-
|
|
14965
|
-
// node_modules/zod/v4/classic/external.js
|
|
14966
|
-
config(en_default());
|
|
14933
|
+
};
|
|
14934
|
+
var fetchInboxJson = async (path) => {
|
|
14935
|
+
requireContext();
|
|
14936
|
+
const response = await fetchFromPage(path, {
|
|
14937
|
+
headers: { Accept: "application/json", "X-Requested-With": "XMLHttpRequest" }
|
|
14938
|
+
});
|
|
14939
|
+
if (!response.ok) throw httpStatusToToolError(response, `Failed to load ${path}`);
|
|
14940
|
+
if (response.status === 204) return null;
|
|
14941
|
+
return await response.json();
|
|
14942
|
+
};
|
|
14943
|
+
var SEND_MESSAGE_PATH = "/inbox/conversations/messages";
|
|
14944
|
+
var sendInboxMessage = async (recipientUsername, body) => {
|
|
14945
|
+
const ctx = requireContext();
|
|
14946
|
+
const response = await fetchFromPage(SEND_MESSAGE_PATH, {
|
|
14947
|
+
method: "POST",
|
|
14948
|
+
headers: {
|
|
14949
|
+
Accept: "application/json",
|
|
14950
|
+
"Content-Type": "application/json",
|
|
14951
|
+
"X-Requested-With": "XMLHttpRequest",
|
|
14952
|
+
"X-CSRF-Token": ctx.csrfToken
|
|
14953
|
+
},
|
|
14954
|
+
body: JSON.stringify({
|
|
14955
|
+
content_blocks: [{ type: "text", plain_text: body, plain_text_format: null }],
|
|
14956
|
+
content_type: "text",
|
|
14957
|
+
participants_usernames: [recipientUsername],
|
|
14958
|
+
channel_id: null,
|
|
14959
|
+
pending_attachment_ids: []
|
|
14960
|
+
})
|
|
14961
|
+
});
|
|
14962
|
+
if (!response.ok) throw httpStatusToToolError(response, "Failed to send message");
|
|
14963
|
+
if (response.status === 204) return { messageId: "" };
|
|
14964
|
+
const data = await response.json();
|
|
14965
|
+
return { messageId: data.id ?? data.message?.id ?? "" };
|
|
14966
|
+
};
|
|
14967
14967
|
|
|
14968
14968
|
// src/tools/draft-message.ts
|
|
14969
14969
|
var draftMessage = defineTool({
|
|
@@ -15419,7 +15419,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15419
15419
|
};
|
|
15420
15420
|
var src_default = new FiverrPlugin();
|
|
15421
15421
|
|
|
15422
|
-
// dist/
|
|
15422
|
+
// dist/_adapter_entry_538f2b4b-b9ea-4d72-a69a-9922dceb8bf3.ts
|
|
15423
|
+
external_exports.config({ jitless: true });
|
|
15423
15424
|
if (!globalThis.__openTabs) {
|
|
15424
15425
|
globalThis.__openTabs = {};
|
|
15425
15426
|
} else {
|
|
@@ -15637,5 +15638,5 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15637
15638
|
};
|
|
15638
15639
|
delete src_default.onDeactivate;
|
|
15639
15640
|
}
|
|
15640
|
-
})();(function(){var o=(globalThis).__openTabs;if(o&&o.adapters&&o.adapters["fiverr"]){var a=o.adapters["fiverr"];a.__adapterHash="
|
|
15641
|
+
})();(function(){var o=(globalThis).__openTabs;if(o&&o.adapters&&o.adapters["fiverr"]){var a=o.adapters["fiverr"];a.__adapterHash="c254b80eeb1a9302fd339b1ef64a6988825db77ad61d59ea8903179202305cc4";if(a.tools&&Array.isArray(a.tools)){for(var i=0;i<a.tools.length;i++){Object.freeze(a.tools[i]);}Object.freeze(a.tools);}Object.freeze(a);Object.defineProperty(o.adapters,"fiverr",{value:a,writable:false,configurable:false,enumerable:true});Object.defineProperty(o,"adapters",{value:o.adapters,writable:false,configurable:false});}})();
|
|
15641
15642
|
//# sourceMappingURL=adapter.iife.js.map
|