lakutata 2.0.54 → 2.0.56
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/com/cacher.cjs +1 -1
- package/com/cacher.d.ts +1 -1
- package/com/cacher.mjs +1 -1
- package/com/docker.d.ts +1 -1
- package/com/entrypoint.cjs +29 -11
- package/com/entrypoint.d.ts +11 -182
- package/com/entrypoint.mjs +12 -0
- package/decorator/asst.d.ts +1 -1
- package/decorator/ctrl.cjs +15 -5
- package/decorator/ctrl.d.ts +112 -10
- package/decorator/ctrl.mjs +11 -1
- package/decorator/di.d.ts +2 -2
- package/decorator/dto.d.ts +3 -3
- package/decorator/orm.d.ts +1 -1
- package/helper.cjs +13 -11
- package/helper.d.ts +1 -1
- package/helper.mjs +3 -1
- package/lakutata.cjs +18 -6
- package/lakutata.d.ts +7 -8
- package/lakutata.mjs +12 -0
- package/orm.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/cacher/Cacher.cjs +1 -1
- package/src/components/cacher/Cacher.mjs +1 -1
- package/src/components/cacher/adapters/CreateFileCacheAdapter.cjs +1 -1
- package/src/components/cacher/adapters/CreateFileCacheAdapter.mjs +1 -1
- package/src/components/cacher/adapters/CreateMemcacheCacheAdapter.cjs +2 -2
- package/src/components/cacher/adapters/CreateMemcacheCacheAdapter.mjs +2 -2
- package/src/components/cacher/adapters/CreateMongoCacheAdapter.cjs +2 -2
- package/src/components/cacher/adapters/CreateMongoCacheAdapter.mjs +2 -2
- package/src/components/cacher/adapters/CreateMysqlCacheAdapter.cjs +2 -2
- package/src/components/cacher/adapters/CreateMysqlCacheAdapter.mjs +2 -2
- package/src/components/cacher/adapters/CreatePostgresCacheAdapter.cjs +2 -2
- package/src/components/cacher/adapters/CreatePostgresCacheAdapter.mjs +2 -2
- package/src/components/cacher/adapters/CreateRedisCacheAdapter.cjs +2 -2
- package/src/components/cacher/adapters/CreateRedisCacheAdapter.mjs +2 -2
- package/src/components/cacher/adapters/CreateSqliteCacheAdapter.cjs +2 -2
- package/src/components/cacher/adapters/CreateSqliteCacheAdapter.mjs +2 -2
- package/src/components/entrypoint/Entrypoint.cjs +1074 -973
- package/src/components/entrypoint/Entrypoint.mjs +884 -781
- package/src/components/entrypoint/exceptions/AccessDenyException.cjs +35 -0
- package/src/components/entrypoint/exceptions/AccessDenyException.mjs +29 -0
- package/src/components/entrypoint/exceptions/DuplicateActionNameException.cjs +34 -0
- package/src/components/entrypoint/exceptions/DuplicateActionNameException.mjs +28 -0
- package/src/components/entrypoint/lib/AccessControl.cjs +247 -0
- package/src/components/entrypoint/lib/AccessControl.mjs +241 -0
- package/src/components/entrypoint/lib/AccessControlRule.cjs +163 -0
- package/src/components/entrypoint/lib/AccessControlRule.mjs +157 -0
- package/src/decorators/ctrl/CLIAction.cjs +17 -10
- package/src/decorators/ctrl/CLIAction.mjs +17 -10
- package/src/decorators/ctrl/HTTPAction.cjs +18 -11
- package/src/decorators/ctrl/HTTPAction.mjs +16 -9
- package/src/decorators/ctrl/ServiceAction.cjs +15 -8
- package/src/decorators/ctrl/ServiceAction.mjs +16 -9
- package/src/decorators/ctrl/http/DELETE.cjs +13 -3
- package/src/decorators/ctrl/http/DELETE.mjs +13 -3
- package/src/decorators/ctrl/http/GET.cjs +13 -3
- package/src/decorators/ctrl/http/GET.mjs +13 -3
- package/src/decorators/ctrl/http/HEAD.cjs +13 -3
- package/src/decorators/ctrl/http/HEAD.mjs +13 -3
- package/src/decorators/ctrl/http/OPTIONS.cjs +13 -3
- package/src/decorators/ctrl/http/OPTIONS.mjs +13 -3
- package/src/decorators/ctrl/http/PATCH.cjs +13 -3
- package/src/decorators/ctrl/http/PATCH.mjs +13 -3
- package/src/decorators/ctrl/http/POST.cjs +13 -3
- package/src/decorators/ctrl/http/POST.mjs +13 -3
- package/src/decorators/ctrl/http/PUT.cjs +13 -3
- package/src/decorators/ctrl/http/PUT.mjs +13 -3
- package/src/lib/base/internal/ActionOptions.cjs +79 -0
- package/src/lib/base/internal/ActionOptions.mjs +73 -0
- package/src/lib/base/internal/ControllerEntrypoint.cjs +625 -53
- package/src/lib/base/internal/ControllerEntrypoint.mjs +640 -68
- package/src/lib/base/internal/GetActionDTOAndOptions.cjs +89 -0
- package/src/lib/base/internal/GetActionDTOAndOptions.mjs +83 -0
- package/src/lib/base/internal/StringifyPattern.cjs +69 -0
- package/src/lib/base/internal/StringifyPattern.mjs +63 -0
- package/src/lib/core/Application.cjs +29 -17
- package/src/lib/core/Application.mjs +33 -21
- package/src/lib/helpers/MD5.cjs +1 -1
- package/src/lib/helpers/MD5.mjs +1 -1
- package/src/lib/helpers/SHA1.cjs +1 -1
- package/src/lib/helpers/SHA1.mjs +1 -1
- package/src/lib/helpers/SHA256.cjs +1 -1
- package/src/lib/helpers/SHA256.mjs +1 -1
- package/src/lib/helpers/SortArray.cjs +18 -201
- package/src/lib/helpers/SortArray.mjs +17 -200
- package/vendor/Package.19.cjs +85 -90
- package/vendor/Package.19.mjs +1 -1
- package/vendor/Package.3.cjs +1 -1
- package/vendor/Package.3.mjs +1 -1
- package/vendor/Package.610.cjs +85 -103
- package/vendor/Package.610.mjs +80 -98
- package/vendor/Package.611.cjs +100 -121
- package/vendor/Package.611.mjs +97 -120
- package/vendor/Package.612.cjs +196 -0
- package/vendor/Package.612.mjs +180 -0
- package/vendor/Package.64.cjs +140 -4118
- package/vendor/Package.64.mjs +140 -4126
- package/vendor/Package.65.cjs +4142 -692
- package/vendor/Package.65.mjs +4151 -689
- package/vendor/Package.66.cjs +571 -535
- package/vendor/Package.66.mjs +586 -528
- package/vendor/Package.67.cjs +633 -96
- package/vendor/Package.67.mjs +619 -94
- package/vendor/Package.68.cjs +96 -294
- package/vendor/Package.68.mjs +95 -295
- package/vendor/Package.69.cjs +297 -113
- package/vendor/Package.69.mjs +285 -97
- package/vendor/TypeDef.10.d.ts +13 -2
- package/vendor/TypeDef.11.d.ts +6 -5
- package/vendor/TypeDef.12.d.ts +104 -4
- package/vendor/TypeDef.13.d.ts +315 -62
- package/vendor/TypeDef.3.d.ts +2 -2
- package/vendor/TypeDef.5.d.ts +1 -1
- package/vendor/TypeDef.7.d.ts +19 -10
- package/vendor/TypeDef.8.d.ts +2 -20
- package/vendor/TypeDef.9.d.ts +5 -2
- package/vendor/TypeDef.14.d.ts +0 -72
package/vendor/TypeDef.13.d.ts
CHANGED
|
@@ -1,107 +1,360 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { P as Provider, B as BaseObject, I as IBaseObjectConstructor, a as Container, M as Module, C as Component } from './TypeDef.3.js';
|
|
2
|
+
import { D as DTO, J as JSONSchema, F as FunctionSchema } from './TypeDef.5.js';
|
|
3
|
+
import { A as ActionPattern, I as IPatRun } from './TypeDef.10.js';
|
|
4
|
+
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
5
|
+
import { E as Exception } from './TypeDef.7.js';
|
|
2
6
|
|
|
3
7
|
/**
|
|
4
|
-
*
|
|
8
|
+
* Context types
|
|
5
9
|
*/
|
|
6
|
-
|
|
10
|
+
declare enum ContextType {
|
|
11
|
+
CLI = "CLI",
|
|
12
|
+
HTTP = "HTTP",
|
|
13
|
+
SERVICE = "SERVICE"
|
|
14
|
+
}
|
|
15
|
+
type ContextParams<T extends {} = {}> = T & Record<string, any>;
|
|
16
|
+
/**
|
|
17
|
+
* Base context class
|
|
18
|
+
*/
|
|
19
|
+
declare class BaseContext<T extends Record<string, any> = {}> extends DTO {
|
|
20
|
+
readonly type: ContextType;
|
|
21
|
+
data: ActionPattern<T>;
|
|
22
|
+
constructor(params: ContextParams);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
declare class CLIContext<T extends Record<string, any> = {}> extends BaseContext<T> {
|
|
26
|
+
readonly type: ContextType;
|
|
27
|
+
command: string;
|
|
28
|
+
constructor(params: ContextParams<{
|
|
29
|
+
readonly command: string;
|
|
30
|
+
readonly data: Record<string, any>;
|
|
31
|
+
}>);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
declare class HTTPContext<T extends Record<string, any> = {}> extends BaseContext<T> {
|
|
35
|
+
readonly type: ContextType;
|
|
36
|
+
readonly route: string;
|
|
37
|
+
readonly method: string;
|
|
38
|
+
readonly request: IncomingMessage;
|
|
39
|
+
readonly response: ServerResponse;
|
|
40
|
+
constructor(params: ContextParams<{
|
|
41
|
+
readonly route: string;
|
|
42
|
+
readonly method: string;
|
|
43
|
+
readonly request: IncomingMessage;
|
|
44
|
+
readonly response: ServerResponse;
|
|
45
|
+
readonly data: Record<string, any>;
|
|
46
|
+
}>);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
declare class ServiceContext<T extends Record<string, any> = {}> extends BaseContext<T> {
|
|
50
|
+
readonly type: ContextType;
|
|
51
|
+
input: ActionPattern<T>;
|
|
52
|
+
constructor(params: ContextParams<{
|
|
53
|
+
readonly data: ActionPattern;
|
|
54
|
+
}>);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* For action decorator
|
|
59
|
+
*/
|
|
60
|
+
type ControllerProperty<ClassPrototype extends Controller> = Exclude<keyof ClassPrototype, keyof Controller>;
|
|
61
|
+
/**
|
|
62
|
+
* Controller base class
|
|
63
|
+
*/
|
|
64
|
+
declare class Controller extends Provider {
|
|
7
65
|
/**
|
|
8
|
-
*
|
|
66
|
+
* Context, possible be cli context, http context or service context
|
|
67
|
+
* @protected
|
|
9
68
|
*/
|
|
10
|
-
|
|
69
|
+
protected readonly context: CLIContext | HTTPContext | ServiceContext;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
type AccessControlRuleHandler<T extends BaseContext<Record<string, any>>> = (context: T, input?: ActionPattern<any>) => Promise<boolean>;
|
|
73
|
+
declare abstract class AccessControlRule<T extends BaseContext<Record<string, any>> = BaseContext<Record<string, any>>> extends BaseObject {
|
|
74
|
+
protected readonly context: T;
|
|
75
|
+
protected readonly input: ActionPattern<any>;
|
|
76
|
+
protected readonly actions: HTTPActionInfo[] | ServiceActionInfo[] | CLIActionInfo[];
|
|
77
|
+
protected readonly targetAction: HTTPActionInfo | ServiceActionInfo | CLIActionInfo;
|
|
78
|
+
abstract get supportContextTypes(): ContextType[];
|
|
11
79
|
/**
|
|
12
|
-
*
|
|
13
|
-
* Works only in MySQL and PostgreSQL.
|
|
80
|
+
* Rule handler
|
|
14
81
|
*/
|
|
15
|
-
|
|
82
|
+
abstract rule(): Promise<boolean>;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
type ActionPatternMap = Map<ActionPattern, ActionDetails>;
|
|
86
|
+
type ActionDetails<ClassPrototype extends Controller = Controller, DTOConstructor extends typeof DTO = typeof DTO> = {
|
|
87
|
+
pattern: ActionPattern;
|
|
88
|
+
constructor: IBaseObjectConstructor<ClassPrototype>;
|
|
89
|
+
method: string | number | symbol;
|
|
90
|
+
dtoConstructor: DTOConstructor;
|
|
91
|
+
jsonSchema: JSONSchema;
|
|
92
|
+
getActionInfo: () => ActionInfo;
|
|
93
|
+
} & ActionInfo;
|
|
94
|
+
type ActionInfo = {
|
|
95
|
+
id: string;
|
|
96
|
+
acl: boolean;
|
|
97
|
+
action: string;
|
|
98
|
+
name: string;
|
|
99
|
+
description: string;
|
|
100
|
+
groups: string[];
|
|
101
|
+
rule?: AccessControlRuleHandler<any>;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
type PatternManagerOptions = {
|
|
105
|
+
globMatch?: boolean;
|
|
106
|
+
};
|
|
107
|
+
declare class PatternManager implements IPatRun {
|
|
108
|
+
#private;
|
|
109
|
+
constructor(options?: PatternManagerOptions);
|
|
16
110
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
111
|
+
* Register a pattern, and the object that will be returned if an input matches.
|
|
112
|
+
* Both keys and values are considered to be strings.
|
|
113
|
+
* Other types are converted to strings.
|
|
114
|
+
* @param pattern
|
|
115
|
+
* @param obj
|
|
19
116
|
*/
|
|
20
|
-
|
|
117
|
+
add(pattern: Record<string, any>, obj: any): this;
|
|
21
118
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* a normal index that includes NULL values.
|
|
25
|
-
*
|
|
26
|
-
* Works only in Spanner.
|
|
119
|
+
* Remove this pattern, and it's object, from the matcher.
|
|
120
|
+
* @param pattern
|
|
27
121
|
*/
|
|
28
|
-
|
|
122
|
+
remove(pattern: Record<string, any>): this;
|
|
29
123
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
124
|
+
* Return the unique match for this subject, or null if not found.
|
|
125
|
+
* The properties of the subject are matched against the patterns previously added, and the most specifc pattern wins.
|
|
126
|
+
* Unknown properties in the subject are ignored.
|
|
127
|
+
* You can optionally provide a second boolean parameter, exact. If true, then all properties of the subject must match.
|
|
128
|
+
*
|
|
129
|
+
* If the optional third boolean parameter collect is true, then find returns an array of all sub matches
|
|
130
|
+
* (i.e. run find on each element of the power set of the subject pattern elements, and collate in breadth first order).
|
|
131
|
+
* Thus, {a:1,b:2} will generate {a:1},{b:2},{a:1,b:2} searches.
|
|
132
|
+
* If exact is true, only increasing sub patterns in lexicographical order are chosen.
|
|
133
|
+
* Thus, {a:1,b:2} will generate {a:1},{a:1,b:2}, omitting {b:2}. (You probably want to set exact to false!).
|
|
134
|
+
* @param subject
|
|
135
|
+
* @param exact
|
|
32
136
|
*/
|
|
33
|
-
|
|
137
|
+
find(subject: Record<string, any>, exact?: boolean): any;
|
|
34
138
|
/**
|
|
35
|
-
*
|
|
139
|
+
* Return the list of registered patterns that contain this partial pattern.
|
|
140
|
+
* You can use wildcards for property values.
|
|
141
|
+
* Omitted values are not equivalent to a wildcard of "*", you must specify each property explicitly.
|
|
142
|
+
* @param partialPattern
|
|
36
143
|
*/
|
|
37
|
-
|
|
144
|
+
list(partialPattern?: Record<string, any> | undefined): {
|
|
145
|
+
match: Record<string, any>;
|
|
146
|
+
data: any;
|
|
147
|
+
}[];
|
|
38
148
|
/**
|
|
39
|
-
*
|
|
40
|
-
* These indexes use less space but behave differently in some situations (particularly sorts).
|
|
41
|
-
* This option is only supported for mongodb database.
|
|
149
|
+
* Generate a string representation of the decision tree for debugging.
|
|
42
150
|
*/
|
|
43
|
-
|
|
151
|
+
toJSON(): string;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
declare class AccessControl extends BaseObject {
|
|
155
|
+
protected readonly runtimeContainer: Container;
|
|
156
|
+
protected readonly actions: HTTPActionInfo[] | ServiceActionInfo[] | CLIActionInfo[];
|
|
157
|
+
protected readonly target: HTTPActionInfo | ServiceActionInfo | CLIActionInfo;
|
|
158
|
+
protected readonly context: CLIContext | HTTPContext | ServiceContext;
|
|
159
|
+
protected readonly input: Record<string, any>;
|
|
160
|
+
protected readonly allowCallback: () => void;
|
|
161
|
+
protected readonly denyCallback: (error?: Error | Exception) => void;
|
|
162
|
+
protected readonly rules: (IBaseObjectConstructor<AccessControlRule> | AccessControlRuleHandler<any>)[];
|
|
163
|
+
protected readonly accessControlRuleConstructorDTO: FunctionSchema<typeof AccessControlRule>;
|
|
44
164
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
165
|
+
* Initializer
|
|
166
|
+
* @protected
|
|
47
167
|
*/
|
|
48
|
-
|
|
168
|
+
protected init(): Promise<void>;
|
|
49
169
|
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
170
|
+
* Match rules
|
|
171
|
+
* @protected
|
|
52
172
|
*/
|
|
53
|
-
|
|
173
|
+
protected match(): Promise<boolean>;
|
|
54
174
|
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
175
|
+
* Run access control and return result
|
|
176
|
+
* @param rules
|
|
177
|
+
* @param runtimeContainer
|
|
178
|
+
* @param context
|
|
179
|
+
* @param input
|
|
180
|
+
* @param details
|
|
181
|
+
* @param getActionsCallback
|
|
57
182
|
*/
|
|
58
|
-
|
|
183
|
+
static run(rules: IBaseObjectConstructor<AccessControlRule>[], runtimeContainer: Container, context: CLIContext | HTTPContext | ServiceContext, input: Record<string, any>, details: ActionDetails, getActionsCallback: (type: ContextType) => BaseActionInfo[]): Promise<[boolean, Error | Exception]>;
|
|
59
184
|
}
|
|
60
185
|
|
|
186
|
+
type CLIEntrypoint = (module: Module, cliMap: CLIMap, handler: CLIEntrypointHandler, registerDestroy: EntrypointDestroyerRegistrar) => void;
|
|
187
|
+
type HTTPEntrypoint = (module: Module, routeMap: HTTPRouteMap, handler: HTTPEntrypointHandler, registerDestroy: EntrypointDestroyerRegistrar) => void;
|
|
188
|
+
type ServiceEntrypoint = (module: Module, handler: ServiceEntrypointHandler, registerDestroy: EntrypointDestroyerRegistrar) => void;
|
|
189
|
+
type CLIMap = Map<string, JSONSchema>;
|
|
190
|
+
type HTTPRouteMap<HTTPMethods = string> = Map<string, Set<HTTPMethods>>;
|
|
191
|
+
type CLIEntrypointHandler<T = unknown> = (context: CLIContext, abortController?: AbortController) => Promise<T>;
|
|
192
|
+
type HTTPEntrypointHandler<T = unknown> = (context: HTTPContext, abortController?: AbortController) => Promise<T>;
|
|
193
|
+
type ServiceEntrypointHandler<T = unknown> = (context: ServiceContext, abortController?: AbortController) => Promise<T>;
|
|
194
|
+
type EntrypointDestroyer = () => void | Promise<void>;
|
|
195
|
+
type EntrypointDestroyerRegistrar = (destroyer: EntrypointDestroyer) => void;
|
|
196
|
+
type EntrypointOptions = {
|
|
197
|
+
rules?: IBaseObjectConstructor<AccessControlRule>[];
|
|
198
|
+
controllers: IBaseObjectConstructor<Controller>[];
|
|
199
|
+
cli?: CLIEntrypoint | CLIEntrypoint[];
|
|
200
|
+
http?: HTTPEntrypoint | HTTPEntrypoint[];
|
|
201
|
+
service?: ServiceEntrypoint | ServiceEntrypoint[];
|
|
202
|
+
};
|
|
203
|
+
interface BaseActionInfo {
|
|
204
|
+
readonly id: string;
|
|
205
|
+
readonly acl: boolean;
|
|
206
|
+
readonly name: string;
|
|
207
|
+
readonly groups: string[];
|
|
208
|
+
readonly controller: string;
|
|
209
|
+
readonly method: string;
|
|
210
|
+
readonly jsonSchema: JSONSchema;
|
|
211
|
+
}
|
|
212
|
+
interface HTTPActionInfo extends BaseActionInfo {
|
|
213
|
+
readonly route: string;
|
|
214
|
+
}
|
|
215
|
+
interface ServiceActionInfo extends BaseActionInfo {
|
|
216
|
+
readonly pattern: ActionPattern;
|
|
217
|
+
}
|
|
218
|
+
interface CLIActionInfo extends BaseActionInfo {
|
|
219
|
+
readonly command: string;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Build cli entrypoint
|
|
223
|
+
* @param entrypoint
|
|
224
|
+
* @constructor
|
|
225
|
+
*/
|
|
226
|
+
declare const BuildCLIEntrypoint: (entrypoint: CLIEntrypoint) => CLIEntrypoint;
|
|
227
|
+
/**
|
|
228
|
+
* Build http entrypoint
|
|
229
|
+
* @param entrypoint
|
|
230
|
+
* @constructor
|
|
231
|
+
*/
|
|
232
|
+
declare const BuildHTTPEntrypoint: (entrypoint: HTTPEntrypoint) => HTTPEntrypoint;
|
|
233
|
+
/**
|
|
234
|
+
* Build service entrypoint
|
|
235
|
+
* @param entrypoint
|
|
236
|
+
* @constructor
|
|
237
|
+
*/
|
|
238
|
+
declare const BuildServiceEntrypoint: (entrypoint: ServiceEntrypoint) => ServiceEntrypoint;
|
|
239
|
+
/**
|
|
240
|
+
* Build entrypoints options for Entrypoint component
|
|
241
|
+
* @param options
|
|
242
|
+
* @constructor
|
|
243
|
+
*/
|
|
244
|
+
declare const BuildEntrypoints: (options: EntrypointOptions) => EntrypointOptions;
|
|
61
245
|
/**
|
|
62
|
-
*
|
|
246
|
+
* Entrypoint Component
|
|
63
247
|
*/
|
|
64
|
-
|
|
248
|
+
declare class Entrypoint extends Component {
|
|
249
|
+
protected readonly CLIActionPatternMap: ActionPatternMap;
|
|
250
|
+
protected readonly HTTPActionPatternMap: ActionPatternMap;
|
|
251
|
+
protected readonly ServiceActionPatternMap: ActionPatternMap;
|
|
252
|
+
protected readonly CLIActionPatternManager: PatternManager;
|
|
253
|
+
protected readonly HTTPActionPatternManager: PatternManager;
|
|
254
|
+
protected readonly ServiceActionPatternManager: PatternManager;
|
|
255
|
+
protected readonly entrypointDestroyers: EntrypointDestroyer[];
|
|
256
|
+
protected readonly httpActionInfoMap: Map<string, HTTPActionInfo>;
|
|
257
|
+
protected readonly serviceActionInfoMap: Map<string, ServiceActionInfo>;
|
|
258
|
+
protected readonly cliActionInfoMap: Map<string, CLIActionInfo>;
|
|
259
|
+
protected readonly accessControl: IBaseObjectConstructor<AccessControl>;
|
|
260
|
+
protected readonly controllers: IBaseObjectConstructor<Controller>[];
|
|
261
|
+
protected readonly rules: IBaseObjectConstructor<AccessControlRule>[];
|
|
262
|
+
protected readonly cli?: CLIEntrypoint | CLIEntrypoint[];
|
|
263
|
+
protected readonly http?: HTTPEntrypoint | HTTPEntrypoint[];
|
|
264
|
+
protected readonly service?: ServiceEntrypoint | ServiceEntrypoint[];
|
|
265
|
+
/**
|
|
266
|
+
* Initializer
|
|
267
|
+
* @protected
|
|
268
|
+
*/
|
|
269
|
+
protected init(): Promise<void>;
|
|
270
|
+
/**
|
|
271
|
+
* Http action info getter
|
|
272
|
+
* @constructor
|
|
273
|
+
*/
|
|
274
|
+
get HTTP_ACTIONS(): HTTPActionInfo[];
|
|
275
|
+
/**
|
|
276
|
+
* Service action info getter
|
|
277
|
+
* @constructor
|
|
278
|
+
*/
|
|
279
|
+
get SERVICE_ACTIONS(): ServiceActionInfo[];
|
|
280
|
+
/**
|
|
281
|
+
* Cli action info getter
|
|
282
|
+
* @constructor
|
|
283
|
+
*/
|
|
284
|
+
get CLI_ACTIONS(): CLIActionInfo[];
|
|
285
|
+
/**
|
|
286
|
+
* Destroyer
|
|
287
|
+
* @protected
|
|
288
|
+
*/
|
|
289
|
+
protected destroy(): Promise<void>;
|
|
290
|
+
/**
|
|
291
|
+
* Find duplicate action names
|
|
292
|
+
* @protected
|
|
293
|
+
* @param actionInfoMap
|
|
294
|
+
*/
|
|
295
|
+
protected findDuplicateActionNames(actionInfoMap: Map<string, BaseActionInfo>): string[];
|
|
65
296
|
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
297
|
+
* Run access control
|
|
298
|
+
* @param rules
|
|
299
|
+
* @param runtimeContainer
|
|
300
|
+
* @param context
|
|
301
|
+
* @param input
|
|
302
|
+
* @param details
|
|
303
|
+
* @protected
|
|
68
304
|
*/
|
|
69
|
-
|
|
305
|
+
protected runAccessControl(rules: IBaseObjectConstructor<AccessControlRule>[], runtimeContainer: Container, context: CLIContext | HTTPContext | ServiceContext, input: Record<string, any>, details: ActionDetails): Promise<void>;
|
|
70
306
|
/**
|
|
71
|
-
*
|
|
307
|
+
* Run controller's method and return its result (without AbortController)
|
|
308
|
+
* @param details
|
|
309
|
+
* @param context
|
|
310
|
+
* @param dtoConstructor
|
|
311
|
+
* @protected
|
|
72
312
|
*/
|
|
73
|
-
|
|
313
|
+
protected runControllerMethodWithoutAbortController<DTOConstructor extends typeof DTO = typeof DTO>(details: ActionDetails, context: CLIContext | HTTPContext | ServiceContext, dtoConstructor: DTOConstructor): Promise<unknown>;
|
|
74
314
|
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
315
|
+
* Run controller's method and return its result (with AbortController)
|
|
316
|
+
* @param details
|
|
317
|
+
* @param context
|
|
318
|
+
* @param dtoConstructor
|
|
319
|
+
* @param abortController
|
|
320
|
+
* @protected
|
|
79
321
|
*/
|
|
80
|
-
|
|
322
|
+
protected runControllerMethodWithAbortController<DTOConstructor extends typeof DTO = typeof DTO>(details: ActionDetails, context: CLIContext | HTTPContext | ServiceContext, dtoConstructor: DTOConstructor, abortController: AbortController): Promise<unknown>;
|
|
81
323
|
/**
|
|
82
|
-
*
|
|
324
|
+
* Run controller's method and return its result
|
|
325
|
+
* @param details
|
|
326
|
+
* @param context
|
|
327
|
+
* @param dtoConstructor
|
|
328
|
+
* @param abortController
|
|
329
|
+
* @protected
|
|
83
330
|
*/
|
|
84
|
-
|
|
331
|
+
protected runControllerMethod<DTOConstructor extends typeof DTO = typeof DTO>(details: ActionDetails, context: CLIContext | HTTPContext | ServiceContext, dtoConstructor: DTOConstructor, abortController?: AbortController): Promise<unknown>;
|
|
85
332
|
/**
|
|
86
|
-
*
|
|
333
|
+
* Register
|
|
334
|
+
* @param eps
|
|
335
|
+
* @param registerFunc
|
|
336
|
+
* @protected
|
|
87
337
|
*/
|
|
88
|
-
|
|
338
|
+
protected register<T>(eps: any | any[] | undefined, registerFunc: (entrypoint: T) => void): void;
|
|
89
339
|
/**
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
340
|
+
* Register CLI entrypoint
|
|
341
|
+
* @param entrypoint
|
|
342
|
+
* @protected
|
|
93
343
|
*/
|
|
94
|
-
|
|
344
|
+
protected registerCLIEntrypoint(entrypoint: CLIEntrypoint): void;
|
|
95
345
|
/**
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
* @
|
|
346
|
+
* Register http entrypoint
|
|
347
|
+
* @param entrypoint
|
|
348
|
+
* @protected
|
|
99
349
|
*/
|
|
100
|
-
|
|
350
|
+
protected registerHTTPEntrypoint(entrypoint: HTTPEntrypoint): void;
|
|
101
351
|
/**
|
|
102
|
-
*
|
|
352
|
+
* Register service entrypoint
|
|
353
|
+
* @param entrypoint
|
|
354
|
+
* @protected
|
|
103
355
|
*/
|
|
104
|
-
|
|
356
|
+
protected registerServiceEntrypoint(entrypoint: ServiceEntrypoint): void;
|
|
105
357
|
}
|
|
106
358
|
|
|
107
|
-
export
|
|
359
|
+
export { BuildCLIEntrypoint as k, BuildHTTPEntrypoint as l, BuildServiceEntrypoint as m, BuildEntrypoints as n, Entrypoint as o, ContextType as p, BaseContext as q, CLIContext as r, HTTPContext as s, ServiceContext as t, Controller as v, AccessControlRule as w };
|
|
360
|
+
export type { AccessControlRuleHandler as A, BaseActionInfo as B, CLIEntrypoint as C, EntrypointDestroyer as E, HTTPEntrypoint as H, ServiceEntrypoint as S, CLIMap as a, HTTPRouteMap as b, CLIEntrypointHandler as c, HTTPEntrypointHandler as d, ServiceEntrypointHandler as e, EntrypointDestroyerRegistrar as f, EntrypointOptions as g, HTTPActionInfo as h, ServiceActionInfo as i, CLIActionInfo as j, ControllerProperty as u };
|
package/vendor/TypeDef.3.d.ts
CHANGED
|
@@ -979,5 +979,5 @@ declare class Container {
|
|
|
979
979
|
destroy(): Promise<void>;
|
|
980
980
|
}
|
|
981
981
|
|
|
982
|
-
export { BaseObject as B, Component as C, Module as M, OverridableNamedObjectOptions as O, Provider as P,
|
|
983
|
-
export type { EventAndListener as E, IBaseObjectConstructor as I, LifetimeType as L, ConstructorOptions as
|
|
982
|
+
export { BaseObject as B, Component as C, Module as M, OverridableNamedObjectOptions as O, Provider as P, Container as a, ModuleOptions as b, ModuleConfigLoader as c, LoadObjectOptions as d, LoadAnonymousObjectOptions as h, LoadNamedObjectOptions as i, ModuleLoadObjectsOptions as j, OverridableObjectOptions as k };
|
|
983
|
+
export type { EventAndListener as E, IBaseObjectConstructor as I, LifetimeType as L, ConstructorOptions as e, event as f, ListenerFn as g };
|
package/vendor/TypeDef.5.d.ts
CHANGED
package/vendor/TypeDef.7.d.ts
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
/**
|
|
2
|
+
* 异常抽象类
|
|
3
|
+
*/
|
|
4
|
+
declare abstract class Exception extends Error {
|
|
5
|
+
abstract errno: number | string;
|
|
6
|
+
readonly appId: string;
|
|
7
|
+
readonly appName: string;
|
|
8
|
+
readonly errMsg: string;
|
|
9
|
+
readonly err: string;
|
|
10
|
+
constructor(template: string, data: unknown[] | Record<string, any>);
|
|
11
|
+
constructor(message: string);
|
|
12
|
+
constructor(error: Error);
|
|
13
|
+
constructor();
|
|
14
|
+
/**
|
|
15
|
+
* 获取错误名称
|
|
16
|
+
* @returns {string}
|
|
17
|
+
*/
|
|
18
|
+
get name(): string;
|
|
10
19
|
}
|
|
11
20
|
|
|
12
|
-
export
|
|
21
|
+
export { Exception as E };
|
package/vendor/TypeDef.8.d.ts
CHANGED
|
@@ -1,21 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
* 异常抽象类
|
|
3
|
-
*/
|
|
4
|
-
declare abstract class Exception extends Error {
|
|
5
|
-
abstract errno: number | string;
|
|
6
|
-
readonly appId: string;
|
|
7
|
-
readonly appName: string;
|
|
8
|
-
readonly errMsg: string;
|
|
9
|
-
readonly err: string;
|
|
10
|
-
constructor(template: string, data: unknown[] | Record<string, any>);
|
|
11
|
-
constructor(message: string);
|
|
12
|
-
constructor(error: Error);
|
|
13
|
-
constructor();
|
|
14
|
-
/**
|
|
15
|
-
* 获取错误名称
|
|
16
|
-
* @returns {string}
|
|
17
|
-
*/
|
|
18
|
-
get name(): string;
|
|
19
|
-
}
|
|
1
|
+
type MethodDecorator<ClassPrototype, Method, Property = string | symbol> = (target: ClassPrototype, propertyKey: Property, descriptor: TypedPropertyDescriptor<Method>) => TypedPropertyDescriptor<Method> | void;
|
|
20
2
|
|
|
21
|
-
export {
|
|
3
|
+
export type { MethodDecorator as M };
|
package/vendor/TypeDef.9.d.ts
CHANGED
package/vendor/TypeDef.14.d.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { P as Provider } from './TypeDef.3.js';
|
|
2
|
-
import { D as DTO } from './TypeDef.5.js';
|
|
3
|
-
import { A as ActionPattern } from './TypeDef.9.js';
|
|
4
|
-
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Context types
|
|
8
|
-
*/
|
|
9
|
-
declare enum ContextType {
|
|
10
|
-
CLI = "CLI",
|
|
11
|
-
HTTP = "HTTP",
|
|
12
|
-
SERVICE = "SERVICE"
|
|
13
|
-
}
|
|
14
|
-
type ContextParams<T extends {} = {}> = T & Record<string, any>;
|
|
15
|
-
/**
|
|
16
|
-
* Base context class
|
|
17
|
-
*/
|
|
18
|
-
declare class BaseContext<T extends Record<string, any> = {}> extends DTO {
|
|
19
|
-
readonly type: ContextType;
|
|
20
|
-
data: ActionPattern<T>;
|
|
21
|
-
constructor(params: ContextParams);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
declare class CLIContext<T extends Record<string, any> = {}> extends BaseContext<T> {
|
|
25
|
-
readonly type: ContextType;
|
|
26
|
-
command: string;
|
|
27
|
-
constructor(params: ContextParams<{
|
|
28
|
-
readonly command: string;
|
|
29
|
-
readonly data: Record<string, any>;
|
|
30
|
-
}>);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
declare class HTTPContext<T extends Record<string, any> = {}> extends BaseContext<T> {
|
|
34
|
-
readonly type: ContextType;
|
|
35
|
-
readonly route: string;
|
|
36
|
-
readonly method: string;
|
|
37
|
-
readonly request: IncomingMessage;
|
|
38
|
-
readonly response: ServerResponse;
|
|
39
|
-
constructor(params: ContextParams<{
|
|
40
|
-
readonly route: string;
|
|
41
|
-
readonly method: string;
|
|
42
|
-
readonly request: IncomingMessage;
|
|
43
|
-
readonly response: ServerResponse;
|
|
44
|
-
readonly data: Record<string, any>;
|
|
45
|
-
}>);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
declare class ServiceContext<T extends Record<string, any> = {}> extends BaseContext<T> {
|
|
49
|
-
readonly type: ContextType;
|
|
50
|
-
input: ActionPattern<T>;
|
|
51
|
-
constructor(params: ContextParams<{
|
|
52
|
-
readonly data: ActionPattern;
|
|
53
|
-
}>);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* For action decorator
|
|
58
|
-
*/
|
|
59
|
-
type ControllerProperty<ClassPrototype extends Controller> = Exclude<keyof ClassPrototype, keyof Controller>;
|
|
60
|
-
/**
|
|
61
|
-
* Controller base class
|
|
62
|
-
*/
|
|
63
|
-
declare class Controller extends Provider {
|
|
64
|
-
/**
|
|
65
|
-
* Context, possible be cli context, http context or service context
|
|
66
|
-
* @protected
|
|
67
|
-
*/
|
|
68
|
-
protected readonly context: CLIContext | HTTPContext | ServiceContext;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export { BaseContext as B, Controller as C, HTTPContext as H, ServiceContext as S, CLIContext as a, ContextType as b };
|
|
72
|
-
export type { ControllerProperty as c };
|