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