bruce-models 0.7.5 → 0.7.7

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 (102) hide show
  1. package/dist/bruce-models.es5.js +183 -16
  2. package/dist/bruce-models.es5.js.map +1 -1
  3. package/dist/bruce-models.umd.js +180 -14
  4. package/dist/bruce-models.umd.js.map +1 -1
  5. package/dist/lib/account/account.js +244 -244
  6. package/dist/lib/ann-document/ann-document.js +116 -116
  7. package/dist/lib/api/abstract-api.js +269 -267
  8. package/dist/lib/api/abstract-api.js.map +1 -1
  9. package/dist/lib/api/api.js +85 -85
  10. package/dist/lib/api/bruce-api.js +228 -202
  11. package/dist/lib/api/bruce-api.js.map +1 -1
  12. package/dist/lib/api/cam-api.js +132 -132
  13. package/dist/lib/api/cam-api.js.map +1 -1
  14. package/dist/lib/api/global-api.js +131 -131
  15. package/dist/lib/api/global-api.js.map +1 -1
  16. package/dist/lib/api/idm-api.js +132 -132
  17. package/dist/lib/api/idm-api.js.map +1 -1
  18. package/dist/lib/bruce-models.js +84 -83
  19. package/dist/lib/bruce-models.js.map +1 -1
  20. package/dist/lib/calculator/calculator.js +158 -158
  21. package/dist/lib/client-file/client-file.js +188 -188
  22. package/dist/lib/common/bounds.js +2 -2
  23. package/dist/lib/common/bruce-event.js +48 -48
  24. package/dist/lib/common/bruce-variable.js +54 -54
  25. package/dist/lib/common/cache.js +86 -86
  26. package/dist/lib/common/camera.js +11 -11
  27. package/dist/lib/common/cartes.js +55 -55
  28. package/dist/lib/common/carto.js +60 -60
  29. package/dist/lib/common/color.js +86 -86
  30. package/dist/lib/common/delay-queue.js +60 -60
  31. package/dist/lib/common/dictionary.js +2 -2
  32. package/dist/lib/common/geometry.js +120 -120
  33. package/dist/lib/common/transform.js +2 -2
  34. package/dist/lib/common/utc.js +39 -39
  35. package/dist/lib/custom-form/custom-form.js +136 -136
  36. package/dist/lib/data-lab/data-lab.js +90 -90
  37. package/dist/lib/entity/entity-attachment-type.js +132 -132
  38. package/dist/lib/entity/entity-attachment.js +208 -208
  39. package/dist/lib/entity/entity-comment.js +132 -132
  40. package/dist/lib/entity/entity-coords.js +181 -181
  41. package/dist/lib/entity/entity-link.js +132 -132
  42. package/dist/lib/entity/entity-lod.js +189 -189
  43. package/dist/lib/entity/entity-relation-type.js +150 -150
  44. package/dist/lib/entity/entity-relation.js +189 -189
  45. package/dist/lib/entity/entity-source.js +176 -176
  46. package/dist/lib/entity/entity-tag.js +229 -229
  47. package/dist/lib/entity/entity-type.js +163 -163
  48. package/dist/lib/entity/entity.js +358 -358
  49. package/dist/lib/entity/getters/batched-data-getter.js +91 -91
  50. package/dist/lib/entity/getters/entity-filter-getter.js +344 -344
  51. package/dist/lib/entity/getters/entity-globe.js +135 -135
  52. package/dist/lib/entity/getters/view-monitor.js +2 -2
  53. package/dist/lib/import/import-cad.js +82 -82
  54. package/dist/lib/import/import-csv.js +51 -51
  55. package/dist/lib/import/import-json.js +51 -51
  56. package/dist/lib/import/import-kml.js +51 -51
  57. package/dist/lib/import/imported-file.js +121 -121
  58. package/dist/lib/markup/markup.js +40 -40
  59. package/dist/lib/program-key/program-key.js +152 -152
  60. package/dist/lib/project/menu-item.js +115 -115
  61. package/dist/lib/project/project-view-bookmark.js +183 -172
  62. package/dist/lib/project/project-view-bookmark.js.map +1 -1
  63. package/dist/lib/project/{project-view-tile-source.js → project-view-legacy-tile.js} +116 -116
  64. package/dist/lib/project/project-view-legacy-tile.js.map +1 -0
  65. package/dist/lib/project/project-view-tile.js +120 -0
  66. package/dist/lib/project/project-view-tile.js.map +1 -0
  67. package/dist/lib/project/project-view.js +177 -166
  68. package/dist/lib/project/project-view.js.map +1 -1
  69. package/dist/lib/project/zoom-control.js +17 -17
  70. package/dist/lib/server/pending-action.js +106 -106
  71. package/dist/lib/server/task.js +113 -113
  72. package/dist/lib/style/style.js +152 -152
  73. package/dist/lib/tileset/tileset-cad.js +2 -2
  74. package/dist/lib/tileset/tileset-entities-map-tiles.js +18 -18
  75. package/dist/lib/tileset/tileset-entities.js +2 -2
  76. package/dist/lib/tileset/tileset-ext-map-tiles.js +17 -17
  77. package/dist/lib/tileset/tileset-ext-terrain-tiles.js +2 -2
  78. package/dist/lib/tileset/tileset-map-tiles.js +2 -2
  79. package/dist/lib/tileset/tileset-pointcloud.js +2 -2
  80. package/dist/lib/tileset/tileset-terrain-tiles.js +2 -2
  81. package/dist/lib/tileset/tileset.js +403 -403
  82. package/dist/lib/user/permission.js +20 -20
  83. package/dist/lib/user/session.js +160 -160
  84. package/dist/lib/user/user-group.js +139 -139
  85. package/dist/lib/user/user.js +451 -451
  86. package/dist/lib/util/encrypt-utils.js +20 -20
  87. package/dist/lib/util/math-utils.js +41 -41
  88. package/dist/lib/util/object-utils.js +17 -17
  89. package/dist/lib/util/path-utils.js +61 -61
  90. package/dist/lib/util/url-utils.js +107 -107
  91. package/dist/types/api/abstract-api.d.ts +1 -1
  92. package/dist/types/api/bruce-api.d.ts +22 -2
  93. package/dist/types/api/cam-api.d.ts +1 -1
  94. package/dist/types/api/global-api.d.ts +1 -1
  95. package/dist/types/api/idm-api.d.ts +1 -1
  96. package/dist/types/bruce-models.d.ts +2 -1
  97. package/dist/types/project/project-view-bookmark.d.ts +85 -36
  98. package/dist/types/project/{project-view-tile-source.d.ts → project-view-legacy-tile.d.ts} +1 -1
  99. package/dist/types/project/project-view-tile.d.ts +68 -0
  100. package/dist/types/project/project-view.d.ts +64 -39
  101. package/package.json +1 -1
  102. package/dist/lib/project/project-view-tile-source.js.map +0 -1
@@ -458,20 +458,22 @@
458
458
  var _a;
459
459
  return __awaiter(this, void 0, void 0, function () {
460
460
  var res;
461
- var _b;
462
- return __generator(this, function (_c) {
463
- switch (_c.label) {
461
+ return __generator(this, function (_b) {
462
+ switch (_b.label) {
464
463
  case 0:
465
464
  if (!params) {
466
465
  params = {};
467
466
  }
468
467
  params.headers = params.headers || {};
469
- params.headers = __assign((_b = { "Content-Type": "application/json;" }, _b[this.ssidHeader] = this.ssid, _b), params.headers);
468
+ params.headers = __assign({ "Content-Type": "application/json;" }, params.headers);
469
+ if (this.ssidHeader) {
470
+ params.headers[this.ssidHeader] = this.ssid;
471
+ }
470
472
  return [4 /*yield*/, fetch(url, {
471
473
  headers: params.headers
472
474
  })];
473
475
  case 1:
474
- res = _c.sent();
476
+ res = _b.sent();
475
477
  return [2 /*return*/, parseResult(res, (_a = params.response) === null || _a === void 0 ? void 0 : _a.encoding)];
476
478
  }
477
479
  });
@@ -907,22 +909,30 @@
907
909
  */
908
910
  var Api$$1 = /** @class */ (function (_super) {
909
911
  __extends(Api$$1, _super);
910
- function Api$$1(accountId, env) {
912
+ /**
913
+ * @param accountId
914
+ * @param env (Optional) environment to use, this will default to PROD.
915
+ * @param cam (Optional) cam instance to use for loading the regional base url.
916
+ */
917
+ function Api$$1(accountId, env, cam) {
911
918
  var _this = _super.call(this, "x-sessionid") || this;
912
919
  _this.baseUrl = "";
920
+ _this.loadCancelled = false;
913
921
  _this.accountId = accountId;
914
922
  _this.env = env !== null && env !== void 0 ? env : exports.Api.EEnv.PROD;
915
- _this.loadProm = _this.setBaseUrl();
923
+ _this.loadProm = _this.setBaseUrl(cam);
916
924
  return _this;
917
925
  }
918
926
  Object.defineProperty(Api$$1.prototype, "Loading", {
927
+ // Indicates if the init process has finished loading.
928
+ // This means the regional base url has been set.
919
929
  get: function () {
920
930
  return this.loadProm;
921
931
  },
922
932
  enumerable: false,
923
933
  configurable: true
924
934
  });
925
- Api$$1.prototype.setBaseUrl = function () {
935
+ Api$$1.prototype.setBaseUrl = function (cam) {
926
936
  var _a;
927
937
  return __awaiter(this, void 0, void 0, function () {
928
938
  var prefix, url, env, camApi, settings, endpoint, e_1;
@@ -951,10 +961,14 @@
951
961
  _b.label = 1;
952
962
  case 1:
953
963
  _b.trys.push([1, 3, , 4]);
954
- camApi = new exports.CamApi.Api(env);
964
+ camApi = cam ? cam : new exports.CamApi.Api(env);
955
965
  return [4 /*yield*/, exports.Account.GetAppSettings(camApi, this.accountId, exports.Account.EAppId.BruceApi)];
956
966
  case 2:
957
967
  settings = _b.sent();
968
+ if (this.loadCancelled) {
969
+ console.warn("BruceApi: Loading was cancelled due to SetBaseUrl being called, not setting regional base url.");
970
+ return [2 /*return*/];
971
+ }
958
972
  endpoint = (_a = settings.BruceAPIURL) === null || _a === void 0 ? void 0 : _a[env];
959
973
  if (typeof endpoint == "string") {
960
974
  if (!endpoint.endsWith("/")) {
@@ -972,14 +986,28 @@
972
986
  });
973
987
  });
974
988
  };
989
+ /**
990
+ * Warning: This method does not wait for init to finish loading.
991
+ * This means the url could be changed once fully initialized.
992
+ * The url will be valid either way, but the loaded one may be faster as it is region specific.
993
+ * Await the "Loading" promise if you care about this.
994
+ * @returns
995
+ */
975
996
  Api$$1.prototype.GetBaseUrl = function () {
976
997
  return this.baseUrl;
977
998
  };
999
+ /**
1000
+ * Warning: This will cancel the init process.
1001
+ * The init process loads a region specific endpoint.
1002
+ * Setting a base url will stop that process from completing.
1003
+ * @param url
1004
+ */
978
1005
  Api$$1.prototype.SetBaseUrl = function (url) {
979
1006
  this.baseUrl = url;
980
1007
  if (!this.baseUrl.endsWith("/")) {
981
1008
  this.baseUrl += "/";
982
1009
  }
1010
+ this.loadCancelled = true;
983
1011
  };
984
1012
  Api$$1.prototype.GET = function (url, params) {
985
1013
  return __awaiter(this, void 0, void 0, function () {
@@ -4870,6 +4898,17 @@
4870
4898
  return "" + exports.Api.ECacheKey.ProjectViewBookmark + exports.Api.ECacheKey.Id + viewId;
4871
4899
  }
4872
4900
  ProjectViewBookmark.GetListCacheKey = GetListCacheKey;
4901
+ // This is the expected default version for the DataVersion value.
4902
+ // This value should NOT be changed without looking at our API and seeing what the default value is.
4903
+ ProjectViewBookmark.DEFAULT_DATA_VERSION = 1;
4904
+ var V1;
4905
+ (function (V1) {
4906
+ V1.DATA_VERSION = 1;
4907
+ })(V1 = ProjectViewBookmark.V1 || (ProjectViewBookmark.V1 = {}));
4908
+ var V2;
4909
+ (function (V2) {
4910
+ V2.DATA_VERSION = 2;
4911
+ })(V2 = ProjectViewBookmark.V2 || (ProjectViewBookmark.V2 = {}));
4873
4912
  function Get(api, viewId, bookmarkId) {
4874
4913
  return __awaiter(this, void 0, void 0, function () {
4875
4914
  var key, cacheData, req;
@@ -4995,6 +5034,17 @@
4995
5034
  return exports.Api.ECacheKey.ProjectView;
4996
5035
  }
4997
5036
  ProjectView.GetListCacheKey = GetListCacheKey;
5037
+ // This is the expected default version for the DataVersion value.
5038
+ // This value should NOT be changed without looking at our API and seeing what the default value is.
5039
+ ProjectView.DEFAULT_DATA_VERSION = 1;
5040
+ var V1;
5041
+ (function (V1) {
5042
+ V1.DATA_VERSION = 1;
5043
+ })(V1 = ProjectView.V1 || (ProjectView.V1 = {}));
5044
+ var V2;
5045
+ (function (V2) {
5046
+ V2.DATA_VERSION = 2;
5047
+ })(V2 = ProjectView.V2 || (ProjectView.V2 = {}));
4998
5048
  function Get(api, viewId) {
4999
5049
  return __awaiter(this, void 0, void 0, function () {
5000
5050
  var key, cacheData, req;
@@ -5112,7 +5162,7 @@
5112
5162
  var view;
5113
5163
  return __generator(this, function (_b) {
5114
5164
  switch (_b.label) {
5115
- case 0: return [4 /*yield*/, exports.ProjectView.Get(apiGetter.getApi(exports.Api.TEMPLATE_ACCOUNT_ID, apiGetter.env), "default")];
5165
+ case 0: return [4 /*yield*/, exports.ProjectView.Get(apiGetter.getApi(exports.Api.TEMPLATE_ACCOUNT_ID), "default")];
5116
5166
  case 1:
5117
5167
  view = _b.sent();
5118
5168
  return [2 /*return*/, (_a = view.Settings) !== null && _a !== void 0 ? _a : {}];
@@ -5132,7 +5182,7 @@
5132
5182
  items.push(templateItem);
5133
5183
  }
5134
5184
  }
5135
- (function (ProjectViewTileSource) {
5185
+ (function (ProjectViewLegacyTile) {
5136
5186
  function MergeMapTemplateData(getter, items, addIfMissing) {
5137
5187
  var _a;
5138
5188
  return __awaiter(this, void 0, void 0, function () {
@@ -5152,7 +5202,7 @@
5152
5202
  });
5153
5203
  });
5154
5204
  }
5155
- ProjectViewTileSource.MergeMapTemplateData = MergeMapTemplateData;
5205
+ ProjectViewLegacyTile.MergeMapTemplateData = MergeMapTemplateData;
5156
5206
  function MergeTerrainTemplateData(getter, items, addIfMissing) {
5157
5207
  var _a;
5158
5208
  return __awaiter(this, void 0, void 0, function () {
@@ -5172,8 +5222,124 @@
5172
5222
  });
5173
5223
  });
5174
5224
  }
5175
- ProjectViewTileSource.MergeTerrainTemplateData = MergeTerrainTemplateData;
5176
- })(exports.ProjectViewTileSource || (exports.ProjectViewTileSource = {}));
5225
+ ProjectViewLegacyTile.MergeTerrainTemplateData = MergeTerrainTemplateData;
5226
+ })(exports.ProjectViewLegacyTile || (exports.ProjectViewLegacyTile = {}));
5227
+
5228
+ (function (ProjectViewTile) {
5229
+ var EDefaultImagery;
5230
+ (function (EDefaultImagery) {
5231
+ EDefaultImagery["BingMapsAerial"] = "bingmapsaerial";
5232
+ EDefaultImagery["BingMapsAerialWithLabels"] = "bingmapsaerialwithlabels";
5233
+ EDefaultImagery["BingMapsRoads"] = "bingmapsroads";
5234
+ EDefaultImagery["MapboxSatellite"] = "mapboxsatellite";
5235
+ EDefaultImagery["MapBoxStreets"] = "mapboxstreets";
5236
+ EDefaultImagery["MapBoxStreetsClassic"] = "mapboxstreetsclassic";
5237
+ EDefaultImagery["EsriWorldImagery"] = "esriworldimagery";
5238
+ EDefaultImagery["EsriWorldStreetMap"] = "esriworldstreetmap";
5239
+ EDefaultImagery["EsriNationalGeographic"] = "esrinationalgeographic";
5240
+ EDefaultImagery["OpenStreetMap"] = "openstreetmap";
5241
+ EDefaultImagery["StamenWaterColor"] = "stamenwatercolor";
5242
+ EDefaultImagery["StamenToner"] = "stamentoner";
5243
+ EDefaultImagery["Grid"] = "grid";
5244
+ })(EDefaultImagery = ProjectViewTile.EDefaultImagery || (ProjectViewTile.EDefaultImagery = {}));
5245
+ /**
5246
+ * Prepared array for UI.
5247
+ * TODO: Im not happy with icon urls sitting in the code. I'd prefer we ship these icons in the library as files.
5248
+ */
5249
+ ProjectViewTile.DefaultImagery = [
5250
+ {
5251
+ id: EDefaultImagery.BingMapsAerial,
5252
+ name: "Bing Maps Aerial",
5253
+ iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/bingAerial.png"
5254
+ },
5255
+ {
5256
+ id: EDefaultImagery.BingMapsAerialWithLabels,
5257
+ name: "Bing Maps Aerial with Labels",
5258
+ iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/bingAerialLabels.png"
5259
+ },
5260
+ {
5261
+ id: EDefaultImagery.BingMapsRoads,
5262
+ name: "Bing Maps Roads",
5263
+ iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/bingRoads.png"
5264
+ },
5265
+ {
5266
+ id: EDefaultImagery.MapboxSatellite,
5267
+ name: "Mapbox Satellite",
5268
+ iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/mapboxSatellite.png"
5269
+ },
5270
+ {
5271
+ id: EDefaultImagery.MapBoxStreets,
5272
+ name: "Mapbox Streets",
5273
+ iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/mapboxTerrain.png"
5274
+ },
5275
+ {
5276
+ id: EDefaultImagery.MapBoxStreetsClassic,
5277
+ name: "Mapbox Streets Classic",
5278
+ iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/mapboxStreets.png"
5279
+ },
5280
+ {
5281
+ id: EDefaultImagery.EsriWorldImagery,
5282
+ name: "Esri World Imagery",
5283
+ iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/esriWorldImagery.png"
5284
+ },
5285
+ {
5286
+ id: EDefaultImagery.EsriWorldStreetMap,
5287
+ name: "Esri World Street Map",
5288
+ iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/esriWorldStreetMap.png"
5289
+ },
5290
+ {
5291
+ id: EDefaultImagery.EsriNationalGeographic,
5292
+ name: "Esri National Geographic",
5293
+ iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/esriNationalGeographic.png"
5294
+ },
5295
+ {
5296
+ id: EDefaultImagery.OpenStreetMap,
5297
+ name: "Open Street Map",
5298
+ iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/openStreetMap.png"
5299
+ },
5300
+ {
5301
+ id: EDefaultImagery.StamenWaterColor,
5302
+ name: "Stamen Water Color",
5303
+ iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/stamenWatercolor.png"
5304
+ },
5305
+ {
5306
+ id: EDefaultImagery.StamenToner,
5307
+ name: "Stamen Toner",
5308
+ iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/stamenToner.png"
5309
+ },
5310
+ {
5311
+ id: EDefaultImagery.Grid,
5312
+ name: "Grid",
5313
+ iconUrl: "https://template.api.nextspace-uat.net/file/2885d8df-028b-4f5c-80b3-2634f7e7cf69.png"
5314
+ }
5315
+ ];
5316
+ var EDefaultTerrain;
5317
+ (function (EDefaultTerrain) {
5318
+ EDefaultTerrain["CesiumWorldTerrain"] = "cesiumworldterrain";
5319
+ EDefaultTerrain["FlatTerrain"] = "flatterrain";
5320
+ EDefaultTerrain["LINZ"] = "linz";
5321
+ })(EDefaultTerrain = ProjectViewTile.EDefaultTerrain || (ProjectViewTile.EDefaultTerrain = {}));
5322
+ /**
5323
+ * Prepared array for UI.
5324
+ * TODO: Im not happy with icon urls sitting in the code. I'd prefer we ship these icons in the library as files.
5325
+ */
5326
+ ProjectViewTile.DefaultTerrains = [
5327
+ {
5328
+ id: EDefaultTerrain.CesiumWorldTerrain,
5329
+ name: "Cesium World Terrain",
5330
+ iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/TerrainProviders/CesiumWorldTerrain.png"
5331
+ },
5332
+ {
5333
+ id: EDefaultTerrain.LINZ,
5334
+ name: "LINZ",
5335
+ iconUrl: "https://template.ui.nextspace.host/media/linz.jpg"
5336
+ },
5337
+ {
5338
+ id: EDefaultTerrain.FlatTerrain,
5339
+ name: "Flat Terrain",
5340
+ }
5341
+ ];
5342
+ })(exports.ProjectViewTile || (exports.ProjectViewTile = {}));
5177
5343
 
5178
5344
  (function (PendingAction) {
5179
5345
  var EStatus;