@lark-apaas/coding-template-nestjs-react-fullstack 0.1.47-alpha.20261005173706 → 0.1.47
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
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"name": "fullstack-nestjs-template",
|
|
9
9
|
"version": "2.3.0",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@lark-apaas/fullstack-nestjs-core": "^1.1.
|
|
11
|
+
"@lark-apaas/fullstack-nestjs-core": "^1.1.65",
|
|
12
12
|
"@nestjs/axios": "^4.0.1",
|
|
13
13
|
"@nestjs/cache-manager": "^3.1.3",
|
|
14
14
|
"@nestjs/common": "^10.4.20",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@hookform/resolvers": "^5.2.2",
|
|
35
|
-
"@lark-apaas/client-toolkit": "^1.2.
|
|
35
|
+
"@lark-apaas/client-toolkit": "^1.2.73",
|
|
36
36
|
"@lark-apaas/coding-preset-vite-react": "^1.0.25",
|
|
37
37
|
"@lark-apaas/fullstack-presets": "^1.1.25",
|
|
38
38
|
"@nestjs/cli": "^10.4.9",
|
|
@@ -1579,9 +1579,9 @@
|
|
|
1579
1579
|
}
|
|
1580
1580
|
},
|
|
1581
1581
|
"node_modules/@lark-apaas/client-toolkit": {
|
|
1582
|
-
"version": "1.2.
|
|
1583
|
-
"resolved": "https://registry.npmmirror.com/@lark-apaas/client-toolkit/-/client-toolkit-1.2.
|
|
1584
|
-
"integrity": "sha512
|
|
1582
|
+
"version": "1.2.73",
|
|
1583
|
+
"resolved": "https://registry.npmmirror.com/@lark-apaas/client-toolkit/-/client-toolkit-1.2.73.tgz",
|
|
1584
|
+
"integrity": "sha512-aZdeRniXBMt++eDQrLgiPHgN46hix/wCPhgdyG+d0y4/UYeNiri7Mo0cgZSXqi4BdolmPmwOfadtcCYBWTLYhQ==",
|
|
1585
1585
|
"dev": true,
|
|
1586
1586
|
"dependencies": {
|
|
1587
1587
|
"@ant-design/colors": "^7.2.1",
|
|
@@ -1697,16 +1697,16 @@
|
|
|
1697
1697
|
}
|
|
1698
1698
|
},
|
|
1699
1699
|
"node_modules/@lark-apaas/fullstack-nestjs-core": {
|
|
1700
|
-
"version": "1.1.
|
|
1701
|
-
"resolved": "https://registry.npmmirror.com/@lark-apaas/fullstack-nestjs-core/-/fullstack-nestjs-core-1.1.
|
|
1702
|
-
"integrity": "sha512-
|
|
1700
|
+
"version": "1.1.65",
|
|
1701
|
+
"resolved": "https://registry.npmmirror.com/@lark-apaas/fullstack-nestjs-core/-/fullstack-nestjs-core-1.1.65.tgz",
|
|
1702
|
+
"integrity": "sha512-BBlF3ZFy8mF+br8nmujF4vSmlvcG2XABCMtGGFZuWfnSDwCfMRhK79hNUy32dXJ6m7QPstJtysPAp+t6oKz06g==",
|
|
1703
1703
|
"license": "MIT",
|
|
1704
1704
|
"dependencies": {
|
|
1705
1705
|
"@lark-apaas/cache-service": "^0.1.2",
|
|
1706
1706
|
"@lark-apaas/file-service": "^0.1.2",
|
|
1707
1707
|
"@lark-apaas/http-client": "^0.1.7",
|
|
1708
|
-
"@lark-apaas/nestjs-authnpaas": "^1.0.
|
|
1709
|
-
"@lark-apaas/nestjs-authzpaas": "^0.1.
|
|
1708
|
+
"@lark-apaas/nestjs-authnpaas": "^1.0.9",
|
|
1709
|
+
"@lark-apaas/nestjs-authzpaas": "^0.1.16",
|
|
1710
1710
|
"@lark-apaas/nestjs-capability": "^0.1.14",
|
|
1711
1711
|
"@lark-apaas/nestjs-common": "^0.1.9",
|
|
1712
1712
|
"@lark-apaas/nestjs-datapaas": "^1.0.21",
|
|
@@ -1806,9 +1806,9 @@
|
|
|
1806
1806
|
}
|
|
1807
1807
|
},
|
|
1808
1808
|
"node_modules/@lark-apaas/nestjs-authnpaas": {
|
|
1809
|
-
"version": "1.0.
|
|
1810
|
-
"resolved": "https://registry.npmmirror.com/@lark-apaas/nestjs-authnpaas/-/nestjs-authnpaas-1.0.
|
|
1811
|
-
"integrity": "sha512-
|
|
1809
|
+
"version": "1.0.9",
|
|
1810
|
+
"resolved": "https://registry.npmmirror.com/@lark-apaas/nestjs-authnpaas/-/nestjs-authnpaas-1.0.9.tgz",
|
|
1811
|
+
"integrity": "sha512-IZmTASPj/fXHjDfUahSNQeFlyWmZxpbpOeJO4cJNH8IGL3ueBWaMJ3A/DcR5TyR7kAy1Z3z371dd/MUlv8KP6g==",
|
|
1812
1812
|
"license": "MIT",
|
|
1813
1813
|
"dependencies": {
|
|
1814
1814
|
"reflect-metadata": "^0.1.13"
|
|
@@ -1824,13 +1824,13 @@
|
|
|
1824
1824
|
}
|
|
1825
1825
|
},
|
|
1826
1826
|
"node_modules/@lark-apaas/nestjs-authzpaas": {
|
|
1827
|
-
"version": "0.1.
|
|
1828
|
-
"resolved": "https://registry.npmmirror.com/@lark-apaas/nestjs-authzpaas/-/nestjs-authzpaas-0.1.
|
|
1829
|
-
"integrity": "sha512-
|
|
1827
|
+
"version": "0.1.16",
|
|
1828
|
+
"resolved": "https://registry.npmmirror.com/@lark-apaas/nestjs-authzpaas/-/nestjs-authzpaas-0.1.16.tgz",
|
|
1829
|
+
"integrity": "sha512-w663qQ0ZZvooovH/bEJ/QqEWtu9uZJT2TaiAtjeqTUBtEqcxDuzZ2XiqK0zk3drdmrIWrbMXqjok8ubhnMrB5A==",
|
|
1830
1830
|
"license": "MIT",
|
|
1831
1831
|
"dependencies": {
|
|
1832
1832
|
"@casl/ability": "^6.7.3",
|
|
1833
|
-
"@lark-apaas/nestjs-authnpaas": "^1.0.
|
|
1833
|
+
"@lark-apaas/nestjs-authnpaas": "^1.0.9",
|
|
1834
1834
|
"@lark-apaas/nestjs-common": "^0.1.9",
|
|
1835
1835
|
"jsonwebtoken": "^9.0.3",
|
|
1836
1836
|
"reflect-metadata": "^0.1.13",
|
package/template/package.json
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"upgrade": "npx -y @lark-apaas/fullstack-cli sync --disable-gen-openapi"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@lark-apaas/fullstack-nestjs-core": "^1.1.
|
|
31
|
+
"@lark-apaas/fullstack-nestjs-core": "^1.1.65",
|
|
32
32
|
"@nestjs/axios": "^4.0.1",
|
|
33
33
|
"@nestjs/cache-manager": "^3.1.3",
|
|
34
34
|
"@nestjs/common": "^10.4.20",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@hookform/resolvers": "^5.2.2",
|
|
55
|
-
"@lark-apaas/client-toolkit": "^1.2.
|
|
55
|
+
"@lark-apaas/client-toolkit": "^1.2.73",
|
|
56
56
|
"@lark-apaas/coding-preset-vite-react": "^1.0.25",
|
|
57
57
|
"@lark-apaas/fullstack-presets": "^1.1.25",
|
|
58
58
|
"@nestjs/cli": "^10.4.9",
|
|
@@ -3,7 +3,6 @@ import type { Response } from 'express';
|
|
|
3
3
|
import { BusinessException } from '../interfaces/exception.interface';
|
|
4
4
|
import { HTTP_STATUS_TO_RESPONSE_CODE_MAP, ResponseCode } from '../constants/api_response_code';
|
|
5
5
|
import { ApiErrorResponse } from '../interfaces/api_response.interface';
|
|
6
|
-
import { hasPostgresSqlState } from '../utils/postgres-error';
|
|
7
6
|
|
|
8
7
|
// 全局异常过滤器,用于捕获所有未处理的异常
|
|
9
8
|
@Catch()
|
|
@@ -45,7 +44,11 @@ export class GlobalExceptionFilter implements ExceptionFilter {
|
|
|
45
44
|
timestamp: Date.now(),
|
|
46
45
|
},
|
|
47
46
|
};
|
|
48
|
-
} else if (
|
|
47
|
+
} else if (
|
|
48
|
+
typeof exception === 'object' &&
|
|
49
|
+
exception !== null &&
|
|
50
|
+
(exception as { code?: unknown }).code === '22P02'
|
|
51
|
+
) {
|
|
49
52
|
// Postgres invalid_text_representation:路径/查询参数与列类型不匹配(最常见是非法 UUID)
|
|
50
53
|
// 与「合法 UUID 但记录不存在」走同一条 not-found 语义,避免 500 噪声
|
|
51
54
|
httpStatus = HttpStatus.NOT_FOUND;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
const POSTGRES_SQLSTATE_PATTERN = /^[0-9A-Z]{5}$/u;
|
|
2
|
-
|
|
3
|
-
export const POSTGRES_ERROR_CAUSE_DEPTH_LIMIT = 8;
|
|
4
|
-
|
|
5
|
-
export function hasPostgresSqlState(
|
|
6
|
-
error: unknown,
|
|
7
|
-
expectedSqlState: string,
|
|
8
|
-
): boolean {
|
|
9
|
-
if (!POSTGRES_SQLSTATE_PATTERN.test(expectedSqlState)) {
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const seen = new Set<object>();
|
|
14
|
-
let current: unknown = error;
|
|
15
|
-
|
|
16
|
-
for (
|
|
17
|
-
let depth = 0;
|
|
18
|
-
depth < POSTGRES_ERROR_CAUSE_DEPTH_LIMIT &&
|
|
19
|
-
current !== null &&
|
|
20
|
-
typeof current === 'object';
|
|
21
|
-
depth += 1
|
|
22
|
-
) {
|
|
23
|
-
if (seen.has(current)) {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
seen.add(current);
|
|
27
|
-
|
|
28
|
-
const { code, cause } = current as { code?: unknown; cause?: unknown };
|
|
29
|
-
if (
|
|
30
|
-
typeof code === 'string' &&
|
|
31
|
-
POSTGRES_SQLSTATE_PATTERN.test(code) &&
|
|
32
|
-
code === expectedSqlState
|
|
33
|
-
) {
|
|
34
|
-
return true;
|
|
35
|
-
}
|
|
36
|
-
current = cause;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return false;
|
|
40
|
-
}
|