bruce-models 5.4.1 → 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")) {
@@ -749,7 +762,8 @@ var GuardianApi;
749
762
  url += ".host/";
750
763
  break;
751
764
  default:
752
- throw ("Specified Environment is not valid. SuppliedEnv=" + env);
765
+ console.warn("Supplied environment does not match default options. You will need to set the base url manually. SuppliedEnv=" + env);
766
+ return;
753
767
  }
754
768
  this.baseUrl = url;
755
769
  }
@@ -860,6 +874,9 @@ var BruceApi;
860
874
  this.loadCancelled = false;
861
875
  // Indicates if loading the regional configuration was already called.
862
876
  this.configLoadAttempted = false;
877
+ // Indicates if the init process has finished loading.
878
+ // While this is not resolved requests will be in a pending state.
879
+ this.loadProm = Promise.resolve();
863
880
  let { accountId, env, guardian, loadRegionalBaseUrl, loadConfig, loadWebSocket, dummy } = params;
864
881
  this.accountId = accountId;
865
882
  this.env = env !== null && env !== void 0 ? env : Api.EEnv.PROD;
@@ -14741,7 +14758,7 @@ var DataSource;
14741
14758
  })(DataSource || (DataSource = {}));
14742
14759
 
14743
14760
  // This is updated with the package.json version on build.
14744
- const VERSION = "5.4.1";
14761
+ const VERSION = "5.4.4";
14745
14762
 
14746
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 };
14747
14764
  //# sourceMappingURL=bruce-models.es5.js.map