@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.js
CHANGED
|
@@ -5,29 +5,6 @@ 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
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
8
|
"../../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
9
|
exports._validateReport = void 0;
|
|
33
10
|
const _validateReport = (array)=>{
|
|
@@ -42,788 +19,6 @@ var __webpack_modules__ = {
|
|
|
42
19
|
};
|
|
43
20
|
};
|
|
44
21
|
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
22
|
}
|
|
828
23
|
};
|
|
829
24
|
var __webpack_module_cache__ = {};
|
|
@@ -2385,8 +1580,213 @@ var hono_Hono = class extends Hono {
|
|
|
2385
1580
|
}
|
|
2386
1581
|
};
|
|
2387
1582
|
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
|
|
2389
|
-
|
|
1583
|
+
var validCookieNameRegEx = /^[\w!#$%&'*.^`|~+-]+$/;
|
|
1584
|
+
var validCookieValueRegEx = /^[ !#-:<-[\]-~]*$/;
|
|
1585
|
+
var parse = (cookie, name)=>{
|
|
1586
|
+
const pairs = cookie.trim().split(";");
|
|
1587
|
+
return pairs.reduce((parsedCookie, pairStr)=>{
|
|
1588
|
+
pairStr = pairStr.trim();
|
|
1589
|
+
const valueStartPos = pairStr.indexOf("=");
|
|
1590
|
+
if (-1 === valueStartPos) return parsedCookie;
|
|
1591
|
+
const cookieName = pairStr.substring(0, valueStartPos).trim();
|
|
1592
|
+
if (name && name !== cookieName || !validCookieNameRegEx.test(cookieName)) return parsedCookie;
|
|
1593
|
+
let cookieValue = pairStr.substring(valueStartPos + 1).trim();
|
|
1594
|
+
if (cookieValue.startsWith('"') && cookieValue.endsWith('"')) cookieValue = cookieValue.slice(1, -1);
|
|
1595
|
+
if (validCookieValueRegEx.test(cookieValue)) parsedCookie[cookieName] = decodeURIComponent_(cookieValue);
|
|
1596
|
+
return parsedCookie;
|
|
1597
|
+
}, {});
|
|
1598
|
+
};
|
|
1599
|
+
var getCookie = (c, key, prefix)=>{
|
|
1600
|
+
const cookie = c.req.raw.headers.get("Cookie");
|
|
1601
|
+
if ("string" == typeof key) {
|
|
1602
|
+
if (!cookie) return;
|
|
1603
|
+
let finalKey = key;
|
|
1604
|
+
if ("secure" === prefix) finalKey = "__Secure-" + key;
|
|
1605
|
+
else if ("host" === prefix) finalKey = "__Host-" + key;
|
|
1606
|
+
const obj2 = parse(cookie, finalKey);
|
|
1607
|
+
return obj2[finalKey];
|
|
1608
|
+
}
|
|
1609
|
+
if (!cookie) return {};
|
|
1610
|
+
const obj = parse(cookie);
|
|
1611
|
+
return obj;
|
|
1612
|
+
};
|
|
1613
|
+
var HTTPException = class extends Error {
|
|
1614
|
+
res;
|
|
1615
|
+
status;
|
|
1616
|
+
constructor(status = 500, options){
|
|
1617
|
+
super(options?.message, {
|
|
1618
|
+
cause: options?.cause
|
|
1619
|
+
});
|
|
1620
|
+
this.res = options?.res;
|
|
1621
|
+
this.status = status;
|
|
1622
|
+
}
|
|
1623
|
+
getResponse() {
|
|
1624
|
+
if (this.res) {
|
|
1625
|
+
const newResponse = new Response(this.res.body, {
|
|
1626
|
+
status: this.status,
|
|
1627
|
+
headers: this.res.headers
|
|
1628
|
+
});
|
|
1629
|
+
return newResponse;
|
|
1630
|
+
}
|
|
1631
|
+
return new Response(this.message, {
|
|
1632
|
+
status: this.status
|
|
1633
|
+
});
|
|
1634
|
+
}
|
|
1635
|
+
};
|
|
1636
|
+
var bufferToFormData = (arrayBuffer, contentType)=>{
|
|
1637
|
+
const response = new Response(arrayBuffer, {
|
|
1638
|
+
headers: {
|
|
1639
|
+
"Content-Type": contentType
|
|
1640
|
+
}
|
|
1641
|
+
});
|
|
1642
|
+
return response.formData();
|
|
1643
|
+
};
|
|
1644
|
+
var jsonRegex = /^application\/([a-z-\.]+\+)?json(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/;
|
|
1645
|
+
var multipartRegex = /^multipart\/form-data(;\s?boundary=[a-zA-Z0-9'"()+_,\-./:=?]+)?$/;
|
|
1646
|
+
var urlencodedRegex = /^application\/x-www-form-urlencoded(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/;
|
|
1647
|
+
var validator = (target, validationFunc)=>async (c, next)=>{
|
|
1648
|
+
let value = {};
|
|
1649
|
+
const contentType = c.req.header("Content-Type");
|
|
1650
|
+
switch(target){
|
|
1651
|
+
case "json":
|
|
1652
|
+
if (!contentType || !jsonRegex.test(contentType)) break;
|
|
1653
|
+
try {
|
|
1654
|
+
value = await c.req.json();
|
|
1655
|
+
} catch {
|
|
1656
|
+
const message = "Malformed JSON in request body";
|
|
1657
|
+
throw new HTTPException(400, {
|
|
1658
|
+
message
|
|
1659
|
+
});
|
|
1660
|
+
}
|
|
1661
|
+
break;
|
|
1662
|
+
case "form":
|
|
1663
|
+
{
|
|
1664
|
+
if (!contentType || !(multipartRegex.test(contentType) || urlencodedRegex.test(contentType))) break;
|
|
1665
|
+
let formData;
|
|
1666
|
+
if (c.req.bodyCache.formData) formData = await c.req.bodyCache.formData;
|
|
1667
|
+
else try {
|
|
1668
|
+
const arrayBuffer = await c.req.arrayBuffer();
|
|
1669
|
+
formData = await bufferToFormData(arrayBuffer, contentType);
|
|
1670
|
+
c.req.bodyCache.formData = formData;
|
|
1671
|
+
} catch (e) {
|
|
1672
|
+
let message = "Malformed FormData request.";
|
|
1673
|
+
message += e instanceof Error ? ` ${e.message}` : ` ${String(e)}`;
|
|
1674
|
+
throw new HTTPException(400, {
|
|
1675
|
+
message
|
|
1676
|
+
});
|
|
1677
|
+
}
|
|
1678
|
+
const form = {};
|
|
1679
|
+
formData.forEach((value2, key)=>{
|
|
1680
|
+
if (key.endsWith("[]")) (form[key] ??= []).push(value2);
|
|
1681
|
+
else if (Array.isArray(form[key])) form[key].push(value2);
|
|
1682
|
+
else if (key in form) form[key] = [
|
|
1683
|
+
form[key],
|
|
1684
|
+
value2
|
|
1685
|
+
];
|
|
1686
|
+
else form[key] = value2;
|
|
1687
|
+
});
|
|
1688
|
+
value = form;
|
|
1689
|
+
break;
|
|
1690
|
+
}
|
|
1691
|
+
case "query":
|
|
1692
|
+
value = Object.fromEntries(Object.entries(c.req.queries()).map(([k, v])=>1 === v.length ? [
|
|
1693
|
+
k,
|
|
1694
|
+
v[0]
|
|
1695
|
+
] : [
|
|
1696
|
+
k,
|
|
1697
|
+
v
|
|
1698
|
+
]));
|
|
1699
|
+
break;
|
|
1700
|
+
case "param":
|
|
1701
|
+
value = c.req.param();
|
|
1702
|
+
break;
|
|
1703
|
+
case "header":
|
|
1704
|
+
value = c.req.header();
|
|
1705
|
+
break;
|
|
1706
|
+
case "cookie":
|
|
1707
|
+
value = getCookie(c);
|
|
1708
|
+
break;
|
|
1709
|
+
}
|
|
1710
|
+
const res = await validationFunc(value, c);
|
|
1711
|
+
if (res instanceof Response) return res;
|
|
1712
|
+
c.req.addValidatedData(target, res);
|
|
1713
|
+
await next();
|
|
1714
|
+
};
|
|
1715
|
+
const typiaValidator = (target, validate, hook)=>validator(target, async (value, c)=>{
|
|
1716
|
+
const result = validate(value);
|
|
1717
|
+
if (hook) {
|
|
1718
|
+
const hookResult = await hook({
|
|
1719
|
+
...result,
|
|
1720
|
+
data: value
|
|
1721
|
+
}, c);
|
|
1722
|
+
if (hookResult) {
|
|
1723
|
+
if (hookResult instanceof Response || hookResult instanceof Promise) return hookResult;
|
|
1724
|
+
if ('response' in hookResult) return hookResult.response;
|
|
1725
|
+
}
|
|
1726
|
+
}
|
|
1727
|
+
if (!result.success) return c.json({
|
|
1728
|
+
success: false,
|
|
1729
|
+
error: result.errors
|
|
1730
|
+
}, 400);
|
|
1731
|
+
return result.data;
|
|
1732
|
+
});
|
|
1733
|
+
const queryBundlesSchema = (()=>{
|
|
1734
|
+
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);
|
|
1735
|
+
const _vo0 = (input, _path, _exceptionable = true)=>[
|
|
1736
|
+
void 0 === input.channel || "string" == typeof input.channel || _report(_exceptionable, {
|
|
1737
|
+
path: _path + ".channel",
|
|
1738
|
+
expected: "(string | undefined)",
|
|
1739
|
+
value: input.channel
|
|
1740
|
+
}),
|
|
1741
|
+
void 0 === input.platform || "ios" === input.platform || "android" === input.platform || _report(_exceptionable, {
|
|
1742
|
+
path: _path + ".platform",
|
|
1743
|
+
expected: "(\"android\" | \"ios\" | undefined)",
|
|
1744
|
+
value: input.platform
|
|
1745
|
+
}),
|
|
1746
|
+
void 0 === input.limit || "string" == typeof input.limit || _report(_exceptionable, {
|
|
1747
|
+
path: _path + ".limit",
|
|
1748
|
+
expected: "(string | undefined)",
|
|
1749
|
+
value: input.limit
|
|
1750
|
+
}),
|
|
1751
|
+
void 0 === input.offset || "string" == typeof input.offset || _report(_exceptionable, {
|
|
1752
|
+
path: _path + ".offset",
|
|
1753
|
+
expected: "(string | undefined)",
|
|
1754
|
+
value: input.offset
|
|
1755
|
+
})
|
|
1756
|
+
].every((flag)=>flag);
|
|
1757
|
+
const __is = (input)=>"object" == typeof input && null !== input && false === Array.isArray(input) && _io0(input);
|
|
1758
|
+
let errors;
|
|
1759
|
+
let _report;
|
|
1760
|
+
return (input)=>{
|
|
1761
|
+
if (false === __is(input)) {
|
|
1762
|
+
errors = [];
|
|
1763
|
+
_report = _validateReport._validateReport(errors);
|
|
1764
|
+
((input, _path, _exceptionable = true)=>("object" == typeof input && null !== input && false === Array.isArray(input) || _report(true, {
|
|
1765
|
+
path: _path + "",
|
|
1766
|
+
expected: "__type",
|
|
1767
|
+
value: input
|
|
1768
|
+
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
1769
|
+
path: _path + "",
|
|
1770
|
+
expected: "__type",
|
|
1771
|
+
value: input
|
|
1772
|
+
}))(input, "$input", true);
|
|
1773
|
+
const success = 0 === errors.length;
|
|
1774
|
+
return success ? {
|
|
1775
|
+
success,
|
|
1776
|
+
data: input
|
|
1777
|
+
} : {
|
|
1778
|
+
success,
|
|
1779
|
+
errors,
|
|
1780
|
+
data: input
|
|
1781
|
+
};
|
|
1782
|
+
}
|
|
1783
|
+
return {
|
|
1784
|
+
success: true,
|
|
1785
|
+
data: input
|
|
1786
|
+
};
|
|
1787
|
+
};
|
|
1788
|
+
})();
|
|
1789
|
+
const paramBundleIdSchema = (()=>{
|
|
2390
1790
|
const _io0 = (input)=>"string" == typeof input.bundleId;
|
|
2391
1791
|
const _vo0 = (input, _path, _exceptionable = true)=>[
|
|
2392
1792
|
"string" == typeof input.bundleId || _report(_exceptionable, {
|
|
@@ -2427,26 +1827,9 @@ const bundleIdValidator = (()=>{
|
|
|
2427
1827
|
};
|
|
2428
1828
|
};
|
|
2429
1829
|
})();
|
|
2430
|
-
const
|
|
2431
|
-
const _io0 = (input)=>"string" == typeof input.
|
|
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);
|
|
1830
|
+
const updateBundleSchema = (()=>{
|
|
1831
|
+
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);
|
|
2433
1832
|
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
1833
|
void 0 === input.id || "string" == typeof input.id || _report(_exceptionable, {
|
|
2451
1834
|
path: _path + ".id",
|
|
2452
1835
|
expected: "(string | undefined)",
|
|
@@ -2472,11 +1855,6 @@ const updateBundleValidator = (()=>{
|
|
|
2472
1855
|
expected: "(boolean | undefined)",
|
|
2473
1856
|
value: input.enabled
|
|
2474
1857
|
}),
|
|
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
1858
|
void 0 === input.fileHash || "string" == typeof input.fileHash || _report(_exceptionable, {
|
|
2481
1859
|
path: _path + ".fileHash",
|
|
2482
1860
|
expected: "(string | undefined)",
|
|
@@ -2491,22 +1869,27 @@ const updateBundleValidator = (()=>{
|
|
|
2491
1869
|
path: _path + ".message",
|
|
2492
1870
|
expected: "(null | string | undefined)",
|
|
2493
1871
|
value: input.message
|
|
1872
|
+
}),
|
|
1873
|
+
void 0 === input.channel || "string" == typeof input.channel || _report(_exceptionable, {
|
|
1874
|
+
path: _path + ".channel",
|
|
1875
|
+
expected: "(string | undefined)",
|
|
1876
|
+
value: input.channel
|
|
2494
1877
|
})
|
|
2495
1878
|
].every((flag)=>flag);
|
|
2496
|
-
const __is = (input)=>"object" == typeof input && null !== input && _io0(input);
|
|
1879
|
+
const __is = (input)=>"object" == typeof input && null !== input && false === Array.isArray(input) && _io0(input);
|
|
2497
1880
|
let errors;
|
|
2498
1881
|
let _report;
|
|
2499
1882
|
return (input)=>{
|
|
2500
1883
|
if (false === __is(input)) {
|
|
2501
1884
|
errors = [];
|
|
2502
1885
|
_report = _validateReport._validateReport(errors);
|
|
2503
|
-
((input, _path, _exceptionable = true)=>("object" == typeof input && null !== input || _report(true, {
|
|
1886
|
+
((input, _path, _exceptionable = true)=>("object" == typeof input && null !== input && false === Array.isArray(input) || _report(true, {
|
|
2504
1887
|
path: _path + "",
|
|
2505
|
-
expected: "
|
|
1888
|
+
expected: "Partial<Bundle>",
|
|
2506
1889
|
value: input
|
|
2507
1890
|
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
2508
1891
|
path: _path + "",
|
|
2509
|
-
expected: "
|
|
1892
|
+
expected: "Partial<Bundle>",
|
|
2510
1893
|
value: input
|
|
2511
1894
|
}))(input, "$input", true);
|
|
2512
1895
|
const success = 0 === errors.length;
|
|
@@ -2525,42 +1908,104 @@ const updateBundleValidator = (()=>{
|
|
|
2525
1908
|
};
|
|
2526
1909
|
};
|
|
2527
1910
|
})();
|
|
2528
|
-
let
|
|
2529
|
-
let rpc_databasePlugin = null;
|
|
1911
|
+
let configPromise = null;
|
|
2530
1912
|
const prepareConfig = async ()=>{
|
|
2531
|
-
if (!
|
|
2532
|
-
|
|
2533
|
-
|
|
1913
|
+
if (!configPromise) configPromise = (async ()=>{
|
|
1914
|
+
try {
|
|
1915
|
+
const config = await (0, __WEBPACK_EXTERNAL_MODULE__hot_updater_plugin_core_40c1c502__.loadConfig)(null);
|
|
1916
|
+
const databasePlugin = await config?.database({
|
|
1917
|
+
cwd: __WEBPACK_EXTERNAL_MODULE__hot_updater_plugin_core_40c1c502__.getCwd()
|
|
1918
|
+
}) ?? null;
|
|
1919
|
+
if (!databasePlugin) throw new Error("Database plugin initialization failed");
|
|
1920
|
+
return {
|
|
1921
|
+
config,
|
|
1922
|
+
databasePlugin
|
|
1923
|
+
};
|
|
1924
|
+
} catch (error) {
|
|
1925
|
+
console.error("Error during configuration initialization:", error);
|
|
1926
|
+
throw error;
|
|
1927
|
+
}
|
|
1928
|
+
})();
|
|
1929
|
+
return configPromise;
|
|
1930
|
+
};
|
|
1931
|
+
const rpc = new hono_Hono().get("/config", async (c)=>{
|
|
1932
|
+
try {
|
|
1933
|
+
const { config } = await prepareConfig();
|
|
1934
|
+
return c.json({
|
|
1935
|
+
console: config.console
|
|
2534
1936
|
});
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
1937
|
+
} catch (error) {
|
|
1938
|
+
console.error("Error during config retrieval:", error);
|
|
1939
|
+
throw error;
|
|
1940
|
+
}
|
|
1941
|
+
}).get("/channels", async (c)=>{
|
|
1942
|
+
try {
|
|
1943
|
+
const { databasePlugin } = await prepareConfig();
|
|
1944
|
+
const channels = await databasePlugin.getChannels();
|
|
1945
|
+
return c.json(channels ?? []);
|
|
1946
|
+
} catch (error) {
|
|
1947
|
+
console.error("Error during channel retrieval:", error);
|
|
1948
|
+
throw error;
|
|
1949
|
+
}
|
|
1950
|
+
}).get("/config-loaded", (c)=>{
|
|
1951
|
+
try {
|
|
1952
|
+
const isLoaded = !!configPromise;
|
|
1953
|
+
return c.json({
|
|
1954
|
+
configLoaded: isLoaded
|
|
1955
|
+
});
|
|
1956
|
+
} catch (error) {
|
|
1957
|
+
console.error("Error during config loaded retrieval:", error);
|
|
1958
|
+
throw error;
|
|
1959
|
+
}
|
|
1960
|
+
}).get("/bundles", typiaValidator("query", queryBundlesSchema), async (c)=>{
|
|
1961
|
+
try {
|
|
1962
|
+
const query = c.req.valid("query");
|
|
1963
|
+
const { databasePlugin } = await prepareConfig();
|
|
1964
|
+
const bundles = await databasePlugin.getBundles({
|
|
1965
|
+
where: {
|
|
1966
|
+
channel: query.channel ?? void 0,
|
|
1967
|
+
platform: query.platform ?? void 0
|
|
1968
|
+
},
|
|
1969
|
+
limit: query.limit ? Number(query.limit) : void 0,
|
|
1970
|
+
offset: query.offset ? Number(query.offset) : void 0
|
|
1971
|
+
});
|
|
1972
|
+
return c.json(bundles ?? []);
|
|
1973
|
+
} catch (error) {
|
|
1974
|
+
console.error("Error during bundle retrieval:", error);
|
|
1975
|
+
throw error;
|
|
1976
|
+
}
|
|
1977
|
+
}).get("/bundles/:bundleId", typiaValidator("param", paramBundleIdSchema), async (c)=>{
|
|
1978
|
+
try {
|
|
1979
|
+
const { bundleId } = c.req.valid("param");
|
|
1980
|
+
const { databasePlugin } = await prepareConfig();
|
|
1981
|
+
const bundle = await databasePlugin.getBundleById(bundleId);
|
|
1982
|
+
return c.json(bundle ?? null);
|
|
1983
|
+
} catch (error) {
|
|
1984
|
+
console.error("Error during bundle retrieval:", error);
|
|
1985
|
+
throw error;
|
|
1986
|
+
}
|
|
1987
|
+
}).patch("/bundles/:bundleId", typiaValidator("json", updateBundleSchema), async (c)=>{
|
|
1988
|
+
try {
|
|
1989
|
+
const bundleId = c.req.param("bundleId");
|
|
1990
|
+
const partialBundle = c.req.valid("json");
|
|
1991
|
+
if (!bundleId) return c.json({
|
|
1992
|
+
error: "Target bundle ID is required"
|
|
1993
|
+
}, 400);
|
|
1994
|
+
const { databasePlugin } = await prepareConfig();
|
|
1995
|
+
await databasePlugin.updateBundle(bundleId, partialBundle);
|
|
1996
|
+
await databasePlugin.commitBundle();
|
|
1997
|
+
return c.json({
|
|
1998
|
+
success: true
|
|
1999
|
+
});
|
|
2000
|
+
} catch (error) {
|
|
2001
|
+
console.error("Error during bundle update:", error);
|
|
2002
|
+
if (error && "object" == typeof error && "message" in error) return c.json({
|
|
2003
|
+
error: error.message
|
|
2004
|
+
}, 500);
|
|
2005
|
+
return c.json({
|
|
2006
|
+
error: "Unknown error"
|
|
2007
|
+
}, 500);
|
|
2538
2008
|
}
|
|
2539
|
-
return {
|
|
2540
|
-
config: rpc_config,
|
|
2541
|
-
databasePlugin: rpc_databasePlugin
|
|
2542
|
-
};
|
|
2543
|
-
};
|
|
2544
|
-
const rpc = new hono_Hono().get("/getConfig", async (c)=>{
|
|
2545
|
-
const { config } = await prepareConfig();
|
|
2546
|
-
return c.json({
|
|
2547
|
-
console: config?.console
|
|
2548
|
-
});
|
|
2549
|
-
}).get("/isConfigLoaded", (c)=>c.json(null !== rpc_config)).get("/getBundles", async (c)=>{
|
|
2550
|
-
const { databasePlugin } = await prepareConfig();
|
|
2551
|
-
const bundles = await databasePlugin?.getBundles(true);
|
|
2552
|
-
return c.json(bundles ?? []);
|
|
2553
|
-
}).get("/getBundleById", (0, cjs.typiaValidator)("query", bundleIdValidator), async (c)=>{
|
|
2554
|
-
const { bundleId } = c.req.valid("query");
|
|
2555
|
-
const { databasePlugin } = await prepareConfig();
|
|
2556
|
-
const bundle = await databasePlugin?.getBundleById(bundleId);
|
|
2557
|
-
return c.json(bundle ?? null);
|
|
2558
|
-
}).post("/updateBundle", (0, cjs.typiaValidator)("json", updateBundleValidator), async (c)=>{
|
|
2559
|
-
const { targetBundleId, bundle } = c.req.valid("json");
|
|
2560
|
-
const { databasePlugin } = await prepareConfig();
|
|
2561
|
-
await databasePlugin?.updateBundle(targetBundleId, bundle);
|
|
2562
|
-
await databasePlugin?.commitBundle();
|
|
2563
|
-
return c.json(true);
|
|
2564
2009
|
});
|
|
2565
2010
|
const src_server_rslib_entry_dirname = __WEBPACK_EXTERNAL_MODULE_path__["default"].dirname((0, __WEBPACK_EXTERNAL_MODULE_url__.fileURLToPath)(import.meta.url));
|
|
2566
2011
|
const relativePathToScript = __WEBPACK_EXTERNAL_MODULE_path__["default"].relative(process.cwd(), src_server_rslib_entry_dirname);
|