@loomcore/api 0.0.37 → 0.0.38

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.
@@ -195,6 +195,16 @@ export class GenericApiService {
195
195
  const entities = await this.onBeforeUpdate(userContext, preparedEntities);
196
196
  const operations = [];
197
197
  const entityIds = [];
198
+ console.log('--- DIAGNOSTICS: Entities received in batchUpdate ---');
199
+ entities.forEach((entity, index) => {
200
+ const entityWithId = entity;
201
+ if (entityWithId && entityWithId._id) {
202
+ console.log(` [${index}]: ID is ${entityWithId._id.toString()}, Type is ${entityWithId._id.constructor.name}`);
203
+ }
204
+ else {
205
+ console.log(` [${index}]: Entity has no _id or is null.`);
206
+ }
207
+ });
198
208
  for (const entity of entities) {
199
209
  const { _id, ...updateData } = entity;
200
210
  if (!_id || !(_id instanceof ObjectId)) {
@@ -412,7 +422,15 @@ export class GenericApiService {
412
422
  if (!this.modelSpec?.fullSchema) {
413
423
  throw new ServerError(`Cannot prepare entity: No model specification with schema provided for ${this.pluralResourceName}`);
414
424
  }
415
- return dbUtils.convertStringsToObjectIds(cleanedEntity, this.modelSpec.fullSchema);
425
+ const finalEntity = dbUtils.convertStringsToObjectIds(cleanedEntity, this.modelSpec.fullSchema);
426
+ const finalEntityWithId = finalEntity;
427
+ if (finalEntityWithId && finalEntityWithId._id) {
428
+ console.log(`--- DIAGNOSTICS: In prepareEntity, after conversion, ID is ${finalEntityWithId._id.toString()}, Type is ${finalEntityWithId._id.constructor.name} ---`);
429
+ }
430
+ else {
431
+ console.log('--- DIAGNOSTICS: In prepareEntity, after conversion, entity has no _id or is null. ---');
432
+ }
433
+ return finalEntity;
416
434
  }
417
435
  prepareQuery(userContext, query) {
418
436
  return query;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loomcore/api",
3
- "version": "0.0.37",
3
+ "version": "0.0.38",
4
4
  "private": false,
5
5
  "description": "Loom Core Api - An opinionated Node.js api using Typescript, Express, and MongoDb",
6
6
  "scripts": {