@bool-ts/core 2.3.1 → 2.3.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.
@@ -49,6 +49,7 @@ export type TApplicationOptions<AllowedMethods extends Array<THttpMethods> = Arr
49
49
  port: number;
50
50
  }> & Partial<{
51
51
  config: Record<string | symbol, any> | (() => Record<string | symbol, any>);
52
+ idleTimeoutInSeconds: number;
52
53
  prefix: string;
53
54
  debug: boolean;
54
55
  log: Partial<{
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "@bool-ts/date-time": "^1.0.0",
8
8
  "qs": "^6.14.1",
9
9
  "reflect-metadata": "^0.2.2",
10
- "zod": "^4.3.4"
10
+ "zod": "^4.3.6"
11
11
  },
12
12
  "description": "Core package for BoolTS framework",
13
13
  "devDependencies": {
@@ -44,5 +44,5 @@
44
44
  "test:socket": "bun --hot run __test/client/socket.ts"
45
45
  },
46
46
  "types": "./dist/index.d.ts",
47
- "version": "2.3.1"
47
+ "version": "2.3.2"
48
48
  }
@@ -119,10 +119,10 @@ export class Application<TRootClass extends Object = Object> {
119
119
  allowOrigins: !this.options.cors?.origins
120
120
  ? ["*"]
121
121
  : typeof this.options.cors.origins !== "string"
122
- ? this.options.cors.origins.includes("*") || this.options.cors.origins.length < 1
123
- ? ["*"]
124
- : this.options.cors.origins
125
- : [this.options.cors.origins !== "*" ? this.options.cors.origins : "*"],
122
+ ? this.options.cors.origins.includes("*") || this.options.cors.origins.length < 1
123
+ ? ["*"]
124
+ : this.options.cors.origins
125
+ : [this.options.cors.origins !== "*" ? this.options.cors.origins : "*"],
126
126
  allowMethods: this.options.cors?.methods || httpMethods,
127
127
  allowCredentials: !this.options.cors?.credentials ? false : true,
128
128
  allowHeaders:
@@ -231,6 +231,11 @@ export class Application<TRootClass extends Object = Object> {
231
231
  public async listen() {
232
232
  const server = serve<TWebSocketUpgradeData>({
233
233
  port: this.options.port,
234
+ idleTimeout:
235
+ typeof this.options.idleTimeoutInSeconds !== "number" ||
236
+ this.options.idleTimeoutInSeconds <= 0
237
+ ? undefined
238
+ : this.options.idleTimeoutInSeconds,
234
239
  fetch: this.#rootFetch.bind(this),
235
240
  websocket: await this.#rootWebSocket.bind(this)()
236
241
  });
@@ -291,8 +296,8 @@ export class Application<TRootClass extends Object = Object> {
291
296
  value: allowOrigins.includes("*")
292
297
  ? "*"
293
298
  : !allowOrigins.includes(origin)
294
- ? allowOrigins[0]
295
- : origin
299
+ ? allowOrigins[0]
300
+ : origin
296
301
  },
297
302
  { key: "Access-Control-Allow-Methods", value: allowMethods.join(", ") },
298
303
  { key: "Access-Control-Allow-Headers", value: allowHeaders.join(", ") }
@@ -399,7 +404,7 @@ export class Application<TRootClass extends Object = Object> {
399
404
  const convertedResponseStatus = ansiText(
400
405
  ` ${inferedResponseStatus} (${inferStatusText(inferedResponseStatus)}) `,
401
406
  (() => {
402
- if (inferedResponseStatus >= 100 && inferedResponseStatus < 200)
407
+ if (inferedResponseStatus >= 100 && inferedResponseStatus < 200)
403
408
  return {
404
409
  color: "white",
405
410
  backgroundColor: "cyan"
@@ -1002,12 +1007,12 @@ export class Application<TRootClass extends Object = Object> {
1002
1007
  ? typeof containerConfig !== "object"
1003
1008
  ? undefined
1004
1009
  : "key" in containerConfig &&
1005
- "value" in containerConfig &&
1006
- typeof containerConfig.key === "symbol"
1007
- ? typeof containerConfig.value !== "function"
1008
- ? containerConfig.value
1009
- : await containerConfig.value()
1010
- : containerConfig
1010
+ "value" in containerConfig &&
1011
+ typeof containerConfig.key === "symbol"
1012
+ ? typeof containerConfig.value !== "function"
1013
+ ? containerConfig.value
1014
+ : await containerConfig.value()
1015
+ : containerConfig
1011
1016
  : await containerConfig())
1012
1017
  }
1013
1018
  });
@@ -1304,12 +1309,12 @@ export class Application<TRootClass extends Object = Object> {
1304
1309
  ? typeof moduleConfig !== "object"
1305
1310
  ? undefined
1306
1311
  : "key" in moduleConfig &&
1307
- "value" in moduleConfig &&
1308
- typeof moduleConfig.key === "symbol"
1309
- ? typeof moduleConfig.value !== "function"
1310
- ? moduleConfig.value
1311
- : await moduleConfig.value()
1312
- : moduleConfig
1312
+ "value" in moduleConfig &&
1313
+ typeof moduleConfig.key === "symbol"
1314
+ ? typeof moduleConfig.value !== "function"
1315
+ ? moduleConfig.value
1316
+ : await moduleConfig.value()
1317
+ : moduleConfig
1313
1318
  : await moduleConfig())
1314
1319
  }
1315
1320
  });
@@ -2255,8 +2260,8 @@ export class Application<TRootClass extends Object = Object> {
2255
2260
  !data
2256
2261
  ? undefined
2257
2262
  : data instanceof ReadableStream
2258
- ? data
2259
- : JSON.stringify(data),
2263
+ ? data
2264
+ : JSON.stringify(data),
2260
2265
  {
2261
2266
  status: inferedStatus,
2262
2267
  statusText: inferedStatusText,
@@ -94,6 +94,7 @@ export type TApplicationOptions<AllowedMethods extends Array<THttpMethods> = Arr
94
94
  }> &
95
95
  Partial<{
96
96
  config: Record<string | symbol, any> | (() => Record<string | symbol, any>);
97
+ idleTimeoutInSeconds: number;
97
98
  prefix: string;
98
99
  debug: boolean;
99
100
  log: Partial<{