bruce-models 5.4.3 → 5.4.4

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.
@@ -307,6 +307,19 @@ function parseResult(data) {
307
307
  return text;
308
308
  });
309
309
  }
310
+ /**
311
+ * Ensuring obvious faults in our session ID storage don't waste DB time.
312
+ * @param ssid
313
+ * @returns
314
+ */
315
+ const prepSessionId = (ssid) => {
316
+ let tmp = ssid;
317
+ if (!tmp || "null" == tmp || "undefined" == tmp) {
318
+ tmp = "";
319
+ }
320
+ // Anonymous SSID will mean Guardian doesn't bother touching the DB.
321
+ return tmp ? tmp : "anonymous";
322
+ };
310
323
  /**
311
324
  * This is a base class for communication with an arbitrary Nextspace API.
312
325
  */
@@ -382,14 +395,14 @@ class AbstractApi {
382
395
  * @returns
383
396
  */
384
397
  GetSessionId() {
385
- return this.ssid;
398
+ return prepSessionId(this.ssid);
386
399
  }
387
400
  /**
388
401
  * Sets the session ID.
389
402
  * @param value
390
403
  */
391
404
  SetSessionId(value) {
392
- this.ssid = value;
405
+ this.ssid = prepSessionId(value);
393
406
  }
394
407
  /**
395
408
  * Returns the session header.
@@ -419,8 +432,8 @@ class AbstractApi {
419
432
  }
420
433
  params.headers = params.headers || {};
421
434
  params.headers = Object.assign({ "Content-Type": "application/json;" }, params.headers);
422
- if (this.ssidHeader && this.ssid) {
423
- params.headers[this.ssidHeader] = this.ssid;
435
+ if (this.ssidHeader) {
436
+ params.headers[this.ssidHeader] = this.GetSessionId();
424
437
  }
425
438
  const res = yield fetch(url, {
426
439
  headers: params.headers,
@@ -443,8 +456,8 @@ class AbstractApi {
443
456
  }
444
457
  params.headers = params.headers || {};
445
458
  params.headers = Object.assign({ "Content-Type": "application/json;" }, params.headers);
446
- if (this.ssidHeader && this.ssid) {
447
- params.headers[this.ssidHeader] = this.ssid;
459
+ if (this.ssidHeader) {
460
+ params.headers[this.ssidHeader] = this.GetSessionId();
448
461
  }
449
462
  const res = yield fetch(url, {
450
463
  headers: params.headers,
@@ -469,8 +482,8 @@ class AbstractApi {
469
482
  }
470
483
  params.headers = params.headers || {};
471
484
  params.headers = Object.assign({ "Content-Type": "application/json;" }, params.headers);
472
- if (this.ssidHeader && this.ssid) {
473
- params.headers[this.ssidHeader] = this.ssid;
485
+ if (this.ssidHeader) {
486
+ params.headers[this.ssidHeader] = this.GetSessionId();
474
487
  }
475
488
  if (!data) {
476
489
  data = {};
@@ -502,8 +515,8 @@ class AbstractApi {
502
515
  }
503
516
  params.headers = params.headers || {};
504
517
  params.headers = Object.assign({ "Content-Type": "application/json;" }, params.headers);
505
- if (this.ssidHeader && this.ssid) {
506
- params.headers[this.ssidHeader] = this.ssid;
518
+ if (this.ssidHeader) {
519
+ params.headers[this.ssidHeader] = this.GetSessionId();
507
520
  }
508
521
  if (!data) {
509
522
  data = {};
@@ -534,8 +547,8 @@ class AbstractApi {
534
547
  params = {};
535
548
  }
536
549
  params.headers = Object.assign({}, params.headers);
537
- if (this.ssidHeader && this.ssid) {
538
- params.headers[this.ssidHeader] = this.ssid;
550
+ if (this.ssidHeader) {
551
+ params.headers[this.ssidHeader] = this.GetSessionId();
539
552
  }
540
553
  const formData = params.formData instanceof FormData ? params.formData : new FormData();
541
554
  if (formData.has("file")) {
@@ -14745,7 +14758,7 @@ var DataSource;
14745
14758
  })(DataSource || (DataSource = {}));
14746
14759
 
14747
14760
  // This is updated with the package.json version on build.
14748
- const VERSION = "5.4.3";
14761
+ const VERSION = "5.4.4";
14749
14762
 
14750
14763
  export { VERSION, AnnDocument, CustomForm, AbstractApi, Api, BruceApi, GlobalApi, GuardianApi, ApiGetters, Calculator, Bounds, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, BruceVariable, LRUCache, GeoJson, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityLodCategory, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityCoords, EntityTypeVisualSettings, EntityAttribute, EntityHistoricData, EntityTableView, Comment, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, ProjectViewLegacy, ProjectViewLegacyBookmark, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, Account, AccountInvite, AccountFeatures, AccountLimits, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, DataLabGroup, ImportAssembly, ImportCad, ImportCsv, ImportJson, ImportGeoJson, ImportKml, ImportedFile, ExportBrz, ExportUsd, Markup, Uploader, Plugin, ENVIRONMENT, DataSource };
14751
14764
  //# sourceMappingURL=bruce-models.es5.js.map