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.
@@ -466,12 +466,18 @@ class CacheControl {
466
466
  }
467
467
  }
468
468
 
469
+ // TODO: Currently checks for CSV vs json specifically,
470
+ // Need to see if our api is generally good at setting content-type headers.
471
+ // Make it less specific to CSV.
469
472
  function parseResult(data) {
470
473
  return __awaiter(this, void 0, void 0, function* () {
471
474
  if (data.status == 200) {
475
+ let type = data.headers.get("Content-Type");
476
+ if (type) {
477
+ type = type.trim().toLowerCase();
478
+ }
472
479
  let encoding = "";
473
- const type = data.headers.get("Content-Type");
474
- const charset = type ? type.split(";").find((x) => x.trim().toLowerCase().startsWith("charset=")) : "";
480
+ const charset = type ? type.split(";").find((x) => x.startsWith("charset=")) : "";
475
481
  if (charset && charset.includes("=")) {
476
482
  encoding = charset.split("=")[1];
477
483
  encoding = encoding.toLowerCase();
@@ -485,11 +491,18 @@ function parseResult(data) {
485
491
  if (!text || !text.trim()) {
486
492
  return null;
487
493
  }
494
+ if (type && type.includes("text/csv")) {
495
+ return text;
496
+ }
488
497
  return JSON.parse(text);
489
498
  }
490
499
  else {
491
500
  const buffer = yield data.arrayBuffer();
492
- return JSON.parse(new TextDecoder(encoding).decode(buffer));
501
+ const text = new TextDecoder(encoding).decode(buffer);
502
+ if (type && type.includes("text/csv")) {
503
+ return text;
504
+ }
505
+ return JSON.parse(text);
493
506
  }
494
507
  }
495
508
  else {
@@ -4145,7 +4158,7 @@ var EntityFilterGetter;
4145
4158
  EStatus["Loading"] = "LOADING";
4146
4159
  })(EStatus = EntityFilterGetter.EStatus || (EntityFilterGetter.EStatus = {}));
4147
4160
  class Getter {
4148
- constructor(api, viewPort, typeId, batchSize, attrFilter) {
4161
+ constructor(api, viewPort, typeId, batchSize, attrFilter, viaCdn) {
4149
4162
  this.onUpdate = null;
4150
4163
  this.LastStateUpdates = {};
4151
4164
  this.onStateUpdate = null;
@@ -4161,7 +4174,8 @@ var EntityFilterGetter;
4161
4174
  this.viewCenter = null;
4162
4175
  this.api = api;
4163
4176
  this.typeId = typeId;
4164
- this.batchSize = batchSize;
4177
+ this.viaCdn = Boolean(viaCdn);
4178
+ this.batchSize = isNaN(batchSize) ? 300 : batchSize;
4165
4179
  this.viewPort = viewPort;
4166
4180
  this.attrFilter = attrFilter;
4167
4181
  this.updateBounds();
@@ -4338,7 +4352,8 @@ var EntityFilterGetter;
4338
4352
  bounds: curCell.GetBounds(),
4339
4353
  sortOrder: Api.ESortOrder.Asc,
4340
4354
  entityTypeConditions: this.attrFilter
4341
- }
4355
+ },
4356
+ viaCdn: this.viaCdn
4342
4357
  });
4343
4358
  const integrity = this.getIntegrityId();
4344
4359
  if (loopIntegrity == integrity && entities) {