@bringg/dashboard-sdk 9.49.0-pre.1 → 9.49.0-pre.2

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.
@@ -56,7 +56,7 @@ var lodash_1 = require("lodash");
56
56
  var BringgException_1 = require("../Core/BringgException");
57
57
  var Logger_1 = __importDefault(require("../Core/Logger"));
58
58
  var abort_1 = require("../utils/abort");
59
- var version = '9.49.0-pre.1';
59
+ var version = '9.49.0-pre.2';
60
60
  function logErrorResponse(response) {
61
61
  var data = response.data, status = response.status;
62
62
  try {
@@ -22219,7 +22219,7 @@ var lodash_1 = __webpack_require__(96486);
22219
22219
  var BringgException_1 = __webpack_require__(43605);
22220
22220
  var Logger_1 = __importDefault(__webpack_require__(55860));
22221
22221
  var abort_1 = __webpack_require__(34179);
22222
- var version = '9.49.0-pre.1';
22222
+ var version = '9.49.0-pre.2';
22223
22223
  function logErrorResponse(response) {
22224
22224
  var data = response.data, status = response.status;
22225
22225
  try {
@@ -33172,7 +33172,7 @@ var StorableDataService = /** @class */ (function () {
33172
33172
  };
33173
33173
  StorableDataService.prototype.loadMany = function (action, loadFunc, ids, options) {
33174
33174
  return __awaiter(this, void 0, void 0, function () {
33175
- var unloadedIds, items, clientItems;
33175
+ var unloadedIds, clientItems;
33176
33176
  var _this = this;
33177
33177
  return __generator(this, function (_a) {
33178
33178
  switch (_a.label) {
@@ -33188,18 +33188,15 @@ var StorableDataService = /** @class */ (function () {
33188
33188
  }
33189
33189
  return _this.extraDataStores.some(function (dataStore) { return !dataStore.has(item, options.fields); });
33190
33190
  });
33191
- if (!(ids.length === 0 || unloadedIds.length > 0)) return [3 /*break*/, 4];
33192
- if (!(ids.length === 0)) return [3 /*break*/, 2];
33193
- return [4 /*yield*/, loadFunc(unloadedIds)];
33191
+ if (!(ids.length === 0 || unloadedIds.length > 0)) return [3 /*break*/, 2];
33192
+ return [4 /*yield*/, this.loadInChunks(unloadedIds, loadFunc, action, options)];
33194
33193
  case 1:
33195
- items = _a.sent();
33196
- clientItems = this.updateManyInStores(items, action, options.fields);
33197
- return [2 /*return*/, clientItems.map(function (mappedItems) { return mappedItems.current; })];
33198
- case 2: return [4 /*yield*/, this.loadInChunks(unloadedIds, loadFunc, action, options)];
33199
- case 3:
33200
- _a.sent();
33201
- _a.label = 4;
33202
- case 4: return [2 /*return*/, ids.map(function (id) { return _this.dataStore.get(id); }).filter(Boolean)];
33194
+ clientItems = _a.sent();
33195
+ if (ids.length === 0) {
33196
+ return [2 /*return*/, clientItems];
33197
+ }
33198
+ _a.label = 2;
33199
+ case 2: return [2 /*return*/, ids.map(function (id) { return _this.dataStore.get(id); }).filter(Boolean)];
33203
33200
  }
33204
33201
  });
33205
33202
  });
@@ -33207,30 +33204,38 @@ var StorableDataService = /** @class */ (function () {
33207
33204
  StorableDataService.prototype.loadInChunks = function (idsToLoad, loadFunc, action, options) {
33208
33205
  var _a;
33209
33206
  return __awaiter(this, void 0, void 0, function () {
33210
- var chunkSize, allClientItems, i, chunkIds, items, clientItems;
33207
+ var allClientItems, items, clientItems, chunkSize, i, chunkIds, items, clientItems;
33211
33208
  return __generator(this, function (_b) {
33212
33209
  switch (_b.label) {
33213
33210
  case 0:
33214
- chunkSize = options.chunkSize || idsToLoad.length;
33215
33211
  allClientItems = [];
33216
- i = 0;
33217
- _b.label = 1;
33212
+ if (!(idsToLoad.length === 0)) return [3 /*break*/, 2];
33213
+ return [4 /*yield*/, loadFunc([])];
33218
33214
  case 1:
33219
- if (!(i < idsToLoad.length)) return [3 /*break*/, 4];
33215
+ items = _b.sent();
33216
+ clientItems = this.updateManyInStores(items, action, options.fields);
33217
+ allClientItems.push.apply(allClientItems, __spreadArray([], __read(clientItems), false));
33218
+ return [3 /*break*/, 6];
33219
+ case 2:
33220
+ chunkSize = options.chunkSize || idsToLoad.length;
33221
+ i = 0;
33222
+ _b.label = 3;
33223
+ case 3:
33224
+ if (!(i < idsToLoad.length)) return [3 /*break*/, 6];
33220
33225
  if ((_a = options === null || options === void 0 ? void 0 : options.signal) === null || _a === void 0 ? void 0 : _a.aborted) {
33221
33226
  throw new Error('Operation was aborted');
33222
33227
  }
33223
33228
  chunkIds = idsToLoad.slice(i, i + chunkSize);
33224
33229
  return [4 /*yield*/, loadFunc(chunkIds)];
33225
- case 2:
33230
+ case 4:
33226
33231
  items = _b.sent();
33227
33232
  clientItems = this.updateManyInStores(items, action, options.fields);
33228
33233
  allClientItems.push.apply(allClientItems, __spreadArray([], __read(clientItems), false));
33229
- _b.label = 3;
33230
- case 3:
33234
+ _b.label = 5;
33235
+ case 5:
33231
33236
  i += chunkSize;
33232
- return [3 /*break*/, 1];
33233
- case 4: return [2 /*return*/, allClientItems.map(function (mappedItems) { return mappedItems.current; })];
33237
+ return [3 /*break*/, 3];
33238
+ case 6: return [2 /*return*/, allClientItems.map(function (mappedItems) { return mappedItems.current; })];
33234
33239
  }
33235
33240
  });
33236
33241
  });