@adonisjs/http-server 7.6.1 → 8.0.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/chunk-ASX56VAK.js +76 -0
- package/build/{chunk-7AGINHO3.js → chunk-VYBTM3NC.js} +1025 -607
- package/build/client.cjs +232 -0
- package/build/client.d.cts +258 -0
- package/build/client.d.ts +258 -0
- package/build/client.js +229 -0
- package/build/factories/http_server.d.ts +1 -1
- package/build/factories/main.d.ts +3 -3
- package/build/factories/main.js +89 -89
- package/build/factories/request.d.ts +1 -1
- package/build/factories/response.d.ts +2 -2
- package/build/factories/url_builder_factory.d.ts +25 -0
- package/build/index.d.ts +3 -2
- package/build/index.js +25 -23
- package/build/src/client/main.d.ts +3 -0
- package/build/src/client/router.d.ts +68 -0
- package/build/src/client/types.d.ts +181 -0
- package/build/src/client/url_builder.d.ts +13 -0
- package/build/src/cookies/client.d.ts +2 -2
- package/build/src/cookies/parser.d.ts +2 -2
- package/build/src/cookies/serializer.d.ts +7 -1
- package/build/src/define_middleware.d.ts +3 -2
- package/build/src/{exceptions.d.ts → errors.d.ts} +13 -1
- package/build/src/exception_handler.d.ts +2 -2
- package/build/src/helpers.d.ts +51 -15
- package/build/src/helpers.js +18 -0
- package/build/src/http_context/main.d.ts +3 -3
- package/build/src/qs.d.ts +3 -3
- package/build/src/redirect.d.ts +3 -2
- package/build/src/request.d.ts +10 -9
- package/build/src/response.d.ts +1 -1
- package/build/src/router/brisk.d.ts +4 -3
- package/build/src/router/executor.d.ts +2 -2
- package/build/src/router/factories/use_return_value.d.ts +6 -1
- package/build/src/router/group.d.ts +4 -4
- package/build/src/router/{lookup_store → legacy}/url_builder.d.ts +20 -4
- package/build/src/router/main.d.ts +52 -12
- package/build/src/router/resource.d.ts +4 -3
- package/build/src/router/route.d.ts +3 -2
- package/build/src/router/signed_url_builder.d.ts +14 -0
- package/build/src/router/store.d.ts +3 -2
- package/build/src/server/factories/middleware_handler.d.ts +3 -3
- package/build/src/server/factories/{final_handler.d.ts → route_finder.d.ts} +2 -2
- package/build/src/server/main.d.ts +7 -3
- package/build/src/tracing_channels.d.ts +23 -0
- package/build/src/types/main.d.ts +7 -7
- package/build/src/types/main.js +0 -1
- package/build/src/types/middleware.d.ts +34 -1
- package/build/src/types/request.d.ts +4 -0
- package/build/src/types/response.d.ts +1 -1
- package/build/src/types/route.d.ts +50 -51
- package/build/src/types/server.d.ts +1 -1
- package/build/src/types/tracing_channels.d.ts +6 -0
- package/build/src/utils.d.ts +28 -0
- package/package.json +60 -48
- package/build/chunk-7AGINHO3.js.map +0 -1
- package/build/factories/main.js.map +0 -1
- package/build/index.js.map +0 -1
- package/build/src/router/lookup_store/main.d.ts +0 -48
- package/build/src/router/lookup_store/route_finder.d.ts +0 -25
- package/build/src/router/parser.d.ts +0 -5
- package/build/src/types/base.d.ts +0 -19
- package/build/src/types/main.js.map +0 -1
|
@@ -1,22 +1,211 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import {
|
|
2
|
+
__export,
|
|
3
|
+
default as default2,
|
|
4
|
+
default2 as default3,
|
|
5
|
+
parseRoute,
|
|
6
|
+
serializeCookie
|
|
7
|
+
} from "./chunk-ASX56VAK.js";
|
|
8
|
+
|
|
9
|
+
// src/errors.ts
|
|
10
|
+
var errors_exports = {};
|
|
11
|
+
__export(errors_exports, {
|
|
12
|
+
E_CANNOT_LOOKUP_ROUTE: () => E_CANNOT_LOOKUP_ROUTE,
|
|
13
|
+
E_HTTP_EXCEPTION: () => E_HTTP_EXCEPTION,
|
|
14
|
+
E_HTTP_REQUEST_ABORTED: () => E_HTTP_REQUEST_ABORTED,
|
|
15
|
+
E_ROUTE_NOT_FOUND: () => E_ROUTE_NOT_FOUND
|
|
16
|
+
});
|
|
17
|
+
import { createError, Exception } from "@poppinss/utils/exception";
|
|
18
|
+
var E_ROUTE_NOT_FOUND = createError(
|
|
19
|
+
"Cannot %s:%s",
|
|
20
|
+
"E_ROUTE_NOT_FOUND",
|
|
21
|
+
404
|
|
22
|
+
);
|
|
23
|
+
var E_CANNOT_LOOKUP_ROUTE = createError(
|
|
24
|
+
'Cannot lookup route "%s"',
|
|
25
|
+
"E_CANNOT_LOOKUP_ROUTE",
|
|
26
|
+
500
|
|
27
|
+
);
|
|
28
|
+
var E_HTTP_EXCEPTION = class HttpException extends Exception {
|
|
29
|
+
body;
|
|
30
|
+
static code = "E_HTTP_EXCEPTION";
|
|
31
|
+
/**
|
|
32
|
+
* This method returns an instance of the exception class
|
|
33
|
+
*/
|
|
34
|
+
static invoke(body, status, code = "E_HTTP_EXCEPTION") {
|
|
35
|
+
if (body === null || body === void 0) {
|
|
36
|
+
const error2 = new this("HTTP Exception", { status, code });
|
|
37
|
+
error2.body = "Internal server error";
|
|
38
|
+
return error2;
|
|
39
|
+
}
|
|
40
|
+
if (typeof body === "object") {
|
|
41
|
+
const error2 = new this(body.message || "HTTP Exception", { status, code });
|
|
42
|
+
error2.body = body;
|
|
43
|
+
return error2;
|
|
44
|
+
}
|
|
45
|
+
const error = new this(body, { status, code });
|
|
46
|
+
error.body = body;
|
|
47
|
+
return error;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
var E_HTTP_REQUEST_ABORTED = class AbortException extends E_HTTP_EXCEPTION {
|
|
51
|
+
handle(error, ctx) {
|
|
52
|
+
ctx.response.status(error.status).send(error.body);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
// src/cookies/drivers/plain.ts
|
|
57
|
+
import base64 from "@poppinss/utils/base64";
|
|
58
|
+
import { MessageBuilder } from "@poppinss/utils";
|
|
59
|
+
function pack(value) {
|
|
60
|
+
if (value === void 0 || value === null) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
return base64.urlEncode(new MessageBuilder().build(value));
|
|
64
|
+
}
|
|
65
|
+
function canUnpack(encodedValue) {
|
|
66
|
+
return typeof encodedValue === "string";
|
|
67
|
+
}
|
|
68
|
+
function unpack(encodedValue) {
|
|
69
|
+
return new MessageBuilder().verify(base64.urlDecode(encodedValue, "utf-8", false));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// src/cookies/drivers/signed.ts
|
|
73
|
+
function pack2(key, value, encryption) {
|
|
74
|
+
if (value === void 0 || value === null) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
return `s:${encryption.verifier.sign(value, void 0, key)}`;
|
|
78
|
+
}
|
|
79
|
+
function canUnpack2(signedValue) {
|
|
80
|
+
return typeof signedValue === "string" && signedValue.substring(0, 2) === "s:";
|
|
81
|
+
}
|
|
82
|
+
function unpack2(key, signedValue, encryption) {
|
|
83
|
+
const value = signedValue.slice(2);
|
|
84
|
+
if (!value) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
return encryption.verifier.unsign(value, key);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// src/cookies/drivers/encrypted.ts
|
|
91
|
+
function pack3(key, value, encryption) {
|
|
92
|
+
if (value === void 0 || value === null) {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
return `e:${encryption.encrypt(value, void 0, key)}`;
|
|
96
|
+
}
|
|
97
|
+
function canUnpack3(encryptedValue) {
|
|
98
|
+
return typeof encryptedValue === "string" && encryptedValue.substring(0, 2) === "e:";
|
|
99
|
+
}
|
|
100
|
+
function unpack3(key, encryptedValue, encryption) {
|
|
101
|
+
const value = encryptedValue.slice(2);
|
|
102
|
+
if (!value) {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
return encryption.decrypt(value, key);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// src/cookies/client.ts
|
|
109
|
+
var CookieClient = class {
|
|
110
|
+
#encryption;
|
|
111
|
+
constructor(encryption) {
|
|
112
|
+
this.#encryption = encryption;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Encrypt a key value pair to be sent in the cookie header
|
|
116
|
+
*/
|
|
117
|
+
encrypt(key, value) {
|
|
118
|
+
return pack3(key, value, this.#encryption);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Sign a key value pair to be sent in the cookie header
|
|
122
|
+
*/
|
|
123
|
+
sign(key, value) {
|
|
124
|
+
return pack2(key, value, this.#encryption);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Encode a key value pair to be sent in the cookie header
|
|
128
|
+
*/
|
|
129
|
+
encode(_, value, stringify2 = true) {
|
|
130
|
+
return stringify2 ? pack(value) : value;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Unsign a signed cookie value
|
|
134
|
+
*/
|
|
135
|
+
unsign(key, value) {
|
|
136
|
+
return canUnpack2(value) ? unpack2(key, value, this.#encryption) : null;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Decrypt an encrypted cookie value
|
|
140
|
+
*/
|
|
141
|
+
decrypt(key, value) {
|
|
142
|
+
return canUnpack3(value) ? unpack3(key, value, this.#encryption) : null;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Decode an encoded cookie value
|
|
146
|
+
*/
|
|
147
|
+
decode(_, value, stringified = true) {
|
|
148
|
+
if (!stringified) {
|
|
149
|
+
return value;
|
|
150
|
+
}
|
|
151
|
+
return canUnpack(value) ? unpack(value) : null;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Parse response cookie
|
|
155
|
+
*/
|
|
156
|
+
parse(key, value) {
|
|
157
|
+
if (canUnpack2(value)) {
|
|
158
|
+
return unpack2(key, value, this.#encryption);
|
|
159
|
+
}
|
|
160
|
+
if (canUnpack3(value)) {
|
|
161
|
+
return unpack3(key, value, this.#encryption);
|
|
162
|
+
}
|
|
163
|
+
if (canUnpack(value)) {
|
|
164
|
+
return unpack(value);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
5
167
|
};
|
|
6
168
|
|
|
169
|
+
// src/tracing_channels.ts
|
|
170
|
+
var tracing_channels_exports = {};
|
|
171
|
+
__export(tracing_channels_exports, {
|
|
172
|
+
httpExceptionHandler: () => httpExceptionHandler,
|
|
173
|
+
httpMiddleware: () => httpMiddleware,
|
|
174
|
+
httpRequest: () => httpRequest,
|
|
175
|
+
httpResponseSerializer: () => httpResponseSerializer,
|
|
176
|
+
httpRouteHandler: () => httpRouteHandler
|
|
177
|
+
});
|
|
178
|
+
import diagnostics_channel from "diagnostics_channel";
|
|
179
|
+
var httpRequest = diagnostics_channel.tracingChannel("adonisjs:http.request");
|
|
180
|
+
var httpMiddleware = diagnostics_channel.tracingChannel("adonisjs:http.middleware");
|
|
181
|
+
var httpExceptionHandler = diagnostics_channel.tracingChannel(
|
|
182
|
+
"adonisjs:http.exception.handler"
|
|
183
|
+
);
|
|
184
|
+
var httpRouteHandler = diagnostics_channel.tracingChannel("adonisjs:http.route.handler");
|
|
185
|
+
var httpResponseSerializer = diagnostics_channel.tracingChannel(
|
|
186
|
+
"adonisjs:http.response.serializer"
|
|
187
|
+
);
|
|
188
|
+
|
|
7
189
|
// src/router/route.ts
|
|
8
190
|
import is from "@sindresorhus/is";
|
|
9
191
|
import Macroable4 from "@poppinss/macroable";
|
|
10
192
|
import Middleware from "@poppinss/middleware";
|
|
11
|
-
import { RuntimeException as RuntimeException2 } from "@poppinss/utils";
|
|
193
|
+
import { RuntimeException as RuntimeException2 } from "@poppinss/utils/exception";
|
|
12
194
|
import { moduleCaller, moduleImporter } from "@adonisjs/fold";
|
|
13
195
|
|
|
196
|
+
// src/debug.ts
|
|
197
|
+
import { debuglog } from "util";
|
|
198
|
+
var debug_default = debuglog("adonisjs:http");
|
|
199
|
+
|
|
14
200
|
// src/router/factories/use_return_value.ts
|
|
201
|
+
function canWriteResponseBody(value, ctx) {
|
|
202
|
+
return value !== void 0 && // Return value is explicitly defined
|
|
203
|
+
!ctx.response.hasLazyBody && // Lazy body is not set
|
|
204
|
+
value !== ctx.response;
|
|
205
|
+
}
|
|
15
206
|
function useReturnValue(ctx) {
|
|
16
207
|
return function(value) {
|
|
17
|
-
if (value
|
|
18
|
-
!ctx.response.hasLazyBody && // Lazy body is not set
|
|
19
|
-
value !== ctx.response) {
|
|
208
|
+
if (canWriteResponseBody(value, ctx)) {
|
|
20
209
|
ctx.response.send(value);
|
|
21
210
|
}
|
|
22
211
|
};
|
|
@@ -24,22 +213,50 @@ function useReturnValue(ctx) {
|
|
|
24
213
|
|
|
25
214
|
// src/router/executor.ts
|
|
26
215
|
function execute(route, resolver, ctx, errorResponder) {
|
|
27
|
-
return route.middleware.runner().errorHandler((error) => errorResponder(error, ctx)).finalHandler(
|
|
216
|
+
return route.middleware.runner().errorHandler((error) => errorResponder(error, ctx)).finalHandler(() => {
|
|
28
217
|
if (typeof route.handler === "function") {
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
-
|
|
218
|
+
return httpRouteHandler.tracePromise(
|
|
219
|
+
($ctx) => Promise.resolve(route.handler($ctx)),
|
|
220
|
+
route,
|
|
221
|
+
void 0,
|
|
222
|
+
ctx
|
|
223
|
+
).then(useReturnValue(ctx));
|
|
224
|
+
}
|
|
225
|
+
return httpRouteHandler.tracePromise(
|
|
226
|
+
route.handler.handle,
|
|
227
|
+
route,
|
|
228
|
+
void 0,
|
|
229
|
+
resolver,
|
|
230
|
+
ctx
|
|
231
|
+
).then(useReturnValue(ctx));
|
|
32
232
|
}).run(async (middleware, next) => {
|
|
33
233
|
if (typeof middleware === "function") {
|
|
34
|
-
return
|
|
234
|
+
return httpMiddleware.tracePromise(
|
|
235
|
+
middleware,
|
|
236
|
+
middleware,
|
|
237
|
+
void 0,
|
|
238
|
+
ctx,
|
|
239
|
+
next
|
|
240
|
+
);
|
|
35
241
|
}
|
|
36
|
-
return
|
|
242
|
+
return httpMiddleware.tracePromise(
|
|
243
|
+
middleware.handle,
|
|
244
|
+
middleware,
|
|
245
|
+
void 0,
|
|
246
|
+
resolver,
|
|
247
|
+
ctx,
|
|
248
|
+
next,
|
|
249
|
+
middleware.args
|
|
250
|
+
);
|
|
37
251
|
});
|
|
38
252
|
}
|
|
39
253
|
|
|
40
|
-
// src/
|
|
254
|
+
// src/utils.ts
|
|
41
255
|
import Cache from "tmp-cache";
|
|
42
|
-
import { InvalidArgumentsException } from "@poppinss/utils";
|
|
256
|
+
import { InvalidArgumentsException } from "@poppinss/utils/exception";
|
|
257
|
+
|
|
258
|
+
// src/router/group.ts
|
|
259
|
+
import Macroable3 from "@poppinss/macroable";
|
|
43
260
|
|
|
44
261
|
// src/router/brisk.ts
|
|
45
262
|
import Macroable from "@poppinss/macroable";
|
|
@@ -87,7 +304,8 @@ var BriskRoute = class extends Macroable {
|
|
|
87
304
|
* Redirects to a given route. Params from the original request will
|
|
88
305
|
* be used when no custom params are defined.
|
|
89
306
|
*/
|
|
90
|
-
redirect(
|
|
307
|
+
redirect(...args) {
|
|
308
|
+
const [identifier, params, options] = args;
|
|
91
309
|
function redirectsToRoute(ctx) {
|
|
92
310
|
const redirector = ctx.response.redirect();
|
|
93
311
|
if (options?.status) {
|
|
@@ -114,13 +332,10 @@ var BriskRoute = class extends Macroable {
|
|
|
114
332
|
}
|
|
115
333
|
};
|
|
116
334
|
|
|
117
|
-
// src/router/group.ts
|
|
118
|
-
import Macroable3 from "@poppinss/macroable";
|
|
119
|
-
|
|
120
335
|
// src/router/resource.ts
|
|
121
336
|
import string from "@poppinss/utils/string";
|
|
122
337
|
import Macroable2 from "@poppinss/macroable";
|
|
123
|
-
import { RuntimeException } from "@poppinss/utils";
|
|
338
|
+
import { RuntimeException } from "@poppinss/utils/exception";
|
|
124
339
|
var RouteResource = class extends Macroable2 {
|
|
125
340
|
/**
|
|
126
341
|
* Resource identifier. Nested resources are separated
|
|
@@ -534,7 +749,7 @@ var RouteGroup = class _RouteGroup extends Macroable3 {
|
|
|
534
749
|
}
|
|
535
750
|
};
|
|
536
751
|
|
|
537
|
-
// src/
|
|
752
|
+
// src/utils.ts
|
|
538
753
|
var proxyCache = new Cache({ max: 200 });
|
|
539
754
|
function dropSlash(input) {
|
|
540
755
|
if (input === "/") {
|
|
@@ -600,10 +815,65 @@ function parseRange(range, value) {
|
|
|
600
815
|
{}
|
|
601
816
|
);
|
|
602
817
|
}
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
818
|
+
function decodeComponentChar(highCharCode, lowCharCode) {
|
|
819
|
+
if (highCharCode === 50) {
|
|
820
|
+
if (lowCharCode === 53) return "%";
|
|
821
|
+
if (lowCharCode === 51) return "#";
|
|
822
|
+
if (lowCharCode === 52) return "$";
|
|
823
|
+
if (lowCharCode === 54) return "&";
|
|
824
|
+
if (lowCharCode === 66) return "+";
|
|
825
|
+
if (lowCharCode === 98) return "+";
|
|
826
|
+
if (lowCharCode === 67) return ",";
|
|
827
|
+
if (lowCharCode === 99) return ",";
|
|
828
|
+
if (lowCharCode === 70) return "/";
|
|
829
|
+
if (lowCharCode === 102) return "/";
|
|
830
|
+
return null;
|
|
831
|
+
}
|
|
832
|
+
if (highCharCode === 51) {
|
|
833
|
+
if (lowCharCode === 65) return ":";
|
|
834
|
+
if (lowCharCode === 97) return ":";
|
|
835
|
+
if (lowCharCode === 66) return ";";
|
|
836
|
+
if (lowCharCode === 98) return ";";
|
|
837
|
+
if (lowCharCode === 68) return "=";
|
|
838
|
+
if (lowCharCode === 100) return "=";
|
|
839
|
+
if (lowCharCode === 70) return "?";
|
|
840
|
+
if (lowCharCode === 102) return "?";
|
|
841
|
+
return null;
|
|
842
|
+
}
|
|
843
|
+
if (highCharCode === 52 && lowCharCode === 48) {
|
|
844
|
+
return "@";
|
|
845
|
+
}
|
|
846
|
+
return null;
|
|
847
|
+
}
|
|
848
|
+
function safeDecodeURI(path, useSemicolonDelimiter) {
|
|
849
|
+
let shouldDecode = false;
|
|
850
|
+
let shouldDecodeParam = false;
|
|
851
|
+
let querystring = "";
|
|
852
|
+
for (let i = 1; i < path.length; i++) {
|
|
853
|
+
const charCode = path.charCodeAt(i);
|
|
854
|
+
if (charCode === 37) {
|
|
855
|
+
const highCharCode = path.charCodeAt(i + 1);
|
|
856
|
+
const lowCharCode = path.charCodeAt(i + 2);
|
|
857
|
+
if (decodeComponentChar(highCharCode, lowCharCode) === null) {
|
|
858
|
+
shouldDecode = true;
|
|
859
|
+
} else {
|
|
860
|
+
shouldDecodeParam = true;
|
|
861
|
+
if (highCharCode === 50 && lowCharCode === 53) {
|
|
862
|
+
shouldDecode = true;
|
|
863
|
+
path = path.slice(0, i + 1) + "25" + path.slice(i + 1);
|
|
864
|
+
i += 2;
|
|
865
|
+
}
|
|
866
|
+
i += 2;
|
|
867
|
+
}
|
|
868
|
+
} else if (charCode === 63 || charCode === 35 || charCode === 59 && useSemicolonDelimiter) {
|
|
869
|
+
querystring = path.slice(i + 1);
|
|
870
|
+
path = path.slice(0, i);
|
|
871
|
+
break;
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
const decodedPath = shouldDecode ? decodeURI(path) : path;
|
|
875
|
+
return { pathname: decodedPath, query: querystring, shouldDecodeParam };
|
|
876
|
+
}
|
|
607
877
|
|
|
608
878
|
// src/router/route.ts
|
|
609
879
|
var Route = class extends Macroable4 {
|
|
@@ -850,16 +1120,20 @@ var Route = class extends Macroable4 {
|
|
|
850
1120
|
debug_default("adding named middleware to route %s, %O", this.#pattern, one);
|
|
851
1121
|
middleware.add(one);
|
|
852
1122
|
});
|
|
1123
|
+
middleware.freeze();
|
|
853
1124
|
return middleware;
|
|
854
1125
|
}
|
|
855
1126
|
/**
|
|
856
1127
|
* Returns JSON representation of the route
|
|
857
1128
|
*/
|
|
858
1129
|
toJSON() {
|
|
1130
|
+
const pattern = this.#computePattern();
|
|
1131
|
+
const matchers = this.#getMatchers();
|
|
859
1132
|
return {
|
|
860
1133
|
domain: this.#routeDomain,
|
|
861
|
-
pattern
|
|
862
|
-
matchers
|
|
1134
|
+
pattern,
|
|
1135
|
+
matchers,
|
|
1136
|
+
tokens: parseRoute(pattern, matchers),
|
|
863
1137
|
meta: {},
|
|
864
1138
|
name: this.#name,
|
|
865
1139
|
handler: this.#handler,
|
|
@@ -870,135 +1144,24 @@ var Route = class extends Macroable4 {
|
|
|
870
1144
|
}
|
|
871
1145
|
};
|
|
872
1146
|
|
|
873
|
-
// src/
|
|
874
|
-
import
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
}
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
}
|
|
884
|
-
function unpack(encodedValue) {
|
|
885
|
-
return new MessageBuilder().verify(base64.urlDecode(encodedValue, "utf-8", false));
|
|
886
|
-
}
|
|
887
|
-
|
|
888
|
-
// src/cookies/drivers/signed.ts
|
|
889
|
-
function pack2(key, value, encryption) {
|
|
890
|
-
if (value === void 0 || value === null) {
|
|
891
|
-
return null;
|
|
892
|
-
}
|
|
893
|
-
return `s:${encryption.verifier.sign(value, void 0, key)}`;
|
|
894
|
-
}
|
|
895
|
-
function canUnpack2(signedValue) {
|
|
896
|
-
return typeof signedValue === "string" && signedValue.substring(0, 2) === "s:";
|
|
897
|
-
}
|
|
898
|
-
function unpack2(key, signedValue, encryption) {
|
|
899
|
-
const value = signedValue.slice(2);
|
|
900
|
-
if (!value) {
|
|
901
|
-
return null;
|
|
902
|
-
}
|
|
903
|
-
return encryption.verifier.unsign(value, key);
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
// src/cookies/drivers/encrypted.ts
|
|
907
|
-
function pack3(key, value, encryption) {
|
|
908
|
-
if (value === void 0 || value === null) {
|
|
909
|
-
return null;
|
|
910
|
-
}
|
|
911
|
-
return `e:${encryption.encrypt(value, void 0, key)}`;
|
|
912
|
-
}
|
|
913
|
-
function canUnpack3(encryptedValue) {
|
|
914
|
-
return typeof encryptedValue === "string" && encryptedValue.substring(0, 2) === "e:";
|
|
915
|
-
}
|
|
916
|
-
function unpack3(key, encryptedValue, encryption) {
|
|
917
|
-
const value = encryptedValue.slice(2);
|
|
918
|
-
if (!value) {
|
|
919
|
-
return null;
|
|
920
|
-
}
|
|
921
|
-
return encryption.decrypt(value, key);
|
|
922
|
-
}
|
|
1147
|
+
// src/request.ts
|
|
1148
|
+
import fresh from "fresh";
|
|
1149
|
+
import typeIs from "type-is";
|
|
1150
|
+
import accepts from "accepts";
|
|
1151
|
+
import { isIP } from "net";
|
|
1152
|
+
import is2 from "@sindresorhus/is";
|
|
1153
|
+
import proxyaddr from "proxy-addr";
|
|
1154
|
+
import { safeEqual } from "@poppinss/utils";
|
|
1155
|
+
import Macroable5 from "@poppinss/macroable";
|
|
1156
|
+
import lodash from "@poppinss/utils/lodash";
|
|
923
1157
|
|
|
924
|
-
// src/cookies/
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
this.#encryption = encryption;
|
|
929
|
-
}
|
|
1158
|
+
// src/cookies/parser.ts
|
|
1159
|
+
import cookie from "cookie";
|
|
1160
|
+
var CookieParser = class {
|
|
1161
|
+
#client;
|
|
930
1162
|
/**
|
|
931
|
-
*
|
|
932
|
-
|
|
933
|
-
encrypt(key, value) {
|
|
934
|
-
return pack3(key, value, this.#encryption);
|
|
935
|
-
}
|
|
936
|
-
/**
|
|
937
|
-
* Sign a key value pair to be sent in the cookie header
|
|
938
|
-
*/
|
|
939
|
-
sign(key, value) {
|
|
940
|
-
return pack2(key, value, this.#encryption);
|
|
941
|
-
}
|
|
942
|
-
/**
|
|
943
|
-
* Encode a key value pair to be sent in the cookie header
|
|
944
|
-
*/
|
|
945
|
-
encode(_, value) {
|
|
946
|
-
return pack(value);
|
|
947
|
-
}
|
|
948
|
-
/**
|
|
949
|
-
* Unsign a signed cookie value
|
|
950
|
-
*/
|
|
951
|
-
unsign(key, value) {
|
|
952
|
-
return canUnpack2(value) ? unpack2(key, value, this.#encryption) : null;
|
|
953
|
-
}
|
|
954
|
-
/**
|
|
955
|
-
* Decrypt an encrypted cookie value
|
|
956
|
-
*/
|
|
957
|
-
decrypt(key, value) {
|
|
958
|
-
return canUnpack3(value) ? unpack3(key, value, this.#encryption) : null;
|
|
959
|
-
}
|
|
960
|
-
/**
|
|
961
|
-
* Decode an encoded cookie value
|
|
962
|
-
*/
|
|
963
|
-
decode(_, value) {
|
|
964
|
-
return canUnpack(value) ? unpack(value) : null;
|
|
965
|
-
}
|
|
966
|
-
/**
|
|
967
|
-
* Parse response cookie
|
|
968
|
-
*/
|
|
969
|
-
parse(key, value) {
|
|
970
|
-
if (canUnpack2(value)) {
|
|
971
|
-
return unpack2(key, value, this.#encryption);
|
|
972
|
-
}
|
|
973
|
-
if (canUnpack3(value)) {
|
|
974
|
-
return unpack3(key, value, this.#encryption);
|
|
975
|
-
}
|
|
976
|
-
if (canUnpack(value)) {
|
|
977
|
-
return unpack(value);
|
|
978
|
-
}
|
|
979
|
-
}
|
|
980
|
-
};
|
|
981
|
-
|
|
982
|
-
// src/request.ts
|
|
983
|
-
import fresh from "fresh";
|
|
984
|
-
import typeIs from "type-is";
|
|
985
|
-
import accepts from "accepts";
|
|
986
|
-
import { isIP } from "node:net";
|
|
987
|
-
import is2 from "@sindresorhus/is";
|
|
988
|
-
import proxyaddr from "proxy-addr";
|
|
989
|
-
import { safeEqual } from "@poppinss/utils";
|
|
990
|
-
import Macroable5 from "@poppinss/macroable";
|
|
991
|
-
import lodash from "@poppinss/utils/lodash";
|
|
992
|
-
import { createId } from "@paralleldrive/cuid2";
|
|
993
|
-
import { parse } from "node:url";
|
|
994
|
-
|
|
995
|
-
// src/cookies/parser.ts
|
|
996
|
-
import cookie from "cookie";
|
|
997
|
-
var CookieParser = class {
|
|
998
|
-
#client;
|
|
999
|
-
/**
|
|
1000
|
-
* A copy of cached cookies, they are cached during a request after
|
|
1001
|
-
* initial decoding, unsigning or decrypting.
|
|
1163
|
+
* A copy of cached cookies, they are cached during a request after
|
|
1164
|
+
* initial decoding, unsigning or decrypting.
|
|
1002
1165
|
*/
|
|
1003
1166
|
#cachedCookies = {
|
|
1004
1167
|
signedCookies: {},
|
|
@@ -1025,10 +1188,10 @@ var CookieParser = class {
|
|
|
1025
1188
|
}
|
|
1026
1189
|
/**
|
|
1027
1190
|
* Attempts to decode a cookie by the name. When calling this method,
|
|
1028
|
-
* you are assuming that the cookie was just
|
|
1191
|
+
* you are assuming that the cookie was just stringified in the first
|
|
1029
1192
|
* place and not signed or encrypted.
|
|
1030
1193
|
*/
|
|
1031
|
-
decode(key,
|
|
1194
|
+
decode(key, stringified = true) {
|
|
1032
1195
|
const value = this.#cookies[key];
|
|
1033
1196
|
if (value === null || value === void 0) {
|
|
1034
1197
|
return null;
|
|
@@ -1037,7 +1200,7 @@ var CookieParser = class {
|
|
|
1037
1200
|
if (cache[key] !== void 0) {
|
|
1038
1201
|
return cache[key];
|
|
1039
1202
|
}
|
|
1040
|
-
const parsed =
|
|
1203
|
+
const parsed = this.#client.decode(key, value, stringified);
|
|
1041
1204
|
if (parsed !== null) {
|
|
1042
1205
|
cache[key] = parsed;
|
|
1043
1206
|
}
|
|
@@ -1100,7 +1263,7 @@ var Request = class extends Macroable5 {
|
|
|
1100
1263
|
this.#qsParser = qsParser;
|
|
1101
1264
|
this.#config = config;
|
|
1102
1265
|
this.#encryption = encryption;
|
|
1103
|
-
this.parsedUrl =
|
|
1266
|
+
this.parsedUrl = safeDecodeURI(request.url, false);
|
|
1104
1267
|
this.#parseQueryString();
|
|
1105
1268
|
}
|
|
1106
1269
|
/**
|
|
@@ -1147,9 +1310,7 @@ var Request = class extends Macroable5 {
|
|
|
1147
1310
|
*/
|
|
1148
1311
|
#cookieParser;
|
|
1149
1312
|
/**
|
|
1150
|
-
*
|
|
1151
|
-
* object. This is done to build URL's with query string without
|
|
1152
|
-
* stringifying the object
|
|
1313
|
+
* Parsed URL with query string stored as a string.
|
|
1153
1314
|
*/
|
|
1154
1315
|
parsedUrl;
|
|
1155
1316
|
/**
|
|
@@ -1189,7 +1350,7 @@ var Request = class extends Macroable5 {
|
|
|
1189
1350
|
id() {
|
|
1190
1351
|
let requestId = this.header("x-request-id");
|
|
1191
1352
|
if (!requestId && this.#config.generateRequestId) {
|
|
1192
|
-
requestId =
|
|
1353
|
+
requestId = this.#config.createRequestId();
|
|
1193
1354
|
this.request.headers["x-request-id"] = requestId;
|
|
1194
1355
|
}
|
|
1195
1356
|
return requestId;
|
|
@@ -1462,11 +1623,11 @@ var Request = class extends Macroable5 {
|
|
|
1462
1623
|
if ("encrypted" in this.request.socket) {
|
|
1463
1624
|
return "https";
|
|
1464
1625
|
}
|
|
1465
|
-
if (
|
|
1466
|
-
|
|
1626
|
+
if (trustProxy(this.request.socket.remoteAddress, this.#config.trustProxy)) {
|
|
1627
|
+
const forwardedProtocol = this.header("X-Forwarded-Proto");
|
|
1628
|
+
return forwardedProtocol ? forwardedProtocol.split(/\s*,\s*/)[0] : "http";
|
|
1467
1629
|
}
|
|
1468
|
-
|
|
1469
|
-
return forwardedProtocol ? forwardedProtocol.split(/\s*,\s*/)[0] : "http";
|
|
1630
|
+
return "http";
|
|
1470
1631
|
}
|
|
1471
1632
|
/**
|
|
1472
1633
|
* Returns a boolean telling if request is served over `https`
|
|
@@ -1896,8 +2057,7 @@ var Request = class extends Macroable5 {
|
|
|
1896
2057
|
};
|
|
1897
2058
|
|
|
1898
2059
|
// src/redirect.ts
|
|
1899
|
-
import { parse
|
|
1900
|
-
import encodeUrl from "encodeurl";
|
|
2060
|
+
import { parse } from "url";
|
|
1901
2061
|
var Redirect = class {
|
|
1902
2062
|
/**
|
|
1903
2063
|
* A boolean to forward the existing query string
|
|
@@ -1928,7 +2088,7 @@ var Redirect = class {
|
|
|
1928
2088
|
const stringified = this.#qs.stringify(query);
|
|
1929
2089
|
url = stringified ? `${url}?${stringified}` : url;
|
|
1930
2090
|
debug_default('redirecting to url "%s"', url);
|
|
1931
|
-
this.#response.location(
|
|
2091
|
+
this.#response.location(default2(url));
|
|
1932
2092
|
this.#response.safeStatus(this.#statusCode);
|
|
1933
2093
|
this.#response.type("text/plain; charset=utf-8");
|
|
1934
2094
|
this.#response.send(`Redirecting to ${url}`);
|
|
@@ -1974,7 +2134,7 @@ var Redirect = class {
|
|
|
1974
2134
|
back() {
|
|
1975
2135
|
let query = {};
|
|
1976
2136
|
const referrerUrl = this.#getReferrerUrl();
|
|
1977
|
-
const url =
|
|
2137
|
+
const url = parse(referrerUrl);
|
|
1978
2138
|
debug_default('referrer url "%s"', referrerUrl);
|
|
1979
2139
|
debug_default('referrer base url "%s"', url.pathname);
|
|
1980
2140
|
if (this.#forwardQueryString) {
|
|
@@ -1986,12 +2146,13 @@ var Redirect = class {
|
|
|
1986
2146
|
/**
|
|
1987
2147
|
* Redirect the request using a route identifier.
|
|
1988
2148
|
*/
|
|
1989
|
-
toRoute(
|
|
2149
|
+
toRoute(...args) {
|
|
2150
|
+
const [identifier, params, options] = args;
|
|
1990
2151
|
if (options && options.qs) {
|
|
1991
2152
|
this.withQs(options.qs);
|
|
1992
2153
|
options.qs = void 0;
|
|
1993
2154
|
}
|
|
1994
|
-
const url = this.#router.
|
|
2155
|
+
const url = this.#router.urlBuilder.urlFor(identifier, params, options);
|
|
1995
2156
|
return this.toPath(url);
|
|
1996
2157
|
}
|
|
1997
2158
|
/**
|
|
@@ -2000,60 +2161,13 @@ var Redirect = class {
|
|
|
2000
2161
|
toPath(url) {
|
|
2001
2162
|
let query = {};
|
|
2002
2163
|
if (this.#forwardQueryString) {
|
|
2003
|
-
query = this.#qs.parse(
|
|
2164
|
+
query = this.#qs.parse(parse(this.#request.url).query || "");
|
|
2004
2165
|
}
|
|
2005
2166
|
Object.assign(query, this.#queryString);
|
|
2006
2167
|
this.#sendResponse(url, query);
|
|
2007
2168
|
}
|
|
2008
2169
|
};
|
|
2009
2170
|
|
|
2010
|
-
// src/exceptions.ts
|
|
2011
|
-
var exceptions_exports = {};
|
|
2012
|
-
__export(exceptions_exports, {
|
|
2013
|
-
E_CANNOT_LOOKUP_ROUTE: () => E_CANNOT_LOOKUP_ROUTE,
|
|
2014
|
-
E_HTTP_EXCEPTION: () => E_HTTP_EXCEPTION,
|
|
2015
|
-
E_HTTP_REQUEST_ABORTED: () => E_HTTP_REQUEST_ABORTED,
|
|
2016
|
-
E_ROUTE_NOT_FOUND: () => E_ROUTE_NOT_FOUND
|
|
2017
|
-
});
|
|
2018
|
-
import { createError, Exception } from "@poppinss/utils";
|
|
2019
|
-
var E_ROUTE_NOT_FOUND = createError(
|
|
2020
|
-
"Cannot %s:%s",
|
|
2021
|
-
"E_ROUTE_NOT_FOUND",
|
|
2022
|
-
404
|
|
2023
|
-
);
|
|
2024
|
-
var E_CANNOT_LOOKUP_ROUTE = createError(
|
|
2025
|
-
'Cannot lookup route "%s"',
|
|
2026
|
-
"E_CANNOT_LOOKUP_ROUTE",
|
|
2027
|
-
500
|
|
2028
|
-
);
|
|
2029
|
-
var E_HTTP_EXCEPTION = class HttpException extends Exception {
|
|
2030
|
-
body;
|
|
2031
|
-
static code = "E_HTTP_EXCEPTION";
|
|
2032
|
-
/**
|
|
2033
|
-
* This method returns an instance of the exception class
|
|
2034
|
-
*/
|
|
2035
|
-
static invoke(body, status, code = "E_HTTP_EXCEPTION") {
|
|
2036
|
-
if (body === null || body === void 0) {
|
|
2037
|
-
const error2 = new this("HTTP Exception", { status, code });
|
|
2038
|
-
error2.body = "Internal server error";
|
|
2039
|
-
return error2;
|
|
2040
|
-
}
|
|
2041
|
-
if (typeof body === "object") {
|
|
2042
|
-
const error2 = new this(body.message || "HTTP Exception", { status, code });
|
|
2043
|
-
error2.body = body;
|
|
2044
|
-
return error2;
|
|
2045
|
-
}
|
|
2046
|
-
const error = new this(body, { status, code });
|
|
2047
|
-
error.body = body;
|
|
2048
|
-
return error;
|
|
2049
|
-
}
|
|
2050
|
-
};
|
|
2051
|
-
var E_HTTP_REQUEST_ABORTED = class AbortException extends E_HTTP_EXCEPTION {
|
|
2052
|
-
handle(error, ctx) {
|
|
2053
|
-
ctx.response.status(error.status).send(error.body);
|
|
2054
|
-
}
|
|
2055
|
-
};
|
|
2056
|
-
|
|
2057
2171
|
// src/response_status.ts
|
|
2058
2172
|
var ResponseStatus = {
|
|
2059
2173
|
Continue: 100,
|
|
@@ -2121,58 +2235,44 @@ var ResponseStatus = {
|
|
|
2121
2235
|
};
|
|
2122
2236
|
|
|
2123
2237
|
// src/response.ts
|
|
2124
|
-
import { Buffer as Buffer2 } from "node:buffer";
|
|
2125
2238
|
import etag from "etag";
|
|
2126
2239
|
import vary from "vary";
|
|
2127
2240
|
import fresh2 from "fresh";
|
|
2128
|
-
import mime from "mime-types";
|
|
2129
2241
|
import destroy from "destroy";
|
|
2130
|
-
import { extname } from "
|
|
2242
|
+
import { extname } from "path";
|
|
2243
|
+
import { Buffer } from "buffer";
|
|
2131
2244
|
import onFinished from "on-finished";
|
|
2132
|
-
import
|
|
2245
|
+
import { stat } from "fs/promises";
|
|
2133
2246
|
import Macroable6 from "@poppinss/macroable";
|
|
2134
|
-
import { createReadStream } from "
|
|
2135
|
-
import { stat } from "node:fs/promises";
|
|
2136
|
-
import { RuntimeException as RuntimeException3 } from "@poppinss/utils";
|
|
2247
|
+
import { createReadStream } from "fs";
|
|
2137
2248
|
import contentDisposition from "content-disposition";
|
|
2249
|
+
import { safeStringify } from "@poppinss/utils/json";
|
|
2250
|
+
import { RuntimeException as RuntimeException3 } from "@poppinss/utils/exception";
|
|
2138
2251
|
|
|
2139
2252
|
// src/cookies/serializer.ts
|
|
2140
|
-
import cookie2 from "cookie";
|
|
2141
|
-
import string2 from "@poppinss/utils/string";
|
|
2142
2253
|
var CookieSerializer = class {
|
|
2143
2254
|
#client;
|
|
2144
2255
|
constructor(encryption) {
|
|
2145
2256
|
this.#client = new CookieClient(encryption);
|
|
2146
2257
|
}
|
|
2147
|
-
/**
|
|
2148
|
-
* Serializes the key-value pair to a string, that can be set on the
|
|
2149
|
-
* `Set-Cookie` header.
|
|
2150
|
-
*/
|
|
2151
|
-
#serializeAsCookie(key, value, options) {
|
|
2152
|
-
let expires = options?.expires;
|
|
2153
|
-
if (typeof expires === "function") {
|
|
2154
|
-
expires = expires();
|
|
2155
|
-
}
|
|
2156
|
-
let maxAge = options?.maxAge ? string2.seconds.parse(options?.maxAge) : void 0;
|
|
2157
|
-
const parsedOptions = Object.assign({}, options, { maxAge, expires });
|
|
2158
|
-
return cookie2.serialize(key, value, parsedOptions);
|
|
2159
|
-
}
|
|
2160
2258
|
/**
|
|
2161
2259
|
* Encodes value as a plain cookie. By default, the plain value will be converted
|
|
2162
2260
|
* to a string using "JSON.stringify" method and then encoded as a base64 string.
|
|
2163
2261
|
*
|
|
2164
|
-
* You can disable
|
|
2262
|
+
* You can disable cookie stringifaction by setting `options.stringify = false`.
|
|
2165
2263
|
*
|
|
2166
2264
|
* ```ts
|
|
2167
2265
|
* serializer.encode('name', 'virk')
|
|
2266
|
+
* serializer.encode('name', 'virk', { stringify: false })
|
|
2168
2267
|
* ```
|
|
2169
2268
|
*/
|
|
2170
2269
|
encode(key, value, options) {
|
|
2171
|
-
const
|
|
2270
|
+
const stringify2 = options?.stringify ?? options?.encode;
|
|
2271
|
+
const packedValue = this.#client.encode(key, value, stringify2);
|
|
2172
2272
|
if (packedValue === null || packedValue === void 0) {
|
|
2173
2273
|
return null;
|
|
2174
2274
|
}
|
|
2175
|
-
return
|
|
2275
|
+
return serializeCookie(key, packedValue, options);
|
|
2176
2276
|
}
|
|
2177
2277
|
/**
|
|
2178
2278
|
* Sign a key-value pair to a signed cookie. The signed value has a
|
|
@@ -2183,7 +2283,7 @@ var CookieSerializer = class {
|
|
|
2183
2283
|
if (packedValue === null) {
|
|
2184
2284
|
return null;
|
|
2185
2285
|
}
|
|
2186
|
-
return
|
|
2286
|
+
return serializeCookie(key, packedValue, options);
|
|
2187
2287
|
}
|
|
2188
2288
|
/**
|
|
2189
2289
|
* Encrypts a key-value pair to an encrypted cookie.
|
|
@@ -2193,7 +2293,7 @@ var CookieSerializer = class {
|
|
|
2193
2293
|
if (packedValue === null) {
|
|
2194
2294
|
return null;
|
|
2195
2295
|
}
|
|
2196
|
-
return
|
|
2296
|
+
return serializeCookie(key, packedValue, options);
|
|
2197
2297
|
}
|
|
2198
2298
|
};
|
|
2199
2299
|
|
|
@@ -2344,20 +2444,20 @@ var Response = class extends Macroable6 {
|
|
|
2344
2444
|
* - Buffer
|
|
2345
2445
|
*/
|
|
2346
2446
|
#getDataType(content) {
|
|
2347
|
-
if (content instanceof Uint8Array) {
|
|
2348
|
-
return "buffer";
|
|
2349
|
-
}
|
|
2350
|
-
if (content instanceof Date) {
|
|
2351
|
-
return "date";
|
|
2352
|
-
}
|
|
2353
|
-
if (content instanceof RegExp) {
|
|
2354
|
-
return "regexp";
|
|
2355
|
-
}
|
|
2356
2447
|
const dataType = typeof content;
|
|
2357
2448
|
if (dataType === "number" || dataType === "boolean" || dataType === "string" || dataType === "bigint") {
|
|
2358
2449
|
return dataType;
|
|
2359
2450
|
}
|
|
2360
2451
|
if (dataType === "object") {
|
|
2452
|
+
if (content instanceof Uint8Array) {
|
|
2453
|
+
return "buffer";
|
|
2454
|
+
}
|
|
2455
|
+
if (content instanceof RegExp) {
|
|
2456
|
+
return "regexp";
|
|
2457
|
+
}
|
|
2458
|
+
if (content instanceof Date) {
|
|
2459
|
+
return "date";
|
|
2460
|
+
}
|
|
2361
2461
|
return "object";
|
|
2362
2462
|
}
|
|
2363
2463
|
throw new RuntimeException3(`Cannot serialize "${dataType}" to HTTP response`);
|
|
@@ -2387,12 +2487,29 @@ var Response = class extends Macroable6 {
|
|
|
2387
2487
|
return;
|
|
2388
2488
|
}
|
|
2389
2489
|
const dataType = this.#getDataType(content);
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2490
|
+
let contentType;
|
|
2491
|
+
switch (dataType) {
|
|
2492
|
+
case "string":
|
|
2493
|
+
contentType = content.trimStart().startsWith("<") ? "text/html; charset=utf-8" : "text/plain; charset=utf-8";
|
|
2494
|
+
break;
|
|
2495
|
+
case "number":
|
|
2496
|
+
case "boolean":
|
|
2497
|
+
case "bigint":
|
|
2498
|
+
case "regexp":
|
|
2499
|
+
content = String(content);
|
|
2500
|
+
contentType = "text/plain; charset=utf-8";
|
|
2501
|
+
break;
|
|
2502
|
+
case "date":
|
|
2503
|
+
content = content.toISOString();
|
|
2504
|
+
contentType = "text/plain; charset=utf-8";
|
|
2505
|
+
break;
|
|
2506
|
+
case "buffer":
|
|
2507
|
+
contentType = "application/octet-stream; charset=utf-8";
|
|
2508
|
+
break;
|
|
2509
|
+
case "object":
|
|
2510
|
+
content = safeStringify(content);
|
|
2511
|
+
contentType = "application/json; charset=utf-8";
|
|
2512
|
+
break;
|
|
2396
2513
|
}
|
|
2397
2514
|
if (jsonpCallbackName) {
|
|
2398
2515
|
content = content.replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
@@ -2409,30 +2526,12 @@ var Response = class extends Macroable6 {
|
|
|
2409
2526
|
return;
|
|
2410
2527
|
}
|
|
2411
2528
|
this.setRequestId();
|
|
2412
|
-
this.header("Content-Length",
|
|
2529
|
+
this.header("Content-Length", Buffer.byteLength(content));
|
|
2413
2530
|
if (jsonpCallbackName) {
|
|
2414
2531
|
this.header("X-Content-Type-Options", "nosniff");
|
|
2415
2532
|
this.safeHeader("Content-Type", "text/javascript; charset=utf-8");
|
|
2416
2533
|
} else {
|
|
2417
|
-
|
|
2418
|
-
case "string":
|
|
2419
|
-
const type = /^\s*</.test(content) ? "text/html" : "text/plain";
|
|
2420
|
-
this.safeHeader("Content-Type", `${type}; charset=utf-8`);
|
|
2421
|
-
break;
|
|
2422
|
-
case "number":
|
|
2423
|
-
case "boolean":
|
|
2424
|
-
case "date":
|
|
2425
|
-
case "bigint":
|
|
2426
|
-
case "regexp":
|
|
2427
|
-
this.safeHeader("Content-Type", "text/plain; charset=utf-8");
|
|
2428
|
-
break;
|
|
2429
|
-
case "buffer":
|
|
2430
|
-
this.safeHeader("Content-Type", "application/octet-stream; charset=utf-8");
|
|
2431
|
-
break;
|
|
2432
|
-
case "object":
|
|
2433
|
-
this.safeHeader("Content-Type", "application/json; charset=utf-8");
|
|
2434
|
-
break;
|
|
2435
|
-
}
|
|
2534
|
+
this.safeHeader("Content-type", contentType);
|
|
2436
2535
|
}
|
|
2437
2536
|
this.#endResponse(content);
|
|
2438
2537
|
}
|
|
@@ -2669,7 +2768,7 @@ var Response = class extends Macroable6 {
|
|
|
2669
2768
|
*/
|
|
2670
2769
|
type(type, charset) {
|
|
2671
2770
|
type = charset ? `${type}; charset=${charset}` : type;
|
|
2672
|
-
this.header("Content-Type",
|
|
2771
|
+
this.header("Content-Type", default3.contentType(type));
|
|
2673
2772
|
return this;
|
|
2674
2773
|
}
|
|
2675
2774
|
/**
|
|
@@ -2956,7 +3055,7 @@ var Response = class extends Macroable6 {
|
|
|
2956
3055
|
return;
|
|
2957
3056
|
}
|
|
2958
3057
|
if (this.content) {
|
|
2959
|
-
this.writeBody
|
|
3058
|
+
httpResponseSerializer.traceSync(this.writeBody, void 0, this, ...this.content);
|
|
2960
3059
|
return;
|
|
2961
3060
|
}
|
|
2962
3061
|
if (this.lazyBody.stream) {
|
|
@@ -3267,22 +3366,13 @@ var Response = class extends Macroable6 {
|
|
|
3267
3366
|
|
|
3268
3367
|
// src/router/main.ts
|
|
3269
3368
|
import is3 from "@sindresorhus/is";
|
|
3369
|
+
import lodash2 from "@poppinss/utils/lodash";
|
|
3270
3370
|
import { moduleImporter as moduleImporter3 } from "@adonisjs/fold";
|
|
3271
|
-
import { RuntimeException as
|
|
3371
|
+
import { RuntimeException as RuntimeException5 } from "@poppinss/utils/exception";
|
|
3272
3372
|
|
|
3273
3373
|
// src/router/store.ts
|
|
3274
|
-
import matchit2 from "@poppinss/matchit";
|
|
3275
|
-
import lodash2 from "@poppinss/utils/lodash";
|
|
3276
|
-
import { RuntimeException as RuntimeException4 } from "@poppinss/utils";
|
|
3277
|
-
|
|
3278
|
-
// src/router/parser.ts
|
|
3279
3374
|
import matchit from "@poppinss/matchit";
|
|
3280
|
-
|
|
3281
|
-
const tokens = matchit.parse(pattern, matchers);
|
|
3282
|
-
return tokens;
|
|
3283
|
-
}
|
|
3284
|
-
|
|
3285
|
-
// src/router/store.ts
|
|
3375
|
+
import { RuntimeException as RuntimeException4 } from "@poppinss/utils/exception";
|
|
3286
3376
|
var RoutesStore = class {
|
|
3287
3377
|
/**
|
|
3288
3378
|
* A flag to know if routes for explicit domains
|
|
@@ -3298,7 +3388,7 @@ var RoutesStore = class {
|
|
|
3298
3388
|
*/
|
|
3299
3389
|
#getDomainNode(domain) {
|
|
3300
3390
|
if (!this.tree.domains[domain]) {
|
|
3301
|
-
this.tree.tokens.push(
|
|
3391
|
+
this.tree.tokens.push(parseRoute(domain));
|
|
3302
3392
|
this.tree.domains[domain] = {};
|
|
3303
3393
|
}
|
|
3304
3394
|
return this.tree.domains[domain];
|
|
@@ -3367,14 +3457,10 @@ var RoutesStore = class {
|
|
|
3367
3457
|
if (route.domain !== "root") {
|
|
3368
3458
|
this.usingDomains = true;
|
|
3369
3459
|
}
|
|
3370
|
-
const
|
|
3371
|
-
|
|
3372
|
-
{ meta: {} },
|
|
3373
|
-
lodash2.pick(route, ["pattern", "handler", "meta", "middleware", "name", "execute"])
|
|
3374
|
-
);
|
|
3375
|
-
routeNode.meta.params = this.#collectRouteParams(routeNode, tokens);
|
|
3460
|
+
const routeNode = { ...route };
|
|
3461
|
+
routeNode.meta.params = this.#collectRouteParams(routeNode, route.tokens);
|
|
3376
3462
|
route.methods.forEach((method) => {
|
|
3377
|
-
this.#registerRoute(route.domain, method, tokens, routeNode);
|
|
3463
|
+
this.#registerRoute(route.domain, method, route.tokens, routeNode);
|
|
3378
3464
|
});
|
|
3379
3465
|
return this;
|
|
3380
3466
|
}
|
|
@@ -3387,7 +3473,7 @@ var RoutesStore = class {
|
|
|
3387
3473
|
* qualified runtime domain. You must call `matchDomain` first to fetch
|
|
3388
3474
|
* the pattern for qualified domain
|
|
3389
3475
|
*/
|
|
3390
|
-
match(url, method, domain) {
|
|
3476
|
+
match(url, method, shouldDecodeParam, domain) {
|
|
3391
3477
|
const domainName = domain?.tokens[0]?.old || "root";
|
|
3392
3478
|
const matchedDomain = this.tree.domains[domainName];
|
|
3393
3479
|
if (!matchedDomain) {
|
|
@@ -3397,7 +3483,7 @@ var RoutesStore = class {
|
|
|
3397
3483
|
if (!matchedMethod) {
|
|
3398
3484
|
return null;
|
|
3399
3485
|
}
|
|
3400
|
-
const matchedRoute =
|
|
3486
|
+
const matchedRoute = matchit.match(url, matchedMethod.tokens);
|
|
3401
3487
|
if (!matchedRoute.length) {
|
|
3402
3488
|
return null;
|
|
3403
3489
|
}
|
|
@@ -3405,8 +3491,8 @@ var RoutesStore = class {
|
|
|
3405
3491
|
return {
|
|
3406
3492
|
route,
|
|
3407
3493
|
routeKey: matchedMethod.routeKeys[route.pattern],
|
|
3408
|
-
params:
|
|
3409
|
-
subdomains: domain?.hostname ?
|
|
3494
|
+
params: matchit.exec(url, matchedRoute, shouldDecodeParam),
|
|
3495
|
+
subdomains: domain?.hostname ? matchit.exec(domain.hostname, domain.tokens) : {}
|
|
3410
3496
|
};
|
|
3411
3497
|
}
|
|
3412
3498
|
/**
|
|
@@ -3416,120 +3502,149 @@ var RoutesStore = class {
|
|
|
3416
3502
|
if (!hostname || !this.usingDomains) {
|
|
3417
3503
|
return [];
|
|
3418
3504
|
}
|
|
3419
|
-
return
|
|
3505
|
+
return matchit.match(hostname, this.tree.tokens);
|
|
3420
3506
|
}
|
|
3421
3507
|
};
|
|
3422
3508
|
|
|
3423
|
-
// src/router
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
// src/router/lookup_store/url_builder.ts
|
|
3427
|
-
import { RuntimeException as RuntimeException5 } from "@poppinss/utils";
|
|
3428
|
-
var UrlBuilder = class {
|
|
3509
|
+
// src/client/router.ts
|
|
3510
|
+
var RouterClient = class {
|
|
3429
3511
|
/**
|
|
3430
|
-
*
|
|
3512
|
+
* List of route references kept for lookup.
|
|
3431
3513
|
*/
|
|
3432
|
-
|
|
3514
|
+
routes;
|
|
3433
3515
|
/**
|
|
3434
|
-
* The
|
|
3516
|
+
* The lookup strategies to follow when generating URL builder
|
|
3517
|
+
* types and client
|
|
3435
3518
|
*/
|
|
3436
|
-
|
|
3519
|
+
lookupStrategies = ["name", "pattern"];
|
|
3520
|
+
constructor(routes) {
|
|
3521
|
+
this.routes = routes ?? {};
|
|
3522
|
+
}
|
|
3437
3523
|
/**
|
|
3438
|
-
*
|
|
3524
|
+
* Register route JSON payload
|
|
3439
3525
|
*/
|
|
3440
|
-
|
|
3526
|
+
register(route) {
|
|
3527
|
+
this.routes[route.domain] = this.routes[route.domain] || [];
|
|
3528
|
+
this.routes[route.domain].push(route);
|
|
3529
|
+
}
|
|
3441
3530
|
/**
|
|
3442
|
-
*
|
|
3443
|
-
*
|
|
3531
|
+
* Define the lookup strategies to follow when generating URL builder
|
|
3532
|
+
* types and client.
|
|
3444
3533
|
*/
|
|
3445
|
-
|
|
3534
|
+
updateLookupStrategies(strategies) {
|
|
3535
|
+
this.lookupStrategies = strategies;
|
|
3536
|
+
return this;
|
|
3537
|
+
}
|
|
3446
3538
|
/**
|
|
3447
|
-
*
|
|
3448
|
-
|
|
3449
|
-
|
|
3539
|
+
* Finds a route by its identifier. The identifier can be the
|
|
3540
|
+
* route name, controller.method name or the route pattern
|
|
3541
|
+
* itself.
|
|
3542
|
+
*
|
|
3543
|
+
* When "followLookupStrategy" is enabled, the lookup will be performed
|
|
3544
|
+
* on the basis of the lookup strategy enabled via the "lookupStrategies"
|
|
3545
|
+
* method. The default lookupStrategy is "name" and "pattern".
|
|
3546
|
+
*/
|
|
3547
|
+
find(routeIdentifier, domain, method, followLookupStrategy) {
|
|
3548
|
+
if (!domain) {
|
|
3549
|
+
let route = null;
|
|
3550
|
+
for (const routeDomain of Object.keys(this.routes)) {
|
|
3551
|
+
route = this.find(routeIdentifier, routeDomain, method, followLookupStrategy);
|
|
3552
|
+
if (route) {
|
|
3553
|
+
break;
|
|
3554
|
+
}
|
|
3555
|
+
}
|
|
3556
|
+
return route;
|
|
3557
|
+
}
|
|
3558
|
+
const routes = this.routes[domain];
|
|
3559
|
+
if (!routes) {
|
|
3560
|
+
return null;
|
|
3561
|
+
}
|
|
3562
|
+
const lookupByName = !followLookupStrategy || this.lookupStrategies.includes("name");
|
|
3563
|
+
const lookupByPattern = !followLookupStrategy || this.lookupStrategies.includes("pattern");
|
|
3564
|
+
const lookupByController = !followLookupStrategy || this.lookupStrategies.includes("controller");
|
|
3565
|
+
return routes.find((route) => {
|
|
3566
|
+
if (method && !route.methods.includes(method)) {
|
|
3567
|
+
return false;
|
|
3568
|
+
}
|
|
3569
|
+
if (route.name === routeIdentifier && lookupByName || route.pattern === routeIdentifier && lookupByPattern) {
|
|
3570
|
+
return true;
|
|
3571
|
+
}
|
|
3572
|
+
if (typeof route.handler === "function" || !lookupByController) {
|
|
3573
|
+
return false;
|
|
3574
|
+
}
|
|
3575
|
+
return route.handler.reference === routeIdentifier;
|
|
3576
|
+
}) || null;
|
|
3577
|
+
}
|
|
3450
3578
|
/**
|
|
3451
|
-
*
|
|
3579
|
+
* Finds a route by its identifier. The identifier can be the
|
|
3580
|
+
* route name, controller.method name or the route pattern
|
|
3581
|
+
* itself.
|
|
3582
|
+
*
|
|
3583
|
+
* An error is raised when unable to find the route.
|
|
3584
|
+
*
|
|
3585
|
+
* When "followLookupStrategy" is enabled, the lookup will be performed
|
|
3586
|
+
* on the basis of the lookup strategy enabled via the "lookupStrategies"
|
|
3587
|
+
* method. The default lookupStrategy is "name" and "pattern".
|
|
3452
3588
|
*/
|
|
3453
|
-
|
|
3589
|
+
findOrFail(routeIdentifier, domain, method, followLookupStrategy) {
|
|
3590
|
+
const route = this.find(routeIdentifier, domain, method, followLookupStrategy);
|
|
3591
|
+
if (!route) {
|
|
3592
|
+
throw new Error(`Cannot lookup route "${routeIdentifier}"`);
|
|
3593
|
+
}
|
|
3594
|
+
return route;
|
|
3595
|
+
}
|
|
3454
3596
|
/**
|
|
3455
|
-
*
|
|
3597
|
+
* Check if a route exists. The identifier can be the
|
|
3598
|
+
* route name, controller.method name or the route pattern
|
|
3599
|
+
* itself.
|
|
3600
|
+
*
|
|
3601
|
+
* When "followLookupStrategy" is enabled, the lookup will be performed
|
|
3602
|
+
* on the basis of the lookup strategy enabled via the "lookupStrategies"
|
|
3603
|
+
* method. The default lookupStrategy is "name" and "pattern".
|
|
3456
3604
|
*/
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
this.#qsParser = qsParser;
|
|
3460
|
-
this.#encryption = encryption;
|
|
3461
|
-
this.#routeFinder = routeFinder;
|
|
3605
|
+
has(routeIdentifier, domain, method, followLookupStrategy) {
|
|
3606
|
+
return !!this.find(routeIdentifier, domain, method, followLookupStrategy);
|
|
3462
3607
|
}
|
|
3463
3608
|
/**
|
|
3464
|
-
*
|
|
3465
|
-
* has length of zero.
|
|
3609
|
+
* Returns a list of routes grouped by their domain names
|
|
3466
3610
|
*/
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
throw new RuntimeException5(
|
|
3470
|
-
`Cannot make URL for "${pattern}" route. Invalid value provided for wildcard param`
|
|
3471
|
-
);
|
|
3472
|
-
}
|
|
3611
|
+
toJSON() {
|
|
3612
|
+
return this.routes;
|
|
3473
3613
|
}
|
|
3474
|
-
|
|
3475
|
-
|
|
3614
|
+
};
|
|
3615
|
+
|
|
3616
|
+
// src/router/legacy/url_builder.ts
|
|
3617
|
+
var UrlBuilder = class {
|
|
3618
|
+
/**
|
|
3619
|
+
* The parameters to apply on the route
|
|
3476
3620
|
*/
|
|
3477
|
-
#
|
|
3478
|
-
if (value === void 0 || value === null) {
|
|
3479
|
-
throw new RuntimeException5(
|
|
3480
|
-
`Cannot make URL for "${pattern}" route. Missing value for "${param}" param`
|
|
3481
|
-
);
|
|
3482
|
-
}
|
|
3483
|
-
}
|
|
3621
|
+
#params = {};
|
|
3484
3622
|
/**
|
|
3485
|
-
*
|
|
3623
|
+
* Query string to append to the route
|
|
3486
3624
|
*/
|
|
3487
|
-
#
|
|
3488
|
-
const uriSegments = [];
|
|
3489
|
-
const paramsArray = Array.isArray(this.#params) ? this.#params : null;
|
|
3490
|
-
const paramsObject = !Array.isArray(this.#params) ? this.#params : {};
|
|
3491
|
-
let paramsIndex = 0;
|
|
3492
|
-
const tokens = parseRoutePattern(pattern);
|
|
3493
|
-
for (const token of tokens) {
|
|
3494
|
-
if (token.type === 0) {
|
|
3495
|
-
uriSegments.push(token.val === "/" ? "" : `${token.val}${token.end}`);
|
|
3496
|
-
} else if (token.type === 2) {
|
|
3497
|
-
const values = paramsArray ? paramsArray.slice(paramsIndex) : paramsObject["*"];
|
|
3498
|
-
this.#ensureHasWildCardValues(pattern, values);
|
|
3499
|
-
uriSegments.push(`${values.join("/")}${token.end}`);
|
|
3500
|
-
break;
|
|
3501
|
-
} else {
|
|
3502
|
-
const paramName = token.val;
|
|
3503
|
-
const value = paramsArray ? paramsArray[paramsIndex] : paramsObject[paramName];
|
|
3504
|
-
if (token.type === 1) {
|
|
3505
|
-
this.#ensureHasParamValue(pattern, paramName, value);
|
|
3506
|
-
}
|
|
3507
|
-
paramsIndex++;
|
|
3508
|
-
if (value !== void 0 && value !== null) {
|
|
3509
|
-
uriSegments.push(`${value}${token.end}`);
|
|
3510
|
-
}
|
|
3511
|
-
}
|
|
3512
|
-
}
|
|
3513
|
-
return `/${uriSegments.join("/")}`;
|
|
3514
|
-
}
|
|
3625
|
+
#qs = {};
|
|
3515
3626
|
/**
|
|
3516
|
-
*
|
|
3627
|
+
* Should we perform the route lookup or just build the
|
|
3628
|
+
* given pattern as it is.
|
|
3517
3629
|
*/
|
|
3518
|
-
#
|
|
3519
|
-
if (qs) {
|
|
3520
|
-
const queryString = this.#qsParser.stringify(qs);
|
|
3521
|
-
url = queryString ? `${url}?${queryString}` : url;
|
|
3522
|
-
}
|
|
3523
|
-
return url;
|
|
3524
|
-
}
|
|
3630
|
+
#shouldPerformLookup = true;
|
|
3525
3631
|
/**
|
|
3526
|
-
*
|
|
3632
|
+
* BaseURL to append to the constructored URL
|
|
3527
3633
|
*/
|
|
3528
|
-
#
|
|
3529
|
-
|
|
3634
|
+
#baseUrl;
|
|
3635
|
+
/**
|
|
3636
|
+
* Route finder for finding route pattern
|
|
3637
|
+
*/
|
|
3638
|
+
#router;
|
|
3639
|
+
#domain;
|
|
3640
|
+
constructor(router, domain) {
|
|
3641
|
+
this.#router = router;
|
|
3642
|
+
this.#domain = domain;
|
|
3530
3643
|
}
|
|
3531
3644
|
/**
|
|
3532
3645
|
* Prefix a custom base URL to the final URI
|
|
3646
|
+
* @deprecated
|
|
3647
|
+
* Instead use "@adonisjs/core/services/url_builder" instead
|
|
3533
3648
|
*/
|
|
3534
3649
|
prefixUrl(url) {
|
|
3535
3650
|
this.#baseUrl = url;
|
|
@@ -3538,6 +3653,8 @@ var UrlBuilder = class {
|
|
|
3538
3653
|
/**
|
|
3539
3654
|
* Disable route lookup. Calling this method considers
|
|
3540
3655
|
* the "identifier" as the route pattern
|
|
3656
|
+
* @deprecated
|
|
3657
|
+
* Instead use "@adonisjs/core/services/url_builder" instead
|
|
3541
3658
|
*/
|
|
3542
3659
|
disableRouteLookup() {
|
|
3543
3660
|
this.#shouldPerformLookup = false;
|
|
@@ -3545,6 +3662,8 @@ var UrlBuilder = class {
|
|
|
3545
3662
|
}
|
|
3546
3663
|
/**
|
|
3547
3664
|
* Append query string to the final URI
|
|
3665
|
+
* @deprecated
|
|
3666
|
+
* Instead use "@adonisjs/core/services/url_builder" instead
|
|
3548
3667
|
*/
|
|
3549
3668
|
qs(queryString) {
|
|
3550
3669
|
if (!queryString) {
|
|
@@ -3555,6 +3674,8 @@ var UrlBuilder = class {
|
|
|
3555
3674
|
}
|
|
3556
3675
|
/**
|
|
3557
3676
|
* Specify params to apply to the route pattern
|
|
3677
|
+
* @deprecated
|
|
3678
|
+
* Instead use "@adonisjs/core/services/url_builder" instead
|
|
3558
3679
|
*/
|
|
3559
3680
|
params(params) {
|
|
3560
3681
|
if (!params) {
|
|
@@ -3567,174 +3688,41 @@ var UrlBuilder = class {
|
|
|
3567
3688
|
* Generate URL for the given route identifier. The identifier can be the
|
|
3568
3689
|
* route name, controller.method name or the route pattern
|
|
3569
3690
|
* itself.
|
|
3691
|
+
*
|
|
3692
|
+
* @deprecated
|
|
3693
|
+
* Instead use "@adonisjs/core/services/url_builder" instead
|
|
3570
3694
|
*/
|
|
3571
3695
|
make(identifier) {
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
}
|
|
3579
|
-
return this.#suffixQueryString(this.#prefixBaseUrl(url), this.#qs);
|
|
3696
|
+
return this.#router.makeUrl(identifier, this.#params, {
|
|
3697
|
+
prefixUrl: this.#baseUrl,
|
|
3698
|
+
disableRouteLookup: !this.#shouldPerformLookup,
|
|
3699
|
+
domain: this.#domain,
|
|
3700
|
+
qs: this.#qs
|
|
3701
|
+
});
|
|
3580
3702
|
}
|
|
3581
3703
|
/**
|
|
3582
3704
|
* Generate a signed URL for the given route identifier. The identifier can be the
|
|
3583
3705
|
* route name, controller.method name or the route pattern
|
|
3584
3706
|
* itself.
|
|
3585
|
-
*/
|
|
3586
|
-
makeSigned(identifier, options) {
|
|
3587
|
-
let url;
|
|
3588
|
-
if (this.#shouldPerformLookup) {
|
|
3589
|
-
const route = this.#routeFinder.findOrFail(identifier);
|
|
3590
|
-
url = this.#processPattern(route.pattern);
|
|
3591
|
-
} else {
|
|
3592
|
-
url = this.#processPattern(identifier);
|
|
3593
|
-
}
|
|
3594
|
-
const signature = this.#encryption.verifier.sign(
|
|
3595
|
-
this.#suffixQueryString(url, this.#qs),
|
|
3596
|
-
options?.expiresIn,
|
|
3597
|
-
options?.purpose
|
|
3598
|
-
);
|
|
3599
|
-
const qs = Object.assign({}, this.#qs, { signature });
|
|
3600
|
-
return this.#suffixQueryString(this.#prefixBaseUrl(url), qs);
|
|
3601
|
-
}
|
|
3602
|
-
};
|
|
3603
|
-
|
|
3604
|
-
// src/router/lookup_store/route_finder.ts
|
|
3605
|
-
var RouteFinder = class {
|
|
3606
|
-
#routes = [];
|
|
3607
|
-
register(route) {
|
|
3608
|
-
this.#routes.push(route);
|
|
3609
|
-
}
|
|
3610
|
-
/**
|
|
3611
|
-
* Find a route by indentifier
|
|
3612
|
-
*/
|
|
3613
|
-
find(routeIdentifier) {
|
|
3614
|
-
return this.#routes.find(({ name, pattern, handler }) => {
|
|
3615
|
-
if (name === routeIdentifier || pattern === routeIdentifier) {
|
|
3616
|
-
return true;
|
|
3617
|
-
}
|
|
3618
|
-
if (typeof handler === "function") {
|
|
3619
|
-
return false;
|
|
3620
|
-
}
|
|
3621
|
-
return handler.reference === routeIdentifier;
|
|
3622
|
-
}) || null;
|
|
3623
|
-
}
|
|
3624
|
-
/**
|
|
3625
|
-
* Find a route by indentifier or fail
|
|
3626
|
-
*/
|
|
3627
|
-
findOrFail(routeIdentifier) {
|
|
3628
|
-
const route = this.find(routeIdentifier);
|
|
3629
|
-
if (!route) {
|
|
3630
|
-
throw new E_CANNOT_LOOKUP_ROUTE([routeIdentifier]);
|
|
3631
|
-
}
|
|
3632
|
-
return route;
|
|
3633
|
-
}
|
|
3634
|
-
/**
|
|
3635
|
-
* Find if a route exists
|
|
3636
|
-
*/
|
|
3637
|
-
has(routeIdentifier) {
|
|
3638
|
-
return !!this.find(routeIdentifier);
|
|
3639
|
-
}
|
|
3640
|
-
/**
|
|
3641
|
-
* Returns an array of registered routes
|
|
3642
|
-
*/
|
|
3643
|
-
toJSON() {
|
|
3644
|
-
return this.#routes;
|
|
3645
|
-
}
|
|
3646
|
-
};
|
|
3647
|
-
|
|
3648
|
-
// src/router/lookup_store/main.ts
|
|
3649
|
-
var LookupStore = class extends Macroable7 {
|
|
3650
|
-
/**
|
|
3651
|
-
* List of route finders grouped by domains
|
|
3652
|
-
*/
|
|
3653
|
-
#routes = {};
|
|
3654
|
-
/**
|
|
3655
|
-
* Encryption for making URLs
|
|
3656
|
-
*/
|
|
3657
|
-
#encryption;
|
|
3658
|
-
/**
|
|
3659
|
-
* Query string parser for making URLs
|
|
3660
|
-
*/
|
|
3661
|
-
#qsParser;
|
|
3662
|
-
constructor(encryption, qsParser) {
|
|
3663
|
-
super();
|
|
3664
|
-
this.#encryption = encryption;
|
|
3665
|
-
this.#qsParser = qsParser;
|
|
3666
|
-
}
|
|
3667
|
-
/**
|
|
3668
|
-
* Register route JSON payload
|
|
3669
|
-
*/
|
|
3670
|
-
register(route) {
|
|
3671
|
-
this.#routes[route.domain] = this.#routes[route.domain] || new RouteFinder();
|
|
3672
|
-
this.#routes[route.domain].register(route);
|
|
3673
|
-
}
|
|
3674
|
-
/**
|
|
3675
|
-
* Returns an instance of the URL builder for making
|
|
3676
|
-
* route URIs
|
|
3677
|
-
*/
|
|
3678
|
-
builder() {
|
|
3679
|
-
return this.builderForDomain("root");
|
|
3680
|
-
}
|
|
3681
|
-
/**
|
|
3682
|
-
* Returns an instance of the URL builder for a specific
|
|
3683
|
-
* domain.
|
|
3684
|
-
*/
|
|
3685
|
-
builderForDomain(domain) {
|
|
3686
|
-
const finder = this.#routes[domain];
|
|
3687
|
-
return new UrlBuilder(this.#encryption, finder || new RouteFinder(), this.#qsParser);
|
|
3688
|
-
}
|
|
3689
|
-
/**
|
|
3690
|
-
* Finds a route by its identifier. The identifier can be the
|
|
3691
|
-
* route name, controller.method name or the route pattern
|
|
3692
|
-
* itself.
|
|
3693
|
-
*/
|
|
3694
|
-
find(routeIdentifier, domain) {
|
|
3695
|
-
const finder = this.#routes[domain || "root"];
|
|
3696
|
-
if (!finder) {
|
|
3697
|
-
return null;
|
|
3698
|
-
}
|
|
3699
|
-
return finder.find(routeIdentifier);
|
|
3700
|
-
}
|
|
3701
|
-
/**
|
|
3702
|
-
* Finds a route by its identifier. The identifier can be the
|
|
3703
|
-
* route name, controller.method name or the route pattern
|
|
3704
|
-
* itself.
|
|
3705
3707
|
*
|
|
3706
|
-
*
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
const finder = this.#routes[domain || "root"];
|
|
3710
|
-
if (!finder) {
|
|
3711
|
-
throw new E_CANNOT_LOOKUP_ROUTE([routeIdentifier]);
|
|
3712
|
-
}
|
|
3713
|
-
return finder.findOrFail(routeIdentifier);
|
|
3714
|
-
}
|
|
3715
|
-
/**
|
|
3716
|
-
* Check if a route exists. The identifier can be the
|
|
3717
|
-
* route name, controller.method name or the route pattern
|
|
3718
|
-
* itself.
|
|
3708
|
+
* @deprecated
|
|
3709
|
+
* Instead use "@adonisjs/core/services/url_builder" instead
|
|
3710
|
+
*
|
|
3719
3711
|
*/
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
return Object.keys(this.#routes).reduce((result, domain) => {
|
|
3729
|
-
result[domain] = this.#routes[domain].toJSON();
|
|
3730
|
-
return result;
|
|
3731
|
-
}, {});
|
|
3712
|
+
makeSigned(identifier, options) {
|
|
3713
|
+
return this.#router.makeSignedUrl(identifier, this.#params, {
|
|
3714
|
+
prefixUrl: this.#baseUrl,
|
|
3715
|
+
disableRouteLookup: !this.#shouldPerformLookup,
|
|
3716
|
+
domain: this.#domain,
|
|
3717
|
+
qs: this.#qs,
|
|
3718
|
+
...options
|
|
3719
|
+
});
|
|
3732
3720
|
}
|
|
3733
3721
|
};
|
|
3734
3722
|
|
|
3735
3723
|
// src/router/matchers.ts
|
|
3736
|
-
import
|
|
3737
|
-
var RouteMatchers = class extends
|
|
3724
|
+
import Macroable7 from "@poppinss/macroable";
|
|
3725
|
+
var RouteMatchers = class extends Macroable7 {
|
|
3738
3726
|
/**
|
|
3739
3727
|
* Enforce value to be a number and also casts it to number data
|
|
3740
3728
|
* type
|
|
@@ -3767,6 +3755,7 @@ function middlewareReferenceBuilder(name, middleware) {
|
|
|
3767
3755
|
return {
|
|
3768
3756
|
...handler,
|
|
3769
3757
|
name,
|
|
3758
|
+
reference: middleware,
|
|
3770
3759
|
args: args[0]
|
|
3771
3760
|
};
|
|
3772
3761
|
};
|
|
@@ -3781,8 +3770,225 @@ function defineNamedMiddleware(collection) {
|
|
|
3781
3770
|
);
|
|
3782
3771
|
}
|
|
3783
3772
|
|
|
3773
|
+
// src/client/url_builder.ts
|
|
3774
|
+
function createURL(identifier, tokens, searchParamsStringifier, params, options) {
|
|
3775
|
+
const uriSegments = [];
|
|
3776
|
+
const paramsArray = Array.isArray(params) ? params : null;
|
|
3777
|
+
const paramsObject = !Array.isArray(params) ? params ?? {} : {};
|
|
3778
|
+
let paramsIndex = 0;
|
|
3779
|
+
for (const token of tokens) {
|
|
3780
|
+
if (token.type === 0) {
|
|
3781
|
+
uriSegments.push(token.val === "/" ? "" : `${token.val}${token.end}`);
|
|
3782
|
+
continue;
|
|
3783
|
+
}
|
|
3784
|
+
if (token.type === 2) {
|
|
3785
|
+
const values = paramsArray ? paramsArray.slice(paramsIndex) : paramsObject["*"];
|
|
3786
|
+
if (!Array.isArray(values) || !values.length) {
|
|
3787
|
+
throw new Error(
|
|
3788
|
+
`Cannot make URL for "${identifier}". Invalid value provided for the wildcard param`
|
|
3789
|
+
);
|
|
3790
|
+
}
|
|
3791
|
+
uriSegments.push(`${values.join("/")}${token.end}`);
|
|
3792
|
+
break;
|
|
3793
|
+
}
|
|
3794
|
+
const paramName = token.val;
|
|
3795
|
+
const value = paramsArray ? paramsArray[paramsIndex] : paramsObject[paramName];
|
|
3796
|
+
const isDefined = value !== void 0 && value !== null;
|
|
3797
|
+
if (token.type === 1 && !isDefined) {
|
|
3798
|
+
throw new Error(
|
|
3799
|
+
`Cannot make URL for "${identifier}". Missing value for the "${paramName}" param`
|
|
3800
|
+
);
|
|
3801
|
+
}
|
|
3802
|
+
if (isDefined) {
|
|
3803
|
+
uriSegments.push(`${value}${token.end}`);
|
|
3804
|
+
}
|
|
3805
|
+
paramsIndex++;
|
|
3806
|
+
}
|
|
3807
|
+
let URI = `/${uriSegments.join("/")}`;
|
|
3808
|
+
if (options?.prefixUrl) {
|
|
3809
|
+
URI = `${options?.prefixUrl.replace(/\/$/, "")}${URI}`;
|
|
3810
|
+
}
|
|
3811
|
+
if (options?.qs) {
|
|
3812
|
+
const queryString = searchParamsStringifier(options?.qs);
|
|
3813
|
+
URI = queryString ? `${URI}?${queryString}` : URI;
|
|
3814
|
+
}
|
|
3815
|
+
return URI;
|
|
3816
|
+
}
|
|
3817
|
+
function createUrlBuilder(router, searchParamsStringifier) {
|
|
3818
|
+
let domainsList;
|
|
3819
|
+
function createUrlForRoute(identifier, params, options, method) {
|
|
3820
|
+
if (!domainsList) {
|
|
3821
|
+
domainsList = Object.keys(router.toJSON()).filter((domain2) => domain2 !== "root");
|
|
3822
|
+
}
|
|
3823
|
+
const domain = domainsList.find((name) => identifier.startsWith(`${name}@`));
|
|
3824
|
+
const routeIdentifier = domain ? identifier.replace(new RegExp(`^${domain}@`), "") : identifier;
|
|
3825
|
+
const route = router.findOrFail(routeIdentifier, domain, method, true);
|
|
3826
|
+
return createURL(
|
|
3827
|
+
route.name ?? route.pattern,
|
|
3828
|
+
route.tokens,
|
|
3829
|
+
searchParamsStringifier,
|
|
3830
|
+
params,
|
|
3831
|
+
options
|
|
3832
|
+
);
|
|
3833
|
+
}
|
|
3834
|
+
const urlFor = function route(...[identifier, params, options]) {
|
|
3835
|
+
return createUrlForRoute(identifier, params, options);
|
|
3836
|
+
};
|
|
3837
|
+
urlFor.get = function urlForMethodGet(...[identifier, params, options]) {
|
|
3838
|
+
return {
|
|
3839
|
+
url: createUrlForRoute(identifier, params, options, "GET"),
|
|
3840
|
+
method: "get",
|
|
3841
|
+
toString() {
|
|
3842
|
+
return this.url;
|
|
3843
|
+
}
|
|
3844
|
+
};
|
|
3845
|
+
};
|
|
3846
|
+
urlFor.post = function urlForMethodPost(...[identifier, params, options]) {
|
|
3847
|
+
return {
|
|
3848
|
+
url: createUrlForRoute(identifier, params, options, "POST"),
|
|
3849
|
+
method: "post",
|
|
3850
|
+
toString() {
|
|
3851
|
+
return this.url;
|
|
3852
|
+
}
|
|
3853
|
+
};
|
|
3854
|
+
};
|
|
3855
|
+
urlFor.put = function urlForMethodPut(...[identifier, params, options]) {
|
|
3856
|
+
return {
|
|
3857
|
+
url: createUrlForRoute(identifier, params, options, "PUT"),
|
|
3858
|
+
method: "put",
|
|
3859
|
+
toString() {
|
|
3860
|
+
return this.url;
|
|
3861
|
+
}
|
|
3862
|
+
};
|
|
3863
|
+
};
|
|
3864
|
+
urlFor.patch = function urlForMethodPatch(...[identifier, params, options]) {
|
|
3865
|
+
return {
|
|
3866
|
+
url: createUrlForRoute(identifier, params, options, "PATCH"),
|
|
3867
|
+
method: "patch",
|
|
3868
|
+
toString() {
|
|
3869
|
+
return this.url;
|
|
3870
|
+
}
|
|
3871
|
+
};
|
|
3872
|
+
};
|
|
3873
|
+
urlFor.delete = function urlForMethodDelete(...[identifier, params, options]) {
|
|
3874
|
+
return {
|
|
3875
|
+
url: createUrlForRoute(identifier, params, options, "DELETE"),
|
|
3876
|
+
method: "delete",
|
|
3877
|
+
toString() {
|
|
3878
|
+
return this.url;
|
|
3879
|
+
}
|
|
3880
|
+
};
|
|
3881
|
+
};
|
|
3882
|
+
urlFor.method = function urlForCustomMethod(method, ...[identifier, params, options]) {
|
|
3883
|
+
return {
|
|
3884
|
+
url: createUrlForRoute(identifier, params, options, method),
|
|
3885
|
+
method,
|
|
3886
|
+
toString() {
|
|
3887
|
+
return this.url;
|
|
3888
|
+
}
|
|
3889
|
+
};
|
|
3890
|
+
};
|
|
3891
|
+
return urlFor;
|
|
3892
|
+
}
|
|
3893
|
+
|
|
3894
|
+
// src/router/signed_url_builder.ts
|
|
3895
|
+
function createSignedURL(identifier, tokens, searchParamsStringifier, encryption, params, options) {
|
|
3896
|
+
const signature = encryption.verifier.sign(
|
|
3897
|
+
createURL(identifier, tokens, searchParamsStringifier, params, {
|
|
3898
|
+
...options,
|
|
3899
|
+
prefixUrl: void 0
|
|
3900
|
+
}),
|
|
3901
|
+
options?.expiresIn,
|
|
3902
|
+
options?.purpose
|
|
3903
|
+
);
|
|
3904
|
+
return createURL(identifier, tokens, searchParamsStringifier, params, {
|
|
3905
|
+
...options,
|
|
3906
|
+
qs: { ...options?.qs, signature }
|
|
3907
|
+
});
|
|
3908
|
+
}
|
|
3909
|
+
function createSignedUrlBuilder(router, encryption, searchParamsStringifier) {
|
|
3910
|
+
let domainsList;
|
|
3911
|
+
function createSignedUrlForRoute(identifier, params, options, method) {
|
|
3912
|
+
if (!domainsList) {
|
|
3913
|
+
domainsList = Object.keys(router.toJSON()).filter((domain2) => domain2 !== "root");
|
|
3914
|
+
}
|
|
3915
|
+
const domain = domainsList.find((name) => identifier.startsWith(`${name}@`));
|
|
3916
|
+
const routeIdentifier = domain ? identifier.replace(new RegExp(`^${domain}@`), "") : identifier;
|
|
3917
|
+
const route = router.findOrFail(routeIdentifier, domain, method, true);
|
|
3918
|
+
return createSignedURL(
|
|
3919
|
+
route.name ?? route.pattern,
|
|
3920
|
+
route.tokens,
|
|
3921
|
+
searchParamsStringifier,
|
|
3922
|
+
encryption,
|
|
3923
|
+
params,
|
|
3924
|
+
options
|
|
3925
|
+
);
|
|
3926
|
+
}
|
|
3927
|
+
const signedRoute = function route(...[identifier, params, options]) {
|
|
3928
|
+
return createSignedUrlForRoute(identifier, params, options);
|
|
3929
|
+
};
|
|
3930
|
+
signedRoute.get = function routeGet(...[identifier, params, options]) {
|
|
3931
|
+
return {
|
|
3932
|
+
url: createSignedUrlForRoute(identifier, params, options, "GET"),
|
|
3933
|
+
method: "get",
|
|
3934
|
+
toString() {
|
|
3935
|
+
return this.url;
|
|
3936
|
+
}
|
|
3937
|
+
};
|
|
3938
|
+
};
|
|
3939
|
+
signedRoute.post = function routePost(...[identifier, params, options]) {
|
|
3940
|
+
return {
|
|
3941
|
+
url: createSignedUrlForRoute(identifier, params, options, "POST"),
|
|
3942
|
+
method: "post",
|
|
3943
|
+
toString() {
|
|
3944
|
+
return this.url;
|
|
3945
|
+
}
|
|
3946
|
+
};
|
|
3947
|
+
};
|
|
3948
|
+
signedRoute.put = function routePut(...[identifier, params, options]) {
|
|
3949
|
+
return {
|
|
3950
|
+
url: createSignedUrlForRoute(identifier, params, options, "PUT"),
|
|
3951
|
+
method: "put",
|
|
3952
|
+
toString() {
|
|
3953
|
+
return this.url;
|
|
3954
|
+
}
|
|
3955
|
+
};
|
|
3956
|
+
};
|
|
3957
|
+
signedRoute.patch = function routePatch(...[identifier, params, options]) {
|
|
3958
|
+
return {
|
|
3959
|
+
url: createSignedUrlForRoute(identifier, params, options, "PATCH"),
|
|
3960
|
+
method: "patch",
|
|
3961
|
+
toString() {
|
|
3962
|
+
return this.url;
|
|
3963
|
+
}
|
|
3964
|
+
};
|
|
3965
|
+
};
|
|
3966
|
+
signedRoute.delete = function routeDelete(...[identifier, params, options]) {
|
|
3967
|
+
return {
|
|
3968
|
+
url: createSignedUrlForRoute(identifier, params, options, "DELETE"),
|
|
3969
|
+
method: "delete",
|
|
3970
|
+
toString() {
|
|
3971
|
+
return this.url;
|
|
3972
|
+
}
|
|
3973
|
+
};
|
|
3974
|
+
};
|
|
3975
|
+
signedRoute.method = function routeGet(method, ...[identifier, params, options]) {
|
|
3976
|
+
return {
|
|
3977
|
+
url: createSignedUrlForRoute(identifier, params, options, method),
|
|
3978
|
+
method,
|
|
3979
|
+
toString() {
|
|
3980
|
+
return this.url;
|
|
3981
|
+
}
|
|
3982
|
+
};
|
|
3983
|
+
};
|
|
3984
|
+
return signedRoute;
|
|
3985
|
+
}
|
|
3986
|
+
|
|
3784
3987
|
// src/router/main.ts
|
|
3785
|
-
var Router = class extends
|
|
3988
|
+
var Router = class extends RouterClient {
|
|
3989
|
+
/**
|
|
3990
|
+
* Flag to avoid re-comitting routes to the store
|
|
3991
|
+
*/
|
|
3786
3992
|
#commited = false;
|
|
3787
3993
|
/**
|
|
3788
3994
|
* Application is needed to resolve string based controller expressions
|
|
@@ -3792,6 +3998,10 @@ var Router = class extends LookupStore {
|
|
|
3792
3998
|
* Store with tokenized routes
|
|
3793
3999
|
*/
|
|
3794
4000
|
#store = new RoutesStore();
|
|
4001
|
+
/**
|
|
4002
|
+
* Encryption for making signed URLs
|
|
4003
|
+
*/
|
|
4004
|
+
#encryption;
|
|
3795
4005
|
/**
|
|
3796
4006
|
* Global matchers to test route params against regular expressions.
|
|
3797
4007
|
*/
|
|
@@ -3806,10 +4016,10 @@ var Router = class extends LookupStore {
|
|
|
3806
4016
|
*/
|
|
3807
4017
|
#openedGroups = [];
|
|
3808
4018
|
/**
|
|
3809
|
-
* Collection of routes
|
|
3810
|
-
*
|
|
4019
|
+
* Collection of routes to be committed with the store, including
|
|
4020
|
+
* route resource and route group.
|
|
3811
4021
|
*/
|
|
3812
|
-
|
|
4022
|
+
#routesToBeCommitted = [];
|
|
3813
4023
|
/**
|
|
3814
4024
|
* A flag to know if routes for explicit domains have been registered.
|
|
3815
4025
|
* The boolean is computed after calling the "commit" method.
|
|
@@ -3827,9 +4037,27 @@ var Router = class extends LookupStore {
|
|
|
3827
4037
|
get commited() {
|
|
3828
4038
|
return this.#commited;
|
|
3829
4039
|
}
|
|
4040
|
+
/**
|
|
4041
|
+
* Query string parser for making URLs
|
|
4042
|
+
*/
|
|
4043
|
+
qs;
|
|
4044
|
+
/**
|
|
4045
|
+
* The URLBuilder offers a type-safe API for creating URL for pre-registered
|
|
4046
|
+
* routes or the route patterns.
|
|
4047
|
+
*
|
|
4048
|
+
* We recommend using the URLBuilder over the "makeUrl" and "makeSignedUrl"
|
|
4049
|
+
* methods.
|
|
4050
|
+
*/
|
|
4051
|
+
urlBuilder;
|
|
3830
4052
|
constructor(app, encryption, qsParser) {
|
|
3831
|
-
super(
|
|
4053
|
+
super();
|
|
3832
4054
|
this.#app = app;
|
|
4055
|
+
this.#encryption = encryption;
|
|
4056
|
+
this.qs = qsParser;
|
|
4057
|
+
this.urlBuilder = {
|
|
4058
|
+
urlFor: createUrlBuilder(this, this.qs.stringify),
|
|
4059
|
+
signedUrlFor: createSignedUrlBuilder(this, this.#encryption, this.qs.stringify)
|
|
4060
|
+
};
|
|
3833
4061
|
}
|
|
3834
4062
|
/**
|
|
3835
4063
|
* Push a give router entity to the list of routes or the
|
|
@@ -3841,13 +4069,13 @@ var Router = class extends LookupStore {
|
|
|
3841
4069
|
openedGroup.routes.push(entity);
|
|
3842
4070
|
return;
|
|
3843
4071
|
}
|
|
3844
|
-
this.
|
|
4072
|
+
this.#routesToBeCommitted.push(entity);
|
|
3845
4073
|
}
|
|
3846
4074
|
/**
|
|
3847
4075
|
* Parses the route pattern
|
|
3848
4076
|
*/
|
|
3849
4077
|
parsePattern(pattern, matchers) {
|
|
3850
|
-
return
|
|
4078
|
+
return parseRoute(pattern, matchers);
|
|
3851
4079
|
}
|
|
3852
4080
|
/**
|
|
3853
4081
|
* Define an array of middleware to use on all the routes.
|
|
@@ -3856,7 +4084,10 @@ var Router = class extends LookupStore {
|
|
|
3856
4084
|
*/
|
|
3857
4085
|
use(middleware) {
|
|
3858
4086
|
middleware.forEach(
|
|
3859
|
-
(one) => this.#middleware.push(
|
|
4087
|
+
(one) => this.#middleware.push({
|
|
4088
|
+
reference: one,
|
|
4089
|
+
...moduleImporter3(one, "handle").toHandleMethod()
|
|
4090
|
+
})
|
|
3860
4091
|
);
|
|
3861
4092
|
return this;
|
|
3862
4093
|
}
|
|
@@ -3994,13 +4225,13 @@ var Router = class extends LookupStore {
|
|
|
3994
4225
|
}
|
|
3995
4226
|
debug_default("Committing routes to the routes store");
|
|
3996
4227
|
const routeNamesByDomain = /* @__PURE__ */ new Map();
|
|
3997
|
-
toRoutesJSON(this
|
|
4228
|
+
toRoutesJSON(this.#routesToBeCommitted).forEach((route) => {
|
|
3998
4229
|
if (!routeNamesByDomain.has(route.domain)) {
|
|
3999
4230
|
routeNamesByDomain.set(route.domain, /* @__PURE__ */ new Set());
|
|
4000
4231
|
}
|
|
4001
4232
|
const routeNames = routeNamesByDomain.get(route.domain);
|
|
4002
4233
|
if (route.name && routeNames.has(route.name)) {
|
|
4003
|
-
throw new
|
|
4234
|
+
throw new RuntimeException5(
|
|
4004
4235
|
`Route with duplicate name found. A route with name "${route.name}" already exists`
|
|
4005
4236
|
);
|
|
4006
4237
|
}
|
|
@@ -4012,54 +4243,209 @@ var Router = class extends LookupStore {
|
|
|
4012
4243
|
});
|
|
4013
4244
|
routeNamesByDomain.clear();
|
|
4014
4245
|
this.usingDomains = this.#store.usingDomains;
|
|
4015
|
-
this
|
|
4246
|
+
this.#routesToBeCommitted = [];
|
|
4016
4247
|
this.#globalMatchers = {};
|
|
4017
4248
|
this.#middleware = [];
|
|
4249
|
+
this.#openedGroups = [];
|
|
4018
4250
|
this.#commited = true;
|
|
4019
4251
|
}
|
|
4252
|
+
/**
|
|
4253
|
+
* Generates types for the URL builder. These types must
|
|
4254
|
+
* be written inside a file for the URL builder to
|
|
4255
|
+
* pick them up.
|
|
4256
|
+
*/
|
|
4257
|
+
generateTypes(indentation = 0) {
|
|
4258
|
+
const routesList = {};
|
|
4259
|
+
function trackRoute(route, domain) {
|
|
4260
|
+
let params = [];
|
|
4261
|
+
let paramsTuple = [];
|
|
4262
|
+
let hasRequiredParams = false;
|
|
4263
|
+
for (let token of route.tokens) {
|
|
4264
|
+
if (token.type === 1) {
|
|
4265
|
+
hasRequiredParams = true;
|
|
4266
|
+
params.push(`'${token.val}': string`);
|
|
4267
|
+
paramsTuple.push("string");
|
|
4268
|
+
} else if (token.type === 3) {
|
|
4269
|
+
params.push(`'${token.val}'?: string`);
|
|
4270
|
+
paramsTuple.push("string?");
|
|
4271
|
+
} else if (token.type === 2) {
|
|
4272
|
+
hasRequiredParams = true;
|
|
4273
|
+
params.push(`'*': string[]`);
|
|
4274
|
+
paramsTuple.push("...string[]");
|
|
4275
|
+
break;
|
|
4276
|
+
}
|
|
4277
|
+
}
|
|
4278
|
+
route.methods.forEach((method) => {
|
|
4279
|
+
routesList["ALL"] = routesList["ALL"] ?? {};
|
|
4280
|
+
routesList[method] = routesList[method] ?? {};
|
|
4281
|
+
const identifiers = [];
|
|
4282
|
+
if (this.lookupStrategies.includes("pattern")) {
|
|
4283
|
+
if (!routesList[method][route.pattern]) {
|
|
4284
|
+
identifiers.push(route.pattern);
|
|
4285
|
+
}
|
|
4286
|
+
}
|
|
4287
|
+
if (this.lookupStrategies.includes("name") && route.name) {
|
|
4288
|
+
identifiers.push(
|
|
4289
|
+
domain && routesList[method][route.name] ? `${domain}@${route.name}` : route.name
|
|
4290
|
+
);
|
|
4291
|
+
}
|
|
4292
|
+
if (this.lookupStrategies.includes("controller") && "reference" in route.handler && typeof route.handler.reference === "string") {
|
|
4293
|
+
identifiers.push(
|
|
4294
|
+
domain && routesList[method][route.handler.reference] ? `${domain}@${route.handler.reference}` : route.handler.reference
|
|
4295
|
+
);
|
|
4296
|
+
}
|
|
4297
|
+
identifiers.forEach((identifier) => {
|
|
4298
|
+
routesList["ALL"][identifier] = {
|
|
4299
|
+
params,
|
|
4300
|
+
paramsTuple,
|
|
4301
|
+
hasRequiredParams
|
|
4302
|
+
};
|
|
4303
|
+
routesList[method][identifier] = {
|
|
4304
|
+
params,
|
|
4305
|
+
paramsTuple,
|
|
4306
|
+
hasRequiredParams
|
|
4307
|
+
};
|
|
4308
|
+
});
|
|
4309
|
+
});
|
|
4310
|
+
}
|
|
4311
|
+
const domains = Object.keys(this.routes).filter((domain) => domain !== "root");
|
|
4312
|
+
this.routes["root"].forEach((route) => trackRoute.bind(this)(route));
|
|
4313
|
+
domains.forEach(
|
|
4314
|
+
(domain) => this.routes[domain].forEach((route) => trackRoute.bind(this)(route, domain))
|
|
4315
|
+
);
|
|
4316
|
+
return Object.keys(routesList).reduce((result, method) => {
|
|
4317
|
+
result.push(`${" ".repeat(indentation)}'${method}': {`);
|
|
4318
|
+
Object.keys(routesList[method]).forEach((identifier) => {
|
|
4319
|
+
const key = `'${identifier}'`;
|
|
4320
|
+
const { paramsTuple, hasRequiredParams, params } = routesList[method][identifier];
|
|
4321
|
+
const dictName = hasRequiredParams ? "params" : "params?";
|
|
4322
|
+
const tupleName = hasRequiredParams ? "paramsTuple" : "paramsTuple?";
|
|
4323
|
+
const dictValue = `{${params.join(",")}}`;
|
|
4324
|
+
const tupleValue = `[${paramsTuple?.join(",")}]`;
|
|
4325
|
+
const value = `{ ${tupleName}: ${tupleValue}, ${dictName}: ${dictValue} }`;
|
|
4326
|
+
result.push(`${" ".repeat(indentation + 2)}${key}: ${value},`);
|
|
4327
|
+
});
|
|
4328
|
+
result.push(`${" ".repeat(indentation)}},`);
|
|
4329
|
+
return result;
|
|
4330
|
+
}, []).join("\n");
|
|
4331
|
+
}
|
|
4332
|
+
generateClient() {
|
|
4333
|
+
const routesForClient = Object.keys(this.routes).reduce(
|
|
4334
|
+
(result, domain) => {
|
|
4335
|
+
const routes = this.routes[domain];
|
|
4336
|
+
result[domain] = routes.map((route) => {
|
|
4337
|
+
const controller = "reference" in route.handler && typeof route.handler.reference === "string" ? route.handler.reference : void 0;
|
|
4338
|
+
return {
|
|
4339
|
+
pattern: route.pattern,
|
|
4340
|
+
name: route.name,
|
|
4341
|
+
handler: {
|
|
4342
|
+
reference: controller
|
|
4343
|
+
},
|
|
4344
|
+
methods: route.methods,
|
|
4345
|
+
domain: route.domain,
|
|
4346
|
+
tokens: route.tokens.map((tokens) => {
|
|
4347
|
+
return lodash2.pick(tokens, ["val", "type", "end"]);
|
|
4348
|
+
})
|
|
4349
|
+
};
|
|
4350
|
+
});
|
|
4351
|
+
return result;
|
|
4352
|
+
},
|
|
4353
|
+
{}
|
|
4354
|
+
);
|
|
4355
|
+
return `import type { RoutesList } from '@adonisjs/core/types/http'
|
|
4356
|
+
import { RouterClient, createUrlBuilder, ClientRouteJSON } from 'adonisjs/core/http/client'
|
|
4357
|
+
|
|
4358
|
+
const routes = ${JSON.stringify(routesForClient)} satisfies { [domain: string]: ClientRouteJSON[] }
|
|
4359
|
+
const router = new RouterClient(routes)
|
|
4360
|
+
export const urlFor = createUrlBuilder<RoutesList>(router, (qs) => {
|
|
4361
|
+
return new URLSearchParams(qs).toString()
|
|
4362
|
+
})`;
|
|
4363
|
+
}
|
|
4020
4364
|
/**
|
|
4021
4365
|
* Find route for a given URL, method and optionally domain
|
|
4022
4366
|
*/
|
|
4023
|
-
match(
|
|
4367
|
+
match(uri, method, shouldDecodeParam, hostname) {
|
|
4024
4368
|
const matchingDomain = this.#store.matchDomain(hostname);
|
|
4025
|
-
return matchingDomain.length ? this.#store.match(
|
|
4369
|
+
return matchingDomain.length ? this.#store.match(uri, method, shouldDecodeParam, {
|
|
4026
4370
|
tokens: matchingDomain,
|
|
4027
4371
|
hostname
|
|
4028
|
-
}) : this.#store.match(
|
|
4372
|
+
}) : this.#store.match(uri, method, shouldDecodeParam);
|
|
4373
|
+
}
|
|
4374
|
+
/**
|
|
4375
|
+
* Create URL builder instance.
|
|
4376
|
+
* @deprecated
|
|
4377
|
+
*
|
|
4378
|
+
* Instead use "@adonisjs/core/services/url_builder" instead
|
|
4379
|
+
*/
|
|
4380
|
+
builder() {
|
|
4381
|
+
return new UrlBuilder(this);
|
|
4382
|
+
}
|
|
4383
|
+
/**
|
|
4384
|
+
* Create URL builder instance for a given domain.
|
|
4385
|
+
* @deprecated
|
|
4386
|
+
*
|
|
4387
|
+
* Instead use "@adonisjs/core/services/url_builder"
|
|
4388
|
+
*/
|
|
4389
|
+
builderForDomain(domain) {
|
|
4390
|
+
return new UrlBuilder(this, domain);
|
|
4029
4391
|
}
|
|
4030
4392
|
/**
|
|
4031
4393
|
* Make URL to a pre-registered route
|
|
4394
|
+
*
|
|
4395
|
+
* @deprecated
|
|
4396
|
+
* Instead use "@adonisjs/core/services/url_builder"
|
|
4032
4397
|
*/
|
|
4033
4398
|
makeUrl(routeIdentifier, params, options) {
|
|
4034
4399
|
const normalizedOptions = Object.assign({}, options);
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4400
|
+
if (options?.disableRouteLookup) {
|
|
4401
|
+
return createURL(
|
|
4402
|
+
routeIdentifier,
|
|
4403
|
+
parseRoute(routeIdentifier),
|
|
4404
|
+
this.qs.stringify,
|
|
4405
|
+
params,
|
|
4406
|
+
options
|
|
4407
|
+
);
|
|
4408
|
+
}
|
|
4409
|
+
const route = this.findOrFail(routeIdentifier, normalizedOptions.domain);
|
|
4410
|
+
return createURL(route.name ?? route.pattern, route.tokens, this.qs.stringify, params, options);
|
|
4041
4411
|
}
|
|
4042
4412
|
/**
|
|
4043
4413
|
* Makes a signed URL to a pre-registered route.
|
|
4414
|
+
*
|
|
4415
|
+
* @deprecated
|
|
4416
|
+
* Instead use "@adonisjs/core/services/url_builder"
|
|
4044
4417
|
*/
|
|
4045
4418
|
makeSignedUrl(routeIdentifier, params, options) {
|
|
4046
4419
|
const normalizedOptions = Object.assign({}, options);
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4420
|
+
if (options?.disableRouteLookup) {
|
|
4421
|
+
return createSignedURL(
|
|
4422
|
+
routeIdentifier,
|
|
4423
|
+
parseRoute(routeIdentifier),
|
|
4424
|
+
this.qs.stringify,
|
|
4425
|
+
this.#encryption,
|
|
4426
|
+
params,
|
|
4427
|
+
options
|
|
4428
|
+
);
|
|
4429
|
+
}
|
|
4430
|
+
const route = this.findOrFail(routeIdentifier, normalizedOptions.domain);
|
|
4431
|
+
return createSignedURL(
|
|
4432
|
+
route.name ?? route.pattern,
|
|
4433
|
+
route.tokens,
|
|
4434
|
+
this.qs.stringify,
|
|
4435
|
+
this.#encryption,
|
|
4436
|
+
params,
|
|
4437
|
+
options
|
|
4438
|
+
);
|
|
4053
4439
|
}
|
|
4054
4440
|
};
|
|
4055
4441
|
|
|
4056
4442
|
// src/http_context/main.ts
|
|
4057
|
-
import { inspect } from "
|
|
4058
|
-
import
|
|
4059
|
-
import { RuntimeException as
|
|
4443
|
+
import { inspect } from "util";
|
|
4444
|
+
import Macroable8 from "@poppinss/macroable";
|
|
4445
|
+
import { RuntimeException as RuntimeException6 } from "@poppinss/utils/exception";
|
|
4060
4446
|
|
|
4061
4447
|
// src/http_context/local_storage.ts
|
|
4062
|
-
import { AsyncLocalStorage } from "
|
|
4448
|
+
import { AsyncLocalStorage } from "async_hooks";
|
|
4063
4449
|
var asyncLocalStorage = {
|
|
4064
4450
|
/**
|
|
4065
4451
|
* Check if the async local storage for the HTTP
|
|
@@ -4089,7 +4475,7 @@ var asyncLocalStorage = {
|
|
|
4089
4475
|
};
|
|
4090
4476
|
|
|
4091
4477
|
// src/http_context/main.ts
|
|
4092
|
-
var HttpContext = class extends
|
|
4478
|
+
var HttpContext = class extends Macroable8 {
|
|
4093
4479
|
constructor(request, response, logger, containerResolver) {
|
|
4094
4480
|
super();
|
|
4095
4481
|
this.request = request;
|
|
@@ -4122,13 +4508,13 @@ var HttpContext = class extends Macroable9 {
|
|
|
4122
4508
|
*/
|
|
4123
4509
|
static getOrFail() {
|
|
4124
4510
|
if (!this.usingAsyncLocalStorage || !asyncLocalStorage.storage) {
|
|
4125
|
-
throw new
|
|
4511
|
+
throw new RuntimeException6(
|
|
4126
4512
|
'HTTP context is not available. Enable "useAsyncLocalStorage" inside "config/app.ts" file'
|
|
4127
4513
|
);
|
|
4128
4514
|
}
|
|
4129
4515
|
const store = this.get();
|
|
4130
4516
|
if (!store) {
|
|
4131
|
-
throw new
|
|
4517
|
+
throw new RuntimeException6("Http context is not available outside of an HTTP request");
|
|
4132
4518
|
}
|
|
4133
4519
|
return store;
|
|
4134
4520
|
}
|
|
@@ -4174,27 +4560,27 @@ import Middleware2 from "@poppinss/middleware";
|
|
|
4174
4560
|
import { moduleCaller as moduleCaller2, moduleImporter as moduleImporter4 } from "@adonisjs/fold";
|
|
4175
4561
|
|
|
4176
4562
|
// src/qs.ts
|
|
4177
|
-
import { parse as
|
|
4563
|
+
import { parse as parse2, stringify } from "qs";
|
|
4178
4564
|
var Qs = class {
|
|
4179
4565
|
#config;
|
|
4180
4566
|
constructor(config) {
|
|
4181
4567
|
this.#config = config;
|
|
4182
4568
|
}
|
|
4183
|
-
parse(value) {
|
|
4184
|
-
return
|
|
4185
|
-
}
|
|
4186
|
-
stringify(value) {
|
|
4569
|
+
parse = (value) => {
|
|
4570
|
+
return parse2(value, this.#config.parse);
|
|
4571
|
+
};
|
|
4572
|
+
stringify = (value) => {
|
|
4187
4573
|
return stringify(value, this.#config.stringify);
|
|
4188
|
-
}
|
|
4574
|
+
};
|
|
4189
4575
|
};
|
|
4190
4576
|
|
|
4191
|
-
// src/server/factories/
|
|
4192
|
-
function
|
|
4577
|
+
// src/server/factories/route_finder.ts
|
|
4578
|
+
function routeFinder(router, resolver, ctx, errorResponder) {
|
|
4193
4579
|
return function() {
|
|
4194
4580
|
const url = ctx.request.url();
|
|
4195
4581
|
const method = ctx.request.method();
|
|
4196
4582
|
const hostname = router.usingDomains ? ctx.request.hostname() : void 0;
|
|
4197
|
-
const route = router.match(url, method, hostname);
|
|
4583
|
+
const route = router.match(url, method, ctx.request.parsedUrl.shouldDecodeParam, hostname);
|
|
4198
4584
|
if (route) {
|
|
4199
4585
|
ctx.params = route.params;
|
|
4200
4586
|
ctx.subdomains = route.subdomains;
|
|
@@ -4223,7 +4609,14 @@ function writeResponse(ctx) {
|
|
|
4223
4609
|
function middlewareHandler(resolver, ctx) {
|
|
4224
4610
|
return function(fn, next) {
|
|
4225
4611
|
debug_default("executing middleware %s", fn.name);
|
|
4226
|
-
return
|
|
4612
|
+
return httpMiddleware.tracePromise(
|
|
4613
|
+
fn.handle,
|
|
4614
|
+
fn,
|
|
4615
|
+
void 0,
|
|
4616
|
+
resolver,
|
|
4617
|
+
ctx,
|
|
4618
|
+
next
|
|
4619
|
+
);
|
|
4227
4620
|
};
|
|
4228
4621
|
}
|
|
4229
4622
|
|
|
@@ -4301,7 +4694,13 @@ var Server = class {
|
|
|
4301
4694
|
*/
|
|
4302
4695
|
#requestErrorResponder = (error, ctx) => {
|
|
4303
4696
|
this.#resolvedErrorHandler.report(error, ctx);
|
|
4304
|
-
return
|
|
4697
|
+
return httpExceptionHandler.tracePromise(
|
|
4698
|
+
this.#resolvedErrorHandler.handle,
|
|
4699
|
+
void 0,
|
|
4700
|
+
void 0,
|
|
4701
|
+
error,
|
|
4702
|
+
ctx
|
|
4703
|
+
);
|
|
4305
4704
|
};
|
|
4306
4705
|
/**
|
|
4307
4706
|
* Check if the server has already been booted
|
|
@@ -4350,7 +4749,7 @@ var Server = class {
|
|
|
4350
4749
|
* Handles the HTTP request
|
|
4351
4750
|
*/
|
|
4352
4751
|
#handleRequest(ctx, resolver) {
|
|
4353
|
-
return this.#serverMiddlewareStack.runner().errorHandler((error) => this.#requestErrorResponder(error, ctx)).finalHandler(
|
|
4752
|
+
return this.#serverMiddlewareStack.runner().errorHandler((error) => this.#requestErrorResponder(error, ctx)).finalHandler(routeFinder(this.#router, resolver, ctx, this.#requestErrorResponder)).run(middlewareHandler(resolver, ctx)).catch((error) => {
|
|
4354
4753
|
ctx.logger.fatal({ err: error }, "Exception raised by error handler");
|
|
4355
4754
|
return this.#defaultErrorHandler.handle(error, ctx);
|
|
4356
4755
|
}).finally(writeResponse(ctx));
|
|
@@ -4361,7 +4760,10 @@ var Server = class {
|
|
|
4361
4760
|
pipeline(middleware) {
|
|
4362
4761
|
const middlewareStack = new Middleware2();
|
|
4363
4762
|
middleware.forEach((one) => {
|
|
4364
|
-
middlewareStack.add(
|
|
4763
|
+
middlewareStack.add({
|
|
4764
|
+
reference: one,
|
|
4765
|
+
...moduleCaller2(one, "handle").toHandleMethod()
|
|
4766
|
+
});
|
|
4365
4767
|
});
|
|
4366
4768
|
middlewareStack.freeze();
|
|
4367
4769
|
const stackRunner = middlewareStack.runner();
|
|
@@ -4388,7 +4790,10 @@ var Server = class {
|
|
|
4388
4790
|
*/
|
|
4389
4791
|
use(middleware) {
|
|
4390
4792
|
middleware.forEach(
|
|
4391
|
-
(one) => this.#middleware.push(
|
|
4793
|
+
(one) => this.#middleware.push({
|
|
4794
|
+
reference: one,
|
|
4795
|
+
...moduleImporter4(one, "handle").toHandleMethod()
|
|
4796
|
+
})
|
|
4392
4797
|
);
|
|
4393
4798
|
return this;
|
|
4394
4799
|
}
|
|
@@ -4469,6 +4874,12 @@ var Server = class {
|
|
|
4469
4874
|
resolver
|
|
4470
4875
|
);
|
|
4471
4876
|
}
|
|
4877
|
+
/**
|
|
4878
|
+
* Returns a list of server middleware stack
|
|
4879
|
+
*/
|
|
4880
|
+
getMiddlewareList() {
|
|
4881
|
+
return this.#serverMiddlewareStack ? Array.from(this.#serverMiddlewareStack.all()) : [...this.#middleware];
|
|
4882
|
+
}
|
|
4472
4883
|
/**
|
|
4473
4884
|
* Handle request
|
|
4474
4885
|
*/
|
|
@@ -4490,15 +4901,18 @@ var Server = class {
|
|
|
4490
4901
|
});
|
|
4491
4902
|
}
|
|
4492
4903
|
if (this.usingAsyncLocalStorage) {
|
|
4493
|
-
return asyncLocalStorage.storage.run(
|
|
4904
|
+
return asyncLocalStorage.storage.run(
|
|
4905
|
+
ctx,
|
|
4906
|
+
() => httpRequest.tracePromise(this.#handleRequest, ctx, this, ctx, resolver)
|
|
4907
|
+
);
|
|
4494
4908
|
}
|
|
4495
|
-
return this.#handleRequest
|
|
4909
|
+
return httpRequest.tracePromise(this.#handleRequest, ctx, this, ctx, resolver);
|
|
4496
4910
|
}
|
|
4497
4911
|
};
|
|
4498
4912
|
|
|
4499
4913
|
// src/define_config.ts
|
|
4500
4914
|
import proxyAddr from "proxy-addr";
|
|
4501
|
-
import
|
|
4915
|
+
import string2 from "@poppinss/utils/string";
|
|
4502
4916
|
import lodash3 from "@poppinss/utils/lodash";
|
|
4503
4917
|
function defineConfig(config) {
|
|
4504
4918
|
const { trustProxy: trustProxy2, ...rest } = config;
|
|
@@ -4506,7 +4920,10 @@ function defineConfig(config) {
|
|
|
4506
4920
|
allowMethodSpoofing: false,
|
|
4507
4921
|
trustProxy: proxyAddr.compile("loopback"),
|
|
4508
4922
|
subdomainOffset: 2,
|
|
4509
|
-
generateRequestId:
|
|
4923
|
+
generateRequestId: !!config.createRequestId,
|
|
4924
|
+
createRequestId() {
|
|
4925
|
+
return crypto.randomUUID();
|
|
4926
|
+
},
|
|
4510
4927
|
useAsyncLocalStorage: false,
|
|
4511
4928
|
etag: false,
|
|
4512
4929
|
jsonpCallbackName: "callback",
|
|
@@ -4535,7 +4952,7 @@ function defineConfig(config) {
|
|
|
4535
4952
|
};
|
|
4536
4953
|
const normalizedConfig = lodash3.merge({}, defaults, rest);
|
|
4537
4954
|
if (normalizedConfig.cookie.maxAge) {
|
|
4538
|
-
normalizedConfig.cookie.maxAge =
|
|
4955
|
+
normalizedConfig.cookie.maxAge = string2.seconds.parse(normalizedConfig.cookie.maxAge);
|
|
4539
4956
|
}
|
|
4540
4957
|
if (typeof trustProxy2 === "boolean") {
|
|
4541
4958
|
const tpValue = trustProxy2;
|
|
@@ -4550,19 +4967,21 @@ function defineConfig(config) {
|
|
|
4550
4967
|
}
|
|
4551
4968
|
|
|
4552
4969
|
export {
|
|
4970
|
+
E_ROUTE_NOT_FOUND,
|
|
4971
|
+
E_CANNOT_LOOKUP_ROUTE,
|
|
4972
|
+
E_HTTP_EXCEPTION,
|
|
4973
|
+
E_HTTP_REQUEST_ABORTED,
|
|
4974
|
+
errors_exports,
|
|
4975
|
+
CookieClient,
|
|
4976
|
+
canWriteResponseBody,
|
|
4977
|
+
tracing_channels_exports,
|
|
4553
4978
|
Route,
|
|
4554
4979
|
BriskRoute,
|
|
4555
4980
|
RouteResource,
|
|
4556
4981
|
RouteGroup,
|
|
4557
4982
|
parseRange,
|
|
4558
|
-
CookieClient,
|
|
4559
4983
|
Request,
|
|
4560
4984
|
Redirect,
|
|
4561
|
-
E_ROUTE_NOT_FOUND,
|
|
4562
|
-
E_CANNOT_LOOKUP_ROUTE,
|
|
4563
|
-
E_HTTP_EXCEPTION,
|
|
4564
|
-
E_HTTP_REQUEST_ABORTED,
|
|
4565
|
-
exceptions_exports,
|
|
4566
4985
|
ResponseStatus,
|
|
4567
4986
|
Response,
|
|
4568
4987
|
Qs,
|
|
@@ -4571,4 +4990,3 @@ export {
|
|
|
4571
4990
|
Server,
|
|
4572
4991
|
defineConfig
|
|
4573
4992
|
};
|
|
4574
|
-
//# sourceMappingURL=chunk-7AGINHO3.js.map
|