jh-be-tools 1.0.51 → 1.0.53
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/api-request/apiRequest.d.ts +2 -2
- package/dist/config/eslint.config.d.mts +48 -96
- package/dist/config/eslint.config.mjs +48 -48
- package/dist/route-handler/routeCreation.d.ts +5 -2
- package/dist/route-handler/routeHandler.d.ts +3 -3
- package/dist/route-handler/routeHandler.js +2 -2
- package/package.json +8 -8
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { AxiosError, AxiosRequestConfig,
|
|
1
|
+
import { AxiosError, AxiosRequestConfig, AxiosResponse, AxiosHeaders } from 'axios';
|
|
2
2
|
import { RouteDef } from '../route-handler/routeCreation.js';
|
|
3
3
|
export interface QueryData {
|
|
4
4
|
params?: Record<string, string>;
|
|
5
5
|
query?: AxiosRequestConfig['params'];
|
|
6
|
-
headers?:
|
|
6
|
+
headers?: Record<string, string> | AxiosHeaders;
|
|
7
7
|
body?: unknown;
|
|
8
8
|
}
|
|
9
9
|
export interface Request {
|
|
@@ -1,118 +1,70 @@
|
|
|
1
|
-
declare const _default: (
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import: import("eslint").ESLint.Plugin;
|
|
5
|
-
prettier: import("eslint").ESLint.Plugin;
|
|
6
|
-
'unused-imports': import("eslint").ESLint.Plugin;
|
|
7
|
-
node: import("eslint").ESLint.Plugin;
|
|
8
|
-
};
|
|
9
|
-
languageOptions: {
|
|
10
|
-
globals: {
|
|
11
|
-
__dirname: false;
|
|
12
|
-
__filename: false;
|
|
13
|
-
AbortController: false;
|
|
14
|
-
AbortSignal: false;
|
|
15
|
-
atob: false;
|
|
16
|
-
Blob: false;
|
|
17
|
-
BroadcastChannel: false;
|
|
18
|
-
btoa: false;
|
|
19
|
-
Buffer: false;
|
|
20
|
-
ByteLengthQueuingStrategy: false;
|
|
21
|
-
clearImmediate: false;
|
|
22
|
-
clearInterval: false;
|
|
23
|
-
clearTimeout: false;
|
|
24
|
-
CompressionStream: false;
|
|
25
|
-
console: false;
|
|
26
|
-
CountQueuingStrategy: false;
|
|
27
|
-
crypto: false;
|
|
28
|
-
Crypto: false;
|
|
29
|
-
CryptoKey: false;
|
|
30
|
-
CustomEvent: false;
|
|
31
|
-
DecompressionStream: false;
|
|
32
|
-
DOMException: false;
|
|
33
|
-
Event: false;
|
|
34
|
-
EventTarget: false;
|
|
35
|
-
exports: true;
|
|
36
|
-
fetch: false;
|
|
37
|
-
File: false;
|
|
38
|
-
FormData: false;
|
|
39
|
-
global: false;
|
|
40
|
-
Headers: false;
|
|
41
|
-
Intl: false;
|
|
42
|
-
MessageChannel: false;
|
|
43
|
-
MessageEvent: false;
|
|
44
|
-
MessagePort: false;
|
|
45
|
-
module: false;
|
|
46
|
-
performance: false;
|
|
47
|
-
PerformanceEntry: false;
|
|
48
|
-
PerformanceMark: false;
|
|
49
|
-
PerformanceMeasure: false;
|
|
50
|
-
PerformanceObserver: false;
|
|
51
|
-
PerformanceObserverEntryList: false;
|
|
52
|
-
PerformanceResourceTiming: false;
|
|
53
|
-
process: false;
|
|
54
|
-
queueMicrotask: false;
|
|
55
|
-
ReadableByteStreamController: false;
|
|
56
|
-
ReadableStream: false;
|
|
57
|
-
ReadableStreamBYOBReader: false;
|
|
58
|
-
ReadableStreamBYOBRequest: false;
|
|
59
|
-
ReadableStreamDefaultController: false;
|
|
60
|
-
ReadableStreamDefaultReader: false;
|
|
61
|
-
Request: false;
|
|
62
|
-
require: false;
|
|
63
|
-
Response: false;
|
|
64
|
-
setImmediate: false;
|
|
65
|
-
setInterval: false;
|
|
66
|
-
setTimeout: false;
|
|
67
|
-
structuredClone: false;
|
|
68
|
-
SubtleCrypto: false;
|
|
69
|
-
TextDecoder: false;
|
|
70
|
-
TextDecoderStream: false;
|
|
71
|
-
TextEncoder: false;
|
|
72
|
-
TextEncoderStream: false;
|
|
73
|
-
TransformStream: false;
|
|
74
|
-
TransformStreamDefaultController: false;
|
|
75
|
-
URL: false;
|
|
76
|
-
URLSearchParams: false;
|
|
77
|
-
WebAssembly: false;
|
|
78
|
-
WritableStream: false;
|
|
79
|
-
WritableStreamDefaultController: false;
|
|
80
|
-
WritableStreamDefaultWriter: false;
|
|
81
|
-
};
|
|
82
|
-
parser: typeof tsParser;
|
|
83
|
-
ecmaVersion: string;
|
|
84
|
-
};
|
|
1
|
+
declare const _default: ({
|
|
2
|
+
readonly rules: Readonly<import("eslint").Linter.RulesRecord>;
|
|
3
|
+
} | import("eslint").Linter.FlatConfig<import("eslint").Linter.RulesRecord> | import("@typescript-eslint/utils/ts-eslint").FlatConfig.Config | {
|
|
85
4
|
settings: {
|
|
86
5
|
'import/parsers': {
|
|
87
6
|
'@typescript-eslint/parser': string[];
|
|
88
7
|
};
|
|
89
8
|
'import/resolver': {
|
|
90
9
|
typescript: {
|
|
91
|
-
|
|
10
|
+
project: string;
|
|
92
11
|
};
|
|
93
12
|
node: {
|
|
94
13
|
extensions: string[];
|
|
95
14
|
};
|
|
96
15
|
};
|
|
97
16
|
};
|
|
17
|
+
plugins: {
|
|
18
|
+
'unused-imports': import("eslint").ESLint.Plugin;
|
|
19
|
+
prettier: import("eslint").ESLint.Plugin;
|
|
20
|
+
};
|
|
21
|
+
languageOptions: {
|
|
22
|
+
parser: import("@typescript-eslint/utils/ts-eslint").Parser.LooseParserModule;
|
|
23
|
+
ecmaVersion: number;
|
|
24
|
+
sourceType: string;
|
|
25
|
+
parserOptions: {
|
|
26
|
+
project: string[];
|
|
27
|
+
sourceType: string;
|
|
28
|
+
ecmaFeatures: {
|
|
29
|
+
modules: boolean;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
};
|
|
98
33
|
rules: {
|
|
34
|
+
'@typescript-eslint/explicit-member-accessibility': number;
|
|
35
|
+
'@typescript-eslint/explicit-function-return-type': number;
|
|
36
|
+
'@typescript-eslint/consistent-type-definitions': string[];
|
|
37
|
+
'@typescript-eslint/no-unused-vars': (string | {
|
|
38
|
+
vars: string;
|
|
39
|
+
varsIgnorePattern: string;
|
|
40
|
+
args: string;
|
|
41
|
+
argsIgnorePattern: string;
|
|
42
|
+
ignoreRestSiblings: boolean;
|
|
43
|
+
})[];
|
|
44
|
+
'@typescript-eslint/no-floating-promises': (string | {
|
|
45
|
+
ignoreIIFE: boolean;
|
|
46
|
+
ignoreVoid: boolean;
|
|
47
|
+
})[];
|
|
48
|
+
'no-return-await': string;
|
|
49
|
+
'@typescript-eslint/return-await': string[];
|
|
50
|
+
'require-await': string;
|
|
51
|
+
'@typescript-eslint/require-await': string;
|
|
52
|
+
'prettier/prettier': (string | {
|
|
53
|
+
singleQuote: boolean;
|
|
54
|
+
})[];
|
|
99
55
|
'import/order': (string | {
|
|
100
56
|
'newlines-between': string;
|
|
101
57
|
alphabetize: {
|
|
102
58
|
order: string;
|
|
103
59
|
};
|
|
104
60
|
})[];
|
|
105
|
-
'import/
|
|
106
|
-
|
|
107
|
-
'
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
})[];
|
|
113
|
-
semi: string[];
|
|
114
|
-
indent: string[];
|
|
61
|
+
'import/order:/no-named-as-default-member': number;
|
|
62
|
+
'unused-imports/no-unused-imports': string;
|
|
63
|
+
'@typescript-eslint/no-non-null-assertion': string;
|
|
64
|
+
eqeqeq: number;
|
|
65
|
+
'no-console': number;
|
|
66
|
+
'no-unused-expressions': number;
|
|
67
|
+
curly: string;
|
|
115
68
|
};
|
|
116
69
|
})[];
|
|
117
70
|
export default _default;
|
|
118
|
-
import tsParser from '@typescript-eslint/parser';
|
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import typescriptEslint from '@typescript-eslint/eslint-plugin';
|
|
7
|
-
import tsParser from '@typescript-eslint/parser';
|
|
8
|
-
import _import from '@eslint/eslint-plugin-module';
|
|
9
|
-
import nodePlugin from 'eslint-plugin-n';
|
|
10
|
-
import prettier from 'eslint-plugin-prettier';
|
|
1
|
+
import eslint from '@eslint/js';
|
|
2
|
+
import tsEslint from 'typescript-eslint';
|
|
3
|
+
import importPlugin from 'eslint-plugin-import';
|
|
4
|
+
import prettierConfig from 'eslint-config-prettier';
|
|
5
|
+
import eslintPluginPrettier from 'eslint-plugin-prettier';
|
|
11
6
|
import unusedImports from 'eslint-plugin-unused-imports';
|
|
12
|
-
import globals from 'globals';
|
|
13
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
14
|
-
const __dirname = path.dirname(__filename);
|
|
15
|
-
const compat = new FlatCompat({
|
|
16
|
-
baseDirectory: __dirname,
|
|
17
|
-
recommendedConfig: js.configs.recommended,
|
|
18
|
-
allConfig: js.configs.all,
|
|
19
|
-
});
|
|
20
7
|
export default [
|
|
21
|
-
|
|
8
|
+
eslint.configs.recommended,
|
|
9
|
+
...tsEslint.configs.recommendedTypeChecked,
|
|
10
|
+
importPlugin.flatConfigs.recommended,
|
|
11
|
+
importPlugin.flatConfigs.typescript,
|
|
12
|
+
prettierConfig,
|
|
22
13
|
{
|
|
23
|
-
plugins: {
|
|
24
|
-
'@typescript-eslint': fixupPluginRules(typescriptEslint),
|
|
25
|
-
import: fixupPluginRules(_import),
|
|
26
|
-
prettier: fixupPluginRules(prettier),
|
|
27
|
-
'unused-imports': unusedImports,
|
|
28
|
-
node: fixupPluginRules(nodePlugin),
|
|
29
|
-
},
|
|
30
|
-
languageOptions: {
|
|
31
|
-
globals: {
|
|
32
|
-
...globals.node,
|
|
33
|
-
},
|
|
34
|
-
parser: tsParser,
|
|
35
|
-
ecmaVersion: 'latest',
|
|
36
|
-
},
|
|
37
14
|
settings: {
|
|
38
15
|
'import/parsers': {
|
|
39
16
|
'@typescript-eslint/parser': ['.ts', '.tsx'],
|
|
40
17
|
},
|
|
41
18
|
'import/resolver': {
|
|
42
19
|
typescript: {
|
|
43
|
-
|
|
20
|
+
project: './tsconfig.json',
|
|
44
21
|
},
|
|
45
22
|
node: {
|
|
46
|
-
extensions: ['.js', '.ts'],
|
|
23
|
+
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
plugins: {
|
|
28
|
+
'unused-imports': unusedImports,
|
|
29
|
+
prettier: eslintPluginPrettier,
|
|
30
|
+
},
|
|
31
|
+
languageOptions: {
|
|
32
|
+
parser: tsEslint.parser,
|
|
33
|
+
ecmaVersion: 6,
|
|
34
|
+
sourceType: 'module',
|
|
35
|
+
parserOptions: {
|
|
36
|
+
project: ['./tsconfig.json'],
|
|
37
|
+
sourceType: 'module',
|
|
38
|
+
ecmaFeatures: {
|
|
39
|
+
modules: true,
|
|
47
40
|
},
|
|
48
41
|
},
|
|
49
42
|
},
|
|
50
43
|
rules: {
|
|
51
|
-
'
|
|
44
|
+
'@typescript-eslint/explicit-member-accessibility': 0,
|
|
45
|
+
'@typescript-eslint/explicit-function-return-type': 0,
|
|
46
|
+
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
|
|
47
|
+
'@typescript-eslint/no-unused-vars': [
|
|
52
48
|
'error',
|
|
53
|
-
{
|
|
54
|
-
'newlines-between': 'always',
|
|
55
|
-
alphabetize: {
|
|
56
|
-
order: 'asc',
|
|
57
|
-
},
|
|
58
|
-
},
|
|
49
|
+
{ vars: 'all', varsIgnorePattern: '^_', args: 'after-used', argsIgnorePattern: '^_', ignoreRestSiblings: true },
|
|
59
50
|
],
|
|
60
|
-
'
|
|
61
|
-
|
|
62
|
-
'
|
|
63
|
-
|
|
64
|
-
|
|
51
|
+
'@typescript-eslint/no-floating-promises': ['error', { ignoreIIFE: true, ignoreVoid: false }],
|
|
52
|
+
'no-return-await': 'off',
|
|
53
|
+
'@typescript-eslint/return-await': ['error', 'always'],
|
|
54
|
+
'require-await': 'off',
|
|
55
|
+
'@typescript-eslint/require-await': 'error',
|
|
56
|
+
'prettier/prettier': ['error', { singleQuote: true }],
|
|
57
|
+
'import/order': ['error', { 'newlines-between': 'always', alphabetize: { order: 'asc' } }],
|
|
58
|
+
'import/order:/no-named-as-default-member': 0,
|
|
59
|
+
'unused-imports/no-unused-imports': 'error',
|
|
60
|
+
'@typescript-eslint/no-non-null-assertion': 'error',
|
|
61
|
+
eqeqeq: 2,
|
|
62
|
+
'no-console': 2,
|
|
63
|
+
'no-unused-expressions': 2,
|
|
64
|
+
curly: 'error',
|
|
65
65
|
},
|
|
66
66
|
},
|
|
67
67
|
{
|
|
68
|
-
ignores: ['eslint.config.mjs'],
|
|
68
|
+
ignores: ['node_modules', '**/build', '**/coverage', '**/dist/**', 'eslint.config.mjs'],
|
|
69
69
|
},
|
|
70
70
|
];
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { Router
|
|
1
|
+
import { Router } from 'express';
|
|
2
2
|
import { RouteSchema } from './routeHandler.js';
|
|
3
|
+
type Next = (err?: unknown) => void;
|
|
4
|
+
export type Middleware = (req: unknown, res: unknown, next: Next) => void | Promise<void>;
|
|
3
5
|
export type RouteMethods = 'get' | 'post' | 'put' | 'delete';
|
|
4
6
|
export type RouteDef = {
|
|
5
7
|
method: RouteMethods;
|
|
6
8
|
path: string;
|
|
7
9
|
routeSchema: RouteSchema;
|
|
8
|
-
middleware?:
|
|
10
|
+
middleware?: Middleware[];
|
|
9
11
|
};
|
|
10
12
|
export type RouteData = [RouteDef, (req?: any) => any];
|
|
11
13
|
export declare const createRoutes: (routeData: RouteData[], router: Router) => void;
|
|
14
|
+
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Request, Response } from 'express';
|
|
2
|
-
import {
|
|
2
|
+
import type { ZodType } from "zod";
|
|
3
3
|
export interface RouteSchema {
|
|
4
|
-
request?:
|
|
5
|
-
response?:
|
|
4
|
+
request?: ZodType;
|
|
5
|
+
response?: ZodType;
|
|
6
6
|
}
|
|
7
7
|
interface ReturnValue<T> {
|
|
8
8
|
data: T;
|
|
@@ -31,7 +31,7 @@ const parseRequest = async (schema, req, res) => {
|
|
|
31
31
|
}
|
|
32
32
|
catch (error) {
|
|
33
33
|
console.log(JSON.stringify(error));
|
|
34
|
-
res.status(400).json(error
|
|
34
|
+
res.status(400).json(error);
|
|
35
35
|
return false;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -44,7 +44,7 @@ const parseResponse = async (schema, res, data) => {
|
|
|
44
44
|
}
|
|
45
45
|
catch (error) {
|
|
46
46
|
console.log(JSON.stringify(error));
|
|
47
|
-
res.status(500).json(error
|
|
47
|
+
res.status(500).json(error);
|
|
48
48
|
return false;
|
|
49
49
|
}
|
|
50
50
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jh-be-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.53",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -13,16 +13,12 @@
|
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"@eslint/js": "^9.30.0",
|
|
15
15
|
"@types/express": "^5.0.1",
|
|
16
|
-
"@types/node": "^
|
|
16
|
+
"@types/node": "^24.0.10",
|
|
17
17
|
"eslint": "^9.30.0",
|
|
18
|
+
"eslint-import-resolver-typescript": "^4.4.4",
|
|
18
19
|
"typescript": "^5.8.3",
|
|
19
20
|
"typescript-eslint": "^8.35.0"
|
|
20
21
|
},
|
|
21
|
-
"dependencies": {
|
|
22
|
-
"axios": "^1.10.0",
|
|
23
|
-
"express": "^5.1.0",
|
|
24
|
-
"zod": "^3.25.67"
|
|
25
|
-
},
|
|
26
22
|
"peerDependencies": {
|
|
27
23
|
"@eslint/compat": "^1.2.4",
|
|
28
24
|
"@eslint/eslintrc": "^3.3.1",
|
|
@@ -34,7 +30,11 @@
|
|
|
34
30
|
"eslint-plugin-n": "^17.16.2",
|
|
35
31
|
"eslint-plugin-node": "^11.1.0",
|
|
36
32
|
"eslint-plugin-prettier": "^5.2.1",
|
|
37
|
-
"eslint-plugin-unused-imports": "^4.1.4"
|
|
33
|
+
"eslint-plugin-unused-imports": "^4.1.4",
|
|
34
|
+
"axios": "^1.10.0",
|
|
35
|
+
"eslint-plugin-import": "^2.32.0",
|
|
36
|
+
"express": "^5.1.0",
|
|
37
|
+
"zod": "^3.25.67"
|
|
38
38
|
},
|
|
39
39
|
"bin": {
|
|
40
40
|
"createPackageIndexFiles": "./dist/create-package-index-files/createPackageIndexFiles.js"
|