@koalarx/nest 3.1.17 → 3.1.19

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.
@@ -169,7 +169,7 @@ class RepositoryBase {
169
169
  ...this.entityToPrisma(item),
170
170
  [parentPropName]: this.getConnectPrismaSchemaForRelation(entity),
171
171
  },
172
- select: this.getSelectRootPrismaSchema(item),
172
+ select: this.getSelectRootPrismaSchema(item.constructor),
173
173
  },
174
174
  relations: this.listRelationEntities(item, true),
175
175
  });
@@ -181,7 +181,7 @@ class RepositoryBase {
181
181
  schema: {
182
182
  where: { id: item._id },
183
183
  data: this.entityToPrisma(item),
184
- select: this.getSelectRootPrismaSchema(item),
184
+ select: this.getSelectRootPrismaSchema(item.constructor),
185
185
  },
186
186
  relations: this.listRelationEntities(item, true),
187
187
  });
@@ -198,7 +198,7 @@ class RepositoryBase {
198
198
  schema: {
199
199
  where: { id: entityInstance._id },
200
200
  data: this.entityToPrisma(entityInstance),
201
- select: this.getSelectRootPrismaSchema(entityInstance),
201
+ select: this.getSelectRootPrismaSchema(entityInstance.constructor),
202
202
  },
203
203
  relations: this.listRelationEntities(entityInstance),
204
204
  });
@@ -360,7 +360,7 @@ class RepositoryBase {
360
360
  return transaction[(0, KlString_1.toCamelCase)(relation.constructor.name)]
361
361
  .create({
362
362
  data: this.entityToPrisma(relation),
363
- select: this.getSelectRootPrismaSchema(relation),
363
+ select: this.getSelectRootPrismaSchema(relation.constructor),
364
364
  })
365
365
  .then((response) => {
366
366
  const idPropName = this.getIdPropName(relation);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koalarx/nest",
3
- "version": "3.1.17",
3
+ "version": "3.1.19",
4
4
  "description": "",
5
5
  "author": "Igor D. Rangel",
6
6
  "license": "MIT",
@@ -56,10 +56,12 @@ class InMemoryBaseRepository {
56
56
  }
57
57
  }
58
58
  getNewId() {
59
- return this.typeId === 'number'
60
- ? new KlArray_1.KlArray(this.items).orderBy('_id', 'desc')[0]?._id ??
61
- 0 + 1
62
- : (0, node_crypto_1.randomUUID)();
59
+ if (this.typeId === 'number') {
60
+ const lastId = new KlArray_1.KlArray(this.items).orderBy('_id', 'desc')[0]
61
+ ?._id;
62
+ return lastId ? lastId + 1 : 1;
63
+ }
64
+ return (0, node_crypto_1.randomUUID)();
63
65
  }
64
66
  }
65
67
  exports.InMemoryBaseRepository = InMemoryBaseRepository;