@hot-updater/console 0.12.6 → 0.12.7
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-CiYz-DpZ.js +585 -0
- package/dist/assets/index-y9HrkcYR.css +1 -0
- package/dist/index.cjs +2464 -1943
- package/dist/index.html +2 -2
- package/dist/index.js +971 -451
- package/dist/src/components/ui/button.d.ts +1 -1
- package/dist/src/components/ui/toast.d.ts +41 -0
- package/dist/src/lib/api.d.ts +2 -11
- package/dist/src-server/index.d.ts +2 -11
- package/dist/src-server/rpc.d.ts +3 -23
- 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,452 +2384,147 @@ 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
|
-
this.res = options?.res;
|
|
1593
|
-
this.status = status;
|
|
1594
|
-
}
|
|
1595
|
-
getResponse() {
|
|
1596
|
-
if (this.res) {
|
|
1597
|
-
const newResponse = new Response(this.res.body, {
|
|
1598
|
-
status: this.status,
|
|
1599
|
-
headers: this.res.headers
|
|
1600
|
-
});
|
|
1601
|
-
return newResponse;
|
|
1602
|
-
}
|
|
1603
|
-
return new Response(this.message, {
|
|
1604
|
-
status: this.status
|
|
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);
|
|
1871
|
-
}
|
|
1872
|
-
};
|
|
1873
|
-
if (0 in args) schema.default = args[0];
|
|
1874
|
-
return schema;
|
|
1875
|
-
}
|
|
1876
|
-
function string(message) {
|
|
1877
|
-
return {
|
|
1878
|
-
kind: "schema",
|
|
1879
|
-
type: "string",
|
|
1880
|
-
reference: string,
|
|
1881
|
-
expects: "string",
|
|
1882
|
-
async: false,
|
|
1883
|
-
message,
|
|
1884
|
-
_run (dataset, config2) {
|
|
1885
|
-
if ("string" == typeof dataset.value) dataset.typed = true;
|
|
1886
|
-
else _addIssue(this, "type", dataset, config2);
|
|
1887
|
-
return dataset;
|
|
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 bundleIdValidator = (()=>{
|
|
2390
|
+
const _io0 = (input)=>"string" == typeof input.bundleId;
|
|
2391
|
+
const _vo0 = (input, _path, _exceptionable = true)=>[
|
|
2392
|
+
"string" == typeof input.bundleId || _report(_exceptionable, {
|
|
2393
|
+
path: _path + ".bundleId",
|
|
2394
|
+
expected: "string",
|
|
2395
|
+
value: input.bundleId
|
|
2396
|
+
})
|
|
2397
|
+
].every((flag)=>flag);
|
|
2398
|
+
const __is = (input)=>"object" == typeof input && null !== input && _io0(input);
|
|
2399
|
+
let errors;
|
|
2400
|
+
let _report;
|
|
2401
|
+
return (input)=>{
|
|
2402
|
+
if (false === __is(input)) {
|
|
2403
|
+
errors = [];
|
|
2404
|
+
_report = _validateReport._validateReport(errors);
|
|
2405
|
+
((input, _path, _exceptionable = true)=>("object" == typeof input && null !== input || _report(true, {
|
|
2406
|
+
path: _path + "",
|
|
2407
|
+
expected: "__type",
|
|
2408
|
+
value: input
|
|
2409
|
+
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
2410
|
+
path: _path + "",
|
|
2411
|
+
expected: "__type",
|
|
2412
|
+
value: input
|
|
2413
|
+
}))(input, "$input", true);
|
|
2414
|
+
const success = 0 === errors.length;
|
|
2415
|
+
return success ? {
|
|
2416
|
+
success,
|
|
2417
|
+
data: input
|
|
2418
|
+
} : {
|
|
2419
|
+
success,
|
|
2420
|
+
errors,
|
|
2421
|
+
data: input
|
|
2422
|
+
};
|
|
1888
2423
|
}
|
|
2424
|
+
return {
|
|
2425
|
+
success: true,
|
|
2426
|
+
data: input
|
|
2427
|
+
};
|
|
1889
2428
|
};
|
|
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
|
-
|
|
2429
|
+
})();
|
|
2430
|
+
const updateBundleValidator = (()=>{
|
|
2431
|
+
const _io0 = (input)=>"string" == typeof input.targetBundleId && "object" == typeof input.bundle && null !== input.bundle && false === Array.isArray(input.bundle) && _io1(input.bundle);
|
|
2432
|
+
const _io1 = (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.fileUrl || "string" == typeof input.fileUrl) && (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);
|
|
2433
|
+
const _vo0 = (input, _path, _exceptionable = true)=>[
|
|
2434
|
+
"string" == typeof input.targetBundleId || _report(_exceptionable, {
|
|
2435
|
+
path: _path + ".targetBundleId",
|
|
2436
|
+
expected: "string",
|
|
2437
|
+
value: input.targetBundleId
|
|
2438
|
+
}),
|
|
2439
|
+
("object" == typeof input.bundle && null !== input.bundle && false === Array.isArray(input.bundle) || _report(_exceptionable, {
|
|
2440
|
+
path: _path + ".bundle",
|
|
2441
|
+
expected: "Partial<Bundle>",
|
|
2442
|
+
value: input.bundle
|
|
2443
|
+
})) && _vo1(input.bundle, _path + ".bundle", _exceptionable) || _report(_exceptionable, {
|
|
2444
|
+
path: _path + ".bundle",
|
|
2445
|
+
expected: "Partial<Bundle>",
|
|
2446
|
+
value: input.bundle
|
|
2447
|
+
})
|
|
2448
|
+
].every((flag)=>flag);
|
|
2449
|
+
const _vo1 = (input, _path, _exceptionable = true)=>[
|
|
2450
|
+
void 0 === input.id || "string" == typeof input.id || _report(_exceptionable, {
|
|
2451
|
+
path: _path + ".id",
|
|
2452
|
+
expected: "(string | undefined)",
|
|
2453
|
+
value: input.id
|
|
2454
|
+
}),
|
|
2455
|
+
void 0 === input.platform || "ios" === input.platform || "android" === input.platform || _report(_exceptionable, {
|
|
2456
|
+
path: _path + ".platform",
|
|
2457
|
+
expected: "(\"android\" | \"ios\" | undefined)",
|
|
2458
|
+
value: input.platform
|
|
2459
|
+
}),
|
|
2460
|
+
void 0 === input.targetAppVersion || "string" == typeof input.targetAppVersion || _report(_exceptionable, {
|
|
2461
|
+
path: _path + ".targetAppVersion",
|
|
2462
|
+
expected: "(string | undefined)",
|
|
2463
|
+
value: input.targetAppVersion
|
|
2464
|
+
}),
|
|
2465
|
+
void 0 === input.shouldForceUpdate || "boolean" == typeof input.shouldForceUpdate || _report(_exceptionable, {
|
|
2466
|
+
path: _path + ".shouldForceUpdate",
|
|
2467
|
+
expected: "(boolean | undefined)",
|
|
2468
|
+
value: input.shouldForceUpdate
|
|
2469
|
+
}),
|
|
2470
|
+
void 0 === input.enabled || "boolean" == typeof input.enabled || _report(_exceptionable, {
|
|
2471
|
+
path: _path + ".enabled",
|
|
2472
|
+
expected: "(boolean | undefined)",
|
|
2473
|
+
value: input.enabled
|
|
2474
|
+
}),
|
|
2475
|
+
void 0 === input.fileUrl || "string" == typeof input.fileUrl || _report(_exceptionable, {
|
|
2476
|
+
path: _path + ".fileUrl",
|
|
2477
|
+
expected: "(string | undefined)",
|
|
2478
|
+
value: input.fileUrl
|
|
2479
|
+
}),
|
|
2480
|
+
void 0 === input.fileHash || "string" == typeof input.fileHash || _report(_exceptionable, {
|
|
2481
|
+
path: _path + ".fileHash",
|
|
2482
|
+
expected: "(string | undefined)",
|
|
2483
|
+
value: input.fileHash
|
|
2484
|
+
}),
|
|
2485
|
+
null === input.gitCommitHash || void 0 === input.gitCommitHash || "string" == typeof input.gitCommitHash || _report(_exceptionable, {
|
|
2486
|
+
path: _path + ".gitCommitHash",
|
|
2487
|
+
expected: "(null | string | undefined)",
|
|
2488
|
+
value: input.gitCommitHash
|
|
2489
|
+
}),
|
|
2490
|
+
null === input.message || void 0 === input.message || "string" == typeof input.message || _report(_exceptionable, {
|
|
2491
|
+
path: _path + ".message",
|
|
2492
|
+
expected: "(null | string | undefined)",
|
|
2493
|
+
value: input.message
|
|
2494
|
+
})
|
|
2495
|
+
].every((flag)=>flag);
|
|
2496
|
+
const __is = (input)=>"object" == typeof input && null !== input && _io0(input);
|
|
2497
|
+
let errors;
|
|
2498
|
+
let _report;
|
|
2499
|
+
return (input)=>{
|
|
2500
|
+
if (false === __is(input)) {
|
|
2501
|
+
errors = [];
|
|
2502
|
+
_report = _validateReport._validateReport(errors);
|
|
2503
|
+
((input, _path, _exceptionable = true)=>("object" == typeof input && null !== input || _report(true, {
|
|
2504
|
+
path: _path + "",
|
|
2505
|
+
expected: "__type",
|
|
2506
|
+
value: input
|
|
2507
|
+
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
2508
|
+
path: _path + "",
|
|
2509
|
+
expected: "__type",
|
|
2510
|
+
value: input
|
|
2511
|
+
}))(input, "$input", true);
|
|
2512
|
+
const success = 0 === errors.length;
|
|
2513
|
+
return success ? {
|
|
2514
|
+
success,
|
|
2515
|
+
data: input
|
|
2516
|
+
} : {
|
|
2517
|
+
success,
|
|
2518
|
+
errors,
|
|
2519
|
+
data: input
|
|
2520
|
+
};
|
|
1944
2521
|
}
|
|
2522
|
+
return {
|
|
2523
|
+
success: true,
|
|
2524
|
+
data: input
|
|
2525
|
+
};
|
|
1945
2526
|
};
|
|
1946
|
-
}
|
|
1947
|
-
function omit(schema, keys) {
|
|
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
|
-
});
|
|
2527
|
+
})();
|
|
2001
2528
|
let rpc_config = null;
|
|
2002
2529
|
let rpc_databasePlugin = null;
|
|
2003
2530
|
const prepareConfig = async ()=>{
|
|
@@ -2023,19 +2550,12 @@ const rpc = new hono_Hono().get("/getConfig", async (c)=>{
|
|
|
2023
2550
|
const { databasePlugin } = await prepareConfig();
|
|
2024
2551
|
const bundles = await databasePlugin?.getBundles(true);
|
|
2025
2552
|
return c.json(bundles ?? []);
|
|
2026
|
-
}).get("/getBundleById",
|
|
2027
|
-
bundleId: string()
|
|
2028
|
-
})), async (c)=>{
|
|
2553
|
+
}).get("/getBundleById", (0, cjs.typiaValidator)("query", bundleIdValidator), async (c)=>{
|
|
2029
2554
|
const { bundleId } = c.req.valid("query");
|
|
2030
2555
|
const { databasePlugin } = await prepareConfig();
|
|
2031
2556
|
const bundle = await databasePlugin?.getBundleById(bundleId);
|
|
2032
2557
|
return c.json(bundle ?? null);
|
|
2033
|
-
}).post("/updateBundle",
|
|
2034
|
-
targetBundleId: string(),
|
|
2035
|
-
bundle: partial(omit(bundleSchema, [
|
|
2036
|
-
"id"
|
|
2037
|
-
]))
|
|
2038
|
-
})), async (c)=>{
|
|
2558
|
+
}).post("/updateBundle", (0, cjs.typiaValidator)("json", updateBundleValidator), async (c)=>{
|
|
2039
2559
|
const { targetBundleId, bundle } = c.req.valid("json");
|
|
2040
2560
|
const { databasePlugin } = await prepareConfig();
|
|
2041
2561
|
await databasePlugin?.updateBundle(targetBundleId, bundle);
|