@sourceregistry/node-webserver 1.7.0 → 1.7.2
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/helpers/sse.d.ts +9 -1
- package/dist/index.cjs.js +4 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +101 -93
- package/dist/index.es.js.map +1 -1
- package/dist/types/router.d.ts +5 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -12,3 +12,4 @@ export declare const text: (body: MaybePromise<string>, init?: ResponseInit) =>
|
|
|
12
12
|
export declare const html: (html: MaybePromise<string>, init?: ResponseInit) => Promise<Response>;
|
|
13
13
|
export { default as dir } from './helpers/static';
|
|
14
14
|
export { default as sse } from './helpers/sse';
|
|
15
|
+
export type { SSEOptions, SSEHandler, SSEEmit, SSEEmitOptions } from './helpers/sse';
|
package/dist/index.es.js
CHANGED
|
@@ -49,7 +49,7 @@ var E = class {
|
|
|
49
49
|
this.cleanupInterval = setInterval(() => {
|
|
50
50
|
let e = Date.now();
|
|
51
51
|
for (let [t, { reset: n }] of this.data) e >= n && this.data.delete(t);
|
|
52
|
-
}, Math.min(this.windowMs, 3e5));
|
|
52
|
+
}, Math.min(this.windowMs, 3e5)), this.cleanupInterval?.unref();
|
|
53
53
|
}
|
|
54
54
|
stop() {
|
|
55
55
|
this.cleanupInterval && clearInterval(this.cleanupInterval);
|
|
@@ -77,7 +77,7 @@ var E = class {
|
|
|
77
77
|
let r = e - this.windowMs, i = n.filter((e) => e > r);
|
|
78
78
|
i.length === 0 ? this.data.delete(t) : this.data.set(t, i);
|
|
79
79
|
}
|
|
80
|
-
}, Math.min(this.windowMs, 3e5));
|
|
80
|
+
}, Math.min(this.windowMs, 3e5)), this.cleanupInterval.unref();
|
|
81
81
|
}
|
|
82
82
|
stop() {
|
|
83
83
|
this.cleanupInterval && clearInterval(this.cleanupInterval);
|
|
@@ -85,13 +85,13 @@ var E = class {
|
|
|
85
85
|
async resetAll() {
|
|
86
86
|
this.data.clear();
|
|
87
87
|
}
|
|
88
|
-
},
|
|
88
|
+
}, O = /* @__PURE__ */ S({
|
|
89
89
|
MemoryStore: () => E,
|
|
90
90
|
SlidingWindowStore: () => D,
|
|
91
|
-
fixedWindowLimit: () =>
|
|
92
|
-
slidingWindowLimit: () =>
|
|
91
|
+
fixedWindowLimit: () => ee,
|
|
92
|
+
slidingWindowLimit: () => k
|
|
93
93
|
});
|
|
94
|
-
function
|
|
94
|
+
function k(e) {
|
|
95
95
|
let { windowMs: t = 6e4, max: n, key: r = (e) => e.getClientAddress(), message: i = "Too many requests, please try again later.", statusCode: a = 429, headers: o = "include", onRateLimit: s, store: c = new D({ windowMs: t }) } = e;
|
|
96
96
|
return async (e, t) => {
|
|
97
97
|
let l = r(e);
|
|
@@ -138,7 +138,7 @@ function O(e) {
|
|
|
138
138
|
return t();
|
|
139
139
|
};
|
|
140
140
|
}
|
|
141
|
-
function
|
|
141
|
+
function ee(e) {
|
|
142
142
|
let { windowMs: t = 6e4, max: n, key: r = (e) => e.getClientAddress(), message: i = "Too many requests, please try again later.", statusCode: a = 429, headers: o = "include", onRateLimit: s, store: c = new E({ windowMs: t }) } = e;
|
|
143
143
|
return async (e, t) => {
|
|
144
144
|
let l = r(e);
|
|
@@ -187,7 +187,7 @@ function te(e) {
|
|
|
187
187
|
}
|
|
188
188
|
//#endregion
|
|
189
189
|
//#region src/middlewares/cros/index.ts
|
|
190
|
-
var
|
|
190
|
+
var te = /* @__PURE__ */ S({ policy: () => N }), ne = [
|
|
191
191
|
"GET",
|
|
192
192
|
"POST",
|
|
193
193
|
"PUT",
|
|
@@ -195,13 +195,13 @@ var ne = /* @__PURE__ */ S({ policy: () => M }), re = [
|
|
|
195
195
|
"PATCH",
|
|
196
196
|
"HEAD",
|
|
197
197
|
"OPTIONS"
|
|
198
|
-
],
|
|
198
|
+
], re = [
|
|
199
199
|
"Accept",
|
|
200
200
|
"Accept-Language",
|
|
201
201
|
"Content-Language",
|
|
202
202
|
"Content-Type",
|
|
203
203
|
"Range"
|
|
204
|
-
],
|
|
204
|
+
], A = [
|
|
205
205
|
"Authorization",
|
|
206
206
|
"X-Auth-Token",
|
|
207
207
|
"X-Requested-With",
|
|
@@ -211,21 +211,21 @@ var ne = /* @__PURE__ */ S({ policy: () => M }), re = [
|
|
|
211
211
|
"X-Real-IP",
|
|
212
212
|
"X-Custom-Header"
|
|
213
213
|
];
|
|
214
|
-
function A(e, t) {
|
|
215
|
-
return !e || !t ? !1 : t === "*" ? !0 : t === "null" ? e === "null" : Array.isArray(t) ? t.some((t) => A(e, t)) : typeof t == "function" ? t(e) : t instanceof RegExp ? t.test(e) : e === t;
|
|
216
|
-
}
|
|
217
214
|
function j(e, t) {
|
|
215
|
+
return !e || !t ? !1 : t === "*" ? !0 : t === "null" ? e === "null" : Array.isArray(t) ? t.some((t) => j(e, t)) : typeof t == "function" ? t(e) : t instanceof RegExp ? t.test(e) : e === t;
|
|
216
|
+
}
|
|
217
|
+
function M(e, t) {
|
|
218
218
|
let { origin: n = "*" } = t;
|
|
219
|
-
return e ? n === "*" ? t.credentials ? e : "*" :
|
|
219
|
+
return e ? n === "*" ? t.credentials ? e : "*" : j(e, n) ? e : null : n === "*" ? "*" : null;
|
|
220
220
|
}
|
|
221
|
-
function
|
|
222
|
-
let { methods: t =
|
|
221
|
+
function N(e = {}) {
|
|
222
|
+
let { methods: t = ne, allowedHeaders: n = A, exposedHeaders: r, credentials: i = !1, maxAge: a = 86400, onResponse: o } = e, s = t.join(","), c = [...re, ...n].join(","), l = [
|
|
223
223
|
["Vary", "Origin,Access-Control-Request-Method,Access-Control-Request-Headers"],
|
|
224
224
|
["Access-Control-Allow-Methods", s],
|
|
225
225
|
["Access-Control-Allow-Headers", c]
|
|
226
226
|
];
|
|
227
227
|
return r && l.push(["Access-Control-Expose-Headers", r.join(",")]), i && l.push(["Access-Control-Allow-Credentials", "true"]), a && l.push(["Access-Control-Max-Age", a.toString()]), async (t, n) => {
|
|
228
|
-
let r = t.request, i = r.headers.get("Origin"), a = r.method === "OPTIONS" && i !== null && r.headers.has("Access-Control-Request-Method"), s =
|
|
228
|
+
let r = t.request, i = r.headers.get("Origin"), a = r.method === "OPTIONS" && i !== null && r.headers.has("Access-Control-Request-Method"), s = M(i, e);
|
|
229
229
|
if (a) {
|
|
230
230
|
if (!s) return new Response(null, { status: 403 });
|
|
231
231
|
let e = new Response(null, { status: 204 });
|
|
@@ -248,7 +248,7 @@ function M(e = {}) {
|
|
|
248
248
|
}
|
|
249
249
|
//#endregion
|
|
250
250
|
//#region src/middlewares/security/index.ts
|
|
251
|
-
var
|
|
251
|
+
var P = /* @__PURE__ */ S({ headers: () => I }), F = {
|
|
252
252
|
contentSecurityPolicy: "default-src 'self'; base-uri 'self'; frame-ancestors 'none'; object-src 'none'",
|
|
253
253
|
frameOptions: "DENY",
|
|
254
254
|
referrerPolicy: "no-referrer",
|
|
@@ -257,36 +257,36 @@ var N = /* @__PURE__ */ S({ headers: () => F }), P = {
|
|
|
257
257
|
crossOriginResourcePolicy: "same-origin",
|
|
258
258
|
strictTransportSecurity: !1
|
|
259
259
|
};
|
|
260
|
-
function
|
|
260
|
+
function I(e = {}) {
|
|
261
261
|
let t = {
|
|
262
|
-
...
|
|
262
|
+
...F,
|
|
263
263
|
...e
|
|
264
264
|
};
|
|
265
265
|
return async (e, n) => {
|
|
266
266
|
let r = await n();
|
|
267
267
|
if (!r) return;
|
|
268
268
|
let i = new Headers(r.headers);
|
|
269
|
-
return
|
|
269
|
+
return L(i, "content-security-policy", t.contentSecurityPolicy), L(i, "x-frame-options", t.frameOptions), L(i, "referrer-policy", t.referrerPolicy), L(i, "permissions-policy", t.permissionsPolicy), L(i, "cross-origin-opener-policy", t.crossOriginOpenerPolicy), L(i, "cross-origin-resource-policy", t.crossOriginResourcePolicy), L(i, "strict-transport-security", t.strictTransportSecurity), new Response(r.body, {
|
|
270
270
|
status: r.status,
|
|
271
271
|
statusText: r.statusText,
|
|
272
272
|
headers: i
|
|
273
273
|
});
|
|
274
274
|
};
|
|
275
275
|
}
|
|
276
|
-
function
|
|
276
|
+
function L(e, t, n) {
|
|
277
277
|
!n || e.has(t) || e.set(t, n);
|
|
278
278
|
}
|
|
279
279
|
//#endregion
|
|
280
280
|
//#region src/middlewares/requestid/index.ts
|
|
281
|
-
var
|
|
282
|
-
function
|
|
281
|
+
var R = /* @__PURE__ */ S({ assign: () => z });
|
|
282
|
+
function z(t = {}) {
|
|
283
283
|
let n = t.headerName?.toLowerCase() ?? "x-request-id", r = t.generate ?? e, i = t.clientRequestId ?? !1;
|
|
284
284
|
return async (e, t) => {
|
|
285
285
|
let a = e.request.headers.get(n) ?? r();
|
|
286
286
|
if (i) {
|
|
287
287
|
let t = e.request.headers.get("x-client-request-id");
|
|
288
288
|
if (t !== null) {
|
|
289
|
-
if (!
|
|
289
|
+
if (!B(t) || t.length > 512) return new Response("Invalid X-Client-Request-Id header", { status: 400 });
|
|
290
290
|
a = t;
|
|
291
291
|
}
|
|
292
292
|
}
|
|
@@ -302,13 +302,13 @@ function R(t = {}) {
|
|
|
302
302
|
});
|
|
303
303
|
};
|
|
304
304
|
}
|
|
305
|
-
function
|
|
305
|
+
function B(e) {
|
|
306
306
|
return /^[\x00-\x7F]*$/.test(e);
|
|
307
307
|
}
|
|
308
308
|
//#endregion
|
|
309
309
|
//#region src/middlewares/timeout/index.ts
|
|
310
|
-
var
|
|
311
|
-
function
|
|
310
|
+
var V = /* @__PURE__ */ S({ deadline: () => H });
|
|
311
|
+
function H(e) {
|
|
312
312
|
let { ms: t, status: n = 504, body: r = "Gateway Timeout", onTimeout: i } = e;
|
|
313
313
|
if (!Number.isFinite(t) || t <= 0) throw TypeError("Timeout.deadline requires a positive ms value");
|
|
314
314
|
return async (e, a) => {
|
|
@@ -333,7 +333,7 @@ function V(e) {
|
|
|
333
333
|
}
|
|
334
334
|
//#endregion
|
|
335
335
|
//#region src/types/RequestMethod.ts
|
|
336
|
-
var
|
|
336
|
+
var U = [
|
|
337
337
|
"GET",
|
|
338
338
|
"PUT",
|
|
339
339
|
"POST",
|
|
@@ -341,7 +341,7 @@ var H = [
|
|
|
341
341
|
"PATCH",
|
|
342
342
|
"HEAD",
|
|
343
343
|
"OPTIONS"
|
|
344
|
-
],
|
|
344
|
+
], W = class {
|
|
345
345
|
static {
|
|
346
346
|
this.cache = /* @__PURE__ */ new Map();
|
|
347
347
|
}
|
|
@@ -351,7 +351,7 @@ var H = [
|
|
|
351
351
|
static set(e, t) {
|
|
352
352
|
this.cache.set(e, t);
|
|
353
353
|
}
|
|
354
|
-
},
|
|
354
|
+
}, G = class e {
|
|
355
355
|
constructor() {
|
|
356
356
|
this._routes = [], this._wsRoutes = [], this._nestedRouters = [], this._middlewares = [], this._preHandlers = [], this._postHandlers = [], this.routesSorted = !1, this.wsRoutesSorted = !1;
|
|
357
357
|
}
|
|
@@ -383,7 +383,7 @@ var H = [
|
|
|
383
383
|
return this.addHandler("OPTIONS", e, t, n);
|
|
384
384
|
}
|
|
385
385
|
USE(e, t, ...n) {
|
|
386
|
-
return
|
|
386
|
+
return U.forEach((r) => this.addHandler(r, e, t, n)), this;
|
|
387
387
|
}
|
|
388
388
|
action(e, t, ...n) {
|
|
389
389
|
return this.addHandler("POST", e, async (e) => {
|
|
@@ -415,6 +415,9 @@ var H = [
|
|
|
415
415
|
useMiddleware(...e) {
|
|
416
416
|
return this._middlewares.push(...e), this;
|
|
417
417
|
}
|
|
418
|
+
middleware(...e) {
|
|
419
|
+
return this._middlewares.push(...e), this;
|
|
420
|
+
}
|
|
418
421
|
pre(...e) {
|
|
419
422
|
return this._preHandlers.push(...e), this;
|
|
420
423
|
}
|
|
@@ -542,7 +545,7 @@ var H = [
|
|
|
542
545
|
}), this.routesSorted = !1, this;
|
|
543
546
|
}
|
|
544
547
|
createPathRegex(e) {
|
|
545
|
-
let t =
|
|
548
|
+
let t = W.get(e);
|
|
546
549
|
if (t) return t;
|
|
547
550
|
let n = [], r = !1, i, a = e.split("/").filter(Boolean);
|
|
548
551
|
i = a.reduce((e, t) => t.startsWith("[...") ? e - 10 : t.startsWith("[[") ? e - 5 : t.startsWith("[") ? e - 1 : e + 1, 0);
|
|
@@ -565,7 +568,7 @@ var H = [
|
|
|
565
568
|
isCatchAll: r,
|
|
566
569
|
priority: i
|
|
567
570
|
};
|
|
568
|
-
return
|
|
571
|
+
return W.set(e, s), s;
|
|
569
572
|
}
|
|
570
573
|
createPrefixRegex(e) {
|
|
571
574
|
let t = [], n = !1, r, i = e.split("/").filter(Boolean);
|
|
@@ -673,17 +676,17 @@ var H = [
|
|
|
673
676
|
this._wsRoutes.sort((e, t) => t.priority - e.priority), this.wsRoutesSorted = !0;
|
|
674
677
|
}
|
|
675
678
|
formatActionResult(e) {
|
|
676
|
-
return e instanceof Response ? e : e?.type === "failure" && "status" in e ?
|
|
679
|
+
return e instanceof Response ? e : e?.type === "failure" && "status" in e ? K.fail(e.status, e.data) : K.success(200, e ?? void 0);
|
|
677
680
|
}
|
|
678
681
|
handleActionError(e) {
|
|
679
|
-
if (C(e)) return
|
|
682
|
+
if (C(e)) return K.error(e.status, { message: e.statusText || "Error" });
|
|
680
683
|
if (w(e)) {
|
|
681
684
|
let t = e.headers.get("Location") || "/";
|
|
682
|
-
return
|
|
685
|
+
return K.redirect(e.status, t);
|
|
683
686
|
}
|
|
684
|
-
return console.error(e),
|
|
687
|
+
return console.error(e), K.error(500, { message: "Internal Server Error" });
|
|
685
688
|
}
|
|
686
|
-
},
|
|
689
|
+
}, K = {
|
|
687
690
|
success: (e = 200, t) => new Response(JSON.stringify({
|
|
688
691
|
data: t,
|
|
689
692
|
type: "success",
|
|
@@ -716,7 +719,7 @@ var H = [
|
|
|
716
719
|
status: e,
|
|
717
720
|
headers: { "Content-Type": "application/json" }
|
|
718
721
|
})
|
|
719
|
-
},
|
|
722
|
+
}, q = class {
|
|
720
723
|
constructor(e, t) {
|
|
721
724
|
this.raw = e.headers.get("cookie") ?? "", this.setCookieHeader = t;
|
|
722
725
|
}
|
|
@@ -738,11 +741,11 @@ var H = [
|
|
|
738
741
|
maxAge: 0
|
|
739
742
|
});
|
|
740
743
|
}
|
|
741
|
-
},
|
|
744
|
+
}, J = class extends Error {
|
|
742
745
|
constructor(e = "Payload Too Large") {
|
|
743
746
|
super(e), this.status = 413, this.name = "PayloadTooLargeError";
|
|
744
747
|
}
|
|
745
|
-
},
|
|
748
|
+
}, Y = class extends G {
|
|
746
749
|
constructor(e) {
|
|
747
750
|
super(), this.upgradeHandlerInstalled = !1, this.config = e ?? {
|
|
748
751
|
type: "http",
|
|
@@ -852,7 +855,7 @@ var H = [
|
|
|
852
855
|
if (!t) return e;
|
|
853
856
|
let n = 0, r = new a({ transform(e, r, i) {
|
|
854
857
|
if (n += Buffer.byteLength(e), n > t) {
|
|
855
|
-
i(new
|
|
858
|
+
i(new J());
|
|
856
859
|
return;
|
|
857
860
|
}
|
|
858
861
|
i(null, e);
|
|
@@ -959,7 +962,7 @@ var H = [
|
|
|
959
962
|
return Number.isFinite(r) && r <= t;
|
|
960
963
|
}
|
|
961
964
|
handleError(e) {
|
|
962
|
-
if (e instanceof
|
|
965
|
+
if (e instanceof J) return new Response(e.message, { status: e.status });
|
|
963
966
|
if (C(e)) return new Response(JSON.stringify({
|
|
964
967
|
error: e.statusText || "Error",
|
|
965
968
|
status: e.status
|
|
@@ -1057,7 +1060,7 @@ var H = [
|
|
|
1057
1060
|
r && t.set(n, r);
|
|
1058
1061
|
}
|
|
1059
1062
|
toRequestEvent(e, t, n) {
|
|
1060
|
-
let r = new
|
|
1063
|
+
let r = new q(e, n.pushSetCookie), i = this.config, a = {}, o = {
|
|
1061
1064
|
name: "node-webserver",
|
|
1062
1065
|
dev: this.isDevelopment()
|
|
1063
1066
|
}, s = /* @__PURE__ */ new Set(), c = {
|
|
@@ -1085,7 +1088,7 @@ var H = [
|
|
|
1085
1088
|
}, l = this.createEventFetch(c, n);
|
|
1086
1089
|
return i.locals && Object.assign(a, i.locals(c)), i.platform && Object.assign(o, i.platform(c)), c;
|
|
1087
1090
|
}
|
|
1088
|
-
},
|
|
1091
|
+
}, ie = {
|
|
1089
1092
|
".avif": "image/avif",
|
|
1090
1093
|
".css": "text/css; charset=utf-8",
|
|
1091
1094
|
".gif": "image/gif",
|
|
@@ -1180,7 +1183,7 @@ function Q(e, t) {
|
|
|
1180
1183
|
return n === "" || !n.startsWith("..") && !g(n);
|
|
1181
1184
|
}
|
|
1182
1185
|
function le(e) {
|
|
1183
|
-
return
|
|
1186
|
+
return ie[h(e).toLowerCase()] ?? "application/octet-stream";
|
|
1184
1187
|
}
|
|
1185
1188
|
function ue(e) {
|
|
1186
1189
|
return typeof e.params.path == "string" ? e.params.path : e.url.pathname.replace(/^\/+/, "");
|
|
@@ -1208,51 +1211,56 @@ function pe(e, t = {}) {
|
|
|
1208
1211
|
}
|
|
1209
1212
|
return `${n.join("\n")}\n\n`;
|
|
1210
1213
|
}
|
|
1211
|
-
var $ = (e, t = {}) =>
|
|
1212
|
-
let
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
} finally {
|
|
1214
|
+
var $ = 15e3, me = (e, t = {}) => {
|
|
1215
|
+
let { keepaliveInterval: n = $, ...r } = t;
|
|
1216
|
+
return (t) => {
|
|
1217
|
+
let i = new TextEncoder(), a = null, o = !1, s, c = null, l = async () => {
|
|
1218
|
+
if (!o) {
|
|
1219
|
+
o = !0, c !== null && (clearInterval(c), c = null);
|
|
1218
1220
|
try {
|
|
1219
|
-
|
|
1220
|
-
}
|
|
1221
|
+
await s?.();
|
|
1222
|
+
} finally {
|
|
1223
|
+
try {
|
|
1224
|
+
a?.close();
|
|
1225
|
+
} catch {}
|
|
1226
|
+
}
|
|
1221
1227
|
}
|
|
1222
|
-
}
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
await
|
|
1235
|
-
|
|
1228
|
+
}, u = new ReadableStream({
|
|
1229
|
+
async start(r) {
|
|
1230
|
+
a = r;
|
|
1231
|
+
let u = (e, t = {}) => {
|
|
1232
|
+
o || r.enqueue(i.encode(pe(e, t)));
|
|
1233
|
+
};
|
|
1234
|
+
t.request.signal.addEventListener("abort", () => {
|
|
1235
|
+
l();
|
|
1236
|
+
}, { once: !0 }), n > 0 && (c = setInterval(() => {
|
|
1237
|
+
o || r.enqueue(i.encode(": keep-alive\n\n"));
|
|
1238
|
+
}, n), c?.unref());
|
|
1239
|
+
try {
|
|
1240
|
+
if (s = await e(t, u), t.request.signal.aborted) {
|
|
1241
|
+
await l();
|
|
1242
|
+
return;
|
|
1243
|
+
}
|
|
1244
|
+
s === void 0 && await l();
|
|
1245
|
+
} catch (e) {
|
|
1246
|
+
o || r.error(e);
|
|
1236
1247
|
}
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1248
|
+
},
|
|
1249
|
+
async cancel() {
|
|
1250
|
+
await l();
|
|
1240
1251
|
}
|
|
1241
|
-
}
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
}
|
|
1254
|
-
});
|
|
1255
|
-
}, me = async (e, t) => {
|
|
1252
|
+
});
|
|
1253
|
+
return new Response(u, {
|
|
1254
|
+
...r,
|
|
1255
|
+
headers: {
|
|
1256
|
+
"content-type": "text/event-stream",
|
|
1257
|
+
"cache-control": "no-cache",
|
|
1258
|
+
connection: "keep-alive",
|
|
1259
|
+
...r.headers
|
|
1260
|
+
}
|
|
1261
|
+
});
|
|
1262
|
+
};
|
|
1263
|
+
}, he = async (e, t) => {
|
|
1256
1264
|
let n = JSON.stringify(await e);
|
|
1257
1265
|
return new Response(n, {
|
|
1258
1266
|
...t,
|
|
@@ -1263,19 +1271,19 @@ var $ = (e, t = {}) => (n) => {
|
|
|
1263
1271
|
}
|
|
1264
1272
|
});
|
|
1265
1273
|
};
|
|
1266
|
-
function
|
|
1274
|
+
function ge(e, t) {
|
|
1267
1275
|
throw new Response(null, {
|
|
1268
1276
|
status: e,
|
|
1269
1277
|
headers: { location: t.toString() }
|
|
1270
1278
|
});
|
|
1271
1279
|
}
|
|
1272
|
-
function
|
|
1280
|
+
function _e(e, t) {
|
|
1273
1281
|
throw new Response(JSON.stringify(typeof t == "string" ? { message: t } : t), {
|
|
1274
1282
|
status: e,
|
|
1275
1283
|
headers: { "content-type": "application/json" }
|
|
1276
1284
|
});
|
|
1277
1285
|
}
|
|
1278
|
-
var
|
|
1286
|
+
var ve = async (e, t) => {
|
|
1279
1287
|
let n = await e;
|
|
1280
1288
|
return new Response(n, {
|
|
1281
1289
|
...t,
|
|
@@ -1285,7 +1293,7 @@ var _e = async (e, t) => {
|
|
|
1285
1293
|
...t?.headers
|
|
1286
1294
|
}
|
|
1287
1295
|
});
|
|
1288
|
-
},
|
|
1296
|
+
}, ye = async (e, t) => {
|
|
1289
1297
|
let n = await e;
|
|
1290
1298
|
return new Response(n, {
|
|
1291
1299
|
...t,
|
|
@@ -1297,6 +1305,6 @@ var _e = async (e, t) => {
|
|
|
1297
1305
|
});
|
|
1298
1306
|
};
|
|
1299
1307
|
//#endregion
|
|
1300
|
-
export {
|
|
1308
|
+
export { K as Action, te as CORS, O as RateLimiter, R as RequestId, U as RequestMethods, G as Router, P as Security, V as Timeout, Y as WebServer, de as dir, fe as enhance, _e as error, ye as html, C as isHttpError, w as isRedirect, T as isResponse, he as json, ge as redirect, X as serveStatic, me as sse, ve as text };
|
|
1301
1309
|
|
|
1302
1310
|
//# sourceMappingURL=index.es.js.map
|