pangea-server 3.3.117 → 3.3.119

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.
@@ -304,34 +304,25 @@ function getFinalOrder(order, config = {}) {
304
304
  });
305
305
  return [...finalOrder, ...(!config.attributes ? [['createdAt', 'DESC']] : [])];
306
306
  }
307
- function processInstance(model, instance) {
307
+ function processJsonInstance(model, jsonInstance) {
308
308
  for (const [relName] of Object.entries(model.Relations)) {
309
- console.log('relName: ', relName);
310
- const relInstance = instance[relName];
311
- console.log('relInstance');
309
+ const relInstance = jsonInstance[relName];
312
310
  if (!relInstance)
313
311
  continue;
314
312
  const relModel = model.Relations[relName].getModelFn();
315
313
  if (Array.isArray(relInstance)) {
316
- console.log('Array.isArray(relInstance)');
317
- relInstance.forEach((i) => processInstance(relModel, i));
314
+ jsonInstance[relName] = relInstance.map((relIns) => processJsonInstance(relModel, relIns));
318
315
  }
319
316
  else {
320
- console.log('!!! Array.isArray(relInstance)');
321
- console.log(relInstance.id);
322
- processInstance(relModel, relInstance);
317
+ jsonInstance[relName] = processJsonInstance(relModel, relInstance);
323
318
  }
324
319
  }
325
- console.log(model.name);
326
- const jsonInstance = instance.toJSON();
327
- console.log('jsonInstance');
328
- console.log(jsonInstance.id);
329
- console.log(jsonInstance.name);
330
320
  model.InitInstance(jsonInstance);
331
- console.log('model.InitInstance()');
332
- console.log(jsonInstance.subscriptionStatus);
333
321
  return jsonInstance;
334
322
  }
323
+ function processInstance(model, instance) {
324
+ return processJsonInstance(model, instance.toJSON());
325
+ }
335
326
  function processInstances(model, instances) {
336
327
  return instances.map((instance) => processInstance(model, instance));
337
328
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pangea-server",
3
3
  "description": "",
4
- "version": "3.3.117",
4
+ "version": "3.3.119",
5
5
  "files": [
6
6
  "dist"
7
7
  ],