@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
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __export = (target, all) => {
|
|
3
|
+
for (var name in all)
|
|
4
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
// src/helpers.ts
|
|
8
|
+
import cookie from "cookie";
|
|
9
|
+
import matchit from "@poppinss/matchit";
|
|
10
|
+
import string from "@poppinss/utils/string";
|
|
11
|
+
import { parseBindingReference } from "@adonisjs/fold";
|
|
12
|
+
import { default as default2 } from "encodeurl";
|
|
13
|
+
import { default as default3 } from "mime-types";
|
|
14
|
+
function parseRoute(pattern, matchers) {
|
|
15
|
+
const tokens = matchit.parse(pattern, matchers);
|
|
16
|
+
return tokens;
|
|
17
|
+
}
|
|
18
|
+
function matchRoute(url, patterns) {
|
|
19
|
+
const tokensBucket = patterns.map((pattern) => parseRoute(pattern));
|
|
20
|
+
const match = matchit.match(url, tokensBucket);
|
|
21
|
+
if (!match.length) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
return matchit.exec(url, match);
|
|
25
|
+
}
|
|
26
|
+
function serializeCookie(key, value, options) {
|
|
27
|
+
let expires;
|
|
28
|
+
let maxAge;
|
|
29
|
+
if (options) {
|
|
30
|
+
expires = typeof options.expires === "function" ? options.expires() : options.expires;
|
|
31
|
+
maxAge = options.maxAge ? string.seconds.parse(options.maxAge) : void 0;
|
|
32
|
+
}
|
|
33
|
+
return cookie.serialize(key, value, { ...options, maxAge, expires });
|
|
34
|
+
}
|
|
35
|
+
async function middlewareInfo(middleware) {
|
|
36
|
+
if (typeof middleware === "function") {
|
|
37
|
+
return {
|
|
38
|
+
type: "closure",
|
|
39
|
+
name: middleware.name || "closure"
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
if ("args" in middleware) {
|
|
43
|
+
return {
|
|
44
|
+
type: "named",
|
|
45
|
+
name: middleware.name,
|
|
46
|
+
args: middleware.args,
|
|
47
|
+
...await parseBindingReference([middleware.reference])
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
type: "global",
|
|
52
|
+
name: middleware.name,
|
|
53
|
+
...await parseBindingReference([middleware.reference])
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
async function routeInfo(route) {
|
|
57
|
+
return "reference" in route.handler ? {
|
|
58
|
+
type: "controller",
|
|
59
|
+
...await parseBindingReference(route.handler.reference)
|
|
60
|
+
} : {
|
|
61
|
+
type: "closure",
|
|
62
|
+
name: route.handler.name || "closure",
|
|
63
|
+
args: "listArgs" in route.handler ? String(route.handler.listArgs) : void 0
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export {
|
|
68
|
+
__export,
|
|
69
|
+
parseRoute,
|
|
70
|
+
matchRoute,
|
|
71
|
+
serializeCookie,
|
|
72
|
+
middlewareInfo,
|
|
73
|
+
routeInfo,
|
|
74
|
+
default2 as default,
|
|
75
|
+
default3 as default2
|
|
76
|
+
};
|