bruce-models 4.2.1 → 4.2.3

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.
@@ -1337,6 +1337,9 @@ var BruceApi;
1337
1337
  get ConfigLoadAttempted() {
1338
1338
  return this.configLoadAttempted;
1339
1339
  }
1340
+ get Version() {
1341
+ return this.version;
1342
+ }
1340
1343
  get Loading() {
1341
1344
  return this.loadProm;
1342
1345
  }
@@ -1386,6 +1389,16 @@ var BruceApi;
1386
1389
  forceLoad: true
1387
1390
  });
1388
1391
  }
1392
+ // Get the version.
1393
+ if (this.baseUrl) {
1394
+ const data = yield this.get(this.baseUrl + "version");
1395
+ if (data === null || data === void 0 ? void 0 : data["Bruce-API"]) {
1396
+ this.version = data["Bruce-API"];
1397
+ }
1398
+ else {
1399
+ this.version = "UNKNOWN";
1400
+ }
1401
+ }
1389
1402
  // Start web socket connection.
1390
1403
  if (loadWebSocket == true) {
1391
1404
  try {
@@ -1443,21 +1456,23 @@ var BruceApi;
1443
1456
  // Precalculated URLs exist.
1444
1457
  // Soon this will be a stable requirement for any account record.
1445
1458
  if (account.URL) {
1446
- const urls = account.URL;
1447
- if (urls === null || urls === void 0 ? void 0 : urls.Base) {
1448
- this.baseUrl = urls.Base;
1449
- }
1450
- if (urls === null || urls === void 0 ? void 0 : urls.CDNEntities) {
1451
- this.EntityCdnUrl = urls.CDNEntities;
1452
- }
1453
- if (urls === null || urls === void 0 ? void 0 : urls.CDNTileset) {
1454
- this.TilesetCdnUrl = urls.CDNTileset;
1455
- }
1456
- if (urls === null || urls === void 0 ? void 0 : urls.CDNLegacyTileset) {
1457
- this.LegacyTilesetCdnUrl = urls.CDNLegacyTileset;
1458
- }
1459
- if (urls === null || urls === void 0 ? void 0 : urls.CDNBase) {
1460
- this.cdnBaseUrl = urls.CDNBase;
1459
+ if (!this.loadCancelled) {
1460
+ const urls = account.URL;
1461
+ if (urls === null || urls === void 0 ? void 0 : urls.Base) {
1462
+ this.baseUrl = urls.Base;
1463
+ }
1464
+ if (urls === null || urls === void 0 ? void 0 : urls.CDNEntities) {
1465
+ this.EntityCdnUrl = urls.CDNEntities;
1466
+ }
1467
+ if (urls === null || urls === void 0 ? void 0 : urls.CDNTileset) {
1468
+ this.TilesetCdnUrl = urls.CDNTileset;
1469
+ }
1470
+ if (urls === null || urls === void 0 ? void 0 : urls.CDNLegacyTileset) {
1471
+ this.LegacyTilesetCdnUrl = urls.CDNLegacyTileset;
1472
+ }
1473
+ if (urls === null || urls === void 0 ? void 0 : urls.CDNBase) {
1474
+ this.cdnBaseUrl = urls.CDNBase;
1475
+ }
1461
1476
  }
1462
1477
  }
1463
1478
  // Deprecated and will eventually stop working at all.
@@ -3553,6 +3568,7 @@ var Entity;
3553
3568
  Entity.Update = Update;
3554
3569
  /**
3555
3570
  * Util to remove a tag from an entity.
3571
+ * @warning This does not save the entity record.
3556
3572
  * @param params
3557
3573
  */
3558
3574
  function RemoveTag(params) {
@@ -3568,6 +3584,7 @@ var Entity;
3568
3584
  Entity.RemoveTag = RemoveTag;
3569
3585
  /**
3570
3586
  * Util to add a tag to an entity.
3587
+ * @warning This does not save the entity record.
3571
3588
  * @param params
3572
3589
  */
3573
3590
  function AddTag(params) {
@@ -3582,6 +3599,7 @@ var Entity;
3582
3599
  Entity.AddTag = AddTag;
3583
3600
  /**
3584
3601
  * Util to set a value on an entity.
3602
+ * @warning This does not save the entity record.
3585
3603
  * @param params
3586
3604
  */
3587
3605
  function SetValue(params) {
@@ -3607,28 +3625,71 @@ var Entity;
3607
3625
  */
3608
3626
  function GetValue(params) {
3609
3627
  var _a;
3610
- const { entity: data, path } = params;
3611
- // Backwards compatibility.
3612
- if (path.length == 1 && path[0] == "ID") {
3628
+ let { entity: data, path, handleLegacy: checkAgainstLegacy } = params;
3629
+ if (checkAgainstLegacy == null) {
3630
+ checkAgainstLegacy = true;
3631
+ }
3632
+ // Backwards compatibility for incredibly old data.
3633
+ if (checkAgainstLegacy && path.length == 1 && path[0] == "ID") {
3613
3634
  return (_a = data.Bruce) === null || _a === void 0 ? void 0 : _a.ID;
3614
3635
  }
3615
- let curData = data;
3616
- for (let i = 0; i < path.length; i++) {
3617
- const step = path[i];
3618
- if (!curData[step]) {
3619
- return null;
3636
+ const checkForValue = (path) => {
3637
+ let curData = data;
3638
+ for (let i = 0; i < path.length; i++) {
3639
+ const step = path[i];
3640
+ if (!curData[step]) {
3641
+ return null;
3642
+ }
3643
+ if (i >= path.length - 1) {
3644
+ return curData[step];
3645
+ }
3646
+ curData = curData[step];
3620
3647
  }
3621
- if (i >= path.length - 1) {
3622
- return curData[step];
3648
+ return null;
3649
+ };
3650
+ // Check using the path provided.
3651
+ let value = checkForValue(path);
3652
+ // Check for the same path but in both top-level and internal data.
3653
+ // This is done for specific paths we're migrating.
3654
+ if (value == null && checkAgainstLegacy) {
3655
+ // We're migrating 2D vector data into the internal data.
3656
+ // So we'll check against both locations until migration is complete.
3657
+ // First we'll check against properties that could be found inside the internal section.
3658
+ if (path[0] == "location") {
3659
+ value = checkForValue(["Bruce"].concat(path));
3660
+ }
3661
+ else if (path[0] == "transform") {
3662
+ value = checkForValue(["Bruce"].concat(path));
3663
+ }
3664
+ else if (path[0] == "geometry") {
3665
+ value = checkForValue(["Bruce"].concat(path));
3666
+ }
3667
+ else if (path[0] == "boundaries") {
3668
+ value = checkForValue(["Bruce"].concat(path));
3669
+ }
3670
+ // Now we'll check against properties that could still be in the top-level and haven't been migrated yet.
3671
+ if (path[0] == "Bruce" && path.length > 1) {
3672
+ if (path[1] == "location") {
3673
+ value = checkForValue(path.slice(1));
3674
+ }
3675
+ else if (path[1] == "transform") {
3676
+ value = checkForValue(path.slice(1));
3677
+ }
3678
+ else if (path[1] == "geometry") {
3679
+ value = checkForValue(path.slice(1));
3680
+ }
3681
+ else if (path[1] == "boundaries") {
3682
+ value = checkForValue(path.slice(1));
3683
+ }
3623
3684
  }
3624
- curData = curData[step];
3625
3685
  }
3626
- return null;
3686
+ return value;
3627
3687
  }
3628
3688
  Entity.GetValue = GetValue;
3629
3689
  /**
3630
3690
  * Removes a value from an entity.
3631
3691
  * This will mutate the entity record and run "delete" on the object property.
3692
+ * @warning This does not save the entity record.
3632
3693
  * @param params
3633
3694
  */
3634
3695
  function RemoveValue(params) {
@@ -13164,7 +13225,7 @@ var DataSource;
13164
13225
  })(DataSource || (DataSource = {}));
13165
13226
 
13166
13227
  // This is updated with the package.json version on build.
13167
- const VERSION = "4.2.1";
13228
+ const VERSION = "4.2.3";
13168
13229
 
13169
13230
  export { VERSION, AnnDocument, CustomForm, AbstractApi, Api, BruceApi, GlobalApi, GuardianApi, ApiGetters, Calculator, Bounds, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, BruceVariable, LRUCache, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityLodCategory, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityCoords, EntityTypeVisualSettings, EntityAttribute, EntityHistoricData, 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, ImportCad, ImportCsv, ImportJson, ImportKml, ImportedFile, Markup, Uploader, Plugin, ENVIRONMENT, DataSource };
13170
13231
  //# sourceMappingURL=bruce-models.es5.js.map