bruce-models 1.7.6 → 1.7.8

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.
@@ -460,12 +460,18 @@
460
460
  }
461
461
  }
462
462
 
463
+ // TODO: Currently checks for CSV vs json specifically,
464
+ // Need to see if our api is generally good at setting content-type headers.
465
+ // Make it less specific to CSV.
463
466
  function parseResult(data) {
464
467
  return __awaiter(this, void 0, void 0, function* () {
465
468
  if (data.status == 200) {
469
+ let type = data.headers.get("Content-Type");
470
+ if (type) {
471
+ type = type.trim().toLowerCase();
472
+ }
466
473
  let encoding = "";
467
- const type = data.headers.get("Content-Type");
468
- const charset = type ? type.split(";").find((x) => x.trim().toLowerCase().startsWith("charset=")) : "";
474
+ const charset = type ? type.split(";").find((x) => x.startsWith("charset=")) : "";
469
475
  if (charset && charset.includes("=")) {
470
476
  encoding = charset.split("=")[1];
471
477
  encoding = encoding.toLowerCase();
@@ -479,11 +485,18 @@
479
485
  if (!text || !text.trim()) {
480
486
  return null;
481
487
  }
488
+ if (type && type.includes("text/csv")) {
489
+ return text;
490
+ }
482
491
  return JSON.parse(text);
483
492
  }
484
493
  else {
485
494
  const buffer = yield data.arrayBuffer();
486
- return JSON.parse(new TextDecoder(encoding).decode(buffer));
495
+ const text = new TextDecoder(encoding).decode(buffer);
496
+ if (type && type.includes("text/csv")) {
497
+ return text;
498
+ }
499
+ return JSON.parse(text);
487
500
  }
488
501
  }
489
502
  else {
@@ -4033,7 +4046,7 @@
4033
4046
  EStatus["Loading"] = "LOADING";
4034
4047
  })(EStatus = EntityFilterGetter.EStatus || (EntityFilterGetter.EStatus = {}));
4035
4048
  class Getter {
4036
- constructor(api, viewPort, typeId, batchSize, attrFilter) {
4049
+ constructor(api, viewPort, typeId, batchSize, attrFilter, viaCdn) {
4037
4050
  this.onUpdate = null;
4038
4051
  this.LastStateUpdates = {};
4039
4052
  this.onStateUpdate = null;
@@ -4049,7 +4062,8 @@
4049
4062
  this.viewCenter = null;
4050
4063
  this.api = api;
4051
4064
  this.typeId = typeId;
4052
- this.batchSize = batchSize;
4065
+ this.viaCdn = Boolean(viaCdn);
4066
+ this.batchSize = isNaN(batchSize) ? 300 : batchSize;
4053
4067
  this.viewPort = viewPort;
4054
4068
  this.attrFilter = attrFilter;
4055
4069
  this.updateBounds();
@@ -4226,7 +4240,8 @@
4226
4240
  bounds: curCell.GetBounds(),
4227
4241
  sortOrder: exports.Api.ESortOrder.Asc,
4228
4242
  entityTypeConditions: this.attrFilter
4229
- }
4243
+ },
4244
+ viaCdn: this.viaCdn
4230
4245
  });
4231
4246
  const integrity = this.getIntegrityId();
4232
4247
  if (loopIntegrity == integrity && entities) {