@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/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.12"
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.0"
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
- responseBodyArgsKey,
516
- JSON.stringify({
517
- httpCode: 404,
518
- message: "Route not found",
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
- ...(typeof options.config !== "function" ? options.config : await options.config()),
993
- ...(typeof moduleConfig !== "function"
994
- ? typeof moduleConfig !== "object"
995
- ? undefined
996
- : "key" in moduleConfig &&
997
- "value" in moduleConfig &&
998
- typeof moduleConfig.key === "symbol"
999
- ? typeof moduleConfig.value !== "function"
1000
- ? moduleConfig.value
1001
- : await moduleConfig.value()
1002
- : moduleConfig
1003
- : await moduleConfig())
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
- injector.set(
1010
- moduleConfig &&
1011
- "key" in moduleConfig &&
1012
- "value" in moduleConfig &&
1013
- typeof moduleConfig.key === "symbol"
1014
- ? moduleConfig.key
1015
- : configKey,
1016
- config
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
- export const argumentsKey = Symbol("__bool:arguments__");
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 webSocketServerArgsKey = Symbol("__bool:webSocketArguments:server__");
18
- export const webSocketConnectionArgsKey = Symbol("__bool:webSocketArguments:connection__");
19
- export const webSocketMessageArgsKey = Symbol("__bool:webSocketArguments:message__");
20
- export const webSocketCloseCodeArgsKey = Symbol("__bool:webSocketArguments:closeCode__");
21
- export const webSocketCloseReasonArgsKey = Symbol("__bool:webSocketArguments:closeReason__");
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 httpServerArgsKey = Symbol("__bool:httpArguments:server__");
24
- export const requestHeadersArgsKey = Symbol("__bool:httpArguments:requestHeaders__");
25
- export const requestHeaderArgsKey = Symbol("__bool:httpArguments:requestHeader__");
26
- export const requestBodyArgsKey = Symbol("__bool:httpArguments:requestBody__");
27
- export const paramsArgsKey = Symbol("__bool:httpArguments:params__");
28
- export const paramArgsKey = Symbol("__bool:httpArguments:param__");
29
- export const queryArgsKey = Symbol("__bool:httpArguments:query__");
30
- export const requestArgsKey = Symbol("__bool:httpArguments:request__");
31
- export const responseHeadersArgsKey = Symbol("__bool:httpArguments:responseHeaders__");
32
- export const contextArgsKey = Symbol("__bool:httpArguments:context__");
33
- export const routeModelArgsKey = Symbol("__bool:httpArguments:routeModel__");
34
- export const responseBodyArgsKey = Symbol("__bool:httpArguments:responseBody__");
35
- export const responseStatusArgsKey = Symbol("__bool:httpArguments:responseStatus__");
36
- export const responseStatusTextArgsKey = Symbol("__bool:httpArguments:responseStatusText__");
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
+ );