@hot-updater/console 0.28.0 → 0.29.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/.output/nitro.json +17 -0
- package/.output/public/apple-touch-icon.png +0 -0
- package/.output/public/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
- package/.output/public/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
- package/.output/public/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
- package/.output/public/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
- package/.output/public/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
- package/.output/public/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- package/.output/public/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
- package/.output/public/assets/main-Dlx8-qN-.js +61 -0
- package/.output/public/assets/routes-DB0tWmiJ.js +10 -0
- package/.output/public/assets/styles-Bfxg4M1x.css +2 -0
- package/.output/public/favicon-16x16.png +0 -0
- package/.output/public/favicon-32x32.png +0 -0
- package/.output/public/favicon.ico +0 -0
- package/.output/public/logo.svg +1 -0
- package/.output/public/manifest.json +30 -0
- package/.output/public/robots.txt +3 -0
- package/.output/server/_chunks/ssr-renderer.mjs +15 -0
- package/.output/server/_libs/@floating-ui/core+[...].mjs +698 -0
- package/.output/server/_libs/@floating-ui/dom+[...].mjs +644 -0
- package/.output/server/_libs/@floating-ui/react-dom+[...].mjs +839 -0
- package/.output/server/_libs/@radix-ui/react-alert-dialog+[...].mjs +2093 -0
- package/.output/server/_libs/@radix-ui/react-popper+[...].mjs +287 -0
- package/.output/server/_libs/@radix-ui/react-select+[...].mjs +1003 -0
- package/.output/server/_libs/@tanstack/devtools-event-client+[...].mjs +196 -0
- package/.output/server/_libs/@tanstack/form-core+[...].mjs +2396 -0
- package/.output/server/_libs/@tanstack/react-form+[...].mjs +298 -0
- package/.output/server/_libs/@tanstack/react-router+[...].mjs +13068 -0
- package/.output/server/_libs/@tanstack/react-table+[...].mjs +2372 -0
- package/.output/server/_libs/chownr.mjs +60 -0
- package/.output/server/_libs/class-variance-authority+clsx.mjs +69 -0
- package/.output/server/_libs/core-util-is.mjs +67 -0
- package/.output/server/_libs/dayjs.mjs +408 -0
- package/.output/server/_libs/h3+rou3+srvx.mjs +1158 -0
- package/.output/server/_libs/hookable.mjs +41 -0
- package/.output/server/_libs/immediate.mjs +57 -0
- package/.output/server/_libs/inherits.mjs +39 -0
- package/.output/server/_libs/isaacs__fs-minipass+minipass.mjs +1120 -0
- package/.output/server/_libs/isarray.mjs +10 -0
- package/.output/server/_libs/jszip+[...].mjs +8311 -0
- package/.output/server/_libs/lucide-react.mjs +371 -0
- package/.output/server/_libs/minizlib.mjs +345 -0
- package/.output/server/_libs/next-themes.mjs +49 -0
- package/.output/server/_libs/radix-ui__number.mjs +6 -0
- package/.output/server/_libs/radix-ui__primitive.mjs +9 -0
- package/.output/server/_libs/radix-ui__react-arrow.mjs +23 -0
- package/.output/server/_libs/radix-ui__react-collection.mjs +78 -0
- package/.output/server/_libs/radix-ui__react-direction.mjs +11 -0
- package/.output/server/_libs/radix-ui__react-label.mjs +22 -0
- package/.output/server/_libs/radix-ui__react-separator.mjs +31 -0
- package/.output/server/_libs/radix-ui__react-slider.mjs +451 -0
- package/.output/server/_libs/radix-ui__react-switch.mjs +118 -0
- package/.output/server/_libs/radix-ui__react-tooltip.mjs +491 -0
- package/.output/server/_libs/semver.mjs +1339 -0
- package/.output/server/_libs/sonner.mjs +908 -0
- package/.output/server/_libs/tailwind-merge.mjs +1962 -0
- package/.output/server/_libs/tanstack__history.mjs +322 -0
- package/.output/server/_libs/tanstack__query-core.mjs +2073 -0
- package/.output/server/_libs/tanstack__react-query.mjs +146 -0
- package/.output/server/_libs/tanstack__router-core.mjs +6 -0
- package/.output/server/_libs/tar.mjs +1996 -0
- package/.output/server/_libs/ufo.mjs +64 -0
- package/.output/server/_runtime.mjs +26 -0
- package/.output/server/_ssr/api-rpc-D3ZehMIN.mjs +217 -0
- package/.output/server/_ssr/config.server-JUYQ7UbI.mjs +26 -0
- package/.output/server/_ssr/deleteBundle-DWUxu9-K.mjs +22 -0
- package/.output/server/_ssr/extract-timestamp-from-uuidv7-B90UBADU.mjs +24 -0
- package/.output/server/_ssr/promoteBundle-DtMHuubR.mjs +1571 -0
- package/.output/server/_ssr/router-pgc7NX76.mjs +250 -0
- package/.output/server/_ssr/routes-PqTTQSoI.mjs +1833 -0
- package/.output/server/_ssr/sidebar-DXng0IOP.mjs +439 -0
- package/.output/server/_ssr/ssr.mjs +5050 -0
- package/.output/server/_ssr/start-DQK0r85G.mjs +4 -0
- package/.output/server/_tanstack-start-manifest_v-DTbQVOpU.mjs +17 -0
- package/.output/server/index.mjs +417 -0
- package/.output/server/node_modules/tslib/modules/index.js +70 -0
- package/.output/server/node_modules/tslib/modules/package.json +3 -0
- package/.output/server/node_modules/tslib/package.json +47 -0
- package/.output/server/node_modules/tslib/tslib.js +484 -0
- package/.output/server/package.json +9 -0
- package/README.md +191 -2
- package/package.json +77 -50
- package/dist/.gitkeep +0 -0
- package/dist/assets/favicon-BkwcEHsj.ico +0 -0
- package/dist/assets/index-DUlKsori.css +0 -1
- package/dist/assets/index-ijmIcyn1.js +0 -27
- package/dist/assets/logo-BYNFyja1.png +0 -0
- package/dist/index.cjs +0 -2129
- package/dist/index.d.cts +0 -218
- package/dist/index.d.ts +0 -218
- package/dist/index.html +0 -14
- package/dist/index.js +0 -2125
package/dist/index.cjs
DELETED
|
@@ -1,2129 +0,0 @@
|
|
|
1
|
-
//#region rolldown:runtime
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __commonJS = (cb, mod) => function() {
|
|
9
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
13
|
-
key = keys[i];
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
|
-
get: ((k) => from[k]).bind(null, key),
|
|
16
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
return to;
|
|
20
|
-
};
|
|
21
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
22
|
-
value: mod,
|
|
23
|
-
enumerable: true
|
|
24
|
-
}) : target, mod));
|
|
25
|
-
|
|
26
|
-
//#endregion
|
|
27
|
-
let fs = require("fs");
|
|
28
|
-
fs = __toESM(fs);
|
|
29
|
-
let path = require("path");
|
|
30
|
-
path = __toESM(path);
|
|
31
|
-
let url = require("url");
|
|
32
|
-
url = __toESM(url);
|
|
33
|
-
let __hot_updater_cli_tools = require("@hot-updater/cli-tools");
|
|
34
|
-
__hot_updater_cli_tools = __toESM(__hot_updater_cli_tools);
|
|
35
|
-
|
|
36
|
-
//#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/utils/filepath.js
|
|
37
|
-
var getFilePath = (options) => {
|
|
38
|
-
let filename = options.filename;
|
|
39
|
-
const defaultDocument = options.defaultDocument || "index.html";
|
|
40
|
-
if (filename.endsWith("/")) filename = filename.concat(defaultDocument);
|
|
41
|
-
else if (!filename.match(/\.[a-zA-Z0-9_-]+$/)) filename = filename.concat("/" + defaultDocument);
|
|
42
|
-
return getFilePathWithoutDefaultDocument({
|
|
43
|
-
root: options.root,
|
|
44
|
-
filename
|
|
45
|
-
});
|
|
46
|
-
};
|
|
47
|
-
var getFilePathWithoutDefaultDocument = (options) => {
|
|
48
|
-
let root = options.root || "";
|
|
49
|
-
let filename = options.filename;
|
|
50
|
-
if (/(?:^|[\/\\])\.\.(?:$|[\/\\])/.test(filename)) return;
|
|
51
|
-
filename = filename.replace(/^\.?[\/\\]/, "");
|
|
52
|
-
filename = filename.replace(/\\/, "/");
|
|
53
|
-
root = root.replace(/\/$/, "");
|
|
54
|
-
let path$2 = root ? root + "/" + filename : filename;
|
|
55
|
-
path$2 = path$2.replace(/^\.?\//, "");
|
|
56
|
-
if (root[0] !== "/" && path$2[0] === "/") return;
|
|
57
|
-
return path$2;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
//#endregion
|
|
61
|
-
//#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/utils/mime.js
|
|
62
|
-
var getMimeType = (filename, mimes = baseMimes) => {
|
|
63
|
-
const match = filename.match(/\.([a-zA-Z0-9]+?)$/);
|
|
64
|
-
if (!match) return;
|
|
65
|
-
let mimeType = mimes[match[1]];
|
|
66
|
-
if (mimeType && mimeType.startsWith("text") || mimeType === "application/json") mimeType += "; charset=utf-8";
|
|
67
|
-
return mimeType;
|
|
68
|
-
};
|
|
69
|
-
var baseMimes = {
|
|
70
|
-
aac: "audio/aac",
|
|
71
|
-
avi: "video/x-msvideo",
|
|
72
|
-
avif: "image/avif",
|
|
73
|
-
av1: "video/av1",
|
|
74
|
-
bin: "application/octet-stream",
|
|
75
|
-
bmp: "image/bmp",
|
|
76
|
-
css: "text/css",
|
|
77
|
-
csv: "text/csv",
|
|
78
|
-
eot: "application/vnd.ms-fontobject",
|
|
79
|
-
epub: "application/epub+zip",
|
|
80
|
-
gif: "image/gif",
|
|
81
|
-
gz: "application/gzip",
|
|
82
|
-
htm: "text/html",
|
|
83
|
-
html: "text/html",
|
|
84
|
-
ico: "image/x-icon",
|
|
85
|
-
ics: "text/calendar",
|
|
86
|
-
jpeg: "image/jpeg",
|
|
87
|
-
jpg: "image/jpeg",
|
|
88
|
-
js: "text/javascript",
|
|
89
|
-
json: "application/json",
|
|
90
|
-
jsonld: "application/ld+json",
|
|
91
|
-
map: "application/json",
|
|
92
|
-
mid: "audio/x-midi",
|
|
93
|
-
midi: "audio/x-midi",
|
|
94
|
-
mjs: "text/javascript",
|
|
95
|
-
mp3: "audio/mpeg",
|
|
96
|
-
mp4: "video/mp4",
|
|
97
|
-
mpeg: "video/mpeg",
|
|
98
|
-
oga: "audio/ogg",
|
|
99
|
-
ogv: "video/ogg",
|
|
100
|
-
ogx: "application/ogg",
|
|
101
|
-
opus: "audio/opus",
|
|
102
|
-
otf: "font/otf",
|
|
103
|
-
pdf: "application/pdf",
|
|
104
|
-
png: "image/png",
|
|
105
|
-
rtf: "application/rtf",
|
|
106
|
-
svg: "image/svg+xml",
|
|
107
|
-
tif: "image/tiff",
|
|
108
|
-
tiff: "image/tiff",
|
|
109
|
-
ts: "video/mp2t",
|
|
110
|
-
ttf: "font/ttf",
|
|
111
|
-
txt: "text/plain",
|
|
112
|
-
wasm: "application/wasm",
|
|
113
|
-
webm: "video/webm",
|
|
114
|
-
weba: "audio/webm",
|
|
115
|
-
webp: "image/webp",
|
|
116
|
-
woff: "font/woff",
|
|
117
|
-
woff2: "font/woff2",
|
|
118
|
-
xhtml: "application/xhtml+xml",
|
|
119
|
-
xml: "application/xml",
|
|
120
|
-
zip: "application/zip",
|
|
121
|
-
"3gp": "video/3gpp",
|
|
122
|
-
"3g2": "video/3gpp2",
|
|
123
|
-
gltf: "model/gltf+json",
|
|
124
|
-
glb: "model/gltf-binary"
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
//#endregion
|
|
128
|
-
//#region ../../node_modules/.pnpm/@hono+node-server@1.13.4_hono@4.6.3/node_modules/@hono/node-server/dist/serve-static.mjs
|
|
129
|
-
var COMPRESSIBLE_CONTENT_TYPE_REGEX = /^\s*(?:text\/[^;\s]+|application\/(?:javascript|json|xml|xml-dtd|ecmascript|dart|postscript|rtf|tar|toml|vnd\.dart|vnd\.ms-fontobject|vnd\.ms-opentype|wasm|x-httpd-php|x-javascript|x-ns-proxy-autoconfig|x-sh|x-tar|x-virtualbox-hdd|x-virtualbox-ova|x-virtualbox-ovf|x-virtualbox-vbox|x-virtualbox-vdi|x-virtualbox-vhd|x-virtualbox-vmdk|x-www-form-urlencoded)|font\/(?:otf|ttf)|image\/(?:bmp|vnd\.adobe\.photoshop|vnd\.microsoft\.icon|vnd\.ms-dds|x-icon|x-ms-bmp)|message\/rfc822|model\/gltf-binary|x-shader\/x-fragment|x-shader\/x-vertex|[^;\s]+?\+(?:json|text|xml|yaml))(?:[;\s]|$)/i;
|
|
130
|
-
var ENCODINGS = {
|
|
131
|
-
br: ".br",
|
|
132
|
-
zstd: ".zst",
|
|
133
|
-
gzip: ".gz"
|
|
134
|
-
};
|
|
135
|
-
var ENCODINGS_ORDERED_KEYS = Object.keys(ENCODINGS);
|
|
136
|
-
var createStreamBody = (stream) => {
|
|
137
|
-
return new ReadableStream({
|
|
138
|
-
start(controller) {
|
|
139
|
-
stream.on("data", (chunk) => {
|
|
140
|
-
controller.enqueue(chunk);
|
|
141
|
-
});
|
|
142
|
-
stream.on("end", () => {
|
|
143
|
-
controller.close();
|
|
144
|
-
});
|
|
145
|
-
},
|
|
146
|
-
cancel() {
|
|
147
|
-
stream.destroy();
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
};
|
|
151
|
-
var addCurrentDirPrefix = (path$2) => {
|
|
152
|
-
return `./${path$2}`;
|
|
153
|
-
};
|
|
154
|
-
var getStats = (path$2) => {
|
|
155
|
-
let stats;
|
|
156
|
-
try {
|
|
157
|
-
stats = (0, fs.lstatSync)(path$2);
|
|
158
|
-
} catch {}
|
|
159
|
-
return stats;
|
|
160
|
-
};
|
|
161
|
-
var serveStatic = (options = { root: "" }) => {
|
|
162
|
-
return async (c, next) => {
|
|
163
|
-
if (c.finalized) return next();
|
|
164
|
-
let filename;
|
|
165
|
-
try {
|
|
166
|
-
filename = options.path ?? decodeURIComponent(c.req.path);
|
|
167
|
-
} catch {
|
|
168
|
-
await options.onNotFound?.(c.req.path, c);
|
|
169
|
-
return next();
|
|
170
|
-
}
|
|
171
|
-
let path$2 = getFilePathWithoutDefaultDocument({
|
|
172
|
-
filename: options.rewriteRequestPath ? options.rewriteRequestPath(filename) : filename,
|
|
173
|
-
root: options.root
|
|
174
|
-
});
|
|
175
|
-
if (path$2) path$2 = addCurrentDirPrefix(path$2);
|
|
176
|
-
else return next();
|
|
177
|
-
let stats = getStats(path$2);
|
|
178
|
-
if (stats && stats.isDirectory()) {
|
|
179
|
-
path$2 = getFilePath({
|
|
180
|
-
filename: options.rewriteRequestPath ? options.rewriteRequestPath(filename) : filename,
|
|
181
|
-
root: options.root,
|
|
182
|
-
defaultDocument: options.index ?? "index.html"
|
|
183
|
-
});
|
|
184
|
-
if (path$2) path$2 = addCurrentDirPrefix(path$2);
|
|
185
|
-
else return next();
|
|
186
|
-
stats = getStats(path$2);
|
|
187
|
-
}
|
|
188
|
-
if (!stats) {
|
|
189
|
-
await options.onNotFound?.(path$2, c);
|
|
190
|
-
return next();
|
|
191
|
-
}
|
|
192
|
-
await options.onFound?.(path$2, c);
|
|
193
|
-
const mimeType = getMimeType(path$2);
|
|
194
|
-
c.header("Content-Type", mimeType || "application/octet-stream");
|
|
195
|
-
if (options.precompressed && (!mimeType || COMPRESSIBLE_CONTENT_TYPE_REGEX.test(mimeType))) {
|
|
196
|
-
const acceptEncodingSet = new Set(c.req.header("Accept-Encoding")?.split(",").map((encoding) => encoding.trim()));
|
|
197
|
-
for (const encoding of ENCODINGS_ORDERED_KEYS) {
|
|
198
|
-
if (!acceptEncodingSet.has(encoding)) continue;
|
|
199
|
-
const precompressedStats = getStats(path$2 + ENCODINGS[encoding]);
|
|
200
|
-
if (precompressedStats) {
|
|
201
|
-
c.header("Content-Encoding", encoding);
|
|
202
|
-
c.header("Vary", "Accept-Encoding", { append: true });
|
|
203
|
-
stats = precompressedStats;
|
|
204
|
-
path$2 = path$2 + ENCODINGS[encoding];
|
|
205
|
-
break;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
const size = stats.size;
|
|
210
|
-
if (c.req.method == "HEAD" || c.req.method == "OPTIONS") {
|
|
211
|
-
c.header("Content-Length", size.toString());
|
|
212
|
-
c.status(200);
|
|
213
|
-
return c.body(null);
|
|
214
|
-
}
|
|
215
|
-
const range = c.req.header("range") || "";
|
|
216
|
-
if (!range) {
|
|
217
|
-
c.header("Content-Length", size.toString());
|
|
218
|
-
return c.body(createStreamBody((0, fs.createReadStream)(path$2)), 200);
|
|
219
|
-
}
|
|
220
|
-
c.header("Accept-Ranges", "bytes");
|
|
221
|
-
c.header("Date", stats.birthtime.toUTCString());
|
|
222
|
-
const parts = range.replace(/bytes=/, "").split("-", 2);
|
|
223
|
-
const start = parts[0] ? parseInt(parts[0], 10) : 0;
|
|
224
|
-
let end = parts[1] ? parseInt(parts[1], 10) : stats.size - 1;
|
|
225
|
-
if (size < end - start + 1) end = size - 1;
|
|
226
|
-
const chunksize = end - start + 1;
|
|
227
|
-
const stream = (0, fs.createReadStream)(path$2, {
|
|
228
|
-
start,
|
|
229
|
-
end
|
|
230
|
-
});
|
|
231
|
-
c.header("Content-Length", chunksize.toString());
|
|
232
|
-
c.header("Content-Range", `bytes ${start}-${end}/${stats.size}`);
|
|
233
|
-
return c.body(createStreamBody(stream), 206);
|
|
234
|
-
};
|
|
235
|
-
};
|
|
236
|
-
|
|
237
|
-
//#endregion
|
|
238
|
-
//#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/utils/body.js
|
|
239
|
-
var parseBody = async (request, options = /* @__PURE__ */ Object.create(null)) => {
|
|
240
|
-
const { all = false, dot = false } = options;
|
|
241
|
-
const contentType = (request instanceof HonoRequest ? request.raw.headers : request.headers).get("Content-Type");
|
|
242
|
-
if (contentType?.startsWith("multipart/form-data") || contentType?.startsWith("application/x-www-form-urlencoded")) return parseFormData(request, {
|
|
243
|
-
all,
|
|
244
|
-
dot
|
|
245
|
-
});
|
|
246
|
-
return {};
|
|
247
|
-
};
|
|
248
|
-
async function parseFormData(request, options) {
|
|
249
|
-
const formData = await request.formData();
|
|
250
|
-
if (formData) return convertFormDataToBodyData(formData, options);
|
|
251
|
-
return {};
|
|
252
|
-
}
|
|
253
|
-
function convertFormDataToBodyData(formData, options) {
|
|
254
|
-
const form = /* @__PURE__ */ Object.create(null);
|
|
255
|
-
formData.forEach((value, key) => {
|
|
256
|
-
if (!(options.all || key.endsWith("[]"))) form[key] = value;
|
|
257
|
-
else handleParsingAllValues(form, key, value);
|
|
258
|
-
});
|
|
259
|
-
if (options.dot) Object.entries(form).forEach(([key, value]) => {
|
|
260
|
-
if (key.includes(".")) {
|
|
261
|
-
handleParsingNestedValues(form, key, value);
|
|
262
|
-
delete form[key];
|
|
263
|
-
}
|
|
264
|
-
});
|
|
265
|
-
return form;
|
|
266
|
-
}
|
|
267
|
-
var handleParsingAllValues = (form, key, value) => {
|
|
268
|
-
if (form[key] !== void 0) if (Array.isArray(form[key])) form[key].push(value);
|
|
269
|
-
else form[key] = [form[key], value];
|
|
270
|
-
else form[key] = value;
|
|
271
|
-
};
|
|
272
|
-
var handleParsingNestedValues = (form, key, value) => {
|
|
273
|
-
let nestedForm = form;
|
|
274
|
-
const keys = key.split(".");
|
|
275
|
-
keys.forEach((key2, index) => {
|
|
276
|
-
if (index === keys.length - 1) nestedForm[key2] = value;
|
|
277
|
-
else {
|
|
278
|
-
if (!nestedForm[key2] || typeof nestedForm[key2] !== "object" || Array.isArray(nestedForm[key2]) || nestedForm[key2] instanceof File) nestedForm[key2] = /* @__PURE__ */ Object.create(null);
|
|
279
|
-
nestedForm = nestedForm[key2];
|
|
280
|
-
}
|
|
281
|
-
});
|
|
282
|
-
};
|
|
283
|
-
|
|
284
|
-
//#endregion
|
|
285
|
-
//#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/utils/url.js
|
|
286
|
-
var splitPath = (path$2) => {
|
|
287
|
-
const paths = path$2.split("/");
|
|
288
|
-
if (paths[0] === "") paths.shift();
|
|
289
|
-
return paths;
|
|
290
|
-
};
|
|
291
|
-
var splitRoutingPath = (routePath) => {
|
|
292
|
-
const { groups, path: path$2 } = extractGroupsFromPath(routePath);
|
|
293
|
-
return replaceGroupMarks(splitPath(path$2), groups);
|
|
294
|
-
};
|
|
295
|
-
var extractGroupsFromPath = (path$2) => {
|
|
296
|
-
const groups = [];
|
|
297
|
-
path$2 = path$2.replace(/\{[^}]+\}/g, (match, index) => {
|
|
298
|
-
const mark = `@${index}`;
|
|
299
|
-
groups.push([mark, match]);
|
|
300
|
-
return mark;
|
|
301
|
-
});
|
|
302
|
-
return {
|
|
303
|
-
groups,
|
|
304
|
-
path: path$2
|
|
305
|
-
};
|
|
306
|
-
};
|
|
307
|
-
var replaceGroupMarks = (paths, groups) => {
|
|
308
|
-
for (let i = groups.length - 1; i >= 0; i--) {
|
|
309
|
-
const [mark] = groups[i];
|
|
310
|
-
for (let j = paths.length - 1; j >= 0; j--) if (paths[j].includes(mark)) {
|
|
311
|
-
paths[j] = paths[j].replace(mark, groups[i][1]);
|
|
312
|
-
break;
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
return paths;
|
|
316
|
-
};
|
|
317
|
-
var patternCache = {};
|
|
318
|
-
var getPattern = (label) => {
|
|
319
|
-
if (label === "*") return "*";
|
|
320
|
-
const match = label.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);
|
|
321
|
-
if (match) {
|
|
322
|
-
if (!patternCache[label]) if (match[2]) patternCache[label] = [
|
|
323
|
-
label,
|
|
324
|
-
match[1],
|
|
325
|
-
/* @__PURE__ */ new RegExp("^" + match[2] + "$")
|
|
326
|
-
];
|
|
327
|
-
else patternCache[label] = [
|
|
328
|
-
label,
|
|
329
|
-
match[1],
|
|
330
|
-
true
|
|
331
|
-
];
|
|
332
|
-
return patternCache[label];
|
|
333
|
-
}
|
|
334
|
-
return null;
|
|
335
|
-
};
|
|
336
|
-
var tryDecodeURI = (str) => {
|
|
337
|
-
try {
|
|
338
|
-
return decodeURI(str);
|
|
339
|
-
} catch {
|
|
340
|
-
return str.replace(/(?:%[0-9A-Fa-f]{2})+/g, (match) => {
|
|
341
|
-
try {
|
|
342
|
-
return decodeURI(match);
|
|
343
|
-
} catch {
|
|
344
|
-
return match;
|
|
345
|
-
}
|
|
346
|
-
});
|
|
347
|
-
}
|
|
348
|
-
};
|
|
349
|
-
var getPath = (request) => {
|
|
350
|
-
const url$1 = request.url;
|
|
351
|
-
const start = url$1.indexOf("/", 8);
|
|
352
|
-
let i = start;
|
|
353
|
-
for (; i < url$1.length; i++) {
|
|
354
|
-
const charCode = url$1.charCodeAt(i);
|
|
355
|
-
if (charCode === 37) {
|
|
356
|
-
const queryIndex = url$1.indexOf("?", i);
|
|
357
|
-
const path$2 = url$1.slice(start, queryIndex === -1 ? void 0 : queryIndex);
|
|
358
|
-
return tryDecodeURI(path$2.includes("%25") ? path$2.replace(/%25/g, "%2525") : path$2);
|
|
359
|
-
} else if (charCode === 63) break;
|
|
360
|
-
}
|
|
361
|
-
return url$1.slice(start, i);
|
|
362
|
-
};
|
|
363
|
-
var getPathNoStrict = (request) => {
|
|
364
|
-
const result = getPath(request);
|
|
365
|
-
return result.length > 1 && result[result.length - 1] === "/" ? result.slice(0, -1) : result;
|
|
366
|
-
};
|
|
367
|
-
var mergePath = (...paths) => {
|
|
368
|
-
let p = "";
|
|
369
|
-
let endsWithSlash = false;
|
|
370
|
-
for (let path$2 of paths) {
|
|
371
|
-
if (p[p.length - 1] === "/") {
|
|
372
|
-
p = p.slice(0, -1);
|
|
373
|
-
endsWithSlash = true;
|
|
374
|
-
}
|
|
375
|
-
if (path$2[0] !== "/") path$2 = `/${path$2}`;
|
|
376
|
-
if (path$2 === "/" && endsWithSlash) p = `${p}/`;
|
|
377
|
-
else if (path$2 !== "/") p = `${p}${path$2}`;
|
|
378
|
-
if (path$2 === "/" && p === "") p = "/";
|
|
379
|
-
}
|
|
380
|
-
return p;
|
|
381
|
-
};
|
|
382
|
-
var checkOptionalParameter = (path$2) => {
|
|
383
|
-
if (!path$2.match(/\:.+\?$/)) return null;
|
|
384
|
-
const segments = path$2.split("/");
|
|
385
|
-
const results = [];
|
|
386
|
-
let basePath = "";
|
|
387
|
-
segments.forEach((segment) => {
|
|
388
|
-
if (segment !== "" && !/\:/.test(segment)) basePath += "/" + segment;
|
|
389
|
-
else if (/\:/.test(segment)) if (/\?/.test(segment)) {
|
|
390
|
-
if (results.length === 0 && basePath === "") results.push("/");
|
|
391
|
-
else results.push(basePath);
|
|
392
|
-
const optionalSegment = segment.replace("?", "");
|
|
393
|
-
basePath += "/" + optionalSegment;
|
|
394
|
-
results.push(basePath);
|
|
395
|
-
} else basePath += "/" + segment;
|
|
396
|
-
});
|
|
397
|
-
return results.filter((v, i, a) => a.indexOf(v) === i);
|
|
398
|
-
};
|
|
399
|
-
var _decodeURI = (value) => {
|
|
400
|
-
if (!/[%+]/.test(value)) return value;
|
|
401
|
-
if (value.indexOf("+") !== -1) value = value.replace(/\+/g, " ");
|
|
402
|
-
return /%/.test(value) ? decodeURIComponent_(value) : value;
|
|
403
|
-
};
|
|
404
|
-
var _getQueryParam = (url$1, key, multiple) => {
|
|
405
|
-
let encoded;
|
|
406
|
-
if (!multiple && key && !/[%+]/.test(key)) {
|
|
407
|
-
let keyIndex2 = url$1.indexOf(`?${key}`, 8);
|
|
408
|
-
if (keyIndex2 === -1) keyIndex2 = url$1.indexOf(`&${key}`, 8);
|
|
409
|
-
while (keyIndex2 !== -1) {
|
|
410
|
-
const trailingKeyCode = url$1.charCodeAt(keyIndex2 + key.length + 1);
|
|
411
|
-
if (trailingKeyCode === 61) {
|
|
412
|
-
const valueIndex = keyIndex2 + key.length + 2;
|
|
413
|
-
const endIndex = url$1.indexOf("&", valueIndex);
|
|
414
|
-
return _decodeURI(url$1.slice(valueIndex, endIndex === -1 ? void 0 : endIndex));
|
|
415
|
-
} else if (trailingKeyCode == 38 || isNaN(trailingKeyCode)) return "";
|
|
416
|
-
keyIndex2 = url$1.indexOf(`&${key}`, keyIndex2 + 1);
|
|
417
|
-
}
|
|
418
|
-
encoded = /[%+]/.test(url$1);
|
|
419
|
-
if (!encoded) return;
|
|
420
|
-
}
|
|
421
|
-
const results = {};
|
|
422
|
-
encoded ??= /[%+]/.test(url$1);
|
|
423
|
-
let keyIndex = url$1.indexOf("?", 8);
|
|
424
|
-
while (keyIndex !== -1) {
|
|
425
|
-
const nextKeyIndex = url$1.indexOf("&", keyIndex + 1);
|
|
426
|
-
let valueIndex = url$1.indexOf("=", keyIndex);
|
|
427
|
-
if (valueIndex > nextKeyIndex && nextKeyIndex !== -1) valueIndex = -1;
|
|
428
|
-
let name = url$1.slice(keyIndex + 1, valueIndex === -1 ? nextKeyIndex === -1 ? void 0 : nextKeyIndex : valueIndex);
|
|
429
|
-
if (encoded) name = _decodeURI(name);
|
|
430
|
-
keyIndex = nextKeyIndex;
|
|
431
|
-
if (name === "") continue;
|
|
432
|
-
let value;
|
|
433
|
-
if (valueIndex === -1) value = "";
|
|
434
|
-
else {
|
|
435
|
-
value = url$1.slice(valueIndex + 1, nextKeyIndex === -1 ? void 0 : nextKeyIndex);
|
|
436
|
-
if (encoded) value = _decodeURI(value);
|
|
437
|
-
}
|
|
438
|
-
if (multiple) {
|
|
439
|
-
if (!(results[name] && Array.isArray(results[name]))) results[name] = [];
|
|
440
|
-
results[name].push(value);
|
|
441
|
-
} else results[name] ??= value;
|
|
442
|
-
}
|
|
443
|
-
return key ? results[key] : results;
|
|
444
|
-
};
|
|
445
|
-
var getQueryParam = _getQueryParam;
|
|
446
|
-
var getQueryParams = (url$1, key) => {
|
|
447
|
-
return _getQueryParam(url$1, key, true);
|
|
448
|
-
};
|
|
449
|
-
var decodeURIComponent_ = decodeURIComponent;
|
|
450
|
-
|
|
451
|
-
//#endregion
|
|
452
|
-
//#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/request.js
|
|
453
|
-
var HonoRequest = class {
|
|
454
|
-
raw;
|
|
455
|
-
#validatedData;
|
|
456
|
-
#matchResult;
|
|
457
|
-
routeIndex = 0;
|
|
458
|
-
path;
|
|
459
|
-
bodyCache = {};
|
|
460
|
-
constructor(request, path$2 = "/", matchResult = [[]]) {
|
|
461
|
-
this.raw = request;
|
|
462
|
-
this.path = path$2;
|
|
463
|
-
this.#matchResult = matchResult;
|
|
464
|
-
this.#validatedData = {};
|
|
465
|
-
}
|
|
466
|
-
param(key) {
|
|
467
|
-
return key ? this.getDecodedParam(key) : this.getAllDecodedParams();
|
|
468
|
-
}
|
|
469
|
-
getDecodedParam(key) {
|
|
470
|
-
const paramKey = this.#matchResult[0][this.routeIndex][1][key];
|
|
471
|
-
const param = this.getParamValue(paramKey);
|
|
472
|
-
return param ? /\%/.test(param) ? decodeURIComponent_(param) : param : void 0;
|
|
473
|
-
}
|
|
474
|
-
getAllDecodedParams() {
|
|
475
|
-
const decoded = {};
|
|
476
|
-
const keys = Object.keys(this.#matchResult[0][this.routeIndex][1]);
|
|
477
|
-
for (const key of keys) {
|
|
478
|
-
const value = this.getParamValue(this.#matchResult[0][this.routeIndex][1][key]);
|
|
479
|
-
if (value && typeof value === "string") decoded[key] = /\%/.test(value) ? decodeURIComponent_(value) : value;
|
|
480
|
-
}
|
|
481
|
-
return decoded;
|
|
482
|
-
}
|
|
483
|
-
getParamValue(paramKey) {
|
|
484
|
-
return this.#matchResult[1] ? this.#matchResult[1][paramKey] : paramKey;
|
|
485
|
-
}
|
|
486
|
-
query(key) {
|
|
487
|
-
return getQueryParam(this.url, key);
|
|
488
|
-
}
|
|
489
|
-
queries(key) {
|
|
490
|
-
return getQueryParams(this.url, key);
|
|
491
|
-
}
|
|
492
|
-
header(name) {
|
|
493
|
-
if (name) return this.raw.headers.get(name.toLowerCase()) ?? void 0;
|
|
494
|
-
const headerData = {};
|
|
495
|
-
this.raw.headers.forEach((value, key) => {
|
|
496
|
-
headerData[key] = value;
|
|
497
|
-
});
|
|
498
|
-
return headerData;
|
|
499
|
-
}
|
|
500
|
-
async parseBody(options) {
|
|
501
|
-
return this.bodyCache.parsedBody ??= await parseBody(this, options);
|
|
502
|
-
}
|
|
503
|
-
cachedBody = (key) => {
|
|
504
|
-
const { bodyCache, raw: raw$1 } = this;
|
|
505
|
-
const cachedBody = bodyCache[key];
|
|
506
|
-
if (cachedBody) return cachedBody;
|
|
507
|
-
const anyCachedKey = Object.keys(bodyCache)[0];
|
|
508
|
-
if (anyCachedKey) return bodyCache[anyCachedKey].then((body) => {
|
|
509
|
-
if (anyCachedKey === "json") body = JSON.stringify(body);
|
|
510
|
-
return new Response(body)[key]();
|
|
511
|
-
});
|
|
512
|
-
return bodyCache[key] = raw$1[key]();
|
|
513
|
-
};
|
|
514
|
-
json() {
|
|
515
|
-
return this.cachedBody("json");
|
|
516
|
-
}
|
|
517
|
-
text() {
|
|
518
|
-
return this.cachedBody("text");
|
|
519
|
-
}
|
|
520
|
-
arrayBuffer() {
|
|
521
|
-
return this.cachedBody("arrayBuffer");
|
|
522
|
-
}
|
|
523
|
-
blob() {
|
|
524
|
-
return this.cachedBody("blob");
|
|
525
|
-
}
|
|
526
|
-
formData() {
|
|
527
|
-
return this.cachedBody("formData");
|
|
528
|
-
}
|
|
529
|
-
addValidatedData(target, data) {
|
|
530
|
-
this.#validatedData[target] = data;
|
|
531
|
-
}
|
|
532
|
-
valid(target) {
|
|
533
|
-
return this.#validatedData[target];
|
|
534
|
-
}
|
|
535
|
-
get url() {
|
|
536
|
-
return this.raw.url;
|
|
537
|
-
}
|
|
538
|
-
get method() {
|
|
539
|
-
return this.raw.method;
|
|
540
|
-
}
|
|
541
|
-
get matchedRoutes() {
|
|
542
|
-
return this.#matchResult[0].map(([[, route]]) => route);
|
|
543
|
-
}
|
|
544
|
-
get routePath() {
|
|
545
|
-
return this.#matchResult[0].map(([[, route]]) => route)[this.routeIndex].path;
|
|
546
|
-
}
|
|
547
|
-
};
|
|
548
|
-
|
|
549
|
-
//#endregion
|
|
550
|
-
//#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/utils/html.js
|
|
551
|
-
var HtmlEscapedCallbackPhase = {
|
|
552
|
-
Stringify: 1,
|
|
553
|
-
BeforeStream: 2,
|
|
554
|
-
Stream: 3
|
|
555
|
-
};
|
|
556
|
-
var raw = (value, callbacks) => {
|
|
557
|
-
const escapedString = new String(value);
|
|
558
|
-
escapedString.isEscaped = true;
|
|
559
|
-
escapedString.callbacks = callbacks;
|
|
560
|
-
return escapedString;
|
|
561
|
-
};
|
|
562
|
-
var resolveCallback = async (str, phase, preserveCallbacks, context, buffer) => {
|
|
563
|
-
if (typeof str === "object" && !(str instanceof String)) {
|
|
564
|
-
if (!(str instanceof Promise)) str = str.toString();
|
|
565
|
-
if (str instanceof Promise) str = await str;
|
|
566
|
-
}
|
|
567
|
-
const callbacks = str.callbacks;
|
|
568
|
-
if (!callbacks?.length) return Promise.resolve(str);
|
|
569
|
-
if (buffer) buffer[0] += str;
|
|
570
|
-
else buffer = [str];
|
|
571
|
-
const resStr = Promise.all(callbacks.map((c) => c({
|
|
572
|
-
phase,
|
|
573
|
-
buffer,
|
|
574
|
-
context
|
|
575
|
-
}))).then((res) => Promise.all(res.filter(Boolean).map((str2) => resolveCallback(str2, phase, false, context, buffer))).then(() => buffer[0]));
|
|
576
|
-
if (preserveCallbacks) return raw(await resStr, callbacks);
|
|
577
|
-
else return resStr;
|
|
578
|
-
};
|
|
579
|
-
|
|
580
|
-
//#endregion
|
|
581
|
-
//#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/context.js
|
|
582
|
-
var TEXT_PLAIN = "text/plain; charset=UTF-8";
|
|
583
|
-
var setHeaders = (headers, map = {}) => {
|
|
584
|
-
Object.entries(map).forEach(([key, value]) => headers.set(key, value));
|
|
585
|
-
return headers;
|
|
586
|
-
};
|
|
587
|
-
var Context = class {
|
|
588
|
-
#rawRequest;
|
|
589
|
-
#req;
|
|
590
|
-
env = {};
|
|
591
|
-
#var;
|
|
592
|
-
finalized = false;
|
|
593
|
-
error;
|
|
594
|
-
#status = 200;
|
|
595
|
-
#executionCtx;
|
|
596
|
-
#headers;
|
|
597
|
-
#preparedHeaders;
|
|
598
|
-
#res;
|
|
599
|
-
#isFresh = true;
|
|
600
|
-
#layout;
|
|
601
|
-
#renderer;
|
|
602
|
-
#notFoundHandler;
|
|
603
|
-
#matchResult;
|
|
604
|
-
#path;
|
|
605
|
-
constructor(req, options) {
|
|
606
|
-
this.#rawRequest = req;
|
|
607
|
-
if (options) {
|
|
608
|
-
this.#executionCtx = options.executionCtx;
|
|
609
|
-
this.env = options.env;
|
|
610
|
-
this.#notFoundHandler = options.notFoundHandler;
|
|
611
|
-
this.#path = options.path;
|
|
612
|
-
this.#matchResult = options.matchResult;
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
get req() {
|
|
616
|
-
this.#req ??= new HonoRequest(this.#rawRequest, this.#path, this.#matchResult);
|
|
617
|
-
return this.#req;
|
|
618
|
-
}
|
|
619
|
-
get event() {
|
|
620
|
-
if (this.#executionCtx && "respondWith" in this.#executionCtx) return this.#executionCtx;
|
|
621
|
-
else throw Error("This context has no FetchEvent");
|
|
622
|
-
}
|
|
623
|
-
get executionCtx() {
|
|
624
|
-
if (this.#executionCtx) return this.#executionCtx;
|
|
625
|
-
else throw Error("This context has no ExecutionContext");
|
|
626
|
-
}
|
|
627
|
-
get res() {
|
|
628
|
-
this.#isFresh = false;
|
|
629
|
-
return this.#res ||= new Response("404 Not Found", { status: 404 });
|
|
630
|
-
}
|
|
631
|
-
set res(_res) {
|
|
632
|
-
this.#isFresh = false;
|
|
633
|
-
if (this.#res && _res) try {
|
|
634
|
-
for (const [k, v] of this.#res.headers.entries()) {
|
|
635
|
-
if (k === "content-type") continue;
|
|
636
|
-
if (k === "set-cookie") {
|
|
637
|
-
const cookies = this.#res.headers.getSetCookie();
|
|
638
|
-
_res.headers.delete("set-cookie");
|
|
639
|
-
for (const cookie of cookies) _res.headers.append("set-cookie", cookie);
|
|
640
|
-
} else _res.headers.set(k, v);
|
|
641
|
-
}
|
|
642
|
-
} catch (e) {
|
|
643
|
-
if (e instanceof TypeError && e.message.includes("immutable")) {
|
|
644
|
-
this.res = new Response(_res.body, {
|
|
645
|
-
headers: _res.headers,
|
|
646
|
-
status: _res.status
|
|
647
|
-
});
|
|
648
|
-
return;
|
|
649
|
-
} else throw e;
|
|
650
|
-
}
|
|
651
|
-
this.#res = _res;
|
|
652
|
-
this.finalized = true;
|
|
653
|
-
}
|
|
654
|
-
render = (...args) => {
|
|
655
|
-
this.#renderer ??= (content) => this.html(content);
|
|
656
|
-
return this.#renderer(...args);
|
|
657
|
-
};
|
|
658
|
-
setLayout = (layout) => this.#layout = layout;
|
|
659
|
-
getLayout = () => this.#layout;
|
|
660
|
-
setRenderer = (renderer) => {
|
|
661
|
-
this.#renderer = renderer;
|
|
662
|
-
};
|
|
663
|
-
header = (name, value, options) => {
|
|
664
|
-
if (value === void 0) {
|
|
665
|
-
if (this.#headers) this.#headers.delete(name);
|
|
666
|
-
else if (this.#preparedHeaders) delete this.#preparedHeaders[name.toLocaleLowerCase()];
|
|
667
|
-
if (this.finalized) this.res.headers.delete(name);
|
|
668
|
-
return;
|
|
669
|
-
}
|
|
670
|
-
if (options?.append) {
|
|
671
|
-
if (!this.#headers) {
|
|
672
|
-
this.#isFresh = false;
|
|
673
|
-
this.#headers = new Headers(this.#preparedHeaders);
|
|
674
|
-
this.#preparedHeaders = {};
|
|
675
|
-
}
|
|
676
|
-
this.#headers.append(name, value);
|
|
677
|
-
} else if (this.#headers) this.#headers.set(name, value);
|
|
678
|
-
else {
|
|
679
|
-
this.#preparedHeaders ??= {};
|
|
680
|
-
this.#preparedHeaders[name.toLowerCase()] = value;
|
|
681
|
-
}
|
|
682
|
-
if (this.finalized) if (options?.append) this.res.headers.append(name, value);
|
|
683
|
-
else this.res.headers.set(name, value);
|
|
684
|
-
};
|
|
685
|
-
status = (status) => {
|
|
686
|
-
this.#isFresh = false;
|
|
687
|
-
this.#status = status;
|
|
688
|
-
};
|
|
689
|
-
set = (key, value) => {
|
|
690
|
-
this.#var ??= /* @__PURE__ */ new Map();
|
|
691
|
-
this.#var.set(key, value);
|
|
692
|
-
};
|
|
693
|
-
get = (key) => {
|
|
694
|
-
return this.#var ? this.#var.get(key) : void 0;
|
|
695
|
-
};
|
|
696
|
-
get var() {
|
|
697
|
-
if (!this.#var) return {};
|
|
698
|
-
return Object.fromEntries(this.#var);
|
|
699
|
-
}
|
|
700
|
-
newResponse = (data, arg, headers) => {
|
|
701
|
-
if (this.#isFresh && !headers && !arg && this.#status === 200) return new Response(data, { headers: this.#preparedHeaders });
|
|
702
|
-
if (arg && typeof arg !== "number") {
|
|
703
|
-
const header = new Headers(arg.headers);
|
|
704
|
-
if (this.#headers) this.#headers.forEach((v, k) => {
|
|
705
|
-
if (k === "set-cookie") header.append(k, v);
|
|
706
|
-
else header.set(k, v);
|
|
707
|
-
});
|
|
708
|
-
const headers2 = setHeaders(header, this.#preparedHeaders);
|
|
709
|
-
return new Response(data, {
|
|
710
|
-
headers: headers2,
|
|
711
|
-
status: arg.status ?? this.#status
|
|
712
|
-
});
|
|
713
|
-
}
|
|
714
|
-
const status = typeof arg === "number" ? arg : this.#status;
|
|
715
|
-
this.#preparedHeaders ??= {};
|
|
716
|
-
this.#headers ??= new Headers();
|
|
717
|
-
setHeaders(this.#headers, this.#preparedHeaders);
|
|
718
|
-
if (this.#res) {
|
|
719
|
-
this.#res.headers.forEach((v, k) => {
|
|
720
|
-
if (k === "set-cookie") this.#headers?.append(k, v);
|
|
721
|
-
else this.#headers?.set(k, v);
|
|
722
|
-
});
|
|
723
|
-
setHeaders(this.#headers, this.#preparedHeaders);
|
|
724
|
-
}
|
|
725
|
-
headers ??= {};
|
|
726
|
-
for (const [k, v] of Object.entries(headers)) if (typeof v === "string") this.#headers.set(k, v);
|
|
727
|
-
else {
|
|
728
|
-
this.#headers.delete(k);
|
|
729
|
-
for (const v2 of v) this.#headers.append(k, v2);
|
|
730
|
-
}
|
|
731
|
-
return new Response(data, {
|
|
732
|
-
status,
|
|
733
|
-
headers: this.#headers
|
|
734
|
-
});
|
|
735
|
-
};
|
|
736
|
-
body = (data, arg, headers) => {
|
|
737
|
-
return typeof arg === "number" ? this.newResponse(data, arg, headers) : this.newResponse(data, arg);
|
|
738
|
-
};
|
|
739
|
-
text = (text, arg, headers) => {
|
|
740
|
-
if (!this.#preparedHeaders) {
|
|
741
|
-
if (this.#isFresh && !headers && !arg) return new Response(text);
|
|
742
|
-
this.#preparedHeaders = {};
|
|
743
|
-
}
|
|
744
|
-
this.#preparedHeaders["content-type"] = TEXT_PLAIN;
|
|
745
|
-
return typeof arg === "number" ? this.newResponse(text, arg, headers) : this.newResponse(text, arg);
|
|
746
|
-
};
|
|
747
|
-
json = (object, arg, headers) => {
|
|
748
|
-
const body = JSON.stringify(object);
|
|
749
|
-
this.#preparedHeaders ??= {};
|
|
750
|
-
this.#preparedHeaders["content-type"] = "application/json; charset=UTF-8";
|
|
751
|
-
return typeof arg === "number" ? this.newResponse(body, arg, headers) : this.newResponse(body, arg);
|
|
752
|
-
};
|
|
753
|
-
html = (html, arg, headers) => {
|
|
754
|
-
this.#preparedHeaders ??= {};
|
|
755
|
-
this.#preparedHeaders["content-type"] = "text/html; charset=UTF-8";
|
|
756
|
-
if (typeof html === "object") return resolveCallback(html, HtmlEscapedCallbackPhase.Stringify, false, {}).then((html2) => {
|
|
757
|
-
return typeof arg === "number" ? this.newResponse(html2, arg, headers) : this.newResponse(html2, arg);
|
|
758
|
-
});
|
|
759
|
-
return typeof arg === "number" ? this.newResponse(html, arg, headers) : this.newResponse(html, arg);
|
|
760
|
-
};
|
|
761
|
-
redirect = (location, status) => {
|
|
762
|
-
this.#headers ??= new Headers();
|
|
763
|
-
this.#headers.set("Location", location);
|
|
764
|
-
return this.newResponse(null, status ?? 302);
|
|
765
|
-
};
|
|
766
|
-
notFound = () => {
|
|
767
|
-
this.#notFoundHandler ??= () => new Response();
|
|
768
|
-
return this.#notFoundHandler(this);
|
|
769
|
-
};
|
|
770
|
-
};
|
|
771
|
-
|
|
772
|
-
//#endregion
|
|
773
|
-
//#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/compose.js
|
|
774
|
-
var compose = (middleware, onError, onNotFound) => {
|
|
775
|
-
return (context, next) => {
|
|
776
|
-
let index = -1;
|
|
777
|
-
return dispatch(0);
|
|
778
|
-
async function dispatch(i) {
|
|
779
|
-
if (i <= index) throw new Error("next() called multiple times");
|
|
780
|
-
index = i;
|
|
781
|
-
let res;
|
|
782
|
-
let isError = false;
|
|
783
|
-
let handler;
|
|
784
|
-
if (middleware[i]) {
|
|
785
|
-
handler = middleware[i][0][0];
|
|
786
|
-
if (context instanceof Context) context.req.routeIndex = i;
|
|
787
|
-
} else handler = i === middleware.length && next || void 0;
|
|
788
|
-
if (!handler) {
|
|
789
|
-
if (context instanceof Context && context.finalized === false && onNotFound) res = await onNotFound(context);
|
|
790
|
-
} else try {
|
|
791
|
-
res = await handler(context, () => {
|
|
792
|
-
return dispatch(i + 1);
|
|
793
|
-
});
|
|
794
|
-
} catch (err) {
|
|
795
|
-
if (err instanceof Error && context instanceof Context && onError) {
|
|
796
|
-
context.error = err;
|
|
797
|
-
res = await onError(err, context);
|
|
798
|
-
isError = true;
|
|
799
|
-
} else throw err;
|
|
800
|
-
}
|
|
801
|
-
if (res && (context.finalized === false || isError)) context.res = res;
|
|
802
|
-
return context;
|
|
803
|
-
}
|
|
804
|
-
};
|
|
805
|
-
};
|
|
806
|
-
|
|
807
|
-
//#endregion
|
|
808
|
-
//#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/router.js
|
|
809
|
-
var METHOD_NAME_ALL = "ALL";
|
|
810
|
-
var METHOD_NAME_ALL_LOWERCASE = "all";
|
|
811
|
-
var METHODS = [
|
|
812
|
-
"get",
|
|
813
|
-
"post",
|
|
814
|
-
"put",
|
|
815
|
-
"delete",
|
|
816
|
-
"options",
|
|
817
|
-
"patch"
|
|
818
|
-
];
|
|
819
|
-
var MESSAGE_MATCHER_IS_ALREADY_BUILT = "Can not add a route since the matcher is already built.";
|
|
820
|
-
var UnsupportedPathError = class extends Error {};
|
|
821
|
-
|
|
822
|
-
//#endregion
|
|
823
|
-
//#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/hono-base.js
|
|
824
|
-
var COMPOSED_HANDLER = Symbol("composedHandler");
|
|
825
|
-
var notFoundHandler = (c) => {
|
|
826
|
-
return c.text("404 Not Found", 404);
|
|
827
|
-
};
|
|
828
|
-
var errorHandler = (err, c) => {
|
|
829
|
-
if ("getResponse" in err) return err.getResponse();
|
|
830
|
-
console.error(err);
|
|
831
|
-
return c.text("Internal Server Error", 500);
|
|
832
|
-
};
|
|
833
|
-
var Hono$1 = class {
|
|
834
|
-
get;
|
|
835
|
-
post;
|
|
836
|
-
put;
|
|
837
|
-
delete;
|
|
838
|
-
options;
|
|
839
|
-
patch;
|
|
840
|
-
all;
|
|
841
|
-
on;
|
|
842
|
-
use;
|
|
843
|
-
router;
|
|
844
|
-
getPath;
|
|
845
|
-
_basePath = "/";
|
|
846
|
-
#path = "/";
|
|
847
|
-
routes = [];
|
|
848
|
-
constructor(options = {}) {
|
|
849
|
-
[...METHODS, METHOD_NAME_ALL_LOWERCASE].forEach((method) => {
|
|
850
|
-
this[method] = (args1, ...args) => {
|
|
851
|
-
if (typeof args1 === "string") this.#path = args1;
|
|
852
|
-
else this.addRoute(method, this.#path, args1);
|
|
853
|
-
args.forEach((handler) => {
|
|
854
|
-
if (typeof handler !== "string") this.addRoute(method, this.#path, handler);
|
|
855
|
-
});
|
|
856
|
-
return this;
|
|
857
|
-
};
|
|
858
|
-
});
|
|
859
|
-
this.on = (method, path$2, ...handlers) => {
|
|
860
|
-
for (const p of [path$2].flat()) {
|
|
861
|
-
this.#path = p;
|
|
862
|
-
for (const m of [method].flat()) handlers.map((handler) => {
|
|
863
|
-
this.addRoute(m.toUpperCase(), this.#path, handler);
|
|
864
|
-
});
|
|
865
|
-
}
|
|
866
|
-
return this;
|
|
867
|
-
};
|
|
868
|
-
this.use = (arg1, ...handlers) => {
|
|
869
|
-
if (typeof arg1 === "string") this.#path = arg1;
|
|
870
|
-
else {
|
|
871
|
-
this.#path = "*";
|
|
872
|
-
handlers.unshift(arg1);
|
|
873
|
-
}
|
|
874
|
-
handlers.forEach((handler) => {
|
|
875
|
-
this.addRoute(METHOD_NAME_ALL, this.#path, handler);
|
|
876
|
-
});
|
|
877
|
-
return this;
|
|
878
|
-
};
|
|
879
|
-
const strict = options.strict ?? true;
|
|
880
|
-
delete options.strict;
|
|
881
|
-
Object.assign(this, options);
|
|
882
|
-
this.getPath = strict ? options.getPath ?? getPath : getPathNoStrict;
|
|
883
|
-
}
|
|
884
|
-
clone() {
|
|
885
|
-
const clone = new Hono$1({
|
|
886
|
-
router: this.router,
|
|
887
|
-
getPath: this.getPath
|
|
888
|
-
});
|
|
889
|
-
clone.routes = this.routes;
|
|
890
|
-
return clone;
|
|
891
|
-
}
|
|
892
|
-
notFoundHandler = notFoundHandler;
|
|
893
|
-
errorHandler = errorHandler;
|
|
894
|
-
route(path$2, app$1) {
|
|
895
|
-
const subApp = this.basePath(path$2);
|
|
896
|
-
app$1.routes.map((r) => {
|
|
897
|
-
let handler;
|
|
898
|
-
if (app$1.errorHandler === errorHandler) handler = r.handler;
|
|
899
|
-
else {
|
|
900
|
-
handler = async (c, next) => (await compose([], app$1.errorHandler)(c, () => r.handler(c, next))).res;
|
|
901
|
-
handler[COMPOSED_HANDLER] = r.handler;
|
|
902
|
-
}
|
|
903
|
-
subApp.addRoute(r.method, r.path, handler);
|
|
904
|
-
});
|
|
905
|
-
return this;
|
|
906
|
-
}
|
|
907
|
-
basePath(path$2) {
|
|
908
|
-
const subApp = this.clone();
|
|
909
|
-
subApp._basePath = mergePath(this._basePath, path$2);
|
|
910
|
-
return subApp;
|
|
911
|
-
}
|
|
912
|
-
onError = (handler) => {
|
|
913
|
-
this.errorHandler = handler;
|
|
914
|
-
return this;
|
|
915
|
-
};
|
|
916
|
-
notFound = (handler) => {
|
|
917
|
-
this.notFoundHandler = handler;
|
|
918
|
-
return this;
|
|
919
|
-
};
|
|
920
|
-
mount(path$2, applicationHandler, options) {
|
|
921
|
-
let replaceRequest;
|
|
922
|
-
let optionHandler;
|
|
923
|
-
if (options) if (typeof options === "function") optionHandler = options;
|
|
924
|
-
else {
|
|
925
|
-
optionHandler = options.optionHandler;
|
|
926
|
-
replaceRequest = options.replaceRequest;
|
|
927
|
-
}
|
|
928
|
-
const getOptions = optionHandler ? (c) => {
|
|
929
|
-
const options2 = optionHandler(c);
|
|
930
|
-
return Array.isArray(options2) ? options2 : [options2];
|
|
931
|
-
} : (c) => {
|
|
932
|
-
let executionContext = void 0;
|
|
933
|
-
try {
|
|
934
|
-
executionContext = c.executionCtx;
|
|
935
|
-
} catch {}
|
|
936
|
-
return [c.env, executionContext];
|
|
937
|
-
};
|
|
938
|
-
replaceRequest ||= (() => {
|
|
939
|
-
const mergedPath = mergePath(this._basePath, path$2);
|
|
940
|
-
const pathPrefixLength = mergedPath === "/" ? 0 : mergedPath.length;
|
|
941
|
-
return (request) => {
|
|
942
|
-
const url$1 = new URL(request.url);
|
|
943
|
-
url$1.pathname = url$1.pathname.slice(pathPrefixLength) || "/";
|
|
944
|
-
return new Request(url$1, request);
|
|
945
|
-
};
|
|
946
|
-
})();
|
|
947
|
-
const handler = async (c, next) => {
|
|
948
|
-
const res = await applicationHandler(replaceRequest(c.req.raw), ...getOptions(c));
|
|
949
|
-
if (res) return res;
|
|
950
|
-
await next();
|
|
951
|
-
};
|
|
952
|
-
this.addRoute(METHOD_NAME_ALL, mergePath(path$2, "*"), handler);
|
|
953
|
-
return this;
|
|
954
|
-
}
|
|
955
|
-
addRoute(method, path$2, handler) {
|
|
956
|
-
method = method.toUpperCase();
|
|
957
|
-
path$2 = mergePath(this._basePath, path$2);
|
|
958
|
-
const r = {
|
|
959
|
-
path: path$2,
|
|
960
|
-
method,
|
|
961
|
-
handler
|
|
962
|
-
};
|
|
963
|
-
this.router.add(method, path$2, [handler, r]);
|
|
964
|
-
this.routes.push(r);
|
|
965
|
-
}
|
|
966
|
-
matchRoute(method, path$2) {
|
|
967
|
-
return this.router.match(method, path$2);
|
|
968
|
-
}
|
|
969
|
-
handleError(err, c) {
|
|
970
|
-
if (err instanceof Error) return this.errorHandler(err, c);
|
|
971
|
-
throw err;
|
|
972
|
-
}
|
|
973
|
-
dispatch(request, executionCtx, env, method) {
|
|
974
|
-
if (method === "HEAD") return (async () => new Response(null, await this.dispatch(request, executionCtx, env, "GET")))();
|
|
975
|
-
const path$2 = this.getPath(request, { env });
|
|
976
|
-
const matchResult = this.matchRoute(method, path$2);
|
|
977
|
-
const c = new Context(request, {
|
|
978
|
-
path: path$2,
|
|
979
|
-
matchResult,
|
|
980
|
-
env,
|
|
981
|
-
executionCtx,
|
|
982
|
-
notFoundHandler: this.notFoundHandler
|
|
983
|
-
});
|
|
984
|
-
if (matchResult[0].length === 1) {
|
|
985
|
-
let res;
|
|
986
|
-
try {
|
|
987
|
-
res = matchResult[0][0][0][0](c, async () => {
|
|
988
|
-
c.res = await this.notFoundHandler(c);
|
|
989
|
-
});
|
|
990
|
-
} catch (err) {
|
|
991
|
-
return this.handleError(err, c);
|
|
992
|
-
}
|
|
993
|
-
return res instanceof Promise ? res.then((resolved) => resolved || (c.finalized ? c.res : this.notFoundHandler(c))).catch((err) => this.handleError(err, c)) : res ?? this.notFoundHandler(c);
|
|
994
|
-
}
|
|
995
|
-
const composed = compose(matchResult[0], this.errorHandler, this.notFoundHandler);
|
|
996
|
-
return (async () => {
|
|
997
|
-
try {
|
|
998
|
-
const context = await composed(c);
|
|
999
|
-
if (!context.finalized) throw new Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");
|
|
1000
|
-
return context.res;
|
|
1001
|
-
} catch (err) {
|
|
1002
|
-
return this.handleError(err, c);
|
|
1003
|
-
}
|
|
1004
|
-
})();
|
|
1005
|
-
}
|
|
1006
|
-
fetch = (request, ...rest) => {
|
|
1007
|
-
return this.dispatch(request, rest[1], rest[0], request.method);
|
|
1008
|
-
};
|
|
1009
|
-
request = (input, requestInit, Env, executionCtx) => {
|
|
1010
|
-
if (input instanceof Request) {
|
|
1011
|
-
if (requestInit !== void 0) input = new Request(input, requestInit);
|
|
1012
|
-
return this.fetch(input, Env, executionCtx);
|
|
1013
|
-
}
|
|
1014
|
-
input = input.toString();
|
|
1015
|
-
const path$2 = /^https?:\/\//.test(input) ? input : `http://localhost${mergePath("/", input)}`;
|
|
1016
|
-
const req = new Request(path$2, requestInit);
|
|
1017
|
-
return this.fetch(req, Env, executionCtx);
|
|
1018
|
-
};
|
|
1019
|
-
fire = () => {
|
|
1020
|
-
addEventListener("fetch", (event) => {
|
|
1021
|
-
event.respondWith(this.dispatch(event.request, event, void 0, event.request.method));
|
|
1022
|
-
});
|
|
1023
|
-
};
|
|
1024
|
-
};
|
|
1025
|
-
|
|
1026
|
-
//#endregion
|
|
1027
|
-
//#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/router/reg-exp-router/node.js
|
|
1028
|
-
var LABEL_REG_EXP_STR = "[^/]+";
|
|
1029
|
-
var ONLY_WILDCARD_REG_EXP_STR = ".*";
|
|
1030
|
-
var TAIL_WILDCARD_REG_EXP_STR = "(?:|/.*)";
|
|
1031
|
-
var PATH_ERROR = Symbol();
|
|
1032
|
-
var regExpMetaChars = /* @__PURE__ */ new Set(".\\+*[^]$()");
|
|
1033
|
-
function compareKey(a, b) {
|
|
1034
|
-
if (a.length === 1) return b.length === 1 ? a < b ? -1 : 1 : -1;
|
|
1035
|
-
if (b.length === 1) return 1;
|
|
1036
|
-
if (a === ONLY_WILDCARD_REG_EXP_STR || a === TAIL_WILDCARD_REG_EXP_STR) return 1;
|
|
1037
|
-
else if (b === ONLY_WILDCARD_REG_EXP_STR || b === TAIL_WILDCARD_REG_EXP_STR) return -1;
|
|
1038
|
-
if (a === LABEL_REG_EXP_STR) return 1;
|
|
1039
|
-
else if (b === LABEL_REG_EXP_STR) return -1;
|
|
1040
|
-
return a.length === b.length ? a < b ? -1 : 1 : b.length - a.length;
|
|
1041
|
-
}
|
|
1042
|
-
var Node$1 = class {
|
|
1043
|
-
index;
|
|
1044
|
-
varIndex;
|
|
1045
|
-
children = /* @__PURE__ */ Object.create(null);
|
|
1046
|
-
insert(tokens, index, paramMap, context, pathErrorCheckOnly) {
|
|
1047
|
-
if (tokens.length === 0) {
|
|
1048
|
-
if (this.index !== void 0) throw PATH_ERROR;
|
|
1049
|
-
if (pathErrorCheckOnly) return;
|
|
1050
|
-
this.index = index;
|
|
1051
|
-
return;
|
|
1052
|
-
}
|
|
1053
|
-
const [token, ...restTokens] = tokens;
|
|
1054
|
-
const pattern = token === "*" ? restTokens.length === 0 ? [
|
|
1055
|
-
"",
|
|
1056
|
-
"",
|
|
1057
|
-
ONLY_WILDCARD_REG_EXP_STR
|
|
1058
|
-
] : [
|
|
1059
|
-
"",
|
|
1060
|
-
"",
|
|
1061
|
-
LABEL_REG_EXP_STR
|
|
1062
|
-
] : token === "/*" ? [
|
|
1063
|
-
"",
|
|
1064
|
-
"",
|
|
1065
|
-
TAIL_WILDCARD_REG_EXP_STR
|
|
1066
|
-
] : token.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);
|
|
1067
|
-
let node;
|
|
1068
|
-
if (pattern) {
|
|
1069
|
-
const name = pattern[1];
|
|
1070
|
-
let regexpStr = pattern[2] || LABEL_REG_EXP_STR;
|
|
1071
|
-
if (name && pattern[2]) {
|
|
1072
|
-
regexpStr = regexpStr.replace(/^\((?!\?:)(?=[^)]+\)$)/, "(?:");
|
|
1073
|
-
if (/\((?!\?:)/.test(regexpStr)) throw PATH_ERROR;
|
|
1074
|
-
}
|
|
1075
|
-
node = this.children[regexpStr];
|
|
1076
|
-
if (!node) {
|
|
1077
|
-
if (Object.keys(this.children).some((k) => k !== ONLY_WILDCARD_REG_EXP_STR && k !== TAIL_WILDCARD_REG_EXP_STR)) throw PATH_ERROR;
|
|
1078
|
-
if (pathErrorCheckOnly) return;
|
|
1079
|
-
node = this.children[regexpStr] = new Node$1();
|
|
1080
|
-
if (name !== "") node.varIndex = context.varIndex++;
|
|
1081
|
-
}
|
|
1082
|
-
if (!pathErrorCheckOnly && name !== "") paramMap.push([name, node.varIndex]);
|
|
1083
|
-
} else {
|
|
1084
|
-
node = this.children[token];
|
|
1085
|
-
if (!node) {
|
|
1086
|
-
if (Object.keys(this.children).some((k) => k.length > 1 && k !== ONLY_WILDCARD_REG_EXP_STR && k !== TAIL_WILDCARD_REG_EXP_STR)) throw PATH_ERROR;
|
|
1087
|
-
if (pathErrorCheckOnly) return;
|
|
1088
|
-
node = this.children[token] = new Node$1();
|
|
1089
|
-
}
|
|
1090
|
-
}
|
|
1091
|
-
node.insert(restTokens, index, paramMap, context, pathErrorCheckOnly);
|
|
1092
|
-
}
|
|
1093
|
-
buildRegExpStr() {
|
|
1094
|
-
const strList = Object.keys(this.children).sort(compareKey).map((k) => {
|
|
1095
|
-
const c = this.children[k];
|
|
1096
|
-
return (typeof c.varIndex === "number" ? `(${k})@${c.varIndex}` : regExpMetaChars.has(k) ? `\\${k}` : k) + c.buildRegExpStr();
|
|
1097
|
-
});
|
|
1098
|
-
if (typeof this.index === "number") strList.unshift(`#${this.index}`);
|
|
1099
|
-
if (strList.length === 0) return "";
|
|
1100
|
-
if (strList.length === 1) return strList[0];
|
|
1101
|
-
return "(?:" + strList.join("|") + ")";
|
|
1102
|
-
}
|
|
1103
|
-
};
|
|
1104
|
-
|
|
1105
|
-
//#endregion
|
|
1106
|
-
//#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/router/reg-exp-router/trie.js
|
|
1107
|
-
var Trie = class {
|
|
1108
|
-
context = { varIndex: 0 };
|
|
1109
|
-
root = new Node$1();
|
|
1110
|
-
insert(path$2, index, pathErrorCheckOnly) {
|
|
1111
|
-
const paramAssoc = [];
|
|
1112
|
-
const groups = [];
|
|
1113
|
-
for (let i = 0;;) {
|
|
1114
|
-
let replaced = false;
|
|
1115
|
-
path$2 = path$2.replace(/\{[^}]+\}/g, (m) => {
|
|
1116
|
-
const mark = `@\\${i}`;
|
|
1117
|
-
groups[i] = [mark, m];
|
|
1118
|
-
i++;
|
|
1119
|
-
replaced = true;
|
|
1120
|
-
return mark;
|
|
1121
|
-
});
|
|
1122
|
-
if (!replaced) break;
|
|
1123
|
-
}
|
|
1124
|
-
const tokens = path$2.match(/(?::[^\/]+)|(?:\/\*$)|./g) || [];
|
|
1125
|
-
for (let i = groups.length - 1; i >= 0; i--) {
|
|
1126
|
-
const [mark] = groups[i];
|
|
1127
|
-
for (let j = tokens.length - 1; j >= 0; j--) if (tokens[j].indexOf(mark) !== -1) {
|
|
1128
|
-
tokens[j] = tokens[j].replace(mark, groups[i][1]);
|
|
1129
|
-
break;
|
|
1130
|
-
}
|
|
1131
|
-
}
|
|
1132
|
-
this.root.insert(tokens, index, paramAssoc, this.context, pathErrorCheckOnly);
|
|
1133
|
-
return paramAssoc;
|
|
1134
|
-
}
|
|
1135
|
-
buildRegExp() {
|
|
1136
|
-
let regexp = this.root.buildRegExpStr();
|
|
1137
|
-
if (regexp === "") return [
|
|
1138
|
-
/^$/,
|
|
1139
|
-
[],
|
|
1140
|
-
[]
|
|
1141
|
-
];
|
|
1142
|
-
let captureIndex = 0;
|
|
1143
|
-
const indexReplacementMap = [];
|
|
1144
|
-
const paramReplacementMap = [];
|
|
1145
|
-
regexp = regexp.replace(/#(\d+)|@(\d+)|\.\*\$/g, (_, handlerIndex, paramIndex) => {
|
|
1146
|
-
if (typeof handlerIndex !== "undefined") {
|
|
1147
|
-
indexReplacementMap[++captureIndex] = Number(handlerIndex);
|
|
1148
|
-
return "$()";
|
|
1149
|
-
}
|
|
1150
|
-
if (typeof paramIndex !== "undefined") {
|
|
1151
|
-
paramReplacementMap[Number(paramIndex)] = ++captureIndex;
|
|
1152
|
-
return "";
|
|
1153
|
-
}
|
|
1154
|
-
return "";
|
|
1155
|
-
});
|
|
1156
|
-
return [
|
|
1157
|
-
/* @__PURE__ */ new RegExp(`^${regexp}`),
|
|
1158
|
-
indexReplacementMap,
|
|
1159
|
-
paramReplacementMap
|
|
1160
|
-
];
|
|
1161
|
-
}
|
|
1162
|
-
};
|
|
1163
|
-
|
|
1164
|
-
//#endregion
|
|
1165
|
-
//#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/router/reg-exp-router/router.js
|
|
1166
|
-
var emptyParam = [];
|
|
1167
|
-
var nullMatcher = [
|
|
1168
|
-
/^$/,
|
|
1169
|
-
[],
|
|
1170
|
-
/* @__PURE__ */ Object.create(null)
|
|
1171
|
-
];
|
|
1172
|
-
var wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
|
|
1173
|
-
function buildWildcardRegExp(path$2) {
|
|
1174
|
-
return wildcardRegExpCache[path$2] ??= /* @__PURE__ */ new RegExp(path$2 === "*" ? "" : `^${path$2.replace(/\/\*$|([.\\+*[^\]$()])/g, (_, metaChar) => metaChar ? `\\${metaChar}` : "(?:|/.*)")}$`);
|
|
1175
|
-
}
|
|
1176
|
-
function clearWildcardRegExpCache() {
|
|
1177
|
-
wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
|
|
1178
|
-
}
|
|
1179
|
-
function buildMatcherFromPreprocessedRoutes(routes) {
|
|
1180
|
-
const trie = new Trie();
|
|
1181
|
-
const handlerData = [];
|
|
1182
|
-
if (routes.length === 0) return nullMatcher;
|
|
1183
|
-
const routesWithStaticPathFlag = routes.map((route) => [!/\*|\/:/.test(route[0]), ...route]).sort(([isStaticA, pathA], [isStaticB, pathB]) => isStaticA ? 1 : isStaticB ? -1 : pathA.length - pathB.length);
|
|
1184
|
-
const staticMap = /* @__PURE__ */ Object.create(null);
|
|
1185
|
-
for (let i = 0, j = -1, len = routesWithStaticPathFlag.length; i < len; i++) {
|
|
1186
|
-
const [pathErrorCheckOnly, path$2, handlers] = routesWithStaticPathFlag[i];
|
|
1187
|
-
if (pathErrorCheckOnly) staticMap[path$2] = [handlers.map(([h]) => [h, /* @__PURE__ */ Object.create(null)]), emptyParam];
|
|
1188
|
-
else j++;
|
|
1189
|
-
let paramAssoc;
|
|
1190
|
-
try {
|
|
1191
|
-
paramAssoc = trie.insert(path$2, j, pathErrorCheckOnly);
|
|
1192
|
-
} catch (e) {
|
|
1193
|
-
throw e === PATH_ERROR ? new UnsupportedPathError(path$2) : e;
|
|
1194
|
-
}
|
|
1195
|
-
if (pathErrorCheckOnly) continue;
|
|
1196
|
-
handlerData[j] = handlers.map(([h, paramCount]) => {
|
|
1197
|
-
const paramIndexMap = /* @__PURE__ */ Object.create(null);
|
|
1198
|
-
paramCount -= 1;
|
|
1199
|
-
for (; paramCount >= 0; paramCount--) {
|
|
1200
|
-
const [key, value] = paramAssoc[paramCount];
|
|
1201
|
-
paramIndexMap[key] = value;
|
|
1202
|
-
}
|
|
1203
|
-
return [h, paramIndexMap];
|
|
1204
|
-
});
|
|
1205
|
-
}
|
|
1206
|
-
const [regexp, indexReplacementMap, paramReplacementMap] = trie.buildRegExp();
|
|
1207
|
-
for (let i = 0, len = handlerData.length; i < len; i++) for (let j = 0, len2 = handlerData[i].length; j < len2; j++) {
|
|
1208
|
-
const map = handlerData[i][j]?.[1];
|
|
1209
|
-
if (!map) continue;
|
|
1210
|
-
const keys = Object.keys(map);
|
|
1211
|
-
for (let k = 0, len3 = keys.length; k < len3; k++) map[keys[k]] = paramReplacementMap[map[keys[k]]];
|
|
1212
|
-
}
|
|
1213
|
-
const handlerMap = [];
|
|
1214
|
-
for (const i in indexReplacementMap) handlerMap[i] = handlerData[indexReplacementMap[i]];
|
|
1215
|
-
return [
|
|
1216
|
-
regexp,
|
|
1217
|
-
handlerMap,
|
|
1218
|
-
staticMap
|
|
1219
|
-
];
|
|
1220
|
-
}
|
|
1221
|
-
function findMiddleware(middleware, path$2) {
|
|
1222
|
-
if (!middleware) return;
|
|
1223
|
-
for (const k of Object.keys(middleware).sort((a, b) => b.length - a.length)) if (buildWildcardRegExp(k).test(path$2)) return [...middleware[k]];
|
|
1224
|
-
}
|
|
1225
|
-
var RegExpRouter = class {
|
|
1226
|
-
name = "RegExpRouter";
|
|
1227
|
-
middleware;
|
|
1228
|
-
routes;
|
|
1229
|
-
constructor() {
|
|
1230
|
-
this.middleware = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) };
|
|
1231
|
-
this.routes = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) };
|
|
1232
|
-
}
|
|
1233
|
-
add(method, path$2, handler) {
|
|
1234
|
-
const { middleware, routes } = this;
|
|
1235
|
-
if (!middleware || !routes) throw new Error(MESSAGE_MATCHER_IS_ALREADY_BUILT);
|
|
1236
|
-
if (!middleware[method]) [middleware, routes].forEach((handlerMap) => {
|
|
1237
|
-
handlerMap[method] = /* @__PURE__ */ Object.create(null);
|
|
1238
|
-
Object.keys(handlerMap[METHOD_NAME_ALL]).forEach((p) => {
|
|
1239
|
-
handlerMap[method][p] = [...handlerMap[METHOD_NAME_ALL][p]];
|
|
1240
|
-
});
|
|
1241
|
-
});
|
|
1242
|
-
if (path$2 === "/*") path$2 = "*";
|
|
1243
|
-
const paramCount = (path$2.match(/\/:/g) || []).length;
|
|
1244
|
-
if (/\*$/.test(path$2)) {
|
|
1245
|
-
const re = buildWildcardRegExp(path$2);
|
|
1246
|
-
if (method === METHOD_NAME_ALL) Object.keys(middleware).forEach((m) => {
|
|
1247
|
-
middleware[m][path$2] ||= findMiddleware(middleware[m], path$2) || findMiddleware(middleware[METHOD_NAME_ALL], path$2) || [];
|
|
1248
|
-
});
|
|
1249
|
-
else middleware[method][path$2] ||= findMiddleware(middleware[method], path$2) || findMiddleware(middleware[METHOD_NAME_ALL], path$2) || [];
|
|
1250
|
-
Object.keys(middleware).forEach((m) => {
|
|
1251
|
-
if (method === METHOD_NAME_ALL || method === m) Object.keys(middleware[m]).forEach((p) => {
|
|
1252
|
-
re.test(p) && middleware[m][p].push([handler, paramCount]);
|
|
1253
|
-
});
|
|
1254
|
-
});
|
|
1255
|
-
Object.keys(routes).forEach((m) => {
|
|
1256
|
-
if (method === METHOD_NAME_ALL || method === m) Object.keys(routes[m]).forEach((p) => re.test(p) && routes[m][p].push([handler, paramCount]));
|
|
1257
|
-
});
|
|
1258
|
-
return;
|
|
1259
|
-
}
|
|
1260
|
-
const paths = checkOptionalParameter(path$2) || [path$2];
|
|
1261
|
-
for (let i = 0, len = paths.length; i < len; i++) {
|
|
1262
|
-
const path2 = paths[i];
|
|
1263
|
-
Object.keys(routes).forEach((m) => {
|
|
1264
|
-
if (method === METHOD_NAME_ALL || method === m) {
|
|
1265
|
-
routes[m][path2] ||= [...findMiddleware(middleware[m], path2) || findMiddleware(middleware[METHOD_NAME_ALL], path2) || []];
|
|
1266
|
-
routes[m][path2].push([handler, paramCount - len + i + 1]);
|
|
1267
|
-
}
|
|
1268
|
-
});
|
|
1269
|
-
}
|
|
1270
|
-
}
|
|
1271
|
-
match(method, path$2) {
|
|
1272
|
-
clearWildcardRegExpCache();
|
|
1273
|
-
const matchers = this.buildAllMatchers();
|
|
1274
|
-
this.match = (method2, path2) => {
|
|
1275
|
-
const matcher = matchers[method2] || matchers[METHOD_NAME_ALL];
|
|
1276
|
-
const staticMatch = matcher[2][path2];
|
|
1277
|
-
if (staticMatch) return staticMatch;
|
|
1278
|
-
const match = path2.match(matcher[0]);
|
|
1279
|
-
if (!match) return [[], emptyParam];
|
|
1280
|
-
const index = match.indexOf("", 1);
|
|
1281
|
-
return [matcher[1][index], match];
|
|
1282
|
-
};
|
|
1283
|
-
return this.match(method, path$2);
|
|
1284
|
-
}
|
|
1285
|
-
buildAllMatchers() {
|
|
1286
|
-
const matchers = /* @__PURE__ */ Object.create(null);
|
|
1287
|
-
[...Object.keys(this.routes), ...Object.keys(this.middleware)].forEach((method) => {
|
|
1288
|
-
matchers[method] ||= this.buildMatcher(method);
|
|
1289
|
-
});
|
|
1290
|
-
this.middleware = this.routes = void 0;
|
|
1291
|
-
return matchers;
|
|
1292
|
-
}
|
|
1293
|
-
buildMatcher(method) {
|
|
1294
|
-
const routes = [];
|
|
1295
|
-
let hasOwnRoute = method === METHOD_NAME_ALL;
|
|
1296
|
-
[this.middleware, this.routes].forEach((r) => {
|
|
1297
|
-
const ownRoute = r[method] ? Object.keys(r[method]).map((path$2) => [path$2, r[method][path$2]]) : [];
|
|
1298
|
-
if (ownRoute.length !== 0) {
|
|
1299
|
-
hasOwnRoute ||= true;
|
|
1300
|
-
routes.push(...ownRoute);
|
|
1301
|
-
} else if (method !== METHOD_NAME_ALL) routes.push(...Object.keys(r[METHOD_NAME_ALL]).map((path$2) => [path$2, r[METHOD_NAME_ALL][path$2]]));
|
|
1302
|
-
});
|
|
1303
|
-
if (!hasOwnRoute) return null;
|
|
1304
|
-
else return buildMatcherFromPreprocessedRoutes(routes);
|
|
1305
|
-
}
|
|
1306
|
-
};
|
|
1307
|
-
|
|
1308
|
-
//#endregion
|
|
1309
|
-
//#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/router/smart-router/router.js
|
|
1310
|
-
var SmartRouter = class {
|
|
1311
|
-
name = "SmartRouter";
|
|
1312
|
-
routers = [];
|
|
1313
|
-
routes = [];
|
|
1314
|
-
constructor(init) {
|
|
1315
|
-
Object.assign(this, init);
|
|
1316
|
-
}
|
|
1317
|
-
add(method, path$2, handler) {
|
|
1318
|
-
if (!this.routes) throw new Error(MESSAGE_MATCHER_IS_ALREADY_BUILT);
|
|
1319
|
-
this.routes.push([
|
|
1320
|
-
method,
|
|
1321
|
-
path$2,
|
|
1322
|
-
handler
|
|
1323
|
-
]);
|
|
1324
|
-
}
|
|
1325
|
-
match(method, path$2) {
|
|
1326
|
-
if (!this.routes) throw new Error("Fatal error");
|
|
1327
|
-
const { routers, routes } = this;
|
|
1328
|
-
const len = routers.length;
|
|
1329
|
-
let i = 0;
|
|
1330
|
-
let res;
|
|
1331
|
-
for (; i < len; i++) {
|
|
1332
|
-
const router = routers[i];
|
|
1333
|
-
try {
|
|
1334
|
-
routes.forEach((args) => {
|
|
1335
|
-
router.add(...args);
|
|
1336
|
-
});
|
|
1337
|
-
res = router.match(method, path$2);
|
|
1338
|
-
} catch (e) {
|
|
1339
|
-
if (e instanceof UnsupportedPathError) continue;
|
|
1340
|
-
throw e;
|
|
1341
|
-
}
|
|
1342
|
-
this.match = router.match.bind(router);
|
|
1343
|
-
this.routers = [router];
|
|
1344
|
-
this.routes = void 0;
|
|
1345
|
-
break;
|
|
1346
|
-
}
|
|
1347
|
-
if (i === len) throw new Error("Fatal error");
|
|
1348
|
-
this.name = `SmartRouter + ${this.activeRouter.name}`;
|
|
1349
|
-
return res;
|
|
1350
|
-
}
|
|
1351
|
-
get activeRouter() {
|
|
1352
|
-
if (this.routes || this.routers.length !== 1) throw new Error("No active router has been determined yet.");
|
|
1353
|
-
return this.routers[0];
|
|
1354
|
-
}
|
|
1355
|
-
};
|
|
1356
|
-
|
|
1357
|
-
//#endregion
|
|
1358
|
-
//#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/router/trie-router/node.js
|
|
1359
|
-
var Node = class {
|
|
1360
|
-
methods;
|
|
1361
|
-
children;
|
|
1362
|
-
patterns;
|
|
1363
|
-
order = 0;
|
|
1364
|
-
name;
|
|
1365
|
-
params = /* @__PURE__ */ Object.create(null);
|
|
1366
|
-
constructor(method, handler, children) {
|
|
1367
|
-
this.children = children || /* @__PURE__ */ Object.create(null);
|
|
1368
|
-
this.methods = [];
|
|
1369
|
-
this.name = "";
|
|
1370
|
-
if (method && handler) {
|
|
1371
|
-
const m = /* @__PURE__ */ Object.create(null);
|
|
1372
|
-
m[method] = {
|
|
1373
|
-
handler,
|
|
1374
|
-
possibleKeys: [],
|
|
1375
|
-
score: 0,
|
|
1376
|
-
name: this.name
|
|
1377
|
-
};
|
|
1378
|
-
this.methods = [m];
|
|
1379
|
-
}
|
|
1380
|
-
this.patterns = [];
|
|
1381
|
-
}
|
|
1382
|
-
insert(method, path$2, handler) {
|
|
1383
|
-
this.name = `${method} ${path$2}`;
|
|
1384
|
-
this.order = ++this.order;
|
|
1385
|
-
let curNode = this;
|
|
1386
|
-
const parts = splitRoutingPath(path$2);
|
|
1387
|
-
const possibleKeys = [];
|
|
1388
|
-
for (let i = 0, len = parts.length; i < len; i++) {
|
|
1389
|
-
const p = parts[i];
|
|
1390
|
-
if (Object.keys(curNode.children).includes(p)) {
|
|
1391
|
-
curNode = curNode.children[p];
|
|
1392
|
-
const pattern2 = getPattern(p);
|
|
1393
|
-
if (pattern2) possibleKeys.push(pattern2[1]);
|
|
1394
|
-
continue;
|
|
1395
|
-
}
|
|
1396
|
-
curNode.children[p] = new Node();
|
|
1397
|
-
const pattern = getPattern(p);
|
|
1398
|
-
if (pattern) {
|
|
1399
|
-
curNode.patterns.push(pattern);
|
|
1400
|
-
possibleKeys.push(pattern[1]);
|
|
1401
|
-
}
|
|
1402
|
-
curNode = curNode.children[p];
|
|
1403
|
-
}
|
|
1404
|
-
if (!curNode.methods.length) curNode.methods = [];
|
|
1405
|
-
const m = /* @__PURE__ */ Object.create(null);
|
|
1406
|
-
m[method] = {
|
|
1407
|
-
handler,
|
|
1408
|
-
possibleKeys: possibleKeys.filter((v, i, a) => a.indexOf(v) === i),
|
|
1409
|
-
name: this.name,
|
|
1410
|
-
score: this.order
|
|
1411
|
-
};
|
|
1412
|
-
curNode.methods.push(m);
|
|
1413
|
-
return curNode;
|
|
1414
|
-
}
|
|
1415
|
-
gHSets(node, method, nodeParams, params) {
|
|
1416
|
-
const handlerSets = [];
|
|
1417
|
-
for (let i = 0, len = node.methods.length; i < len; i++) {
|
|
1418
|
-
const m = node.methods[i];
|
|
1419
|
-
const handlerSet = m[method] || m[METHOD_NAME_ALL];
|
|
1420
|
-
const processedSet = /* @__PURE__ */ Object.create(null);
|
|
1421
|
-
if (handlerSet !== void 0) {
|
|
1422
|
-
handlerSet.params = /* @__PURE__ */ Object.create(null);
|
|
1423
|
-
handlerSet.possibleKeys.forEach((key) => {
|
|
1424
|
-
const processed = processedSet[handlerSet.name];
|
|
1425
|
-
handlerSet.params[key] = params[key] && !processed ? params[key] : nodeParams[key] ?? params[key];
|
|
1426
|
-
processedSet[handlerSet.name] = true;
|
|
1427
|
-
});
|
|
1428
|
-
handlerSets.push(handlerSet);
|
|
1429
|
-
}
|
|
1430
|
-
}
|
|
1431
|
-
return handlerSets;
|
|
1432
|
-
}
|
|
1433
|
-
search(method, path$2) {
|
|
1434
|
-
const handlerSets = [];
|
|
1435
|
-
this.params = /* @__PURE__ */ Object.create(null);
|
|
1436
|
-
let curNodes = [this];
|
|
1437
|
-
const parts = splitPath(path$2);
|
|
1438
|
-
for (let i = 0, len = parts.length; i < len; i++) {
|
|
1439
|
-
const part = parts[i];
|
|
1440
|
-
const isLast = i === len - 1;
|
|
1441
|
-
const tempNodes = [];
|
|
1442
|
-
for (let j = 0, len2 = curNodes.length; j < len2; j++) {
|
|
1443
|
-
const node = curNodes[j];
|
|
1444
|
-
const nextNode = node.children[part];
|
|
1445
|
-
if (nextNode) {
|
|
1446
|
-
nextNode.params = node.params;
|
|
1447
|
-
if (isLast === true) {
|
|
1448
|
-
if (nextNode.children["*"]) handlerSets.push(...this.gHSets(nextNode.children["*"], method, node.params, /* @__PURE__ */ Object.create(null)));
|
|
1449
|
-
handlerSets.push(...this.gHSets(nextNode, method, node.params, /* @__PURE__ */ Object.create(null)));
|
|
1450
|
-
} else tempNodes.push(nextNode);
|
|
1451
|
-
}
|
|
1452
|
-
for (let k = 0, len3 = node.patterns.length; k < len3; k++) {
|
|
1453
|
-
const pattern = node.patterns[k];
|
|
1454
|
-
const params = { ...node.params };
|
|
1455
|
-
if (pattern === "*") {
|
|
1456
|
-
const astNode = node.children["*"];
|
|
1457
|
-
if (astNode) {
|
|
1458
|
-
handlerSets.push(...this.gHSets(astNode, method, node.params, /* @__PURE__ */ Object.create(null)));
|
|
1459
|
-
tempNodes.push(astNode);
|
|
1460
|
-
}
|
|
1461
|
-
continue;
|
|
1462
|
-
}
|
|
1463
|
-
if (part === "") continue;
|
|
1464
|
-
const [key, name, matcher] = pattern;
|
|
1465
|
-
const child = node.children[key];
|
|
1466
|
-
const restPathString = parts.slice(i).join("/");
|
|
1467
|
-
if (matcher instanceof RegExp && matcher.test(restPathString)) {
|
|
1468
|
-
params[name] = restPathString;
|
|
1469
|
-
handlerSets.push(...this.gHSets(child, method, node.params, params));
|
|
1470
|
-
continue;
|
|
1471
|
-
}
|
|
1472
|
-
if (matcher === true || matcher instanceof RegExp && matcher.test(part)) {
|
|
1473
|
-
if (typeof key === "string") {
|
|
1474
|
-
params[name] = part;
|
|
1475
|
-
if (isLast === true) {
|
|
1476
|
-
handlerSets.push(...this.gHSets(child, method, params, node.params));
|
|
1477
|
-
if (child.children["*"]) handlerSets.push(...this.gHSets(child.children["*"], method, params, node.params));
|
|
1478
|
-
} else {
|
|
1479
|
-
child.params = params;
|
|
1480
|
-
tempNodes.push(child);
|
|
1481
|
-
}
|
|
1482
|
-
}
|
|
1483
|
-
}
|
|
1484
|
-
}
|
|
1485
|
-
}
|
|
1486
|
-
curNodes = tempNodes;
|
|
1487
|
-
}
|
|
1488
|
-
return [handlerSets.sort((a, b) => {
|
|
1489
|
-
return a.score - b.score;
|
|
1490
|
-
}).map(({ handler, params }) => [handler, params])];
|
|
1491
|
-
}
|
|
1492
|
-
};
|
|
1493
|
-
|
|
1494
|
-
//#endregion
|
|
1495
|
-
//#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/router/trie-router/router.js
|
|
1496
|
-
var TrieRouter = class {
|
|
1497
|
-
name = "TrieRouter";
|
|
1498
|
-
node;
|
|
1499
|
-
constructor() {
|
|
1500
|
-
this.node = new Node();
|
|
1501
|
-
}
|
|
1502
|
-
add(method, path$2, handler) {
|
|
1503
|
-
const results = checkOptionalParameter(path$2);
|
|
1504
|
-
if (results) {
|
|
1505
|
-
for (const p of results) this.node.insert(method, p, handler);
|
|
1506
|
-
return;
|
|
1507
|
-
}
|
|
1508
|
-
this.node.insert(method, path$2, handler);
|
|
1509
|
-
}
|
|
1510
|
-
match(method, path$2) {
|
|
1511
|
-
return this.node.search(method, path$2);
|
|
1512
|
-
}
|
|
1513
|
-
};
|
|
1514
|
-
|
|
1515
|
-
//#endregion
|
|
1516
|
-
//#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/hono.js
|
|
1517
|
-
var Hono = class extends Hono$1 {
|
|
1518
|
-
constructor(options = {}) {
|
|
1519
|
-
super(options);
|
|
1520
|
-
this.router = options.router ?? new SmartRouter({ routers: [new RegExpRouter(), new TrieRouter()] });
|
|
1521
|
-
}
|
|
1522
|
-
};
|
|
1523
|
-
|
|
1524
|
-
//#endregion
|
|
1525
|
-
//#region ../../node_modules/.pnpm/typia@8.0.3_@samchon+openapi@3.1.0_typescript@5.8.3/node_modules/typia/lib/internal/_validateReport.js
|
|
1526
|
-
var require__validateReport = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/typia@8.0.3_@samchon+openapi@3.1.0_typescript@5.8.3/node_modules/typia/lib/internal/_validateReport.js": ((exports) => {
|
|
1527
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1528
|
-
const _validateReport = (array) => {
|
|
1529
|
-
const reportable = (path$2) => {
|
|
1530
|
-
if (array.length === 0) return true;
|
|
1531
|
-
const last = array[array.length - 1].path;
|
|
1532
|
-
return path$2.length > last.length || last.substring(0, path$2.length) !== path$2;
|
|
1533
|
-
};
|
|
1534
|
-
return (exceptable, error) => {
|
|
1535
|
-
if (exceptable && reportable(error.path)) array.push(error);
|
|
1536
|
-
return false;
|
|
1537
|
-
};
|
|
1538
|
-
};
|
|
1539
|
-
exports._validateReport = _validateReport;
|
|
1540
|
-
}) });
|
|
1541
|
-
|
|
1542
|
-
//#endregion
|
|
1543
|
-
//#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/utils/cookie.js
|
|
1544
|
-
var validCookieNameRegEx = /^[\w!#$%&'*.^`|~+-]+$/;
|
|
1545
|
-
var validCookieValueRegEx = /^[ !#-:<-[\]-~]*$/;
|
|
1546
|
-
var parse = (cookie, name) => {
|
|
1547
|
-
return cookie.trim().split(";").reduce((parsedCookie, pairStr) => {
|
|
1548
|
-
pairStr = pairStr.trim();
|
|
1549
|
-
const valueStartPos = pairStr.indexOf("=");
|
|
1550
|
-
if (valueStartPos === -1) return parsedCookie;
|
|
1551
|
-
const cookieName = pairStr.substring(0, valueStartPos).trim();
|
|
1552
|
-
if (name && name !== cookieName || !validCookieNameRegEx.test(cookieName)) return parsedCookie;
|
|
1553
|
-
let cookieValue = pairStr.substring(valueStartPos + 1).trim();
|
|
1554
|
-
if (cookieValue.startsWith("\"") && cookieValue.endsWith("\"")) cookieValue = cookieValue.slice(1, -1);
|
|
1555
|
-
if (validCookieValueRegEx.test(cookieValue)) parsedCookie[cookieName] = decodeURIComponent_(cookieValue);
|
|
1556
|
-
return parsedCookie;
|
|
1557
|
-
}, {});
|
|
1558
|
-
};
|
|
1559
|
-
|
|
1560
|
-
//#endregion
|
|
1561
|
-
//#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/helper/cookie/index.js
|
|
1562
|
-
var getCookie = (c, key, prefix) => {
|
|
1563
|
-
const cookie = c.req.raw.headers.get("Cookie");
|
|
1564
|
-
if (typeof key === "string") {
|
|
1565
|
-
if (!cookie) return;
|
|
1566
|
-
let finalKey = key;
|
|
1567
|
-
if (prefix === "secure") finalKey = "__Secure-" + key;
|
|
1568
|
-
else if (prefix === "host") finalKey = "__Host-" + key;
|
|
1569
|
-
return parse(cookie, finalKey)[finalKey];
|
|
1570
|
-
}
|
|
1571
|
-
if (!cookie) return {};
|
|
1572
|
-
return parse(cookie);
|
|
1573
|
-
};
|
|
1574
|
-
|
|
1575
|
-
//#endregion
|
|
1576
|
-
//#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/http-exception.js
|
|
1577
|
-
var HTTPException = class extends Error {
|
|
1578
|
-
res;
|
|
1579
|
-
status;
|
|
1580
|
-
constructor(status = 500, options) {
|
|
1581
|
-
super(options?.message, { cause: options?.cause });
|
|
1582
|
-
this.res = options?.res;
|
|
1583
|
-
this.status = status;
|
|
1584
|
-
}
|
|
1585
|
-
getResponse() {
|
|
1586
|
-
if (this.res) return new Response(this.res.body, {
|
|
1587
|
-
status: this.status,
|
|
1588
|
-
headers: this.res.headers
|
|
1589
|
-
});
|
|
1590
|
-
return new Response(this.message, { status: this.status });
|
|
1591
|
-
}
|
|
1592
|
-
};
|
|
1593
|
-
|
|
1594
|
-
//#endregion
|
|
1595
|
-
//#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/utils/buffer.js
|
|
1596
|
-
var bufferToFormData = (arrayBuffer, contentType) => {
|
|
1597
|
-
return new Response(arrayBuffer, { headers: { "Content-Type": contentType } }).formData();
|
|
1598
|
-
};
|
|
1599
|
-
|
|
1600
|
-
//#endregion
|
|
1601
|
-
//#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/validator/validator.js
|
|
1602
|
-
var jsonRegex = /^application\/([a-z-\.]+\+)?json(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/;
|
|
1603
|
-
var multipartRegex = /^multipart\/form-data(;\s?boundary=[a-zA-Z0-9'"()+_,\-./:=?]+)?$/;
|
|
1604
|
-
var urlencodedRegex = /^application\/x-www-form-urlencoded(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/;
|
|
1605
|
-
var validator = (target, validationFunc) => {
|
|
1606
|
-
return async (c, next) => {
|
|
1607
|
-
let value = {};
|
|
1608
|
-
const contentType = c.req.header("Content-Type");
|
|
1609
|
-
switch (target) {
|
|
1610
|
-
case "json":
|
|
1611
|
-
if (!contentType || !jsonRegex.test(contentType)) break;
|
|
1612
|
-
try {
|
|
1613
|
-
value = await c.req.json();
|
|
1614
|
-
} catch {
|
|
1615
|
-
throw new HTTPException(400, { message: "Malformed JSON in request body" });
|
|
1616
|
-
}
|
|
1617
|
-
break;
|
|
1618
|
-
case "form": {
|
|
1619
|
-
if (!contentType || !(multipartRegex.test(contentType) || urlencodedRegex.test(contentType))) break;
|
|
1620
|
-
let formData;
|
|
1621
|
-
if (c.req.bodyCache.formData) formData = await c.req.bodyCache.formData;
|
|
1622
|
-
else try {
|
|
1623
|
-
formData = await bufferToFormData(await c.req.arrayBuffer(), contentType);
|
|
1624
|
-
c.req.bodyCache.formData = formData;
|
|
1625
|
-
} catch (e) {
|
|
1626
|
-
let message = "Malformed FormData request.";
|
|
1627
|
-
message += e instanceof Error ? ` ${e.message}` : ` ${String(e)}`;
|
|
1628
|
-
throw new HTTPException(400, { message });
|
|
1629
|
-
}
|
|
1630
|
-
const form = {};
|
|
1631
|
-
formData.forEach((value2, key) => {
|
|
1632
|
-
if (key.endsWith("[]")) (form[key] ??= []).push(value2);
|
|
1633
|
-
else if (Array.isArray(form[key])) form[key].push(value2);
|
|
1634
|
-
else if (key in form) form[key] = [form[key], value2];
|
|
1635
|
-
else form[key] = value2;
|
|
1636
|
-
});
|
|
1637
|
-
value = form;
|
|
1638
|
-
break;
|
|
1639
|
-
}
|
|
1640
|
-
case "query":
|
|
1641
|
-
value = Object.fromEntries(Object.entries(c.req.queries()).map(([k, v]) => {
|
|
1642
|
-
return v.length === 1 ? [k, v[0]] : [k, v];
|
|
1643
|
-
}));
|
|
1644
|
-
break;
|
|
1645
|
-
case "param":
|
|
1646
|
-
value = c.req.param();
|
|
1647
|
-
break;
|
|
1648
|
-
case "header":
|
|
1649
|
-
value = c.req.header();
|
|
1650
|
-
break;
|
|
1651
|
-
case "cookie":
|
|
1652
|
-
value = getCookie(c);
|
|
1653
|
-
break;
|
|
1654
|
-
}
|
|
1655
|
-
const res = await validationFunc(value, c);
|
|
1656
|
-
if (res instanceof Response) return res;
|
|
1657
|
-
c.req.addValidatedData(target, res);
|
|
1658
|
-
await next();
|
|
1659
|
-
};
|
|
1660
|
-
};
|
|
1661
|
-
|
|
1662
|
-
//#endregion
|
|
1663
|
-
//#region ../../node_modules/.pnpm/@hono+typia-validator@0.1.2_hono@4.6.3_typia@8.0.3_@samchon+openapi@3.1.0_typescript@5.8.3_/node_modules/@hono/typia-validator/dist/esm/index.js
|
|
1664
|
-
var import__validateReport = /* @__PURE__ */ __toESM(require__validateReport(), 1);
|
|
1665
|
-
const typiaValidator = (target, validate, hook) => validator(target, async (value, c) => {
|
|
1666
|
-
const result = validate(value);
|
|
1667
|
-
if (hook) {
|
|
1668
|
-
const hookResult = await hook({
|
|
1669
|
-
...result,
|
|
1670
|
-
data: value
|
|
1671
|
-
}, c);
|
|
1672
|
-
if (hookResult) {
|
|
1673
|
-
if (hookResult instanceof Response || hookResult instanceof Promise) return hookResult;
|
|
1674
|
-
if ("response" in hookResult) return hookResult.response;
|
|
1675
|
-
}
|
|
1676
|
-
}
|
|
1677
|
-
if (!result.success) return c.json({
|
|
1678
|
-
success: false,
|
|
1679
|
-
error: result.errors
|
|
1680
|
-
}, 400);
|
|
1681
|
-
return result.data;
|
|
1682
|
-
});
|
|
1683
|
-
|
|
1684
|
-
//#endregion
|
|
1685
|
-
//#region src-server/rpc.ts
|
|
1686
|
-
const DEFAULT_PAGE_LIMIT = 20;
|
|
1687
|
-
const DEFAULT_PAGE_OFFSET = 0;
|
|
1688
|
-
const queryBundlesSchema = (() => {
|
|
1689
|
-
const _io0 = (input) => (void 0 === input.channel || "string" === typeof input.channel) && (void 0 === input.platform || "ios" === input.platform || "android" === input.platform) && (void 0 === input.limit || "string" === typeof input.limit) && (void 0 === input.offset || "string" === typeof input.offset);
|
|
1690
|
-
const _vo0 = (input, _path, _exceptionable = true) => [
|
|
1691
|
-
void 0 === input.channel || "string" === typeof input.channel || _report(_exceptionable, {
|
|
1692
|
-
path: _path + ".channel",
|
|
1693
|
-
expected: "(string | undefined)",
|
|
1694
|
-
value: input.channel
|
|
1695
|
-
}),
|
|
1696
|
-
void 0 === input.platform || "ios" === input.platform || "android" === input.platform || _report(_exceptionable, {
|
|
1697
|
-
path: _path + ".platform",
|
|
1698
|
-
expected: "(\"android\" | \"ios\" | undefined)",
|
|
1699
|
-
value: input.platform
|
|
1700
|
-
}),
|
|
1701
|
-
void 0 === input.limit || "string" === typeof input.limit || _report(_exceptionable, {
|
|
1702
|
-
path: _path + ".limit",
|
|
1703
|
-
expected: "(string | undefined)",
|
|
1704
|
-
value: input.limit
|
|
1705
|
-
}),
|
|
1706
|
-
void 0 === input.offset || "string" === typeof input.offset || _report(_exceptionable, {
|
|
1707
|
-
path: _path + ".offset",
|
|
1708
|
-
expected: "(string | undefined)",
|
|
1709
|
-
value: input.offset
|
|
1710
|
-
})
|
|
1711
|
-
].every((flag) => flag);
|
|
1712
|
-
const __is = (input) => "object" === typeof input && null !== input && false === Array.isArray(input) && _io0(input);
|
|
1713
|
-
let errors;
|
|
1714
|
-
let _report;
|
|
1715
|
-
return (input) => {
|
|
1716
|
-
if (false === __is(input)) {
|
|
1717
|
-
errors = [];
|
|
1718
|
-
_report = import__validateReport._validateReport(errors);
|
|
1719
|
-
((input$1, _path, _exceptionable = true) => ("object" === typeof input$1 && null !== input$1 && false === Array.isArray(input$1) || _report(true, {
|
|
1720
|
-
path: _path + "",
|
|
1721
|
-
expected: "__type",
|
|
1722
|
-
value: input$1
|
|
1723
|
-
})) && _vo0(input$1, _path + "", true) || _report(true, {
|
|
1724
|
-
path: _path + "",
|
|
1725
|
-
expected: "__type",
|
|
1726
|
-
value: input$1
|
|
1727
|
-
}))(input, "$input", true);
|
|
1728
|
-
const success = 0 === errors.length;
|
|
1729
|
-
return success ? {
|
|
1730
|
-
success,
|
|
1731
|
-
data: input
|
|
1732
|
-
} : {
|
|
1733
|
-
success,
|
|
1734
|
-
errors,
|
|
1735
|
-
data: input
|
|
1736
|
-
};
|
|
1737
|
-
}
|
|
1738
|
-
return {
|
|
1739
|
-
success: true,
|
|
1740
|
-
data: input
|
|
1741
|
-
};
|
|
1742
|
-
};
|
|
1743
|
-
})();
|
|
1744
|
-
const paramBundleIdSchema = (() => {
|
|
1745
|
-
const _io0 = (input) => "string" === typeof input.bundleId;
|
|
1746
|
-
const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.bundleId || _report(_exceptionable, {
|
|
1747
|
-
path: _path + ".bundleId",
|
|
1748
|
-
expected: "string",
|
|
1749
|
-
value: input.bundleId
|
|
1750
|
-
})].every((flag) => flag);
|
|
1751
|
-
const __is = (input) => "object" === typeof input && null !== input && _io0(input);
|
|
1752
|
-
let errors;
|
|
1753
|
-
let _report;
|
|
1754
|
-
return (input) => {
|
|
1755
|
-
if (false === __is(input)) {
|
|
1756
|
-
errors = [];
|
|
1757
|
-
_report = import__validateReport._validateReport(errors);
|
|
1758
|
-
((input$1, _path, _exceptionable = true) => ("object" === typeof input$1 && null !== input$1 || _report(true, {
|
|
1759
|
-
path: _path + "",
|
|
1760
|
-
expected: "__type",
|
|
1761
|
-
value: input$1
|
|
1762
|
-
})) && _vo0(input$1, _path + "", true) || _report(true, {
|
|
1763
|
-
path: _path + "",
|
|
1764
|
-
expected: "__type",
|
|
1765
|
-
value: input$1
|
|
1766
|
-
}))(input, "$input", true);
|
|
1767
|
-
const success = 0 === errors.length;
|
|
1768
|
-
return success ? {
|
|
1769
|
-
success,
|
|
1770
|
-
data: input
|
|
1771
|
-
} : {
|
|
1772
|
-
success,
|
|
1773
|
-
errors,
|
|
1774
|
-
data: input
|
|
1775
|
-
};
|
|
1776
|
-
}
|
|
1777
|
-
return {
|
|
1778
|
-
success: true,
|
|
1779
|
-
data: input
|
|
1780
|
-
};
|
|
1781
|
-
};
|
|
1782
|
-
})();
|
|
1783
|
-
const updateBundleSchema = (() => {
|
|
1784
|
-
const _io0 = (input) => (void 0 === input.id || "string" === typeof input.id) && (void 0 === input.platform || "ios" === input.platform || "android" === input.platform) && (void 0 === input.shouldForceUpdate || "boolean" === typeof input.shouldForceUpdate) && (void 0 === input.enabled || "boolean" === typeof input.enabled) && (void 0 === input.fileHash || "string" === typeof input.fileHash) && (void 0 === input.storageUri || "string" === typeof input.storageUri) && (null === input.gitCommitHash || void 0 === input.gitCommitHash || "string" === typeof input.gitCommitHash) && (null === input.message || void 0 === input.message || "string" === typeof input.message) && (void 0 === input.channel || "string" === typeof input.channel) && (null === input.targetAppVersion || void 0 === input.targetAppVersion || "string" === typeof input.targetAppVersion) && (null === input.fingerprintHash || void 0 === input.fingerprintHash || "string" === typeof input.fingerprintHash) && (void 0 === input.metadata || "object" === typeof input.metadata && null !== input.metadata && false === Array.isArray(input.metadata) && _io1(input.metadata));
|
|
1785
|
-
const _io1 = (input) => void 0 === input.app_version || "string" === typeof input.app_version;
|
|
1786
|
-
const _vo0 = (input, _path, _exceptionable = true) => [
|
|
1787
|
-
void 0 === input.id || "string" === typeof input.id || _report(_exceptionable, {
|
|
1788
|
-
path: _path + ".id",
|
|
1789
|
-
expected: "(string | undefined)",
|
|
1790
|
-
value: input.id
|
|
1791
|
-
}),
|
|
1792
|
-
void 0 === input.platform || "ios" === input.platform || "android" === input.platform || _report(_exceptionable, {
|
|
1793
|
-
path: _path + ".platform",
|
|
1794
|
-
expected: "(\"android\" | \"ios\" | undefined)",
|
|
1795
|
-
value: input.platform
|
|
1796
|
-
}),
|
|
1797
|
-
void 0 === input.shouldForceUpdate || "boolean" === typeof input.shouldForceUpdate || _report(_exceptionable, {
|
|
1798
|
-
path: _path + ".shouldForceUpdate",
|
|
1799
|
-
expected: "(boolean | undefined)",
|
|
1800
|
-
value: input.shouldForceUpdate
|
|
1801
|
-
}),
|
|
1802
|
-
void 0 === input.enabled || "boolean" === typeof input.enabled || _report(_exceptionable, {
|
|
1803
|
-
path: _path + ".enabled",
|
|
1804
|
-
expected: "(boolean | undefined)",
|
|
1805
|
-
value: input.enabled
|
|
1806
|
-
}),
|
|
1807
|
-
void 0 === input.fileHash || "string" === typeof input.fileHash || _report(_exceptionable, {
|
|
1808
|
-
path: _path + ".fileHash",
|
|
1809
|
-
expected: "(string | undefined)",
|
|
1810
|
-
value: input.fileHash
|
|
1811
|
-
}),
|
|
1812
|
-
void 0 === input.storageUri || "string" === typeof input.storageUri || _report(_exceptionable, {
|
|
1813
|
-
path: _path + ".storageUri",
|
|
1814
|
-
expected: "(string | undefined)",
|
|
1815
|
-
value: input.storageUri
|
|
1816
|
-
}),
|
|
1817
|
-
null === input.gitCommitHash || void 0 === input.gitCommitHash || "string" === typeof input.gitCommitHash || _report(_exceptionable, {
|
|
1818
|
-
path: _path + ".gitCommitHash",
|
|
1819
|
-
expected: "(null | string | undefined)",
|
|
1820
|
-
value: input.gitCommitHash
|
|
1821
|
-
}),
|
|
1822
|
-
null === input.message || void 0 === input.message || "string" === typeof input.message || _report(_exceptionable, {
|
|
1823
|
-
path: _path + ".message",
|
|
1824
|
-
expected: "(null | string | undefined)",
|
|
1825
|
-
value: input.message
|
|
1826
|
-
}),
|
|
1827
|
-
void 0 === input.channel || "string" === typeof input.channel || _report(_exceptionable, {
|
|
1828
|
-
path: _path + ".channel",
|
|
1829
|
-
expected: "(string | undefined)",
|
|
1830
|
-
value: input.channel
|
|
1831
|
-
}),
|
|
1832
|
-
null === input.targetAppVersion || void 0 === input.targetAppVersion || "string" === typeof input.targetAppVersion || _report(_exceptionable, {
|
|
1833
|
-
path: _path + ".targetAppVersion",
|
|
1834
|
-
expected: "(null | string | undefined)",
|
|
1835
|
-
value: input.targetAppVersion
|
|
1836
|
-
}),
|
|
1837
|
-
null === input.fingerprintHash || void 0 === input.fingerprintHash || "string" === typeof input.fingerprintHash || _report(_exceptionable, {
|
|
1838
|
-
path: _path + ".fingerprintHash",
|
|
1839
|
-
expected: "(null | string | undefined)",
|
|
1840
|
-
value: input.fingerprintHash
|
|
1841
|
-
}),
|
|
1842
|
-
void 0 === input.metadata || ("object" === typeof input.metadata && null !== input.metadata && false === Array.isArray(input.metadata) || _report(_exceptionable, {
|
|
1843
|
-
path: _path + ".metadata",
|
|
1844
|
-
expected: "(BundleMetadata | undefined)",
|
|
1845
|
-
value: input.metadata
|
|
1846
|
-
})) && _vo1(input.metadata, _path + ".metadata", _exceptionable) || _report(_exceptionable, {
|
|
1847
|
-
path: _path + ".metadata",
|
|
1848
|
-
expected: "(BundleMetadata | undefined)",
|
|
1849
|
-
value: input.metadata
|
|
1850
|
-
})
|
|
1851
|
-
].every((flag) => flag);
|
|
1852
|
-
const _vo1 = (input, _path, _exceptionable = true) => [void 0 === input.app_version || "string" === typeof input.app_version || _report(_exceptionable, {
|
|
1853
|
-
path: _path + ".app_version",
|
|
1854
|
-
expected: "(string | undefined)",
|
|
1855
|
-
value: input.app_version
|
|
1856
|
-
})].every((flag) => flag);
|
|
1857
|
-
const __is = (input) => "object" === typeof input && null !== input && false === Array.isArray(input) && _io0(input);
|
|
1858
|
-
let errors;
|
|
1859
|
-
let _report;
|
|
1860
|
-
return (input) => {
|
|
1861
|
-
if (false === __is(input)) {
|
|
1862
|
-
errors = [];
|
|
1863
|
-
_report = import__validateReport._validateReport(errors);
|
|
1864
|
-
((input$1, _path, _exceptionable = true) => ("object" === typeof input$1 && null !== input$1 && false === Array.isArray(input$1) || _report(true, {
|
|
1865
|
-
path: _path + "",
|
|
1866
|
-
expected: "Partial<Bundle>",
|
|
1867
|
-
value: input$1
|
|
1868
|
-
})) && _vo0(input$1, _path + "", true) || _report(true, {
|
|
1869
|
-
path: _path + "",
|
|
1870
|
-
expected: "Partial<Bundle>",
|
|
1871
|
-
value: input$1
|
|
1872
|
-
}))(input, "$input", true);
|
|
1873
|
-
const success = 0 === errors.length;
|
|
1874
|
-
return success ? {
|
|
1875
|
-
success,
|
|
1876
|
-
data: input
|
|
1877
|
-
} : {
|
|
1878
|
-
success,
|
|
1879
|
-
errors,
|
|
1880
|
-
data: input
|
|
1881
|
-
};
|
|
1882
|
-
}
|
|
1883
|
-
return {
|
|
1884
|
-
success: true,
|
|
1885
|
-
data: input
|
|
1886
|
-
};
|
|
1887
|
-
};
|
|
1888
|
-
})();
|
|
1889
|
-
const createBundleSchema = (() => {
|
|
1890
|
-
const _io0 = (input) => "string" === typeof input.id && ("ios" === input.platform || "android" === input.platform) && "boolean" === typeof input.shouldForceUpdate && "boolean" === typeof input.enabled && "string" === typeof input.fileHash && "string" === typeof input.storageUri && (null === input.gitCommitHash || "string" === typeof input.gitCommitHash) && (null === input.message || "string" === typeof input.message) && "string" === typeof input.channel && (null === input.targetAppVersion || "string" === typeof input.targetAppVersion) && (null === input.fingerprintHash || "string" === typeof input.fingerprintHash) && (void 0 === input.metadata || "object" === typeof input.metadata && null !== input.metadata && false === Array.isArray(input.metadata) && _io1(input.metadata));
|
|
1891
|
-
const _io1 = (input) => void 0 === input.app_version || "string" === typeof input.app_version;
|
|
1892
|
-
const _vo0 = (input, _path, _exceptionable = true) => [
|
|
1893
|
-
"string" === typeof input.id || _report(_exceptionable, {
|
|
1894
|
-
path: _path + ".id",
|
|
1895
|
-
expected: "string",
|
|
1896
|
-
value: input.id
|
|
1897
|
-
}),
|
|
1898
|
-
"ios" === input.platform || "android" === input.platform || _report(_exceptionable, {
|
|
1899
|
-
path: _path + ".platform",
|
|
1900
|
-
expected: "(\"android\" | \"ios\")",
|
|
1901
|
-
value: input.platform
|
|
1902
|
-
}),
|
|
1903
|
-
"boolean" === typeof input.shouldForceUpdate || _report(_exceptionable, {
|
|
1904
|
-
path: _path + ".shouldForceUpdate",
|
|
1905
|
-
expected: "boolean",
|
|
1906
|
-
value: input.shouldForceUpdate
|
|
1907
|
-
}),
|
|
1908
|
-
"boolean" === typeof input.enabled || _report(_exceptionable, {
|
|
1909
|
-
path: _path + ".enabled",
|
|
1910
|
-
expected: "boolean",
|
|
1911
|
-
value: input.enabled
|
|
1912
|
-
}),
|
|
1913
|
-
"string" === typeof input.fileHash || _report(_exceptionable, {
|
|
1914
|
-
path: _path + ".fileHash",
|
|
1915
|
-
expected: "string",
|
|
1916
|
-
value: input.fileHash
|
|
1917
|
-
}),
|
|
1918
|
-
"string" === typeof input.storageUri || _report(_exceptionable, {
|
|
1919
|
-
path: _path + ".storageUri",
|
|
1920
|
-
expected: "string",
|
|
1921
|
-
value: input.storageUri
|
|
1922
|
-
}),
|
|
1923
|
-
null === input.gitCommitHash || "string" === typeof input.gitCommitHash || _report(_exceptionable, {
|
|
1924
|
-
path: _path + ".gitCommitHash",
|
|
1925
|
-
expected: "(null | string)",
|
|
1926
|
-
value: input.gitCommitHash
|
|
1927
|
-
}),
|
|
1928
|
-
null === input.message || "string" === typeof input.message || _report(_exceptionable, {
|
|
1929
|
-
path: _path + ".message",
|
|
1930
|
-
expected: "(null | string)",
|
|
1931
|
-
value: input.message
|
|
1932
|
-
}),
|
|
1933
|
-
"string" === typeof input.channel || _report(_exceptionable, {
|
|
1934
|
-
path: _path + ".channel",
|
|
1935
|
-
expected: "string",
|
|
1936
|
-
value: input.channel
|
|
1937
|
-
}),
|
|
1938
|
-
null === input.targetAppVersion || "string" === typeof input.targetAppVersion || _report(_exceptionable, {
|
|
1939
|
-
path: _path + ".targetAppVersion",
|
|
1940
|
-
expected: "(null | string)",
|
|
1941
|
-
value: input.targetAppVersion
|
|
1942
|
-
}),
|
|
1943
|
-
null === input.fingerprintHash || "string" === typeof input.fingerprintHash || _report(_exceptionable, {
|
|
1944
|
-
path: _path + ".fingerprintHash",
|
|
1945
|
-
expected: "(null | string)",
|
|
1946
|
-
value: input.fingerprintHash
|
|
1947
|
-
}),
|
|
1948
|
-
void 0 === input.metadata || ("object" === typeof input.metadata && null !== input.metadata && false === Array.isArray(input.metadata) || _report(_exceptionable, {
|
|
1949
|
-
path: _path + ".metadata",
|
|
1950
|
-
expected: "(BundleMetadata | undefined)",
|
|
1951
|
-
value: input.metadata
|
|
1952
|
-
})) && _vo1(input.metadata, _path + ".metadata", _exceptionable) || _report(_exceptionable, {
|
|
1953
|
-
path: _path + ".metadata",
|
|
1954
|
-
expected: "(BundleMetadata | undefined)",
|
|
1955
|
-
value: input.metadata
|
|
1956
|
-
})
|
|
1957
|
-
].every((flag) => flag);
|
|
1958
|
-
const _vo1 = (input, _path, _exceptionable = true) => [void 0 === input.app_version || "string" === typeof input.app_version || _report(_exceptionable, {
|
|
1959
|
-
path: _path + ".app_version",
|
|
1960
|
-
expected: "(string | undefined)",
|
|
1961
|
-
value: input.app_version
|
|
1962
|
-
})].every((flag) => flag);
|
|
1963
|
-
const __is = (input) => "object" === typeof input && null !== input && _io0(input);
|
|
1964
|
-
let errors;
|
|
1965
|
-
let _report;
|
|
1966
|
-
return (input) => {
|
|
1967
|
-
if (false === __is(input)) {
|
|
1968
|
-
errors = [];
|
|
1969
|
-
_report = import__validateReport._validateReport(errors);
|
|
1970
|
-
((input$1, _path, _exceptionable = true) => ("object" === typeof input$1 && null !== input$1 || _report(true, {
|
|
1971
|
-
path: _path + "",
|
|
1972
|
-
expected: "Bundle",
|
|
1973
|
-
value: input$1
|
|
1974
|
-
})) && _vo0(input$1, _path + "", true) || _report(true, {
|
|
1975
|
-
path: _path + "",
|
|
1976
|
-
expected: "Bundle",
|
|
1977
|
-
value: input$1
|
|
1978
|
-
}))(input, "$input", true);
|
|
1979
|
-
const success = 0 === errors.length;
|
|
1980
|
-
return success ? {
|
|
1981
|
-
success,
|
|
1982
|
-
data: input
|
|
1983
|
-
} : {
|
|
1984
|
-
success,
|
|
1985
|
-
errors,
|
|
1986
|
-
data: input
|
|
1987
|
-
};
|
|
1988
|
-
}
|
|
1989
|
-
return {
|
|
1990
|
-
success: true,
|
|
1991
|
-
data: input
|
|
1992
|
-
};
|
|
1993
|
-
};
|
|
1994
|
-
})();
|
|
1995
|
-
let configPromise = null;
|
|
1996
|
-
const prepareConfig = async () => {
|
|
1997
|
-
if (!configPromise) configPromise = (async () => {
|
|
1998
|
-
try {
|
|
1999
|
-
const config = await (0, __hot_updater_cli_tools.loadConfig)(null);
|
|
2000
|
-
const databasePlugin = await config?.database() ?? null;
|
|
2001
|
-
const storagePlugin = await config?.storage() ?? null;
|
|
2002
|
-
if (!databasePlugin) throw new Error("Database plugin initialization failed");
|
|
2003
|
-
return {
|
|
2004
|
-
config,
|
|
2005
|
-
databasePlugin,
|
|
2006
|
-
storagePlugin
|
|
2007
|
-
};
|
|
2008
|
-
} catch (error) {
|
|
2009
|
-
console.error("Error during configuration initialization:", error);
|
|
2010
|
-
throw error;
|
|
2011
|
-
}
|
|
2012
|
-
})();
|
|
2013
|
-
return configPromise;
|
|
2014
|
-
};
|
|
2015
|
-
const rpc = new Hono().get("/config", async (c) => {
|
|
2016
|
-
try {
|
|
2017
|
-
const { config } = await prepareConfig();
|
|
2018
|
-
return c.json({ console: config.console });
|
|
2019
|
-
} catch (error) {
|
|
2020
|
-
console.error("Error during config retrieval:", error);
|
|
2021
|
-
throw error;
|
|
2022
|
-
}
|
|
2023
|
-
}).get("/channels", async (c) => {
|
|
2024
|
-
try {
|
|
2025
|
-
const { databasePlugin } = await prepareConfig();
|
|
2026
|
-
const channels = await databasePlugin.getChannels();
|
|
2027
|
-
return c.json(channels ?? []);
|
|
2028
|
-
} catch (error) {
|
|
2029
|
-
console.error("Error during channel retrieval:", error);
|
|
2030
|
-
throw error;
|
|
2031
|
-
}
|
|
2032
|
-
}).get("/config-loaded", (c) => {
|
|
2033
|
-
try {
|
|
2034
|
-
const isLoaded = !!configPromise;
|
|
2035
|
-
return c.json({ configLoaded: isLoaded });
|
|
2036
|
-
} catch (error) {
|
|
2037
|
-
console.error("Error during config loaded retrieval:", error);
|
|
2038
|
-
throw error;
|
|
2039
|
-
}
|
|
2040
|
-
}).get("/bundles", typiaValidator("query", queryBundlesSchema), async (c) => {
|
|
2041
|
-
try {
|
|
2042
|
-
const rawQuery = c.req.valid("query");
|
|
2043
|
-
const query = {
|
|
2044
|
-
channel: rawQuery.channel ?? void 0,
|
|
2045
|
-
platform: rawQuery.platform ?? void 0,
|
|
2046
|
-
limit: rawQuery.limit ?? DEFAULT_PAGE_LIMIT,
|
|
2047
|
-
offset: rawQuery.offset ?? DEFAULT_PAGE_OFFSET
|
|
2048
|
-
};
|
|
2049
|
-
const { databasePlugin } = await prepareConfig();
|
|
2050
|
-
const bundles = await databasePlugin.getBundles({
|
|
2051
|
-
where: {
|
|
2052
|
-
channel: query.channel,
|
|
2053
|
-
platform: query.platform
|
|
2054
|
-
},
|
|
2055
|
-
limit: Number(query.limit),
|
|
2056
|
-
offset: Number(query.offset)
|
|
2057
|
-
});
|
|
2058
|
-
return c.json(bundles ?? []);
|
|
2059
|
-
} catch (error) {
|
|
2060
|
-
console.error("Error during bundle retrieval:", error);
|
|
2061
|
-
throw error;
|
|
2062
|
-
}
|
|
2063
|
-
}).get("/bundles/:bundleId", typiaValidator("param", paramBundleIdSchema), async (c) => {
|
|
2064
|
-
try {
|
|
2065
|
-
const { bundleId } = c.req.valid("param");
|
|
2066
|
-
const { databasePlugin } = await prepareConfig();
|
|
2067
|
-
const bundle = await databasePlugin.getBundleById(bundleId);
|
|
2068
|
-
return c.json(bundle ?? null);
|
|
2069
|
-
} catch (error) {
|
|
2070
|
-
console.error("Error during bundle retrieval:", error);
|
|
2071
|
-
throw error;
|
|
2072
|
-
}
|
|
2073
|
-
}).patch("/bundles/:bundleId", typiaValidator("json", updateBundleSchema), async (c) => {
|
|
2074
|
-
try {
|
|
2075
|
-
const bundleId = c.req.param("bundleId");
|
|
2076
|
-
const partialBundle = c.req.valid("json");
|
|
2077
|
-
if (!bundleId) return c.json({ error: "Target bundle ID is required" }, 400);
|
|
2078
|
-
const { databasePlugin } = await prepareConfig();
|
|
2079
|
-
await databasePlugin.updateBundle(bundleId, partialBundle);
|
|
2080
|
-
await databasePlugin.commitBundle();
|
|
2081
|
-
return c.json({ success: true });
|
|
2082
|
-
} catch (error) {
|
|
2083
|
-
console.error("Error during bundle update:", error);
|
|
2084
|
-
if (error && typeof error === "object" && "message" in error) return c.json({ error: error.message }, 500);
|
|
2085
|
-
return c.json({ error: "Unknown error" }, 500);
|
|
2086
|
-
}
|
|
2087
|
-
}).post("/bundles", typiaValidator("json", createBundleSchema), async (c) => {
|
|
2088
|
-
try {
|
|
2089
|
-
const bundle = c.req.valid("json");
|
|
2090
|
-
const { databasePlugin } = await prepareConfig();
|
|
2091
|
-
await databasePlugin.appendBundle(bundle);
|
|
2092
|
-
await databasePlugin.commitBundle();
|
|
2093
|
-
return c.json({
|
|
2094
|
-
success: true,
|
|
2095
|
-
bundleId: bundle.id
|
|
2096
|
-
});
|
|
2097
|
-
} catch (error) {
|
|
2098
|
-
console.error("Error during bundle creation:", error);
|
|
2099
|
-
if (error && typeof error === "object" && "message" in error) return c.json({ error: error.message }, 500);
|
|
2100
|
-
return c.json({ error: "Unknown error" }, 500);
|
|
2101
|
-
}
|
|
2102
|
-
}).delete("/bundles/:bundleId", typiaValidator("param", paramBundleIdSchema), async (c) => {
|
|
2103
|
-
try {
|
|
2104
|
-
const { bundleId } = c.req.valid("param");
|
|
2105
|
-
const { databasePlugin } = await prepareConfig();
|
|
2106
|
-
const deleteBundle = await databasePlugin.getBundleById(bundleId);
|
|
2107
|
-
if (!deleteBundle) return c.json({ error: "Bundle not found" }, 404);
|
|
2108
|
-
await databasePlugin.deleteBundle(deleteBundle);
|
|
2109
|
-
await databasePlugin.commitBundle();
|
|
2110
|
-
return c.json({ success: true });
|
|
2111
|
-
} catch (error) {
|
|
2112
|
-
console.error("Error during bundle deletion:", error);
|
|
2113
|
-
if (error && typeof error === "object" && "message" in error) return c.json({ error: error.message }, 500);
|
|
2114
|
-
return c.json({ error: "Unknown error" }, 500);
|
|
2115
|
-
}
|
|
2116
|
-
});
|
|
2117
|
-
|
|
2118
|
-
//#endregion
|
|
2119
|
-
//#region src-server/index.ts
|
|
2120
|
-
const __dirname$1 = path.default.dirname((0, url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
|
|
2121
|
-
const relativePathToScript = path.default.relative(process.cwd(), __dirname$1);
|
|
2122
|
-
const app = new Hono().get("/ping", (c) => c.text("pong")).route("/rpc", rpc).use("/assets/*", serveStatic({ root: relativePathToScript })).get("*", serveStatic({
|
|
2123
|
-
root: relativePathToScript,
|
|
2124
|
-
path: "index.html"
|
|
2125
|
-
}));
|
|
2126
|
-
var src_server_default = app;
|
|
2127
|
-
|
|
2128
|
-
//#endregion
|
|
2129
|
-
module.exports = src_server_default;
|