bruce-models 3.7.1 → 3.7.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.
@@ -1287,7 +1287,7 @@ var HostingLocation;
1287
1287
  * This API is used to manage your data.
1288
1288
  */
1289
1289
  var BruceApi;
1290
- (function (BruceApi) {
1290
+ (function (BruceApi$$1) {
1291
1291
  /**
1292
1292
  * This is the request handler for Bruce Api,
1293
1293
  * it should be passed to any method that wants to communicate with this particular api.
@@ -1401,69 +1401,96 @@ var BruceApi;
1401
1401
  env: this.env
1402
1402
  });
1403
1403
  }
1404
- const env = this.env.toUpperCase();
1405
- const domain = this.getDomain();
1406
- const host = yield HostingLocation.GetByAccountId({
1404
+ const { account } = yield Account.Get({
1407
1405
  accountId: this.accountId,
1408
1406
  api: guardian
1409
1407
  });
1410
- if (host === null || host === void 0 ? void 0 : host.location) {
1411
- const settings = host.location.Settings;
1412
- if (!this.loadCancelled) {
1413
- // Attempt to load regional base url.
1414
- // First try go through settings.
1415
- let urlSet = false;
1416
- if (settings === null || settings === void 0 ? void 0 : settings.BruceAPIURL) {
1417
- let envUrl = settings.BruceAPIURL[env];
1418
- if (envUrl) {
1419
- envUrl = envUrl
1408
+ // Precalculated URLs exist.
1409
+ // Soon this will be a stable requirement for any account record.
1410
+ if (account.URL) {
1411
+ const urls = account.URL;
1412
+ if (urls === null || urls === void 0 ? void 0 : urls.Base) {
1413
+ this.baseUrl = urls.Base;
1414
+ }
1415
+ if (urls === null || urls === void 0 ? void 0 : urls.CDNEntities) {
1416
+ this.EntityCdnUrl = urls.CDNEntities;
1417
+ }
1418
+ if (urls === null || urls === void 0 ? void 0 : urls.CDNTileset) {
1419
+ this.TilesetCdnUrl = urls.CDNTileset;
1420
+ }
1421
+ if (urls === null || urls === void 0 ? void 0 : urls.CDNLegacyTileset) {
1422
+ this.LegacyTilesetCdnUrl = urls.CDNLegacyTileset;
1423
+ }
1424
+ if (urls === null || urls === void 0 ? void 0 : urls.CDNBase) {
1425
+ this.cdnBaseUrl = urls.CDNBase;
1426
+ }
1427
+ }
1428
+ // Deprecated and will eventually stop working at all.
1429
+ else {
1430
+ const env = this.env.toUpperCase();
1431
+ const domain = this.getDomain();
1432
+ const host = yield HostingLocation.GetByAccountId({
1433
+ accountId: this.accountId,
1434
+ api: guardian
1435
+ });
1436
+ if (host === null || host === void 0 ? void 0 : host.location) {
1437
+ const settings = host.location.Settings;
1438
+ if (!this.loadCancelled) {
1439
+ // Attempt to load regional base url.
1440
+ // First try go through settings.
1441
+ let urlSet = false;
1442
+ if (settings === null || settings === void 0 ? void 0 : settings.BruceAPIURL) {
1443
+ let envUrl = settings.BruceAPIURL[env];
1444
+ if (envUrl) {
1445
+ envUrl = envUrl
1446
+ .replace("<ACCOUNTID>", this.accountId)
1447
+ .replace("<ACCOUNT>", this.accountId);
1448
+ if (envUrl && envUrl.length > 1) {
1449
+ this.baseUrl = envUrl;
1450
+ urlSet = true;
1451
+ }
1452
+ }
1453
+ }
1454
+ // Try go through host location's base url.
1455
+ // This may be wrong env which is why it's used as fallback right now.
1456
+ if (!urlSet && host.location.BruceAPIURL) {
1457
+ const regionalUrl = host.location.BruceAPIURL
1420
1458
  .replace("<ACCOUNTID>", this.accountId)
1421
- .replace("<ACCOUNT>", this.accountId);
1422
- if (envUrl && envUrl.length > 1) {
1423
- this.baseUrl = envUrl;
1459
+ .replace("<ACCOUNT>", this.accountId)
1460
+ .replace("<DOMAIN>", domain);
1461
+ if (regionalUrl && regionalUrl.length > 1) {
1462
+ this.baseUrl = regionalUrl;
1424
1463
  urlSet = true;
1425
1464
  }
1426
1465
  }
1427
1466
  }
1428
- // Try go through host location's base url.
1429
- // This may be wrong env which is why it's used as fallback right now.
1430
- if (!urlSet && host.location.BruceAPIURL) {
1431
- const regionalUrl = host.location.BruceAPIURL
1432
- .replace("<ACCOUNTID>", this.accountId)
1433
- .replace("<ACCOUNT>", this.accountId)
1434
- .replace("<DOMAIN>", domain);
1435
- if (regionalUrl && regionalUrl.length > 1) {
1436
- this.baseUrl = regionalUrl;
1437
- urlSet = true;
1438
- }
1439
- }
1440
- }
1441
- // Attempt to load CDN settings.
1442
- if (settings === null || settings === void 0 ? void 0 : settings.CDN) {
1443
- this.EntityCdnUrl = (_a = settings.CDN.entityURL) === null || _a === void 0 ? void 0 : _a[env];
1444
- // We need to fix our configs.
1445
- if (this.EntityCdnUrl) {
1446
- if (this.EntityCdnUrl.includes("entitiesListForCDN")) {
1447
- this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", this.accountId);
1467
+ // Attempt to load CDN settings.
1468
+ if (settings === null || settings === void 0 ? void 0 : settings.CDN) {
1469
+ this.EntityCdnUrl = (_a = settings.CDN.entityURL) === null || _a === void 0 ? void 0 : _a[env];
1470
+ // We need to fix our configs.
1471
+ if (this.EntityCdnUrl) {
1472
+ if (this.EntityCdnUrl.includes("entitiesListForCDN")) {
1473
+ this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", this.accountId);
1474
+ }
1475
+ else {
1476
+ this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", "entitiesListForCDN/" + this.accountId);
1477
+ }
1448
1478
  }
1449
- else {
1450
- this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", "entitiesListForCDN/" + this.accountId);
1479
+ this.LegacyTilesetCdnUrl = (_b = settings.CDN.legacyTilesetURL) === null || _b === void 0 ? void 0 : _b[env];
1480
+ this.TilesetCdnUrl = (_c = settings.CDN.tilesetURL) === null || _c === void 0 ? void 0 : _c[env];
1481
+ if (this.TilesetCdnUrl) {
1482
+ this.TilesetCdnUrl = this.TilesetCdnUrl.replace("<ACCOUNT>", this.accountId);
1451
1483
  }
1452
- }
1453
- this.LegacyTilesetCdnUrl = (_b = settings.CDN.legacyTilesetURL) === null || _b === void 0 ? void 0 : _b[env];
1454
- this.TilesetCdnUrl = (_c = settings.CDN.tilesetURL) === null || _c === void 0 ? void 0 : _c[env];
1455
- if (this.TilesetCdnUrl) {
1456
- this.TilesetCdnUrl = this.TilesetCdnUrl.replace("<ACCOUNT>", this.accountId);
1457
- }
1458
- // TilesetCdnUrl example: "https://blah.cloudfront.net/tilesets/<TILESETID>/files/<FILEPATH>?accountId=<ACCOUNT>".
1459
- // Lazy at the moment to go around updating every region we have, I'll interpret the url from tilesetCdnUrl.
1460
- if (this.TilesetCdnUrl) {
1461
- try {
1462
- const url = new URL(this.TilesetCdnUrl);
1463
- this.cdnBaseUrl = `${url.protocol}//${url.hostname}/`;
1464
- }
1465
- catch (e) {
1466
- console.error(e);
1484
+ // TilesetCdnUrl example: "https://blah.cloudfront.net/tilesets/<TILESETID>/files/<FILEPATH>?accountId=<ACCOUNT>".
1485
+ // Lazy at the moment to go around updating every region we have, I'll interpret the url from tilesetCdnUrl.
1486
+ if (this.TilesetCdnUrl) {
1487
+ try {
1488
+ const url = new URL(this.TilesetCdnUrl);
1489
+ this.cdnBaseUrl = `${url.protocol}//${url.hostname}/`;
1490
+ }
1491
+ catch (e) {
1492
+ console.error(e);
1493
+ }
1467
1494
  }
1468
1495
  }
1469
1496
  }
@@ -1622,7 +1649,7 @@ var BruceApi;
1622
1649
  });
1623
1650
  }
1624
1651
  }
1625
- BruceApi.Api = Api$$1;
1652
+ BruceApi$$1.Api = Api$$1;
1626
1653
  })(BruceApi || (BruceApi = {}));
1627
1654
 
1628
1655
  /**
@@ -11092,7 +11119,7 @@ var DataSource;
11092
11119
  })(DataSource || (DataSource = {}));
11093
11120
 
11094
11121
  // This is updated with the package.json version on build.
11095
- const VERSION = "3.7.1";
11122
+ const VERSION = "3.7.3";
11096
11123
 
11097
11124
  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, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, ProjectViewLegacy, ProjectViewLegacyBookmark, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, Account, AccountInvite, AccountFeatures, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, ImportCad, ImportCsv, ImportJson, ImportKml, ImportedFile, Markup, Uploader, Plugin, ENVIRONMENT, DataSource };
11098
11125
  //# sourceMappingURL=bruce-models.es5.js.map