@bool-ts/core 1.5.6 → 1.5.7

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/bun.lockb CHANGED
Binary file
@@ -393,7 +393,7 @@ export const BoolFactory = (target, options) => {
393
393
  });
394
394
  }
395
395
  catch (error) {
396
- return jsonErrorInfer(error);
396
+ return jsonErrorInfer(error, resHeaders);
397
397
  }
398
398
  finally {
399
399
  if (allowLogsMethods) {
@@ -9,6 +9,6 @@ export type THttpMethods = {
9
9
  TRACE: "TRACE";
10
10
  PATCH: "PATCH";
11
11
  };
12
- export declare const jsonErrorInfer: (data: any) => import("undici-types").Response;
12
+ export declare const jsonErrorInfer: (data: any, headers?: Headers) => Response;
13
13
  export * from "./clientError";
14
14
  export * from "./serverError";
@@ -1,8 +1,7 @@
1
1
  import { HttpClientError } from "./clientError";
2
2
  import { HttpServerError } from "./serverError";
3
- export const jsonErrorInfer = (data) => {
4
- const headers = new Headers();
5
- headers.append("Content-Type", "application/json");
3
+ export const jsonErrorInfer = (data, headers = new Headers()) => {
4
+ headers.set("Content-Type", "application/json");
6
5
  if (data instanceof HttpClientError || data instanceof HttpServerError) {
7
6
  return new Response(JSON.stringify(data), {
8
7
  status: data.httpCode,
package/jsconfig.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "compilerOptions": {
3
+ // Enable latest features
4
+ "lib": ["ESNext", "DOM"],
5
+ "target": "ESNext",
6
+ "module": "ESNext",
7
+ "moduleDetection": "force",
8
+ "jsx": "react-jsx",
9
+ "allowJs": true,
10
+
11
+ // Bundler mode
12
+ "moduleResolution": "bundler",
13
+ "allowImportingTsExtensions": true,
14
+ "verbatimModuleSyntax": true,
15
+ "noEmit": true,
16
+
17
+ // Best practices
18
+ "strict": true,
19
+ "skipLibCheck": true,
20
+ "noFallthroughCasesInSwitch": true,
21
+
22
+ // Some stricter flags (disabled by default)
23
+ "noUnusedLocals": false,
24
+ "noUnusedParameters": false,
25
+ "noPropertyAccessFromIndexSignature": false
26
+ }
27
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bool-ts/core",
3
- "version": "1.5.6",
3
+ "version": "1.5.7",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -24,7 +24,7 @@
24
24
  "zod": "^3.23.8"
25
25
  },
26
26
  "devDependencies": {
27
- "@types/bun": "^1.1.6",
27
+ "@types/bun": "latest",
28
28
  "@types/qs": "^6.9.15",
29
29
  "typescript": "^5.5.4"
30
30
  }
@@ -592,7 +592,7 @@ export const BoolFactory = (target: new (...args: any[]) => unknown, options: TB
592
592
  }
593
593
  );
594
594
  } catch (error) {
595
- return jsonErrorInfer(error);
595
+ return jsonErrorInfer(error, resHeaders);
596
596
  } finally {
597
597
  if (allowLogsMethods) {
598
598
  const end = performance.now();
package/src/http/index.ts CHANGED
@@ -13,10 +13,8 @@ export type THttpMethods = {
13
13
  PATCH: "PATCH";
14
14
  };
15
15
 
16
- export const jsonErrorInfer = (data: any) => {
17
- const headers = new Headers();
18
-
19
- headers.append("Content-Type", "application/json");
16
+ export const jsonErrorInfer = (data: any, headers: Headers = new Headers()) => {
17
+ headers.set("Content-Type", "application/json");
20
18
 
21
19
  if (data instanceof HttpClientError || data instanceof HttpServerError) {
22
20
  return new Response(JSON.stringify(data), {
package/tsconfig.json CHANGED
@@ -11,7 +11,8 @@
11
11
  /* Language and Environment */
12
12
  "target": "ESNext" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
13
13
  "lib": [
14
- "ESNext"
14
+ "ESNext",
15
+ "DOM"
15
16
  ] /* Specify a set of bundled library declaration files that describe the target runtime environment. */,
16
17
  // "jsx": "preserve", /* Specify what JSX code is generated. */
17
18
  "experimentalDecorators": true /* Enable experimental support for legacy experimental decorators. */,