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