@buka/nestjs-kit 4.4.8 → 4.4.10
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/CHANGELOG.md +14 -0
- package/dist/index.js +18 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [4.4.10](https://github.com/buka-ltd/npm.nestjs-kit/compare/v4.4.9...v4.4.10) (2026-07-06)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* 修复Keq处理错误信息丢失错误信息的问题 ([8a5f353](https://github.com/buka-ltd/npm.nestjs-kit/commit/8a5f353ff97a8ac4aff18b1ee3e015b503abc9e7))
|
|
9
|
+
|
|
10
|
+
## [4.4.9](https://github.com/buka-ltd/npm.nestjs-kit/compare/v4.4.8...v4.4.9) (2026-07-05)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* 修复collection生成的filter query的swagger错误 ([810c3ef](https://github.com/buka-ltd/npm.nestjs-kit/commit/810c3efef10204462be94b9075a07f9e8c983058))
|
|
16
|
+
|
|
3
17
|
## [4.4.8](https://github.com/buka-ltd/npm.nestjs-kit/compare/v4.4.7...v4.4.8) (2026-07-05)
|
|
4
18
|
|
|
5
19
|
|
package/dist/index.js
CHANGED
|
@@ -1619,7 +1619,13 @@ function getObjectSchema(classRef) {
|
|
|
1619
1619
|
if (isRelation) if (isCollection) {
|
|
1620
1620
|
const sub = getObjectSchema(propertyMetadata.association.type());
|
|
1621
1621
|
const operators = getCollectionOperators(classRef, propertyKey);
|
|
1622
|
-
|
|
1622
|
+
const wrapper = {
|
|
1623
|
+
type: "object",
|
|
1624
|
+
properties: {},
|
|
1625
|
+
additionalProperties: false
|
|
1626
|
+
};
|
|
1627
|
+
for (const operator of operators) wrapper.properties[operator] = sub;
|
|
1628
|
+
properties[propertyKey] = wrapper;
|
|
1623
1629
|
} else properties[propertyKey] = getObjectSchema(propertyMetadata.association.type());
|
|
1624
1630
|
else {
|
|
1625
1631
|
const propertySchema = {
|
|
@@ -8431,8 +8437,14 @@ function throwOnResponseError(options) {
|
|
|
8431
8437
|
if (!ctx.response || ctx.response.status >= 200 && ctx.response.status < 400) return;
|
|
8432
8438
|
const response = ctx.response;
|
|
8433
8439
|
if (!response.headers.get("content-type")?.includes("application/json")) throw (0, _keq_request_exception.createExceptionByStatusCode)(response);
|
|
8434
|
-
|
|
8435
|
-
|
|
8440
|
+
let body;
|
|
8441
|
+
try {
|
|
8442
|
+
body = await response.json();
|
|
8443
|
+
} catch (err) {
|
|
8444
|
+
if (debug) logger.debug("响应体 JSON 解析失败,降级为状态码异常", err instanceof Error ? err.stack : err);
|
|
8445
|
+
throw (0, _keq_request_exception.createExceptionByStatusCode)(response);
|
|
8446
|
+
}
|
|
8447
|
+
if (body !== null && typeof body === "object" && "error" in body) {
|
|
8436
8448
|
const { error } = body;
|
|
8437
8449
|
const exceptionOptions = {
|
|
8438
8450
|
code: error.code,
|
|
@@ -8444,13 +8456,13 @@ function throwOnResponseError(options) {
|
|
|
8444
8456
|
404
|
|
8445
8457
|
].includes(response.status)
|
|
8446
8458
|
};
|
|
8447
|
-
if (errorDispatchers && error.code in errorDispatchers) {
|
|
8459
|
+
if (errorDispatchers && error.code in errorDispatchers) try {
|
|
8448
8460
|
const ExceptionClass = errorDispatchers[error.code];
|
|
8449
8461
|
throw new ExceptionClass(response.status, error.message, exceptionOptions);
|
|
8462
|
+
} catch (caught) {
|
|
8463
|
+
if (debug) logger.debug("自定义异常派发失败,降级为 BukaRequestException", caught instanceof Error ? caught.stack : caught);
|
|
8450
8464
|
}
|
|
8451
8465
|
throw new BukaRequestException(response.status, error.message, exceptionOptions);
|
|
8452
|
-
} catch (caught) {
|
|
8453
|
-
if (debug) logger.debug("解析响应错误体失败,降级为通用异常", caught instanceof Error ? caught.stack : caught);
|
|
8454
8466
|
}
|
|
8455
8467
|
throw (0, _keq_request_exception.createExceptionByStatusCode)(response);
|
|
8456
8468
|
};
|