@hot-updater/console 0.12.7 → 0.13.1
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 +313 -868
- package/dist/index.html +2 -2
- package/dist/index.js +313 -868
- package/dist/src/hooks/useFilter.d.ts +9 -0
- package/dist/src/lib/api.d.ts +90 -41
- package/dist/src/routes/_components/data-table.d.ts +5 -6
- package/dist/src-server/index.d.ts +57 -13
- package/dist/src-server/rpc.d.ts +64 -17
- package/package.json +5 -5
- package/dist/assets/index-CiYz-DpZ.js +0 -585
- package/dist/assets/index-y9HrkcYR.css +0 -1
package/dist/index.cjs
CHANGED
|
@@ -3,29 +3,6 @@ const __rslib_import_meta_url__ = /*#__PURE__*/ function() {
|
|
|
3
3
|
return 'undefined' == typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
|
|
4
4
|
}();
|
|
5
5
|
var __webpack_modules__ = {
|
|
6
|
-
"../../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, exports1, __webpack_require__) {
|
|
7
|
-
exports1.typiaValidator = void 0;
|
|
8
|
-
const validator_1 = __webpack_require__("../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/cjs/validator/index.js");
|
|
9
|
-
const typiaValidator = (target, validate, hook)=>(0, validator_1.validator)(target, async (value, c)=>{
|
|
10
|
-
const result = validate(value);
|
|
11
|
-
if (hook) {
|
|
12
|
-
const hookResult = await hook({
|
|
13
|
-
...result,
|
|
14
|
-
data: value
|
|
15
|
-
}, c);
|
|
16
|
-
if (hookResult) {
|
|
17
|
-
if (hookResult instanceof Response || hookResult instanceof Promise) return hookResult;
|
|
18
|
-
if ('response' in hookResult) return hookResult.response;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
if (!result.success) return c.json({
|
|
22
|
-
success: false,
|
|
23
|
-
error: result.errors
|
|
24
|
-
}, 400);
|
|
25
|
-
return result.data;
|
|
26
|
-
});
|
|
27
|
-
exports1.typiaValidator = typiaValidator;
|
|
28
|
-
},
|
|
29
6
|
"../../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, exports1) {
|
|
30
7
|
exports1._validateReport = void 0;
|
|
31
8
|
const _validateReport = (array)=>{
|
|
@@ -40,788 +17,6 @@ var __webpack_modules__ = {
|
|
|
40
17
|
};
|
|
41
18
|
};
|
|
42
19
|
exports1._validateReport = _validateReport;
|
|
43
|
-
},
|
|
44
|
-
"../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/cjs/helper/cookie/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
|
|
45
|
-
var __defProp = Object.defineProperty;
|
|
46
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
47
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
48
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
49
|
-
var __export = (target, all)=>{
|
|
50
|
-
for(var name in all)__defProp(target, name, {
|
|
51
|
-
get: all[name],
|
|
52
|
-
enumerable: true
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
var __copyProps = (to, from, except, desc)=>{
|
|
56
|
-
if (from && "object" == typeof from || "function" == typeof from) {
|
|
57
|
-
for (let key of __getOwnPropNames(from))if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
58
|
-
get: ()=>from[key],
|
|
59
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
return to;
|
|
63
|
-
};
|
|
64
|
-
var __toCommonJS = (mod)=>__copyProps(__defProp({}, "__esModule", {
|
|
65
|
-
value: true
|
|
66
|
-
}), mod);
|
|
67
|
-
var cookie_exports = {};
|
|
68
|
-
__export(cookie_exports, {
|
|
69
|
-
deleteCookie: ()=>deleteCookie,
|
|
70
|
-
getCookie: ()=>getCookie,
|
|
71
|
-
getSignedCookie: ()=>getSignedCookie,
|
|
72
|
-
setCookie: ()=>setCookie,
|
|
73
|
-
setSignedCookie: ()=>setSignedCookie
|
|
74
|
-
});
|
|
75
|
-
module.exports = __toCommonJS(cookie_exports);
|
|
76
|
-
var import_cookie = __webpack_require__("../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/cjs/utils/cookie.js");
|
|
77
|
-
const getCookie = (c, key, prefix)=>{
|
|
78
|
-
const cookie = c.req.raw.headers.get("Cookie");
|
|
79
|
-
if ("string" == typeof key) {
|
|
80
|
-
if (!cookie) return;
|
|
81
|
-
let finalKey = key;
|
|
82
|
-
if ("secure" === prefix) finalKey = "__Secure-" + key;
|
|
83
|
-
else if ("host" === prefix) finalKey = "__Host-" + key;
|
|
84
|
-
const obj2 = (0, import_cookie.parse)(cookie, finalKey);
|
|
85
|
-
return obj2[finalKey];
|
|
86
|
-
}
|
|
87
|
-
if (!cookie) return {};
|
|
88
|
-
const obj = (0, import_cookie.parse)(cookie);
|
|
89
|
-
return obj;
|
|
90
|
-
};
|
|
91
|
-
const getSignedCookie = async (c, secret, key, prefix)=>{
|
|
92
|
-
const cookie = c.req.raw.headers.get("Cookie");
|
|
93
|
-
if ("string" == typeof key) {
|
|
94
|
-
if (!cookie) return;
|
|
95
|
-
let finalKey = key;
|
|
96
|
-
if ("secure" === prefix) finalKey = "__Secure-" + key;
|
|
97
|
-
else if ("host" === prefix) finalKey = "__Host-" + key;
|
|
98
|
-
const obj2 = await (0, import_cookie.parseSigned)(cookie, secret, finalKey);
|
|
99
|
-
return obj2[finalKey];
|
|
100
|
-
}
|
|
101
|
-
if (!cookie) return {};
|
|
102
|
-
const obj = await (0, import_cookie.parseSigned)(cookie, secret);
|
|
103
|
-
return obj;
|
|
104
|
-
};
|
|
105
|
-
const setCookie = (c, name, value, opt)=>{
|
|
106
|
-
let cookie;
|
|
107
|
-
cookie = opt?.prefix === "secure" ? (0, import_cookie.serialize)("__Secure-" + name, value, {
|
|
108
|
-
path: "/",
|
|
109
|
-
...opt,
|
|
110
|
-
secure: true
|
|
111
|
-
}) : opt?.prefix === "host" ? (0, import_cookie.serialize)("__Host-" + name, value, {
|
|
112
|
-
...opt,
|
|
113
|
-
path: "/",
|
|
114
|
-
secure: true,
|
|
115
|
-
domain: void 0
|
|
116
|
-
}) : (0, import_cookie.serialize)(name, value, {
|
|
117
|
-
path: "/",
|
|
118
|
-
...opt
|
|
119
|
-
});
|
|
120
|
-
c.header("set-cookie", cookie, {
|
|
121
|
-
append: true
|
|
122
|
-
});
|
|
123
|
-
};
|
|
124
|
-
const setSignedCookie = async (c, name, value, secret, opt)=>{
|
|
125
|
-
let cookie;
|
|
126
|
-
cookie = opt?.prefix === "secure" ? await (0, import_cookie.serializeSigned)("__Secure-" + name, value, secret, {
|
|
127
|
-
path: "/",
|
|
128
|
-
...opt,
|
|
129
|
-
secure: true
|
|
130
|
-
}) : opt?.prefix === "host" ? await (0, import_cookie.serializeSigned)("__Host-" + name, value, secret, {
|
|
131
|
-
...opt,
|
|
132
|
-
path: "/",
|
|
133
|
-
secure: true,
|
|
134
|
-
domain: void 0
|
|
135
|
-
}) : await (0, import_cookie.serializeSigned)(name, value, secret, {
|
|
136
|
-
path: "/",
|
|
137
|
-
...opt
|
|
138
|
-
});
|
|
139
|
-
c.header("set-cookie", cookie, {
|
|
140
|
-
append: true
|
|
141
|
-
});
|
|
142
|
-
};
|
|
143
|
-
const deleteCookie = (c, name, opt)=>{
|
|
144
|
-
const deletedCookie = getCookie(c, name);
|
|
145
|
-
setCookie(c, name, "", {
|
|
146
|
-
...opt,
|
|
147
|
-
maxAge: 0
|
|
148
|
-
});
|
|
149
|
-
return deletedCookie;
|
|
150
|
-
};
|
|
151
|
-
},
|
|
152
|
-
"../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/cjs/http-exception.js": function(module) {
|
|
153
|
-
var __defProp = Object.defineProperty;
|
|
154
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
155
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
156
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
157
|
-
var __export = (target, all)=>{
|
|
158
|
-
for(var name in all)__defProp(target, name, {
|
|
159
|
-
get: all[name],
|
|
160
|
-
enumerable: true
|
|
161
|
-
});
|
|
162
|
-
};
|
|
163
|
-
var __copyProps = (to, from, except, desc)=>{
|
|
164
|
-
if (from && "object" == typeof from || "function" == typeof from) {
|
|
165
|
-
for (let key of __getOwnPropNames(from))if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
166
|
-
get: ()=>from[key],
|
|
167
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
return to;
|
|
171
|
-
};
|
|
172
|
-
var __toCommonJS = (mod)=>__copyProps(__defProp({}, "__esModule", {
|
|
173
|
-
value: true
|
|
174
|
-
}), mod);
|
|
175
|
-
var http_exception_exports = {};
|
|
176
|
-
__export(http_exception_exports, {
|
|
177
|
-
HTTPException: ()=>HTTPException
|
|
178
|
-
});
|
|
179
|
-
module.exports = __toCommonJS(http_exception_exports);
|
|
180
|
-
class HTTPException extends Error {
|
|
181
|
-
res;
|
|
182
|
-
status;
|
|
183
|
-
constructor(status = 500, options){
|
|
184
|
-
super(options?.message, {
|
|
185
|
-
cause: options?.cause
|
|
186
|
-
});
|
|
187
|
-
this.res = options?.res;
|
|
188
|
-
this.status = status;
|
|
189
|
-
}
|
|
190
|
-
getResponse() {
|
|
191
|
-
if (this.res) {
|
|
192
|
-
const newResponse = new Response(this.res.body, {
|
|
193
|
-
status: this.status,
|
|
194
|
-
headers: this.res.headers
|
|
195
|
-
});
|
|
196
|
-
return newResponse;
|
|
197
|
-
}
|
|
198
|
-
return new Response(this.message, {
|
|
199
|
-
status: this.status
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
},
|
|
204
|
-
"../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/cjs/utils/buffer.js": function(module, __unused_webpack_exports, __webpack_require__) {
|
|
205
|
-
var __defProp = Object.defineProperty;
|
|
206
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
207
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
208
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
209
|
-
var __export = (target, all)=>{
|
|
210
|
-
for(var name in all)__defProp(target, name, {
|
|
211
|
-
get: all[name],
|
|
212
|
-
enumerable: true
|
|
213
|
-
});
|
|
214
|
-
};
|
|
215
|
-
var __copyProps = (to, from, except, desc)=>{
|
|
216
|
-
if (from && "object" == typeof from || "function" == typeof from) {
|
|
217
|
-
for (let key of __getOwnPropNames(from))if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
218
|
-
get: ()=>from[key],
|
|
219
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
return to;
|
|
223
|
-
};
|
|
224
|
-
var __toCommonJS = (mod)=>__copyProps(__defProp({}, "__esModule", {
|
|
225
|
-
value: true
|
|
226
|
-
}), mod);
|
|
227
|
-
var buffer_exports = {};
|
|
228
|
-
__export(buffer_exports, {
|
|
229
|
-
bufferToFormData: ()=>bufferToFormData,
|
|
230
|
-
bufferToString: ()=>bufferToString,
|
|
231
|
-
equal: ()=>equal,
|
|
232
|
-
timingSafeEqual: ()=>timingSafeEqual
|
|
233
|
-
});
|
|
234
|
-
module.exports = __toCommonJS(buffer_exports);
|
|
235
|
-
var import_crypto = __webpack_require__("../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/cjs/utils/crypto.js");
|
|
236
|
-
const equal = (a, b)=>{
|
|
237
|
-
if (a === b) return true;
|
|
238
|
-
if (a.byteLength !== b.byteLength) return false;
|
|
239
|
-
const va = new DataView(a);
|
|
240
|
-
const vb = new DataView(b);
|
|
241
|
-
let i = va.byteLength;
|
|
242
|
-
while(i--)if (va.getUint8(i) !== vb.getUint8(i)) return false;
|
|
243
|
-
return true;
|
|
244
|
-
};
|
|
245
|
-
const timingSafeEqual = async (a, b, hashFunction)=>{
|
|
246
|
-
if (!hashFunction) hashFunction = import_crypto.sha256;
|
|
247
|
-
const [sa, sb] = await Promise.all([
|
|
248
|
-
hashFunction(a),
|
|
249
|
-
hashFunction(b)
|
|
250
|
-
]);
|
|
251
|
-
if (!sa || !sb) return false;
|
|
252
|
-
return sa === sb && a === b;
|
|
253
|
-
};
|
|
254
|
-
const bufferToString = (buffer)=>{
|
|
255
|
-
if (buffer instanceof ArrayBuffer) {
|
|
256
|
-
const enc = new TextDecoder("utf-8");
|
|
257
|
-
return enc.decode(buffer);
|
|
258
|
-
}
|
|
259
|
-
return buffer;
|
|
260
|
-
};
|
|
261
|
-
const bufferToFormData = (arrayBuffer, contentType)=>{
|
|
262
|
-
const response = new Response(arrayBuffer, {
|
|
263
|
-
headers: {
|
|
264
|
-
"Content-Type": contentType
|
|
265
|
-
}
|
|
266
|
-
});
|
|
267
|
-
return response.formData();
|
|
268
|
-
};
|
|
269
|
-
},
|
|
270
|
-
"../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/cjs/utils/cookie.js": function(module, __unused_webpack_exports, __webpack_require__) {
|
|
271
|
-
var __defProp = Object.defineProperty;
|
|
272
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
273
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
274
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
275
|
-
var __export = (target, all)=>{
|
|
276
|
-
for(var name in all)__defProp(target, name, {
|
|
277
|
-
get: all[name],
|
|
278
|
-
enumerable: true
|
|
279
|
-
});
|
|
280
|
-
};
|
|
281
|
-
var __copyProps = (to, from, except, desc)=>{
|
|
282
|
-
if (from && "object" == typeof from || "function" == typeof from) {
|
|
283
|
-
for (let key of __getOwnPropNames(from))if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
284
|
-
get: ()=>from[key],
|
|
285
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
return to;
|
|
289
|
-
};
|
|
290
|
-
var __toCommonJS = (mod)=>__copyProps(__defProp({}, "__esModule", {
|
|
291
|
-
value: true
|
|
292
|
-
}), mod);
|
|
293
|
-
var cookie_exports = {};
|
|
294
|
-
__export(cookie_exports, {
|
|
295
|
-
parse: ()=>parse,
|
|
296
|
-
parseSigned: ()=>parseSigned,
|
|
297
|
-
serialize: ()=>serialize,
|
|
298
|
-
serializeSigned: ()=>serializeSigned
|
|
299
|
-
});
|
|
300
|
-
module.exports = __toCommonJS(cookie_exports);
|
|
301
|
-
var import_url = __webpack_require__("../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/cjs/utils/url.js");
|
|
302
|
-
const algorithm = {
|
|
303
|
-
name: "HMAC",
|
|
304
|
-
hash: "SHA-256"
|
|
305
|
-
};
|
|
306
|
-
const getCryptoKey = async (secret)=>{
|
|
307
|
-
const secretBuf = "string" == typeof secret ? new TextEncoder().encode(secret) : secret;
|
|
308
|
-
return await crypto.subtle.importKey("raw", secretBuf, algorithm, false, [
|
|
309
|
-
"sign",
|
|
310
|
-
"verify"
|
|
311
|
-
]);
|
|
312
|
-
};
|
|
313
|
-
const makeSignature = async (value, secret)=>{
|
|
314
|
-
const key = await getCryptoKey(secret);
|
|
315
|
-
const signature = await crypto.subtle.sign(algorithm.name, key, new TextEncoder().encode(value));
|
|
316
|
-
return btoa(String.fromCharCode(...new Uint8Array(signature)));
|
|
317
|
-
};
|
|
318
|
-
const verifySignature = async (base64Signature, value, secret)=>{
|
|
319
|
-
try {
|
|
320
|
-
const signatureBinStr = atob(base64Signature);
|
|
321
|
-
const signature = new Uint8Array(signatureBinStr.length);
|
|
322
|
-
for(let i = 0, len = signatureBinStr.length; i < len; i++)signature[i] = signatureBinStr.charCodeAt(i);
|
|
323
|
-
return await crypto.subtle.verify(algorithm, secret, signature, new TextEncoder().encode(value));
|
|
324
|
-
} catch {
|
|
325
|
-
return false;
|
|
326
|
-
}
|
|
327
|
-
};
|
|
328
|
-
const validCookieNameRegEx = /^[\w!#$%&'*.^`|~+-]+$/;
|
|
329
|
-
const validCookieValueRegEx = /^[ !#-:<-[\]-~]*$/;
|
|
330
|
-
const parse = (cookie, name)=>{
|
|
331
|
-
const pairs = cookie.trim().split(";");
|
|
332
|
-
return pairs.reduce((parsedCookie, pairStr)=>{
|
|
333
|
-
pairStr = pairStr.trim();
|
|
334
|
-
const valueStartPos = pairStr.indexOf("=");
|
|
335
|
-
if (-1 === valueStartPos) return parsedCookie;
|
|
336
|
-
const cookieName = pairStr.substring(0, valueStartPos).trim();
|
|
337
|
-
if (name && name !== cookieName || !validCookieNameRegEx.test(cookieName)) return parsedCookie;
|
|
338
|
-
let cookieValue = pairStr.substring(valueStartPos + 1).trim();
|
|
339
|
-
if (cookieValue.startsWith('"') && cookieValue.endsWith('"')) cookieValue = cookieValue.slice(1, -1);
|
|
340
|
-
if (validCookieValueRegEx.test(cookieValue)) parsedCookie[cookieName] = (0, import_url.decodeURIComponent_)(cookieValue);
|
|
341
|
-
return parsedCookie;
|
|
342
|
-
}, {});
|
|
343
|
-
};
|
|
344
|
-
const parseSigned = async (cookie, secret, name)=>{
|
|
345
|
-
const parsedCookie = {};
|
|
346
|
-
const secretKey = await getCryptoKey(secret);
|
|
347
|
-
for (const [key, value] of Object.entries(parse(cookie, name))){
|
|
348
|
-
const signatureStartPos = value.lastIndexOf(".");
|
|
349
|
-
if (signatureStartPos < 1) continue;
|
|
350
|
-
const signedValue = value.substring(0, signatureStartPos);
|
|
351
|
-
const signature = value.substring(signatureStartPos + 1);
|
|
352
|
-
if (44 !== signature.length || !signature.endsWith("=")) continue;
|
|
353
|
-
const isVerified = await verifySignature(signature, signedValue, secretKey);
|
|
354
|
-
parsedCookie[key] = isVerified ? signedValue : false;
|
|
355
|
-
}
|
|
356
|
-
return parsedCookie;
|
|
357
|
-
};
|
|
358
|
-
const _serialize = (name, value, opt = {})=>{
|
|
359
|
-
let cookie = `${name}=${value}`;
|
|
360
|
-
if (name.startsWith("__Secure-") && !opt.secure) throw new Error("__Secure- Cookie must have Secure attributes");
|
|
361
|
-
if (name.startsWith("__Host-")) {
|
|
362
|
-
if (!opt.secure) throw new Error("__Host- Cookie must have Secure attributes");
|
|
363
|
-
if ("/" !== opt.path) throw new Error('__Host- Cookie must have Path attributes with "/"');
|
|
364
|
-
if (opt.domain) throw new Error("__Host- Cookie must not have Domain attributes");
|
|
365
|
-
}
|
|
366
|
-
if (opt && "number" == typeof opt.maxAge && opt.maxAge >= 0) {
|
|
367
|
-
if (opt.maxAge > 3456e4) throw new Error("Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.");
|
|
368
|
-
cookie += `; Max-Age=${Math.floor(opt.maxAge)}`;
|
|
369
|
-
}
|
|
370
|
-
if (opt.domain && "host" !== opt.prefix) cookie += `; Domain=${opt.domain}`;
|
|
371
|
-
if (opt.path) cookie += `; Path=${opt.path}`;
|
|
372
|
-
if (opt.expires) {
|
|
373
|
-
if (opt.expires.getTime() - Date.now() > 3456e7) throw new Error("Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.");
|
|
374
|
-
cookie += `; Expires=${opt.expires.toUTCString()}`;
|
|
375
|
-
}
|
|
376
|
-
if (opt.httpOnly) cookie += "; HttpOnly";
|
|
377
|
-
if (opt.secure) cookie += "; Secure";
|
|
378
|
-
if (opt.sameSite) cookie += `; SameSite=${opt.sameSite.charAt(0).toUpperCase() + opt.sameSite.slice(1)}`;
|
|
379
|
-
if (opt.partitioned) {
|
|
380
|
-
if (!opt.secure) throw new Error("Partitioned Cookie must have Secure attributes");
|
|
381
|
-
cookie += "; Partitioned";
|
|
382
|
-
}
|
|
383
|
-
return cookie;
|
|
384
|
-
};
|
|
385
|
-
const serialize = (name, value, opt)=>{
|
|
386
|
-
value = encodeURIComponent(value);
|
|
387
|
-
return _serialize(name, value, opt);
|
|
388
|
-
};
|
|
389
|
-
const serializeSigned = async (name, value, secret, opt = {})=>{
|
|
390
|
-
const signature = await makeSignature(value, secret);
|
|
391
|
-
value = `${value}.${signature}`;
|
|
392
|
-
value = encodeURIComponent(value);
|
|
393
|
-
return _serialize(name, value, opt);
|
|
394
|
-
};
|
|
395
|
-
},
|
|
396
|
-
"../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/cjs/utils/crypto.js": function(module) {
|
|
397
|
-
var __defProp = Object.defineProperty;
|
|
398
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
399
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
400
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
401
|
-
var __export = (target, all)=>{
|
|
402
|
-
for(var name in all)__defProp(target, name, {
|
|
403
|
-
get: all[name],
|
|
404
|
-
enumerable: true
|
|
405
|
-
});
|
|
406
|
-
};
|
|
407
|
-
var __copyProps = (to, from, except, desc)=>{
|
|
408
|
-
if (from && "object" == typeof from || "function" == typeof from) {
|
|
409
|
-
for (let key of __getOwnPropNames(from))if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
410
|
-
get: ()=>from[key],
|
|
411
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
412
|
-
});
|
|
413
|
-
}
|
|
414
|
-
return to;
|
|
415
|
-
};
|
|
416
|
-
var __toCommonJS = (mod)=>__copyProps(__defProp({}, "__esModule", {
|
|
417
|
-
value: true
|
|
418
|
-
}), mod);
|
|
419
|
-
var crypto_exports = {};
|
|
420
|
-
__export(crypto_exports, {
|
|
421
|
-
createHash: ()=>createHash,
|
|
422
|
-
md5: ()=>md5,
|
|
423
|
-
sha1: ()=>sha1,
|
|
424
|
-
sha256: ()=>sha256
|
|
425
|
-
});
|
|
426
|
-
module.exports = __toCommonJS(crypto_exports);
|
|
427
|
-
const sha256 = async (data)=>{
|
|
428
|
-
const algorithm = {
|
|
429
|
-
name: "SHA-256",
|
|
430
|
-
alias: "sha256"
|
|
431
|
-
};
|
|
432
|
-
const hash = await createHash(data, algorithm);
|
|
433
|
-
return hash;
|
|
434
|
-
};
|
|
435
|
-
const sha1 = async (data)=>{
|
|
436
|
-
const algorithm = {
|
|
437
|
-
name: "SHA-1",
|
|
438
|
-
alias: "sha1"
|
|
439
|
-
};
|
|
440
|
-
const hash = await createHash(data, algorithm);
|
|
441
|
-
return hash;
|
|
442
|
-
};
|
|
443
|
-
const md5 = async (data)=>{
|
|
444
|
-
const algorithm = {
|
|
445
|
-
name: "MD5",
|
|
446
|
-
alias: "md5"
|
|
447
|
-
};
|
|
448
|
-
const hash = await createHash(data, algorithm);
|
|
449
|
-
return hash;
|
|
450
|
-
};
|
|
451
|
-
const createHash = async (data, algorithm)=>{
|
|
452
|
-
let sourceBuffer;
|
|
453
|
-
if (data instanceof ReadableStream) {
|
|
454
|
-
let body = "";
|
|
455
|
-
const reader = data.getReader();
|
|
456
|
-
await reader?.read().then(async (chuck)=>{
|
|
457
|
-
const value = await createHash(chuck.value || "", algorithm);
|
|
458
|
-
body += value;
|
|
459
|
-
});
|
|
460
|
-
return body;
|
|
461
|
-
}
|
|
462
|
-
if (ArrayBuffer.isView(data) || data instanceof ArrayBuffer) sourceBuffer = data;
|
|
463
|
-
else {
|
|
464
|
-
if ("object" == typeof data) data = JSON.stringify(data);
|
|
465
|
-
sourceBuffer = new TextEncoder().encode(String(data));
|
|
466
|
-
}
|
|
467
|
-
if (crypto && crypto.subtle) {
|
|
468
|
-
const buffer = await crypto.subtle.digest({
|
|
469
|
-
name: algorithm.name
|
|
470
|
-
}, sourceBuffer);
|
|
471
|
-
const hash = Array.prototype.map.call(new Uint8Array(buffer), (x)=>("00" + x.toString(16)).slice(-2)).join("");
|
|
472
|
-
return hash;
|
|
473
|
-
}
|
|
474
|
-
return null;
|
|
475
|
-
};
|
|
476
|
-
},
|
|
477
|
-
"../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/cjs/utils/url.js": function(module) {
|
|
478
|
-
var __defProp = Object.defineProperty;
|
|
479
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
480
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
481
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
482
|
-
var __export = (target, all)=>{
|
|
483
|
-
for(var name in all)__defProp(target, name, {
|
|
484
|
-
get: all[name],
|
|
485
|
-
enumerable: true
|
|
486
|
-
});
|
|
487
|
-
};
|
|
488
|
-
var __copyProps = (to, from, except, desc)=>{
|
|
489
|
-
if (from && "object" == typeof from || "function" == typeof from) {
|
|
490
|
-
for (let key of __getOwnPropNames(from))if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
491
|
-
get: ()=>from[key],
|
|
492
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
493
|
-
});
|
|
494
|
-
}
|
|
495
|
-
return to;
|
|
496
|
-
};
|
|
497
|
-
var __toCommonJS = (mod)=>__copyProps(__defProp({}, "__esModule", {
|
|
498
|
-
value: true
|
|
499
|
-
}), mod);
|
|
500
|
-
var url_exports = {};
|
|
501
|
-
__export(url_exports, {
|
|
502
|
-
checkOptionalParameter: ()=>checkOptionalParameter,
|
|
503
|
-
decodeURIComponent_: ()=>decodeURIComponent_,
|
|
504
|
-
getPath: ()=>getPath,
|
|
505
|
-
getPathNoStrict: ()=>getPathNoStrict,
|
|
506
|
-
getPattern: ()=>getPattern,
|
|
507
|
-
getQueryParam: ()=>getQueryParam,
|
|
508
|
-
getQueryParams: ()=>getQueryParams,
|
|
509
|
-
getQueryStrings: ()=>getQueryStrings,
|
|
510
|
-
mergePath: ()=>mergePath,
|
|
511
|
-
splitPath: ()=>splitPath,
|
|
512
|
-
splitRoutingPath: ()=>splitRoutingPath
|
|
513
|
-
});
|
|
514
|
-
module.exports = __toCommonJS(url_exports);
|
|
515
|
-
const splitPath = (path)=>{
|
|
516
|
-
const paths = path.split("/");
|
|
517
|
-
if ("" === paths[0]) paths.shift();
|
|
518
|
-
return paths;
|
|
519
|
-
};
|
|
520
|
-
const splitRoutingPath = (routePath)=>{
|
|
521
|
-
const { groups, path } = extractGroupsFromPath(routePath);
|
|
522
|
-
const paths = splitPath(path);
|
|
523
|
-
return replaceGroupMarks(paths, groups);
|
|
524
|
-
};
|
|
525
|
-
const extractGroupsFromPath = (path)=>{
|
|
526
|
-
const groups = [];
|
|
527
|
-
path = path.replace(/\{[^}]+\}/g, (match, index)=>{
|
|
528
|
-
const mark = `@${index}`;
|
|
529
|
-
groups.push([
|
|
530
|
-
mark,
|
|
531
|
-
match
|
|
532
|
-
]);
|
|
533
|
-
return mark;
|
|
534
|
-
});
|
|
535
|
-
return {
|
|
536
|
-
groups,
|
|
537
|
-
path
|
|
538
|
-
};
|
|
539
|
-
};
|
|
540
|
-
const replaceGroupMarks = (paths, groups)=>{
|
|
541
|
-
for(let i = groups.length - 1; i >= 0; i--){
|
|
542
|
-
const [mark] = groups[i];
|
|
543
|
-
for(let j = paths.length - 1; j >= 0; j--)if (paths[j].includes(mark)) {
|
|
544
|
-
paths[j] = paths[j].replace(mark, groups[i][1]);
|
|
545
|
-
break;
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
return paths;
|
|
549
|
-
};
|
|
550
|
-
const patternCache = {};
|
|
551
|
-
const getPattern = (label)=>{
|
|
552
|
-
if ("*" === label) return "*";
|
|
553
|
-
const match = label.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);
|
|
554
|
-
if (match) {
|
|
555
|
-
if (!patternCache[label]) {
|
|
556
|
-
if (match[2]) patternCache[label] = [
|
|
557
|
-
label,
|
|
558
|
-
match[1],
|
|
559
|
-
new RegExp("^" + match[2] + "$")
|
|
560
|
-
];
|
|
561
|
-
else patternCache[label] = [
|
|
562
|
-
label,
|
|
563
|
-
match[1],
|
|
564
|
-
true
|
|
565
|
-
];
|
|
566
|
-
}
|
|
567
|
-
return patternCache[label];
|
|
568
|
-
}
|
|
569
|
-
return null;
|
|
570
|
-
};
|
|
571
|
-
const tryDecodeURI = (str)=>{
|
|
572
|
-
try {
|
|
573
|
-
return decodeURI(str);
|
|
574
|
-
} catch {
|
|
575
|
-
return str.replace(/(?:%[0-9A-Fa-f]{2})+/g, (match)=>{
|
|
576
|
-
try {
|
|
577
|
-
return decodeURI(match);
|
|
578
|
-
} catch {
|
|
579
|
-
return match;
|
|
580
|
-
}
|
|
581
|
-
});
|
|
582
|
-
}
|
|
583
|
-
};
|
|
584
|
-
const getPath = (request)=>{
|
|
585
|
-
const url = request.url;
|
|
586
|
-
const start = url.indexOf("/", 8);
|
|
587
|
-
let i = start;
|
|
588
|
-
for(; i < url.length; i++){
|
|
589
|
-
const charCode = url.charCodeAt(i);
|
|
590
|
-
if (37 === charCode) {
|
|
591
|
-
const queryIndex = url.indexOf("?", i);
|
|
592
|
-
const path = url.slice(start, -1 === queryIndex ? void 0 : queryIndex);
|
|
593
|
-
return tryDecodeURI(path.includes("%25") ? path.replace(/%25/g, "%2525") : path);
|
|
594
|
-
}
|
|
595
|
-
if (63 === charCode) break;
|
|
596
|
-
}
|
|
597
|
-
return url.slice(start, i);
|
|
598
|
-
};
|
|
599
|
-
const getQueryStrings = (url)=>{
|
|
600
|
-
const queryIndex = url.indexOf("?", 8);
|
|
601
|
-
return -1 === queryIndex ? "" : "?" + url.slice(queryIndex + 1);
|
|
602
|
-
};
|
|
603
|
-
const getPathNoStrict = (request)=>{
|
|
604
|
-
const result = getPath(request);
|
|
605
|
-
return result.length > 1 && "/" === result[result.length - 1] ? result.slice(0, -1) : result;
|
|
606
|
-
};
|
|
607
|
-
const mergePath = (...paths)=>{
|
|
608
|
-
let p = "";
|
|
609
|
-
let endsWithSlash = false;
|
|
610
|
-
for (let path of paths){
|
|
611
|
-
if ("/" === p[p.length - 1]) {
|
|
612
|
-
p = p.slice(0, -1);
|
|
613
|
-
endsWithSlash = true;
|
|
614
|
-
}
|
|
615
|
-
if ("/" !== path[0]) path = `/${path}`;
|
|
616
|
-
if ("/" === path && endsWithSlash) p = `${p}/`;
|
|
617
|
-
else if ("/" !== path) p = `${p}${path}`;
|
|
618
|
-
if ("/" === path && "" === p) p = "/";
|
|
619
|
-
}
|
|
620
|
-
return p;
|
|
621
|
-
};
|
|
622
|
-
const checkOptionalParameter = (path)=>{
|
|
623
|
-
if (!path.match(/\:.+\?$/)) return null;
|
|
624
|
-
const segments = path.split("/");
|
|
625
|
-
const results = [];
|
|
626
|
-
let basePath = "";
|
|
627
|
-
segments.forEach((segment)=>{
|
|
628
|
-
if ("" === segment || /\:/.test(segment)) {
|
|
629
|
-
if (/\:/.test(segment)) {
|
|
630
|
-
if (/\?/.test(segment)) {
|
|
631
|
-
if (0 === results.length && "" === basePath) results.push("/");
|
|
632
|
-
else results.push(basePath);
|
|
633
|
-
const optionalSegment = segment.replace("?", "");
|
|
634
|
-
basePath += "/" + optionalSegment;
|
|
635
|
-
results.push(basePath);
|
|
636
|
-
} else basePath += "/" + segment;
|
|
637
|
-
}
|
|
638
|
-
} else basePath += "/" + segment;
|
|
639
|
-
});
|
|
640
|
-
return results.filter((v, i, a)=>a.indexOf(v) === i);
|
|
641
|
-
};
|
|
642
|
-
const _decodeURI = (value)=>{
|
|
643
|
-
if (!/[%+]/.test(value)) return value;
|
|
644
|
-
if (-1 !== value.indexOf("+")) value = value.replace(/\+/g, " ");
|
|
645
|
-
return /%/.test(value) ? decodeURIComponent_(value) : value;
|
|
646
|
-
};
|
|
647
|
-
const _getQueryParam = (url, key, multiple)=>{
|
|
648
|
-
let encoded;
|
|
649
|
-
if (!multiple && key && !/[%+]/.test(key)) {
|
|
650
|
-
let keyIndex2 = url.indexOf(`?${key}`, 8);
|
|
651
|
-
if (-1 === keyIndex2) keyIndex2 = url.indexOf(`&${key}`, 8);
|
|
652
|
-
while(-1 !== keyIndex2){
|
|
653
|
-
const trailingKeyCode = url.charCodeAt(keyIndex2 + key.length + 1);
|
|
654
|
-
if (61 === trailingKeyCode) {
|
|
655
|
-
const valueIndex = keyIndex2 + key.length + 2;
|
|
656
|
-
const endIndex = url.indexOf("&", valueIndex);
|
|
657
|
-
return _decodeURI(url.slice(valueIndex, -1 === endIndex ? void 0 : endIndex));
|
|
658
|
-
}
|
|
659
|
-
if (38 == trailingKeyCode || isNaN(trailingKeyCode)) return "";
|
|
660
|
-
keyIndex2 = url.indexOf(`&${key}`, keyIndex2 + 1);
|
|
661
|
-
}
|
|
662
|
-
encoded = /[%+]/.test(url);
|
|
663
|
-
if (!encoded) return;
|
|
664
|
-
}
|
|
665
|
-
const results = {};
|
|
666
|
-
encoded ??= /[%+]/.test(url);
|
|
667
|
-
let keyIndex = url.indexOf("?", 8);
|
|
668
|
-
while(-1 !== keyIndex){
|
|
669
|
-
const nextKeyIndex = url.indexOf("&", keyIndex + 1);
|
|
670
|
-
let valueIndex = url.indexOf("=", keyIndex);
|
|
671
|
-
if (valueIndex > nextKeyIndex && -1 !== nextKeyIndex) valueIndex = -1;
|
|
672
|
-
let name = url.slice(keyIndex + 1, -1 === valueIndex ? -1 === nextKeyIndex ? void 0 : nextKeyIndex : valueIndex);
|
|
673
|
-
if (encoded) name = _decodeURI(name);
|
|
674
|
-
keyIndex = nextKeyIndex;
|
|
675
|
-
if ("" === name) continue;
|
|
676
|
-
let value;
|
|
677
|
-
if (-1 === valueIndex) value = "";
|
|
678
|
-
else {
|
|
679
|
-
value = url.slice(valueIndex + 1, -1 === nextKeyIndex ? void 0 : nextKeyIndex);
|
|
680
|
-
if (encoded) value = _decodeURI(value);
|
|
681
|
-
}
|
|
682
|
-
if (multiple) {
|
|
683
|
-
if (!(results[name] && Array.isArray(results[name]))) results[name] = [];
|
|
684
|
-
results[name].push(value);
|
|
685
|
-
} else results[name] ??= value;
|
|
686
|
-
}
|
|
687
|
-
return key ? results[key] : results;
|
|
688
|
-
};
|
|
689
|
-
const getQueryParam = _getQueryParam;
|
|
690
|
-
const getQueryParams = (url, key)=>_getQueryParam(url, key, true);
|
|
691
|
-
const decodeURIComponent_ = decodeURIComponent;
|
|
692
|
-
},
|
|
693
|
-
"../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/cjs/validator/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
|
|
694
|
-
var __defProp = Object.defineProperty;
|
|
695
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
696
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
697
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
698
|
-
var __export = (target, all)=>{
|
|
699
|
-
for(var name in all)__defProp(target, name, {
|
|
700
|
-
get: all[name],
|
|
701
|
-
enumerable: true
|
|
702
|
-
});
|
|
703
|
-
};
|
|
704
|
-
var __copyProps = (to, from, except, desc)=>{
|
|
705
|
-
if (from && "object" == typeof from || "function" == typeof from) {
|
|
706
|
-
for (let key of __getOwnPropNames(from))if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
707
|
-
get: ()=>from[key],
|
|
708
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
709
|
-
});
|
|
710
|
-
}
|
|
711
|
-
return to;
|
|
712
|
-
};
|
|
713
|
-
var __toCommonJS = (mod)=>__copyProps(__defProp({}, "__esModule", {
|
|
714
|
-
value: true
|
|
715
|
-
}), mod);
|
|
716
|
-
var validator_exports = {};
|
|
717
|
-
__export(validator_exports, {
|
|
718
|
-
validator: ()=>import_validator.validator
|
|
719
|
-
});
|
|
720
|
-
module.exports = __toCommonJS(validator_exports);
|
|
721
|
-
var import_validator = __webpack_require__("../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/cjs/validator/validator.js");
|
|
722
|
-
},
|
|
723
|
-
"../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/cjs/validator/validator.js": function(module, __unused_webpack_exports, __webpack_require__) {
|
|
724
|
-
var __defProp = Object.defineProperty;
|
|
725
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
726
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
727
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
728
|
-
var __export = (target, all)=>{
|
|
729
|
-
for(var name in all)__defProp(target, name, {
|
|
730
|
-
get: all[name],
|
|
731
|
-
enumerable: true
|
|
732
|
-
});
|
|
733
|
-
};
|
|
734
|
-
var __copyProps = (to, from, except, desc)=>{
|
|
735
|
-
if (from && "object" == typeof from || "function" == typeof from) {
|
|
736
|
-
for (let key of __getOwnPropNames(from))if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
737
|
-
get: ()=>from[key],
|
|
738
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
739
|
-
});
|
|
740
|
-
}
|
|
741
|
-
return to;
|
|
742
|
-
};
|
|
743
|
-
var __toCommonJS = (mod)=>__copyProps(__defProp({}, "__esModule", {
|
|
744
|
-
value: true
|
|
745
|
-
}), mod);
|
|
746
|
-
var validator_exports = {};
|
|
747
|
-
__export(validator_exports, {
|
|
748
|
-
validator: ()=>validator
|
|
749
|
-
});
|
|
750
|
-
module.exports = __toCommonJS(validator_exports);
|
|
751
|
-
var import_cookie = __webpack_require__("../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/cjs/helper/cookie/index.js");
|
|
752
|
-
var import_http_exception = __webpack_require__("../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/cjs/http-exception.js");
|
|
753
|
-
var import_buffer = __webpack_require__("../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/cjs/utils/buffer.js");
|
|
754
|
-
const jsonRegex = /^application\/([a-z-\.]+\+)?json(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/;
|
|
755
|
-
const multipartRegex = /^multipart\/form-data(;\s?boundary=[a-zA-Z0-9'"()+_,\-./:=?]+)?$/;
|
|
756
|
-
const urlencodedRegex = /^application\/x-www-form-urlencoded(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/;
|
|
757
|
-
const validator = (target, validationFunc)=>async (c, next)=>{
|
|
758
|
-
let value = {};
|
|
759
|
-
const contentType = c.req.header("Content-Type");
|
|
760
|
-
switch(target){
|
|
761
|
-
case "json":
|
|
762
|
-
if (!contentType || !jsonRegex.test(contentType)) break;
|
|
763
|
-
try {
|
|
764
|
-
value = await c.req.json();
|
|
765
|
-
} catch {
|
|
766
|
-
const message = "Malformed JSON in request body";
|
|
767
|
-
throw new import_http_exception.HTTPException(400, {
|
|
768
|
-
message
|
|
769
|
-
});
|
|
770
|
-
}
|
|
771
|
-
break;
|
|
772
|
-
case "form":
|
|
773
|
-
{
|
|
774
|
-
if (!contentType || !(multipartRegex.test(contentType) || urlencodedRegex.test(contentType))) break;
|
|
775
|
-
let formData;
|
|
776
|
-
if (c.req.bodyCache.formData) formData = await c.req.bodyCache.formData;
|
|
777
|
-
else try {
|
|
778
|
-
const arrayBuffer = await c.req.arrayBuffer();
|
|
779
|
-
formData = await (0, import_buffer.bufferToFormData)(arrayBuffer, contentType);
|
|
780
|
-
c.req.bodyCache.formData = formData;
|
|
781
|
-
} catch (e) {
|
|
782
|
-
let message = "Malformed FormData request.";
|
|
783
|
-
message += e instanceof Error ? ` ${e.message}` : ` ${String(e)}`;
|
|
784
|
-
throw new import_http_exception.HTTPException(400, {
|
|
785
|
-
message
|
|
786
|
-
});
|
|
787
|
-
}
|
|
788
|
-
const form = {};
|
|
789
|
-
formData.forEach((value2, key)=>{
|
|
790
|
-
if (key.endsWith("[]")) (form[key] ??= []).push(value2);
|
|
791
|
-
else if (Array.isArray(form[key])) form[key].push(value2);
|
|
792
|
-
else if (key in form) form[key] = [
|
|
793
|
-
form[key],
|
|
794
|
-
value2
|
|
795
|
-
];
|
|
796
|
-
else form[key] = value2;
|
|
797
|
-
});
|
|
798
|
-
value = form;
|
|
799
|
-
break;
|
|
800
|
-
}
|
|
801
|
-
case "query":
|
|
802
|
-
value = Object.fromEntries(Object.entries(c.req.queries()).map(([k, v])=>1 === v.length ? [
|
|
803
|
-
k,
|
|
804
|
-
v[0]
|
|
805
|
-
] : [
|
|
806
|
-
k,
|
|
807
|
-
v
|
|
808
|
-
]));
|
|
809
|
-
break;
|
|
810
|
-
case "param":
|
|
811
|
-
value = c.req.param();
|
|
812
|
-
break;
|
|
813
|
-
case "header":
|
|
814
|
-
value = c.req.header();
|
|
815
|
-
break;
|
|
816
|
-
case "cookie":
|
|
817
|
-
value = (0, import_cookie.getCookie)(c);
|
|
818
|
-
break;
|
|
819
|
-
}
|
|
820
|
-
const res = await validationFunc(value, c);
|
|
821
|
-
if (res instanceof Response) return res;
|
|
822
|
-
c.req.addValidatedData(target, res);
|
|
823
|
-
await next();
|
|
824
|
-
};
|
|
825
20
|
}
|
|
826
21
|
};
|
|
827
22
|
var __webpack_module_cache__ = {};
|
|
@@ -2423,9 +1618,214 @@ var __webpack_exports__ = {};
|
|
|
2423
1618
|
}
|
|
2424
1619
|
};
|
|
2425
1620
|
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");
|
|
2426
|
-
var
|
|
1621
|
+
var validCookieNameRegEx = /^[\w!#$%&'*.^`|~+-]+$/;
|
|
1622
|
+
var validCookieValueRegEx = /^[ !#-:<-[\]-~]*$/;
|
|
1623
|
+
var parse = (cookie, name)=>{
|
|
1624
|
+
const pairs = cookie.trim().split(";");
|
|
1625
|
+
return pairs.reduce((parsedCookie, pairStr)=>{
|
|
1626
|
+
pairStr = pairStr.trim();
|
|
1627
|
+
const valueStartPos = pairStr.indexOf("=");
|
|
1628
|
+
if (-1 === valueStartPos) return parsedCookie;
|
|
1629
|
+
const cookieName = pairStr.substring(0, valueStartPos).trim();
|
|
1630
|
+
if (name && name !== cookieName || !validCookieNameRegEx.test(cookieName)) return parsedCookie;
|
|
1631
|
+
let cookieValue = pairStr.substring(valueStartPos + 1).trim();
|
|
1632
|
+
if (cookieValue.startsWith('"') && cookieValue.endsWith('"')) cookieValue = cookieValue.slice(1, -1);
|
|
1633
|
+
if (validCookieValueRegEx.test(cookieValue)) parsedCookie[cookieName] = decodeURIComponent_(cookieValue);
|
|
1634
|
+
return parsedCookie;
|
|
1635
|
+
}, {});
|
|
1636
|
+
};
|
|
1637
|
+
var getCookie = (c, key, prefix)=>{
|
|
1638
|
+
const cookie = c.req.raw.headers.get("Cookie");
|
|
1639
|
+
if ("string" == typeof key) {
|
|
1640
|
+
if (!cookie) return;
|
|
1641
|
+
let finalKey = key;
|
|
1642
|
+
if ("secure" === prefix) finalKey = "__Secure-" + key;
|
|
1643
|
+
else if ("host" === prefix) finalKey = "__Host-" + key;
|
|
1644
|
+
const obj2 = parse(cookie, finalKey);
|
|
1645
|
+
return obj2[finalKey];
|
|
1646
|
+
}
|
|
1647
|
+
if (!cookie) return {};
|
|
1648
|
+
const obj = parse(cookie);
|
|
1649
|
+
return obj;
|
|
1650
|
+
};
|
|
1651
|
+
var HTTPException = class extends Error {
|
|
1652
|
+
res;
|
|
1653
|
+
status;
|
|
1654
|
+
constructor(status = 500, options){
|
|
1655
|
+
super(options?.message, {
|
|
1656
|
+
cause: options?.cause
|
|
1657
|
+
});
|
|
1658
|
+
this.res = options?.res;
|
|
1659
|
+
this.status = status;
|
|
1660
|
+
}
|
|
1661
|
+
getResponse() {
|
|
1662
|
+
if (this.res) {
|
|
1663
|
+
const newResponse = new Response(this.res.body, {
|
|
1664
|
+
status: this.status,
|
|
1665
|
+
headers: this.res.headers
|
|
1666
|
+
});
|
|
1667
|
+
return newResponse;
|
|
1668
|
+
}
|
|
1669
|
+
return new Response(this.message, {
|
|
1670
|
+
status: this.status
|
|
1671
|
+
});
|
|
1672
|
+
}
|
|
1673
|
+
};
|
|
1674
|
+
var bufferToFormData = (arrayBuffer, contentType)=>{
|
|
1675
|
+
const response = new Response(arrayBuffer, {
|
|
1676
|
+
headers: {
|
|
1677
|
+
"Content-Type": contentType
|
|
1678
|
+
}
|
|
1679
|
+
});
|
|
1680
|
+
return response.formData();
|
|
1681
|
+
};
|
|
1682
|
+
var jsonRegex = /^application\/([a-z-\.]+\+)?json(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/;
|
|
1683
|
+
var multipartRegex = /^multipart\/form-data(;\s?boundary=[a-zA-Z0-9'"()+_,\-./:=?]+)?$/;
|
|
1684
|
+
var urlencodedRegex = /^application\/x-www-form-urlencoded(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/;
|
|
1685
|
+
var validator = (target, validationFunc)=>async (c, next)=>{
|
|
1686
|
+
let value = {};
|
|
1687
|
+
const contentType = c.req.header("Content-Type");
|
|
1688
|
+
switch(target){
|
|
1689
|
+
case "json":
|
|
1690
|
+
if (!contentType || !jsonRegex.test(contentType)) break;
|
|
1691
|
+
try {
|
|
1692
|
+
value = await c.req.json();
|
|
1693
|
+
} catch {
|
|
1694
|
+
const message = "Malformed JSON in request body";
|
|
1695
|
+
throw new HTTPException(400, {
|
|
1696
|
+
message
|
|
1697
|
+
});
|
|
1698
|
+
}
|
|
1699
|
+
break;
|
|
1700
|
+
case "form":
|
|
1701
|
+
{
|
|
1702
|
+
if (!contentType || !(multipartRegex.test(contentType) || urlencodedRegex.test(contentType))) break;
|
|
1703
|
+
let formData;
|
|
1704
|
+
if (c.req.bodyCache.formData) formData = await c.req.bodyCache.formData;
|
|
1705
|
+
else try {
|
|
1706
|
+
const arrayBuffer = await c.req.arrayBuffer();
|
|
1707
|
+
formData = await bufferToFormData(arrayBuffer, contentType);
|
|
1708
|
+
c.req.bodyCache.formData = formData;
|
|
1709
|
+
} catch (e) {
|
|
1710
|
+
let message = "Malformed FormData request.";
|
|
1711
|
+
message += e instanceof Error ? ` ${e.message}` : ` ${String(e)}`;
|
|
1712
|
+
throw new HTTPException(400, {
|
|
1713
|
+
message
|
|
1714
|
+
});
|
|
1715
|
+
}
|
|
1716
|
+
const form = {};
|
|
1717
|
+
formData.forEach((value2, key)=>{
|
|
1718
|
+
if (key.endsWith("[]")) (form[key] ??= []).push(value2);
|
|
1719
|
+
else if (Array.isArray(form[key])) form[key].push(value2);
|
|
1720
|
+
else if (key in form) form[key] = [
|
|
1721
|
+
form[key],
|
|
1722
|
+
value2
|
|
1723
|
+
];
|
|
1724
|
+
else form[key] = value2;
|
|
1725
|
+
});
|
|
1726
|
+
value = form;
|
|
1727
|
+
break;
|
|
1728
|
+
}
|
|
1729
|
+
case "query":
|
|
1730
|
+
value = Object.fromEntries(Object.entries(c.req.queries()).map(([k, v])=>1 === v.length ? [
|
|
1731
|
+
k,
|
|
1732
|
+
v[0]
|
|
1733
|
+
] : [
|
|
1734
|
+
k,
|
|
1735
|
+
v
|
|
1736
|
+
]));
|
|
1737
|
+
break;
|
|
1738
|
+
case "param":
|
|
1739
|
+
value = c.req.param();
|
|
1740
|
+
break;
|
|
1741
|
+
case "header":
|
|
1742
|
+
value = c.req.header();
|
|
1743
|
+
break;
|
|
1744
|
+
case "cookie":
|
|
1745
|
+
value = getCookie(c);
|
|
1746
|
+
break;
|
|
1747
|
+
}
|
|
1748
|
+
const res = await validationFunc(value, c);
|
|
1749
|
+
if (res instanceof Response) return res;
|
|
1750
|
+
c.req.addValidatedData(target, res);
|
|
1751
|
+
await next();
|
|
1752
|
+
};
|
|
1753
|
+
const typiaValidator = (target, validate, hook)=>validator(target, async (value, c)=>{
|
|
1754
|
+
const result = validate(value);
|
|
1755
|
+
if (hook) {
|
|
1756
|
+
const hookResult = await hook({
|
|
1757
|
+
...result,
|
|
1758
|
+
data: value
|
|
1759
|
+
}, c);
|
|
1760
|
+
if (hookResult) {
|
|
1761
|
+
if (hookResult instanceof Response || hookResult instanceof Promise) return hookResult;
|
|
1762
|
+
if ('response' in hookResult) return hookResult.response;
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
if (!result.success) return c.json({
|
|
1766
|
+
success: false,
|
|
1767
|
+
error: result.errors
|
|
1768
|
+
}, 400);
|
|
1769
|
+
return result.data;
|
|
1770
|
+
});
|
|
2427
1771
|
const plugin_core_namespaceObject = require("@hot-updater/plugin-core");
|
|
2428
|
-
const
|
|
1772
|
+
const queryBundlesSchema = (()=>{
|
|
1773
|
+
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);
|
|
1774
|
+
const _vo0 = (input, _path, _exceptionable = true)=>[
|
|
1775
|
+
void 0 === input.channel || "string" == typeof input.channel || _report(_exceptionable, {
|
|
1776
|
+
path: _path + ".channel",
|
|
1777
|
+
expected: "(string | undefined)",
|
|
1778
|
+
value: input.channel
|
|
1779
|
+
}),
|
|
1780
|
+
void 0 === input.platform || "ios" === input.platform || "android" === input.platform || _report(_exceptionable, {
|
|
1781
|
+
path: _path + ".platform",
|
|
1782
|
+
expected: "(\"android\" | \"ios\" | undefined)",
|
|
1783
|
+
value: input.platform
|
|
1784
|
+
}),
|
|
1785
|
+
void 0 === input.limit || "string" == typeof input.limit || _report(_exceptionable, {
|
|
1786
|
+
path: _path + ".limit",
|
|
1787
|
+
expected: "(string | undefined)",
|
|
1788
|
+
value: input.limit
|
|
1789
|
+
}),
|
|
1790
|
+
void 0 === input.offset || "string" == typeof input.offset || _report(_exceptionable, {
|
|
1791
|
+
path: _path + ".offset",
|
|
1792
|
+
expected: "(string | undefined)",
|
|
1793
|
+
value: input.offset
|
|
1794
|
+
})
|
|
1795
|
+
].every((flag)=>flag);
|
|
1796
|
+
const __is = (input)=>"object" == typeof input && null !== input && false === Array.isArray(input) && _io0(input);
|
|
1797
|
+
let errors;
|
|
1798
|
+
let _report;
|
|
1799
|
+
return (input)=>{
|
|
1800
|
+
if (false === __is(input)) {
|
|
1801
|
+
errors = [];
|
|
1802
|
+
_report = _validateReport._validateReport(errors);
|
|
1803
|
+
((input, _path, _exceptionable = true)=>("object" == typeof input && null !== input && false === Array.isArray(input) || _report(true, {
|
|
1804
|
+
path: _path + "",
|
|
1805
|
+
expected: "__type",
|
|
1806
|
+
value: input
|
|
1807
|
+
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
1808
|
+
path: _path + "",
|
|
1809
|
+
expected: "__type",
|
|
1810
|
+
value: input
|
|
1811
|
+
}))(input, "$input", true);
|
|
1812
|
+
const success = 0 === errors.length;
|
|
1813
|
+
return success ? {
|
|
1814
|
+
success,
|
|
1815
|
+
data: input
|
|
1816
|
+
} : {
|
|
1817
|
+
success,
|
|
1818
|
+
errors,
|
|
1819
|
+
data: input
|
|
1820
|
+
};
|
|
1821
|
+
}
|
|
1822
|
+
return {
|
|
1823
|
+
success: true,
|
|
1824
|
+
data: input
|
|
1825
|
+
};
|
|
1826
|
+
};
|
|
1827
|
+
})();
|
|
1828
|
+
const paramBundleIdSchema = (()=>{
|
|
2429
1829
|
const _io0 = (input)=>"string" == typeof input.bundleId;
|
|
2430
1830
|
const _vo0 = (input, _path, _exceptionable = true)=>[
|
|
2431
1831
|
"string" == typeof input.bundleId || _report(_exceptionable, {
|
|
@@ -2466,26 +1866,9 @@ var __webpack_exports__ = {};
|
|
|
2466
1866
|
};
|
|
2467
1867
|
};
|
|
2468
1868
|
})();
|
|
2469
|
-
const
|
|
2470
|
-
const _io0 = (input)=>"string" == typeof input.
|
|
2471
|
-
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);
|
|
1869
|
+
const updateBundleSchema = (()=>{
|
|
1870
|
+
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);
|
|
2472
1871
|
const _vo0 = (input, _path, _exceptionable = true)=>[
|
|
2473
|
-
"string" == typeof input.targetBundleId || _report(_exceptionable, {
|
|
2474
|
-
path: _path + ".targetBundleId",
|
|
2475
|
-
expected: "string",
|
|
2476
|
-
value: input.targetBundleId
|
|
2477
|
-
}),
|
|
2478
|
-
("object" == typeof input.bundle && null !== input.bundle && false === Array.isArray(input.bundle) || _report(_exceptionable, {
|
|
2479
|
-
path: _path + ".bundle",
|
|
2480
|
-
expected: "Partial<Bundle>",
|
|
2481
|
-
value: input.bundle
|
|
2482
|
-
})) && _vo1(input.bundle, _path + ".bundle", _exceptionable) || _report(_exceptionable, {
|
|
2483
|
-
path: _path + ".bundle",
|
|
2484
|
-
expected: "Partial<Bundle>",
|
|
2485
|
-
value: input.bundle
|
|
2486
|
-
})
|
|
2487
|
-
].every((flag)=>flag);
|
|
2488
|
-
const _vo1 = (input, _path, _exceptionable = true)=>[
|
|
2489
1872
|
void 0 === input.id || "string" == typeof input.id || _report(_exceptionable, {
|
|
2490
1873
|
path: _path + ".id",
|
|
2491
1874
|
expected: "(string | undefined)",
|
|
@@ -2511,11 +1894,6 @@ var __webpack_exports__ = {};
|
|
|
2511
1894
|
expected: "(boolean | undefined)",
|
|
2512
1895
|
value: input.enabled
|
|
2513
1896
|
}),
|
|
2514
|
-
void 0 === input.fileUrl || "string" == typeof input.fileUrl || _report(_exceptionable, {
|
|
2515
|
-
path: _path + ".fileUrl",
|
|
2516
|
-
expected: "(string | undefined)",
|
|
2517
|
-
value: input.fileUrl
|
|
2518
|
-
}),
|
|
2519
1897
|
void 0 === input.fileHash || "string" == typeof input.fileHash || _report(_exceptionable, {
|
|
2520
1898
|
path: _path + ".fileHash",
|
|
2521
1899
|
expected: "(string | undefined)",
|
|
@@ -2530,22 +1908,27 @@ var __webpack_exports__ = {};
|
|
|
2530
1908
|
path: _path + ".message",
|
|
2531
1909
|
expected: "(null | string | undefined)",
|
|
2532
1910
|
value: input.message
|
|
1911
|
+
}),
|
|
1912
|
+
void 0 === input.channel || "string" == typeof input.channel || _report(_exceptionable, {
|
|
1913
|
+
path: _path + ".channel",
|
|
1914
|
+
expected: "(string | undefined)",
|
|
1915
|
+
value: input.channel
|
|
2533
1916
|
})
|
|
2534
1917
|
].every((flag)=>flag);
|
|
2535
|
-
const __is = (input)=>"object" == typeof input && null !== input && _io0(input);
|
|
1918
|
+
const __is = (input)=>"object" == typeof input && null !== input && false === Array.isArray(input) && _io0(input);
|
|
2536
1919
|
let errors;
|
|
2537
1920
|
let _report;
|
|
2538
1921
|
return (input)=>{
|
|
2539
1922
|
if (false === __is(input)) {
|
|
2540
1923
|
errors = [];
|
|
2541
1924
|
_report = _validateReport._validateReport(errors);
|
|
2542
|
-
((input, _path, _exceptionable = true)=>("object" == typeof input && null !== input || _report(true, {
|
|
1925
|
+
((input, _path, _exceptionable = true)=>("object" == typeof input && null !== input && false === Array.isArray(input) || _report(true, {
|
|
2543
1926
|
path: _path + "",
|
|
2544
|
-
expected: "
|
|
1927
|
+
expected: "Partial<Bundle>",
|
|
2545
1928
|
value: input
|
|
2546
1929
|
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
2547
1930
|
path: _path + "",
|
|
2548
|
-
expected: "
|
|
1931
|
+
expected: "Partial<Bundle>",
|
|
2549
1932
|
value: input
|
|
2550
1933
|
}))(input, "$input", true);
|
|
2551
1934
|
const success = 0 === errors.length;
|
|
@@ -2564,42 +1947,104 @@ var __webpack_exports__ = {};
|
|
|
2564
1947
|
};
|
|
2565
1948
|
};
|
|
2566
1949
|
})();
|
|
2567
|
-
let
|
|
2568
|
-
let rpc_databasePlugin = null;
|
|
1950
|
+
let configPromise = null;
|
|
2569
1951
|
const prepareConfig = async ()=>{
|
|
2570
|
-
if (!
|
|
2571
|
-
|
|
2572
|
-
|
|
1952
|
+
if (!configPromise) configPromise = (async ()=>{
|
|
1953
|
+
try {
|
|
1954
|
+
const config = await (0, plugin_core_namespaceObject.loadConfig)(null);
|
|
1955
|
+
const databasePlugin = await config?.database({
|
|
1956
|
+
cwd: plugin_core_namespaceObject.getCwd()
|
|
1957
|
+
}) ?? null;
|
|
1958
|
+
if (!databasePlugin) throw new Error("Database plugin initialization failed");
|
|
1959
|
+
return {
|
|
1960
|
+
config,
|
|
1961
|
+
databasePlugin
|
|
1962
|
+
};
|
|
1963
|
+
} catch (error) {
|
|
1964
|
+
console.error("Error during configuration initialization:", error);
|
|
1965
|
+
throw error;
|
|
1966
|
+
}
|
|
1967
|
+
})();
|
|
1968
|
+
return configPromise;
|
|
1969
|
+
};
|
|
1970
|
+
const rpc = new hono_Hono().get("/config", async (c)=>{
|
|
1971
|
+
try {
|
|
1972
|
+
const { config } = await prepareConfig();
|
|
1973
|
+
return c.json({
|
|
1974
|
+
console: config.console
|
|
2573
1975
|
});
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
1976
|
+
} catch (error) {
|
|
1977
|
+
console.error("Error during config retrieval:", error);
|
|
1978
|
+
throw error;
|
|
1979
|
+
}
|
|
1980
|
+
}).get("/channels", async (c)=>{
|
|
1981
|
+
try {
|
|
1982
|
+
const { databasePlugin } = await prepareConfig();
|
|
1983
|
+
const channels = await databasePlugin.getChannels();
|
|
1984
|
+
return c.json(channels ?? []);
|
|
1985
|
+
} catch (error) {
|
|
1986
|
+
console.error("Error during channel retrieval:", error);
|
|
1987
|
+
throw error;
|
|
1988
|
+
}
|
|
1989
|
+
}).get("/config-loaded", (c)=>{
|
|
1990
|
+
try {
|
|
1991
|
+
const isLoaded = !!configPromise;
|
|
1992
|
+
return c.json({
|
|
1993
|
+
configLoaded: isLoaded
|
|
1994
|
+
});
|
|
1995
|
+
} catch (error) {
|
|
1996
|
+
console.error("Error during config loaded retrieval:", error);
|
|
1997
|
+
throw error;
|
|
1998
|
+
}
|
|
1999
|
+
}).get("/bundles", typiaValidator("query", queryBundlesSchema), async (c)=>{
|
|
2000
|
+
try {
|
|
2001
|
+
const query = c.req.valid("query");
|
|
2002
|
+
const { databasePlugin } = await prepareConfig();
|
|
2003
|
+
const bundles = await databasePlugin.getBundles({
|
|
2004
|
+
where: {
|
|
2005
|
+
channel: query.channel ?? void 0,
|
|
2006
|
+
platform: query.platform ?? void 0
|
|
2007
|
+
},
|
|
2008
|
+
limit: query.limit ? Number(query.limit) : void 0,
|
|
2009
|
+
offset: query.offset ? Number(query.offset) : void 0
|
|
2010
|
+
});
|
|
2011
|
+
return c.json(bundles ?? []);
|
|
2012
|
+
} catch (error) {
|
|
2013
|
+
console.error("Error during bundle retrieval:", error);
|
|
2014
|
+
throw error;
|
|
2015
|
+
}
|
|
2016
|
+
}).get("/bundles/:bundleId", typiaValidator("param", paramBundleIdSchema), async (c)=>{
|
|
2017
|
+
try {
|
|
2018
|
+
const { bundleId } = c.req.valid("param");
|
|
2019
|
+
const { databasePlugin } = await prepareConfig();
|
|
2020
|
+
const bundle = await databasePlugin.getBundleById(bundleId);
|
|
2021
|
+
return c.json(bundle ?? null);
|
|
2022
|
+
} catch (error) {
|
|
2023
|
+
console.error("Error during bundle retrieval:", error);
|
|
2024
|
+
throw error;
|
|
2025
|
+
}
|
|
2026
|
+
}).patch("/bundles/:bundleId", typiaValidator("json", updateBundleSchema), async (c)=>{
|
|
2027
|
+
try {
|
|
2028
|
+
const bundleId = c.req.param("bundleId");
|
|
2029
|
+
const partialBundle = c.req.valid("json");
|
|
2030
|
+
if (!bundleId) return c.json({
|
|
2031
|
+
error: "Target bundle ID is required"
|
|
2032
|
+
}, 400);
|
|
2033
|
+
const { databasePlugin } = await prepareConfig();
|
|
2034
|
+
await databasePlugin.updateBundle(bundleId, partialBundle);
|
|
2035
|
+
await databasePlugin.commitBundle();
|
|
2036
|
+
return c.json({
|
|
2037
|
+
success: true
|
|
2038
|
+
});
|
|
2039
|
+
} catch (error) {
|
|
2040
|
+
console.error("Error during bundle update:", error);
|
|
2041
|
+
if (error && "object" == typeof error && "message" in error) return c.json({
|
|
2042
|
+
error: error.message
|
|
2043
|
+
}, 500);
|
|
2044
|
+
return c.json({
|
|
2045
|
+
error: "Unknown error"
|
|
2046
|
+
}, 500);
|
|
2577
2047
|
}
|
|
2578
|
-
return {
|
|
2579
|
-
config: rpc_config,
|
|
2580
|
-
databasePlugin: rpc_databasePlugin
|
|
2581
|
-
};
|
|
2582
|
-
};
|
|
2583
|
-
const rpc = new hono_Hono().get("/getConfig", async (c)=>{
|
|
2584
|
-
const { config } = await prepareConfig();
|
|
2585
|
-
return c.json({
|
|
2586
|
-
console: config?.console
|
|
2587
|
-
});
|
|
2588
|
-
}).get("/isConfigLoaded", (c)=>c.json(null !== rpc_config)).get("/getBundles", async (c)=>{
|
|
2589
|
-
const { databasePlugin } = await prepareConfig();
|
|
2590
|
-
const bundles = await databasePlugin?.getBundles(true);
|
|
2591
|
-
return c.json(bundles ?? []);
|
|
2592
|
-
}).get("/getBundleById", (0, cjs.typiaValidator)("query", bundleIdValidator), async (c)=>{
|
|
2593
|
-
const { bundleId } = c.req.valid("query");
|
|
2594
|
-
const { databasePlugin } = await prepareConfig();
|
|
2595
|
-
const bundle = await databasePlugin?.getBundleById(bundleId);
|
|
2596
|
-
return c.json(bundle ?? null);
|
|
2597
|
-
}).post("/updateBundle", (0, cjs.typiaValidator)("json", updateBundleValidator), async (c)=>{
|
|
2598
|
-
const { targetBundleId, bundle } = c.req.valid("json");
|
|
2599
|
-
const { databasePlugin } = await prepareConfig();
|
|
2600
|
-
await databasePlugin?.updateBundle(targetBundleId, bundle);
|
|
2601
|
-
await databasePlugin?.commitBundle();
|
|
2602
|
-
return c.json(true);
|
|
2603
2048
|
});
|
|
2604
2049
|
const src_server_rslib_entry_dirname = external_path_default().dirname((0, external_url_namespaceObject.fileURLToPath)(__rslib_import_meta_url__));
|
|
2605
2050
|
const relativePathToScript = external_path_default().relative(process.cwd(), src_server_rslib_entry_dirname);
|