@midwayjs/core 3.3.5 → 3.4.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/baseFramework.d.ts +3 -0
- package/dist/baseFramework.js +32 -13
- package/dist/common/asyncContextManager.d.ts +61 -0
- package/dist/common/asyncContextManager.js +63 -0
- package/dist/common/dataSourceManager.d.ts +35 -0
- package/dist/common/dataSourceManager.js +127 -0
- package/dist/common/fileDetector.d.ts +1 -0
- package/dist/common/fileDetector.js +20 -0
- package/dist/common/filterManager.d.ts +1 -0
- package/dist/common/filterManager.js +37 -5
- package/dist/common/serviceFactory.js +2 -1
- package/dist/common/webGenerator.d.ts +4 -3
- package/dist/common/webGenerator.js +24 -15
- package/dist/config/config.default.d.ts +3 -0
- package/dist/config/config.default.js +3 -0
- package/dist/context/container.js +3 -0
- package/dist/error/framework.d.ts +8 -0
- package/dist/error/framework.js +15 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.js +11 -3
- package/dist/interface.d.ts +14 -4
- package/dist/interface.js +3 -1
- package/dist/service/configService.js +7 -4
- package/dist/service/frameworkService.js +7 -6
- package/dist/service/middlewareService.js +13 -5
- package/dist/service/slsFunctionService.d.ts +25 -0
- package/dist/service/slsFunctionService.js +242 -0
- package/dist/{common/webRouterCollector.d.ts → service/webRouterService.d.ts} +87 -36
- package/dist/{common/webRouterCollector.js → service/webRouterService.js} +121 -116
- package/dist/setup.js +3 -0
- package/dist/util/contextUtil.d.ts +2 -0
- package/dist/util/contextUtil.js +6 -1
- package/dist/util/index.d.ts +1 -0
- package/dist/util/index.js +23 -2
- package/dist/util/pathToRegexp.d.ts +113 -7
- package/dist/util/pathToRegexp.js +326 -205
- package/package.json +3 -3
- package/dist/common/triggerCollector.d.ts +0 -8
- package/dist/common/triggerCollector.js +0 -37
|
@@ -1,17 +1,123 @@
|
|
|
1
|
+
interface ParseOptions {
|
|
2
|
+
/**
|
|
3
|
+
* Set the default delimiter for repeat parameters. (default: `'/'`)
|
|
4
|
+
*/
|
|
5
|
+
delimiter?: string;
|
|
6
|
+
/**
|
|
7
|
+
* List of characters to automatically consider prefixes when parsing.
|
|
8
|
+
*/
|
|
9
|
+
prefixes?: string;
|
|
10
|
+
}
|
|
1
11
|
/**
|
|
2
|
-
*
|
|
12
|
+
* Parse a string for the raw tokens.
|
|
3
13
|
*/
|
|
14
|
+
declare function parse(str: string, options?: ParseOptions): Token[];
|
|
15
|
+
interface TokensToFunctionOptions {
|
|
16
|
+
/**
|
|
17
|
+
* When `true` the regexp will be case sensitive. (default: `false`)
|
|
18
|
+
*/
|
|
19
|
+
sensitive?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Function for encoding input strings for output.
|
|
22
|
+
*/
|
|
23
|
+
encode?: (value: string, token: Key) => string;
|
|
24
|
+
/**
|
|
25
|
+
* When `false` the function can produce an invalid (unmatched) path. (default: `true`)
|
|
26
|
+
*/
|
|
27
|
+
validate?: boolean;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Compile a string to a template function for the path.
|
|
31
|
+
*/
|
|
32
|
+
declare function compile<P extends object = object>(str: string, options?: ParseOptions & TokensToFunctionOptions): PathFunction<P>;
|
|
33
|
+
declare type PathFunction<P extends object = object> = (data?: P) => string;
|
|
34
|
+
interface RegexpToFunctionOptions {
|
|
35
|
+
/**
|
|
36
|
+
* Function for decoding strings for params.
|
|
37
|
+
*/
|
|
38
|
+
decode?: (value: string, token: Key) => string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A match result contains data about the path match.
|
|
42
|
+
*/
|
|
43
|
+
interface MatchResult<P extends object = object> {
|
|
44
|
+
path: string;
|
|
45
|
+
index: number;
|
|
46
|
+
params: P;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* A match is either `false` (no match) or a match result.
|
|
50
|
+
*/
|
|
51
|
+
declare type Match<P extends object = object> = false | MatchResult<P>;
|
|
52
|
+
/**
|
|
53
|
+
* The match function takes a string and returns whether it matched the path.
|
|
54
|
+
*/
|
|
55
|
+
declare type MatchFunction<P extends object = object> = (path: string) => Match<P>;
|
|
56
|
+
/**
|
|
57
|
+
* Create path match function from `path-to-regexp` spec.
|
|
58
|
+
*/
|
|
59
|
+
declare function match<P extends object = object>(str: Path, options?: ParseOptions & TokensToRegexpOptions & RegexpToFunctionOptions): MatchFunction<P>;
|
|
60
|
+
/**
|
|
61
|
+
* Metadata about a key.
|
|
62
|
+
*/
|
|
63
|
+
interface Key {
|
|
64
|
+
name: string | number;
|
|
65
|
+
prefix: string;
|
|
66
|
+
suffix: string;
|
|
67
|
+
pattern: string;
|
|
68
|
+
modifier: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* A token is a string (nothing special) or key metadata (capture group).
|
|
72
|
+
*/
|
|
73
|
+
declare type Token = string | Key;
|
|
74
|
+
interface TokensToRegexpOptions {
|
|
75
|
+
/**
|
|
76
|
+
* When `true` the regexp will be case sensitive. (default: `false`)
|
|
77
|
+
*/
|
|
78
|
+
sensitive?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* When `true` the regexp won't allow an optional trailing delimiter to match. (default: `false`)
|
|
81
|
+
*/
|
|
82
|
+
strict?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* When `true` the regexp will match to the end of the string. (default: `true`)
|
|
85
|
+
*/
|
|
86
|
+
end?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* When `true` the regexp will match from the beginning of the string. (default: `true`)
|
|
89
|
+
*/
|
|
90
|
+
start?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Sets the final character for non-ending optimistic matches. (default: `/`)
|
|
93
|
+
*/
|
|
94
|
+
delimiter?: string;
|
|
95
|
+
/**
|
|
96
|
+
* List of characters that can also be "end" characters.
|
|
97
|
+
*/
|
|
98
|
+
endsWith?: string;
|
|
99
|
+
/**
|
|
100
|
+
* Encode path tokens for use in the `RegExp`.
|
|
101
|
+
*/
|
|
102
|
+
encode?: (value: string) => string;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Supported `path-to-regexp` input types.
|
|
106
|
+
*/
|
|
107
|
+
declare type Path = string | RegExp | Array<string | RegExp>;
|
|
4
108
|
/**
|
|
5
109
|
* Normalize the given path string, returning a regular expression.
|
|
6
110
|
*
|
|
7
111
|
* An empty array can be passed in for the keys, which will hold the
|
|
8
112
|
* placeholder key descriptions. For example, using `/user/:id`, `keys` will
|
|
9
113
|
* contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.
|
|
10
|
-
*
|
|
11
|
-
* @param {(string|RegExp|Array)} path
|
|
12
|
-
* @param {(Array|Object)=} keys
|
|
13
|
-
* @param {Object=} options
|
|
14
|
-
* @return {!RegExp}
|
|
15
114
|
*/
|
|
16
|
-
|
|
115
|
+
declare function toRegexp(path: Path, keys?: Key[], options?: TokensToRegexpOptions & ParseOptions): RegExp;
|
|
116
|
+
export declare const PathToRegexpUtil: {
|
|
117
|
+
toRegexp: typeof toRegexp;
|
|
118
|
+
compile: typeof compile;
|
|
119
|
+
parse: typeof parse;
|
|
120
|
+
match: typeof match;
|
|
121
|
+
};
|
|
122
|
+
export {};
|
|
17
123
|
//# sourceMappingURL=pathToRegexp.d.ts.map
|