@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 +0 -0
- package/dist/hooks/factory.js +1 -1
- package/dist/http/index.d.ts +1 -1
- package/dist/http/index.js +2 -3
- package/jsconfig.json +27 -0
- package/package.json +2 -2
- package/src/hooks/factory.ts +1 -1
- package/src/http/index.ts +2 -4
- package/tsconfig.json +2 -1
package/bun.lockb
CHANGED
|
Binary file
|
package/dist/hooks/factory.js
CHANGED
package/dist/http/index.d.ts
CHANGED
|
@@ -9,6 +9,6 @@ export type THttpMethods = {
|
|
|
9
9
|
TRACE: "TRACE";
|
|
10
10
|
PATCH: "PATCH";
|
|
11
11
|
};
|
|
12
|
-
export declare const jsonErrorInfer: (data: any) =>
|
|
12
|
+
export declare const jsonErrorInfer: (data: any, headers?: Headers) => Response;
|
|
13
13
|
export * from "./clientError";
|
|
14
14
|
export * from "./serverError";
|
package/dist/http/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { HttpClientError } from "./clientError";
|
|
2
2
|
import { HttpServerError } from "./serverError";
|
|
3
|
-
export const jsonErrorInfer = (data) => {
|
|
4
|
-
|
|
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.
|
|
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": "
|
|
27
|
+
"@types/bun": "latest",
|
|
28
28
|
"@types/qs": "^6.9.15",
|
|
29
29
|
"typescript": "^5.5.4"
|
|
30
30
|
}
|
package/src/hooks/factory.ts
CHANGED
|
@@ -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
|
-
|
|
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. */,
|