bruce-models 7.1.69 → 7.1.70

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.
@@ -5295,13 +5295,18 @@
5295
5295
  }
5296
5296
  const data = yield Promise.all(reqs);
5297
5297
  // Populate array, while checking for already added types.
5298
+ // Batched ID requests can overlap.
5298
5299
  const types = [];
5300
+ const seenIds = new Set();
5299
5301
  for (const item of data) {
5300
5302
  for (const type of item.Items) {
5301
- appendInternalAttrSchema(type);
5302
- if (!types.find(x => x.ID == type.ID)) {
5303
- types.push(type);
5303
+ const key = String(type.ID);
5304
+ if (seenIds.has(key)) {
5305
+ continue;
5304
5306
  }
5307
+ seenIds.add(key);
5308
+ appendInternalAttrSchema(type);
5309
+ types.push(type);
5305
5310
  }
5306
5311
  }
5307
5312
  res({
@@ -6292,13 +6297,22 @@
6292
6297
  const reqs = [];
6293
6298
  if (reqIds.length > 0) {
6294
6299
  const req = api.POST(url, reqData, exports.Api.PrepReqParams(reqParams));
6300
+ const itemsById = req.then(data => {
6301
+ const map = new Map();
6302
+ for (const item of data.Items) {
6303
+ const id = String(item.Bruce.ID);
6304
+ if (!map.has(id)) {
6305
+ map.set(id, item);
6306
+ }
6307
+ }
6308
+ return map;
6309
+ });
6295
6310
  for (let i = 0; i < reqIds.length; i++) {
6296
6311
  const entityId = reqIds[i];
6297
6312
  const key = GetCacheKey(Object.assign(Object.assign({}, cacheKeyData), { entityId }));
6298
6313
  const prom = new Promise((res) => __awaiter(this, void 0, void 0, function* () {
6299
6314
  try {
6300
- const data = yield req;
6301
- const item = data.Items.find(x => x.Bruce.ID == entityId);
6315
+ const item = (yield itemsById).get(String(entityId));
6302
6316
  res({
6303
6317
  entity: item
6304
6318
  });
@@ -13188,11 +13202,19 @@
13188
13202
  rej(e);
13189
13203
  }
13190
13204
  }));
13205
+ const sourcesByKey = prom.then((sources) => {
13206
+ const map = new Map();
13207
+ for (const s of sources) {
13208
+ if (!map.has(s["SourceRecord.Key"])) {
13209
+ map.set(s["SourceRecord.Key"], s);
13210
+ }
13211
+ }
13212
+ return map;
13213
+ });
13191
13214
  for (let i = 0; i < reqKeys.length; i++) {
13192
13215
  const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
13193
13216
  try {
13194
- const sources = yield prom;
13195
- res(sources.find((s) => s["SourceRecord.Key"] === reqKeys[i]));
13217
+ res((yield sourcesByKey).get(reqKeys[i]));
13196
13218
  }
13197
13219
  catch (e) {
13198
13220
  rej(e);
@@ -13452,12 +13474,20 @@
13452
13474
  rej(e);
13453
13475
  }
13454
13476
  }));
13477
+ const tagsById = prom.then((tags) => {
13478
+ const map = new Map();
13479
+ for (const t of tags) {
13480
+ if (!map.has(t.ID)) {
13481
+ map.set(t.ID, t);
13482
+ }
13483
+ }
13484
+ return map;
13485
+ });
13455
13486
  for (let i = 0; i < reqIds.length; i++) {
13456
13487
  const id = reqIds[i];
13457
13488
  const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
13458
13489
  try {
13459
- const tags = yield prom;
13460
- const tag = tags.find((t) => t.ID === id);
13490
+ const tag = (yield tagsById).get(id);
13461
13491
  res({
13462
13492
  tag: tag
13463
13493
  });
@@ -15772,8 +15802,9 @@
15772
15802
  }
15773
15803
  else if (tilesetIds.length > 1) {
15774
15804
  const tilesets = yield api.GET("ui.tilesets", exports.Api.PrepReqParams(reqParams));
15805
+ const tilesetIdsSet = new Set(tilesetIds);
15775
15806
  for (const tileset of tilesets) {
15776
- if (tilesetIds.indexOf(tileset.ID) >= 0) {
15807
+ if (tilesetIdsSet.has(tileset.ID)) {
15777
15808
  mapping[tileset.ID] = tileset.Type;
15778
15809
  }
15779
15810
  }
@@ -19405,7 +19436,7 @@
19405
19436
  })(exports.UrlUtils || (exports.UrlUtils = {}));
19406
19437
 
19407
19438
  // This is updated with the package.json version on build.
19408
- const VERSION = "7.1.69";
19439
+ const VERSION = "7.1.70";
19409
19440
 
19410
19441
  exports.VERSION = VERSION;
19411
19442
  exports.AbstractApi = AbstractApi;