@buka/nestjs-kit 4.1.3 → 4.1.5
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 +41 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +38 -12
- 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.1.5](https://github.com/buka-ltd/npm.nestjs-kit/compare/v4.1.4...v4.1.5) (2026-05-23)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* deep import error ([0b0645f](https://github.com/buka-ltd/npm.nestjs-kit/commit/0b0645f6018d6ed810aaa305380d6105379b5e59))
|
|
9
|
+
|
|
10
|
+
## [4.1.4](https://github.com/buka-ltd/npm.nestjs-kit/compare/v4.1.3...v4.1.4) (2026-05-21)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* 修复setTimeout溢出问题 ([ac82108](https://github.com/buka-ltd/npm.nestjs-kit/commit/ac82108f1d958cc436584bc86bd1db01f215830c))
|
|
16
|
+
|
|
3
17
|
## [4.1.3](https://github.com/buka-ltd/npm.nestjs-kit/compare/v4.1.2...v4.1.3) (2026-05-21)
|
|
4
18
|
|
|
5
19
|
|
package/dist/index.js
CHANGED
|
@@ -33,13 +33,6 @@ let ramda = require("ramda");
|
|
|
33
33
|
ramda = __toESM(ramda);
|
|
34
34
|
let class_transformer_cjs_storage_js = require("class-transformer/cjs/storage.js");
|
|
35
35
|
class_transformer_cjs_storage_js = __toESM(class_transformer_cjs_storage_js);
|
|
36
|
-
let _nestjs_swagger_dist_services_model_properties_accessor = require("@nestjs/swagger/dist/services/model-properties-accessor");
|
|
37
|
-
let _nestjs_swagger_dist_constants = require("@nestjs/swagger/dist/constants");
|
|
38
|
-
let _nestjs_swagger_dist_plugin_plugin_constants = require("@nestjs/swagger/dist/plugin/plugin-constants");
|
|
39
|
-
let _nestjs_swagger_dist_type_helpers_mapped_types_utils = require("@nestjs/swagger/dist/type-helpers/mapped-types.utils");
|
|
40
|
-
let _nestjs_common_utils_shared_utils = require("@nestjs/common/utils/shared.utils");
|
|
41
|
-
require("@nestjs/swagger/dist/utils/is-built-in-type.util");
|
|
42
|
-
require("@nestjs/swagger/dist/interfaces/schema-object-metadata.interface");
|
|
43
36
|
let uuid = require("uuid");
|
|
44
37
|
let _nestjs_mapped_types = require("@nestjs/mapped-types");
|
|
45
38
|
let _buka_class_transformer_extra = require("@buka/class-transformer-extra");
|
|
@@ -1434,25 +1427,57 @@ function getPropertyOperators(target, propertyKey) {
|
|
|
1434
1427
|
return operators.filter((op) => FilterQueryPropertyOperators.includes(op));
|
|
1435
1428
|
}
|
|
1436
1429
|
//#endregion
|
|
1430
|
+
//#region src/utils/internals/nestjs-common.ts
|
|
1431
|
+
function isFunction(value) {
|
|
1432
|
+
return typeof value === "function";
|
|
1433
|
+
}
|
|
1434
|
+
function isString(value) {
|
|
1435
|
+
return typeof value === "string";
|
|
1436
|
+
}
|
|
1437
|
+
//#endregion
|
|
1438
|
+
//#region src/utils/internals/nestjs-swagger.ts
|
|
1439
|
+
const METADATA_FACTORY_NAME = "_OPENAPI_METADATA_FACTORY";
|
|
1440
|
+
function getModelProperties(prototype) {
|
|
1441
|
+
return (Reflect.getMetadata(_nestjs_swagger.DECORATORS.API_MODEL_PROPERTIES_ARRAY, prototype) || []).filter(isString).filter((key) => key.charAt(0) === ":" && !isFunction(prototype[key])).map((key) => key.slice(1));
|
|
1442
|
+
}
|
|
1443
|
+
function clonePluginMetadataFactory(target, parent, transformFn = (x) => x) {
|
|
1444
|
+
let targetMetadata = {};
|
|
1445
|
+
do {
|
|
1446
|
+
if (!parent.constructor) return;
|
|
1447
|
+
if (!parent.constructor["_OPENAPI_METADATA_FACTORY"]) continue;
|
|
1448
|
+
targetMetadata = {
|
|
1449
|
+
...parent.constructor[METADATA_FACTORY_NAME](),
|
|
1450
|
+
...targetMetadata
|
|
1451
|
+
};
|
|
1452
|
+
} while ((parent = Reflect.getPrototypeOf(parent)) && parent !== Object.prototype && parent);
|
|
1453
|
+
targetMetadata = transformFn(targetMetadata);
|
|
1454
|
+
if (target["_OPENAPI_METADATA_FACTORY"]) {
|
|
1455
|
+
const originalFactory = target[METADATA_FACTORY_NAME];
|
|
1456
|
+
target[METADATA_FACTORY_NAME] = () => ({
|
|
1457
|
+
...originalFactory(),
|
|
1458
|
+
...targetMetadata
|
|
1459
|
+
});
|
|
1460
|
+
} else target[METADATA_FACTORY_NAME] = () => targetMetadata;
|
|
1461
|
+
}
|
|
1462
|
+
//#endregion
|
|
1437
1463
|
//#region src/utils/nestjs-swagger-utils.ts
|
|
1438
|
-
const modelPropertiesAccessor = new _nestjs_swagger_dist_services_model_properties_accessor.ModelPropertiesAccessor();
|
|
1439
1464
|
/**
|
|
1440
1465
|
* 克隆 @nestjs/swagger Plugin 添加的元数据
|
|
1441
1466
|
*/
|
|
1442
1467
|
function cloneMetadata(target, source, keys) {
|
|
1443
|
-
|
|
1468
|
+
clonePluginMetadataFactory(target, source.prototype, (metadata) => ramda.pick(keys, metadata));
|
|
1444
1469
|
for (const propertyKey of keys) {
|
|
1445
1470
|
const metadata = getMetadataOfDecorator(source, propertyKey);
|
|
1446
1471
|
if (metadata) (0, _nestjs_swagger.ApiProperty)(metadata)(target.prototype, propertyKey);
|
|
1447
1472
|
}
|
|
1448
1473
|
}
|
|
1449
1474
|
function getMetadataOfDecorator(classRef, propertyKey) {
|
|
1450
|
-
if (propertyKey) return Reflect.getMetadata(
|
|
1451
|
-
const props =
|
|
1452
|
-
return ramda.fromPairs(props.map((prop) => [prop, Reflect.getMetadata(
|
|
1475
|
+
if (propertyKey) return Reflect.getMetadata(_nestjs_swagger.DECORATORS.API_MODEL_PROPERTIES, classRef.prototype, propertyKey);
|
|
1476
|
+
const props = getModelProperties(classRef.prototype);
|
|
1477
|
+
return ramda.fromPairs(props.map((prop) => [prop, Reflect.getMetadata(_nestjs_swagger.DECORATORS.API_MODEL_PROPERTIES, classRef.prototype, prop)]));
|
|
1453
1478
|
}
|
|
1454
1479
|
function getMetadataOfPlugin(classRef, propertyKey) {
|
|
1455
|
-
const propsInPlugin = typeof classRef[
|
|
1480
|
+
const propsInPlugin = typeof classRef["_OPENAPI_METADATA_FACTORY"] === "function" ? classRef[METADATA_FACTORY_NAME]() : {};
|
|
1456
1481
|
if (propertyKey) return propsInPlugin[propertyKey];
|
|
1457
1482
|
return propsInPlugin;
|
|
1458
1483
|
}
|
|
@@ -1467,7 +1492,7 @@ function getMetadata$1(classRef, propertyKey) {
|
|
|
1467
1492
|
* 判断 type 是否是 lazy type function
|
|
1468
1493
|
*/
|
|
1469
1494
|
function isLazyTypeFunc(type) {
|
|
1470
|
-
return
|
|
1495
|
+
return isFunction(type) && type.name == "type";
|
|
1471
1496
|
}
|
|
1472
1497
|
//#endregion
|
|
1473
1498
|
//#region src/modules/core/converters/filter-query-type/utils/swagger-metadata-to-json-schema.ts
|
|
@@ -3558,7 +3583,8 @@ let OpenBaoTokenManager = _OpenBaoTokenManager = class OpenBaoTokenManager {
|
|
|
3558
3583
|
return;
|
|
3559
3584
|
}
|
|
3560
3585
|
const renewBuffer = this.config.renewBufferSeconds ?? 30;
|
|
3561
|
-
const
|
|
3586
|
+
const maxCheckInterval = Math.min(10080 * 60 * 1e3, this.leaseDuration * .7 * 1e3);
|
|
3587
|
+
const renewInMs = Math.min(Math.max((this.leaseDuration - renewBuffer) * 1e3, 1e3), maxCheckInterval);
|
|
3562
3588
|
this.renewalTimer = setTimeout(() => {
|
|
3563
3589
|
this.renewToken();
|
|
3564
3590
|
}, renewInMs);
|