@buka/nestjs-kit 4.4.7 → 4.4.9
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.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +13 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -7
- 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.9](https://github.com/buka-ltd/npm.nestjs-kit/compare/v4.4.8...v4.4.9) (2026-07-05)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* 修复collection生成的filter query的swagger错误 ([810c3ef](https://github.com/buka-ltd/npm.nestjs-kit/commit/810c3efef10204462be94b9075a07f9e8c983058))
|
|
9
|
+
|
|
10
|
+
## [4.4.8](https://github.com/buka-ltd/npm.nestjs-kit/compare/v4.4.7...v4.4.8) (2026-07-05)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* 修复cursor格式无法获取首页的问题 ([f13c11d](https://github.com/buka-ltd/npm.nestjs-kit/commit/f13c11d8088f432a408209ac7d7cf97259521c87))
|
|
16
|
+
|
|
3
17
|
## [4.4.7](https://github.com/buka-ltd/npm.nestjs-kit/compare/v4.4.6...v4.4.7) (2026-07-05)
|
|
4
18
|
|
|
5
19
|
|
package/dist/index.d.mts
CHANGED
|
@@ -958,12 +958,12 @@ type IOffsetPageParameters = {
|
|
|
958
958
|
offset: number;
|
|
959
959
|
};
|
|
960
960
|
type INextCursorPageParameters = {
|
|
961
|
-
first: number;
|
|
962
|
-
after
|
|
961
|
+
first: number; /** 首次加载无需传递 cursor */
|
|
962
|
+
after?: string;
|
|
963
963
|
};
|
|
964
964
|
type IPreviousCursorPageParameters = {
|
|
965
965
|
last: number;
|
|
966
|
-
before
|
|
966
|
+
before?: string;
|
|
967
967
|
};
|
|
968
968
|
type IPageQuery<T extends 'cursor' | 'offset' = 'cursor' | 'offset'> = {
|
|
969
969
|
page: T extends 'cursor' ? INextCursorPageParameters | IPreviousCursorPageParameters : T extends 'offset' ? IOffsetPageParameters : INextCursorPageParameters | IPreviousCursorPageParameters | IOffsetPageParameters;
|
package/dist/index.d.ts
CHANGED
|
@@ -958,12 +958,12 @@ type IOffsetPageParameters = {
|
|
|
958
958
|
offset: number;
|
|
959
959
|
};
|
|
960
960
|
type INextCursorPageParameters = {
|
|
961
|
-
first: number;
|
|
962
|
-
after
|
|
961
|
+
first: number; /** 首次加载无需传递 cursor */
|
|
962
|
+
after?: string;
|
|
963
963
|
};
|
|
964
964
|
type IPreviousCursorPageParameters = {
|
|
965
965
|
last: number;
|
|
966
|
-
before
|
|
966
|
+
before?: string;
|
|
967
967
|
};
|
|
968
968
|
type IPageQuery<T extends 'cursor' | 'offset' = 'cursor' | 'offset'> = {
|
|
969
969
|
page: T extends 'cursor' ? INextCursorPageParameters | IPreviousCursorPageParameters : T extends 'offset' ? IOffsetPageParameters : INextCursorPageParameters | IPreviousCursorPageParameters | IOffsetPageParameters;
|
package/dist/index.js
CHANGED
|
@@ -1308,7 +1308,7 @@ const NextCursorPageSchema = {
|
|
|
1308
1308
|
after: { type: "string" },
|
|
1309
1309
|
first: { type: "number" }
|
|
1310
1310
|
},
|
|
1311
|
-
required: ["
|
|
1311
|
+
required: ["first"],
|
|
1312
1312
|
additionalProperties: false
|
|
1313
1313
|
};
|
|
1314
1314
|
//#endregion
|
|
@@ -1319,7 +1319,7 @@ const PreviousCursorPageSchema = {
|
|
|
1319
1319
|
before: { type: "string" },
|
|
1320
1320
|
last: { type: "number" }
|
|
1321
1321
|
},
|
|
1322
|
-
required: ["
|
|
1322
|
+
required: ["last"],
|
|
1323
1323
|
additionalProperties: false
|
|
1324
1324
|
};
|
|
1325
1325
|
//#endregion
|
|
@@ -1363,9 +1363,9 @@ let BukaPageQueryValidationPipe = class BukaPageQueryValidationPipe {
|
|
|
1363
1363
|
if ("after" in value.page || "first" in value.page) {
|
|
1364
1364
|
if ("limit" in value.page || "offset" in value.page) throw new _nestjs_common.BadRequestException(mixedOffsetAndCursorError);
|
|
1365
1365
|
if ("before" in value.page || "last" in value.page) throw new _nestjs_common.BadRequestException(mixedNextAndLastCursorError);
|
|
1366
|
-
const after = value.page.after;
|
|
1366
|
+
const after = value.page.after ?? "";
|
|
1367
1367
|
const first = parseInt(value.page.first, 10);
|
|
1368
|
-
if (typeof after !== "string") throw new _nestjs_common.BadRequestException("Invalid page query: after must be a string.");
|
|
1368
|
+
if (value.page.after !== void 0 && typeof value.page.after !== "string") throw new _nestjs_common.BadRequestException("Invalid page query: after must be a string.");
|
|
1369
1369
|
if (isNaN(first) || first <= 0) throw new _nestjs_common.BadRequestException("Invalid page query: first must be a positive integer.");
|
|
1370
1370
|
return { page: {
|
|
1371
1371
|
after,
|
|
@@ -1375,9 +1375,9 @@ let BukaPageQueryValidationPipe = class BukaPageQueryValidationPipe {
|
|
|
1375
1375
|
if ("before" in value.page || "last" in value.page) {
|
|
1376
1376
|
if ("limit" in value.page || "offset" in value.page) throw new _nestjs_common.BadRequestException(mixedOffsetAndCursorError);
|
|
1377
1377
|
if ("after" in value.page || "first" in value.page) throw new _nestjs_common.BadRequestException(mixedNextAndLastCursorError);
|
|
1378
|
-
const before = value.page.before;
|
|
1378
|
+
const before = value.page.before ?? "";
|
|
1379
1379
|
const last = parseInt(value.page.last, 10);
|
|
1380
|
-
if (typeof before !== "string") throw new _nestjs_common.BadRequestException("Invalid page query: before must be a string.");
|
|
1380
|
+
if (value.page.before !== void 0 && typeof value.page.before !== "string") throw new _nestjs_common.BadRequestException("Invalid page query: before must be a string.");
|
|
1381
1381
|
if (isNaN(last) || last <= 0) throw new _nestjs_common.BadRequestException("Invalid page query: last must be a positive integer.");
|
|
1382
1382
|
return { page: {
|
|
1383
1383
|
before,
|
|
@@ -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 = {
|