bruce-models 3.5.8 → 3.6.0
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.
- package/dist/bruce-models.es5.js +167 -94
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +167 -94
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/api/api-getters.js +17 -3
- package/dist/lib/api/api-getters.js.map +1 -1
- package/dist/lib/api/bruce-api.js +125 -88
- package/dist/lib/api/bruce-api.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/lib/calculator/calculator.js +1 -1
- package/dist/lib/calculator/calculator.js.map +1 -1
- package/dist/lib/project/menu-item.js +23 -1
- package/dist/lib/project/menu-item.js.map +1 -1
- package/dist/types/api/bruce-api.d.ts +11 -1
- package/dist/types/bruce-models.d.ts +1 -1
- package/dist/types/project/menu-item.d.ts +15 -0
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -1278,6 +1278,9 @@
|
|
|
1278
1278
|
get MessageBroker() {
|
|
1279
1279
|
return this.messageBroker;
|
|
1280
1280
|
}
|
|
1281
|
+
get ConfigLoadAttempted() {
|
|
1282
|
+
return this.configLoadAttempted;
|
|
1283
|
+
}
|
|
1281
1284
|
get Loading() {
|
|
1282
1285
|
return this.loadProm;
|
|
1283
1286
|
}
|
|
@@ -1289,16 +1292,18 @@
|
|
|
1289
1292
|
// Load cancelled indicates the user set a custom base url.
|
|
1290
1293
|
// This will stop the regional url from being set if it's still loading.
|
|
1291
1294
|
this.loadCancelled = false;
|
|
1295
|
+
// Indicates if loading the regional configuration was already called.
|
|
1296
|
+
this.configLoadAttempted = false;
|
|
1292
1297
|
let { accountId, env, guardian, loadRegionalBaseUrl, loadConfig, loadWebSocket } = params;
|
|
1293
1298
|
this.accountId = accountId;
|
|
1294
1299
|
this.env = env !== null && env !== void 0 ? env : exports.Api.EEnv.PROD;
|
|
1300
|
+
// Backwards compatibility.
|
|
1295
1301
|
if (loadRegionalBaseUrl) {
|
|
1296
1302
|
loadConfig = true;
|
|
1297
1303
|
}
|
|
1298
|
-
if (
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
});
|
|
1304
|
+
if (loadConfig) {
|
|
1305
|
+
// Mark it as attempted right away because we don't want any external calls while it gets to that async point.
|
|
1306
|
+
this.configLoadAttempted = true;
|
|
1302
1307
|
}
|
|
1303
1308
|
this.loadProm = this.init(guardian, loadConfig, loadWebSocket);
|
|
1304
1309
|
}
|
|
@@ -1309,110 +1314,142 @@
|
|
|
1309
1314
|
* @returns
|
|
1310
1315
|
*/
|
|
1311
1316
|
init(guardian, loadConfig, loadWebSocket) {
|
|
1312
|
-
var _a, _b, _c;
|
|
1313
1317
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1314
1318
|
if (!this.accountId) {
|
|
1315
1319
|
throw ("accountId is required.");
|
|
1316
1320
|
}
|
|
1317
|
-
const env = this.env.toUpperCase();
|
|
1318
|
-
let domain = "nextspace.host";
|
|
1319
|
-
switch (env) {
|
|
1320
|
-
case exports.Api.EEnv.DEV:
|
|
1321
|
-
domain = "nextspace-dev.net";
|
|
1322
|
-
break;
|
|
1323
|
-
case exports.Api.EEnv.STG:
|
|
1324
|
-
domain = "nextspace-stg.net";
|
|
1325
|
-
break;
|
|
1326
|
-
case exports.Api.EEnv.UAT:
|
|
1327
|
-
domain = "nextspace-uat.net";
|
|
1328
|
-
break;
|
|
1329
|
-
case exports.Api.EEnv.PROD:
|
|
1330
|
-
domain = "nextspace.host";
|
|
1331
|
-
break;
|
|
1332
|
-
default:
|
|
1333
|
-
console.error("Specified Environment is not valid. SuppliedEnv=" + env);
|
|
1334
|
-
}
|
|
1335
1321
|
// Set using a stable default.
|
|
1322
|
+
const domain = this.getDomain();
|
|
1336
1323
|
this.baseUrl = `https://${this.accountId}.api.${domain}/`;
|
|
1337
|
-
|
|
1324
|
+
// Attempt to load regional configuration.
|
|
1325
|
+
if (loadConfig) {
|
|
1326
|
+
yield this.LoadConfig({
|
|
1327
|
+
guardian: guardian,
|
|
1328
|
+
// We marked it as attempted to load outside this method to fight any external calls.
|
|
1329
|
+
// So we'll force load it now.
|
|
1330
|
+
forceLoad: true
|
|
1331
|
+
});
|
|
1332
|
+
}
|
|
1333
|
+
// Start web socket connection.
|
|
1334
|
+
if (loadWebSocket != false) {
|
|
1338
1335
|
try {
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1336
|
+
this.messageBroker = new exports.MessageBroker.WebSocketBroker(this.baseUrl, this.env);
|
|
1337
|
+
}
|
|
1338
|
+
catch (e) {
|
|
1339
|
+
console.warn("BruceApi: Failed to create message broker.", e);
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
});
|
|
1343
|
+
}
|
|
1344
|
+
getDomain() {
|
|
1345
|
+
const env = this.env.toUpperCase();
|
|
1346
|
+
let domain = "nextspace.host";
|
|
1347
|
+
switch (env) {
|
|
1348
|
+
case exports.Api.EEnv.DEV:
|
|
1349
|
+
domain = "nextspace-dev.net";
|
|
1350
|
+
break;
|
|
1351
|
+
case exports.Api.EEnv.STG:
|
|
1352
|
+
domain = "nextspace-stg.net";
|
|
1353
|
+
break;
|
|
1354
|
+
case exports.Api.EEnv.UAT:
|
|
1355
|
+
domain = "nextspace-uat.net";
|
|
1356
|
+
break;
|
|
1357
|
+
case exports.Api.EEnv.PROD:
|
|
1358
|
+
domain = "nextspace.host";
|
|
1359
|
+
break;
|
|
1360
|
+
default:
|
|
1361
|
+
console.error("Specified Environment is not valid. SuppliedEnv=" + env);
|
|
1362
|
+
}
|
|
1363
|
+
return domain;
|
|
1364
|
+
}
|
|
1365
|
+
/**
|
|
1366
|
+
* Loads the regional configuration for the account.
|
|
1367
|
+
* If the config is already loaded then this will do nothing.
|
|
1368
|
+
*/
|
|
1369
|
+
LoadConfig(params) {
|
|
1370
|
+
var _a, _b, _c;
|
|
1371
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1372
|
+
let { guardian, forceLoad } = (params !== null && params !== void 0 ? params : {});
|
|
1373
|
+
if (this.configLoadAttempted && forceLoad != true) {
|
|
1374
|
+
return;
|
|
1375
|
+
}
|
|
1376
|
+
this.configLoadAttempted = true;
|
|
1377
|
+
try {
|
|
1378
|
+
if (!guardian) {
|
|
1379
|
+
guardian = new exports.GuardianApi.Api({
|
|
1380
|
+
env: this.env
|
|
1342
1381
|
});
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
}
|
|
1361
|
-
// Try go through host location's base url.
|
|
1362
|
-
// This may be wrong env which is why it's used as fallback right now.
|
|
1363
|
-
if (!urlSet && host.location.BruceAPIURL) {
|
|
1364
|
-
const regionalUrl = host.location.BruceAPIURL
|
|
1382
|
+
}
|
|
1383
|
+
const env = this.env.toUpperCase();
|
|
1384
|
+
const domain = this.getDomain();
|
|
1385
|
+
const host = yield exports.HostingLocation.GetByAccountId({
|
|
1386
|
+
accountId: this.accountId,
|
|
1387
|
+
api: guardian
|
|
1388
|
+
});
|
|
1389
|
+
if (host === null || host === void 0 ? void 0 : host.location) {
|
|
1390
|
+
const settings = host.location.Settings;
|
|
1391
|
+
if (!this.loadCancelled) {
|
|
1392
|
+
// Attempt to load regional base url.
|
|
1393
|
+
// First try go through settings.
|
|
1394
|
+
let urlSet = false;
|
|
1395
|
+
if (settings === null || settings === void 0 ? void 0 : settings.BruceAPIURL) {
|
|
1396
|
+
let envUrl = settings.BruceAPIURL[env];
|
|
1397
|
+
if (envUrl) {
|
|
1398
|
+
envUrl = envUrl
|
|
1365
1399
|
.replace("<ACCOUNTID>", this.accountId)
|
|
1366
|
-
.replace("<ACCOUNT>", this.accountId)
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
this.baseUrl = regionalUrl;
|
|
1400
|
+
.replace("<ACCOUNT>", this.accountId);
|
|
1401
|
+
if (envUrl && envUrl.length > 1) {
|
|
1402
|
+
this.baseUrl = envUrl;
|
|
1370
1403
|
urlSet = true;
|
|
1371
1404
|
}
|
|
1372
1405
|
}
|
|
1373
1406
|
}
|
|
1374
|
-
//
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
}
|
|
1407
|
+
// Try go through host location's base url.
|
|
1408
|
+
// This may be wrong env which is why it's used as fallback right now.
|
|
1409
|
+
if (!urlSet && host.location.BruceAPIURL) {
|
|
1410
|
+
const regionalUrl = host.location.BruceAPIURL
|
|
1411
|
+
.replace("<ACCOUNTID>", this.accountId)
|
|
1412
|
+
.replace("<ACCOUNT>", this.accountId)
|
|
1413
|
+
.replace("<DOMAIN>", domain);
|
|
1414
|
+
if (regionalUrl && regionalUrl.length > 1) {
|
|
1415
|
+
this.baseUrl = regionalUrl;
|
|
1416
|
+
urlSet = true;
|
|
1385
1417
|
}
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
// Attempt to load CDN settings.
|
|
1421
|
+
if (settings === null || settings === void 0 ? void 0 : settings.CDN) {
|
|
1422
|
+
this.EntityCdnUrl = (_a = settings.CDN.entityURL) === null || _a === void 0 ? void 0 : _a[env];
|
|
1423
|
+
// We need to fix our configs.
|
|
1424
|
+
if (this.EntityCdnUrl) {
|
|
1425
|
+
if (this.EntityCdnUrl.includes("entitiesListForCDN")) {
|
|
1426
|
+
this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", this.accountId);
|
|
1390
1427
|
}
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1428
|
+
else {
|
|
1429
|
+
this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", "entitiesListForCDN/" + this.accountId);
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
this.LegacyTilesetCdnUrl = (_b = settings.CDN.legacyTilesetURL) === null || _b === void 0 ? void 0 : _b[env];
|
|
1433
|
+
this.TilesetCdnUrl = (_c = settings.CDN.tilesetURL) === null || _c === void 0 ? void 0 : _c[env];
|
|
1434
|
+
if (this.TilesetCdnUrl) {
|
|
1435
|
+
this.TilesetCdnUrl = this.TilesetCdnUrl.replace("<ACCOUNT>", this.accountId);
|
|
1436
|
+
}
|
|
1437
|
+
// TilesetCdnUrl example: "https://blah.cloudfront.net/tilesets/<TILESETID>/files/<FILEPATH>?accountId=<ACCOUNT>".
|
|
1438
|
+
// Lazy at the moment to go around updating every region we have, I'll interpret the url from tilesetCdnUrl.
|
|
1439
|
+
if (this.TilesetCdnUrl) {
|
|
1440
|
+
try {
|
|
1441
|
+
const url = new URL(this.TilesetCdnUrl);
|
|
1442
|
+
this.cdnBaseUrl = `${url.protocol}//${url.hostname}/`;
|
|
1443
|
+
}
|
|
1444
|
+
catch (e) {
|
|
1445
|
+
console.error(e);
|
|
1401
1446
|
}
|
|
1402
1447
|
}
|
|
1403
1448
|
}
|
|
1404
1449
|
}
|
|
1405
|
-
catch (e) {
|
|
1406
|
-
console.error(e);
|
|
1407
|
-
}
|
|
1408
1450
|
}
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
this.messageBroker = new exports.MessageBroker.WebSocketBroker(this.baseUrl, this.env);
|
|
1412
|
-
}
|
|
1413
|
-
catch (e) {
|
|
1414
|
-
console.warn("BruceApi: Failed to create message broker.", e);
|
|
1415
|
-
}
|
|
1451
|
+
catch (e) {
|
|
1452
|
+
console.error(e);
|
|
1416
1453
|
}
|
|
1417
1454
|
});
|
|
1418
1455
|
}
|
|
@@ -1721,6 +1758,17 @@
|
|
|
1721
1758
|
*/
|
|
1722
1759
|
SetAccountId(accountId) {
|
|
1723
1760
|
this.accountId = accountId;
|
|
1761
|
+
// Queue load of regional config in case an instance was made earlier without it.
|
|
1762
|
+
// We want the default account to always go through the fastest regional endpoint.
|
|
1763
|
+
const api = this.GetBruceApi({
|
|
1764
|
+
accountId: accountId,
|
|
1765
|
+
loadConfig: true
|
|
1766
|
+
});
|
|
1767
|
+
api.LoadConfig({
|
|
1768
|
+
guardian: this.GetGuardianApi({
|
|
1769
|
+
env: this.env
|
|
1770
|
+
})
|
|
1771
|
+
});
|
|
1724
1772
|
}
|
|
1725
1773
|
/**
|
|
1726
1774
|
* Returns the default account ID to use when one is unspecified.
|
|
@@ -1785,7 +1833,9 @@
|
|
|
1785
1833
|
this.bruce[key] = new exports.BruceApi.Api({
|
|
1786
1834
|
accountId,
|
|
1787
1835
|
env,
|
|
1788
|
-
|
|
1836
|
+
// We'll load regional config if the accountId matches the default accountId.
|
|
1837
|
+
// We'll also load if it no default is known.
|
|
1838
|
+
loadConfig: loadConfig != null ? loadConfig : (this.accountId == accountId || !this.accountId),
|
|
1789
1839
|
loadWebSocket: loadWebSocket,
|
|
1790
1840
|
guardian: this.GetGuardianApi({
|
|
1791
1841
|
env
|
|
@@ -1809,8 +1859,9 @@
|
|
|
1809
1859
|
return this.GetBruceApi({
|
|
1810
1860
|
accountId,
|
|
1811
1861
|
env,
|
|
1812
|
-
|
|
1813
|
-
|
|
1862
|
+
// We'll load regional config if the accountId matches the default accountId.
|
|
1863
|
+
// We'll also load if it no default is known.
|
|
1864
|
+
loadConfig: this.accountId == accountId || !this.accountId
|
|
1814
1865
|
});
|
|
1815
1866
|
}
|
|
1816
1867
|
};
|
|
@@ -3963,7 +4014,7 @@
|
|
|
3963
4014
|
str: value,
|
|
3964
4015
|
entity: entity
|
|
3965
4016
|
});
|
|
3966
|
-
const isJsEval =
|
|
4017
|
+
const isJsEval = value.startsWith("JS:");
|
|
3967
4018
|
const MATH_REGEX = /(\d+\.?\d*|\.\d+)([+\-*/])(\d+\.?\d*|\.\d+)/;
|
|
3968
4019
|
const isMathEval = isJsEval || MATH_REGEX.test(value);
|
|
3969
4020
|
if (isJsEval || isMathEval) {
|
|
@@ -7637,22 +7688,44 @@
|
|
|
7637
7688
|
*/
|
|
7638
7689
|
let EType;
|
|
7639
7690
|
(function (EType) {
|
|
7691
|
+
// Container for other menu items.
|
|
7640
7692
|
EType["None"] = "NONE";
|
|
7693
|
+
// Renders Nextspace Entities based on an Entity Type ID and optional attribute filter.
|
|
7641
7694
|
EType["Entities"] = "BruceEntity";
|
|
7695
|
+
// Renders a single Entity by ID.
|
|
7642
7696
|
EType["Entity"] = "SingleEntity";
|
|
7697
|
+
// Renders Cesium OSM Buildings.
|
|
7643
7698
|
EType["Osm"] = "OSMBuildingsTileset";
|
|
7699
|
+
// Renders a Cesium Tileset made from importing an assembly file into Nextspace.
|
|
7644
7700
|
EType["CadTileset"] = "ModelTileset";
|
|
7701
|
+
// Renders legacy Nextspace tilesets.
|
|
7702
|
+
// This is primarily used for static Tilesets as they don't have an upgraded version yet.
|
|
7645
7703
|
EType["ArbTileset"] = "ArbitraryTileset";
|
|
7704
|
+
// Renders a Cesium Tileset by Ion asset ID.
|
|
7646
7705
|
EType["IonTileset"] = "Cesium3DTileset";
|
|
7706
|
+
// Renders a KML file in Cesium.
|
|
7707
|
+
// No data is managed, this is purely visual.
|
|
7647
7708
|
EType["Kml"] = "StaticKML";
|
|
7709
|
+
// Renders rows of a CSV as Cesium Entities.
|
|
7710
|
+
// This a single-purpose proof of concept feature. Avoid using.
|
|
7711
|
+
EType["Csv"] = "StaticCSV";
|
|
7712
|
+
// Renders a Cesium Tileset made from arbitrary Nextspace Entities.
|
|
7648
7713
|
EType["EntityTileset"] = "EntitiesTileset";
|
|
7714
|
+
// Renders a Cesium Imagery made from arbitrary Nextspace Entities.
|
|
7715
|
+
// @deprecated.
|
|
7649
7716
|
EType["EntityRaster"] = "RasterEntitiesTileset";
|
|
7717
|
+
// Renders a Cesium Point Cloud imported from LAS/LAZ file into Nextspace.
|
|
7650
7718
|
EType["PointCloud"] = "PointCloudTileset";
|
|
7719
|
+
// Renders preloaded Entity records.
|
|
7651
7720
|
EType["EntitiesLoaded"] = "LoadedEntities";
|
|
7721
|
+
// Renders Entities matching specific IDs.
|
|
7652
7722
|
EType["EntitiesIds"] = "EntitiesIds";
|
|
7653
|
-
//
|
|
7723
|
+
// @deprecated. Use Relationships instead.
|
|
7654
7724
|
EType["Relations"] = "Relations";
|
|
7725
|
+
// Renders Entity relationships.
|
|
7726
|
+
// This renders specified downstream relationship types for specified Entity IDs.
|
|
7655
7727
|
EType["Relationships"] = "Relationships";
|
|
7728
|
+
// Renders the Cesium Google photogrammetry tileset.
|
|
7656
7729
|
EType["GooglePhotoTileset"] = "GooglePhotoTileset";
|
|
7657
7730
|
})(EType = MenuItem.EType || (MenuItem.EType = {}));
|
|
7658
7731
|
/**
|
|
@@ -10639,7 +10712,7 @@
|
|
|
10639
10712
|
})(exports.DataSource || (exports.DataSource = {}));
|
|
10640
10713
|
|
|
10641
10714
|
// This is updated with the package.json version on build.
|
|
10642
|
-
const VERSION = "3.
|
|
10715
|
+
const VERSION = "3.6.0";
|
|
10643
10716
|
|
|
10644
10717
|
exports.VERSION = VERSION;
|
|
10645
10718
|
exports.AbstractApi = AbstractApi;
|