@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/dist/index.mjs CHANGED
@@ -1280,7 +1280,7 @@ const NextCursorPageSchema = {
1280
1280
  after: { type: "string" },
1281
1281
  first: { type: "number" }
1282
1282
  },
1283
- required: ["after", "first"],
1283
+ required: ["first"],
1284
1284
  additionalProperties: false
1285
1285
  };
1286
1286
  //#endregion
@@ -1291,7 +1291,7 @@ const PreviousCursorPageSchema = {
1291
1291
  before: { type: "string" },
1292
1292
  last: { type: "number" }
1293
1293
  },
1294
- required: ["before", "last"],
1294
+ required: ["last"],
1295
1295
  additionalProperties: false
1296
1296
  };
1297
1297
  //#endregion
@@ -1335,9 +1335,9 @@ let BukaPageQueryValidationPipe = class BukaPageQueryValidationPipe {
1335
1335
  if ("after" in value.page || "first" in value.page) {
1336
1336
  if ("limit" in value.page || "offset" in value.page) throw new BadRequestException(mixedOffsetAndCursorError);
1337
1337
  if ("before" in value.page || "last" in value.page) throw new BadRequestException(mixedNextAndLastCursorError);
1338
- const after = value.page.after;
1338
+ const after = value.page.after ?? "";
1339
1339
  const first = parseInt(value.page.first, 10);
1340
- if (typeof after !== "string") throw new BadRequestException("Invalid page query: after must be a string.");
1340
+ if (value.page.after !== void 0 && typeof value.page.after !== "string") throw new BadRequestException("Invalid page query: after must be a string.");
1341
1341
  if (isNaN(first) || first <= 0) throw new BadRequestException("Invalid page query: first must be a positive integer.");
1342
1342
  return { page: {
1343
1343
  after,
@@ -1347,9 +1347,9 @@ let BukaPageQueryValidationPipe = class BukaPageQueryValidationPipe {
1347
1347
  if ("before" in value.page || "last" in value.page) {
1348
1348
  if ("limit" in value.page || "offset" in value.page) throw new BadRequestException(mixedOffsetAndCursorError);
1349
1349
  if ("after" in value.page || "first" in value.page) throw new BadRequestException(mixedNextAndLastCursorError);
1350
- const before = value.page.before;
1350
+ const before = value.page.before ?? "";
1351
1351
  const last = parseInt(value.page.last, 10);
1352
- if (typeof before !== "string") throw new BadRequestException("Invalid page query: before must be a string.");
1352
+ if (value.page.before !== void 0 && typeof value.page.before !== "string") throw new BadRequestException("Invalid page query: before must be a string.");
1353
1353
  if (isNaN(last) || last <= 0) throw new BadRequestException("Invalid page query: last must be a positive integer.");
1354
1354
  return { page: {
1355
1355
  before,
@@ -1591,7 +1591,13 @@ function getObjectSchema(classRef) {
1591
1591
  if (isRelation) if (isCollection) {
1592
1592
  const sub = getObjectSchema(propertyMetadata.association.type());
1593
1593
  const operators = getCollectionOperators(classRef, propertyKey);
1594
- for (const operator of operators) properties[operator] = sub;
1594
+ const wrapper = {
1595
+ type: "object",
1596
+ properties: {},
1597
+ additionalProperties: false
1598
+ };
1599
+ for (const operator of operators) wrapper.properties[operator] = sub;
1600
+ properties[propertyKey] = wrapper;
1595
1601
  } else properties[propertyKey] = getObjectSchema(propertyMetadata.association.type());
1596
1602
  else {
1597
1603
  const propertySchema = {