@bool-ts/core 2.1.0 → 2.1.2
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/index.js +5 -5
- package/dist/index.js.map +4 -4
- package/package.json +3 -3
- package/src/entities/application.ts +30 -25
- package/src/keys/index.ts +40 -34
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"@bool-ts/date-time": "^1.0.0",
|
|
8
8
|
"qs": "^6.14.0",
|
|
9
9
|
"reflect-metadata": "^0.2.2",
|
|
10
|
-
"zod": "^4.1
|
|
10
|
+
"zod": "^4.2.1"
|
|
11
11
|
},
|
|
12
12
|
"description": "Core package for BoolTS framework",
|
|
13
13
|
"devDependencies": {
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"test": "bun --hot run __test/index.ts"
|
|
44
44
|
},
|
|
45
45
|
"types": "./dist/index.d.ts",
|
|
46
|
-
"version": "2.1.
|
|
47
|
-
}
|
|
46
|
+
"version": "2.1.2"
|
|
47
|
+
}
|
|
@@ -332,7 +332,7 @@ export class Application<TRootClass extends Object = Object> {
|
|
|
332
332
|
new Response(
|
|
333
333
|
JSON.stringify({
|
|
334
334
|
httpCode: 404,
|
|
335
|
-
message: "Route not found",
|
|
335
|
+
message: "Route not found.",
|
|
336
336
|
data: undefined
|
|
337
337
|
}),
|
|
338
338
|
{
|
|
@@ -515,7 +515,7 @@ export class Application<TRootClass extends Object = Object> {
|
|
|
515
515
|
responseBodyArgsKey,
|
|
516
516
|
JSON.stringify({
|
|
517
517
|
httpCode: 404,
|
|
518
|
-
message: "Route not found",
|
|
518
|
+
message: "Route not found.",
|
|
519
519
|
data: undefined
|
|
520
520
|
})
|
|
521
521
|
);
|
|
@@ -988,33 +988,38 @@ export class Application<TRootClass extends Object = Object> {
|
|
|
988
988
|
|
|
989
989
|
//#region [Configuration(s)]
|
|
990
990
|
const { config } = Object.freeze({
|
|
991
|
-
config:
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
typeof moduleConfig
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
991
|
+
config: !moduleConfig
|
|
992
|
+
? undefined
|
|
993
|
+
: {
|
|
994
|
+
...(typeof options.config !== "function"
|
|
995
|
+
? options.config
|
|
996
|
+
: await options.config()),
|
|
997
|
+
...(typeof moduleConfig !== "function"
|
|
998
|
+
? typeof moduleConfig !== "object"
|
|
999
|
+
? undefined
|
|
1000
|
+
: "key" in moduleConfig &&
|
|
1001
|
+
"value" in moduleConfig &&
|
|
1002
|
+
typeof moduleConfig.key === "symbol"
|
|
1003
|
+
? typeof moduleConfig.value !== "function"
|
|
1004
|
+
? moduleConfig.value
|
|
1005
|
+
: await moduleConfig.value()
|
|
1006
|
+
: moduleConfig
|
|
1007
|
+
: await moduleConfig())
|
|
1008
|
+
}
|
|
1005
1009
|
});
|
|
1006
1010
|
//#endregion
|
|
1007
1011
|
|
|
1008
1012
|
//#region [Register config like an injection]
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1013
|
+
config &&
|
|
1014
|
+
injector.set(
|
|
1015
|
+
moduleConfig &&
|
|
1016
|
+
"key" in moduleConfig &&
|
|
1017
|
+
"value" in moduleConfig &&
|
|
1018
|
+
typeof moduleConfig.key === "symbol"
|
|
1019
|
+
? moduleConfig.key
|
|
1020
|
+
: configKey,
|
|
1021
|
+
config
|
|
1022
|
+
);
|
|
1018
1023
|
//#endregion
|
|
1019
1024
|
|
|
1020
1025
|
//#region [Run loader(s)]
|
package/src/keys/index.ts
CHANGED
|
@@ -1,36 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
export const webSocketEventArgumentsKey = Symbol("__bool:webSocketEventArguments__");
|
|
3
|
-
export const configKey = Symbol("__bool:config__");
|
|
4
|
-
export const controllerKey = Symbol("__bool:controller__");
|
|
5
|
-
export const interceptorKey = Symbol("__bool:interceptor__");
|
|
6
|
-
export const guardKey = Symbol("__bool:guard__");
|
|
7
|
-
export const controllerHttpKey = Symbol("__bool:controller.http__");
|
|
8
|
-
export const injectKey = Symbol("__bool:inject__");
|
|
9
|
-
export const injectableKey = Symbol("__bool:injectable__");
|
|
10
|
-
export const middlewareKey = Symbol("__bool:middleware__");
|
|
11
|
-
export const moduleKey = Symbol("__bool:module__");
|
|
12
|
-
export const containerKey = Symbol("__bool:container__");
|
|
13
|
-
export const zodSchemaKey = Symbol("__bool:zodSchema__");
|
|
14
|
-
export const webSocketKey = Symbol("__bool:webSocket__");
|
|
15
|
-
export const webSocketEventKey = Symbol("__bool:webSocket:event__");
|
|
1
|
+
const prefix = "__boolTypescriptCore";
|
|
16
2
|
|
|
17
|
-
export const
|
|
18
|
-
export const
|
|
19
|
-
export const
|
|
20
|
-
export const
|
|
21
|
-
export const
|
|
3
|
+
export const argumentsKey = Symbol.for(`__${prefix}:arguments__`);
|
|
4
|
+
export const webSocketEventArgumentsKey = Symbol.for(`__${prefix}:webSocketEventArguments__`);
|
|
5
|
+
export const configKey = Symbol.for(`__${prefix}:config__`);
|
|
6
|
+
export const controllerKey = Symbol.for(`__${prefix}:controller__`);
|
|
7
|
+
export const interceptorKey = Symbol.for(`__${prefix}:interceptor__`);
|
|
8
|
+
export const guardKey = Symbol.for(`__${prefix}:guard__`);
|
|
9
|
+
export const controllerHttpKey = Symbol.for(`__${prefix}:controller.http__`);
|
|
10
|
+
export const injectKey = Symbol.for(`__${prefix}:inject__`);
|
|
11
|
+
export const injectableKey = Symbol.for(`__${prefix}:injectable__`);
|
|
12
|
+
export const middlewareKey = Symbol.for(`__${prefix}:middleware__`);
|
|
13
|
+
export const moduleKey = Symbol.for(`__${prefix}:module__`);
|
|
14
|
+
export const containerKey = Symbol.for(`__${prefix}:container__`);
|
|
15
|
+
export const zodSchemaKey = Symbol.for(`__${prefix}:zodSchema__`);
|
|
16
|
+
export const webSocketKey = Symbol.for(`__${prefix}:webSocket__`);
|
|
17
|
+
export const webSocketEventKey = Symbol.for(`__${prefix}:webSocket:event__`);
|
|
22
18
|
|
|
23
|
-
export const
|
|
24
|
-
export const
|
|
25
|
-
export const
|
|
26
|
-
export const
|
|
27
|
-
export const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
export const
|
|
32
|
-
export const
|
|
33
|
-
export const
|
|
34
|
-
export const
|
|
35
|
-
export const
|
|
36
|
-
export const
|
|
19
|
+
export const webSocketServerArgsKey = Symbol.for(`__${prefix}:webSocketArguments:server__`);
|
|
20
|
+
export const webSocketConnectionArgsKey = Symbol.for(`__${prefix}:webSocketArguments:connection__`);
|
|
21
|
+
export const webSocketMessageArgsKey = Symbol.for(`__${prefix}:webSocketArguments:message__`);
|
|
22
|
+
export const webSocketCloseCodeArgsKey = Symbol.for(`__${prefix}:webSocketArguments:closeCode__`);
|
|
23
|
+
export const webSocketCloseReasonArgsKey = Symbol.for(
|
|
24
|
+
`__${prefix}:webSocketArguments:closeReason__`
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
export const httpServerArgsKey = Symbol.for(`__${prefix}:httpArguments:server__`);
|
|
28
|
+
export const requestHeadersArgsKey = Symbol.for(`__${prefix}:httpArguments:requestHeaders__`);
|
|
29
|
+
export const requestHeaderArgsKey = Symbol.for(`__${prefix}:httpArguments:requestHeader__`);
|
|
30
|
+
export const requestBodyArgsKey = Symbol.for(`__${prefix}:httpArguments:requestBody__`);
|
|
31
|
+
export const paramsArgsKey = Symbol.for(`__${prefix}:httpArguments:params__`);
|
|
32
|
+
export const paramArgsKey = Symbol.for(`__${prefix}:httpArguments:param__`);
|
|
33
|
+
export const queryArgsKey = Symbol.for(`__${prefix}:httpArguments:query__`);
|
|
34
|
+
export const requestArgsKey = Symbol.for(`__${prefix}:httpArguments:request__`);
|
|
35
|
+
export const responseHeadersArgsKey = Symbol.for(`__${prefix}:httpArguments:responseHeaders__`);
|
|
36
|
+
export const contextArgsKey = Symbol.for(`__${prefix}:httpArguments:context__`);
|
|
37
|
+
export const routeModelArgsKey = Symbol.for(`__${prefix}:httpArguments:routeModel__`);
|
|
38
|
+
export const responseBodyArgsKey = Symbol.for(`__${prefix}:httpArguments:responseBody__`);
|
|
39
|
+
export const responseStatusArgsKey = Symbol.for(`__${prefix}:httpArguments:responseStatus__`);
|
|
40
|
+
export const responseStatusTextArgsKey = Symbol.for(
|
|
41
|
+
`__${prefix}:httpArguments:responseStatusText__`
|
|
42
|
+
);
|