@stacksjs/api 0.62.0 → 0.63.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +73 -67
- package/dist/index.js.map +14 -0
- package/package.json +2 -2
- package/src/generate-openapi.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// ../../../../node_modules/destr/dist/index.mjs
|
|
3
|
-
|
|
3
|
+
function jsonParseTransform(key, value) {
|
|
4
4
|
if (key === "__proto__" || key === "constructor" && value && typeof value === "object" && "prototype" in value) {
|
|
5
5
|
warnKeyDropped(key);
|
|
6
6
|
return;
|
|
7
7
|
}
|
|
8
8
|
return value;
|
|
9
|
-
}
|
|
10
|
-
|
|
9
|
+
}
|
|
10
|
+
function warnKeyDropped(key) {
|
|
11
11
|
console.warn(`[destr] Dropping "${key}" key to prevent prototype pollution.`);
|
|
12
|
-
}
|
|
13
|
-
|
|
12
|
+
}
|
|
13
|
+
function destr(value, options = {}) {
|
|
14
14
|
if (typeof value !== "string") {
|
|
15
15
|
return value;
|
|
16
16
|
}
|
|
@@ -62,35 +62,35 @@ var destr = function(value, options = {}) {
|
|
|
62
62
|
}
|
|
63
63
|
return value;
|
|
64
64
|
}
|
|
65
|
-
}
|
|
65
|
+
}
|
|
66
66
|
var suspectProtoRx = /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/;
|
|
67
67
|
var suspectConstructorRx = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
|
|
68
68
|
var JsonSigRx = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;
|
|
69
69
|
|
|
70
70
|
// ../../../../node_modules/ufo/dist/index.mjs
|
|
71
|
-
|
|
71
|
+
function encode(text) {
|
|
72
72
|
return encodeURI("" + text).replace(ENC_PIPE_RE, "|");
|
|
73
|
-
}
|
|
74
|
-
|
|
73
|
+
}
|
|
74
|
+
function encodeQueryValue(input) {
|
|
75
75
|
return encode(typeof input === "string" ? input : JSON.stringify(input)).replace(PLUS_RE, "%2B").replace(ENC_SPACE_RE, "+").replace(HASH_RE, "%23").replace(AMPERSAND_RE, "%26").replace(ENC_BACKTICK_RE, "`").replace(ENC_CARET_RE, "^").replace(SLASH_RE, "%2F");
|
|
76
|
-
}
|
|
77
|
-
|
|
76
|
+
}
|
|
77
|
+
function encodeQueryKey(text) {
|
|
78
78
|
return encodeQueryValue(text).replace(EQUAL_RE, "%3D");
|
|
79
|
-
}
|
|
80
|
-
|
|
79
|
+
}
|
|
80
|
+
function decode(text = "") {
|
|
81
81
|
try {
|
|
82
82
|
return decodeURIComponent("" + text);
|
|
83
83
|
} catch {
|
|
84
84
|
return "" + text;
|
|
85
85
|
}
|
|
86
|
-
}
|
|
87
|
-
|
|
86
|
+
}
|
|
87
|
+
function decodeQueryKey(text) {
|
|
88
88
|
return decode(text.replace(PLUS_RE, " "));
|
|
89
|
-
}
|
|
90
|
-
|
|
89
|
+
}
|
|
90
|
+
function decodeQueryValue(text) {
|
|
91
91
|
return decode(text.replace(PLUS_RE, " "));
|
|
92
|
-
}
|
|
93
|
-
|
|
92
|
+
}
|
|
93
|
+
function parseQuery(parametersString = "") {
|
|
94
94
|
const object = {};
|
|
95
95
|
if (parametersString[0] === "?") {
|
|
96
96
|
parametersString = parametersString.slice(1);
|
|
@@ -114,8 +114,8 @@ var parseQuery = function(parametersString = "") {
|
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
return object;
|
|
117
|
-
}
|
|
118
|
-
|
|
117
|
+
}
|
|
118
|
+
function encodeQueryItem(key, value) {
|
|
119
119
|
if (typeof value === "number" || typeof value === "boolean") {
|
|
120
120
|
value = String(value);
|
|
121
121
|
}
|
|
@@ -126,11 +126,11 @@ var encodeQueryItem = function(key, value) {
|
|
|
126
126
|
return value.map((_value) => `${encodeQueryKey(key)}=${encodeQueryValue(_value)}`).join("&");
|
|
127
127
|
}
|
|
128
128
|
return `${encodeQueryKey(key)}=${encodeQueryValue(value)}`;
|
|
129
|
-
}
|
|
130
|
-
|
|
129
|
+
}
|
|
130
|
+
function stringifyQuery(query) {
|
|
131
131
|
return Object.keys(query).filter((k) => query[k] !== undefined).map((k) => encodeQueryItem(k, query[k])).filter(Boolean).join("&");
|
|
132
|
-
}
|
|
133
|
-
|
|
132
|
+
}
|
|
133
|
+
function hasProtocol(inputString, opts = {}) {
|
|
134
134
|
if (typeof opts === "boolean") {
|
|
135
135
|
opts = { acceptRelative: opts };
|
|
136
136
|
}
|
|
@@ -138,14 +138,14 @@ var hasProtocol = function(inputString, opts = {}) {
|
|
|
138
138
|
return PROTOCOL_STRICT_REGEX.test(inputString);
|
|
139
139
|
}
|
|
140
140
|
return PROTOCOL_REGEX.test(inputString) || (opts.acceptRelative ? PROTOCOL_RELATIVE_REGEX.test(inputString) : false);
|
|
141
|
-
}
|
|
142
|
-
|
|
141
|
+
}
|
|
142
|
+
function hasTrailingSlash(input = "", respectQueryAndFragment) {
|
|
143
143
|
if (!respectQueryAndFragment) {
|
|
144
144
|
return input.endsWith("/");
|
|
145
145
|
}
|
|
146
146
|
return TRAILING_SLASH_RE.test(input);
|
|
147
|
-
}
|
|
148
|
-
|
|
147
|
+
}
|
|
148
|
+
function withoutTrailingSlash(input = "", respectQueryAndFragment) {
|
|
149
149
|
if (!respectQueryAndFragment) {
|
|
150
150
|
return (hasTrailingSlash(input) ? input.slice(0, -1) : input) || "/";
|
|
151
151
|
}
|
|
@@ -162,8 +162,8 @@ var withoutTrailingSlash = function(input = "", respectQueryAndFragment) {
|
|
|
162
162
|
const [s0, ...s] = path.split("?");
|
|
163
163
|
const cleanPath = s0.endsWith("/") ? s0.slice(0, -1) : s0;
|
|
164
164
|
return (cleanPath || "/") + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
|
|
165
|
-
}
|
|
166
|
-
|
|
165
|
+
}
|
|
166
|
+
function withTrailingSlash(input = "", respectQueryAndFragment) {
|
|
167
167
|
if (!respectQueryAndFragment) {
|
|
168
168
|
return input.endsWith("/") ? input : input + "/";
|
|
169
169
|
}
|
|
@@ -182,8 +182,8 @@ var withTrailingSlash = function(input = "", respectQueryAndFragment) {
|
|
|
182
182
|
}
|
|
183
183
|
const [s0, ...s] = path.split("?");
|
|
184
184
|
return s0 + "/" + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
|
|
185
|
-
}
|
|
186
|
-
|
|
185
|
+
}
|
|
186
|
+
function withBase(input, base) {
|
|
187
187
|
if (isEmptyURL(base) || hasProtocol(input)) {
|
|
188
188
|
return input;
|
|
189
189
|
}
|
|
@@ -192,20 +192,20 @@ var withBase = function(input, base) {
|
|
|
192
192
|
return input;
|
|
193
193
|
}
|
|
194
194
|
return joinURL(_base, input);
|
|
195
|
-
}
|
|
196
|
-
|
|
195
|
+
}
|
|
196
|
+
function withQuery(input, query) {
|
|
197
197
|
const parsed = parseURL(input);
|
|
198
198
|
const mergedQuery = { ...parseQuery(parsed.search), ...query };
|
|
199
199
|
parsed.search = stringifyQuery(mergedQuery);
|
|
200
200
|
return stringifyParsedURL(parsed);
|
|
201
|
-
}
|
|
202
|
-
|
|
201
|
+
}
|
|
202
|
+
function isEmptyURL(url) {
|
|
203
203
|
return !url || url === "/";
|
|
204
|
-
}
|
|
205
|
-
|
|
204
|
+
}
|
|
205
|
+
function isNonEmptyURL(url) {
|
|
206
206
|
return url && url !== "/";
|
|
207
|
-
}
|
|
208
|
-
|
|
207
|
+
}
|
|
208
|
+
function joinURL(base, ...input) {
|
|
209
209
|
let url = base || "";
|
|
210
210
|
for (const segment of input.filter((url2) => isNonEmptyURL(url2))) {
|
|
211
211
|
if (url) {
|
|
@@ -216,8 +216,8 @@ var joinURL = function(base, ...input) {
|
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
218
|
return url;
|
|
219
|
-
}
|
|
220
|
-
|
|
219
|
+
}
|
|
220
|
+
function parseURL(input = "", defaultProto) {
|
|
221
221
|
const _specialProtoMatch = input.match(/^[\s\0]*(blob:|data:|javascript:|vbscript:)(.*)/i);
|
|
222
222
|
if (_specialProtoMatch) {
|
|
223
223
|
const [, _proto, _pathname = ""] = _specialProtoMatch;
|
|
@@ -235,8 +235,11 @@ var parseURL = function(input = "", defaultProto) {
|
|
|
235
235
|
return defaultProto ? parseURL(defaultProto + input) : parsePath(input);
|
|
236
236
|
}
|
|
237
237
|
const [, protocol = "", auth, hostAndPath = ""] = input.replace(/\\/g, "/").match(/^[\s\0]*([\w+.-]{2,}:)?\/\/([^/@]+@)?(.*)/) || [];
|
|
238
|
-
|
|
239
|
-
|
|
238
|
+
let [, host = "", path = ""] = hostAndPath.match(/([^#/?]*)(.*)?/) || [];
|
|
239
|
+
if (protocol === "file:") {
|
|
240
|
+
path = path.replace(/\/(?=[A-Za-z]:)/, "");
|
|
241
|
+
}
|
|
242
|
+
const { pathname, search, hash } = parsePath(path);
|
|
240
243
|
return {
|
|
241
244
|
protocol: protocol.toLowerCase(),
|
|
242
245
|
auth: auth ? auth.slice(0, Math.max(0, auth.length - 1)) : "",
|
|
@@ -246,16 +249,16 @@ var parseURL = function(input = "", defaultProto) {
|
|
|
246
249
|
hash,
|
|
247
250
|
[protocolRelative]: !protocol
|
|
248
251
|
};
|
|
249
|
-
}
|
|
250
|
-
|
|
252
|
+
}
|
|
253
|
+
function parsePath(input = "") {
|
|
251
254
|
const [pathname = "", search = "", hash = ""] = (input.match(/([^#?]*)(\?[^#]*)?(#.*)?/) || []).splice(1);
|
|
252
255
|
return {
|
|
253
256
|
pathname,
|
|
254
257
|
search,
|
|
255
258
|
hash
|
|
256
259
|
};
|
|
257
|
-
}
|
|
258
|
-
|
|
260
|
+
}
|
|
261
|
+
function stringifyParsedURL(parsed) {
|
|
259
262
|
const pathname = parsed.pathname || "";
|
|
260
263
|
const search = parsed.search ? (parsed.search.startsWith("?") ? "" : "?") + parsed.search : "";
|
|
261
264
|
const hash = parsed.hash || "";
|
|
@@ -263,7 +266,7 @@ var stringifyParsedURL = function(parsed) {
|
|
|
263
266
|
const host = parsed.host || "";
|
|
264
267
|
const proto = parsed.protocol || parsed[protocolRelative] ? (parsed.protocol || "") + "//" : "";
|
|
265
268
|
return proto + auth + host + pathname + search + hash;
|
|
266
|
-
}
|
|
269
|
+
}
|
|
267
270
|
var r = String.fromCharCode;
|
|
268
271
|
var HASH_RE = /#/g;
|
|
269
272
|
var AMPERSAND_RE = /&/g;
|
|
@@ -282,7 +285,7 @@ var JOIN_LEADING_SLASH_RE = /^\.?\//;
|
|
|
282
285
|
var protocolRelative = Symbol.for("ufo:protocolRelative");
|
|
283
286
|
|
|
284
287
|
// ../../../../node_modules/ofetch/dist/shared/ofetch.37386b05.mjs
|
|
285
|
-
|
|
288
|
+
function createFetchError(ctx) {
|
|
286
289
|
const errorMessage = ctx.error?.message || ctx.error?.toString() || "";
|
|
287
290
|
const method = ctx.request?.method || ctx.options?.method || "GET";
|
|
288
291
|
const url = ctx.request?.url || String(ctx.request) || "/";
|
|
@@ -311,11 +314,11 @@ var createFetchError = function(ctx) {
|
|
|
311
314
|
});
|
|
312
315
|
}
|
|
313
316
|
return fetchError;
|
|
314
|
-
}
|
|
315
|
-
|
|
317
|
+
}
|
|
318
|
+
function isPayloadMethod(method = "GET") {
|
|
316
319
|
return payloadMethods.has(method.toUpperCase());
|
|
317
|
-
}
|
|
318
|
-
|
|
320
|
+
}
|
|
321
|
+
function isJSONSerializable(value) {
|
|
319
322
|
if (value === undefined) {
|
|
320
323
|
return false;
|
|
321
324
|
}
|
|
@@ -333,8 +336,8 @@ var isJSONSerializable = function(value) {
|
|
|
333
336
|
return false;
|
|
334
337
|
}
|
|
335
338
|
return value.constructor && value.constructor.name === "Object" || typeof value.toJSON === "function";
|
|
336
|
-
}
|
|
337
|
-
|
|
339
|
+
}
|
|
340
|
+
function detectResponseType(_contentType = "") {
|
|
338
341
|
if (!_contentType) {
|
|
339
342
|
return "json";
|
|
340
343
|
}
|
|
@@ -346,8 +349,8 @@ var detectResponseType = function(_contentType = "") {
|
|
|
346
349
|
return "text";
|
|
347
350
|
}
|
|
348
351
|
return "blob";
|
|
349
|
-
}
|
|
350
|
-
|
|
352
|
+
}
|
|
353
|
+
function mergeFetchOptions(input, defaults, Headers = globalThis.Headers) {
|
|
351
354
|
const merged = {
|
|
352
355
|
...defaults,
|
|
353
356
|
...input
|
|
@@ -371,8 +374,8 @@ var mergeFetchOptions = function(input, defaults, Headers = globalThis.Headers)
|
|
|
371
374
|
}
|
|
372
375
|
}
|
|
373
376
|
return merged;
|
|
374
|
-
}
|
|
375
|
-
|
|
377
|
+
}
|
|
378
|
+
function createFetch(globalOptions = {}) {
|
|
376
379
|
const {
|
|
377
380
|
fetch = globalThis.fetch,
|
|
378
381
|
Headers = globalThis.Headers,
|
|
@@ -506,7 +509,7 @@ var createFetch = function(globalOptions = {}) {
|
|
|
506
509
|
}
|
|
507
510
|
});
|
|
508
511
|
return $fetch;
|
|
509
|
-
}
|
|
512
|
+
}
|
|
510
513
|
|
|
511
514
|
class FetchError extends Error {
|
|
512
515
|
constructor(message, opts) {
|
|
@@ -518,14 +521,14 @@ class FetchError extends Error {
|
|
|
518
521
|
}
|
|
519
522
|
}
|
|
520
523
|
var payloadMethods = new Set(Object.freeze(["PATCH", "POST", "PUT", "DELETE"]));
|
|
521
|
-
var textTypes = new Set([
|
|
524
|
+
var textTypes = /* @__PURE__ */ new Set([
|
|
522
525
|
"image/svg",
|
|
523
526
|
"application/xml",
|
|
524
527
|
"application/xhtml",
|
|
525
528
|
"application/html"
|
|
526
529
|
]);
|
|
527
530
|
var JSON_RE = /^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;
|
|
528
|
-
var retryStatusCodes = new Set([
|
|
531
|
+
var retryStatusCodes = /* @__PURE__ */ new Set([
|
|
529
532
|
408,
|
|
530
533
|
409,
|
|
531
534
|
425,
|
|
@@ -535,7 +538,7 @@ var retryStatusCodes = new Set([
|
|
|
535
538
|
503,
|
|
536
539
|
504
|
|
537
540
|
]);
|
|
538
|
-
var nullBodyResponses = new Set([101, 204, 205, 304]);
|
|
541
|
+
var nullBodyResponses = /* @__PURE__ */ new Set([101, 204, 205, 304]);
|
|
539
542
|
|
|
540
543
|
// ../../../../node_modules/ofetch/dist/index.mjs
|
|
541
544
|
var _globalThis = function() {
|
|
@@ -628,9 +631,9 @@ async function destroy(url, params) {
|
|
|
628
631
|
loading.value = true;
|
|
629
632
|
return await ofetch(url, parameters);
|
|
630
633
|
}
|
|
631
|
-
|
|
634
|
+
function setToken(authToken) {
|
|
632
635
|
token.value = authToken;
|
|
633
|
-
}
|
|
636
|
+
}
|
|
634
637
|
var loading = ref(false);
|
|
635
638
|
var token = ref("");
|
|
636
639
|
var baseURL = "/";
|
|
@@ -647,3 +650,6 @@ var Fetch = {
|
|
|
647
650
|
export {
|
|
648
651
|
Fetch
|
|
649
652
|
};
|
|
653
|
+
|
|
654
|
+
//# debugId=C052A5CAF01FE71864756E2164756E21
|
|
655
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../node_modules/destr/dist/index.mjs", "../../../../../node_modules/ufo/dist/index.mjs", "../../../../../node_modules/ofetch/dist/shared/ofetch.37386b05.mjs", "../../../../../node_modules/ofetch/dist/index.mjs", "../src/index.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"const suspectProtoRx = /\"(?:_|\\\\u0{2}5[Ff]){2}(?:p|\\\\u0{2}70)(?:r|\\\\u0{2}72)(?:o|\\\\u0{2}6[Ff])(?:t|\\\\u0{2}74)(?:o|\\\\u0{2}6[Ff])(?:_|\\\\u0{2}5[Ff]){2}\"\\s*:/;\nconst suspectConstructorRx = /\"(?:c|\\\\u0063)(?:o|\\\\u006[Ff])(?:n|\\\\u006[Ee])(?:s|\\\\u0073)(?:t|\\\\u0074)(?:r|\\\\u0072)(?:u|\\\\u0075)(?:c|\\\\u0063)(?:t|\\\\u0074)(?:o|\\\\u006[Ff])(?:r|\\\\u0072)\"\\s*:/;\nconst JsonSigRx = /^\\s*[\"[{]|^\\s*-?\\d{1,16}(\\.\\d{1,17})?([Ee][+-]?\\d+)?\\s*$/;\nfunction jsonParseTransform(key, value) {\n if (key === \"__proto__\" || key === \"constructor\" && value && typeof value === \"object\" && \"prototype\" in value) {\n warnKeyDropped(key);\n return;\n }\n return value;\n}\nfunction warnKeyDropped(key) {\n console.warn(`[destr] Dropping \"${key}\" key to prevent prototype pollution.`);\n}\nfunction destr(value, options = {}) {\n if (typeof value !== \"string\") {\n return value;\n }\n const _value = value.trim();\n if (\n // eslint-disable-next-line unicorn/prefer-at\n value[0] === '\"' && value.endsWith('\"') && !value.includes(\"\\\\\")\n ) {\n return _value.slice(1, -1);\n }\n if (_value.length <= 9) {\n const _lval = _value.toLowerCase();\n if (_lval === \"true\") {\n return true;\n }\n if (_lval === \"false\") {\n return false;\n }\n if (_lval === \"undefined\") {\n return void 0;\n }\n if (_lval === \"null\") {\n return null;\n }\n if (_lval === \"nan\") {\n return Number.NaN;\n }\n if (_lval === \"infinity\") {\n return Number.POSITIVE_INFINITY;\n }\n if (_lval === \"-infinity\") {\n return Number.NEGATIVE_INFINITY;\n }\n }\n if (!JsonSigRx.test(value)) {\n if (options.strict) {\n throw new SyntaxError(\"[destr] Invalid JSON\");\n }\n return value;\n }\n try {\n if (suspectProtoRx.test(value) || suspectConstructorRx.test(value)) {\n if (options.strict) {\n throw new Error(\"[destr] Possible prototype pollution\");\n }\n return JSON.parse(value, jsonParseTransform);\n }\n return JSON.parse(value);\n } catch (error) {\n if (options.strict) {\n throw error;\n }\n return value;\n }\n}\nfunction safeDestr(value, options = {}) {\n return destr(value, { ...options, strict: true });\n}\n\nexport { destr as default, destr, safeDestr };\n",
|
|
6
|
+
"const n = /[^\\0-\\x7E]/;\nconst t = /[\\x2E\\u3002\\uFF0E\\uFF61]/g;\nconst o = {\n overflow: \"Overflow Error\",\n \"not-basic\": \"Illegal Input\",\n \"invalid-input\": \"Invalid Input\"\n};\nconst e = Math.floor;\nconst r = String.fromCharCode;\nfunction s(n2) {\n throw new RangeError(o[n2]);\n}\nconst c = function(n2, t2) {\n return n2 + 22 + 75 * (n2 < 26) - ((t2 != 0) << 5);\n};\nconst u = function(n2, t2, o2) {\n let r2 = 0;\n for (n2 = o2 ? e(n2 / 700) : n2 >> 1, n2 += e(n2 / t2); n2 > 455; r2 += 36) {\n n2 = e(n2 / 35);\n }\n return e(r2 + 36 * n2 / (n2 + 38));\n};\nfunction toASCII(o2) {\n return function(n2, o3) {\n const e2 = n2.split(\"@\");\n let r2 = \"\";\n e2.length > 1 && (r2 = e2[0] + \"@\", n2 = e2[1]);\n const s2 = function(n3, t2) {\n const o4 = [];\n let e3 = n3.length;\n for (; e3--; ) {\n o4[e3] = t2(n3[e3]);\n }\n return o4;\n }((n2 = n2.replace(t, \".\")).split(\".\"), o3).join(\".\");\n return r2 + s2;\n }(o2, function(t2) {\n return n.test(t2) ? \"xn--\" + function(n2) {\n const t3 = [];\n const o3 = (n2 = function(n3) {\n const t4 = [];\n let o4 = 0;\n const e2 = n3.length;\n for (; o4 < e2; ) {\n const r2 = n3.charCodeAt(o4++);\n if (r2 >= 55296 && r2 <= 56319 && o4 < e2) {\n const e3 = n3.charCodeAt(o4++);\n (64512 & e3) == 56320 ? t4.push(((1023 & r2) << 10) + (1023 & e3) + 65536) : (t4.push(r2), o4--);\n } else {\n t4.push(r2);\n }\n }\n return t4;\n }(n2)).length;\n let f = 128;\n let i = 0;\n let l = 72;\n for (const o4 of n2) {\n o4 < 128 && t3.push(r(o4));\n }\n const h = t3.length;\n let p = h;\n for (h && t3.push(\"-\"); p < o3; ) {\n let o4 = 2147483647;\n for (const t4 of n2) {\n t4 >= f && t4 < o4 && (o4 = t4);\n }\n const a = p + 1;\n o4 - f > e((2147483647 - i) / a) && s(\"overflow\"), i += (o4 - f) * a, f = o4;\n for (const o5 of n2) {\n if (o5 < f && ++i > 2147483647 && s(\"overflow\"), o5 == f) {\n let n3 = i;\n for (let o6 = 36; ; o6 += 36) {\n const s2 = o6 <= l ? 1 : o6 >= l + 26 ? 26 : o6 - l;\n if (n3 < s2) {\n break;\n }\n const u2 = n3 - s2;\n const f2 = 36 - s2;\n t3.push(r(c(s2 + u2 % f2, 0))), n3 = e(u2 / f2);\n }\n t3.push(r(c(n3, 0))), l = u(i, a, p == h), i = 0, ++p;\n }\n }\n ++i, ++f;\n }\n return t3.join(\"\");\n }(t2) : t2;\n });\n}\n\nconst HASH_RE = /#/g;\nconst AMPERSAND_RE = /&/g;\nconst SLASH_RE = /\\//g;\nconst EQUAL_RE = /=/g;\nconst IM_RE = /\\?/g;\nconst PLUS_RE = /\\+/g;\nconst ENC_CARET_RE = /%5e/gi;\nconst ENC_BACKTICK_RE = /%60/gi;\nconst ENC_CURLY_OPEN_RE = /%7b/gi;\nconst ENC_PIPE_RE = /%7c/gi;\nconst ENC_CURLY_CLOSE_RE = /%7d/gi;\nconst ENC_SPACE_RE = /%20/gi;\nconst ENC_SLASH_RE = /%2f/gi;\nconst ENC_ENC_SLASH_RE = /%252f/gi;\nfunction encode(text) {\n return encodeURI(\"\" + text).replace(ENC_PIPE_RE, \"|\");\n}\nfunction encodeHash(text) {\n return encode(text).replace(ENC_CURLY_OPEN_RE, \"{\").replace(ENC_CURLY_CLOSE_RE, \"}\").replace(ENC_CARET_RE, \"^\");\n}\nfunction encodeQueryValue(input) {\n return encode(typeof input === \"string\" ? input : JSON.stringify(input)).replace(PLUS_RE, \"%2B\").replace(ENC_SPACE_RE, \"+\").replace(HASH_RE, \"%23\").replace(AMPERSAND_RE, \"%26\").replace(ENC_BACKTICK_RE, \"`\").replace(ENC_CARET_RE, \"^\").replace(SLASH_RE, \"%2F\");\n}\nfunction encodeQueryKey(text) {\n return encodeQueryValue(text).replace(EQUAL_RE, \"%3D\");\n}\nfunction encodePath(text) {\n return encode(text).replace(HASH_RE, \"%23\").replace(IM_RE, \"%3F\").replace(ENC_ENC_SLASH_RE, \"%2F\").replace(AMPERSAND_RE, \"%26\").replace(PLUS_RE, \"%2B\");\n}\nfunction encodeParam(text) {\n return encodePath(text).replace(SLASH_RE, \"%2F\");\n}\nfunction decode(text = \"\") {\n try {\n return decodeURIComponent(\"\" + text);\n } catch {\n return \"\" + text;\n }\n}\nfunction decodePath(text) {\n return decode(text.replace(ENC_SLASH_RE, \"%252F\"));\n}\nfunction decodeQueryKey(text) {\n return decode(text.replace(PLUS_RE, \" \"));\n}\nfunction decodeQueryValue(text) {\n return decode(text.replace(PLUS_RE, \" \"));\n}\nfunction encodeHost(name = \"\") {\n return toASCII(name);\n}\n\nfunction parseQuery(parametersString = \"\") {\n const object = {};\n if (parametersString[0] === \"?\") {\n parametersString = parametersString.slice(1);\n }\n for (const parameter of parametersString.split(\"&\")) {\n const s = parameter.match(/([^=]+)=?(.*)/) || [];\n if (s.length < 2) {\n continue;\n }\n const key = decodeQueryKey(s[1]);\n if (key === \"__proto__\" || key === \"constructor\") {\n continue;\n }\n const value = decodeQueryValue(s[2] || \"\");\n if (object[key] === void 0) {\n object[key] = value;\n } else if (Array.isArray(object[key])) {\n object[key].push(value);\n } else {\n object[key] = [object[key], value];\n }\n }\n return object;\n}\nfunction encodeQueryItem(key, value) {\n if (typeof value === \"number\" || typeof value === \"boolean\") {\n value = String(value);\n }\n if (!value) {\n return encodeQueryKey(key);\n }\n if (Array.isArray(value)) {\n return value.map((_value) => `${encodeQueryKey(key)}=${encodeQueryValue(_value)}`).join(\"&\");\n }\n return `${encodeQueryKey(key)}=${encodeQueryValue(value)}`;\n}\nfunction stringifyQuery(query) {\n return Object.keys(query).filter((k) => query[k] !== void 0).map((k) => encodeQueryItem(k, query[k])).filter(Boolean).join(\"&\");\n}\n\nconst PROTOCOL_STRICT_REGEX = /^[\\s\\w\\0+.-]{2,}:([/\\\\]{1,2})/;\nconst PROTOCOL_REGEX = /^[\\s\\w\\0+.-]{2,}:([/\\\\]{2})?/;\nconst PROTOCOL_RELATIVE_REGEX = /^([/\\\\]\\s*){2,}[^/\\\\]/;\nconst PROTOCOL_SCRIPT_RE = /^[\\s\\0]*(blob|data|javascript|vbscript):$/i;\nconst TRAILING_SLASH_RE = /\\/$|\\/\\?|\\/#/;\nconst JOIN_LEADING_SLASH_RE = /^\\.?\\//;\nfunction isRelative(inputString) {\n return [\"./\", \"../\"].some((string_) => inputString.startsWith(string_));\n}\nfunction hasProtocol(inputString, opts = {}) {\n if (typeof opts === \"boolean\") {\n opts = { acceptRelative: opts };\n }\n if (opts.strict) {\n return PROTOCOL_STRICT_REGEX.test(inputString);\n }\n return PROTOCOL_REGEX.test(inputString) || (opts.acceptRelative ? PROTOCOL_RELATIVE_REGEX.test(inputString) : false);\n}\nfunction isScriptProtocol(protocol) {\n return !!protocol && PROTOCOL_SCRIPT_RE.test(protocol);\n}\nfunction hasTrailingSlash(input = \"\", respectQueryAndFragment) {\n if (!respectQueryAndFragment) {\n return input.endsWith(\"/\");\n }\n return TRAILING_SLASH_RE.test(input);\n}\nfunction withoutTrailingSlash(input = \"\", respectQueryAndFragment) {\n if (!respectQueryAndFragment) {\n return (hasTrailingSlash(input) ? input.slice(0, -1) : input) || \"/\";\n }\n if (!hasTrailingSlash(input, true)) {\n return input || \"/\";\n }\n let path = input;\n let fragment = \"\";\n const fragmentIndex = input.indexOf(\"#\");\n if (fragmentIndex >= 0) {\n path = input.slice(0, fragmentIndex);\n fragment = input.slice(fragmentIndex);\n }\n const [s0, ...s] = path.split(\"?\");\n const cleanPath = s0.endsWith(\"/\") ? s0.slice(0, -1) : s0;\n return (cleanPath || \"/\") + (s.length > 0 ? `?${s.join(\"?\")}` : \"\") + fragment;\n}\nfunction withTrailingSlash(input = \"\", respectQueryAndFragment) {\n if (!respectQueryAndFragment) {\n return input.endsWith(\"/\") ? input : input + \"/\";\n }\n if (hasTrailingSlash(input, true)) {\n return input || \"/\";\n }\n let path = input;\n let fragment = \"\";\n const fragmentIndex = input.indexOf(\"#\");\n if (fragmentIndex >= 0) {\n path = input.slice(0, fragmentIndex);\n fragment = input.slice(fragmentIndex);\n if (!path) {\n return fragment;\n }\n }\n const [s0, ...s] = path.split(\"?\");\n return s0 + \"/\" + (s.length > 0 ? `?${s.join(\"?\")}` : \"\") + fragment;\n}\nfunction hasLeadingSlash(input = \"\") {\n return input.startsWith(\"/\");\n}\nfunction withoutLeadingSlash(input = \"\") {\n return (hasLeadingSlash(input) ? input.slice(1) : input) || \"/\";\n}\nfunction withLeadingSlash(input = \"\") {\n return hasLeadingSlash(input) ? input : \"/\" + input;\n}\nfunction cleanDoubleSlashes(input = \"\") {\n return input.split(\"://\").map((string_) => string_.replace(/\\/{2,}/g, \"/\")).join(\"://\");\n}\nfunction withBase(input, base) {\n if (isEmptyURL(base) || hasProtocol(input)) {\n return input;\n }\n const _base = withoutTrailingSlash(base);\n if (input.startsWith(_base)) {\n return input;\n }\n return joinURL(_base, input);\n}\nfunction withoutBase(input, base) {\n if (isEmptyURL(base)) {\n return input;\n }\n const _base = withoutTrailingSlash(base);\n if (!input.startsWith(_base)) {\n return input;\n }\n const trimmed = input.slice(_base.length);\n return trimmed[0] === \"/\" ? trimmed : \"/\" + trimmed;\n}\nfunction withQuery(input, query) {\n const parsed = parseURL(input);\n const mergedQuery = { ...parseQuery(parsed.search), ...query };\n parsed.search = stringifyQuery(mergedQuery);\n return stringifyParsedURL(parsed);\n}\nfunction getQuery(input) {\n return parseQuery(parseURL(input).search);\n}\nfunction isEmptyURL(url) {\n return !url || url === \"/\";\n}\nfunction isNonEmptyURL(url) {\n return url && url !== \"/\";\n}\nfunction joinURL(base, ...input) {\n let url = base || \"\";\n for (const segment of input.filter((url2) => isNonEmptyURL(url2))) {\n if (url) {\n const _segment = segment.replace(JOIN_LEADING_SLASH_RE, \"\");\n url = withTrailingSlash(url) + _segment;\n } else {\n url = segment;\n }\n }\n return url;\n}\nfunction joinRelativeURL(..._input) {\n const JOIN_SEGMENT_SPLIT_RE = /\\/(?!\\/)/;\n const input = _input.filter(Boolean);\n const segments = [];\n let segmentsDepth = 0;\n for (const i of input) {\n if (!i || i === \"/\") {\n continue;\n }\n for (const [sindex, s] of i.split(JOIN_SEGMENT_SPLIT_RE).entries()) {\n if (!s || s === \".\") {\n continue;\n }\n if (s === \"..\") {\n if (segments.length === 1 && hasProtocol(segments[0])) {\n continue;\n }\n segments.pop();\n segmentsDepth--;\n continue;\n }\n if (sindex === 1 && segments[segments.length - 1]?.endsWith(\":/\")) {\n segments[segments.length - 1] += \"/\" + s;\n continue;\n }\n segments.push(s);\n segmentsDepth++;\n }\n }\n let url = segments.join(\"/\");\n if (segmentsDepth >= 0) {\n if (input[0]?.startsWith(\"/\") && !url.startsWith(\"/\")) {\n url = \"/\" + url;\n } else if (input[0]?.startsWith(\"./\") && !url.startsWith(\"./\")) {\n url = \"./\" + url;\n }\n } else {\n url = \"../\".repeat(-1 * segmentsDepth) + url;\n }\n if (input[input.length - 1]?.endsWith(\"/\") && !url.endsWith(\"/\")) {\n url += \"/\";\n }\n return url;\n}\nfunction withHttp(input) {\n return withProtocol(input, \"http://\");\n}\nfunction withHttps(input) {\n return withProtocol(input, \"https://\");\n}\nfunction withoutProtocol(input) {\n return withProtocol(input, \"\");\n}\nfunction withProtocol(input, protocol) {\n let match = input.match(PROTOCOL_REGEX);\n if (!match) {\n match = input.match(/^\\/{2,}/);\n }\n if (!match) {\n return protocol + input;\n }\n return protocol + input.slice(match[0].length);\n}\nfunction normalizeURL(input) {\n const parsed = parseURL(input);\n parsed.pathname = encodePath(decodePath(parsed.pathname));\n parsed.hash = encodeHash(decode(parsed.hash));\n parsed.host = encodeHost(decode(parsed.host));\n parsed.search = stringifyQuery(parseQuery(parsed.search));\n return stringifyParsedURL(parsed);\n}\nfunction resolveURL(base = \"\", ...inputs) {\n if (typeof base !== \"string\") {\n throw new TypeError(\n `URL input should be string received ${typeof base} (${base})`\n );\n }\n const filteredInputs = inputs.filter((input) => isNonEmptyURL(input));\n if (filteredInputs.length === 0) {\n return base;\n }\n const url = parseURL(base);\n for (const inputSegment of filteredInputs) {\n const urlSegment = parseURL(inputSegment);\n if (urlSegment.pathname) {\n url.pathname = withTrailingSlash(url.pathname) + withoutLeadingSlash(urlSegment.pathname);\n }\n if (urlSegment.hash && urlSegment.hash !== \"#\") {\n url.hash = urlSegment.hash;\n }\n if (urlSegment.search && urlSegment.search !== \"?\") {\n if (url.search && url.search !== \"?\") {\n const queryString = stringifyQuery({\n ...parseQuery(url.search),\n ...parseQuery(urlSegment.search)\n });\n url.search = queryString.length > 0 ? \"?\" + queryString : \"\";\n } else {\n url.search = urlSegment.search;\n }\n }\n }\n return stringifyParsedURL(url);\n}\nfunction isSamePath(p1, p2) {\n return decode(withoutTrailingSlash(p1)) === decode(withoutTrailingSlash(p2));\n}\nfunction isEqual(a, b, options = {}) {\n if (!options.trailingSlash) {\n a = withTrailingSlash(a);\n b = withTrailingSlash(b);\n }\n if (!options.leadingSlash) {\n a = withLeadingSlash(a);\n b = withLeadingSlash(b);\n }\n if (!options.encoding) {\n a = decode(a);\n b = decode(b);\n }\n return a === b;\n}\nfunction withFragment(input, hash) {\n if (!hash || hash === \"#\") {\n return input;\n }\n const parsed = parseURL(input);\n parsed.hash = hash === \"\" ? \"\" : \"#\" + encodeHash(hash);\n return stringifyParsedURL(parsed);\n}\nfunction withoutFragment(input) {\n return stringifyParsedURL({ ...parseURL(input), hash: \"\" });\n}\nfunction withoutHost(input) {\n const parsed = parseURL(input);\n return (parsed.pathname || \"/\") + parsed.search + parsed.hash;\n}\n\nconst protocolRelative = Symbol.for(\"ufo:protocolRelative\");\nfunction parseURL(input = \"\", defaultProto) {\n const _specialProtoMatch = input.match(\n /^[\\s\\0]*(blob:|data:|javascript:|vbscript:)(.*)/i\n );\n if (_specialProtoMatch) {\n const [, _proto, _pathname = \"\"] = _specialProtoMatch;\n return {\n protocol: _proto.toLowerCase(),\n pathname: _pathname,\n href: _proto + _pathname,\n auth: \"\",\n host: \"\",\n search: \"\",\n hash: \"\"\n };\n }\n if (!hasProtocol(input, { acceptRelative: true })) {\n return defaultProto ? parseURL(defaultProto + input) : parsePath(input);\n }\n const [, protocol = \"\", auth, hostAndPath = \"\"] = input.replace(/\\\\/g, \"/\").match(/^[\\s\\0]*([\\w+.-]{2,}:)?\\/\\/([^/@]+@)?(.*)/) || [];\n let [, host = \"\", path = \"\"] = hostAndPath.match(/([^#/?]*)(.*)?/) || [];\n if (protocol === \"file:\") {\n path = path.replace(/\\/(?=[A-Za-z]:)/, \"\");\n }\n const { pathname, search, hash } = parsePath(path);\n return {\n protocol: protocol.toLowerCase(),\n auth: auth ? auth.slice(0, Math.max(0, auth.length - 1)) : \"\",\n host,\n pathname,\n search,\n hash,\n [protocolRelative]: !protocol\n };\n}\nfunction parsePath(input = \"\") {\n const [pathname = \"\", search = \"\", hash = \"\"] = (input.match(/([^#?]*)(\\?[^#]*)?(#.*)?/) || []).splice(1);\n return {\n pathname,\n search,\n hash\n };\n}\nfunction parseAuth(input = \"\") {\n const [username, password] = input.split(\":\");\n return {\n username: decode(username),\n password: decode(password)\n };\n}\nfunction parseHost(input = \"\") {\n const [hostname, port] = (input.match(/([^/:]*):?(\\d+)?/) || []).splice(1);\n return {\n hostname: decode(hostname),\n port\n };\n}\nfunction stringifyParsedURL(parsed) {\n const pathname = parsed.pathname || \"\";\n const search = parsed.search ? (parsed.search.startsWith(\"?\") ? \"\" : \"?\") + parsed.search : \"\";\n const hash = parsed.hash || \"\";\n const auth = parsed.auth ? parsed.auth + \"@\" : \"\";\n const host = parsed.host || \"\";\n const proto = parsed.protocol || parsed[protocolRelative] ? (parsed.protocol || \"\") + \"//\" : \"\";\n return proto + auth + host + pathname + search + hash;\n}\nconst FILENAME_STRICT_REGEX = /\\/([^/]+\\.[^/]+)$/;\nconst FILENAME_REGEX = /\\/([^/]+)$/;\nfunction parseFilename(input = \"\", { strict }) {\n const { pathname } = parseURL(input);\n const matches = strict ? pathname.match(FILENAME_STRICT_REGEX) : pathname.match(FILENAME_REGEX);\n return matches ? matches[1] : void 0;\n}\n\nvar __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => {\n __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\n return value;\n};\nclass $URL {\n constructor(input = \"\") {\n __publicField(this, \"protocol\");\n __publicField(this, \"host\");\n __publicField(this, \"auth\");\n __publicField(this, \"pathname\");\n __publicField(this, \"query\", {});\n __publicField(this, \"hash\");\n if (typeof input !== \"string\") {\n throw new TypeError(\n `URL input should be string received ${typeof input} (${input})`\n );\n }\n const parsed = parseURL(input);\n this.protocol = decode(parsed.protocol);\n this.host = decode(parsed.host);\n this.auth = decode(parsed.auth);\n this.pathname = decodePath(parsed.pathname);\n this.query = parseQuery(parsed.search);\n this.hash = decode(parsed.hash);\n }\n get hostname() {\n return parseHost(this.host).hostname;\n }\n get port() {\n return parseHost(this.host).port || \"\";\n }\n get username() {\n return parseAuth(this.auth).username;\n }\n get password() {\n return parseAuth(this.auth).password || \"\";\n }\n get hasProtocol() {\n return this.protocol.length;\n }\n get isAbsolute() {\n return this.hasProtocol || this.pathname[0] === \"/\";\n }\n get search() {\n const q = stringifyQuery(this.query);\n return q.length > 0 ? \"?\" + q : \"\";\n }\n get searchParams() {\n const p = new URLSearchParams();\n for (const name in this.query) {\n const value = this.query[name];\n if (Array.isArray(value)) {\n for (const v of value) {\n p.append(name, v);\n }\n } else {\n p.append(\n name,\n typeof value === \"string\" ? value : JSON.stringify(value)\n );\n }\n }\n return p;\n }\n get origin() {\n return (this.protocol ? this.protocol + \"//\" : \"\") + encodeHost(this.host);\n }\n get fullpath() {\n return encodePath(this.pathname) + this.search + encodeHash(this.hash);\n }\n get encodedAuth() {\n if (!this.auth) {\n return \"\";\n }\n const { username, password } = parseAuth(this.auth);\n return encodeURIComponent(username) + (password ? \":\" + encodeURIComponent(password) : \"\");\n }\n get href() {\n const auth = this.encodedAuth;\n const originWithAuth = (this.protocol ? this.protocol + \"//\" : \"\") + (auth ? auth + \"@\" : \"\") + encodeHost(this.host);\n return this.hasProtocol && this.isAbsolute ? originWithAuth + this.fullpath : this.fullpath;\n }\n append(url) {\n if (url.hasProtocol) {\n throw new Error(\"Cannot append a URL with protocol\");\n }\n Object.assign(this.query, url.query);\n if (url.pathname) {\n this.pathname = withTrailingSlash(this.pathname) + withoutLeadingSlash(url.pathname);\n }\n if (url.hash) {\n this.hash = url.hash;\n }\n }\n toJSON() {\n return this.href;\n }\n toString() {\n return this.href;\n }\n}\nfunction createURL(input) {\n return new $URL(input);\n}\n\nexport { $URL, cleanDoubleSlashes, createURL, decode, decodePath, decodeQueryKey, decodeQueryValue, encode, encodeHash, encodeHost, encodeParam, encodePath, encodeQueryItem, encodeQueryKey, encodeQueryValue, getQuery, hasLeadingSlash, hasProtocol, hasTrailingSlash, isEmptyURL, isEqual, isNonEmptyURL, isRelative, isSamePath, isScriptProtocol, joinRelativeURL, joinURL, normalizeURL, parseAuth, parseFilename, parseHost, parsePath, parseQuery, parseURL, resolveURL, stringifyParsedURL, stringifyQuery, withBase, withFragment, withHttp, withHttps, withLeadingSlash, withProtocol, withQuery, withTrailingSlash, withoutBase, withoutFragment, withoutHost, withoutLeadingSlash, withoutProtocol, withoutTrailingSlash };\n",
|
|
7
|
+
"import destr from 'destr';\nimport { withBase, withQuery } from 'ufo';\n\nclass FetchError extends Error {\n constructor(message, opts) {\n super(message, opts);\n this.name = \"FetchError\";\n if (opts?.cause && !this.cause) {\n this.cause = opts.cause;\n }\n }\n}\nfunction createFetchError(ctx) {\n const errorMessage = ctx.error?.message || ctx.error?.toString() || \"\";\n const method = ctx.request?.method || ctx.options?.method || \"GET\";\n const url = ctx.request?.url || String(ctx.request) || \"/\";\n const requestStr = `[${method}] ${JSON.stringify(url)}`;\n const statusStr = ctx.response ? `${ctx.response.status} ${ctx.response.statusText}` : \"<no response>\";\n const message = `${requestStr}: ${statusStr}${errorMessage ? ` ${errorMessage}` : \"\"}`;\n const fetchError = new FetchError(\n message,\n ctx.error ? { cause: ctx.error } : void 0\n );\n for (const key of [\"request\", \"options\", \"response\"]) {\n Object.defineProperty(fetchError, key, {\n get() {\n return ctx[key];\n }\n });\n }\n for (const [key, refKey] of [\n [\"data\", \"_data\"],\n [\"status\", \"status\"],\n [\"statusCode\", \"status\"],\n [\"statusText\", \"statusText\"],\n [\"statusMessage\", \"statusText\"]\n ]) {\n Object.defineProperty(fetchError, key, {\n get() {\n return ctx.response && ctx.response[refKey];\n }\n });\n }\n return fetchError;\n}\n\nconst payloadMethods = new Set(\n Object.freeze([\"PATCH\", \"POST\", \"PUT\", \"DELETE\"])\n);\nfunction isPayloadMethod(method = \"GET\") {\n return payloadMethods.has(method.toUpperCase());\n}\nfunction isJSONSerializable(value) {\n if (value === void 0) {\n return false;\n }\n const t = typeof value;\n if (t === \"string\" || t === \"number\" || t === \"boolean\" || t === null) {\n return true;\n }\n if (t !== \"object\") {\n return false;\n }\n if (Array.isArray(value)) {\n return true;\n }\n if (value.buffer) {\n return false;\n }\n return value.constructor && value.constructor.name === \"Object\" || typeof value.toJSON === \"function\";\n}\nconst textTypes = /* @__PURE__ */ new Set([\n \"image/svg\",\n \"application/xml\",\n \"application/xhtml\",\n \"application/html\"\n]);\nconst JSON_RE = /^application\\/(?:[\\w!#$%&*.^`~-]*\\+)?json(;.+)?$/i;\nfunction detectResponseType(_contentType = \"\") {\n if (!_contentType) {\n return \"json\";\n }\n const contentType = _contentType.split(\";\").shift() || \"\";\n if (JSON_RE.test(contentType)) {\n return \"json\";\n }\n if (textTypes.has(contentType) || contentType.startsWith(\"text/\")) {\n return \"text\";\n }\n return \"blob\";\n}\nfunction mergeFetchOptions(input, defaults, Headers = globalThis.Headers) {\n const merged = {\n ...defaults,\n ...input\n };\n if (defaults?.params && input?.params) {\n merged.params = {\n ...defaults?.params,\n ...input?.params\n };\n }\n if (defaults?.query && input?.query) {\n merged.query = {\n ...defaults?.query,\n ...input?.query\n };\n }\n if (defaults?.headers && input?.headers) {\n merged.headers = new Headers(defaults?.headers || {});\n for (const [key, value] of new Headers(input?.headers || {})) {\n merged.headers.set(key, value);\n }\n }\n return merged;\n}\n\nconst retryStatusCodes = /* @__PURE__ */ new Set([\n 408,\n // Request Timeout\n 409,\n // Conflict\n 425,\n // Too Early\n 429,\n // Too Many Requests\n 500,\n // Internal Server Error\n 502,\n // Bad Gateway\n 503,\n // Service Unavailable\n 504\n // Gateway Timeout\n]);\nconst nullBodyResponses = /* @__PURE__ */ new Set([101, 204, 205, 304]);\nfunction createFetch(globalOptions = {}) {\n const {\n fetch = globalThis.fetch,\n Headers = globalThis.Headers,\n AbortController = globalThis.AbortController\n } = globalOptions;\n async function onError(context) {\n const isAbort = context.error && context.error.name === \"AbortError\" && !context.options.timeout || false;\n if (context.options.retry !== false && !isAbort) {\n let retries;\n if (typeof context.options.retry === \"number\") {\n retries = context.options.retry;\n } else {\n retries = isPayloadMethod(context.options.method) ? 0 : 1;\n }\n const responseCode = context.response && context.response.status || 500;\n if (retries > 0 && (Array.isArray(context.options.retryStatusCodes) ? context.options.retryStatusCodes.includes(responseCode) : retryStatusCodes.has(responseCode))) {\n const retryDelay = context.options.retryDelay || 0;\n if (retryDelay > 0) {\n await new Promise((resolve) => setTimeout(resolve, retryDelay));\n }\n return $fetchRaw(context.request, {\n ...context.options,\n retry: retries - 1\n });\n }\n }\n const error = createFetchError(context);\n if (Error.captureStackTrace) {\n Error.captureStackTrace(error, $fetchRaw);\n }\n throw error;\n }\n const $fetchRaw = async function $fetchRaw2(_request, _options = {}) {\n const context = {\n request: _request,\n options: mergeFetchOptions(_options, globalOptions.defaults, Headers),\n response: void 0,\n error: void 0\n };\n context.options.method = context.options.method?.toUpperCase();\n if (context.options.onRequest) {\n await context.options.onRequest(context);\n }\n if (typeof context.request === \"string\") {\n if (context.options.baseURL) {\n context.request = withBase(context.request, context.options.baseURL);\n }\n if (context.options.query || context.options.params) {\n context.request = withQuery(context.request, {\n ...context.options.params,\n ...context.options.query\n });\n }\n }\n if (context.options.body && isPayloadMethod(context.options.method)) {\n if (isJSONSerializable(context.options.body)) {\n context.options.body = typeof context.options.body === \"string\" ? context.options.body : JSON.stringify(context.options.body);\n context.options.headers = new Headers(context.options.headers || {});\n if (!context.options.headers.has(\"content-type\")) {\n context.options.headers.set(\"content-type\", \"application/json\");\n }\n if (!context.options.headers.has(\"accept\")) {\n context.options.headers.set(\"accept\", \"application/json\");\n }\n } else if (\n // ReadableStream Body\n \"pipeTo\" in context.options.body && typeof context.options.body.pipeTo === \"function\" || // Node.js Stream Body\n typeof context.options.body.pipe === \"function\"\n ) {\n if (!(\"duplex\" in context.options)) {\n context.options.duplex = \"half\";\n }\n }\n }\n let abortTimeout;\n if (!context.options.signal && context.options.timeout) {\n const controller = new AbortController();\n abortTimeout = setTimeout(\n () => controller.abort(),\n context.options.timeout\n );\n context.options.signal = controller.signal;\n }\n try {\n context.response = await fetch(\n context.request,\n context.options\n );\n } catch (error) {\n context.error = error;\n if (context.options.onRequestError) {\n await context.options.onRequestError(context);\n }\n return await onError(context);\n } finally {\n if (abortTimeout) {\n clearTimeout(abortTimeout);\n }\n }\n const hasBody = context.response.body && !nullBodyResponses.has(context.response.status) && context.options.method !== \"HEAD\";\n if (hasBody) {\n const responseType = (context.options.parseResponse ? \"json\" : context.options.responseType) || detectResponseType(context.response.headers.get(\"content-type\") || \"\");\n switch (responseType) {\n case \"json\": {\n const data = await context.response.text();\n const parseFunction = context.options.parseResponse || destr;\n context.response._data = parseFunction(data);\n break;\n }\n case \"stream\": {\n context.response._data = context.response.body;\n break;\n }\n default: {\n context.response._data = await context.response[responseType]();\n }\n }\n }\n if (context.options.onResponse) {\n await context.options.onResponse(context);\n }\n if (!context.options.ignoreResponseError && context.response.status >= 400 && context.response.status < 600) {\n if (context.options.onResponseError) {\n await context.options.onResponseError(context);\n }\n return await onError(context);\n }\n return context.response;\n };\n const $fetch = async function $fetch2(request, options) {\n const r = await $fetchRaw(request, options);\n return r._data;\n };\n $fetch.raw = $fetchRaw;\n $fetch.native = (...args) => fetch(...args);\n $fetch.create = (defaultOptions = {}) => createFetch({\n ...globalOptions,\n defaults: {\n ...globalOptions.defaults,\n ...defaultOptions\n }\n });\n return $fetch;\n}\n\nexport { FetchError as F, createFetchError as a, createFetch as c };\n",
|
|
8
|
+
"import { c as createFetch } from './shared/ofetch.37386b05.mjs';\nexport { F as FetchError, a as createFetchError } from './shared/ofetch.37386b05.mjs';\nimport 'destr';\nimport 'ufo';\n\nconst _globalThis = function() {\n if (typeof globalThis !== \"undefined\") {\n return globalThis;\n }\n if (typeof self !== \"undefined\") {\n return self;\n }\n if (typeof window !== \"undefined\") {\n return window;\n }\n if (typeof global !== \"undefined\") {\n return global;\n }\n throw new Error(\"unable to locate global object\");\n}();\nconst fetch = _globalThis.fetch || (() => Promise.reject(new Error(\"[ofetch] global.fetch is not supported!\")));\nconst Headers = _globalThis.Headers;\nconst AbortController = _globalThis.AbortController;\nconst ofetch = createFetch({ fetch, Headers, AbortController });\nconst $fetch = ofetch;\n\nexport { $fetch, AbortController, Headers, createFetch, fetch, ofetch };\n",
|
|
9
|
+
"import { ofetch } from 'ofetch'\n\ninterface Params {\n [key: string]: any // Replace 'any' with more specific types if possible\n}\n\ninterface FetchRequestHeaders {\n 'Content-Type'?: string\n Authorization?: string\n Accept?: string\n 'User-Agent'?: string\n Referer?: string\n Origin?: string\n 'Cache-Control'?: string\n Pragma?: string\n Cookie?: string\n 'If-Modified-Since'?: string\n 'If-None-Match'?: string\n 'X-Requested-With'?: string\n 'Accept-Encoding'?: string\n 'Accept-Language'?: string\n [key: string]: string | undefined // To allow additional headers\n}\n\ninterface FetchRequestParams {\n headers?: FetchRequestHeaders\n method?: string\n baseURL?: string\n body?: any // Optional, for request bodies like in POST or PUT requests\n mode?: RequestMode // Optional, e.g., 'cors', 'no-cors', 'same-origin'\n credentials?: RequestCredentials // Optional, e.g., 'include', 'same-origin', 'omit'\n cache?: RequestCache // Optional, e.g., 'default', 'no-store', 'reload'\n redirect?: RequestRedirect // Optional, e.g., 'follow', 'manual', 'error'\n referrerPolicy?: ReferrerPolicy // Optional, e.g., 'no-referrer', 'origin'\n integrity?: string // Optional, for subresource integrity\n keepalive?: boolean // Optional, for whether the request should outlive the page\n signal?: AbortSignal // Optional, to abort the request\n [key: string]: any // To allow additional parameters\n}\n\ntype FetchResponse = string | Blob | ArrayBuffer | ReadableStream<Uint8Array>\n\nconst loading = ref(false)\nconst token = ref('')\nconst baseURL = '/'\n\nasync function post(url: string, params?: Params): Promise<any> {\n const headers: FetchRequestHeaders = { Accept: 'application/json' }\n\n if (token.value) headers.Authorization = `Bearer ${token.value}`\n\n const parameters: FetchRequestParams = {\n ...params,\n ...{\n headers,\n parseResponse: JSON.parse,\n method: 'POST',\n baseURL,\n },\n }\n\n loading.value = true\n\n try {\n const result: string | FetchResponse | Blob | ArrayBuffer | ReadableStream<Uint8Array> = await ofetch(\n url,\n parameters,\n )\n\n loading.value = false\n return result\n } catch (err: any) {\n loading.value = false\n\n throw err\n }\n}\n\nasync function get(url: string, params?: Params): Promise<any> {\n const headers: FetchRequestHeaders = { Accept: 'application/json' }\n\n if (token.value) headers.Authorization = `Bearer ${token.value}`\n\n const parameters: FetchRequestParams = {\n ...params,\n ...{\n headers,\n parseResponse: JSON.parse,\n method: 'GET',\n baseURL,\n },\n }\n\n return (await ofetch(url, parameters)) as FetchResponse\n}\n\nasync function patch(url: string, params?: Params): Promise<any> {\n const headers: FetchRequestHeaders = { Accept: 'application/json' }\n\n if (token.value) headers.Authorization = `Bearer ${token.value}`\n\n const parameters: FetchRequestParams = {\n ...params,\n ...{\n headers,\n parseResponse: JSON.parse,\n method: 'PATCH',\n baseURL,\n },\n }\n\n loading.value = true\n\n return (await ofetch(url, parameters)) as FetchResponse\n}\n\nasync function destroy(url: string, params?: Params): Promise<any> {\n const headers: FetchRequestHeaders = { Accept: 'application/json' }\n\n if (token.value) headers.Authorization = `Bearer ${token.value}`\n\n const parameters: FetchRequestParams = {\n ...params,\n ...{\n headers,\n method: 'DELETE',\n baseURL,\n },\n }\n\n loading.value = true\n\n return (await ofetch(url, parameters)) as FetchResponse\n}\n\nfunction setToken(authToken: string) {\n token.value = authToken\n}\n\nexport const Fetch = {\n post,\n get,\n patch,\n destroy,\n baseURL,\n loading,\n token,\n setToken,\n}\n"
|
|
10
|
+
],
|
|
11
|
+
"mappings": ";;AAGA,SAAS,kBAAkB,CAAC,KAAK,OAAO;AACtC,MAAI,QAAQ,eAAe,QAAQ,iBAAiB,gBAAgB,UAAU,YAAY,eAAe,OAAO;AAC9G,mBAAe,GAAG;AAClB;AAAA,EACF;AACA,SAAO;AAAA;AAET,SAAS,cAAc,CAAC,KAAK;AAC3B,UAAQ,KAAK,qBAAqB,0CAA0C;AAAA;AAE9E,SAAS,KAAK,CAAC,OAAO,UAAU,CAAC,GAAG;AAClC,aAAW,UAAU,UAAU;AAC7B,WAAO;AAAA,EACT;AACA,QAAM,SAAS,MAAM,KAAK;AAC1B,MAEE,MAAM,OAAO,OAAO,MAAM,SAAS,GAAG,MAAM,MAAM,SAAS,IAAI,GAC/D;AACA,WAAO,OAAO,MAAM,GAAG,EAAE;AAAA,EAC3B;AACA,MAAI,OAAO,UAAU,GAAG;AACtB,UAAM,QAAQ,OAAO,YAAY;AACjC,QAAI,UAAU,QAAQ;AACpB,aAAO;AAAA,IACT;AACA,QAAI,UAAU,SAAS;AACrB,aAAO;AAAA,IACT;AACA,QAAI,UAAU,aAAa;AACzB;AAAA,IACF;AACA,QAAI,UAAU,QAAQ;AACpB,aAAO;AAA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AAA,EACA;AAAA,EACA;AACF;",
|
|
12
|
+
"debugId": "C052A5CAF01FE71864756E2164756E21",
|
|
13
|
+
"names": []
|
|
14
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/api",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.63.0",
|
|
5
5
|
"description": "The Stacks array utilities.",
|
|
6
6
|
"author": "Chris Breuer",
|
|
7
7
|
"contributors": [
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@stacksjs/utils": "latest",
|
|
57
57
|
"ofetch": "^1.3.4",
|
|
58
|
-
"openapi-typescript": "^7.0
|
|
58
|
+
"openapi-typescript": "^7.3.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@stacksjs/development": "latest"
|
package/src/generate-openapi.ts
CHANGED
|
@@ -73,7 +73,7 @@ async function generateOpenAPISpec() {
|
|
|
73
73
|
|
|
74
74
|
const openAPISpec = await generateOpenAPISpec()
|
|
75
75
|
|
|
76
|
-
const file = Bun.file(path.
|
|
76
|
+
const file = Bun.file(path.frameworkPath(`api/openapi.json`))
|
|
77
77
|
|
|
78
78
|
const writer = file.writer()
|
|
79
79
|
|