raiton 6.1.1-beta.5 → 6.3.1-beta.11
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/CHANGELOG.md +30 -0
- package/build/bin/index.mjs +25 -1183
- package/docs/contributors/README.md +8 -1
- package/package.json +2 -2
- package/scripts/postinstall.ts +42 -0
- package/scripts/update-version.ts +532 -123
- package/source/core/injection/injection.ts +1 -1
- package/source/core/router/matcher.ts +16 -4
- package/source/framework/env.ts +4 -4
|
@@ -42,10 +42,22 @@ export class RouteMatcher {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
match(method: string, url: string): Route | null {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
let best: Route | null = null
|
|
46
|
+
let bestParamCount = Number.MAX_SAFE_INTEGER
|
|
47
|
+
|
|
48
|
+
for (const route of this._routes.values()) {
|
|
49
|
+
if (!route.match(method, url)) continue
|
|
50
|
+
|
|
51
|
+
const paramCount = route.params.length
|
|
52
|
+
if (paramCount < bestParamCount) {
|
|
53
|
+
bestParamCount = paramCount
|
|
54
|
+
best = route
|
|
55
|
+
|
|
56
|
+
if (paramCount === 0) break
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return best ? best.extractParams(url) : null
|
|
49
61
|
}
|
|
50
62
|
|
|
51
63
|
clear(): this {
|
package/source/framework/env.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {GenericValueType} from "../types/generic";
|
|
2
2
|
import {getType} from "./utilities";
|
|
3
3
|
|
|
4
|
-
export function env<T>(key: string, defaultValue?:
|
|
4
|
+
export function env<T>(key: string, defaultValue?: T, type?: GenericValueType): T | undefined {
|
|
5
5
|
const value = process.env[key] || defaultValue;
|
|
6
6
|
type = type || getType(value) as GenericValueType;
|
|
7
7
|
|
|
@@ -9,16 +9,16 @@ export function env<T>(key: string, defaultValue?: string, type?: GenericValueTy
|
|
|
9
9
|
switch (type) {
|
|
10
10
|
|
|
11
11
|
case "bigInt":
|
|
12
|
-
return BigInt(value) as any;
|
|
12
|
+
return BigInt(value.toString()) as any;
|
|
13
13
|
|
|
14
14
|
case 'float':
|
|
15
|
-
return parseFloat(value) as any;
|
|
15
|
+
return parseFloat(value.toString()) as any;
|
|
16
16
|
|
|
17
17
|
case 'boolean':
|
|
18
18
|
return Boolean(value) as any;
|
|
19
19
|
|
|
20
20
|
case "int":
|
|
21
|
-
return parseInt(value) as any;
|
|
21
|
+
return parseInt(value.toString()) as any;
|
|
22
22
|
|
|
23
23
|
default:
|
|
24
24
|
return value as any;
|