@hot-updater/console 0.12.6 → 0.13.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-DAX_alp5.js +27 -0
- package/dist/assets/index-paAi6YFm.css +1 -0
- package/dist/index.cjs +2564 -1942
- package/dist/index.html +2 -2
- package/dist/index.js +1101 -480
- package/dist/src/components/ui/button.d.ts +1 -1
- package/dist/src/components/ui/toast.d.ts +41 -0
- package/dist/src/hooks/useFilter.d.ts +9 -0
- package/dist/src/lib/api.d.ts +89 -49
- package/dist/src/routes/_components/data-table.d.ts +5 -6
- package/dist/src-server/index.d.ts +58 -23
- package/dist/src-server/rpc.d.ts +66 -39
- package/package.json +7 -8
- package/dist/assets/index-B_xkX-3E.js +0 -585
- package/dist/assets/index-CvELDnIr.css +0 -1
- package/dist/src-server/type.spec.d.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -4,6 +4,838 @@ import * as __WEBPACK_EXTERNAL_MODULE_path__ from "path";
|
|
|
4
4
|
import * as __WEBPACK_EXTERNAL_MODULE_url__ from "url";
|
|
5
5
|
import * as __WEBPACK_EXTERNAL_MODULE_fs__ from "fs";
|
|
6
6
|
import * as __WEBPACK_EXTERNAL_MODULE__hot_updater_plugin_core_40c1c502__ from "@hot-updater/plugin-core";
|
|
7
|
+
var __webpack_modules__ = {
|
|
8
|
+
"../../node_modules/.pnpm/@hono+typia-validator@0.1.0_hono@4.6.3_typia@8.0.3_@samchon+openapi@3.1.0_typescript@5.6.3_/node_modules/@hono/typia-validator/dist/cjs/index.js": function(__unused_webpack_module, exports, __webpack_require__) {
|
|
9
|
+
exports.typiaValidator = void 0;
|
|
10
|
+
const validator_1 = __webpack_require__("../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/cjs/validator/index.js");
|
|
11
|
+
const typiaValidator = (target, validate, hook)=>(0, validator_1.validator)(target, async (value, c)=>{
|
|
12
|
+
const result = validate(value);
|
|
13
|
+
if (hook) {
|
|
14
|
+
const hookResult = await hook({
|
|
15
|
+
...result,
|
|
16
|
+
data: value
|
|
17
|
+
}, c);
|
|
18
|
+
if (hookResult) {
|
|
19
|
+
if (hookResult instanceof Response || hookResult instanceof Promise) return hookResult;
|
|
20
|
+
if ('response' in hookResult) return hookResult.response;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
if (!result.success) return c.json({
|
|
24
|
+
success: false,
|
|
25
|
+
error: result.errors
|
|
26
|
+
}, 400);
|
|
27
|
+
return result.data;
|
|
28
|
+
});
|
|
29
|
+
exports.typiaValidator = typiaValidator;
|
|
30
|
+
},
|
|
31
|
+
"../../node_modules/.pnpm/typia@8.0.3_@samchon+openapi@3.1.0_typescript@5.6.3/node_modules/typia/lib/internal/_validateReport.js": function(__unused_webpack_module, exports) {
|
|
32
|
+
exports._validateReport = void 0;
|
|
33
|
+
const _validateReport = (array)=>{
|
|
34
|
+
const reportable = (path)=>{
|
|
35
|
+
if (0 === array.length) return true;
|
|
36
|
+
const last = array[array.length - 1].path;
|
|
37
|
+
return path.length > last.length || last.substring(0, path.length) !== path;
|
|
38
|
+
};
|
|
39
|
+
return (exceptable, error)=>{
|
|
40
|
+
if (exceptable && reportable(error.path)) array.push(error);
|
|
41
|
+
return false;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
exports._validateReport = _validateReport;
|
|
45
|
+
},
|
|
46
|
+
"../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/cjs/helper/cookie/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
|
|
47
|
+
var __defProp = Object.defineProperty;
|
|
48
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
49
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
50
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
51
|
+
var __export = (target, all)=>{
|
|
52
|
+
for(var name in all)__defProp(target, name, {
|
|
53
|
+
get: all[name],
|
|
54
|
+
enumerable: true
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
var __copyProps = (to, from, except, desc)=>{
|
|
58
|
+
if (from && "object" == typeof from || "function" == typeof from) {
|
|
59
|
+
for (let key of __getOwnPropNames(from))if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
60
|
+
get: ()=>from[key],
|
|
61
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
return to;
|
|
65
|
+
};
|
|
66
|
+
var __toCommonJS = (mod)=>__copyProps(__defProp({}, "__esModule", {
|
|
67
|
+
value: true
|
|
68
|
+
}), mod);
|
|
69
|
+
var cookie_exports = {};
|
|
70
|
+
__export(cookie_exports, {
|
|
71
|
+
deleteCookie: ()=>deleteCookie,
|
|
72
|
+
getCookie: ()=>getCookie,
|
|
73
|
+
getSignedCookie: ()=>getSignedCookie,
|
|
74
|
+
setCookie: ()=>setCookie,
|
|
75
|
+
setSignedCookie: ()=>setSignedCookie
|
|
76
|
+
});
|
|
77
|
+
module.exports = __toCommonJS(cookie_exports);
|
|
78
|
+
var import_cookie = __webpack_require__("../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/cjs/utils/cookie.js");
|
|
79
|
+
const getCookie = (c, key, prefix)=>{
|
|
80
|
+
const cookie = c.req.raw.headers.get("Cookie");
|
|
81
|
+
if ("string" == typeof key) {
|
|
82
|
+
if (!cookie) return;
|
|
83
|
+
let finalKey = key;
|
|
84
|
+
if ("secure" === prefix) finalKey = "__Secure-" + key;
|
|
85
|
+
else if ("host" === prefix) finalKey = "__Host-" + key;
|
|
86
|
+
const obj2 = (0, import_cookie.parse)(cookie, finalKey);
|
|
87
|
+
return obj2[finalKey];
|
|
88
|
+
}
|
|
89
|
+
if (!cookie) return {};
|
|
90
|
+
const obj = (0, import_cookie.parse)(cookie);
|
|
91
|
+
return obj;
|
|
92
|
+
};
|
|
93
|
+
const getSignedCookie = async (c, secret, key, prefix)=>{
|
|
94
|
+
const cookie = c.req.raw.headers.get("Cookie");
|
|
95
|
+
if ("string" == typeof key) {
|
|
96
|
+
if (!cookie) return;
|
|
97
|
+
let finalKey = key;
|
|
98
|
+
if ("secure" === prefix) finalKey = "__Secure-" + key;
|
|
99
|
+
else if ("host" === prefix) finalKey = "__Host-" + key;
|
|
100
|
+
const obj2 = await (0, import_cookie.parseSigned)(cookie, secret, finalKey);
|
|
101
|
+
return obj2[finalKey];
|
|
102
|
+
}
|
|
103
|
+
if (!cookie) return {};
|
|
104
|
+
const obj = await (0, import_cookie.parseSigned)(cookie, secret);
|
|
105
|
+
return obj;
|
|
106
|
+
};
|
|
107
|
+
const setCookie = (c, name, value, opt)=>{
|
|
108
|
+
let cookie;
|
|
109
|
+
cookie = opt?.prefix === "secure" ? (0, import_cookie.serialize)("__Secure-" + name, value, {
|
|
110
|
+
path: "/",
|
|
111
|
+
...opt,
|
|
112
|
+
secure: true
|
|
113
|
+
}) : opt?.prefix === "host" ? (0, import_cookie.serialize)("__Host-" + name, value, {
|
|
114
|
+
...opt,
|
|
115
|
+
path: "/",
|
|
116
|
+
secure: true,
|
|
117
|
+
domain: void 0
|
|
118
|
+
}) : (0, import_cookie.serialize)(name, value, {
|
|
119
|
+
path: "/",
|
|
120
|
+
...opt
|
|
121
|
+
});
|
|
122
|
+
c.header("set-cookie", cookie, {
|
|
123
|
+
append: true
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
const setSignedCookie = async (c, name, value, secret, opt)=>{
|
|
127
|
+
let cookie;
|
|
128
|
+
cookie = opt?.prefix === "secure" ? await (0, import_cookie.serializeSigned)("__Secure-" + name, value, secret, {
|
|
129
|
+
path: "/",
|
|
130
|
+
...opt,
|
|
131
|
+
secure: true
|
|
132
|
+
}) : opt?.prefix === "host" ? await (0, import_cookie.serializeSigned)("__Host-" + name, value, secret, {
|
|
133
|
+
...opt,
|
|
134
|
+
path: "/",
|
|
135
|
+
secure: true,
|
|
136
|
+
domain: void 0
|
|
137
|
+
}) : await (0, import_cookie.serializeSigned)(name, value, secret, {
|
|
138
|
+
path: "/",
|
|
139
|
+
...opt
|
|
140
|
+
});
|
|
141
|
+
c.header("set-cookie", cookie, {
|
|
142
|
+
append: true
|
|
143
|
+
});
|
|
144
|
+
};
|
|
145
|
+
const deleteCookie = (c, name, opt)=>{
|
|
146
|
+
const deletedCookie = getCookie(c, name);
|
|
147
|
+
setCookie(c, name, "", {
|
|
148
|
+
...opt,
|
|
149
|
+
maxAge: 0
|
|
150
|
+
});
|
|
151
|
+
return deletedCookie;
|
|
152
|
+
};
|
|
153
|
+
},
|
|
154
|
+
"../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/cjs/http-exception.js": function(module) {
|
|
155
|
+
var __defProp = Object.defineProperty;
|
|
156
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
157
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
158
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
159
|
+
var __export = (target, all)=>{
|
|
160
|
+
for(var name in all)__defProp(target, name, {
|
|
161
|
+
get: all[name],
|
|
162
|
+
enumerable: true
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
var __copyProps = (to, from, except, desc)=>{
|
|
166
|
+
if (from && "object" == typeof from || "function" == typeof from) {
|
|
167
|
+
for (let key of __getOwnPropNames(from))if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
168
|
+
get: ()=>from[key],
|
|
169
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
return to;
|
|
173
|
+
};
|
|
174
|
+
var __toCommonJS = (mod)=>__copyProps(__defProp({}, "__esModule", {
|
|
175
|
+
value: true
|
|
176
|
+
}), mod);
|
|
177
|
+
var http_exception_exports = {};
|
|
178
|
+
__export(http_exception_exports, {
|
|
179
|
+
HTTPException: ()=>HTTPException
|
|
180
|
+
});
|
|
181
|
+
module.exports = __toCommonJS(http_exception_exports);
|
|
182
|
+
class HTTPException extends Error {
|
|
183
|
+
res;
|
|
184
|
+
status;
|
|
185
|
+
constructor(status = 500, options){
|
|
186
|
+
super(options?.message, {
|
|
187
|
+
cause: options?.cause
|
|
188
|
+
});
|
|
189
|
+
this.res = options?.res;
|
|
190
|
+
this.status = status;
|
|
191
|
+
}
|
|
192
|
+
getResponse() {
|
|
193
|
+
if (this.res) {
|
|
194
|
+
const newResponse = new Response(this.res.body, {
|
|
195
|
+
status: this.status,
|
|
196
|
+
headers: this.res.headers
|
|
197
|
+
});
|
|
198
|
+
return newResponse;
|
|
199
|
+
}
|
|
200
|
+
return new Response(this.message, {
|
|
201
|
+
status: this.status
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
"../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/cjs/utils/buffer.js": function(module, __unused_webpack_exports, __webpack_require__) {
|
|
207
|
+
var __defProp = Object.defineProperty;
|
|
208
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
209
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
210
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
211
|
+
var __export = (target, all)=>{
|
|
212
|
+
for(var name in all)__defProp(target, name, {
|
|
213
|
+
get: all[name],
|
|
214
|
+
enumerable: true
|
|
215
|
+
});
|
|
216
|
+
};
|
|
217
|
+
var __copyProps = (to, from, except, desc)=>{
|
|
218
|
+
if (from && "object" == typeof from || "function" == typeof from) {
|
|
219
|
+
for (let key of __getOwnPropNames(from))if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
220
|
+
get: ()=>from[key],
|
|
221
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
return to;
|
|
225
|
+
};
|
|
226
|
+
var __toCommonJS = (mod)=>__copyProps(__defProp({}, "__esModule", {
|
|
227
|
+
value: true
|
|
228
|
+
}), mod);
|
|
229
|
+
var buffer_exports = {};
|
|
230
|
+
__export(buffer_exports, {
|
|
231
|
+
bufferToFormData: ()=>bufferToFormData,
|
|
232
|
+
bufferToString: ()=>bufferToString,
|
|
233
|
+
equal: ()=>equal,
|
|
234
|
+
timingSafeEqual: ()=>timingSafeEqual
|
|
235
|
+
});
|
|
236
|
+
module.exports = __toCommonJS(buffer_exports);
|
|
237
|
+
var import_crypto = __webpack_require__("../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/cjs/utils/crypto.js");
|
|
238
|
+
const equal = (a, b)=>{
|
|
239
|
+
if (a === b) return true;
|
|
240
|
+
if (a.byteLength !== b.byteLength) return false;
|
|
241
|
+
const va = new DataView(a);
|
|
242
|
+
const vb = new DataView(b);
|
|
243
|
+
let i = va.byteLength;
|
|
244
|
+
while(i--)if (va.getUint8(i) !== vb.getUint8(i)) return false;
|
|
245
|
+
return true;
|
|
246
|
+
};
|
|
247
|
+
const timingSafeEqual = async (a, b, hashFunction)=>{
|
|
248
|
+
if (!hashFunction) hashFunction = import_crypto.sha256;
|
|
249
|
+
const [sa, sb] = await Promise.all([
|
|
250
|
+
hashFunction(a),
|
|
251
|
+
hashFunction(b)
|
|
252
|
+
]);
|
|
253
|
+
if (!sa || !sb) return false;
|
|
254
|
+
return sa === sb && a === b;
|
|
255
|
+
};
|
|
256
|
+
const bufferToString = (buffer)=>{
|
|
257
|
+
if (buffer instanceof ArrayBuffer) {
|
|
258
|
+
const enc = new TextDecoder("utf-8");
|
|
259
|
+
return enc.decode(buffer);
|
|
260
|
+
}
|
|
261
|
+
return buffer;
|
|
262
|
+
};
|
|
263
|
+
const bufferToFormData = (arrayBuffer, contentType)=>{
|
|
264
|
+
const response = new Response(arrayBuffer, {
|
|
265
|
+
headers: {
|
|
266
|
+
"Content-Type": contentType
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
return response.formData();
|
|
270
|
+
};
|
|
271
|
+
},
|
|
272
|
+
"../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/cjs/utils/cookie.js": function(module, __unused_webpack_exports, __webpack_require__) {
|
|
273
|
+
var __defProp = Object.defineProperty;
|
|
274
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
275
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
276
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
277
|
+
var __export = (target, all)=>{
|
|
278
|
+
for(var name in all)__defProp(target, name, {
|
|
279
|
+
get: all[name],
|
|
280
|
+
enumerable: true
|
|
281
|
+
});
|
|
282
|
+
};
|
|
283
|
+
var __copyProps = (to, from, except, desc)=>{
|
|
284
|
+
if (from && "object" == typeof from || "function" == typeof from) {
|
|
285
|
+
for (let key of __getOwnPropNames(from))if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
286
|
+
get: ()=>from[key],
|
|
287
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
return to;
|
|
291
|
+
};
|
|
292
|
+
var __toCommonJS = (mod)=>__copyProps(__defProp({}, "__esModule", {
|
|
293
|
+
value: true
|
|
294
|
+
}), mod);
|
|
295
|
+
var cookie_exports = {};
|
|
296
|
+
__export(cookie_exports, {
|
|
297
|
+
parse: ()=>parse,
|
|
298
|
+
parseSigned: ()=>parseSigned,
|
|
299
|
+
serialize: ()=>serialize,
|
|
300
|
+
serializeSigned: ()=>serializeSigned
|
|
301
|
+
});
|
|
302
|
+
module.exports = __toCommonJS(cookie_exports);
|
|
303
|
+
var import_url = __webpack_require__("../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/cjs/utils/url.js");
|
|
304
|
+
const algorithm = {
|
|
305
|
+
name: "HMAC",
|
|
306
|
+
hash: "SHA-256"
|
|
307
|
+
};
|
|
308
|
+
const getCryptoKey = async (secret)=>{
|
|
309
|
+
const secretBuf = "string" == typeof secret ? new TextEncoder().encode(secret) : secret;
|
|
310
|
+
return await crypto.subtle.importKey("raw", secretBuf, algorithm, false, [
|
|
311
|
+
"sign",
|
|
312
|
+
"verify"
|
|
313
|
+
]);
|
|
314
|
+
};
|
|
315
|
+
const makeSignature = async (value, secret)=>{
|
|
316
|
+
const key = await getCryptoKey(secret);
|
|
317
|
+
const signature = await crypto.subtle.sign(algorithm.name, key, new TextEncoder().encode(value));
|
|
318
|
+
return btoa(String.fromCharCode(...new Uint8Array(signature)));
|
|
319
|
+
};
|
|
320
|
+
const verifySignature = async (base64Signature, value, secret)=>{
|
|
321
|
+
try {
|
|
322
|
+
const signatureBinStr = atob(base64Signature);
|
|
323
|
+
const signature = new Uint8Array(signatureBinStr.length);
|
|
324
|
+
for(let i = 0, len = signatureBinStr.length; i < len; i++)signature[i] = signatureBinStr.charCodeAt(i);
|
|
325
|
+
return await crypto.subtle.verify(algorithm, secret, signature, new TextEncoder().encode(value));
|
|
326
|
+
} catch {
|
|
327
|
+
return false;
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
const validCookieNameRegEx = /^[\w!#$%&'*.^`|~+-]+$/;
|
|
331
|
+
const validCookieValueRegEx = /^[ !#-:<-[\]-~]*$/;
|
|
332
|
+
const parse = (cookie, name)=>{
|
|
333
|
+
const pairs = cookie.trim().split(";");
|
|
334
|
+
return pairs.reduce((parsedCookie, pairStr)=>{
|
|
335
|
+
pairStr = pairStr.trim();
|
|
336
|
+
const valueStartPos = pairStr.indexOf("=");
|
|
337
|
+
if (-1 === valueStartPos) return parsedCookie;
|
|
338
|
+
const cookieName = pairStr.substring(0, valueStartPos).trim();
|
|
339
|
+
if (name && name !== cookieName || !validCookieNameRegEx.test(cookieName)) return parsedCookie;
|
|
340
|
+
let cookieValue = pairStr.substring(valueStartPos + 1).trim();
|
|
341
|
+
if (cookieValue.startsWith('"') && cookieValue.endsWith('"')) cookieValue = cookieValue.slice(1, -1);
|
|
342
|
+
if (validCookieValueRegEx.test(cookieValue)) parsedCookie[cookieName] = (0, import_url.decodeURIComponent_)(cookieValue);
|
|
343
|
+
return parsedCookie;
|
|
344
|
+
}, {});
|
|
345
|
+
};
|
|
346
|
+
const parseSigned = async (cookie, secret, name)=>{
|
|
347
|
+
const parsedCookie = {};
|
|
348
|
+
const secretKey = await getCryptoKey(secret);
|
|
349
|
+
for (const [key, value] of Object.entries(parse(cookie, name))){
|
|
350
|
+
const signatureStartPos = value.lastIndexOf(".");
|
|
351
|
+
if (signatureStartPos < 1) continue;
|
|
352
|
+
const signedValue = value.substring(0, signatureStartPos);
|
|
353
|
+
const signature = value.substring(signatureStartPos + 1);
|
|
354
|
+
if (44 !== signature.length || !signature.endsWith("=")) continue;
|
|
355
|
+
const isVerified = await verifySignature(signature, signedValue, secretKey);
|
|
356
|
+
parsedCookie[key] = isVerified ? signedValue : false;
|
|
357
|
+
}
|
|
358
|
+
return parsedCookie;
|
|
359
|
+
};
|
|
360
|
+
const _serialize = (name, value, opt = {})=>{
|
|
361
|
+
let cookie = `${name}=${value}`;
|
|
362
|
+
if (name.startsWith("__Secure-") && !opt.secure) throw new Error("__Secure- Cookie must have Secure attributes");
|
|
363
|
+
if (name.startsWith("__Host-")) {
|
|
364
|
+
if (!opt.secure) throw new Error("__Host- Cookie must have Secure attributes");
|
|
365
|
+
if ("/" !== opt.path) throw new Error('__Host- Cookie must have Path attributes with "/"');
|
|
366
|
+
if (opt.domain) throw new Error("__Host- Cookie must not have Domain attributes");
|
|
367
|
+
}
|
|
368
|
+
if (opt && "number" == typeof opt.maxAge && opt.maxAge >= 0) {
|
|
369
|
+
if (opt.maxAge > 3456e4) throw new Error("Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.");
|
|
370
|
+
cookie += `; Max-Age=${Math.floor(opt.maxAge)}`;
|
|
371
|
+
}
|
|
372
|
+
if (opt.domain && "host" !== opt.prefix) cookie += `; Domain=${opt.domain}`;
|
|
373
|
+
if (opt.path) cookie += `; Path=${opt.path}`;
|
|
374
|
+
if (opt.expires) {
|
|
375
|
+
if (opt.expires.getTime() - Date.now() > 3456e7) throw new Error("Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.");
|
|
376
|
+
cookie += `; Expires=${opt.expires.toUTCString()}`;
|
|
377
|
+
}
|
|
378
|
+
if (opt.httpOnly) cookie += "; HttpOnly";
|
|
379
|
+
if (opt.secure) cookie += "; Secure";
|
|
380
|
+
if (opt.sameSite) cookie += `; SameSite=${opt.sameSite.charAt(0).toUpperCase() + opt.sameSite.slice(1)}`;
|
|
381
|
+
if (opt.partitioned) {
|
|
382
|
+
if (!opt.secure) throw new Error("Partitioned Cookie must have Secure attributes");
|
|
383
|
+
cookie += "; Partitioned";
|
|
384
|
+
}
|
|
385
|
+
return cookie;
|
|
386
|
+
};
|
|
387
|
+
const serialize = (name, value, opt)=>{
|
|
388
|
+
value = encodeURIComponent(value);
|
|
389
|
+
return _serialize(name, value, opt);
|
|
390
|
+
};
|
|
391
|
+
const serializeSigned = async (name, value, secret, opt = {})=>{
|
|
392
|
+
const signature = await makeSignature(value, secret);
|
|
393
|
+
value = `${value}.${signature}`;
|
|
394
|
+
value = encodeURIComponent(value);
|
|
395
|
+
return _serialize(name, value, opt);
|
|
396
|
+
};
|
|
397
|
+
},
|
|
398
|
+
"../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/cjs/utils/crypto.js": function(module) {
|
|
399
|
+
var __defProp = Object.defineProperty;
|
|
400
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
401
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
402
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
403
|
+
var __export = (target, all)=>{
|
|
404
|
+
for(var name in all)__defProp(target, name, {
|
|
405
|
+
get: all[name],
|
|
406
|
+
enumerable: true
|
|
407
|
+
});
|
|
408
|
+
};
|
|
409
|
+
var __copyProps = (to, from, except, desc)=>{
|
|
410
|
+
if (from && "object" == typeof from || "function" == typeof from) {
|
|
411
|
+
for (let key of __getOwnPropNames(from))if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
412
|
+
get: ()=>from[key],
|
|
413
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
return to;
|
|
417
|
+
};
|
|
418
|
+
var __toCommonJS = (mod)=>__copyProps(__defProp({}, "__esModule", {
|
|
419
|
+
value: true
|
|
420
|
+
}), mod);
|
|
421
|
+
var crypto_exports = {};
|
|
422
|
+
__export(crypto_exports, {
|
|
423
|
+
createHash: ()=>createHash,
|
|
424
|
+
md5: ()=>md5,
|
|
425
|
+
sha1: ()=>sha1,
|
|
426
|
+
sha256: ()=>sha256
|
|
427
|
+
});
|
|
428
|
+
module.exports = __toCommonJS(crypto_exports);
|
|
429
|
+
const sha256 = async (data)=>{
|
|
430
|
+
const algorithm = {
|
|
431
|
+
name: "SHA-256",
|
|
432
|
+
alias: "sha256"
|
|
433
|
+
};
|
|
434
|
+
const hash = await createHash(data, algorithm);
|
|
435
|
+
return hash;
|
|
436
|
+
};
|
|
437
|
+
const sha1 = async (data)=>{
|
|
438
|
+
const algorithm = {
|
|
439
|
+
name: "SHA-1",
|
|
440
|
+
alias: "sha1"
|
|
441
|
+
};
|
|
442
|
+
const hash = await createHash(data, algorithm);
|
|
443
|
+
return hash;
|
|
444
|
+
};
|
|
445
|
+
const md5 = async (data)=>{
|
|
446
|
+
const algorithm = {
|
|
447
|
+
name: "MD5",
|
|
448
|
+
alias: "md5"
|
|
449
|
+
};
|
|
450
|
+
const hash = await createHash(data, algorithm);
|
|
451
|
+
return hash;
|
|
452
|
+
};
|
|
453
|
+
const createHash = async (data, algorithm)=>{
|
|
454
|
+
let sourceBuffer;
|
|
455
|
+
if (data instanceof ReadableStream) {
|
|
456
|
+
let body = "";
|
|
457
|
+
const reader = data.getReader();
|
|
458
|
+
await reader?.read().then(async (chuck)=>{
|
|
459
|
+
const value = await createHash(chuck.value || "", algorithm);
|
|
460
|
+
body += value;
|
|
461
|
+
});
|
|
462
|
+
return body;
|
|
463
|
+
}
|
|
464
|
+
if (ArrayBuffer.isView(data) || data instanceof ArrayBuffer) sourceBuffer = data;
|
|
465
|
+
else {
|
|
466
|
+
if ("object" == typeof data) data = JSON.stringify(data);
|
|
467
|
+
sourceBuffer = new TextEncoder().encode(String(data));
|
|
468
|
+
}
|
|
469
|
+
if (crypto && crypto.subtle) {
|
|
470
|
+
const buffer = await crypto.subtle.digest({
|
|
471
|
+
name: algorithm.name
|
|
472
|
+
}, sourceBuffer);
|
|
473
|
+
const hash = Array.prototype.map.call(new Uint8Array(buffer), (x)=>("00" + x.toString(16)).slice(-2)).join("");
|
|
474
|
+
return hash;
|
|
475
|
+
}
|
|
476
|
+
return null;
|
|
477
|
+
};
|
|
478
|
+
},
|
|
479
|
+
"../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/cjs/utils/url.js": function(module) {
|
|
480
|
+
var __defProp = Object.defineProperty;
|
|
481
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
482
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
483
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
484
|
+
var __export = (target, all)=>{
|
|
485
|
+
for(var name in all)__defProp(target, name, {
|
|
486
|
+
get: all[name],
|
|
487
|
+
enumerable: true
|
|
488
|
+
});
|
|
489
|
+
};
|
|
490
|
+
var __copyProps = (to, from, except, desc)=>{
|
|
491
|
+
if (from && "object" == typeof from || "function" == typeof from) {
|
|
492
|
+
for (let key of __getOwnPropNames(from))if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
493
|
+
get: ()=>from[key],
|
|
494
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
return to;
|
|
498
|
+
};
|
|
499
|
+
var __toCommonJS = (mod)=>__copyProps(__defProp({}, "__esModule", {
|
|
500
|
+
value: true
|
|
501
|
+
}), mod);
|
|
502
|
+
var url_exports = {};
|
|
503
|
+
__export(url_exports, {
|
|
504
|
+
checkOptionalParameter: ()=>checkOptionalParameter,
|
|
505
|
+
decodeURIComponent_: ()=>decodeURIComponent_,
|
|
506
|
+
getPath: ()=>getPath,
|
|
507
|
+
getPathNoStrict: ()=>getPathNoStrict,
|
|
508
|
+
getPattern: ()=>getPattern,
|
|
509
|
+
getQueryParam: ()=>getQueryParam,
|
|
510
|
+
getQueryParams: ()=>getQueryParams,
|
|
511
|
+
getQueryStrings: ()=>getQueryStrings,
|
|
512
|
+
mergePath: ()=>mergePath,
|
|
513
|
+
splitPath: ()=>splitPath,
|
|
514
|
+
splitRoutingPath: ()=>splitRoutingPath
|
|
515
|
+
});
|
|
516
|
+
module.exports = __toCommonJS(url_exports);
|
|
517
|
+
const splitPath = (path)=>{
|
|
518
|
+
const paths = path.split("/");
|
|
519
|
+
if ("" === paths[0]) paths.shift();
|
|
520
|
+
return paths;
|
|
521
|
+
};
|
|
522
|
+
const splitRoutingPath = (routePath)=>{
|
|
523
|
+
const { groups, path } = extractGroupsFromPath(routePath);
|
|
524
|
+
const paths = splitPath(path);
|
|
525
|
+
return replaceGroupMarks(paths, groups);
|
|
526
|
+
};
|
|
527
|
+
const extractGroupsFromPath = (path)=>{
|
|
528
|
+
const groups = [];
|
|
529
|
+
path = path.replace(/\{[^}]+\}/g, (match, index)=>{
|
|
530
|
+
const mark = `@${index}`;
|
|
531
|
+
groups.push([
|
|
532
|
+
mark,
|
|
533
|
+
match
|
|
534
|
+
]);
|
|
535
|
+
return mark;
|
|
536
|
+
});
|
|
537
|
+
return {
|
|
538
|
+
groups,
|
|
539
|
+
path
|
|
540
|
+
};
|
|
541
|
+
};
|
|
542
|
+
const replaceGroupMarks = (paths, groups)=>{
|
|
543
|
+
for(let i = groups.length - 1; i >= 0; i--){
|
|
544
|
+
const [mark] = groups[i];
|
|
545
|
+
for(let j = paths.length - 1; j >= 0; j--)if (paths[j].includes(mark)) {
|
|
546
|
+
paths[j] = paths[j].replace(mark, groups[i][1]);
|
|
547
|
+
break;
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
return paths;
|
|
551
|
+
};
|
|
552
|
+
const patternCache = {};
|
|
553
|
+
const getPattern = (label)=>{
|
|
554
|
+
if ("*" === label) return "*";
|
|
555
|
+
const match = label.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);
|
|
556
|
+
if (match) {
|
|
557
|
+
if (!patternCache[label]) {
|
|
558
|
+
if (match[2]) patternCache[label] = [
|
|
559
|
+
label,
|
|
560
|
+
match[1],
|
|
561
|
+
new RegExp("^" + match[2] + "$")
|
|
562
|
+
];
|
|
563
|
+
else patternCache[label] = [
|
|
564
|
+
label,
|
|
565
|
+
match[1],
|
|
566
|
+
true
|
|
567
|
+
];
|
|
568
|
+
}
|
|
569
|
+
return patternCache[label];
|
|
570
|
+
}
|
|
571
|
+
return null;
|
|
572
|
+
};
|
|
573
|
+
const tryDecodeURI = (str)=>{
|
|
574
|
+
try {
|
|
575
|
+
return decodeURI(str);
|
|
576
|
+
} catch {
|
|
577
|
+
return str.replace(/(?:%[0-9A-Fa-f]{2})+/g, (match)=>{
|
|
578
|
+
try {
|
|
579
|
+
return decodeURI(match);
|
|
580
|
+
} catch {
|
|
581
|
+
return match;
|
|
582
|
+
}
|
|
583
|
+
});
|
|
584
|
+
}
|
|
585
|
+
};
|
|
586
|
+
const getPath = (request)=>{
|
|
587
|
+
const url = request.url;
|
|
588
|
+
const start = url.indexOf("/", 8);
|
|
589
|
+
let i = start;
|
|
590
|
+
for(; i < url.length; i++){
|
|
591
|
+
const charCode = url.charCodeAt(i);
|
|
592
|
+
if (37 === charCode) {
|
|
593
|
+
const queryIndex = url.indexOf("?", i);
|
|
594
|
+
const path = url.slice(start, -1 === queryIndex ? void 0 : queryIndex);
|
|
595
|
+
return tryDecodeURI(path.includes("%25") ? path.replace(/%25/g, "%2525") : path);
|
|
596
|
+
}
|
|
597
|
+
if (63 === charCode) break;
|
|
598
|
+
}
|
|
599
|
+
return url.slice(start, i);
|
|
600
|
+
};
|
|
601
|
+
const getQueryStrings = (url)=>{
|
|
602
|
+
const queryIndex = url.indexOf("?", 8);
|
|
603
|
+
return -1 === queryIndex ? "" : "?" + url.slice(queryIndex + 1);
|
|
604
|
+
};
|
|
605
|
+
const getPathNoStrict = (request)=>{
|
|
606
|
+
const result = getPath(request);
|
|
607
|
+
return result.length > 1 && "/" === result[result.length - 1] ? result.slice(0, -1) : result;
|
|
608
|
+
};
|
|
609
|
+
const mergePath = (...paths)=>{
|
|
610
|
+
let p = "";
|
|
611
|
+
let endsWithSlash = false;
|
|
612
|
+
for (let path of paths){
|
|
613
|
+
if ("/" === p[p.length - 1]) {
|
|
614
|
+
p = p.slice(0, -1);
|
|
615
|
+
endsWithSlash = true;
|
|
616
|
+
}
|
|
617
|
+
if ("/" !== path[0]) path = `/${path}`;
|
|
618
|
+
if ("/" === path && endsWithSlash) p = `${p}/`;
|
|
619
|
+
else if ("/" !== path) p = `${p}${path}`;
|
|
620
|
+
if ("/" === path && "" === p) p = "/";
|
|
621
|
+
}
|
|
622
|
+
return p;
|
|
623
|
+
};
|
|
624
|
+
const checkOptionalParameter = (path)=>{
|
|
625
|
+
if (!path.match(/\:.+\?$/)) return null;
|
|
626
|
+
const segments = path.split("/");
|
|
627
|
+
const results = [];
|
|
628
|
+
let basePath = "";
|
|
629
|
+
segments.forEach((segment)=>{
|
|
630
|
+
if ("" === segment || /\:/.test(segment)) {
|
|
631
|
+
if (/\:/.test(segment)) {
|
|
632
|
+
if (/\?/.test(segment)) {
|
|
633
|
+
if (0 === results.length && "" === basePath) results.push("/");
|
|
634
|
+
else results.push(basePath);
|
|
635
|
+
const optionalSegment = segment.replace("?", "");
|
|
636
|
+
basePath += "/" + optionalSegment;
|
|
637
|
+
results.push(basePath);
|
|
638
|
+
} else basePath += "/" + segment;
|
|
639
|
+
}
|
|
640
|
+
} else basePath += "/" + segment;
|
|
641
|
+
});
|
|
642
|
+
return results.filter((v, i, a)=>a.indexOf(v) === i);
|
|
643
|
+
};
|
|
644
|
+
const _decodeURI = (value)=>{
|
|
645
|
+
if (!/[%+]/.test(value)) return value;
|
|
646
|
+
if (-1 !== value.indexOf("+")) value = value.replace(/\+/g, " ");
|
|
647
|
+
return /%/.test(value) ? decodeURIComponent_(value) : value;
|
|
648
|
+
};
|
|
649
|
+
const _getQueryParam = (url, key, multiple)=>{
|
|
650
|
+
let encoded;
|
|
651
|
+
if (!multiple && key && !/[%+]/.test(key)) {
|
|
652
|
+
let keyIndex2 = url.indexOf(`?${key}`, 8);
|
|
653
|
+
if (-1 === keyIndex2) keyIndex2 = url.indexOf(`&${key}`, 8);
|
|
654
|
+
while(-1 !== keyIndex2){
|
|
655
|
+
const trailingKeyCode = url.charCodeAt(keyIndex2 + key.length + 1);
|
|
656
|
+
if (61 === trailingKeyCode) {
|
|
657
|
+
const valueIndex = keyIndex2 + key.length + 2;
|
|
658
|
+
const endIndex = url.indexOf("&", valueIndex);
|
|
659
|
+
return _decodeURI(url.slice(valueIndex, -1 === endIndex ? void 0 : endIndex));
|
|
660
|
+
}
|
|
661
|
+
if (38 == trailingKeyCode || isNaN(trailingKeyCode)) return "";
|
|
662
|
+
keyIndex2 = url.indexOf(`&${key}`, keyIndex2 + 1);
|
|
663
|
+
}
|
|
664
|
+
encoded = /[%+]/.test(url);
|
|
665
|
+
if (!encoded) return;
|
|
666
|
+
}
|
|
667
|
+
const results = {};
|
|
668
|
+
encoded ??= /[%+]/.test(url);
|
|
669
|
+
let keyIndex = url.indexOf("?", 8);
|
|
670
|
+
while(-1 !== keyIndex){
|
|
671
|
+
const nextKeyIndex = url.indexOf("&", keyIndex + 1);
|
|
672
|
+
let valueIndex = url.indexOf("=", keyIndex);
|
|
673
|
+
if (valueIndex > nextKeyIndex && -1 !== nextKeyIndex) valueIndex = -1;
|
|
674
|
+
let name = url.slice(keyIndex + 1, -1 === valueIndex ? -1 === nextKeyIndex ? void 0 : nextKeyIndex : valueIndex);
|
|
675
|
+
if (encoded) name = _decodeURI(name);
|
|
676
|
+
keyIndex = nextKeyIndex;
|
|
677
|
+
if ("" === name) continue;
|
|
678
|
+
let value;
|
|
679
|
+
if (-1 === valueIndex) value = "";
|
|
680
|
+
else {
|
|
681
|
+
value = url.slice(valueIndex + 1, -1 === nextKeyIndex ? void 0 : nextKeyIndex);
|
|
682
|
+
if (encoded) value = _decodeURI(value);
|
|
683
|
+
}
|
|
684
|
+
if (multiple) {
|
|
685
|
+
if (!(results[name] && Array.isArray(results[name]))) results[name] = [];
|
|
686
|
+
results[name].push(value);
|
|
687
|
+
} else results[name] ??= value;
|
|
688
|
+
}
|
|
689
|
+
return key ? results[key] : results;
|
|
690
|
+
};
|
|
691
|
+
const getQueryParam = _getQueryParam;
|
|
692
|
+
const getQueryParams = (url, key)=>_getQueryParam(url, key, true);
|
|
693
|
+
const decodeURIComponent_ = decodeURIComponent;
|
|
694
|
+
},
|
|
695
|
+
"../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/cjs/validator/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
|
|
696
|
+
var __defProp = Object.defineProperty;
|
|
697
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
698
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
699
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
700
|
+
var __export = (target, all)=>{
|
|
701
|
+
for(var name in all)__defProp(target, name, {
|
|
702
|
+
get: all[name],
|
|
703
|
+
enumerable: true
|
|
704
|
+
});
|
|
705
|
+
};
|
|
706
|
+
var __copyProps = (to, from, except, desc)=>{
|
|
707
|
+
if (from && "object" == typeof from || "function" == typeof from) {
|
|
708
|
+
for (let key of __getOwnPropNames(from))if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
709
|
+
get: ()=>from[key],
|
|
710
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
return to;
|
|
714
|
+
};
|
|
715
|
+
var __toCommonJS = (mod)=>__copyProps(__defProp({}, "__esModule", {
|
|
716
|
+
value: true
|
|
717
|
+
}), mod);
|
|
718
|
+
var validator_exports = {};
|
|
719
|
+
__export(validator_exports, {
|
|
720
|
+
validator: ()=>import_validator.validator
|
|
721
|
+
});
|
|
722
|
+
module.exports = __toCommonJS(validator_exports);
|
|
723
|
+
var import_validator = __webpack_require__("../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/cjs/validator/validator.js");
|
|
724
|
+
},
|
|
725
|
+
"../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/cjs/validator/validator.js": function(module, __unused_webpack_exports, __webpack_require__) {
|
|
726
|
+
var __defProp = Object.defineProperty;
|
|
727
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
728
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
729
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
730
|
+
var __export = (target, all)=>{
|
|
731
|
+
for(var name in all)__defProp(target, name, {
|
|
732
|
+
get: all[name],
|
|
733
|
+
enumerable: true
|
|
734
|
+
});
|
|
735
|
+
};
|
|
736
|
+
var __copyProps = (to, from, except, desc)=>{
|
|
737
|
+
if (from && "object" == typeof from || "function" == typeof from) {
|
|
738
|
+
for (let key of __getOwnPropNames(from))if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
739
|
+
get: ()=>from[key],
|
|
740
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
741
|
+
});
|
|
742
|
+
}
|
|
743
|
+
return to;
|
|
744
|
+
};
|
|
745
|
+
var __toCommonJS = (mod)=>__copyProps(__defProp({}, "__esModule", {
|
|
746
|
+
value: true
|
|
747
|
+
}), mod);
|
|
748
|
+
var validator_exports = {};
|
|
749
|
+
__export(validator_exports, {
|
|
750
|
+
validator: ()=>validator
|
|
751
|
+
});
|
|
752
|
+
module.exports = __toCommonJS(validator_exports);
|
|
753
|
+
var import_cookie = __webpack_require__("../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/cjs/helper/cookie/index.js");
|
|
754
|
+
var import_http_exception = __webpack_require__("../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/cjs/http-exception.js");
|
|
755
|
+
var import_buffer = __webpack_require__("../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/cjs/utils/buffer.js");
|
|
756
|
+
const jsonRegex = /^application\/([a-z-\.]+\+)?json(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/;
|
|
757
|
+
const multipartRegex = /^multipart\/form-data(;\s?boundary=[a-zA-Z0-9'"()+_,\-./:=?]+)?$/;
|
|
758
|
+
const urlencodedRegex = /^application\/x-www-form-urlencoded(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/;
|
|
759
|
+
const validator = (target, validationFunc)=>async (c, next)=>{
|
|
760
|
+
let value = {};
|
|
761
|
+
const contentType = c.req.header("Content-Type");
|
|
762
|
+
switch(target){
|
|
763
|
+
case "json":
|
|
764
|
+
if (!contentType || !jsonRegex.test(contentType)) break;
|
|
765
|
+
try {
|
|
766
|
+
value = await c.req.json();
|
|
767
|
+
} catch {
|
|
768
|
+
const message = "Malformed JSON in request body";
|
|
769
|
+
throw new import_http_exception.HTTPException(400, {
|
|
770
|
+
message
|
|
771
|
+
});
|
|
772
|
+
}
|
|
773
|
+
break;
|
|
774
|
+
case "form":
|
|
775
|
+
{
|
|
776
|
+
if (!contentType || !(multipartRegex.test(contentType) || urlencodedRegex.test(contentType))) break;
|
|
777
|
+
let formData;
|
|
778
|
+
if (c.req.bodyCache.formData) formData = await c.req.bodyCache.formData;
|
|
779
|
+
else try {
|
|
780
|
+
const arrayBuffer = await c.req.arrayBuffer();
|
|
781
|
+
formData = await (0, import_buffer.bufferToFormData)(arrayBuffer, contentType);
|
|
782
|
+
c.req.bodyCache.formData = formData;
|
|
783
|
+
} catch (e) {
|
|
784
|
+
let message = "Malformed FormData request.";
|
|
785
|
+
message += e instanceof Error ? ` ${e.message}` : ` ${String(e)}`;
|
|
786
|
+
throw new import_http_exception.HTTPException(400, {
|
|
787
|
+
message
|
|
788
|
+
});
|
|
789
|
+
}
|
|
790
|
+
const form = {};
|
|
791
|
+
formData.forEach((value2, key)=>{
|
|
792
|
+
if (key.endsWith("[]")) (form[key] ??= []).push(value2);
|
|
793
|
+
else if (Array.isArray(form[key])) form[key].push(value2);
|
|
794
|
+
else if (key in form) form[key] = [
|
|
795
|
+
form[key],
|
|
796
|
+
value2
|
|
797
|
+
];
|
|
798
|
+
else form[key] = value2;
|
|
799
|
+
});
|
|
800
|
+
value = form;
|
|
801
|
+
break;
|
|
802
|
+
}
|
|
803
|
+
case "query":
|
|
804
|
+
value = Object.fromEntries(Object.entries(c.req.queries()).map(([k, v])=>1 === v.length ? [
|
|
805
|
+
k,
|
|
806
|
+
v[0]
|
|
807
|
+
] : [
|
|
808
|
+
k,
|
|
809
|
+
v
|
|
810
|
+
]));
|
|
811
|
+
break;
|
|
812
|
+
case "param":
|
|
813
|
+
value = c.req.param();
|
|
814
|
+
break;
|
|
815
|
+
case "header":
|
|
816
|
+
value = c.req.header();
|
|
817
|
+
break;
|
|
818
|
+
case "cookie":
|
|
819
|
+
value = (0, import_cookie.getCookie)(c);
|
|
820
|
+
break;
|
|
821
|
+
}
|
|
822
|
+
const res = await validationFunc(value, c);
|
|
823
|
+
if (res instanceof Response) return res;
|
|
824
|
+
c.req.addValidatedData(target, res);
|
|
825
|
+
await next();
|
|
826
|
+
};
|
|
827
|
+
}
|
|
828
|
+
};
|
|
829
|
+
var __webpack_module_cache__ = {};
|
|
830
|
+
function __webpack_require__(moduleId) {
|
|
831
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
832
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
833
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
834
|
+
exports: {}
|
|
835
|
+
};
|
|
836
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
837
|
+
return module.exports;
|
|
838
|
+
}
|
|
7
839
|
var getFilePath = (options)=>{
|
|
8
840
|
let filename = options.filename;
|
|
9
841
|
const defaultDocument = options.defaultDocument || "index.html";
|
|
@@ -1552,495 +2384,284 @@ var hono_Hono = class extends Hono {
|
|
|
1552
2384
|
});
|
|
1553
2385
|
}
|
|
1554
2386
|
};
|
|
1555
|
-
var
|
|
1556
|
-
var
|
|
1557
|
-
|
|
1558
|
-
const
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
const
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
}
|
|
1607
|
-
};
|
|
1608
|
-
var bufferToFormData = (arrayBuffer, contentType)=>{
|
|
1609
|
-
const response = new Response(arrayBuffer, {
|
|
1610
|
-
headers: {
|
|
1611
|
-
"Content-Type": contentType
|
|
1612
|
-
}
|
|
1613
|
-
});
|
|
1614
|
-
return response.formData();
|
|
1615
|
-
};
|
|
1616
|
-
var jsonRegex = /^application\/([a-z-\.]+\+)?json(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/;
|
|
1617
|
-
var multipartRegex = /^multipart\/form-data(;\s?boundary=[a-zA-Z0-9'"()+_,\-./:=?]+)?$/;
|
|
1618
|
-
var urlencodedRegex = /^application\/x-www-form-urlencoded(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/;
|
|
1619
|
-
var validator = (target, validationFunc)=>async (c, next)=>{
|
|
1620
|
-
let value = {};
|
|
1621
|
-
const contentType = c.req.header("Content-Type");
|
|
1622
|
-
switch(target){
|
|
1623
|
-
case "json":
|
|
1624
|
-
if (!contentType || !jsonRegex.test(contentType)) break;
|
|
1625
|
-
try {
|
|
1626
|
-
value = await c.req.json();
|
|
1627
|
-
} catch {
|
|
1628
|
-
const message = "Malformed JSON in request body";
|
|
1629
|
-
throw new HTTPException(400, {
|
|
1630
|
-
message
|
|
1631
|
-
});
|
|
1632
|
-
}
|
|
1633
|
-
break;
|
|
1634
|
-
case "form":
|
|
1635
|
-
{
|
|
1636
|
-
if (!contentType || !(multipartRegex.test(contentType) || urlencodedRegex.test(contentType))) break;
|
|
1637
|
-
let formData;
|
|
1638
|
-
if (c.req.bodyCache.formData) formData = await c.req.bodyCache.formData;
|
|
1639
|
-
else try {
|
|
1640
|
-
const arrayBuffer = await c.req.arrayBuffer();
|
|
1641
|
-
formData = await bufferToFormData(arrayBuffer, contentType);
|
|
1642
|
-
c.req.bodyCache.formData = formData;
|
|
1643
|
-
} catch (e) {
|
|
1644
|
-
let message = "Malformed FormData request.";
|
|
1645
|
-
message += e instanceof Error ? ` ${e.message}` : ` ${String(e)}`;
|
|
1646
|
-
throw new HTTPException(400, {
|
|
1647
|
-
message
|
|
1648
|
-
});
|
|
1649
|
-
}
|
|
1650
|
-
const form = {};
|
|
1651
|
-
formData.forEach((value2, key)=>{
|
|
1652
|
-
if (key.endsWith("[]")) (form[key] ??= []).push(value2);
|
|
1653
|
-
else if (Array.isArray(form[key])) form[key].push(value2);
|
|
1654
|
-
else if (key in form) form[key] = [
|
|
1655
|
-
form[key],
|
|
1656
|
-
value2
|
|
1657
|
-
];
|
|
1658
|
-
else form[key] = value2;
|
|
1659
|
-
});
|
|
1660
|
-
value = form;
|
|
1661
|
-
break;
|
|
1662
|
-
}
|
|
1663
|
-
case "query":
|
|
1664
|
-
value = Object.fromEntries(Object.entries(c.req.queries()).map(([k, v])=>1 === v.length ? [
|
|
1665
|
-
k,
|
|
1666
|
-
v[0]
|
|
1667
|
-
] : [
|
|
1668
|
-
k,
|
|
1669
|
-
v
|
|
1670
|
-
]));
|
|
1671
|
-
break;
|
|
1672
|
-
case "param":
|
|
1673
|
-
value = c.req.param();
|
|
1674
|
-
break;
|
|
1675
|
-
case "header":
|
|
1676
|
-
value = c.req.header();
|
|
1677
|
-
break;
|
|
1678
|
-
case "cookie":
|
|
1679
|
-
value = getCookie(c);
|
|
1680
|
-
break;
|
|
1681
|
-
}
|
|
1682
|
-
const res = await validationFunc(value, c);
|
|
1683
|
-
if (res instanceof Response) return res;
|
|
1684
|
-
c.req.addValidatedData(target, res);
|
|
1685
|
-
await next();
|
|
1686
|
-
};
|
|
1687
|
-
var store;
|
|
1688
|
-
function getGlobalConfig(config2) {
|
|
1689
|
-
return {
|
|
1690
|
-
lang: config2?.lang ?? store?.lang,
|
|
1691
|
-
message: config2?.message,
|
|
1692
|
-
abortEarly: config2?.abortEarly ?? store?.abortEarly,
|
|
1693
|
-
abortPipeEarly: config2?.abortPipeEarly ?? store?.abortPipeEarly
|
|
1694
|
-
};
|
|
1695
|
-
}
|
|
1696
|
-
var store2;
|
|
1697
|
-
function getGlobalMessage(lang) {
|
|
1698
|
-
return store2?.get(lang);
|
|
1699
|
-
}
|
|
1700
|
-
var store3;
|
|
1701
|
-
function getSchemaMessage(lang) {
|
|
1702
|
-
return store3?.get(lang);
|
|
1703
|
-
}
|
|
1704
|
-
var store4;
|
|
1705
|
-
function getSpecificMessage(reference, lang) {
|
|
1706
|
-
return store4?.get(reference)?.get(lang);
|
|
1707
|
-
}
|
|
1708
|
-
function _stringify(input) {
|
|
1709
|
-
const type = typeof input;
|
|
1710
|
-
if ("string" === type) return `"${input}"`;
|
|
1711
|
-
if ("number" === type || "bigint" === type || "boolean" === type) return `${input}`;
|
|
1712
|
-
if ("object" === type || "function" === type) return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
|
|
1713
|
-
return type;
|
|
1714
|
-
}
|
|
1715
|
-
function _addIssue(context, label, dataset, config2, other) {
|
|
1716
|
-
const input = other && "input" in other ? other.input : dataset.value;
|
|
1717
|
-
const expected = other?.expected ?? context.expects ?? null;
|
|
1718
|
-
const received = other?.received ?? _stringify(input);
|
|
1719
|
-
const issue = {
|
|
1720
|
-
kind: context.kind,
|
|
1721
|
-
type: context.type,
|
|
1722
|
-
input,
|
|
1723
|
-
expected,
|
|
1724
|
-
received,
|
|
1725
|
-
message: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : "R"}eceived ${received}`,
|
|
1726
|
-
requirement: context.requirement,
|
|
1727
|
-
path: other?.path,
|
|
1728
|
-
issues: other?.issues,
|
|
1729
|
-
lang: config2.lang,
|
|
1730
|
-
abortEarly: config2.abortEarly,
|
|
1731
|
-
abortPipeEarly: config2.abortPipeEarly
|
|
1732
|
-
};
|
|
1733
|
-
const isSchema = "schema" === context.kind;
|
|
1734
|
-
const message = other?.message ?? context.message ?? getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? getSchemaMessage(issue.lang) : null) ?? config2.message ?? getGlobalMessage(issue.lang);
|
|
1735
|
-
if (message) issue.message = "function" == typeof message ? message(issue) : message;
|
|
1736
|
-
if (isSchema) dataset.typed = false;
|
|
1737
|
-
if (dataset.issues) dataset.issues.push(issue);
|
|
1738
|
-
else dataset.issues = [
|
|
1739
|
-
issue
|
|
1740
|
-
];
|
|
1741
|
-
}
|
|
1742
|
-
function _joinExpects(values, separator) {
|
|
1743
|
-
const list = [
|
|
1744
|
-
...new Set(values)
|
|
1745
|
-
];
|
|
1746
|
-
if (list.length > 1) return `(${list.join(` ${separator} `)})`;
|
|
1747
|
-
return list[0] ?? "never";
|
|
1748
|
-
}
|
|
1749
|
-
function getDefault(schema, dataset, config2) {
|
|
1750
|
-
return "function" == typeof schema.default ? schema.default(dataset, config2) : schema.default;
|
|
1751
|
-
}
|
|
1752
|
-
function dist_boolean(message) {
|
|
1753
|
-
return {
|
|
1754
|
-
kind: "schema",
|
|
1755
|
-
type: "boolean",
|
|
1756
|
-
reference: dist_boolean,
|
|
1757
|
-
expects: "boolean",
|
|
1758
|
-
async: false,
|
|
1759
|
-
message,
|
|
1760
|
-
_run (dataset, config2) {
|
|
1761
|
-
if ("boolean" == typeof dataset.value) dataset.typed = true;
|
|
1762
|
-
else _addIssue(this, "type", dataset, config2);
|
|
1763
|
-
return dataset;
|
|
1764
|
-
}
|
|
1765
|
-
};
|
|
1766
|
-
}
|
|
1767
|
-
function literal(literal_, message) {
|
|
1768
|
-
return {
|
|
1769
|
-
kind: "schema",
|
|
1770
|
-
type: "literal",
|
|
1771
|
-
reference: literal,
|
|
1772
|
-
expects: _stringify(literal_),
|
|
1773
|
-
async: false,
|
|
1774
|
-
literal: literal_,
|
|
1775
|
-
message,
|
|
1776
|
-
_run (dataset, config2) {
|
|
1777
|
-
if (dataset.value === this.literal) dataset.typed = true;
|
|
1778
|
-
else _addIssue(this, "type", dataset, config2);
|
|
1779
|
-
return dataset;
|
|
1780
|
-
}
|
|
1781
|
-
};
|
|
1782
|
-
}
|
|
1783
|
-
function nullable(wrapped, ...args) {
|
|
1784
|
-
const schema = {
|
|
1785
|
-
kind: "schema",
|
|
1786
|
-
type: "nullable",
|
|
1787
|
-
reference: nullable,
|
|
1788
|
-
expects: `(${wrapped.expects} | null)`,
|
|
1789
|
-
async: false,
|
|
1790
|
-
wrapped,
|
|
1791
|
-
_run (dataset, config2) {
|
|
1792
|
-
if (null === dataset.value) {
|
|
1793
|
-
if ("default" in this) dataset.value = getDefault(this, dataset, config2);
|
|
1794
|
-
if (null === dataset.value) {
|
|
1795
|
-
dataset.typed = true;
|
|
1796
|
-
return dataset;
|
|
1797
|
-
}
|
|
1798
|
-
}
|
|
1799
|
-
return this.wrapped._run(dataset, config2);
|
|
1800
|
-
}
|
|
1801
|
-
};
|
|
1802
|
-
if (0 in args) schema.default = args[0];
|
|
1803
|
-
return schema;
|
|
1804
|
-
}
|
|
1805
|
-
function dist_object(entries, message) {
|
|
1806
|
-
return {
|
|
1807
|
-
kind: "schema",
|
|
1808
|
-
type: "object",
|
|
1809
|
-
reference: dist_object,
|
|
1810
|
-
expects: "Object",
|
|
1811
|
-
async: false,
|
|
1812
|
-
entries,
|
|
1813
|
-
message,
|
|
1814
|
-
_run (dataset, config2) {
|
|
1815
|
-
const input = dataset.value;
|
|
1816
|
-
if (input && "object" == typeof input) {
|
|
1817
|
-
dataset.typed = true;
|
|
1818
|
-
dataset.value = {};
|
|
1819
|
-
for(const key in this.entries){
|
|
1820
|
-
const value2 = input[key];
|
|
1821
|
-
const valueDataset = this.entries[key]._run({
|
|
1822
|
-
typed: false,
|
|
1823
|
-
value: value2
|
|
1824
|
-
}, config2);
|
|
1825
|
-
if (valueDataset.issues) {
|
|
1826
|
-
const pathItem = {
|
|
1827
|
-
type: "object",
|
|
1828
|
-
origin: "value",
|
|
1829
|
-
input,
|
|
1830
|
-
key,
|
|
1831
|
-
value: value2
|
|
1832
|
-
};
|
|
1833
|
-
for (const issue of valueDataset.issues){
|
|
1834
|
-
if (issue.path) issue.path.unshift(pathItem);
|
|
1835
|
-
else issue.path = [
|
|
1836
|
-
pathItem
|
|
1837
|
-
];
|
|
1838
|
-
dataset.issues?.push(issue);
|
|
1839
|
-
}
|
|
1840
|
-
if (!dataset.issues) dataset.issues = valueDataset.issues;
|
|
1841
|
-
if (config2.abortEarly) {
|
|
1842
|
-
dataset.typed = false;
|
|
1843
|
-
break;
|
|
1844
|
-
}
|
|
1845
|
-
}
|
|
1846
|
-
if (!valueDataset.typed) dataset.typed = false;
|
|
1847
|
-
if (void 0 !== valueDataset.value || key in input) dataset.value[key] = valueDataset.value;
|
|
1848
|
-
}
|
|
1849
|
-
} else _addIssue(this, "type", dataset, config2);
|
|
1850
|
-
return dataset;
|
|
1851
|
-
}
|
|
1852
|
-
};
|
|
1853
|
-
}
|
|
1854
|
-
function optional(wrapped, ...args) {
|
|
1855
|
-
const schema = {
|
|
1856
|
-
kind: "schema",
|
|
1857
|
-
type: "optional",
|
|
1858
|
-
reference: optional,
|
|
1859
|
-
expects: `(${wrapped.expects} | undefined)`,
|
|
1860
|
-
async: false,
|
|
1861
|
-
wrapped,
|
|
1862
|
-
_run (dataset, config2) {
|
|
1863
|
-
if (void 0 === dataset.value) {
|
|
1864
|
-
if ("default" in this) dataset.value = getDefault(this, dataset, config2);
|
|
1865
|
-
if (void 0 === dataset.value) {
|
|
1866
|
-
dataset.typed = true;
|
|
1867
|
-
return dataset;
|
|
1868
|
-
}
|
|
1869
|
-
}
|
|
1870
|
-
return this.wrapped._run(dataset, config2);
|
|
2387
|
+
var _validateReport = __webpack_require__("../../node_modules/.pnpm/typia@8.0.3_@samchon+openapi@3.1.0_typescript@5.6.3/node_modules/typia/lib/internal/_validateReport.js");
|
|
2388
|
+
var cjs = __webpack_require__("../../node_modules/.pnpm/@hono+typia-validator@0.1.0_hono@4.6.3_typia@8.0.3_@samchon+openapi@3.1.0_typescript@5.6.3_/node_modules/@hono/typia-validator/dist/cjs/index.js");
|
|
2389
|
+
const queryBundlesSchema = (()=>{
|
|
2390
|
+
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);
|
|
2391
|
+
const _vo0 = (input, _path, _exceptionable = true)=>[
|
|
2392
|
+
void 0 === input.channel || "string" == typeof input.channel || _report(_exceptionable, {
|
|
2393
|
+
path: _path + ".channel",
|
|
2394
|
+
expected: "(string | undefined)",
|
|
2395
|
+
value: input.channel
|
|
2396
|
+
}),
|
|
2397
|
+
void 0 === input.platform || "ios" === input.platform || "android" === input.platform || _report(_exceptionable, {
|
|
2398
|
+
path: _path + ".platform",
|
|
2399
|
+
expected: "(\"android\" | \"ios\" | undefined)",
|
|
2400
|
+
value: input.platform
|
|
2401
|
+
}),
|
|
2402
|
+
void 0 === input.limit || "string" == typeof input.limit || _report(_exceptionable, {
|
|
2403
|
+
path: _path + ".limit",
|
|
2404
|
+
expected: "(string | undefined)",
|
|
2405
|
+
value: input.limit
|
|
2406
|
+
}),
|
|
2407
|
+
void 0 === input.offset || "string" == typeof input.offset || _report(_exceptionable, {
|
|
2408
|
+
path: _path + ".offset",
|
|
2409
|
+
expected: "(string | undefined)",
|
|
2410
|
+
value: input.offset
|
|
2411
|
+
})
|
|
2412
|
+
].every((flag)=>flag);
|
|
2413
|
+
const __is = (input)=>"object" == typeof input && null !== input && false === Array.isArray(input) && _io0(input);
|
|
2414
|
+
let errors;
|
|
2415
|
+
let _report;
|
|
2416
|
+
return (input)=>{
|
|
2417
|
+
if (false === __is(input)) {
|
|
2418
|
+
errors = [];
|
|
2419
|
+
_report = _validateReport._validateReport(errors);
|
|
2420
|
+
((input, _path, _exceptionable = true)=>("object" == typeof input && null !== input && false === Array.isArray(input) || _report(true, {
|
|
2421
|
+
path: _path + "",
|
|
2422
|
+
expected: "__type",
|
|
2423
|
+
value: input
|
|
2424
|
+
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
2425
|
+
path: _path + "",
|
|
2426
|
+
expected: "__type",
|
|
2427
|
+
value: input
|
|
2428
|
+
}))(input, "$input", true);
|
|
2429
|
+
const success = 0 === errors.length;
|
|
2430
|
+
return success ? {
|
|
2431
|
+
success,
|
|
2432
|
+
data: input
|
|
2433
|
+
} : {
|
|
2434
|
+
success,
|
|
2435
|
+
errors,
|
|
2436
|
+
data: input
|
|
2437
|
+
};
|
|
1871
2438
|
}
|
|
2439
|
+
return {
|
|
2440
|
+
success: true,
|
|
2441
|
+
data: input
|
|
2442
|
+
};
|
|
1872
2443
|
};
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
2444
|
+
})();
|
|
2445
|
+
const paramBundleIdSchema = (()=>{
|
|
2446
|
+
const _io0 = (input)=>"string" == typeof input.bundleId;
|
|
2447
|
+
const _vo0 = (input, _path, _exceptionable = true)=>[
|
|
2448
|
+
"string" == typeof input.bundleId || _report(_exceptionable, {
|
|
2449
|
+
path: _path + ".bundleId",
|
|
2450
|
+
expected: "string",
|
|
2451
|
+
value: input.bundleId
|
|
2452
|
+
})
|
|
2453
|
+
].every((flag)=>flag);
|
|
2454
|
+
const __is = (input)=>"object" == typeof input && null !== input && _io0(input);
|
|
2455
|
+
let errors;
|
|
2456
|
+
let _report;
|
|
2457
|
+
return (input)=>{
|
|
2458
|
+
if (false === __is(input)) {
|
|
2459
|
+
errors = [];
|
|
2460
|
+
_report = _validateReport._validateReport(errors);
|
|
2461
|
+
((input, _path, _exceptionable = true)=>("object" == typeof input && null !== input || _report(true, {
|
|
2462
|
+
path: _path + "",
|
|
2463
|
+
expected: "__type",
|
|
2464
|
+
value: input
|
|
2465
|
+
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
2466
|
+
path: _path + "",
|
|
2467
|
+
expected: "__type",
|
|
2468
|
+
value: input
|
|
2469
|
+
}))(input, "$input", true);
|
|
2470
|
+
const success = 0 === errors.length;
|
|
2471
|
+
return success ? {
|
|
2472
|
+
success,
|
|
2473
|
+
data: input
|
|
2474
|
+
} : {
|
|
2475
|
+
success,
|
|
2476
|
+
errors,
|
|
2477
|
+
data: input
|
|
2478
|
+
};
|
|
1888
2479
|
}
|
|
2480
|
+
return {
|
|
2481
|
+
success: true,
|
|
2482
|
+
data: input
|
|
2483
|
+
};
|
|
1889
2484
|
};
|
|
1890
|
-
}
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
2485
|
+
})();
|
|
2486
|
+
const updateBundleSchema = (()=>{
|
|
2487
|
+
const _io0 = (input)=>(void 0 === input.id || "string" == typeof input.id) && (void 0 === input.platform || "ios" === input.platform || "android" === input.platform) && (void 0 === input.targetAppVersion || "string" == typeof input.targetAppVersion) && (void 0 === input.shouldForceUpdate || "boolean" == typeof input.shouldForceUpdate) && (void 0 === input.enabled || "boolean" == typeof input.enabled) && (void 0 === input.fileHash || "string" == typeof input.fileHash) && (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);
|
|
2488
|
+
const _vo0 = (input, _path, _exceptionable = true)=>[
|
|
2489
|
+
void 0 === input.id || "string" == typeof input.id || _report(_exceptionable, {
|
|
2490
|
+
path: _path + ".id",
|
|
2491
|
+
expected: "(string | undefined)",
|
|
2492
|
+
value: input.id
|
|
2493
|
+
}),
|
|
2494
|
+
void 0 === input.platform || "ios" === input.platform || "android" === input.platform || _report(_exceptionable, {
|
|
2495
|
+
path: _path + ".platform",
|
|
2496
|
+
expected: "(\"android\" | \"ios\" | undefined)",
|
|
2497
|
+
value: input.platform
|
|
2498
|
+
}),
|
|
2499
|
+
void 0 === input.targetAppVersion || "string" == typeof input.targetAppVersion || _report(_exceptionable, {
|
|
2500
|
+
path: _path + ".targetAppVersion",
|
|
2501
|
+
expected: "(string | undefined)",
|
|
2502
|
+
value: input.targetAppVersion
|
|
2503
|
+
}),
|
|
2504
|
+
void 0 === input.shouldForceUpdate || "boolean" == typeof input.shouldForceUpdate || _report(_exceptionable, {
|
|
2505
|
+
path: _path + ".shouldForceUpdate",
|
|
2506
|
+
expected: "(boolean | undefined)",
|
|
2507
|
+
value: input.shouldForceUpdate
|
|
2508
|
+
}),
|
|
2509
|
+
void 0 === input.enabled || "boolean" == typeof input.enabled || _report(_exceptionable, {
|
|
2510
|
+
path: _path + ".enabled",
|
|
2511
|
+
expected: "(boolean | undefined)",
|
|
2512
|
+
value: input.enabled
|
|
2513
|
+
}),
|
|
2514
|
+
void 0 === input.fileHash || "string" == typeof input.fileHash || _report(_exceptionable, {
|
|
2515
|
+
path: _path + ".fileHash",
|
|
2516
|
+
expected: "(string | undefined)",
|
|
2517
|
+
value: input.fileHash
|
|
2518
|
+
}),
|
|
2519
|
+
null === input.gitCommitHash || void 0 === input.gitCommitHash || "string" == typeof input.gitCommitHash || _report(_exceptionable, {
|
|
2520
|
+
path: _path + ".gitCommitHash",
|
|
2521
|
+
expected: "(null | string | undefined)",
|
|
2522
|
+
value: input.gitCommitHash
|
|
2523
|
+
}),
|
|
2524
|
+
null === input.message || void 0 === input.message || "string" == typeof input.message || _report(_exceptionable, {
|
|
2525
|
+
path: _path + ".message",
|
|
2526
|
+
expected: "(null | string | undefined)",
|
|
2527
|
+
value: input.message
|
|
2528
|
+
}),
|
|
2529
|
+
void 0 === input.channel || "string" == typeof input.channel || _report(_exceptionable, {
|
|
2530
|
+
path: _path + ".channel",
|
|
2531
|
+
expected: "(string | undefined)",
|
|
2532
|
+
value: input.channel
|
|
2533
|
+
})
|
|
2534
|
+
].every((flag)=>flag);
|
|
2535
|
+
const __is = (input)=>"object" == typeof input && null !== input && false === Array.isArray(input) && _io0(input);
|
|
2536
|
+
let errors;
|
|
2537
|
+
let _report;
|
|
2538
|
+
return (input)=>{
|
|
2539
|
+
if (false === __is(input)) {
|
|
2540
|
+
errors = [];
|
|
2541
|
+
_report = _validateReport._validateReport(errors);
|
|
2542
|
+
((input, _path, _exceptionable = true)=>("object" == typeof input && null !== input && false === Array.isArray(input) || _report(true, {
|
|
2543
|
+
path: _path + "",
|
|
2544
|
+
expected: "Partial<Bundle>",
|
|
2545
|
+
value: input
|
|
2546
|
+
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
2547
|
+
path: _path + "",
|
|
2548
|
+
expected: "Partial<Bundle>",
|
|
2549
|
+
value: input
|
|
2550
|
+
}))(input, "$input", true);
|
|
2551
|
+
const success = 0 === errors.length;
|
|
2552
|
+
return success ? {
|
|
2553
|
+
success,
|
|
2554
|
+
data: input
|
|
2555
|
+
} : {
|
|
2556
|
+
success,
|
|
2557
|
+
errors,
|
|
2558
|
+
data: input
|
|
2559
|
+
};
|
|
1944
2560
|
}
|
|
2561
|
+
return {
|
|
2562
|
+
success: true,
|
|
2563
|
+
data: input
|
|
2564
|
+
};
|
|
1945
2565
|
};
|
|
1946
|
-
}
|
|
1947
|
-
|
|
1948
|
-
const entries = {
|
|
1949
|
-
...schema.entries
|
|
1950
|
-
};
|
|
1951
|
-
for (const key of keys)delete entries[key];
|
|
1952
|
-
return {
|
|
1953
|
-
...schema,
|
|
1954
|
-
entries
|
|
1955
|
-
};
|
|
1956
|
-
}
|
|
1957
|
-
function partial(schema, keys) {
|
|
1958
|
-
const entries = {};
|
|
1959
|
-
for(const key in schema.entries)entries[key] = !keys || keys.includes(key) ? optional(schema.entries[key]) : schema.entries[key];
|
|
1960
|
-
return {
|
|
1961
|
-
...schema,
|
|
1962
|
-
entries
|
|
1963
|
-
};
|
|
1964
|
-
}
|
|
1965
|
-
async function safeParseAsync(schema, input, config2) {
|
|
1966
|
-
const dataset = await schema._run({
|
|
1967
|
-
typed: false,
|
|
1968
|
-
value: input
|
|
1969
|
-
}, getGlobalConfig(config2));
|
|
1970
|
-
return {
|
|
1971
|
-
typed: dataset.typed,
|
|
1972
|
-
success: !dataset.issues,
|
|
1973
|
-
output: dataset.value,
|
|
1974
|
-
issues: dataset.issues
|
|
1975
|
-
};
|
|
1976
|
-
}
|
|
1977
|
-
var vValidator = (target, schema, hook)=>validator(target, async (value, c)=>{
|
|
1978
|
-
const result = await safeParseAsync(schema, value);
|
|
1979
|
-
if (hook) {
|
|
1980
|
-
const hookResult = hook(result, c);
|
|
1981
|
-
if (hookResult instanceof Response || hookResult instanceof Promise) return hookResult;
|
|
1982
|
-
}
|
|
1983
|
-
if (!result.success) return c.json(result, 400);
|
|
1984
|
-
const data = result.output;
|
|
1985
|
-
return data;
|
|
1986
|
-
});
|
|
1987
|
-
const bundleSchema = dist_object({
|
|
1988
|
-
platform: union([
|
|
1989
|
-
literal("ios"),
|
|
1990
|
-
literal("android")
|
|
1991
|
-
]),
|
|
1992
|
-
targetAppVersion: string(),
|
|
1993
|
-
id: string(),
|
|
1994
|
-
shouldForceUpdate: dist_boolean(),
|
|
1995
|
-
enabled: dist_boolean(),
|
|
1996
|
-
fileUrl: string(),
|
|
1997
|
-
fileHash: string(),
|
|
1998
|
-
gitCommitHash: nullable(string()),
|
|
1999
|
-
message: nullable(string())
|
|
2000
|
-
});
|
|
2001
|
-
let rpc_config = null;
|
|
2002
|
-
let rpc_databasePlugin = null;
|
|
2566
|
+
})();
|
|
2567
|
+
let configPromise = null;
|
|
2003
2568
|
const prepareConfig = async ()=>{
|
|
2004
|
-
if (!
|
|
2005
|
-
|
|
2006
|
-
|
|
2569
|
+
if (!configPromise) configPromise = (async ()=>{
|
|
2570
|
+
try {
|
|
2571
|
+
const config = await (0, __WEBPACK_EXTERNAL_MODULE__hot_updater_plugin_core_40c1c502__.loadConfig)(null);
|
|
2572
|
+
const databasePlugin = await config?.database({
|
|
2573
|
+
cwd: __WEBPACK_EXTERNAL_MODULE__hot_updater_plugin_core_40c1c502__.getCwd()
|
|
2574
|
+
}) ?? null;
|
|
2575
|
+
if (!databasePlugin) throw new Error("Database plugin initialization failed");
|
|
2576
|
+
return {
|
|
2577
|
+
config,
|
|
2578
|
+
databasePlugin
|
|
2579
|
+
};
|
|
2580
|
+
} catch (error) {
|
|
2581
|
+
console.error("Error during configuration initialization:", error);
|
|
2582
|
+
throw error;
|
|
2583
|
+
}
|
|
2584
|
+
})();
|
|
2585
|
+
return configPromise;
|
|
2586
|
+
};
|
|
2587
|
+
const rpc = new hono_Hono().get("/config", async (c)=>{
|
|
2588
|
+
try {
|
|
2589
|
+
const { config } = await prepareConfig();
|
|
2590
|
+
return c.json({
|
|
2591
|
+
console: config.console
|
|
2007
2592
|
});
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2593
|
+
} catch (error) {
|
|
2594
|
+
console.error("Error during config retrieval:", error);
|
|
2595
|
+
throw error;
|
|
2596
|
+
}
|
|
2597
|
+
}).get("/channels", async (c)=>{
|
|
2598
|
+
try {
|
|
2599
|
+
const { databasePlugin } = await prepareConfig();
|
|
2600
|
+
const channels = await databasePlugin.getChannels();
|
|
2601
|
+
return c.json(channels ?? []);
|
|
2602
|
+
} catch (error) {
|
|
2603
|
+
console.error("Error during channel retrieval:", error);
|
|
2604
|
+
throw error;
|
|
2605
|
+
}
|
|
2606
|
+
}).get("/config-loaded", (c)=>{
|
|
2607
|
+
try {
|
|
2608
|
+
const isLoaded = !!configPromise;
|
|
2609
|
+
return c.json({
|
|
2610
|
+
configLoaded: isLoaded
|
|
2611
|
+
});
|
|
2612
|
+
} catch (error) {
|
|
2613
|
+
console.error("Error during config loaded retrieval:", error);
|
|
2614
|
+
throw error;
|
|
2615
|
+
}
|
|
2616
|
+
}).get("/bundles", (0, cjs.typiaValidator)("query", queryBundlesSchema), async (c)=>{
|
|
2617
|
+
try {
|
|
2618
|
+
const query = c.req.valid("query");
|
|
2619
|
+
const { databasePlugin } = await prepareConfig();
|
|
2620
|
+
const bundles = await databasePlugin.getBundles({
|
|
2621
|
+
where: {
|
|
2622
|
+
channel: query.channel ?? void 0,
|
|
2623
|
+
platform: query.platform ?? void 0
|
|
2624
|
+
},
|
|
2625
|
+
limit: query.limit ? Number(query.limit) : void 0,
|
|
2626
|
+
offset: query.offset ? Number(query.offset) : void 0
|
|
2627
|
+
});
|
|
2628
|
+
return c.json(bundles ?? []);
|
|
2629
|
+
} catch (error) {
|
|
2630
|
+
console.error("Error during bundle retrieval:", error);
|
|
2631
|
+
throw error;
|
|
2632
|
+
}
|
|
2633
|
+
}).get("/bundles/:bundleId", (0, cjs.typiaValidator)("param", paramBundleIdSchema), async (c)=>{
|
|
2634
|
+
try {
|
|
2635
|
+
const { bundleId } = c.req.valid("param");
|
|
2636
|
+
const { databasePlugin } = await prepareConfig();
|
|
2637
|
+
const bundle = await databasePlugin.getBundleById(bundleId);
|
|
2638
|
+
return c.json(bundle ?? null);
|
|
2639
|
+
} catch (error) {
|
|
2640
|
+
console.error("Error during bundle retrieval:", error);
|
|
2641
|
+
throw error;
|
|
2642
|
+
}
|
|
2643
|
+
}).patch("/bundles/:bundleId", (0, cjs.typiaValidator)("json", updateBundleSchema), async (c)=>{
|
|
2644
|
+
try {
|
|
2645
|
+
const bundleId = c.req.param("bundleId");
|
|
2646
|
+
const partialBundle = c.req.valid("json");
|
|
2647
|
+
if (!bundleId) return c.json({
|
|
2648
|
+
error: "Target bundle ID is required"
|
|
2649
|
+
}, 400);
|
|
2650
|
+
const { databasePlugin } = await prepareConfig();
|
|
2651
|
+
await databasePlugin.updateBundle(bundleId, partialBundle);
|
|
2652
|
+
await databasePlugin.commitBundle();
|
|
2653
|
+
return c.json({
|
|
2654
|
+
success: true
|
|
2655
|
+
});
|
|
2656
|
+
} catch (error) {
|
|
2657
|
+
console.error("Error during bundle update:", error);
|
|
2658
|
+
if (error && "object" == typeof error && "message" in error) return c.json({
|
|
2659
|
+
error: error.message
|
|
2660
|
+
}, 500);
|
|
2661
|
+
return c.json({
|
|
2662
|
+
error: "Unknown error"
|
|
2663
|
+
}, 500);
|
|
2011
2664
|
}
|
|
2012
|
-
return {
|
|
2013
|
-
config: rpc_config,
|
|
2014
|
-
databasePlugin: rpc_databasePlugin
|
|
2015
|
-
};
|
|
2016
|
-
};
|
|
2017
|
-
const rpc = new hono_Hono().get("/getConfig", async (c)=>{
|
|
2018
|
-
const { config } = await prepareConfig();
|
|
2019
|
-
return c.json({
|
|
2020
|
-
console: config?.console
|
|
2021
|
-
});
|
|
2022
|
-
}).get("/isConfigLoaded", (c)=>c.json(null !== rpc_config)).get("/getBundles", async (c)=>{
|
|
2023
|
-
const { databasePlugin } = await prepareConfig();
|
|
2024
|
-
const bundles = await databasePlugin?.getBundles(true);
|
|
2025
|
-
return c.json(bundles ?? []);
|
|
2026
|
-
}).get("/getBundleById", vValidator("query", dist_object({
|
|
2027
|
-
bundleId: string()
|
|
2028
|
-
})), async (c)=>{
|
|
2029
|
-
const { bundleId } = c.req.valid("query");
|
|
2030
|
-
const { databasePlugin } = await prepareConfig();
|
|
2031
|
-
const bundle = await databasePlugin?.getBundleById(bundleId);
|
|
2032
|
-
return c.json(bundle ?? null);
|
|
2033
|
-
}).post("/updateBundle", vValidator("json", dist_object({
|
|
2034
|
-
targetBundleId: string(),
|
|
2035
|
-
bundle: partial(omit(bundleSchema, [
|
|
2036
|
-
"id"
|
|
2037
|
-
]))
|
|
2038
|
-
})), async (c)=>{
|
|
2039
|
-
const { targetBundleId, bundle } = c.req.valid("json");
|
|
2040
|
-
const { databasePlugin } = await prepareConfig();
|
|
2041
|
-
await databasePlugin?.updateBundle(targetBundleId, bundle);
|
|
2042
|
-
await databasePlugin?.commitBundle();
|
|
2043
|
-
return c.json(true);
|
|
2044
2665
|
});
|
|
2045
2666
|
const src_server_rslib_entry_dirname = __WEBPACK_EXTERNAL_MODULE_path__["default"].dirname((0, __WEBPACK_EXTERNAL_MODULE_url__.fileURLToPath)(import.meta.url));
|
|
2046
2667
|
const relativePathToScript = __WEBPACK_EXTERNAL_MODULE_path__["default"].relative(process.cwd(), src_server_rslib_entry_dirname);
|