spice-js 2.7.2 → 2.7.3

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.
@@ -704,50 +704,75 @@ class SpiceModel {
704
704
  var _this6 = this;
705
705
 
706
706
  return _asyncToGenerator(function* () {
707
- try {
708
- if (!args) {
709
- args = {};
710
- }
707
+ var _this6$_ctx;
711
708
 
712
- if (args.skip_hooks != true) {
713
- yield _this6.run_hook(_this6, "list", "before");
714
- }
709
+ // Profiling: use track() for proper async context forking
710
+ var p = (_this6$_ctx = _this6[_ctx]) == null ? void 0 : _this6$_ctx.profiler;
711
+
712
+ var doGetMulti =
713
+ /*#__PURE__*/
714
+ function () {
715
+ var _ref5 = _asyncToGenerator(function* () {
716
+ if (!args) {
717
+ args = {};
718
+ }
715
719
 
716
- _.remove(args.ids, o => o == undefined);
720
+ if (args.skip_hooks != true) {
721
+ yield _this6.run_hook(_this6, "list", "before");
722
+ }
717
723
 
718
- var key = "multi-get::" + _this6.type + "::" + _.join(args.ids, "|");
724
+ _.remove(args.ids, o => o == undefined);
719
725
 
720
- var results = [];
726
+ var key = "multi-get::" + _this6.type + "::" + _.join(args.ids, "|");
721
727
 
722
- if (args.ids.length > 0) {
723
- if (_this6.shouldUseCache(_this6.type)) {
724
- var cached_results = yield _this6.getCacheProviderObject(_this6.type).get(key);
725
- results = cached_results == null ? void 0 : cached_results.value;
728
+ var results = [];
726
729
 
727
- if ((cached_results == null ? void 0 : cached_results.value) === undefined || (yield _this6.shouldForceRefresh(cached_results))) {
728
- results = yield _this6.database.multi_get(args.ids, true);
730
+ if (args.ids.length > 0) {
731
+ if (_this6.shouldUseCache(_this6.type)) {
732
+ var cached_results = yield _this6.getCacheProviderObject(_this6.type).get(key);
733
+ results = cached_results == null ? void 0 : cached_results.value;
729
734
 
730
- _this6.getCacheProviderObject(_this6.type).set(key, {
731
- value: results,
732
- time: new Date().getTime()
733
- }, _this6.getCacheConfig(_this6.type));
735
+ if ((cached_results == null ? void 0 : cached_results.value) === undefined || (yield _this6.shouldForceRefresh(cached_results))) {
736
+ results = yield _this6.database.multi_get(args.ids, true);
737
+
738
+ _this6.getCacheProviderObject(_this6.type).set(key, {
739
+ value: results,
740
+ time: new Date().getTime()
741
+ }, _this6.getCacheConfig(_this6.type));
742
+ }
743
+ } else {
744
+ results = yield _this6.database.multi_get(args.ids, true);
734
745
  }
735
- } else {
736
- results = yield _this6.database.multi_get(args.ids, true);
737
746
  }
738
- }
739
747
 
740
- _.remove(results, o => o.type != _this6.type);
748
+ _.remove(results, o => o.type != _this6.type);
741
749
 
742
- if (args.skip_read_serialize != true && args.skip_serialize != true) {
743
- results = yield _this6.do_serialize(results, "read", {}, args, (yield _this6.propsToBeRemoved(results)));
744
- }
750
+ if (args.skip_read_serialize != true && args.skip_serialize != true) {
751
+ results = yield _this6.do_serialize(results, "read", {}, args, (yield _this6.propsToBeRemoved(results)));
752
+ }
753
+
754
+ if (args.skip_hooks != true) {
755
+ yield _this6.run_hook(results, "list", "after", args.context);
756
+ }
757
+
758
+ return results;
759
+ });
760
+
761
+ return function doGetMulti() {
762
+ return _ref5.apply(this, arguments);
763
+ };
764
+ }();
745
765
 
746
- if (args.skip_hooks != true) {
747
- yield _this6.run_hook(results, "list", "after", args.context);
766
+ try {
767
+ if (p) {
768
+ var _args9, _args9$ids;
769
+
770
+ return yield p.track(_this6.type + ".getMulti", doGetMulti, {
771
+ ids_count: ((_args9 = args) == null ? void 0 : (_args9$ids = _args9.ids) == null ? void 0 : _args9$ids.length) || 0
772
+ });
748
773
  }
749
774
 
750
- return results;
775
+ return yield doGetMulti();
751
776
  } catch (e) {
752
777
  console.warn(e.stack);
753
778
  throw e;
@@ -796,7 +821,7 @@ class SpiceModel {
796
821
  var doUpdate =
797
822
  /*#__PURE__*/
798
823
  function () {
799
- var _ref5 = _asyncToGenerator(function* () {
824
+ var _ref6 = _asyncToGenerator(function* () {
800
825
  _this8.updated_at = new SDate().now();
801
826
  var results = yield _this8.database.get(args.id);
802
827
  var item_exist = yield _this8.exist(results);
@@ -855,7 +880,7 @@ class SpiceModel {
855
880
  });
856
881
 
857
882
  return function doUpdate() {
858
- return _ref5.apply(this, arguments);
883
+ return _ref6.apply(this, arguments);
859
884
  };
860
885
  }();
861
886
 
@@ -890,7 +915,7 @@ class SpiceModel {
890
915
  var doCreate =
891
916
  /*#__PURE__*/
892
917
  function () {
893
- var _ref7 = _asyncToGenerator(function* () {
918
+ var _ref8 = _asyncToGenerator(function* () {
894
919
  var form;
895
920
  _this9.created_at = new SDate().now();
896
921
  args = _.defaults(args, {
@@ -950,7 +975,7 @@ class SpiceModel {
950
975
  });
951
976
 
952
977
  return function doCreate() {
953
- return _ref7.apply(this, arguments);
978
+ return _ref8.apply(this, arguments);
954
979
  };
955
980
  }();
956
981
 
@@ -1000,7 +1025,7 @@ class SpiceModel {
1000
1025
  var doDelete =
1001
1026
  /*#__PURE__*/
1002
1027
  function () {
1003
- var _ref9 = _asyncToGenerator(function* () {
1028
+ var _ref10 = _asyncToGenerator(function* () {
1004
1029
  var item_exist = yield _this11.exist(args.id);
1005
1030
 
1006
1031
  if (!item_exist) {
@@ -1018,7 +1043,7 @@ class SpiceModel {
1018
1043
  var dbOperation =
1019
1044
  /*#__PURE__*/
1020
1045
  function () {
1021
- var _ref10 = _asyncToGenerator(function* () {
1046
+ var _ref11 = _asyncToGenerator(function* () {
1022
1047
  if (args.hard) {
1023
1048
  delete_response = yield _this11.database.delete(args.id);
1024
1049
 
@@ -1031,7 +1056,7 @@ class SpiceModel {
1031
1056
  });
1032
1057
 
1033
1058
  return function dbOperation() {
1034
- return _ref10.apply(this, arguments);
1059
+ return _ref11.apply(this, arguments);
1035
1060
  };
1036
1061
  }();
1037
1062
 
@@ -1049,7 +1074,7 @@ class SpiceModel {
1049
1074
  });
1050
1075
 
1051
1076
  return function doDelete() {
1052
- return _ref9.apply(this, arguments);
1077
+ return _ref10.apply(this, arguments);
1053
1078
  };
1054
1079
  }();
1055
1080
 
@@ -1218,12 +1243,12 @@ class SpiceModel {
1218
1243
 
1219
1244
  createJoinSection(mappedNestings) {
1220
1245
  if (!mappedNestings || mappedNestings.length === 0) return "";
1221
- return mappedNestings.map((_ref11) => {
1246
+ return mappedNestings.map((_ref12) => {
1222
1247
  var {
1223
1248
  alias,
1224
1249
  reference,
1225
1250
  is_array
1226
- } = _ref11;
1251
+ } = _ref12;
1227
1252
  var keyspace = (0, _fix.fixCollection)(reference);
1228
1253
 
1229
1254
  if (is_array === true) {
@@ -1319,13 +1344,13 @@ class SpiceModel {
1319
1344
  var doList =
1320
1345
  /*#__PURE__*/
1321
1346
  function () {
1322
- var _ref12 = _asyncToGenerator(function* () {
1323
- var _args9, _args10, _args11;
1347
+ var _ref13 = _asyncToGenerator(function* () {
1348
+ var _args10, _args11, _args12;
1324
1349
 
1325
1350
  if (args.mapping_dept) _this12[_mapping_dept] = args.mapping_dept;
1326
1351
  if (args.mapping_dept_exempt) _this12[_mapping_dept_exempt] = args.mapping_dept_exempt; // Find alias tokens from query/columns/sort
1327
1352
 
1328
- var nestings = [..._this12.extractNestings(((_args9 = args) == null ? void 0 : _args9.query) || "", _this12.type), ..._this12.extractNestings(((_args10 = args) == null ? void 0 : _args10.columns) || "", _this12.type), ..._this12.extractNestings(((_args11 = args) == null ? void 0 : _args11.sort) || "", _this12.type)]; // Decide which aliases we can join: only when map.type===MODEL AND reference is a STRING keyspace.
1353
+ var nestings = [..._this12.extractNestings(((_args10 = args) == null ? void 0 : _args10.query) || "", _this12.type), ..._this12.extractNestings(((_args11 = args) == null ? void 0 : _args11.columns) || "", _this12.type), ..._this12.extractNestings(((_args12 = args) == null ? void 0 : _args12.sort) || "", _this12.type)]; // Decide which aliases we can join: only when map.type===MODEL AND reference is a STRING keyspace.
1329
1354
 
1330
1355
  var mappedNestings = _.compact(_.uniq(nestings).map(alias => {
1331
1356
  var prop = _this12.props[alias];
@@ -1416,17 +1441,17 @@ class SpiceModel {
1416
1441
  });
1417
1442
 
1418
1443
  return function doList() {
1419
- return _ref12.apply(this, arguments);
1444
+ return _ref13.apply(this, arguments);
1420
1445
  };
1421
1446
  }();
1422
1447
 
1423
1448
  try {
1424
1449
  if (p) {
1425
- var _args12, _args13;
1450
+ var _args13, _args14;
1426
1451
 
1427
1452
  return yield p.track(_this12.type + ".list", doList, {
1428
- limit: (_args12 = args) == null ? void 0 : _args12.limit,
1429
- offset: (_args13 = args) == null ? void 0 : _args13.offset
1453
+ limit: (_args13 = args) == null ? void 0 : _args13.limit,
1454
+ offset: (_args14 = args) == null ? void 0 : _args14.offset
1430
1455
  });
1431
1456
  }
1432
1457
 
@@ -1450,7 +1475,7 @@ class SpiceModel {
1450
1475
  var doFetch =
1451
1476
  /*#__PURE__*/
1452
1477
  function () {
1453
- var _ref13 = _asyncToGenerator(function* () {
1478
+ var _ref14 = _asyncToGenerator(function* () {
1454
1479
  if (args.is_custom_query === "true" && args.ids.length > 0) {
1455
1480
  return yield _this13.database.query(query);
1456
1481
  } else if (args.is_full_text === "true") {
@@ -1462,7 +1487,7 @@ class SpiceModel {
1462
1487
  });
1463
1488
 
1464
1489
  return function doFetch() {
1465
- return _ref13.apply(this, arguments);
1490
+ return _ref14.apply(this, arguments);
1466
1491
  };
1467
1492
  }();
1468
1493
 
@@ -1474,12 +1499,12 @@ class SpiceModel {
1474
1499
  })();
1475
1500
  }
1476
1501
 
1477
- addHook(_ref14) {
1502
+ addHook(_ref15) {
1478
1503
  var {
1479
1504
  operation,
1480
1505
  when,
1481
1506
  execute
1482
- } = _ref14;
1507
+ } = _ref15;
1483
1508
 
1484
1509
  this[_hooks][operation][when].push(execute);
1485
1510
  }
@@ -1613,6 +1638,11 @@ class SpiceModel {
1613
1638
  var _this15 = this;
1614
1639
 
1615
1640
  return _asyncToGenerator(function* () {
1641
+ var _this15$_ctx;
1642
+
1643
+ // ⚡ Get profiler for proper async context forking
1644
+ var p = (_this15$_ctx = _this15[_ctx]) == null ? void 0 : _this15$_ctx.profiler;
1645
+
1616
1646
  var original_is_array = _.isArray(data);
1617
1647
 
1618
1648
  if (!original_is_array) {
@@ -1633,19 +1663,40 @@ class SpiceModel {
1633
1663
  }); // Build the path for child models
1634
1664
 
1635
1665
 
1636
- var childPath = _this15[_current_path] ? _this15[_current_path] + "." + source_property : source_property;
1637
- var returned_all = yield Promise.allSettled(_.map(classes, obj => {
1638
- return new obj(_extends({}, _this15[_args], {
1639
- skip_cache: _this15[_skip_cache],
1640
- _level: _this15[_level] + 1,
1641
- mapping_dept: _this15[_mapping_dept],
1642
- mapping_dept_exempt: _this15[_mapping_dept_exempt],
1643
- _current_path: childPath
1644
- })).getMulti({
1645
- skip_hooks: true,
1646
- ids: ids
1666
+ var childPath = _this15[_current_path] ? _this15[_current_path] + "." + source_property : source_property; // ⚡ Wrap in profiler track() to ensure proper async context for child operations
1667
+
1668
+ var fetchRelated =
1669
+ /*#__PURE__*/
1670
+ function () {
1671
+ var _ref16 = _asyncToGenerator(function* () {
1672
+ return yield Promise.allSettled(_.map(classes, obj => {
1673
+ return new obj(_extends({}, _this15[_args], {
1674
+ skip_cache: _this15[_skip_cache],
1675
+ _level: _this15[_level] + 1,
1676
+ mapping_dept: _this15[_mapping_dept],
1677
+ mapping_dept_exempt: _this15[_mapping_dept_exempt],
1678
+ _current_path: childPath
1679
+ })).getMulti({
1680
+ skip_hooks: true,
1681
+ ids: ids
1682
+ });
1683
+ }));
1647
1684
  });
1648
- }));
1685
+
1686
+ return function fetchRelated() {
1687
+ return _ref16.apply(this, arguments);
1688
+ };
1689
+ }();
1690
+
1691
+ var returned_all;
1692
+
1693
+ if (p && ids.length > 0) {
1694
+ returned_all = yield p.track(_this15.type + ".map." + source_property, fetchRelated, {
1695
+ ids_count: ids.length
1696
+ });
1697
+ } else {
1698
+ returned_all = yield fetchRelated();
1699
+ }
1649
1700
 
1650
1701
  var ug = _.flatten(_.compact(_.map(returned_all, returned_obj => {
1651
1702
  if (returned_obj.status == "fulfilled") return returned_obj.value;
@@ -1668,6 +1719,11 @@ class SpiceModel {
1668
1719
  var _this16 = this;
1669
1720
 
1670
1721
  return _asyncToGenerator(function* () {
1722
+ var _this16$_ctx;
1723
+
1724
+ // ⚡ Get profiler for proper async context forking
1725
+ var p = (_this16$_ctx = _this16[_ctx]) == null ? void 0 : _this16$_ctx.profiler;
1726
+
1671
1727
  var original_is_array = _.isArray(data);
1672
1728
 
1673
1729
  if (!original_is_array) {
@@ -1698,28 +1754,45 @@ class SpiceModel {
1698
1754
 
1699
1755
  var childPath = _this16[_current_path] ? _this16[_current_path] + "." + source_property : source_property;
1700
1756
 
1701
- var classes = _.compact(_.isArray(Class) ? Class : [Class]);
1757
+ var classes = _.compact(_.isArray(Class) ? Class : [Class]); // ⚡ Wrap in profiler track() to ensure proper async context for child operations
1758
+
1759
+
1760
+ var fetchRelated =
1761
+ /*#__PURE__*/
1762
+ function () {
1763
+ var _ref17 = _asyncToGenerator(function* () {
1764
+ return yield Promise.allSettled(_.map(classes, obj => {
1765
+ return new obj(_extends({}, _this16[_args], {
1766
+ skip_cache: _this16[_skip_cache],
1767
+ _level: _this16[_level] + 1,
1768
+ mapping_dept: _this16[_mapping_dept],
1769
+ mapping_dept_exempt: _this16[_mapping_dept_exempt],
1770
+ _current_path: childPath
1771
+ })).getMulti({
1772
+ skip_hooks: true,
1773
+ ids: ids
1774
+ });
1775
+ }));
1776
+ });
1777
+
1778
+ return function fetchRelated() {
1779
+ return _ref17.apply(this, arguments);
1780
+ };
1781
+ }();
1782
+
1783
+ var returned_all;
1702
1784
 
1703
- var returned_all = yield Promise.allSettled(_.map(classes, obj => {
1704
- return new obj(_extends({}, _this16[_args], {
1705
- skip_cache: _this16[_skip_cache],
1706
- _level: _this16[_level] + 1,
1707
- mapping_dept: _this16[_mapping_dept],
1708
- mapping_dept_exempt: _this16[_mapping_dept_exempt],
1709
- _current_path: childPath
1710
- })).getMulti({
1711
- skip_hooks: true,
1712
- ids: ids
1785
+ if (p && ids.length > 0) {
1786
+ returned_all = yield p.track(_this16.type + ".mapArray." + source_property, fetchRelated, {
1787
+ ids_count: ids.length
1713
1788
  });
1714
- }));
1789
+ } else {
1790
+ returned_all = yield fetchRelated();
1791
+ }
1715
1792
 
1716
1793
  var returned_objects = _.flatten(_.compact(_.map(returned_all, returned_obj => {
1717
1794
  if (returned_obj.status == "fulfilled") return returned_obj.value;
1718
1795
  })));
1719
- /* let returned_objects = await new Class().getMulti({
1720
- ids: ids,
1721
- }); */
1722
-
1723
1796
 
1724
1797
  _.each(data, result => {
1725
1798
  if (_.isString(result[store_property])) {
@@ -1740,13 +1813,13 @@ class SpiceModel {
1740
1813
  })();
1741
1814
  }
1742
1815
 
1743
- addModifier(_ref15) {
1816
+ addModifier(_ref18) {
1744
1817
  var {
1745
1818
  when,
1746
1819
  execute,
1747
1820
  field = null,
1748
1821
  sourceField = null
1749
- } = _ref15;
1822
+ } = _ref18;
1750
1823
 
1751
1824
  if (this[_serializers][when]) {
1752
1825
  // Store as object with field info for column-based filtering
@@ -1905,7 +1978,7 @@ class SpiceModel {
1905
1978
  var doSerialize =
1906
1979
  /*#__PURE__*/
1907
1980
  function () {
1908
- var _ref16 = _asyncToGenerator(function* () {
1981
+ var _ref19 = _asyncToGenerator(function* () {
1909
1982
  var _this18$_serializers, _this18$_serializers$;
1910
1983
 
1911
1984
  // Early exit if serialization should not run.
@@ -1996,7 +2069,7 @@ class SpiceModel {
1996
2069
  });
1997
2070
 
1998
2071
  return function doSerialize() {
1999
- return _ref16.apply(this, arguments);
2072
+ return _ref19.apply(this, arguments);
2000
2073
  };
2001
2074
  }();
2002
2075
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spice-js",
3
- "version": "2.7.2",
3
+ "version": "2.7.3",
4
4
  "description": "spice",
5
5
  "main": "build/index.js",
6
6
  "repository": {
@@ -606,7 +606,10 @@ export default class SpiceModel {
606
606
  }
607
607
 
608
608
  async getMulti(args) {
609
- try {
609
+ // ⚡ Profiling: use track() for proper async context forking
610
+ const p = this[_ctx]?.profiler;
611
+
612
+ const doGetMulti = async () => {
610
613
  if (!args) {
611
614
  args = {};
612
615
  }
@@ -653,6 +656,15 @@ export default class SpiceModel {
653
656
  }
654
657
 
655
658
  return results;
659
+ };
660
+
661
+ try {
662
+ if (p) {
663
+ return await p.track(`${this.type}.getMulti`, doGetMulti, {
664
+ ids_count: args?.ids?.length || 0,
665
+ });
666
+ }
667
+ return await doGetMulti();
656
668
  } catch (e) {
657
669
  console.warn(e.stack);
658
670
  throw e;
@@ -1445,6 +1457,9 @@ export default class SpiceModel {
1445
1457
  }
1446
1458
 
1447
1459
  async mapToObject(data, Class, source_property, store_property, property) {
1460
+ // ⚡ Get profiler for proper async context forking
1461
+ const p = this[_ctx]?.profiler;
1462
+
1448
1463
  let original_is_array = _.isArray(data);
1449
1464
  if (!original_is_array) {
1450
1465
  data = Array.of(data);
@@ -1469,21 +1484,36 @@ export default class SpiceModel {
1469
1484
  `${this[_current_path]}.${source_property}`
1470
1485
  : source_property;
1471
1486
 
1472
- var returned_all = await Promise.allSettled(
1473
- _.map(classes, (obj) => {
1474
- return new obj({
1475
- ...this[_args],
1476
- skip_cache: this[_skip_cache],
1477
- _level: this[_level] + 1,
1478
- mapping_dept: this[_mapping_dept],
1479
- mapping_dept_exempt: this[_mapping_dept_exempt],
1480
- _current_path: childPath,
1481
- }).getMulti({
1482
- skip_hooks: true,
1483
- ids: ids,
1484
- });
1485
- })
1486
- );
1487
+ // Wrap in profiler track() to ensure proper async context for child operations
1488
+ const fetchRelated = async () => {
1489
+ return await Promise.allSettled(
1490
+ _.map(classes, (obj) => {
1491
+ return new obj({
1492
+ ...this[_args],
1493
+ skip_cache: this[_skip_cache],
1494
+ _level: this[_level] + 1,
1495
+ mapping_dept: this[_mapping_dept],
1496
+ mapping_dept_exempt: this[_mapping_dept_exempt],
1497
+ _current_path: childPath,
1498
+ }).getMulti({
1499
+ skip_hooks: true,
1500
+ ids: ids,
1501
+ });
1502
+ })
1503
+ );
1504
+ };
1505
+
1506
+ var returned_all;
1507
+ if (p && ids.length > 0) {
1508
+ returned_all = await p.track(
1509
+ `${this.type}.map.${source_property}`,
1510
+ fetchRelated,
1511
+ { ids_count: ids.length }
1512
+ );
1513
+ } else {
1514
+ returned_all = await fetchRelated();
1515
+ }
1516
+
1487
1517
  let ug = _.flatten(
1488
1518
  _.compact(
1489
1519
  _.map(returned_all, (returned_obj) => {
@@ -1511,6 +1541,9 @@ export default class SpiceModel {
1511
1541
  store_property,
1512
1542
  property
1513
1543
  ) {
1544
+ // ⚡ Get profiler for proper async context forking
1545
+ const p = this[_ctx]?.profiler;
1546
+
1514
1547
  let original_is_array = _.isArray(data);
1515
1548
  if (!original_is_array) {
1516
1549
  data = Array.of(data);
@@ -1540,21 +1573,36 @@ export default class SpiceModel {
1540
1573
  : source_property;
1541
1574
 
1542
1575
  let classes = _.compact(_.isArray(Class) ? Class : [Class]);
1543
- var returned_all = await Promise.allSettled(
1544
- _.map(classes, (obj) => {
1545
- return new obj({
1546
- ...this[_args],
1547
- skip_cache: this[_skip_cache],
1548
- _level: this[_level] + 1,
1549
- mapping_dept: this[_mapping_dept],
1550
- mapping_dept_exempt: this[_mapping_dept_exempt],
1551
- _current_path: childPath,
1552
- }).getMulti({
1553
- skip_hooks: true,
1554
- ids: ids,
1555
- });
1556
- })
1557
- );
1576
+
1577
+ // ⚡ Wrap in profiler track() to ensure proper async context for child operations
1578
+ const fetchRelated = async () => {
1579
+ return await Promise.allSettled(
1580
+ _.map(classes, (obj) => {
1581
+ return new obj({
1582
+ ...this[_args],
1583
+ skip_cache: this[_skip_cache],
1584
+ _level: this[_level] + 1,
1585
+ mapping_dept: this[_mapping_dept],
1586
+ mapping_dept_exempt: this[_mapping_dept_exempt],
1587
+ _current_path: childPath,
1588
+ }).getMulti({
1589
+ skip_hooks: true,
1590
+ ids: ids,
1591
+ });
1592
+ })
1593
+ );
1594
+ };
1595
+
1596
+ var returned_all;
1597
+ if (p && ids.length > 0) {
1598
+ returned_all = await p.track(
1599
+ `${this.type}.mapArray.${source_property}`,
1600
+ fetchRelated,
1601
+ { ids_count: ids.length }
1602
+ );
1603
+ } else {
1604
+ returned_all = await fetchRelated();
1605
+ }
1558
1606
 
1559
1607
  var returned_objects = _.flatten(
1560
1608
  _.compact(
@@ -1564,9 +1612,6 @@ export default class SpiceModel {
1564
1612
  )
1565
1613
  );
1566
1614
 
1567
- /* let returned_objects = await new Class().getMulti({
1568
- ids: ids,
1569
- }); */
1570
1615
  _.each(data, (result) => {
1571
1616
  if (_.isString(result[store_property])) {
1572
1617
  result[store_property] = [result[store_property]];