bruce-models 0.7.4 → 0.7.6

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.
Files changed (33) hide show
  1. package/dist/bruce-models.es5.js +187 -13
  2. package/dist/bruce-models.es5.js.map +1 -1
  3. package/dist/bruce-models.umd.js +184 -11
  4. package/dist/bruce-models.umd.js.map +1 -1
  5. package/dist/lib/api/bruce-api.js +30 -4
  6. package/dist/lib/api/bruce-api.js.map +1 -1
  7. package/dist/lib/api/cam-api.js.map +1 -1
  8. package/dist/lib/api/global-api.js.map +1 -1
  9. package/dist/lib/api/idm-api.js.map +1 -1
  10. package/dist/lib/bruce-models.js +2 -1
  11. package/dist/lib/bruce-models.js.map +1 -1
  12. package/dist/lib/entity/entity.js +11 -2
  13. package/dist/lib/entity/entity.js.map +1 -1
  14. package/dist/lib/project/project-view-bookmark.js +11 -0
  15. package/dist/lib/project/project-view-bookmark.js.map +1 -1
  16. package/dist/lib/project/{project-view-tile-source.js → project-view-legacy-tile.js} +8 -8
  17. package/dist/lib/project/project-view-legacy-tile.js.map +1 -0
  18. package/dist/lib/project/project-view-tile.js +120 -0
  19. package/dist/lib/project/project-view-tile.js.map +1 -0
  20. package/dist/lib/project/project-view.js +11 -0
  21. package/dist/lib/project/project-view.js.map +1 -1
  22. package/dist/types/api/bruce-api.d.ts +22 -2
  23. package/dist/types/api/cam-api.d.ts +1 -1
  24. package/dist/types/api/global-api.d.ts +1 -1
  25. package/dist/types/api/idm-api.d.ts +1 -1
  26. package/dist/types/bruce-models.d.ts +2 -1
  27. package/dist/types/entity/entity.d.ts +10 -1
  28. package/dist/types/project/project-view-bookmark.d.ts +85 -36
  29. package/dist/types/project/{project-view-tile-source.d.ts → project-view-legacy-tile.d.ts} +1 -1
  30. package/dist/types/project/project-view-tile.d.ts +68 -0
  31. package/dist/types/project/project-view.d.ts +64 -39
  32. package/package.json +1 -1
  33. package/dist/lib/project/project-view-tile-source.js.map +0 -1
@@ -923,22 +923,30 @@ var BruceApi;
923
923
  */
924
924
  var Api$$1 = /** @class */ (function (_super) {
925
925
  __extends(Api$$1, _super);
926
- function Api$$1(accountId, env) {
926
+ /**
927
+ * @param accountId
928
+ * @param env (Optional) environment to use, this will default to PROD.
929
+ * @param cam (Optional) cam instance to use for loading the regional base url.
930
+ */
931
+ function Api$$1(accountId, env, cam) {
927
932
  var _this = _super.call(this, "x-sessionid") || this;
928
933
  _this.baseUrl = "";
934
+ _this.loadCancelled = false;
929
935
  _this.accountId = accountId;
930
936
  _this.env = env !== null && env !== void 0 ? env : Api.EEnv.PROD;
931
- _this.loadProm = _this.setBaseUrl();
937
+ _this.loadProm = _this.setBaseUrl(cam);
932
938
  return _this;
933
939
  }
934
940
  Object.defineProperty(Api$$1.prototype, "Loading", {
941
+ // Indicates if the init process has finished loading.
942
+ // This means the regional base url has been set.
935
943
  get: function () {
936
944
  return this.loadProm;
937
945
  },
938
946
  enumerable: false,
939
947
  configurable: true
940
948
  });
941
- Api$$1.prototype.setBaseUrl = function () {
949
+ Api$$1.prototype.setBaseUrl = function (cam) {
942
950
  var _a;
943
951
  return __awaiter(this, void 0, void 0, function () {
944
952
  var prefix, url, env, camApi, settings, endpoint, e_1;
@@ -967,10 +975,14 @@ var BruceApi;
967
975
  _b.label = 1;
968
976
  case 1:
969
977
  _b.trys.push([1, 3, , 4]);
970
- camApi = new CamApi.Api(env);
978
+ camApi = cam ? cam : new CamApi.Api(env);
971
979
  return [4 /*yield*/, Account.GetAppSettings(camApi, this.accountId, Account.EAppId.BruceApi)];
972
980
  case 2:
973
981
  settings = _b.sent();
982
+ if (this.loadCancelled) {
983
+ console.warn("BruceApi: Loading was cancelled due to SetBaseUrl being called, not setting regional base url.");
984
+ return [2 /*return*/];
985
+ }
974
986
  endpoint = (_a = settings.BruceAPIURL) === null || _a === void 0 ? void 0 : _a[env];
975
987
  if (typeof endpoint == "string") {
976
988
  if (!endpoint.endsWith("/")) {
@@ -988,14 +1000,28 @@ var BruceApi;
988
1000
  });
989
1001
  });
990
1002
  };
1003
+ /**
1004
+ * Warning: This method does not wait for init to finish loading.
1005
+ * This means the url could be changed once fully initialized.
1006
+ * The url will be valid either way, but the loaded one may be faster as it is region specific.
1007
+ * Await the "Loading" promise if you care about this.
1008
+ * @returns
1009
+ */
991
1010
  Api$$1.prototype.GetBaseUrl = function () {
992
1011
  return this.baseUrl;
993
1012
  };
1013
+ /**
1014
+ * Warning: This will cancel the init process.
1015
+ * The init process loads a region specific endpoint.
1016
+ * Setting a base url will stop that process from completing.
1017
+ * @param url
1018
+ */
994
1019
  Api$$1.prototype.SetBaseUrl = function (url) {
995
1020
  this.baseUrl = url;
996
1021
  if (!this.baseUrl.endsWith("/")) {
997
1022
  this.baseUrl += "/";
998
1023
  }
1024
+ this.loadCancelled = true;
999
1025
  };
1000
1026
  Api$$1.prototype.GET = function (url, params) {
1001
1027
  return __awaiter(this, void 0, void 0, function () {
@@ -1593,7 +1619,16 @@ var Entity;
1593
1619
  return null;
1594
1620
  }
1595
1621
  Entity.GetValue = GetValue;
1596
- function CalculateName(entity, type) {
1622
+ /**
1623
+ * Calculates an entity's name based on attribute priority set in the type.
1624
+ * @param entity
1625
+ * @param type
1626
+ * @param defaultToId
1627
+ * If true, will return the entity ID if no name can be calculated.
1628
+ * Otherwise it returns null.
1629
+ * @returns
1630
+ */
1631
+ function CalculateName(entity, type, defaultToId) {
1597
1632
  var attrStr = type.DisplayNameAttributePath;
1598
1633
  if (attrStr) {
1599
1634
  var attrPaths = attrStr.split(",");
@@ -1606,7 +1641,7 @@ var Entity;
1606
1641
  }
1607
1642
  }
1608
1643
  }
1609
- return entity.Bruce.ID;
1644
+ return defaultToId ? entity.Bruce.ID : null;
1610
1645
  }
1611
1646
  Entity.CalculateName = CalculateName;
1612
1647
  var Filter;
@@ -5009,6 +5044,17 @@ var ProjectViewBookmark;
5009
5044
  return "" + Api.ECacheKey.ProjectViewBookmark + Api.ECacheKey.Id + viewId;
5010
5045
  }
5011
5046
  ProjectViewBookmark.GetListCacheKey = GetListCacheKey;
5047
+ // This is the expected default version for the DataVersion value.
5048
+ // This value should NOT be changed without looking at our API and seeing what the default value is.
5049
+ ProjectViewBookmark.DEFAULT_DATA_VERSION = 1;
5050
+ var V1;
5051
+ (function (V1) {
5052
+ V1.DATA_VERSION = 1;
5053
+ })(V1 = ProjectViewBookmark.V1 || (ProjectViewBookmark.V1 = {}));
5054
+ var V2;
5055
+ (function (V2) {
5056
+ V2.DATA_VERSION = 2;
5057
+ })(V2 = ProjectViewBookmark.V2 || (ProjectViewBookmark.V2 = {}));
5012
5058
  function Get(api, viewId, bookmarkId) {
5013
5059
  return __awaiter(this, void 0, void 0, function () {
5014
5060
  var key, cacheData, req;
@@ -5140,6 +5186,17 @@ var ProjectView;
5140
5186
  return Api.ECacheKey.ProjectView;
5141
5187
  }
5142
5188
  ProjectView.GetListCacheKey = GetListCacheKey;
5189
+ // This is the expected default version for the DataVersion value.
5190
+ // This value should NOT be changed without looking at our API and seeing what the default value is.
5191
+ ProjectView.DEFAULT_DATA_VERSION = 1;
5192
+ var V1;
5193
+ (function (V1) {
5194
+ V1.DATA_VERSION = 1;
5195
+ })(V1 = ProjectView.V1 || (ProjectView.V1 = {}));
5196
+ var V2;
5197
+ (function (V2) {
5198
+ V2.DATA_VERSION = 2;
5199
+ })(V2 = ProjectView.V2 || (ProjectView.V2 = {}));
5143
5200
  function Get(api, viewId) {
5144
5201
  return __awaiter(this, void 0, void 0, function () {
5145
5202
  var key, cacheData, req;
@@ -5257,7 +5314,7 @@ function getTemplateSettings(apiGetter) {
5257
5314
  var view;
5258
5315
  return __generator(this, function (_b) {
5259
5316
  switch (_b.label) {
5260
- case 0: return [4 /*yield*/, ProjectView.Get(apiGetter.getApi(Api.TEMPLATE_ACCOUNT_ID, apiGetter.env), "default")];
5317
+ case 0: return [4 /*yield*/, ProjectView.Get(apiGetter.getApi(Api.TEMPLATE_ACCOUNT_ID), "default")];
5261
5318
  case 1:
5262
5319
  view = _b.sent();
5263
5320
  return [2 /*return*/, (_a = view.Settings) !== null && _a !== void 0 ? _a : {}];
@@ -5282,8 +5339,8 @@ function checkSourceToTemplate(items, templateItem, addIfMissing) {
5282
5339
  * This is a concept we want to trash as we're moving towards storing tileset ids instead.
5283
5340
  * This will help at least understand and manage this dying concept.
5284
5341
  */
5285
- var ProjectViewTileSource;
5286
- (function (ProjectViewTileSource) {
5342
+ var ProjectViewLegacyTile;
5343
+ (function (ProjectViewLegacyTile) {
5287
5344
  function MergeMapTemplateData(getter, items, addIfMissing) {
5288
5345
  var _a;
5289
5346
  return __awaiter(this, void 0, void 0, function () {
@@ -5303,7 +5360,7 @@ var ProjectViewTileSource;
5303
5360
  });
5304
5361
  });
5305
5362
  }
5306
- ProjectViewTileSource.MergeMapTemplateData = MergeMapTemplateData;
5363
+ ProjectViewLegacyTile.MergeMapTemplateData = MergeMapTemplateData;
5307
5364
  function MergeTerrainTemplateData(getter, items, addIfMissing) {
5308
5365
  var _a;
5309
5366
  return __awaiter(this, void 0, void 0, function () {
@@ -5323,8 +5380,125 @@ var ProjectViewTileSource;
5323
5380
  });
5324
5381
  });
5325
5382
  }
5326
- ProjectViewTileSource.MergeTerrainTemplateData = MergeTerrainTemplateData;
5327
- })(ProjectViewTileSource || (ProjectViewTileSource = {}));
5383
+ ProjectViewLegacyTile.MergeTerrainTemplateData = MergeTerrainTemplateData;
5384
+ })(ProjectViewLegacyTile || (ProjectViewLegacyTile = {}));
5385
+
5386
+ var ProjectViewTile;
5387
+ (function (ProjectViewTile) {
5388
+ var EDefaultImagery;
5389
+ (function (EDefaultImagery) {
5390
+ EDefaultImagery["BingMapsAerial"] = "bingmapsaerial";
5391
+ EDefaultImagery["BingMapsAerialWithLabels"] = "bingmapsaerialwithlabels";
5392
+ EDefaultImagery["BingMapsRoads"] = "bingmapsroads";
5393
+ EDefaultImagery["MapboxSatellite"] = "mapboxsatellite";
5394
+ EDefaultImagery["MapBoxStreets"] = "mapboxstreets";
5395
+ EDefaultImagery["MapBoxStreetsClassic"] = "mapboxstreetsclassic";
5396
+ EDefaultImagery["EsriWorldImagery"] = "esriworldimagery";
5397
+ EDefaultImagery["EsriWorldStreetMap"] = "esriworldstreetmap";
5398
+ EDefaultImagery["EsriNationalGeographic"] = "esrinationalgeographic";
5399
+ EDefaultImagery["OpenStreetMap"] = "openstreetmap";
5400
+ EDefaultImagery["StamenWaterColor"] = "stamenwatercolor";
5401
+ EDefaultImagery["StamenToner"] = "stamentoner";
5402
+ EDefaultImagery["Grid"] = "grid";
5403
+ })(EDefaultImagery = ProjectViewTile.EDefaultImagery || (ProjectViewTile.EDefaultImagery = {}));
5404
+ /**
5405
+ * Prepared array for UI.
5406
+ * TODO: Im not happy with icon urls sitting in the code. I'd prefer we ship these icons in the library as files.
5407
+ */
5408
+ ProjectViewTile.DefaultImagery = [
5409
+ {
5410
+ id: EDefaultImagery.BingMapsAerial,
5411
+ name: "Bing Maps Aerial",
5412
+ iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/bingAerial.png"
5413
+ },
5414
+ {
5415
+ id: EDefaultImagery.BingMapsAerialWithLabels,
5416
+ name: "Bing Maps Aerial with Labels",
5417
+ iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/bingAerialLabels.png"
5418
+ },
5419
+ {
5420
+ id: EDefaultImagery.BingMapsRoads,
5421
+ name: "Bing Maps Roads",
5422
+ iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/bingRoads.png"
5423
+ },
5424
+ {
5425
+ id: EDefaultImagery.MapboxSatellite,
5426
+ name: "Mapbox Satellite",
5427
+ iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/mapboxSatellite.png"
5428
+ },
5429
+ {
5430
+ id: EDefaultImagery.MapBoxStreets,
5431
+ name: "Mapbox Streets",
5432
+ iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/mapboxTerrain.png"
5433
+ },
5434
+ {
5435
+ id: EDefaultImagery.MapBoxStreetsClassic,
5436
+ name: "Mapbox Streets Classic",
5437
+ iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/mapboxStreets.png"
5438
+ },
5439
+ {
5440
+ id: EDefaultImagery.EsriWorldImagery,
5441
+ name: "Esri World Imagery",
5442
+ iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/esriWorldImagery.png"
5443
+ },
5444
+ {
5445
+ id: EDefaultImagery.EsriWorldStreetMap,
5446
+ name: "Esri World Street Map",
5447
+ iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/esriWorldStreetMap.png"
5448
+ },
5449
+ {
5450
+ id: EDefaultImagery.EsriNationalGeographic,
5451
+ name: "Esri National Geographic",
5452
+ iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/esriNationalGeographic.png"
5453
+ },
5454
+ {
5455
+ id: EDefaultImagery.OpenStreetMap,
5456
+ name: "Open Street Map",
5457
+ iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/openStreetMap.png"
5458
+ },
5459
+ {
5460
+ id: EDefaultImagery.StamenWaterColor,
5461
+ name: "Stamen Water Color",
5462
+ iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/stamenWatercolor.png"
5463
+ },
5464
+ {
5465
+ id: EDefaultImagery.StamenToner,
5466
+ name: "Stamen Toner",
5467
+ iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/stamenToner.png"
5468
+ },
5469
+ {
5470
+ id: EDefaultImagery.Grid,
5471
+ name: "Grid",
5472
+ iconUrl: "https://template.api.nextspace-uat.net/file/2885d8df-028b-4f5c-80b3-2634f7e7cf69.png"
5473
+ }
5474
+ ];
5475
+ var EDefaultTerrain;
5476
+ (function (EDefaultTerrain) {
5477
+ EDefaultTerrain["CesiumWorldTerrain"] = "cesiumworldterrain";
5478
+ EDefaultTerrain["FlatTerrain"] = "flatterrain";
5479
+ EDefaultTerrain["LINZ"] = "linz";
5480
+ })(EDefaultTerrain = ProjectViewTile.EDefaultTerrain || (ProjectViewTile.EDefaultTerrain = {}));
5481
+ /**
5482
+ * Prepared array for UI.
5483
+ * TODO: Im not happy with icon urls sitting in the code. I'd prefer we ship these icons in the library as files.
5484
+ */
5485
+ ProjectViewTile.DefaultTerrains = [
5486
+ {
5487
+ id: EDefaultTerrain.CesiumWorldTerrain,
5488
+ name: "Cesium World Terrain",
5489
+ iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/TerrainProviders/CesiumWorldTerrain.png"
5490
+ },
5491
+ {
5492
+ id: EDefaultTerrain.LINZ,
5493
+ name: "LINZ",
5494
+ iconUrl: "https://template.ui.nextspace.host/media/linz.jpg"
5495
+ },
5496
+ {
5497
+ id: EDefaultTerrain.FlatTerrain,
5498
+ name: "Flat Terrain",
5499
+ }
5500
+ ];
5501
+ })(ProjectViewTile || (ProjectViewTile = {}));
5328
5502
 
5329
5503
  /**
5330
5504
  * Describes the "Pending Action" concept within Bruce.
@@ -6523,5 +6697,5 @@ var ImportedFile;
6523
6697
  ImportedFile.Get = Get;
6524
6698
  })(ImportedFile || (ImportedFile = {}));
6525
6699
 
6526
- export { AnnDocument, CustomForm, AbstractApi, Api, BruceApi, CamApi, IdmApi, GlobalApi, Calculator, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityGlobe, EntityFilterGetter, BatchedDataGetter, EntityCoords, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewTileSource, PendingAction, Style, TilesetEntitiesMapTiles, TilesetExtMapTiles, Tileset, Permission, Session, UserGroup, User, Account, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, ImportCad, ImportCsv, ImportJson, ImportKml, ImportedFile };
6700
+ export { AnnDocument, CustomForm, AbstractApi, Api, BruceApi, CamApi, IdmApi, GlobalApi, Calculator, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityGlobe, EntityFilterGetter, BatchedDataGetter, EntityCoords, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, PendingAction, Style, TilesetEntitiesMapTiles, TilesetExtMapTiles, Tileset, Permission, Session, UserGroup, User, Account, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, ImportCad, ImportCsv, ImportJson, ImportKml, ImportedFile };
6527
6701
  //# sourceMappingURL=bruce-models.es5.js.map