@bool-ts/core 2.1.0 → 2.1.1
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 +33 -31
- 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.1"
|
|
47
|
+
}
|
|
@@ -511,14 +511,11 @@ export class Application<TRootClass extends Object = Object> {
|
|
|
511
511
|
.setOptions({ isStatic: false })
|
|
512
512
|
.set(responseStatusArgsKey, 404)
|
|
513
513
|
.set(responseStatusTextArgsKey, "Not found.")
|
|
514
|
-
.set(
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
data: undefined
|
|
520
|
-
})
|
|
521
|
-
);
|
|
514
|
+
.set(responseBodyArgsKey, {
|
|
515
|
+
httpCode: 404,
|
|
516
|
+
message: "Route not found",
|
|
517
|
+
data: undefined
|
|
518
|
+
});
|
|
522
519
|
} else {
|
|
523
520
|
const { context: newContext } = await this.httpFetcher({
|
|
524
521
|
context: context,
|
|
@@ -988,33 +985,38 @@ export class Application<TRootClass extends Object = Object> {
|
|
|
988
985
|
|
|
989
986
|
//#region [Configuration(s)]
|
|
990
987
|
const { config } = Object.freeze({
|
|
991
|
-
config:
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
typeof moduleConfig
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
988
|
+
config: !moduleConfig
|
|
989
|
+
? undefined
|
|
990
|
+
: {
|
|
991
|
+
...(typeof options.config !== "function"
|
|
992
|
+
? options.config
|
|
993
|
+
: await options.config()),
|
|
994
|
+
...(typeof moduleConfig !== "function"
|
|
995
|
+
? typeof moduleConfig !== "object"
|
|
996
|
+
? undefined
|
|
997
|
+
: "key" in moduleConfig &&
|
|
998
|
+
"value" in moduleConfig &&
|
|
999
|
+
typeof moduleConfig.key === "symbol"
|
|
1000
|
+
? typeof moduleConfig.value !== "function"
|
|
1001
|
+
? moduleConfig.value
|
|
1002
|
+
: await moduleConfig.value()
|
|
1003
|
+
: moduleConfig
|
|
1004
|
+
: await moduleConfig())
|
|
1005
|
+
}
|
|
1005
1006
|
});
|
|
1006
1007
|
//#endregion
|
|
1007
1008
|
|
|
1008
1009
|
//#region [Register config like an injection]
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1010
|
+
config &&
|
|
1011
|
+
injector.set(
|
|
1012
|
+
moduleConfig &&
|
|
1013
|
+
"key" in moduleConfig &&
|
|
1014
|
+
"value" in moduleConfig &&
|
|
1015
|
+
typeof moduleConfig.key === "symbol"
|
|
1016
|
+
? moduleConfig.key
|
|
1017
|
+
: configKey,
|
|
1018
|
+
config
|
|
1019
|
+
);
|
|
1018
1020
|
//#endregion
|
|
1019
1021
|
|
|
1020
1022
|
//#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
|
+
);
|