bruce-models 7.1.46 → 7.1.48

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.
@@ -1475,6 +1475,8 @@ var GuardianApi;
1475
1475
  */
1476
1476
  var BruceApi;
1477
1477
  (function (BruceApi$$1) {
1478
+ // Minimum API version that supports server-side token proxies.
1479
+ BruceApi$$1.VERSION_WITH_PROXIES = "1.0.6437";
1478
1480
  /**
1479
1481
  * This is the request handler for Bruce Api,
1480
1482
  * it should be passed to any method that wants to communicate with this particular api.
@@ -1578,6 +1580,16 @@ var BruceApi;
1578
1580
  this.version = "UNKNOWN";
1579
1581
  }
1580
1582
  }
1583
+ // Same version as the proxy-update we started supporting an accountId/subdomain prefix.
1584
+ // We can upgrade URLs automatically so anything using them for proxies doesn't have to manage query params.
1585
+ // Eg: "/v3/entity/abc?accountId=template" would become "/A:template/v3/entity/abc".
1586
+ if (this.IsVersionAtLeast(BruceApi$$1.VERSION_WITH_PROXIES)) {
1587
+ this.baseUrl = Api$$1.rewriteAccountIdToPath(this.baseUrl);
1588
+ this.cdnBaseUrl = Api$$1.rewriteAccountIdToPath(this.cdnBaseUrl);
1589
+ this.EntityCdnUrl = Api$$1.rewriteAccountIdToPath(this.EntityCdnUrl);
1590
+ this.TilesetCdnUrl = Api$$1.rewriteAccountIdToPath(this.TilesetCdnUrl);
1591
+ this.LegacyTilesetCdnUrl = Api$$1.rewriteAccountIdToPath(this.LegacyTilesetCdnUrl);
1592
+ }
1581
1593
  // Start web socket connection.
1582
1594
  if (loadWebSocket == true) {
1583
1595
  try {
@@ -1591,6 +1603,34 @@ var BruceApi;
1591
1603
  }
1592
1604
  });
1593
1605
  }
1606
+ /**
1607
+ * Moves query param specified accountId/subdomain to be a prefix segment in the URL path.
1608
+ * Eg: "/v3/entity/abc?accountId=template" would become "/A:template/v3/entity/abc".
1609
+ * If no accountId param is present or the URL is invalid, returns the URL unchanged.
1610
+ */
1611
+ static rewriteAccountIdToPath(url) {
1612
+ if (!url) {
1613
+ return url;
1614
+ }
1615
+ try {
1616
+ const parsed = new URL(url);
1617
+ const accountId = parsed.searchParams.get("accountId");
1618
+ if (!accountId) {
1619
+ return url;
1620
+ }
1621
+ parsed.searchParams.delete("accountId");
1622
+ // Prepend A:<id>/ to the existing pathname.
1623
+ let path = parsed.pathname;
1624
+ if (!path.endsWith("/")) {
1625
+ path += "/";
1626
+ }
1627
+ parsed.pathname = path + `A:${accountId}/`;
1628
+ return parsed.toString();
1629
+ }
1630
+ catch (e) {
1631
+ return url;
1632
+ }
1633
+ }
1594
1634
  getDomain() {
1595
1635
  const env = this.env.toUpperCase();
1596
1636
  let domain = "nextspace.host";
@@ -18949,7 +18989,7 @@ var UrlUtils;
18949
18989
  })(UrlUtils || (UrlUtils = {}));
18950
18990
 
18951
18991
  // This is updated with the package.json version on build.
18952
- const VERSION = "7.1.46";
18992
+ const VERSION = "7.1.48";
18953
18993
 
18954
18994
  export { VERSION, Account, AccountConcept, AccountFeatures, AccountInvite, AccountLimits, AccountTemplate, AccountType, AnnDocument, AbstractApi, Api, ApiGetters, BruceApi, GlobalApi, GuardianApi, Assembly, Calculator, ChangeSet, ClientFile, Bounds, BruceEvent, BruceVariable, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, GeoJson, Geometry, LRUCache, UTC, CustomForm, DashboardView, DataFeed, DataLab, DataLabGroup, DataSource, DataTransform, Comment, Entity, EntityAttachment, EntityAttachmentType, EntityAttribute, EntityComment, EntityCoords, EntityHistoricData, EntityLink, EntityLod, EntityLodCategory, EntityRelation, EntityRelationType, EntitySource, EntityTableView, EntityTag, EntityType, EntityTypeTrigger, ENVIRONMENT, ExportBrz, ExportUsd, ImportAssembly, ImportCad, ImportCsv, ImportGeoJson, ImportJson, ImportKml, ImportLcc, ImportedFile, Uploader, Markup, NAVIGATOR_CHAT_EVENT_ENTITY_HIGHLIGHT_APPLIED, NAVIGATOR_CHAT_EVENT_SCENE_CONTEXT_PREFETCHED, NavigatorChatClient, NavigatorMcpWebSocketClient, Plugin, ProgramKey, MenuItem, ProjectView, ProjectViewBookmark, ProjectViewBookmarkGroup, ProjectViewLegacy, ProjectViewLegacyBookmark, ProjectViewLegacyTile, ProjectViewTile, ZoomControl, Scenario, HostingLocation, MessageBroker, PendingAction, RecordChangeFeed, Style, Tileset, Tracking, Permission, Session, User, UserGroup, UserMfaMethod, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils };
18955
18995
  //# sourceMappingURL=bruce-models.es5.js.map