bruce-models 4.5.8 → 4.5.9
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 +1587 -1586
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +1511 -1510
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/api/bruce-api.js +96 -87
- package/dist/lib/api/bruce-api.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/lib/client-file/client-file.js +16 -18
- package/dist/lib/client-file/client-file.js.map +1 -1
- package/dist/lib/entity/entity-lod.js +6 -5
- package/dist/lib/entity/entity-lod.js.map +1 -1
- package/dist/lib/entity/entity.js +12 -15
- package/dist/lib/entity/entity.js.map +1 -1
- package/dist/lib/plugin/plugin.js +6 -1
- package/dist/lib/plugin/plugin.js.map +1 -1
- package/dist/lib/tileset/tileset.js +16 -27
- package/dist/lib/tileset/tileset.js.map +1 -1
- package/dist/types/api/bruce-api.d.ts +14 -1
- package/dist/types/bruce-models.d.ts +1 -1
- package/package.json +1 -1
package/dist/bruce-models.es5.js
CHANGED
|
@@ -841,782 +841,455 @@ var GuardianApi;
|
|
|
841
841
|
GuardianApi.Api = Api$$1;
|
|
842
842
|
})(GuardianApi || (GuardianApi = {}));
|
|
843
843
|
|
|
844
|
-
// Some dead accounts that we don't want to show in the UI.
|
|
845
|
-
// Some accounts may not be "dead" but instead purposely don't have a NextspaceAPI database so we'll avoid them too.
|
|
846
|
-
const ACCOUNT_EXCLUSIONS = ["hyperportal", "hypeportal", "bviewer"];
|
|
847
844
|
/**
|
|
848
|
-
*
|
|
849
|
-
*
|
|
845
|
+
* The primary API for communication with Nextspace.
|
|
846
|
+
* This API is used to manage your data.
|
|
850
847
|
*/
|
|
851
|
-
var
|
|
852
|
-
(function (
|
|
853
|
-
/**
|
|
854
|
-
* Known Nextspace applications we store settings for.
|
|
855
|
-
*/
|
|
856
|
-
let EAppId;
|
|
857
|
-
(function (EAppId) {
|
|
858
|
-
EAppId["BruceApi"] = "BruceAPI";
|
|
859
|
-
EAppId["Navigator"] = "Navigator";
|
|
860
|
-
EAppId["Operator"] = "BruceClientAdmin";
|
|
861
|
-
})(EAppId = Account.EAppId || (Account.EAppId = {}));
|
|
862
|
-
/**
|
|
863
|
-
* Possible starter content options.
|
|
864
|
-
* When creating a new account you can populate it with certain default data.
|
|
865
|
-
*/
|
|
866
|
-
let EStarterContent;
|
|
867
|
-
(function (EStarterContent) {
|
|
868
|
-
EStarterContent["Default"] = "default";
|
|
869
|
-
EStarterContent["None"] = "none";
|
|
870
|
-
})(EStarterContent = Account.EStarterContent || (Account.EStarterContent = {}));
|
|
848
|
+
var BruceApi;
|
|
849
|
+
(function (BruceApi$$1) {
|
|
871
850
|
/**
|
|
872
|
-
*
|
|
873
|
-
*
|
|
874
|
-
* @returns
|
|
851
|
+
* This is the request handler for Bruce Api,
|
|
852
|
+
* it should be passed to any method that wants to communicate with this particular api.
|
|
875
853
|
*/
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
854
|
+
class Api$$1 extends AbstractApi {
|
|
855
|
+
get AccountId() {
|
|
856
|
+
return this.accountId;
|
|
857
|
+
}
|
|
858
|
+
get MessageBroker() {
|
|
859
|
+
return this.messageBroker;
|
|
860
|
+
}
|
|
861
|
+
get ConfigLoadAttempted() {
|
|
862
|
+
return this.configLoadAttempted;
|
|
863
|
+
}
|
|
864
|
+
get Version() {
|
|
865
|
+
return this.version;
|
|
866
|
+
}
|
|
867
|
+
get Loading() {
|
|
868
|
+
return this.loadProm;
|
|
869
|
+
}
|
|
870
|
+
constructor(params) {
|
|
871
|
+
super({
|
|
872
|
+
ssidHeader: "x-sessionid",
|
|
873
|
+
cacheId: `BRUCE_API_${params === null || params === void 0 ? void 0 : params.env}_${params === null || params === void 0 ? void 0 : params.accountId}_`
|
|
874
|
+
});
|
|
875
|
+
// Load cancelled indicates the user set a custom base url.
|
|
876
|
+
// This will stop the regional url from being set if it's still loading.
|
|
877
|
+
this.loadCancelled = false;
|
|
878
|
+
// Indicates if loading the regional configuration was already called.
|
|
879
|
+
this.configLoadAttempted = false;
|
|
880
|
+
let { accountId, env, guardian, loadRegionalBaseUrl, loadConfig, loadWebSocket, dummy } = params;
|
|
881
|
+
this.accountId = accountId;
|
|
882
|
+
this.env = env !== null && env !== void 0 ? env : Api.EEnv.PROD;
|
|
883
|
+
if (!dummy) {
|
|
884
|
+
// Backwards compatibility.
|
|
885
|
+
if (loadRegionalBaseUrl) {
|
|
886
|
+
loadConfig = true;
|
|
887
|
+
}
|
|
888
|
+
if (loadConfig) {
|
|
889
|
+
// Mark it as attempted right away because we don't want any external calls while it gets to that async point.
|
|
890
|
+
this.configLoadAttempted = true;
|
|
891
|
+
}
|
|
892
|
+
this.loadProm = this.init(guardian, loadConfig, loadWebSocket);
|
|
885
893
|
}
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
894
|
+
}
|
|
895
|
+
/**
|
|
896
|
+
* Loads regional base url and sets up message broker.
|
|
897
|
+
* @param guardian Required for loading regional base url.
|
|
898
|
+
* @param loadConfig
|
|
899
|
+
* @returns
|
|
900
|
+
*/
|
|
901
|
+
init(guardian, loadConfig, loadWebSocket) {
|
|
902
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
903
|
+
if (!this.accountId) {
|
|
904
|
+
throw ("accountId is required.");
|
|
905
|
+
}
|
|
906
|
+
// Set using a stable default.
|
|
907
|
+
const domain = this.getDomain();
|
|
908
|
+
this.baseUrl = `https://${this.accountId}.api.${domain}/`;
|
|
909
|
+
// Attempt to load regional configuration.
|
|
910
|
+
if (loadConfig) {
|
|
911
|
+
yield this.LoadConfig({
|
|
912
|
+
guardian: guardian,
|
|
913
|
+
// We marked it as attempted to load outside this method to fight any external calls.
|
|
914
|
+
// So we'll force load it now.
|
|
915
|
+
forceLoad: true
|
|
899
916
|
});
|
|
900
917
|
}
|
|
901
|
-
|
|
902
|
-
|
|
918
|
+
// Get the version.
|
|
919
|
+
if (this.baseUrl) {
|
|
920
|
+
const full = this.ConstructUrl({
|
|
921
|
+
url: "version"
|
|
922
|
+
});
|
|
923
|
+
const data = yield this.get(full);
|
|
924
|
+
if (data === null || data === void 0 ? void 0 : data["Bruce-API"]) {
|
|
925
|
+
this.version = data["Bruce-API"];
|
|
926
|
+
}
|
|
927
|
+
else {
|
|
928
|
+
this.version = "UNKNOWN";
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
// Start web socket connection.
|
|
932
|
+
if (loadWebSocket == true) {
|
|
933
|
+
try {
|
|
934
|
+
const full = this.ConstructUrl();
|
|
935
|
+
this.messageBroker = new MessageBroker.WebSocketBroker(full, this.env);
|
|
936
|
+
}
|
|
937
|
+
catch (e) {
|
|
938
|
+
console.warn("BruceApi: Failed to create message broker.", e);
|
|
939
|
+
}
|
|
903
940
|
}
|
|
904
|
-
}));
|
|
905
|
-
yield api.SetCacheItem({
|
|
906
|
-
key: GetCacheKey(id),
|
|
907
|
-
value: prom,
|
|
908
|
-
req: reqParams
|
|
909
941
|
});
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
942
|
+
}
|
|
943
|
+
getDomain() {
|
|
944
|
+
const env = this.env.toUpperCase();
|
|
945
|
+
let domain = "nextspace.host";
|
|
946
|
+
switch (env) {
|
|
947
|
+
case Api.EEnv.DEV:
|
|
948
|
+
domain = "nextspace-dev.net";
|
|
949
|
+
break;
|
|
950
|
+
case Api.EEnv.STG:
|
|
951
|
+
domain = "nextspace-stg.net";
|
|
952
|
+
break;
|
|
953
|
+
case Api.EEnv.UAT:
|
|
954
|
+
domain = "nextspace-uat.net";
|
|
955
|
+
break;
|
|
956
|
+
case Api.EEnv.PROD:
|
|
957
|
+
domain = "nextspace.host";
|
|
958
|
+
break;
|
|
959
|
+
default:
|
|
960
|
+
console.error("Specified Environment is not valid. SuppliedEnv=" + env);
|
|
928
961
|
}
|
|
929
|
-
|
|
962
|
+
return domain;
|
|
963
|
+
}
|
|
964
|
+
/**
|
|
965
|
+
* Loads the regional configuration for the account.
|
|
966
|
+
* If the config is already loaded then this will do nothing.
|
|
967
|
+
*/
|
|
968
|
+
LoadConfig(params) {
|
|
969
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
970
|
+
let { guardian, forceLoad } = (params !== null && params !== void 0 ? params : {});
|
|
971
|
+
if (this.configLoadAttempted && forceLoad != true) {
|
|
972
|
+
return;
|
|
973
|
+
}
|
|
974
|
+
this.configLoadAttempted = true;
|
|
930
975
|
try {
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
yield api.SetCacheItem({
|
|
935
|
-
key: data.ID,
|
|
936
|
-
value: prom,
|
|
937
|
-
req: reqParams
|
|
976
|
+
if (!guardian) {
|
|
977
|
+
guardian = new GuardianApi.Api({
|
|
978
|
+
env: this.env
|
|
938
979
|
});
|
|
939
980
|
}
|
|
940
|
-
|
|
941
|
-
|
|
981
|
+
const { account } = yield Account.GetBySubdomain({
|
|
982
|
+
subdomain: this.accountId,
|
|
983
|
+
api: guardian
|
|
942
984
|
});
|
|
985
|
+
if (!this.loadCancelled) {
|
|
986
|
+
// Set the calculated base url.
|
|
987
|
+
// If this is not available then this is considered a critical failure.
|
|
988
|
+
// However I am not crashing here because I want to monitor this in production.
|
|
989
|
+
if (account.URL) {
|
|
990
|
+
const urls = account.URL;
|
|
991
|
+
if (urls === null || urls === void 0 ? void 0 : urls.Base) {
|
|
992
|
+
this.baseUrl = urls.Base;
|
|
993
|
+
}
|
|
994
|
+
if (urls === null || urls === void 0 ? void 0 : urls.CDNEntities) {
|
|
995
|
+
this.EntityCdnUrl = urls.CDNEntities;
|
|
996
|
+
}
|
|
997
|
+
if (urls === null || urls === void 0 ? void 0 : urls.CDNTileset) {
|
|
998
|
+
this.TilesetCdnUrl = urls.CDNTileset;
|
|
999
|
+
}
|
|
1000
|
+
if (urls === null || urls === void 0 ? void 0 : urls.CDNLegacyTileset) {
|
|
1001
|
+
this.LegacyTilesetCdnUrl = urls.CDNLegacyTileset;
|
|
1002
|
+
}
|
|
1003
|
+
if (urls === null || urls === void 0 ? void 0 : urls.CDNBase) {
|
|
1004
|
+
this.cdnBaseUrl = urls.CDNBase;
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
else {
|
|
1008
|
+
console.error("BruceApi: Failed to load regional configuration for account.", this.accountId);
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
943
1011
|
}
|
|
944
1012
|
catch (e) {
|
|
945
|
-
|
|
1013
|
+
console.error(e);
|
|
946
1014
|
}
|
|
947
|
-
}));
|
|
948
|
-
yield api.SetCacheItem({
|
|
949
|
-
key: GetCacheKey(subdomain),
|
|
950
|
-
value: prom,
|
|
951
|
-
req: reqParams
|
|
952
1015
|
});
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
let { api, req: reqParams } = params;
|
|
965
|
-
if (!api) {
|
|
966
|
-
api = ENVIRONMENT.Api().GetGuardianApi();
|
|
967
|
-
}
|
|
968
|
-
const cache = yield api.GetCacheItem(GetListCacheKey(api.GetSessionId()), reqParams);
|
|
969
|
-
if (cache === null || cache === void 0 ? void 0 : cache.found) {
|
|
970
|
-
return cache.data;
|
|
971
|
-
}
|
|
972
|
-
const req = api.GET("user/relatedClientAccounts", reqParams);
|
|
973
|
-
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
974
|
-
try {
|
|
975
|
-
const data = yield req;
|
|
976
|
-
const items = data.Items.filter((x) => !ACCOUNT_EXCLUSIONS.includes(x.ID));
|
|
977
|
-
res({
|
|
978
|
-
accounts: items
|
|
979
|
-
});
|
|
980
|
-
}
|
|
981
|
-
catch (e) {
|
|
982
|
-
rej(e);
|
|
1016
|
+
}
|
|
1017
|
+
/**
|
|
1018
|
+
* Creates a message broker instance and returns it.
|
|
1019
|
+
* If an instance is already created, it will return that one.
|
|
1020
|
+
* @warning This will await the loading promise to avoid using data that isn't ready.
|
|
1021
|
+
*/
|
|
1022
|
+
ConnectWebsocket() {
|
|
1023
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1024
|
+
yield this.loadProm;
|
|
1025
|
+
if (this.messageBroker) {
|
|
1026
|
+
return this.messageBroker;
|
|
983
1027
|
}
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
value: prom,
|
|
988
|
-
req: reqParams
|
|
1028
|
+
const full = this.ConstructUrl();
|
|
1029
|
+
this.messageBroker = new MessageBroker.WebSocketBroker(full, this.env);
|
|
1030
|
+
return this.messageBroker;
|
|
989
1031
|
});
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1032
|
+
}
|
|
1033
|
+
/**
|
|
1034
|
+
* Warning: This method does not wait for init to finish loading.
|
|
1035
|
+
* This means the url could be changed once fully initialized.
|
|
1036
|
+
* The url will be valid either way, but the loaded one may be faster as it is region specific.
|
|
1037
|
+
* Await the "Loading" promise if you care about this.
|
|
1038
|
+
* @warning use ConstructUrl instead as the baseUrl may have a query param for the account.
|
|
1039
|
+
* @returns
|
|
1040
|
+
*/
|
|
1041
|
+
GetBaseUrl() {
|
|
1042
|
+
return this.baseUrl;
|
|
1043
|
+
}
|
|
1044
|
+
/**
|
|
1045
|
+
* Warning: Wait the "Loading" promise before using this url.
|
|
1046
|
+
* @warning use ConstructUrl instead as the baseUrl may have a query param for the account.
|
|
1047
|
+
* @returns
|
|
1048
|
+
*/
|
|
1049
|
+
GetCdnBaseUrl() {
|
|
1050
|
+
return this.cdnBaseUrl;
|
|
1051
|
+
}
|
|
1052
|
+
/**
|
|
1053
|
+
* Returns a url with the provided url appended to the loaded base url.
|
|
1054
|
+
* If the base url is not loaded yet, this will return null.
|
|
1055
|
+
* @param params
|
|
1056
|
+
*/
|
|
1057
|
+
ConstructUrl(params) {
|
|
1058
|
+
if (!(params === null || params === void 0 ? void 0 : params.url)) {
|
|
1059
|
+
return null;
|
|
1004
1060
|
}
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
return cache.data;
|
|
1061
|
+
if ((params === null || params === void 0 ? void 0 : params.cdn) && this.cdnBaseUrl) {
|
|
1062
|
+
return this.ConstructCdnUrl(params.url, params.urlParams);
|
|
1008
1063
|
}
|
|
1009
|
-
const
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
const settings = (_a = data === null || data === void 0 ? void 0 : data["Application.Settings"]) !== null && _a !== void 0 ? _a : {};
|
|
1015
|
-
res({
|
|
1016
|
-
settings: settings
|
|
1064
|
+
const tmp = new URL(this.baseUrl);
|
|
1065
|
+
if (params === null || params === void 0 ? void 0 : params.urlParams) {
|
|
1066
|
+
if (params.urlParams instanceof URLSearchParams) {
|
|
1067
|
+
params.urlParams.forEach((value, key) => {
|
|
1068
|
+
tmp.searchParams.append(key, value);
|
|
1017
1069
|
});
|
|
1018
1070
|
}
|
|
1019
|
-
|
|
1020
|
-
|
|
1071
|
+
else {
|
|
1072
|
+
for (const key in params.urlParams) {
|
|
1073
|
+
tmp.searchParams.append(key, params.urlParams[key]);
|
|
1074
|
+
}
|
|
1021
1075
|
}
|
|
1022
|
-
}));
|
|
1023
|
-
yield api.SetCacheItem({
|
|
1024
|
-
key: GetCacheKey(id, appId),
|
|
1025
|
-
value: prom,
|
|
1026
|
-
req: reqParams
|
|
1027
|
-
});
|
|
1028
|
-
return prom;
|
|
1029
|
-
});
|
|
1030
|
-
}
|
|
1031
|
-
Account.GetAppSettings = GetAppSettings;
|
|
1032
|
-
/**
|
|
1033
|
-
* Updates application settings for a specific client account + application.
|
|
1034
|
-
* WARNING: Do not update API settings without knowing what you're doing.
|
|
1035
|
-
* @param params
|
|
1036
|
-
* @returns
|
|
1037
|
-
*/
|
|
1038
|
-
function UpdateAppSettings(params) {
|
|
1039
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1040
|
-
let { api, accountId: id, appId, settings: data, req: reqParams } = params;
|
|
1041
|
-
if (!api) {
|
|
1042
|
-
api = ENVIRONMENT.Api().GetGuardianApi();
|
|
1043
|
-
}
|
|
1044
|
-
const res = yield api.POST(`account/${id}/applicationSettings/${appId}`, data, reqParams);
|
|
1045
|
-
yield api.Cache.RemoveByStartsWith(Api.ECacheKey.Account + Api.ECacheKey.Id + id);
|
|
1046
|
-
return {
|
|
1047
|
-
settings: res
|
|
1048
|
-
};
|
|
1049
|
-
});
|
|
1050
|
-
}
|
|
1051
|
-
Account.UpdateAppSettings = UpdateAppSettings;
|
|
1052
|
-
/**
|
|
1053
|
-
* Creates a new Nextspace account using given details.
|
|
1054
|
-
* @param params
|
|
1055
|
-
* @returns
|
|
1056
|
-
*/
|
|
1057
|
-
function Create(params) {
|
|
1058
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1059
|
-
let { api, accountId: id, name, hostingLocationKey, starterContent, req: reqParams } = params;
|
|
1060
|
-
if (!id || !name || !hostingLocationKey) {
|
|
1061
|
-
throw new Error("Id, Name and hostingLocationKey are required.");
|
|
1062
1076
|
}
|
|
1063
|
-
|
|
1064
|
-
|
|
1077
|
+
// Ensure the url ends with a slash.
|
|
1078
|
+
if (!tmp.pathname.endsWith("/")) {
|
|
1079
|
+
tmp.pathname += "/";
|
|
1065
1080
|
}
|
|
1066
|
-
if (
|
|
1067
|
-
|
|
1081
|
+
if (params === null || params === void 0 ? void 0 : params.url) {
|
|
1082
|
+
// Ensure the url does not start with a slash.
|
|
1083
|
+
// This is because the base url already has a slash at the end.
|
|
1084
|
+
if (params.url.startsWith("/")) {
|
|
1085
|
+
params.url = params.url.substring(1);
|
|
1086
|
+
}
|
|
1087
|
+
tmp.pathname += params.url;
|
|
1068
1088
|
}
|
|
1069
|
-
|
|
1070
|
-
"Name": name,
|
|
1071
|
-
"HostingLocation.Key": hostingLocationKey,
|
|
1072
|
-
"StarterContent": starterContent
|
|
1073
|
-
};
|
|
1074
|
-
const res = yield api.POST(`clientAccount/${id}`, reqData, Api.PrepReqParams(reqParams));
|
|
1075
|
-
const resData = {
|
|
1076
|
-
account: res
|
|
1077
|
-
};
|
|
1078
|
-
api.Cache.Remove(GetListCacheKey(api.GetSessionId()));
|
|
1079
|
-
return resData;
|
|
1080
|
-
});
|
|
1081
|
-
}
|
|
1082
|
-
Account.Create = Create;
|
|
1083
|
-
/**
|
|
1084
|
-
* Returns cache identifier for an account by ID.
|
|
1085
|
-
* Example: {
|
|
1086
|
-
* const api: BruceApi.Api = ...;
|
|
1087
|
-
* const key = GetCacheKey(1);
|
|
1088
|
-
* api.Cache.Remove(key);
|
|
1089
|
-
* }
|
|
1090
|
-
* @param accountId
|
|
1091
|
-
* @param appSettingsId
|
|
1092
|
-
* @returns
|
|
1093
|
-
*/
|
|
1094
|
-
function GetCacheKey(accountId, appSettingsId) {
|
|
1095
|
-
if (appSettingsId) {
|
|
1096
|
-
return Api.ECacheKey.Account + Api.ECacheKey.Id + accountId + Api.ECacheKey + appSettingsId;
|
|
1089
|
+
return tmp.toString();
|
|
1097
1090
|
}
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
* @param ssid
|
|
1109
|
-
* @returns
|
|
1110
|
-
*/
|
|
1111
|
-
function GetListCacheKey(ssid) {
|
|
1112
|
-
return Api.ECacheKey.Account + Api.ECacheKey.Session + Api.ECacheKey.Id + ssid;
|
|
1113
|
-
}
|
|
1114
|
-
Account.GetListCacheKey = GetListCacheKey;
|
|
1115
|
-
/**
|
|
1116
|
-
* Returns cache identifier for a list of database regions.
|
|
1117
|
-
* Example: {
|
|
1118
|
-
* const api: BruceApi.Api = ...;
|
|
1119
|
-
* const key = GetDbRegionListCacheKey();
|
|
1120
|
-
* api.Cache.Remove(key);
|
|
1121
|
-
* }
|
|
1122
|
-
* @returns
|
|
1123
|
-
*/
|
|
1124
|
-
function GetDbRegionListCacheKey() {
|
|
1125
|
-
return Api.ECacheKey.DatabaseRegion;
|
|
1126
|
-
}
|
|
1127
|
-
Account.GetDbRegionListCacheKey = GetDbRegionListCacheKey;
|
|
1128
|
-
})(Account || (Account = {}));
|
|
1129
|
-
|
|
1130
|
-
/**
|
|
1131
|
-
* A hosting location is a record for a possible bruce-api server configuration.
|
|
1132
|
-
* A hosting location will have one or many database servers as well, this is an additional setting.
|
|
1133
|
-
*/
|
|
1134
|
-
var HostingLocation;
|
|
1135
|
-
(function (HostingLocation) {
|
|
1136
|
-
/**
|
|
1137
|
-
* Returns a list of hosting locations.
|
|
1138
|
-
* @Warning: This will not return the Settings property.
|
|
1139
|
-
* @param params
|
|
1140
|
-
* @returns
|
|
1141
|
-
*/
|
|
1142
|
-
function GetList(params) {
|
|
1143
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1144
|
-
let { api, req } = params;
|
|
1145
|
-
if (!api) {
|
|
1146
|
-
api = ENVIRONMENT.Api().GetGuardianApi();
|
|
1091
|
+
/**
|
|
1092
|
+
* Returns a url routed through the API's CDN.
|
|
1093
|
+
* If the CDN is not enabled for the account, this will return null.
|
|
1094
|
+
* @param url suffix to append to the base url.
|
|
1095
|
+
* @param urlParams
|
|
1096
|
+
* @returns
|
|
1097
|
+
*/
|
|
1098
|
+
ConstructCdnUrl(url, urlParams) {
|
|
1099
|
+
if (!this.cdnBaseUrl) {
|
|
1100
|
+
return null;
|
|
1147
1101
|
}
|
|
1148
|
-
const
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
function GetById(params) {
|
|
1161
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1162
|
-
let { id, api, req } = params;
|
|
1163
|
-
if (!id) {
|
|
1164
|
-
throw ("Invalid id");
|
|
1102
|
+
const tmp = new URL(this.cdnBaseUrl);
|
|
1103
|
+
if (urlParams) {
|
|
1104
|
+
if (urlParams instanceof URLSearchParams) {
|
|
1105
|
+
urlParams.forEach((value, key) => {
|
|
1106
|
+
tmp.searchParams.append(key, value);
|
|
1107
|
+
});
|
|
1108
|
+
}
|
|
1109
|
+
else {
|
|
1110
|
+
for (const key in urlParams) {
|
|
1111
|
+
tmp.searchParams.append(key, urlParams[key]);
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1165
1114
|
}
|
|
1166
|
-
|
|
1167
|
-
|
|
1115
|
+
// Ensure the url ends with a slash.
|
|
1116
|
+
if (!tmp.pathname.endsWith("/")) {
|
|
1117
|
+
tmp.pathname += "/";
|
|
1168
1118
|
}
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
/**
|
|
1177
|
-
* Returns a hosting location record by key.
|
|
1178
|
-
* @param params
|
|
1179
|
-
* @returns
|
|
1180
|
-
*/
|
|
1181
|
-
function GetByKey(params) {
|
|
1182
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1183
|
-
let { key, api, req } = params;
|
|
1184
|
-
if (!key) {
|
|
1185
|
-
throw ("Invalid key");
|
|
1119
|
+
if (url) {
|
|
1120
|
+
// Ensure the url does not start with a slash.
|
|
1121
|
+
// This is because the base url already has a slash at the end.
|
|
1122
|
+
if (url.startsWith("/")) {
|
|
1123
|
+
url = url.substring(1);
|
|
1124
|
+
}
|
|
1125
|
+
tmp.pathname += url;
|
|
1186
1126
|
}
|
|
1187
|
-
|
|
1188
|
-
api = ENVIRONMENT.Api().GetGuardianApi();
|
|
1189
|
-
}
|
|
1190
|
-
const res = yield api.GET(`hostinglocation/key/${key}`, Api.PrepReqParams(req));
|
|
1191
|
-
return {
|
|
1192
|
-
location: res
|
|
1193
|
-
};
|
|
1194
|
-
});
|
|
1195
|
-
}
|
|
1196
|
-
HostingLocation.GetByKey = GetByKey;
|
|
1197
|
-
/**
|
|
1198
|
-
* Returns hostingLocationKey from given db url.
|
|
1199
|
-
* Some older accounts don't have this set, so we need to guess it.
|
|
1200
|
-
* @param params
|
|
1201
|
-
* @returns
|
|
1202
|
-
*/
|
|
1203
|
-
function GuessKey(params) {
|
|
1204
|
-
const { DBServer: databaseUrl } = params;
|
|
1205
|
-
if (databaseUrl.includes("hyperfarm-prod-instance-1")) {
|
|
1206
|
-
return "HYPERFARM";
|
|
1207
|
-
}
|
|
1208
|
-
if (databaseUrl.includes("prod-syd1.nextspace.host")) {
|
|
1209
|
-
return "AU-VULTR-FIRST";
|
|
1210
|
-
}
|
|
1211
|
-
else if (databaseUrl.includes("prod-nyc1.nextspace.host")) {
|
|
1212
|
-
return "US-VULTR-FIRST";
|
|
1213
|
-
}
|
|
1214
|
-
else if (databaseUrl.includes("prod-ams1.nextspace.host")) {
|
|
1215
|
-
return "EU-VULTR-FIRST";
|
|
1216
|
-
}
|
|
1217
|
-
else if (databaseUrl.includes("prod-sing1.nextspace.host")) {
|
|
1218
|
-
return "SE-VULTR-FIRST";
|
|
1219
|
-
}
|
|
1220
|
-
else if (databaseUrl.includes("dev-first")) {
|
|
1221
|
-
return "DEV-FIRST";
|
|
1222
|
-
}
|
|
1223
|
-
else if (databaseUrl.includes(".ap-southeast-1.")) {
|
|
1224
|
-
return "SE";
|
|
1127
|
+
return tmp.toString();
|
|
1225
1128
|
}
|
|
1226
|
-
|
|
1227
|
-
|
|
1129
|
+
/**
|
|
1130
|
+
* Warning: This will cancel the init process.
|
|
1131
|
+
* The init process loads a region specific endpoint.
|
|
1132
|
+
* Setting a base url will stop that process from completing.
|
|
1133
|
+
* @param url
|
|
1134
|
+
*/
|
|
1135
|
+
SetBaseUrl(url) {
|
|
1136
|
+
this.baseUrl = url;
|
|
1137
|
+
if (!this.baseUrl.endsWith("/")) {
|
|
1138
|
+
this.baseUrl += "/";
|
|
1139
|
+
}
|
|
1140
|
+
this.loadCancelled = true;
|
|
1228
1141
|
}
|
|
1229
|
-
|
|
1230
|
-
|
|
1142
|
+
/**
|
|
1143
|
+
* Performs an HTTP GET request.
|
|
1144
|
+
* This will prepend the base url to the url.
|
|
1145
|
+
* @param url
|
|
1146
|
+
* @param params
|
|
1147
|
+
* @returns
|
|
1148
|
+
*/
|
|
1149
|
+
GET(url, params) {
|
|
1150
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1151
|
+
return new Promise((res, rej) => {
|
|
1152
|
+
this.loadProm.then(() => {
|
|
1153
|
+
const full = this.ConstructUrl({
|
|
1154
|
+
url: url
|
|
1155
|
+
});
|
|
1156
|
+
this.get(full, params).then(res).catch(rej);
|
|
1157
|
+
}).catch(rej);
|
|
1158
|
+
});
|
|
1159
|
+
});
|
|
1231
1160
|
}
|
|
1232
|
-
|
|
1233
|
-
|
|
1161
|
+
/**
|
|
1162
|
+
* Performs an HTTP DELETE request.
|
|
1163
|
+
* This will prepend the base url to the url.
|
|
1164
|
+
* @param url
|
|
1165
|
+
* @param params
|
|
1166
|
+
* @returns
|
|
1167
|
+
*/
|
|
1168
|
+
DELETE(url, params) {
|
|
1169
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1170
|
+
return new Promise((res, rej) => {
|
|
1171
|
+
this.loadProm.then(() => {
|
|
1172
|
+
const full = this.ConstructUrl({
|
|
1173
|
+
url: url
|
|
1174
|
+
});
|
|
1175
|
+
this.delete(full, params).then(res).catch(rej);
|
|
1176
|
+
}).catch(rej);
|
|
1177
|
+
});
|
|
1178
|
+
});
|
|
1234
1179
|
}
|
|
1235
|
-
|
|
1236
|
-
|
|
1180
|
+
/**
|
|
1181
|
+
* Performs an HTTP POST request.
|
|
1182
|
+
* This will prepend the base url to the url.
|
|
1183
|
+
* @param url
|
|
1184
|
+
* @param data
|
|
1185
|
+
* @param params
|
|
1186
|
+
* @returns
|
|
1187
|
+
*/
|
|
1188
|
+
POST(url, data, params) {
|
|
1189
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1190
|
+
return new Promise((res, rej) => {
|
|
1191
|
+
this.loadProm.then(() => {
|
|
1192
|
+
const full = this.ConstructUrl({
|
|
1193
|
+
url: url
|
|
1194
|
+
});
|
|
1195
|
+
this.post(full, data, params).then(res).catch(rej);
|
|
1196
|
+
}).catch(rej);
|
|
1197
|
+
});
|
|
1198
|
+
});
|
|
1237
1199
|
}
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
// We'll prioritize account record if provided.
|
|
1256
|
-
if (accountId && !account) {
|
|
1257
|
-
account = (yield Account.Get({
|
|
1258
|
-
accountId,
|
|
1259
|
-
api,
|
|
1260
|
-
req
|
|
1261
|
-
})).account;
|
|
1262
|
-
}
|
|
1263
|
-
if (account === null || account === void 0 ? void 0 : account["HostingLocation.Key"]) {
|
|
1264
|
-
return {
|
|
1265
|
-
key: account["HostingLocation.Key"],
|
|
1266
|
-
isLegacy: false
|
|
1267
|
-
};
|
|
1268
|
-
}
|
|
1269
|
-
// Fallback to settings JSON for older records.
|
|
1270
|
-
const settings = apiSettings ? apiSettings : (yield Account.GetAppSettings({
|
|
1271
|
-
api,
|
|
1272
|
-
accountId,
|
|
1273
|
-
appId: Account.EAppId.BruceApi
|
|
1274
|
-
})).settings;
|
|
1275
|
-
let hostingKey = settings["HostingLocation.Key"];
|
|
1276
|
-
let isLegacy = false;
|
|
1277
|
-
if (!hostingKey) {
|
|
1278
|
-
hostingKey = settings.DBLocation;
|
|
1279
|
-
isLegacy = true;
|
|
1280
|
-
}
|
|
1281
|
-
if (!hostingKey) {
|
|
1282
|
-
hostingKey = GuessKey({
|
|
1283
|
-
DBServer: settings.DBServer
|
|
1200
|
+
/**
|
|
1201
|
+
* Performs an HTTP PUT request.
|
|
1202
|
+
* This will prepend the base url to the url.
|
|
1203
|
+
* @param url
|
|
1204
|
+
* @param data
|
|
1205
|
+
* @param params
|
|
1206
|
+
* @returns
|
|
1207
|
+
*/
|
|
1208
|
+
PUT(url, data, params) {
|
|
1209
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1210
|
+
return new Promise((res, rej) => {
|
|
1211
|
+
this.loadProm.then(() => {
|
|
1212
|
+
const full = this.ConstructUrl({
|
|
1213
|
+
url: url
|
|
1214
|
+
});
|
|
1215
|
+
this.put(full, data, params).then(res).catch(rej);
|
|
1216
|
+
}).catch(rej);
|
|
1284
1217
|
});
|
|
1285
|
-
isLegacy = true;
|
|
1286
|
-
}
|
|
1287
|
-
return {
|
|
1288
|
-
key: hostingKey,
|
|
1289
|
-
isLegacy
|
|
1290
|
-
};
|
|
1291
|
-
});
|
|
1292
|
-
}
|
|
1293
|
-
HostingLocation.GetKeyByAccountId = GetKeyByAccountId;
|
|
1294
|
-
/**
|
|
1295
|
-
* Returns a hosting location record by account ID.
|
|
1296
|
-
* @param params
|
|
1297
|
-
* @returns
|
|
1298
|
-
*/
|
|
1299
|
-
function GetByAccountId(params) {
|
|
1300
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1301
|
-
let { accountId, apiSettings, api, req, account } = params;
|
|
1302
|
-
if (!api) {
|
|
1303
|
-
api = ENVIRONMENT.Api().GetGuardianApi();
|
|
1304
|
-
}
|
|
1305
|
-
const data = yield GetKeyByAccountId({
|
|
1306
|
-
accountId,
|
|
1307
|
-
account,
|
|
1308
|
-
apiSettings,
|
|
1309
|
-
api,
|
|
1310
|
-
req
|
|
1311
1218
|
});
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1219
|
+
}
|
|
1220
|
+
/**
|
|
1221
|
+
* Performs a file upload request (HTTP POST).
|
|
1222
|
+
* This will prepend the base url to the url.
|
|
1223
|
+
* @param url
|
|
1224
|
+
* @param blob
|
|
1225
|
+
* @param params
|
|
1226
|
+
* @returns
|
|
1227
|
+
*/
|
|
1228
|
+
UPLOAD(url, blob, params) {
|
|
1229
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1230
|
+
return new Promise((res, rej) => {
|
|
1231
|
+
this.loadProm.then(() => {
|
|
1232
|
+
const full = this.ConstructUrl({
|
|
1233
|
+
url: url
|
|
1234
|
+
});
|
|
1235
|
+
this.upload(full, blob, params).then(res).catch(rej);
|
|
1236
|
+
}).catch(rej);
|
|
1237
|
+
});
|
|
1319
1238
|
});
|
|
1320
|
-
|
|
1321
|
-
});
|
|
1239
|
+
}
|
|
1322
1240
|
}
|
|
1323
|
-
|
|
1324
|
-
})(
|
|
1241
|
+
BruceApi$$1.Api = Api$$1;
|
|
1242
|
+
})(BruceApi || (BruceApi = {}));
|
|
1325
1243
|
|
|
1326
1244
|
/**
|
|
1327
|
-
*
|
|
1328
|
-
*
|
|
1245
|
+
* This is the request handler for Global Api,
|
|
1246
|
+
* The global api is used to store information that is higher level than client accounts.
|
|
1247
|
+
* For example it will store usage records, client account group settings, data sharing settings, etc.
|
|
1329
1248
|
*/
|
|
1330
|
-
var
|
|
1331
|
-
(function (
|
|
1332
|
-
/**
|
|
1333
|
-
* This is the request handler for Bruce Api,
|
|
1334
|
-
* it should be passed to any method that wants to communicate with this particular api.
|
|
1335
|
-
*/
|
|
1249
|
+
var GlobalApi;
|
|
1250
|
+
(function (GlobalApi) {
|
|
1336
1251
|
class Api$$1 extends AbstractApi {
|
|
1337
|
-
get AccountId() {
|
|
1338
|
-
return this.accountId;
|
|
1339
|
-
}
|
|
1340
|
-
get MessageBroker() {
|
|
1341
|
-
return this.messageBroker;
|
|
1342
|
-
}
|
|
1343
|
-
get ConfigLoadAttempted() {
|
|
1344
|
-
return this.configLoadAttempted;
|
|
1345
|
-
}
|
|
1346
|
-
get Version() {
|
|
1347
|
-
return this.version;
|
|
1348
|
-
}
|
|
1349
|
-
get Loading() {
|
|
1350
|
-
return this.loadProm;
|
|
1351
|
-
}
|
|
1352
1252
|
constructor(params) {
|
|
1353
1253
|
super({
|
|
1354
1254
|
ssidHeader: "x-sessionid",
|
|
1355
|
-
cacheId: `
|
|
1255
|
+
cacheId: `GLOBAL_API_${params === null || params === void 0 ? void 0 : params.env}_`
|
|
1356
1256
|
});
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
this.loadCancelled = false;
|
|
1360
|
-
// Indicates if loading the regional configuration was already called.
|
|
1361
|
-
this.configLoadAttempted = false;
|
|
1362
|
-
let { accountId, env, guardian, loadRegionalBaseUrl, loadConfig, loadWebSocket, dummy } = params;
|
|
1363
|
-
this.accountId = accountId;
|
|
1364
|
-
this.env = env !== null && env !== void 0 ? env : Api.EEnv.PROD;
|
|
1365
|
-
if (!dummy) {
|
|
1366
|
-
// Backwards compatibility.
|
|
1367
|
-
if (loadRegionalBaseUrl) {
|
|
1368
|
-
loadConfig = true;
|
|
1369
|
-
}
|
|
1370
|
-
if (loadConfig) {
|
|
1371
|
-
// Mark it as attempted right away because we don't want any external calls while it gets to that async point.
|
|
1372
|
-
this.configLoadAttempted = true;
|
|
1373
|
-
}
|
|
1374
|
-
this.loadProm = this.init(guardian, loadConfig, loadWebSocket);
|
|
1375
|
-
}
|
|
1257
|
+
this.env = (params === null || params === void 0 ? void 0 : params.env) ? params.env : Api.EEnv.PROD;
|
|
1258
|
+
this.setBaseUrl();
|
|
1376
1259
|
}
|
|
1377
1260
|
/**
|
|
1378
|
-
*
|
|
1379
|
-
* @param guardian Required for loading regional base url.
|
|
1380
|
-
* @param loadConfig
|
|
1381
|
-
* @returns
|
|
1261
|
+
* Sets the base url for this api.
|
|
1382
1262
|
*/
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
if (!this.accountId) {
|
|
1386
|
-
throw ("accountId is required.");
|
|
1387
|
-
}
|
|
1388
|
-
// Set using a stable default.
|
|
1389
|
-
const domain = this.getDomain();
|
|
1390
|
-
this.baseUrl = `https://${this.accountId}.api.${domain}/`;
|
|
1391
|
-
// Attempt to load regional configuration.
|
|
1392
|
-
if (loadConfig) {
|
|
1393
|
-
yield this.LoadConfig({
|
|
1394
|
-
guardian: guardian,
|
|
1395
|
-
// We marked it as attempted to load outside this method to fight any external calls.
|
|
1396
|
-
// So we'll force load it now.
|
|
1397
|
-
forceLoad: true
|
|
1398
|
-
});
|
|
1399
|
-
}
|
|
1400
|
-
// Get the version.
|
|
1401
|
-
if (this.baseUrl) {
|
|
1402
|
-
const data = yield this.get(this.baseUrl + "version");
|
|
1403
|
-
if (data === null || data === void 0 ? void 0 : data["Bruce-API"]) {
|
|
1404
|
-
this.version = data["Bruce-API"];
|
|
1405
|
-
}
|
|
1406
|
-
else {
|
|
1407
|
-
this.version = "UNKNOWN";
|
|
1408
|
-
}
|
|
1409
|
-
}
|
|
1410
|
-
// Start web socket connection.
|
|
1411
|
-
if (loadWebSocket == true) {
|
|
1412
|
-
try {
|
|
1413
|
-
this.messageBroker = new MessageBroker.WebSocketBroker(this.baseUrl, this.env);
|
|
1414
|
-
}
|
|
1415
|
-
catch (e) {
|
|
1416
|
-
console.warn("BruceApi: Failed to create message broker.", e);
|
|
1417
|
-
}
|
|
1418
|
-
}
|
|
1419
|
-
});
|
|
1420
|
-
}
|
|
1421
|
-
getDomain() {
|
|
1263
|
+
setBaseUrl() {
|
|
1264
|
+
let url;
|
|
1422
1265
|
const env = this.env.toUpperCase();
|
|
1423
|
-
let domain = "nextspace.host";
|
|
1424
1266
|
switch (env) {
|
|
1425
1267
|
case Api.EEnv.DEV:
|
|
1426
|
-
|
|
1268
|
+
url = "https://bruceglobal.nextspace-dev.net/";
|
|
1427
1269
|
break;
|
|
1428
1270
|
case Api.EEnv.STG:
|
|
1429
|
-
|
|
1271
|
+
url = "https://bruceglobal.nextspace-stg.net/";
|
|
1430
1272
|
break;
|
|
1431
1273
|
case Api.EEnv.UAT:
|
|
1432
|
-
|
|
1274
|
+
url = "https://bruceglobal.api.nextspace-uat.net/";
|
|
1433
1275
|
break;
|
|
1434
1276
|
case Api.EEnv.PROD:
|
|
1435
|
-
|
|
1277
|
+
url = "https://bruceglobal.api.nextspace.host/";
|
|
1436
1278
|
break;
|
|
1437
1279
|
default:
|
|
1438
|
-
|
|
1280
|
+
throw ("Specified Environment is not valid. SuppliedEnv=" + env);
|
|
1439
1281
|
}
|
|
1440
|
-
|
|
1441
|
-
}
|
|
1442
|
-
/**
|
|
1443
|
-
* Loads the regional configuration for the account.
|
|
1444
|
-
* If the config is already loaded then this will do nothing.
|
|
1445
|
-
*/
|
|
1446
|
-
LoadConfig(params) {
|
|
1447
|
-
var _a, _b, _c;
|
|
1448
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1449
|
-
let { guardian, forceLoad } = (params !== null && params !== void 0 ? params : {});
|
|
1450
|
-
if (this.configLoadAttempted && forceLoad != true) {
|
|
1451
|
-
return;
|
|
1452
|
-
}
|
|
1453
|
-
this.configLoadAttempted = true;
|
|
1454
|
-
try {
|
|
1455
|
-
if (!guardian) {
|
|
1456
|
-
guardian = new GuardianApi.Api({
|
|
1457
|
-
env: this.env
|
|
1458
|
-
});
|
|
1459
|
-
}
|
|
1460
|
-
const { account } = yield Account.GetBySubdomain({
|
|
1461
|
-
subdomain: this.accountId,
|
|
1462
|
-
api: guardian
|
|
1463
|
-
});
|
|
1464
|
-
// Precalculated URLs exist.
|
|
1465
|
-
// Soon this will be a stable requirement for any account record.
|
|
1466
|
-
if (account.URL) {
|
|
1467
|
-
if (!this.loadCancelled) {
|
|
1468
|
-
const urls = account.URL;
|
|
1469
|
-
if (urls === null || urls === void 0 ? void 0 : urls.Base) {
|
|
1470
|
-
this.baseUrl = urls.Base;
|
|
1471
|
-
}
|
|
1472
|
-
if (urls === null || urls === void 0 ? void 0 : urls.CDNEntities) {
|
|
1473
|
-
this.EntityCdnUrl = urls.CDNEntities;
|
|
1474
|
-
}
|
|
1475
|
-
if (urls === null || urls === void 0 ? void 0 : urls.CDNTileset) {
|
|
1476
|
-
this.TilesetCdnUrl = urls.CDNTileset;
|
|
1477
|
-
}
|
|
1478
|
-
if (urls === null || urls === void 0 ? void 0 : urls.CDNLegacyTileset) {
|
|
1479
|
-
this.LegacyTilesetCdnUrl = urls.CDNLegacyTileset;
|
|
1480
|
-
}
|
|
1481
|
-
if (urls === null || urls === void 0 ? void 0 : urls.CDNBase) {
|
|
1482
|
-
this.cdnBaseUrl = urls.CDNBase;
|
|
1483
|
-
}
|
|
1484
|
-
}
|
|
1485
|
-
}
|
|
1486
|
-
// Deprecated and will eventually stop working at all.
|
|
1487
|
-
else {
|
|
1488
|
-
const env = this.env.toUpperCase();
|
|
1489
|
-
const domain = this.getDomain();
|
|
1490
|
-
const host = yield HostingLocation.GetByAccountId({
|
|
1491
|
-
accountId: this.accountId,
|
|
1492
|
-
api: guardian
|
|
1493
|
-
});
|
|
1494
|
-
if (host === null || host === void 0 ? void 0 : host.location) {
|
|
1495
|
-
const settings = host.location.Settings;
|
|
1496
|
-
if (!this.loadCancelled) {
|
|
1497
|
-
// Attempt to load regional base url.
|
|
1498
|
-
// First try go through settings.
|
|
1499
|
-
let urlSet = false;
|
|
1500
|
-
if (settings === null || settings === void 0 ? void 0 : settings.BruceAPIURL) {
|
|
1501
|
-
let envUrl = settings.BruceAPIURL[env];
|
|
1502
|
-
if (envUrl) {
|
|
1503
|
-
envUrl = envUrl
|
|
1504
|
-
.replace("<ACCOUNTID>", this.accountId)
|
|
1505
|
-
.replace("<ACCOUNT>", this.accountId);
|
|
1506
|
-
if (envUrl && envUrl.length > 1) {
|
|
1507
|
-
this.baseUrl = envUrl;
|
|
1508
|
-
urlSet = true;
|
|
1509
|
-
}
|
|
1510
|
-
}
|
|
1511
|
-
}
|
|
1512
|
-
// Try go through host location's base url.
|
|
1513
|
-
// This may be wrong env which is why it's used as fallback right now.
|
|
1514
|
-
if (!urlSet && host.location.BruceAPIURL) {
|
|
1515
|
-
const regionalUrl = host.location.BruceAPIURL
|
|
1516
|
-
.replace("<ACCOUNTID>", this.accountId)
|
|
1517
|
-
.replace("<ACCOUNT>", this.accountId)
|
|
1518
|
-
.replace("<DOMAIN>", domain);
|
|
1519
|
-
if (regionalUrl && regionalUrl.length > 1) {
|
|
1520
|
-
this.baseUrl = regionalUrl;
|
|
1521
|
-
urlSet = true;
|
|
1522
|
-
}
|
|
1523
|
-
}
|
|
1524
|
-
}
|
|
1525
|
-
// Attempt to load CDN settings.
|
|
1526
|
-
if (settings === null || settings === void 0 ? void 0 : settings.CDN) {
|
|
1527
|
-
this.EntityCdnUrl = (_a = settings.CDN.entityURL) === null || _a === void 0 ? void 0 : _a[env];
|
|
1528
|
-
// We need to fix our configs.
|
|
1529
|
-
if (this.EntityCdnUrl) {
|
|
1530
|
-
if (this.EntityCdnUrl.includes("entitiesListForCDN")) {
|
|
1531
|
-
this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", this.accountId);
|
|
1532
|
-
}
|
|
1533
|
-
else {
|
|
1534
|
-
this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", "entitiesListForCDN/" + this.accountId);
|
|
1535
|
-
}
|
|
1536
|
-
}
|
|
1537
|
-
this.LegacyTilesetCdnUrl = (_b = settings.CDN.legacyTilesetURL) === null || _b === void 0 ? void 0 : _b[env];
|
|
1538
|
-
this.TilesetCdnUrl = (_c = settings.CDN.tilesetURL) === null || _c === void 0 ? void 0 : _c[env];
|
|
1539
|
-
if (this.TilesetCdnUrl) {
|
|
1540
|
-
this.TilesetCdnUrl = this.TilesetCdnUrl.replace("<ACCOUNT>", this.accountId);
|
|
1541
|
-
}
|
|
1542
|
-
// TilesetCdnUrl example: "https://blah.cloudfront.net/tilesets/<TILESETID>/files/<FILEPATH>?accountId=<ACCOUNT>".
|
|
1543
|
-
// Lazy at the moment to go around updating every region we have, I'll interpret the url from tilesetCdnUrl.
|
|
1544
|
-
if (this.TilesetCdnUrl) {
|
|
1545
|
-
try {
|
|
1546
|
-
const url = new URL(this.TilesetCdnUrl);
|
|
1547
|
-
this.cdnBaseUrl = `${url.protocol}//${url.hostname}/`;
|
|
1548
|
-
}
|
|
1549
|
-
catch (e) {
|
|
1550
|
-
console.error(e);
|
|
1551
|
-
}
|
|
1552
|
-
}
|
|
1553
|
-
}
|
|
1554
|
-
}
|
|
1555
|
-
}
|
|
1556
|
-
}
|
|
1557
|
-
catch (e) {
|
|
1558
|
-
console.error(e);
|
|
1559
|
-
}
|
|
1560
|
-
});
|
|
1561
|
-
}
|
|
1562
|
-
/**
|
|
1563
|
-
* Creates a message broker instance and returns it.
|
|
1564
|
-
* If an instance is already created, it will return that one.
|
|
1565
|
-
* @warning This will await the loading promise to avoid using data that isn't ready.
|
|
1566
|
-
*/
|
|
1567
|
-
ConnectWebsocket() {
|
|
1568
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1569
|
-
yield this.loadProm;
|
|
1570
|
-
if (this.messageBroker) {
|
|
1571
|
-
return this.messageBroker;
|
|
1572
|
-
}
|
|
1573
|
-
this.messageBroker = new MessageBroker.WebSocketBroker(this.baseUrl, this.env);
|
|
1574
|
-
return this.messageBroker;
|
|
1575
|
-
});
|
|
1282
|
+
this.baseUrl = url;
|
|
1576
1283
|
}
|
|
1577
1284
|
/**
|
|
1578
|
-
*
|
|
1579
|
-
* This means the url could be changed once fully initialized.
|
|
1580
|
-
* The url will be valid either way, but the loaded one may be faster as it is region specific.
|
|
1581
|
-
* Await the "Loading" promise if you care about this.
|
|
1285
|
+
* Gets the base url for this api.
|
|
1582
1286
|
* @returns
|
|
1583
1287
|
*/
|
|
1584
1288
|
GetBaseUrl() {
|
|
1585
1289
|
return this.baseUrl;
|
|
1586
1290
|
}
|
|
1587
1291
|
/**
|
|
1588
|
-
*
|
|
1589
|
-
* @returns
|
|
1590
|
-
*/
|
|
1591
|
-
GetCdnBaseUrl() {
|
|
1592
|
-
return this.cdnBaseUrl;
|
|
1593
|
-
}
|
|
1594
|
-
/**
|
|
1595
|
-
* Returns a url routed through the API's CDN.
|
|
1596
|
-
* If the CDN is not enabled for the account, this will return null.
|
|
1597
|
-
* @param url suffix to append to the base url.
|
|
1598
|
-
* @param urlParams
|
|
1599
|
-
* @returns
|
|
1600
|
-
*/
|
|
1601
|
-
ConstructCdnUrl(url, urlParams) {
|
|
1602
|
-
if (!this.cdnBaseUrl) {
|
|
1603
|
-
return null;
|
|
1604
|
-
}
|
|
1605
|
-
const tmp = new URL(this.cdnBaseUrl);
|
|
1606
|
-
if (urlParams && urlParams instanceof URLSearchParams) {
|
|
1607
|
-
urlParams.forEach((value, key) => {
|
|
1608
|
-
tmp.searchParams.append(key, value);
|
|
1609
|
-
});
|
|
1610
|
-
}
|
|
1611
|
-
if (url) {
|
|
1612
|
-
tmp.pathname += url;
|
|
1613
|
-
}
|
|
1614
|
-
return tmp.toString();
|
|
1615
|
-
}
|
|
1616
|
-
/**
|
|
1617
|
-
* Warning: This will cancel the init process.
|
|
1618
|
-
* The init process loads a region specific endpoint.
|
|
1619
|
-
* Setting a base url will stop that process from completing.
|
|
1292
|
+
* Sets the base url for this api.
|
|
1620
1293
|
* @param url
|
|
1621
1294
|
*/
|
|
1622
1295
|
SetBaseUrl(url) {
|
|
@@ -1624,7 +1297,6 @@ var BruceApi;
|
|
|
1624
1297
|
if (!this.baseUrl.endsWith("/")) {
|
|
1625
1298
|
this.baseUrl += "/";
|
|
1626
1299
|
}
|
|
1627
|
-
this.loadCancelled = true;
|
|
1628
1300
|
}
|
|
1629
1301
|
/**
|
|
1630
1302
|
* Performs an HTTP GET request.
|
|
@@ -1635,11 +1307,7 @@ var BruceApi;
|
|
|
1635
1307
|
*/
|
|
1636
1308
|
GET(url, params) {
|
|
1637
1309
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1638
|
-
return
|
|
1639
|
-
this.loadProm.then(() => {
|
|
1640
|
-
this.get(this.baseUrl + url, params).then(res).catch(rej);
|
|
1641
|
-
}).catch(rej);
|
|
1642
|
-
});
|
|
1310
|
+
return this.get(this.baseUrl + url, params);
|
|
1643
1311
|
});
|
|
1644
1312
|
}
|
|
1645
1313
|
/**
|
|
@@ -1651,11 +1319,7 @@ var BruceApi;
|
|
|
1651
1319
|
*/
|
|
1652
1320
|
DELETE(url, params) {
|
|
1653
1321
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1654
|
-
return
|
|
1655
|
-
this.loadProm.then(() => {
|
|
1656
|
-
this.delete(this.baseUrl + url, params).then(res).catch(rej);
|
|
1657
|
-
}).catch(rej);
|
|
1658
|
-
});
|
|
1322
|
+
return this.delete(this.baseUrl + url, params);
|
|
1659
1323
|
});
|
|
1660
1324
|
}
|
|
1661
1325
|
/**
|
|
@@ -1668,28 +1332,7 @@ var BruceApi;
|
|
|
1668
1332
|
*/
|
|
1669
1333
|
POST(url, data, params) {
|
|
1670
1334
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1671
|
-
return
|
|
1672
|
-
this.loadProm.then(() => {
|
|
1673
|
-
this.post(this.baseUrl + url, data, params).then(res).catch(rej);
|
|
1674
|
-
}).catch(rej);
|
|
1675
|
-
});
|
|
1676
|
-
});
|
|
1677
|
-
}
|
|
1678
|
-
/**
|
|
1679
|
-
* Performs an HTTP PUT request.
|
|
1680
|
-
* This will prepend the base url to the url.
|
|
1681
|
-
* @param url
|
|
1682
|
-
* @param data
|
|
1683
|
-
* @param params
|
|
1684
|
-
* @returns
|
|
1685
|
-
*/
|
|
1686
|
-
PUT(url, data, params) {
|
|
1687
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1688
|
-
return new Promise((res, rej) => {
|
|
1689
|
-
this.loadProm.then(() => {
|
|
1690
|
-
this.put(this.baseUrl + url, data, params).then(res).catch(rej);
|
|
1691
|
-
}).catch(rej);
|
|
1692
|
-
});
|
|
1335
|
+
return this.post(this.baseUrl + url, data, params);
|
|
1693
1336
|
});
|
|
1694
1337
|
}
|
|
1695
1338
|
/**
|
|
@@ -1702,146 +1345,31 @@ var BruceApi;
|
|
|
1702
1345
|
*/
|
|
1703
1346
|
UPLOAD(url, blob, params) {
|
|
1704
1347
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1705
|
-
return
|
|
1706
|
-
this.loadProm.then(() => {
|
|
1707
|
-
this.upload(this.baseUrl + url, blob, params).then(res).catch(rej);
|
|
1708
|
-
}).catch(rej);
|
|
1709
|
-
});
|
|
1348
|
+
return this.upload(this.baseUrl + url, blob, params);
|
|
1710
1349
|
});
|
|
1711
1350
|
}
|
|
1712
1351
|
}
|
|
1713
|
-
|
|
1714
|
-
})(
|
|
1352
|
+
GlobalApi.Api = Api$$1;
|
|
1353
|
+
})(GlobalApi || (GlobalApi = {}));
|
|
1715
1354
|
|
|
1716
1355
|
/**
|
|
1717
|
-
*
|
|
1718
|
-
*
|
|
1719
|
-
*
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
*/
|
|
1735
|
-
setBaseUrl() {
|
|
1736
|
-
let url;
|
|
1737
|
-
const env = this.env.toUpperCase();
|
|
1738
|
-
switch (env) {
|
|
1739
|
-
case Api.EEnv.DEV:
|
|
1740
|
-
url = "https://bruceglobal.nextspace-dev.net/";
|
|
1741
|
-
break;
|
|
1742
|
-
case Api.EEnv.STG:
|
|
1743
|
-
url = "https://bruceglobal.nextspace-stg.net/";
|
|
1744
|
-
break;
|
|
1745
|
-
case Api.EEnv.UAT:
|
|
1746
|
-
url = "https://bruceglobal.api.nextspace-uat.net/";
|
|
1747
|
-
break;
|
|
1748
|
-
case Api.EEnv.PROD:
|
|
1749
|
-
url = "https://bruceglobal.api.nextspace.host/";
|
|
1750
|
-
break;
|
|
1751
|
-
default:
|
|
1752
|
-
throw ("Specified Environment is not valid. SuppliedEnv=" + env);
|
|
1753
|
-
}
|
|
1754
|
-
this.baseUrl = url;
|
|
1755
|
-
}
|
|
1756
|
-
/**
|
|
1757
|
-
* Gets the base url for this api.
|
|
1758
|
-
* @returns
|
|
1759
|
-
*/
|
|
1760
|
-
GetBaseUrl() {
|
|
1761
|
-
return this.baseUrl;
|
|
1762
|
-
}
|
|
1763
|
-
/**
|
|
1764
|
-
* Sets the base url for this api.
|
|
1765
|
-
* @param url
|
|
1766
|
-
*/
|
|
1767
|
-
SetBaseUrl(url) {
|
|
1768
|
-
this.baseUrl = url;
|
|
1769
|
-
if (!this.baseUrl.endsWith("/")) {
|
|
1770
|
-
this.baseUrl += "/";
|
|
1771
|
-
}
|
|
1772
|
-
}
|
|
1773
|
-
/**
|
|
1774
|
-
* Performs an HTTP GET request.
|
|
1775
|
-
* This will prepend the base url to the url.
|
|
1776
|
-
* @param url
|
|
1777
|
-
* @param params
|
|
1778
|
-
* @returns
|
|
1779
|
-
*/
|
|
1780
|
-
GET(url, params) {
|
|
1781
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1782
|
-
return this.get(this.baseUrl + url, params);
|
|
1783
|
-
});
|
|
1784
|
-
}
|
|
1785
|
-
/**
|
|
1786
|
-
* Performs an HTTP DELETE request.
|
|
1787
|
-
* This will prepend the base url to the url.
|
|
1788
|
-
* @param url
|
|
1789
|
-
* @param params
|
|
1790
|
-
* @returns
|
|
1791
|
-
*/
|
|
1792
|
-
DELETE(url, params) {
|
|
1793
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1794
|
-
return this.delete(this.baseUrl + url, params);
|
|
1795
|
-
});
|
|
1796
|
-
}
|
|
1797
|
-
/**
|
|
1798
|
-
* Performs an HTTP POST request.
|
|
1799
|
-
* This will prepend the base url to the url.
|
|
1800
|
-
* @param url
|
|
1801
|
-
* @param data
|
|
1802
|
-
* @param params
|
|
1803
|
-
* @returns
|
|
1804
|
-
*/
|
|
1805
|
-
POST(url, data, params) {
|
|
1806
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1807
|
-
return this.post(this.baseUrl + url, data, params);
|
|
1808
|
-
});
|
|
1809
|
-
}
|
|
1810
|
-
/**
|
|
1811
|
-
* Performs a file upload request (HTTP POST).
|
|
1812
|
-
* This will prepend the base url to the url.
|
|
1813
|
-
* @param url
|
|
1814
|
-
* @param blob
|
|
1815
|
-
* @param params
|
|
1816
|
-
* @returns
|
|
1817
|
-
*/
|
|
1818
|
-
UPLOAD(url, blob, params) {
|
|
1819
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1820
|
-
return this.upload(this.baseUrl + url, blob, params);
|
|
1821
|
-
});
|
|
1822
|
-
}
|
|
1823
|
-
}
|
|
1824
|
-
GlobalApi.Api = Api$$1;
|
|
1825
|
-
})(GlobalApi || (GlobalApi = {}));
|
|
1826
|
-
|
|
1827
|
-
/**
|
|
1828
|
-
* Utility for managing multiple API instances.
|
|
1829
|
-
* Example: {
|
|
1830
|
-
* const api = new ApiGetters({
|
|
1831
|
-
* accountId: "123",
|
|
1832
|
-
* env: Api.EEnv.PROD
|
|
1833
|
-
* });
|
|
1834
|
-
*
|
|
1835
|
-
* // Returns default API instance specified in constructor.
|
|
1836
|
-
* const bruce1 = api.GetBruceApi();
|
|
1837
|
-
* // Returns API instance for account 456.
|
|
1838
|
-
* const bruce2 = api.GetBruceApi({
|
|
1839
|
-
* accountId: "456"
|
|
1840
|
-
* });
|
|
1841
|
-
*
|
|
1842
|
-
* const global = api.GetGlobalApi();
|
|
1843
|
-
* const guardian = api.GetGuardianApi();
|
|
1844
|
-
* }
|
|
1356
|
+
* Utility for managing multiple API instances.
|
|
1357
|
+
* Example: {
|
|
1358
|
+
* const api = new ApiGetters({
|
|
1359
|
+
* accountId: "123",
|
|
1360
|
+
* env: Api.EEnv.PROD
|
|
1361
|
+
* });
|
|
1362
|
+
*
|
|
1363
|
+
* // Returns default API instance specified in constructor.
|
|
1364
|
+
* const bruce1 = api.GetBruceApi();
|
|
1365
|
+
* // Returns API instance for account 456.
|
|
1366
|
+
* const bruce2 = api.GetBruceApi({
|
|
1367
|
+
* accountId: "456"
|
|
1368
|
+
* });
|
|
1369
|
+
*
|
|
1370
|
+
* const global = api.GetGlobalApi();
|
|
1371
|
+
* const guardian = api.GetGuardianApi();
|
|
1372
|
+
* }
|
|
1845
1373
|
*/
|
|
1846
1374
|
class ApiGetters {
|
|
1847
1375
|
constructor(params) {
|
|
@@ -4219,17 +3747,7 @@ var Entity;
|
|
|
4219
3747
|
let totalCount;
|
|
4220
3748
|
let entities = [];
|
|
4221
3749
|
if (analysis || expandRelations || (viaCdn && api.GetCdnBaseUrl())) {
|
|
4222
|
-
|
|
4223
|
-
if (analysis) {
|
|
4224
|
-
url = new URL(api.GetBaseUrl() + "entities/summary");
|
|
4225
|
-
}
|
|
4226
|
-
else if (viaCdn && api.GetCdnBaseUrl()) {
|
|
4227
|
-
url = new URL(api.ConstructCdnUrl("entities"));
|
|
4228
|
-
}
|
|
4229
|
-
else {
|
|
4230
|
-
url = new URL(api.GetBaseUrl() + "entities");
|
|
4231
|
-
}
|
|
4232
|
-
const urlParams = url.searchParams;
|
|
3750
|
+
const urlParams = new URLSearchParams();
|
|
4233
3751
|
urlParams.set("cacheToken", String(viaCdnCacheToken ? viaCdnCacheToken : 0));
|
|
4234
3752
|
if (body.SortOrder) {
|
|
4235
3753
|
urlParams.set("SortOrder", body.SortOrder);
|
|
@@ -4277,7 +3795,11 @@ var Entity;
|
|
|
4277
3795
|
urlParams.set("schema", schemaId);
|
|
4278
3796
|
}
|
|
4279
3797
|
urlParams.set("hasMigrated", String(Boolean(migrated)));
|
|
4280
|
-
const urlStr =
|
|
3798
|
+
const urlStr = api.ConstructUrl({
|
|
3799
|
+
cdn: !analysis && viaCdn,
|
|
3800
|
+
url: analysis ? "entities/summary" : "entities",
|
|
3801
|
+
urlParams: urlParams
|
|
3802
|
+
});
|
|
4281
3803
|
const data = yield api.get(urlStr, Api.PrepReqParams(reqParams));
|
|
4282
3804
|
if (!analysis) {
|
|
4283
3805
|
entities = data.Items;
|
|
@@ -4285,8 +3807,7 @@ var Entity;
|
|
|
4285
3807
|
totalCount = data.TotalCount;
|
|
4286
3808
|
}
|
|
4287
3809
|
else {
|
|
4288
|
-
const
|
|
4289
|
-
const urlParams = url.searchParams;
|
|
3810
|
+
const urlParams = new URLSearchParams();
|
|
4290
3811
|
if (expandRelations) {
|
|
4291
3812
|
urlParams.append("$expand", "relation");
|
|
4292
3813
|
}
|
|
@@ -4297,7 +3818,11 @@ var Entity;
|
|
|
4297
3818
|
urlParams.set("schema", schemaId);
|
|
4298
3819
|
}
|
|
4299
3820
|
urlParams.set("hasMigrated", String(Boolean(migrated)));
|
|
4300
|
-
const urlStr =
|
|
3821
|
+
const urlStr = api.ConstructUrl({
|
|
3822
|
+
cdn: false,
|
|
3823
|
+
url: analysis ? "entities/summary" : "entities",
|
|
3824
|
+
urlParams: urlParams
|
|
3825
|
+
});
|
|
4301
3826
|
const data = yield api.post(urlStr, body, Api.PrepReqParams(reqParams));
|
|
4302
3827
|
if (!analysis) {
|
|
4303
3828
|
entities = data.Items;
|
|
@@ -6215,12 +5740,13 @@ var EntityLod;
|
|
|
6215
5740
|
if (!level) {
|
|
6216
5741
|
level = 0;
|
|
6217
5742
|
}
|
|
6218
|
-
let url = api.GetBaseUrl() + `entity/${entityId}/lod/${categoryId}/${level}`;
|
|
6219
|
-
if (strict) {
|
|
6220
|
-
url = url + "?strict=true";
|
|
6221
|
-
}
|
|
6222
5743
|
return {
|
|
6223
|
-
url:
|
|
5744
|
+
url: api.ConstructUrl({
|
|
5745
|
+
url: `entity/${entityId}/lod/${categoryId}/${level}`,
|
|
5746
|
+
urlParams: {
|
|
5747
|
+
"strict": strict ? "true" : "false"
|
|
5748
|
+
}
|
|
5749
|
+
})
|
|
6224
5750
|
};
|
|
6225
5751
|
}
|
|
6226
5752
|
EntityLod.GetUrl = GetUrl;
|
|
@@ -8424,13 +7950,13 @@ var Uploader;
|
|
|
8424
7950
|
* A client file is a record of a file uploaded to Bruce.
|
|
8425
7951
|
*/
|
|
8426
7952
|
var ClientFile;
|
|
8427
|
-
(function (ClientFile
|
|
7953
|
+
(function (ClientFile) {
|
|
8428
7954
|
let EPurpose;
|
|
8429
7955
|
(function (EPurpose) {
|
|
8430
7956
|
// Use this purpose for uploading bookmark thumbnail images.
|
|
8431
7957
|
// This will allow lower level privileges to upload (small) bookmark thumbnails.
|
|
8432
7958
|
EPurpose["BookmarkThumbnail"] = "Bookmark Thumbnail";
|
|
8433
|
-
})(EPurpose = ClientFile
|
|
7959
|
+
})(EPurpose = ClientFile.EPurpose || (ClientFile.EPurpose = {}));
|
|
8434
7960
|
/**
|
|
8435
7961
|
* Returns the URL for a client file.
|
|
8436
7962
|
* @param params
|
|
@@ -8441,17 +7967,16 @@ var ClientFile;
|
|
|
8441
7967
|
if (!api) {
|
|
8442
7968
|
api = ENVIRONMENT.Api().GetBruceApi();
|
|
8443
7969
|
}
|
|
8444
|
-
|
|
8445
|
-
|
|
8446
|
-
|
|
8447
|
-
|
|
8448
|
-
|
|
8449
|
-
|
|
8450
|
-
|
|
8451
|
-
|
|
8452
|
-
return url;
|
|
7970
|
+
return api.ConstructUrl({
|
|
7971
|
+
cdn: viaCdn,
|
|
7972
|
+
url: `file/${fileId}`,
|
|
7973
|
+
urlParams: {
|
|
7974
|
+
// Invalidating cache manually because we have a wave of invalid headers now cached across devices.
|
|
7975
|
+
cc: "1"
|
|
7976
|
+
}
|
|
7977
|
+
});
|
|
8453
7978
|
}
|
|
8454
|
-
ClientFile
|
|
7979
|
+
ClientFile.GetUrl = GetUrl;
|
|
8455
7980
|
/**
|
|
8456
7981
|
* Returns the URL for a client file with the extension.
|
|
8457
7982
|
* @param params
|
|
@@ -8470,16 +7995,16 @@ var ClientFile;
|
|
|
8470
7995
|
ext = "." + ext;
|
|
8471
7996
|
}
|
|
8472
7997
|
const urlSuffix = ext ? `file/${file.ID}${ext}` : `file/${file.ID}`;
|
|
8473
|
-
|
|
8474
|
-
|
|
8475
|
-
|
|
8476
|
-
|
|
8477
|
-
|
|
8478
|
-
|
|
8479
|
-
|
|
8480
|
-
|
|
7998
|
+
return api.ConstructUrl({
|
|
7999
|
+
cdn: viaCdn,
|
|
8000
|
+
url: urlSuffix,
|
|
8001
|
+
urlParams: {
|
|
8002
|
+
// Invalidating cache manually because we have a wave of invalid headers now cached across devices.
|
|
8003
|
+
cc: "1"
|
|
8004
|
+
}
|
|
8005
|
+
});
|
|
8481
8006
|
}
|
|
8482
|
-
ClientFile
|
|
8007
|
+
ClientFile.GetUrlWithExt = GetUrlWithExt;
|
|
8483
8008
|
/**
|
|
8484
8009
|
* Returns a client file record by ID.
|
|
8485
8010
|
* @param params
|
|
@@ -8518,7 +8043,7 @@ var ClientFile;
|
|
|
8518
8043
|
return prom;
|
|
8519
8044
|
});
|
|
8520
8045
|
}
|
|
8521
|
-
ClientFile
|
|
8046
|
+
ClientFile.Get = Get;
|
|
8522
8047
|
/**
|
|
8523
8048
|
* Deletes one or many client file records by IDs.
|
|
8524
8049
|
* @param params
|
|
@@ -8542,7 +8067,7 @@ var ClientFile;
|
|
|
8542
8067
|
}
|
|
8543
8068
|
});
|
|
8544
8069
|
}
|
|
8545
|
-
ClientFile
|
|
8070
|
+
ClientFile.Delete = Delete;
|
|
8546
8071
|
/**
|
|
8547
8072
|
* Uploads a file and creates a new client file record.
|
|
8548
8073
|
* @param params
|
|
@@ -8605,7 +8130,7 @@ var ClientFile;
|
|
|
8605
8130
|
};
|
|
8606
8131
|
});
|
|
8607
8132
|
}
|
|
8608
|
-
ClientFile
|
|
8133
|
+
ClientFile.Upload = Upload;
|
|
8609
8134
|
/**
|
|
8610
8135
|
* Updates the purpose of a client file.
|
|
8611
8136
|
* @param params
|
|
@@ -8626,7 +8151,7 @@ var ClientFile;
|
|
|
8626
8151
|
api.Cache.RemoveByContains(cacheKey);
|
|
8627
8152
|
});
|
|
8628
8153
|
}
|
|
8629
|
-
ClientFile
|
|
8154
|
+
ClientFile.UpdatePurpose = UpdatePurpose;
|
|
8630
8155
|
/**
|
|
8631
8156
|
* Uploads a temp file.
|
|
8632
8157
|
* This will return a temp file ID.
|
|
@@ -8676,7 +8201,7 @@ var ClientFile;
|
|
|
8676
8201
|
};
|
|
8677
8202
|
});
|
|
8678
8203
|
}
|
|
8679
|
-
ClientFile
|
|
8204
|
+
ClientFile.UploadTemp = UploadTemp;
|
|
8680
8205
|
/**
|
|
8681
8206
|
* Returns a dictionary of purpose counts for client files.
|
|
8682
8207
|
* @param params
|
|
@@ -8715,7 +8240,7 @@ var ClientFile;
|
|
|
8715
8240
|
return prom;
|
|
8716
8241
|
});
|
|
8717
8242
|
}
|
|
8718
|
-
ClientFile
|
|
8243
|
+
ClientFile.GetCountsPurpose = GetCountsPurpose;
|
|
8719
8244
|
/**
|
|
8720
8245
|
* Returns a dictionary of MIME type counts for client files.
|
|
8721
8246
|
* @param params
|
|
@@ -8754,7 +8279,7 @@ var ClientFile;
|
|
|
8754
8279
|
return prom;
|
|
8755
8280
|
});
|
|
8756
8281
|
}
|
|
8757
|
-
ClientFile
|
|
8282
|
+
ClientFile.GetCountsExtension = GetCountsExtension;
|
|
8758
8283
|
/**
|
|
8759
8284
|
* Returns a dictionary of MIME type counts for client files.
|
|
8760
8285
|
* @param params
|
|
@@ -8793,7 +8318,7 @@ var ClientFile;
|
|
|
8793
8318
|
return prom;
|
|
8794
8319
|
});
|
|
8795
8320
|
}
|
|
8796
|
-
ClientFile
|
|
8321
|
+
ClientFile.GetCountsMIMEType = GetCountsMIMEType;
|
|
8797
8322
|
/**
|
|
8798
8323
|
* Returns a dictionary of user counts for client files.
|
|
8799
8324
|
* @param params
|
|
@@ -8832,7 +8357,7 @@ var ClientFile;
|
|
|
8832
8357
|
return prom;
|
|
8833
8358
|
});
|
|
8834
8359
|
}
|
|
8835
|
-
ClientFile
|
|
8360
|
+
ClientFile.GetCountsUser = GetCountsUser;
|
|
8836
8361
|
/**
|
|
8837
8362
|
* Filter definitions for requesting a list of client files.
|
|
8838
8363
|
*/
|
|
@@ -8858,7 +8383,7 @@ var ClientFile;
|
|
|
8858
8383
|
ERowOperator["AND"] = "AND";
|
|
8859
8384
|
ERowOperator["OR"] = "OR";
|
|
8860
8385
|
})(ERowOperator = Filter.ERowOperator || (Filter.ERowOperator = {}));
|
|
8861
|
-
})(Filter = ClientFile
|
|
8386
|
+
})(Filter = ClientFile.Filter || (ClientFile.Filter = {}));
|
|
8862
8387
|
/**
|
|
8863
8388
|
* Returns a list of client files matching the filter.
|
|
8864
8389
|
* @param params
|
|
@@ -8877,7 +8402,7 @@ var ClientFile;
|
|
|
8877
8402
|
};
|
|
8878
8403
|
});
|
|
8879
8404
|
}
|
|
8880
|
-
ClientFile
|
|
8405
|
+
ClientFile.GetList = GetList;
|
|
8881
8406
|
/**
|
|
8882
8407
|
* Deletes a list of client files matching the filter.
|
|
8883
8408
|
* @param params
|
|
@@ -8899,7 +8424,7 @@ var ClientFile;
|
|
|
8899
8424
|
};
|
|
8900
8425
|
});
|
|
8901
8426
|
}
|
|
8902
|
-
ClientFile
|
|
8427
|
+
ClientFile.DeleteList = DeleteList;
|
|
8903
8428
|
/**
|
|
8904
8429
|
* Utility for processing client files.
|
|
8905
8430
|
* Commonly used to convert a file to a different format. Eg: FBX to GLB.
|
|
@@ -8936,7 +8461,7 @@ var ClientFile;
|
|
|
8936
8461
|
});
|
|
8937
8462
|
}
|
|
8938
8463
|
Processor.ConvertFormat = ConvertFormat;
|
|
8939
|
-
})(Processor = ClientFile
|
|
8464
|
+
})(Processor = ClientFile.Processor || (ClientFile.Processor = {}));
|
|
8940
8465
|
/**
|
|
8941
8466
|
* Returns cache identifier for a client file by ID.
|
|
8942
8467
|
* Example: {
|
|
@@ -8950,23 +8475,23 @@ var ClientFile;
|
|
|
8950
8475
|
function GetCacheKey(fileId) {
|
|
8951
8476
|
return `${Api.ECacheKey.ClientFile}${Api.ECacheKey.Id}${fileId}`;
|
|
8952
8477
|
}
|
|
8953
|
-
ClientFile
|
|
8478
|
+
ClientFile.GetCacheKey = GetCacheKey;
|
|
8954
8479
|
function GetCountsPurposeCacheKey() {
|
|
8955
8480
|
return `${Api.ECacheKey.ClientFile}${Api.ECacheKey.ClientFileCountsPurpose}`;
|
|
8956
8481
|
}
|
|
8957
|
-
ClientFile
|
|
8482
|
+
ClientFile.GetCountsPurposeCacheKey = GetCountsPurposeCacheKey;
|
|
8958
8483
|
function GetCountsExtensionCacheKey() {
|
|
8959
8484
|
return `${Api.ECacheKey.ClientFile}${Api.ECacheKey.ClientFileCountsExtension}`;
|
|
8960
8485
|
}
|
|
8961
|
-
ClientFile
|
|
8486
|
+
ClientFile.GetCountsExtensionCacheKey = GetCountsExtensionCacheKey;
|
|
8962
8487
|
function GetCountsMIMETypeCacheKey() {
|
|
8963
8488
|
return `${Api.ECacheKey.ClientFile}${Api.ECacheKey.ClientFileCountsMIMEType}`;
|
|
8964
8489
|
}
|
|
8965
|
-
ClientFile
|
|
8490
|
+
ClientFile.GetCountsMIMETypeCacheKey = GetCountsMIMETypeCacheKey;
|
|
8966
8491
|
function GetCountsUserCacheKey() {
|
|
8967
8492
|
return `${Api.ECacheKey.ClientFile}${Api.ECacheKey.ClientFileCountsUser}`;
|
|
8968
8493
|
}
|
|
8969
|
-
ClientFile
|
|
8494
|
+
ClientFile.GetCountsUserCacheKey = GetCountsUserCacheKey;
|
|
8970
8495
|
})(ClientFile || (ClientFile = {}));
|
|
8971
8496
|
|
|
8972
8497
|
/**
|
|
@@ -9618,23 +9143,13 @@ var Tileset;
|
|
|
9618
9143
|
if (!file) {
|
|
9619
9144
|
file = "";
|
|
9620
9145
|
}
|
|
9621
|
-
|
|
9622
|
-
|
|
9623
|
-
|
|
9624
|
-
|
|
9625
|
-
|
|
9626
|
-
if (cacheToken != null) {
|
|
9627
|
-
urlParams.append("cacheToken", String(cacheToken));
|
|
9628
|
-
}
|
|
9629
|
-
url = api.ConstructCdnUrl(url, urlParams);
|
|
9630
|
-
}
|
|
9631
|
-
else {
|
|
9632
|
-
url = api.GetBaseUrl() + `v3/tilesets/${tilesetId}/files/${legacy ? "" : "files/"}${file}`;
|
|
9633
|
-
if (cacheToken != null) {
|
|
9634
|
-
url += `?cacheToken=${cacheToken}`;
|
|
9146
|
+
return api.ConstructUrl({
|
|
9147
|
+
cdn: viaCdn,
|
|
9148
|
+
url: `v3/tilesets/${tilesetId}/files/${legacy ? "" : "files/"}${file}`,
|
|
9149
|
+
urlParams: {
|
|
9150
|
+
"cacheToken": String(cacheToken ? cacheToken : 0)
|
|
9635
9151
|
}
|
|
9636
|
-
}
|
|
9637
|
-
return url;
|
|
9152
|
+
});
|
|
9638
9153
|
}
|
|
9639
9154
|
Tileset$$1.GetFileUrl = GetFileUrl;
|
|
9640
9155
|
/**
|
|
@@ -9653,7 +9168,9 @@ var Tileset;
|
|
|
9653
9168
|
if (!file) {
|
|
9654
9169
|
file = "";
|
|
9655
9170
|
}
|
|
9656
|
-
return api.
|
|
9171
|
+
return api.ConstructUrl({
|
|
9172
|
+
url: `tileset/getFile/${tilesetId}/src/${file}`
|
|
9173
|
+
});
|
|
9657
9174
|
}
|
|
9658
9175
|
Tileset$$1.GetSrcFileUrl = GetSrcFileUrl;
|
|
9659
9176
|
/**
|
|
@@ -9673,16 +9190,13 @@ var Tileset;
|
|
|
9673
9190
|
if (!file) {
|
|
9674
9191
|
file = "";
|
|
9675
9192
|
}
|
|
9676
|
-
|
|
9677
|
-
|
|
9678
|
-
|
|
9679
|
-
|
|
9193
|
+
return api.ConstructUrl({
|
|
9194
|
+
cdn: viaCdn,
|
|
9195
|
+
url: `tileset/file/${tilesetId}/${file}`,
|
|
9196
|
+
urlParams: {
|
|
9197
|
+
"cacheToken": String(viaCdnCacheToken ? viaCdnCacheToken : 0)
|
|
9680
9198
|
}
|
|
9681
|
-
|
|
9682
|
-
urlParams.append("cacheToken", String(viaCdnCacheToken));
|
|
9683
|
-
return api.ConstructCdnUrl(`tileset/file/${tilesetId}/${file}`, urlParams);
|
|
9684
|
-
}
|
|
9685
|
-
return api.GetBaseUrl() + `tileset/file/${tilesetId}/${file}`;
|
|
9199
|
+
});
|
|
9686
9200
|
}
|
|
9687
9201
|
Tileset$$1.GetPublicFileUrl = GetPublicFileUrl;
|
|
9688
9202
|
/**
|
|
@@ -10020,203 +9534,881 @@ var MenuItem;
|
|
|
10020
9534
|
}
|
|
10021
9535
|
MenuItem.CreateFromEntityId = CreateFromEntityId;
|
|
10022
9536
|
/**
|
|
10023
|
-
* Creates a menu item for an entity type.
|
|
10024
|
-
* @param typeId
|
|
10025
|
-
* @param styleId
|
|
10026
|
-
* @returns
|
|
9537
|
+
* Creates a menu item for an entity type.
|
|
9538
|
+
* @param typeId
|
|
9539
|
+
* @param styleId
|
|
9540
|
+
* @returns
|
|
9541
|
+
*/
|
|
9542
|
+
function CreateFromTypeId(typeId, styleId) {
|
|
9543
|
+
return {
|
|
9544
|
+
id: ObjectUtils.UId(),
|
|
9545
|
+
Type: EType.Entities,
|
|
9546
|
+
Caption: "Generated Entity Type Menu Item",
|
|
9547
|
+
BruceEntity: {
|
|
9548
|
+
"EntityType.ID": typeId
|
|
9549
|
+
},
|
|
9550
|
+
CameraZoomSettings: [
|
|
9551
|
+
{
|
|
9552
|
+
DisplayType: ZoomControl.EDisplayType.Model3D,
|
|
9553
|
+
MaxZoom: 100000,
|
|
9554
|
+
MinZoom: 0,
|
|
9555
|
+
StyleID: styleId
|
|
9556
|
+
}
|
|
9557
|
+
]
|
|
9558
|
+
};
|
|
9559
|
+
}
|
|
9560
|
+
MenuItem.CreateFromTypeId = CreateFromTypeId;
|
|
9561
|
+
/**
|
|
9562
|
+
* Creates a menu item for a tileset.
|
|
9563
|
+
* @param tilesetId
|
|
9564
|
+
* @param type
|
|
9565
|
+
* @returns
|
|
9566
|
+
*/
|
|
9567
|
+
function CreateFromTilesetId(tilesetId, type) {
|
|
9568
|
+
if (type === Tileset.EType.Cad) {
|
|
9569
|
+
return {
|
|
9570
|
+
id: ObjectUtils.UId(),
|
|
9571
|
+
Type: EType.CadTileset,
|
|
9572
|
+
Caption: "Generated CAD Menu Item",
|
|
9573
|
+
FlyTo: false,
|
|
9574
|
+
tileset: {
|
|
9575
|
+
TilesetID: tilesetId
|
|
9576
|
+
}
|
|
9577
|
+
};
|
|
9578
|
+
}
|
|
9579
|
+
else if (type == Tileset.EType.EntitiesSet) {
|
|
9580
|
+
return {
|
|
9581
|
+
id: ObjectUtils.UId(),
|
|
9582
|
+
Type: EType.EntityTileset,
|
|
9583
|
+
Caption: "Generated Entities Menu Item",
|
|
9584
|
+
FlyTo: false,
|
|
9585
|
+
tileset: {
|
|
9586
|
+
TilesetID: tilesetId
|
|
9587
|
+
}
|
|
9588
|
+
};
|
|
9589
|
+
}
|
|
9590
|
+
else if (type == Tileset.EType.PointCloud) {
|
|
9591
|
+
return {
|
|
9592
|
+
id: ObjectUtils.UId(),
|
|
9593
|
+
Type: EType.PointCloud,
|
|
9594
|
+
Caption: "Generated Point Cloud Menu Item",
|
|
9595
|
+
FlyTo: false,
|
|
9596
|
+
tileset: {
|
|
9597
|
+
TilesetID: tilesetId
|
|
9598
|
+
}
|
|
9599
|
+
};
|
|
9600
|
+
}
|
|
9601
|
+
else if (type == Tileset.EType.EntitiesMap) {
|
|
9602
|
+
return {
|
|
9603
|
+
id: ObjectUtils.UId(),
|
|
9604
|
+
Type: EType.EntityRaster,
|
|
9605
|
+
Caption: "Generated Entities Menu Item",
|
|
9606
|
+
tileset: {
|
|
9607
|
+
TilesetID: tilesetId
|
|
9608
|
+
}
|
|
9609
|
+
};
|
|
9610
|
+
}
|
|
9611
|
+
throw ("Tileset type not supported.");
|
|
9612
|
+
}
|
|
9613
|
+
MenuItem.CreateFromTilesetId = CreateFromTilesetId;
|
|
9614
|
+
})(MenuItem || (MenuItem = {}));
|
|
9615
|
+
|
|
9616
|
+
/**
|
|
9617
|
+
* Describe the "Project View Bookmark" concept within Nextspace.
|
|
9618
|
+
* This is referred to as "slides" in older code.
|
|
9619
|
+
*
|
|
9620
|
+
* A bookmark is a snapshot of what should be displayed and how in a particular project view.
|
|
9621
|
+
*/
|
|
9622
|
+
var ProjectViewBookmark;
|
|
9623
|
+
(function (ProjectViewBookmark) {
|
|
9624
|
+
// This is the expected default version for the DataVersion value.
|
|
9625
|
+
// This value should NOT be changed without looking at our API and seeing what the default value is.
|
|
9626
|
+
ProjectViewBookmark.DEFAULT_DATA_VERSION = 2;
|
|
9627
|
+
/**
|
|
9628
|
+
* Describes the content of a bookmark.
|
|
9629
|
+
* As part of a deal we've been commissioned to create an alternative bookmark type to embed content.
|
|
9630
|
+
*/
|
|
9631
|
+
let EContentType;
|
|
9632
|
+
(function (EContentType) {
|
|
9633
|
+
EContentType["WEB_3D"] = "WEB_3D";
|
|
9634
|
+
EContentType["IFRAME"] = "IFRAME";
|
|
9635
|
+
})(EContentType = ProjectViewBookmark.EContentType || (ProjectViewBookmark.EContentType = {}));
|
|
9636
|
+
/**
|
|
9637
|
+
* Gets a bookmark record.
|
|
9638
|
+
* @param params
|
|
9639
|
+
* @returns
|
|
9640
|
+
*/
|
|
9641
|
+
function Get(params) {
|
|
9642
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
9643
|
+
let { api, viewId, bookmarkId, req: reqParams } = params;
|
|
9644
|
+
if (!viewId || !bookmarkId) {
|
|
9645
|
+
throw ("View ID and Bookmark ID are required.");
|
|
9646
|
+
}
|
|
9647
|
+
if (!api) {
|
|
9648
|
+
api = ENVIRONMENT.Api().GetBruceApi();
|
|
9649
|
+
}
|
|
9650
|
+
const key = GetCacheKey(viewId, bookmarkId);
|
|
9651
|
+
const cache = yield api.GetCacheItem(key, reqParams);
|
|
9652
|
+
if (cache === null || cache === void 0 ? void 0 : cache.found) {
|
|
9653
|
+
return cache.data;
|
|
9654
|
+
}
|
|
9655
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
9656
|
+
try {
|
|
9657
|
+
const data = yield api.GET(`ui.view/${viewId}/slide/${bookmarkId}`, Api.PrepReqParams(reqParams));
|
|
9658
|
+
res({
|
|
9659
|
+
bookmark: data
|
|
9660
|
+
});
|
|
9661
|
+
}
|
|
9662
|
+
catch (e) {
|
|
9663
|
+
rej(e);
|
|
9664
|
+
}
|
|
9665
|
+
}));
|
|
9666
|
+
yield api.SetCacheItem({
|
|
9667
|
+
key,
|
|
9668
|
+
value: prom,
|
|
9669
|
+
req: reqParams
|
|
9670
|
+
});
|
|
9671
|
+
return prom;
|
|
9672
|
+
});
|
|
9673
|
+
}
|
|
9674
|
+
ProjectViewBookmark.Get = Get;
|
|
9675
|
+
/**
|
|
9676
|
+
* Deletes a bookmark record.
|
|
9677
|
+
* @param params
|
|
9678
|
+
*/
|
|
9679
|
+
function Delete(params) {
|
|
9680
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
9681
|
+
let { api, viewId, bookmarkId, req: reqParams } = params;
|
|
9682
|
+
if (!viewId || !bookmarkId) {
|
|
9683
|
+
throw ("View ID and Bookmark ID are required.");
|
|
9684
|
+
}
|
|
9685
|
+
if (!api) {
|
|
9686
|
+
api = ENVIRONMENT.Api().GetBruceApi();
|
|
9687
|
+
}
|
|
9688
|
+
yield api.DELETE(`ui.view/${viewId}/slide/${bookmarkId}`, Api.PrepReqParams(reqParams));
|
|
9689
|
+
api.Cache.Remove(GetCacheKey(viewId, bookmarkId));
|
|
9690
|
+
api.Cache.Remove(GetListCacheKey(viewId));
|
|
9691
|
+
});
|
|
9692
|
+
}
|
|
9693
|
+
ProjectViewBookmark.Delete = Delete;
|
|
9694
|
+
/**
|
|
9695
|
+
* Gets a list of bookmark records.
|
|
9696
|
+
* @param params
|
|
9697
|
+
* @returns
|
|
9698
|
+
*/
|
|
9699
|
+
function GetList(params) {
|
|
9700
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
9701
|
+
let { api, viewId, req: reqParams } = params;
|
|
9702
|
+
if (!viewId) {
|
|
9703
|
+
throw ("View ID is required.");
|
|
9704
|
+
}
|
|
9705
|
+
if (!api) {
|
|
9706
|
+
api = ENVIRONMENT.Api().GetBruceApi();
|
|
9707
|
+
}
|
|
9708
|
+
const cache = yield api.GetCacheItem(GetListCacheKey(viewId), reqParams);
|
|
9709
|
+
if (cache === null || cache === void 0 ? void 0 : cache.found) {
|
|
9710
|
+
return cache.data;
|
|
9711
|
+
}
|
|
9712
|
+
const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
9713
|
+
try {
|
|
9714
|
+
const data = yield api.GET(`ui.view/${viewId}/slides`, Api.PrepReqParams(reqParams));
|
|
9715
|
+
const items = data.Items ? data.Items : [];
|
|
9716
|
+
// Cache individual items.
|
|
9717
|
+
// Maybe better to load list cache when getting 1 slide and seeing if it's in there.
|
|
9718
|
+
// WARNING: Right now the data matches, in the future the list may contain a shortened result.
|
|
9719
|
+
for (let i = 0; i < items.length; i++) {
|
|
9720
|
+
const item = items[i];
|
|
9721
|
+
const prom = new Promise((res) => {
|
|
9722
|
+
res({
|
|
9723
|
+
bookmark: item
|
|
9724
|
+
});
|
|
9725
|
+
});
|
|
9726
|
+
yield api.SetCacheItem({
|
|
9727
|
+
key: GetCacheKey(viewId, item.ID),
|
|
9728
|
+
value: prom,
|
|
9729
|
+
req: reqParams
|
|
9730
|
+
});
|
|
9731
|
+
}
|
|
9732
|
+
res({
|
|
9733
|
+
bookmarks: items
|
|
9734
|
+
});
|
|
9735
|
+
}
|
|
9736
|
+
catch (e) {
|
|
9737
|
+
rej(e);
|
|
9738
|
+
}
|
|
9739
|
+
}));
|
|
9740
|
+
yield api.SetCacheItem({
|
|
9741
|
+
key: GetListCacheKey(viewId),
|
|
9742
|
+
value: req,
|
|
9743
|
+
req: reqParams
|
|
9744
|
+
});
|
|
9745
|
+
return req;
|
|
9746
|
+
});
|
|
9747
|
+
}
|
|
9748
|
+
ProjectViewBookmark.GetList = GetList;
|
|
9749
|
+
/**
|
|
9750
|
+
* Creates or updates a bookmark record.
|
|
9751
|
+
* @param params
|
|
9752
|
+
* @returns
|
|
9753
|
+
*/
|
|
9754
|
+
function Update(params) {
|
|
9755
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
9756
|
+
let { api, viewId, bookmark: data, req: reqParams } = params;
|
|
9757
|
+
if (!api) {
|
|
9758
|
+
api = ENVIRONMENT.Api().GetBruceApi();
|
|
9759
|
+
}
|
|
9760
|
+
if (!(data === null || data === void 0 ? void 0 : data.Title)) {
|
|
9761
|
+
data.Title = data.ID;
|
|
9762
|
+
}
|
|
9763
|
+
const res = yield api.POST(`ui.view/${viewId}/slide/${data.ID ? data.ID : ""}`, data, Api.PrepReqParams(reqParams));
|
|
9764
|
+
api.Cache.Remove(GetCacheKey(viewId, data.ID));
|
|
9765
|
+
api.Cache.Remove(GetListCacheKey(viewId));
|
|
9766
|
+
return {
|
|
9767
|
+
bookmark: res
|
|
9768
|
+
};
|
|
9769
|
+
});
|
|
9770
|
+
}
|
|
9771
|
+
ProjectViewBookmark.Update = Update;
|
|
9772
|
+
/**
|
|
9773
|
+
* Sets the order of bookmarks within a project view.
|
|
9774
|
+
* @param params
|
|
9775
|
+
*/
|
|
9776
|
+
function SetOrder(params) {
|
|
9777
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
9778
|
+
let { api, viewId, bookmarkIds, req: reqParams } = params;
|
|
9779
|
+
if (!api) {
|
|
9780
|
+
api = ENVIRONMENT.Api().GetBruceApi();
|
|
9781
|
+
}
|
|
9782
|
+
const reqData = {
|
|
9783
|
+
"UISlide.ID": bookmarkIds,
|
|
9784
|
+
"DisplayOrder.Start": 0
|
|
9785
|
+
};
|
|
9786
|
+
yield api.POST(`ui.view/${viewId}/slides/setOrder`, reqData, Api.PrepReqParams(reqParams));
|
|
9787
|
+
yield api.Cache.RemoveByStartsWith(GetListCacheKey(viewId));
|
|
9788
|
+
});
|
|
9789
|
+
}
|
|
9790
|
+
ProjectViewBookmark.SetOrder = SetOrder;
|
|
9791
|
+
/**
|
|
9792
|
+
* Returns cache identifier for a bookmark.
|
|
9793
|
+
* Example: {
|
|
9794
|
+
* const api: BruceApi.Api = ...;
|
|
9795
|
+
* const key = GetCacheKey("abc", "def");
|
|
9796
|
+
* api.Cache.Remove(key);
|
|
9797
|
+
* }
|
|
9798
|
+
* @param viewId
|
|
9799
|
+
* @param bookmarkId
|
|
9800
|
+
* @returns
|
|
9801
|
+
*/
|
|
9802
|
+
function GetCacheKey(viewId, bookmarkId) {
|
|
9803
|
+
return `${Api.ECacheKey.ProjectViewBookmark}${Api.ECacheKey.Id}${viewId}${Api.ECacheKey.Id}${bookmarkId}`;
|
|
9804
|
+
}
|
|
9805
|
+
ProjectViewBookmark.GetCacheKey = GetCacheKey;
|
|
9806
|
+
/**
|
|
9807
|
+
* Returns cache identifier for a list of bookmarks.
|
|
9808
|
+
* Example: {
|
|
9809
|
+
* const api: BruceApi.Api = ...;
|
|
9810
|
+
* const key = GetListCacheKey("abc");
|
|
9811
|
+
* api.Cache.Remove(key);
|
|
9812
|
+
* }
|
|
9813
|
+
* @param viewId
|
|
9814
|
+
* @returns
|
|
9815
|
+
*/
|
|
9816
|
+
function GetListCacheKey(viewId) {
|
|
9817
|
+
return `${Api.ECacheKey.ProjectViewBookmark}${Api.ECacheKey.Id}${viewId}`;
|
|
9818
|
+
}
|
|
9819
|
+
ProjectViewBookmark.GetListCacheKey = GetListCacheKey;
|
|
9820
|
+
})(ProjectViewBookmark || (ProjectViewBookmark = {}));
|
|
9821
|
+
|
|
9822
|
+
/**
|
|
9823
|
+
* Describes the "Project View" concept within Nextspace.
|
|
9824
|
+
* A project view is a collection of settings for a visualization application we support.
|
|
9825
|
+
* It will describe what panels to show and how, it will also describe all possible ways data can be displayed.
|
|
9826
|
+
*/
|
|
9827
|
+
var ProjectView;
|
|
9828
|
+
(function (ProjectView) {
|
|
9829
|
+
// This is the expected default version for the DataVersion value.
|
|
9830
|
+
// This value should NOT be changed without looking at our API and seeing what the default value is.
|
|
9831
|
+
ProjectView.DEFAULT_DATA_VERSION = 2;
|
|
9832
|
+
// Our Cesium web navigator.
|
|
9833
|
+
ProjectView.TYPE_WEB_3D_NAVIGATOR = "WEB_3D_NAVIGATOR";
|
|
9834
|
+
// Our (currently WIP) 2D web navigator. Also known as our graph viewer.
|
|
9835
|
+
ProjectView.TYPE_WEB_2D_NAVIGATOR = "WEB_2D_NAVIGATOR";
|
|
9836
|
+
// Defaulting to 3D navigator for backwards compatibility.
|
|
9837
|
+
ProjectView.DEFAULT_TYPE = ProjectView.TYPE_WEB_3D_NAVIGATOR;
|
|
9838
|
+
/**
|
|
9839
|
+
* Gets a project view record.
|
|
9840
|
+
* @param params
|
|
9841
|
+
* @returns
|
|
9842
|
+
*/
|
|
9843
|
+
function Get(params) {
|
|
9844
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
9845
|
+
let { api, viewId, req: reqParams } = params;
|
|
9846
|
+
if (!viewId) {
|
|
9847
|
+
throw ("View ID is required.");
|
|
9848
|
+
}
|
|
9849
|
+
if (!api) {
|
|
9850
|
+
api = ENVIRONMENT.Api().GetBruceApi();
|
|
9851
|
+
}
|
|
9852
|
+
const key = GetCacheKey(viewId);
|
|
9853
|
+
const cache = yield api.GetCacheItem(key, reqParams);
|
|
9854
|
+
if (cache === null || cache === void 0 ? void 0 : cache.found) {
|
|
9855
|
+
return cache.data;
|
|
9856
|
+
}
|
|
9857
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
9858
|
+
try {
|
|
9859
|
+
const data = yield api.GET(`ui.view/${viewId}`, Api.PrepReqParams(reqParams));
|
|
9860
|
+
res({
|
|
9861
|
+
view: data
|
|
9862
|
+
});
|
|
9863
|
+
}
|
|
9864
|
+
catch (e) {
|
|
9865
|
+
rej(e);
|
|
9866
|
+
}
|
|
9867
|
+
}));
|
|
9868
|
+
yield api.SetCacheItem({
|
|
9869
|
+
key,
|
|
9870
|
+
value: prom,
|
|
9871
|
+
req: reqParams
|
|
9872
|
+
});
|
|
9873
|
+
return prom;
|
|
9874
|
+
});
|
|
9875
|
+
}
|
|
9876
|
+
ProjectView.Get = Get;
|
|
9877
|
+
/**
|
|
9878
|
+
* Gets a list of project views.
|
|
9879
|
+
* @param params
|
|
9880
|
+
* @returns
|
|
9881
|
+
*/
|
|
9882
|
+
function GetList(params) {
|
|
9883
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
9884
|
+
let { api, req: reqParams, type } = params;
|
|
9885
|
+
if (!api) {
|
|
9886
|
+
api = ENVIRONMENT.Api().GetBruceApi();
|
|
9887
|
+
}
|
|
9888
|
+
const cache = yield api.GetCacheItem(GetListCacheKey(type), reqParams);
|
|
9889
|
+
if (cache === null || cache === void 0 ? void 0 : cache.found) {
|
|
9890
|
+
return cache.data;
|
|
9891
|
+
}
|
|
9892
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
9893
|
+
try {
|
|
9894
|
+
const data = yield api.GET("ui.view/list", Api.PrepReqParams(reqParams));
|
|
9895
|
+
res({
|
|
9896
|
+
views: data.Items
|
|
9897
|
+
});
|
|
9898
|
+
}
|
|
9899
|
+
catch (e) {
|
|
9900
|
+
rej(e);
|
|
9901
|
+
}
|
|
9902
|
+
}));
|
|
9903
|
+
yield api.SetCacheItem({
|
|
9904
|
+
key: GetListCacheKey(type),
|
|
9905
|
+
value: prom,
|
|
9906
|
+
req: reqParams
|
|
9907
|
+
});
|
|
9908
|
+
return prom;
|
|
9909
|
+
});
|
|
9910
|
+
}
|
|
9911
|
+
ProjectView.GetList = GetList;
|
|
9912
|
+
/**
|
|
9913
|
+
* Deletes a project view.
|
|
9914
|
+
* @param params
|
|
9915
|
+
*/
|
|
9916
|
+
function Delete(params) {
|
|
9917
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
9918
|
+
let { api, viewId, req: reqParams } = params;
|
|
9919
|
+
if (!viewId) {
|
|
9920
|
+
throw ("View ID is required.");
|
|
9921
|
+
}
|
|
9922
|
+
if (!api) {
|
|
9923
|
+
api = ENVIRONMENT.Api().GetBruceApi();
|
|
9924
|
+
}
|
|
9925
|
+
yield api.DELETE(`ui.view/${viewId}`, Api.PrepReqParams(reqParams));
|
|
9926
|
+
api.Cache.Remove(GetCacheKey(viewId));
|
|
9927
|
+
api.Cache.RemoveByStartsWith(GetListCacheKey());
|
|
9928
|
+
});
|
|
9929
|
+
}
|
|
9930
|
+
ProjectView.Delete = Delete;
|
|
9931
|
+
/**
|
|
9932
|
+
* Creates or updates a project view.
|
|
9933
|
+
* @param params
|
|
9934
|
+
* @returns
|
|
9935
|
+
*/
|
|
9936
|
+
function Update(params) {
|
|
9937
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
9938
|
+
let { api, view: data, req: reqParams } = params;
|
|
9939
|
+
if (!api) {
|
|
9940
|
+
api = ENVIRONMENT.Api().GetBruceApi();
|
|
9941
|
+
}
|
|
9942
|
+
if (!data) {
|
|
9943
|
+
data = {};
|
|
9944
|
+
}
|
|
9945
|
+
const isNew = !data.ID;
|
|
9946
|
+
if (!data.ID) {
|
|
9947
|
+
// Short ID to keep the URL short.
|
|
9948
|
+
// 8 length = 4,294,967,296 combinations.
|
|
9949
|
+
data.ID = ObjectUtils.UId(8);
|
|
9950
|
+
}
|
|
9951
|
+
if (!data.Name) {
|
|
9952
|
+
data.Name = data.ID;
|
|
9953
|
+
}
|
|
9954
|
+
if (!data.CreatedByUIVersion) {
|
|
9955
|
+
data.CreatedByUIVersion = "-1";
|
|
9956
|
+
}
|
|
9957
|
+
if (isNew) {
|
|
9958
|
+
data = yield api.POST(`ui.view/${data.ID}`, data, Api.PrepReqParams(reqParams));
|
|
9959
|
+
}
|
|
9960
|
+
else {
|
|
9961
|
+
data = yield api.PUT(`ui.view/${data.ID}`, data, Api.PrepReqParams(reqParams));
|
|
9962
|
+
}
|
|
9963
|
+
api.Cache.Remove(GetCacheKey(data.ID));
|
|
9964
|
+
api.Cache.RemoveByStartsWith(GetListCacheKey());
|
|
9965
|
+
return {
|
|
9966
|
+
view: data
|
|
9967
|
+
};
|
|
9968
|
+
});
|
|
9969
|
+
}
|
|
9970
|
+
ProjectView.Update = Update;
|
|
9971
|
+
/**
|
|
9972
|
+
* Returns cache identifier for a project view.
|
|
9973
|
+
* Example: {
|
|
9974
|
+
* const api: BruceApi.Api = ...;
|
|
9975
|
+
* const key = GetCacheKey("abc");
|
|
9976
|
+
* api.Cache.Remove(key);
|
|
9977
|
+
* }
|
|
9978
|
+
* @param viewId
|
|
9979
|
+
* @returns
|
|
9980
|
+
*/
|
|
9981
|
+
function GetCacheKey(viewId) {
|
|
9982
|
+
return `${Api.ECacheKey.ProjectView}${Api.ECacheKey.Id}${viewId}`;
|
|
9983
|
+
}
|
|
9984
|
+
ProjectView.GetCacheKey = GetCacheKey;
|
|
9985
|
+
/**
|
|
9986
|
+
* Returns cache identifier for a list of project views.
|
|
9987
|
+
* Example: {
|
|
9988
|
+
* const api: BruceApi.Api = ...;
|
|
9989
|
+
* const key = GetListCacheKey();
|
|
9990
|
+
* api.Cache.Remove(key);
|
|
9991
|
+
* }
|
|
9992
|
+
* @param type optional filter for the type of project view.
|
|
9993
|
+
* @returns
|
|
9994
|
+
*/
|
|
9995
|
+
function GetListCacheKey(type) {
|
|
9996
|
+
if (type) {
|
|
9997
|
+
return `${Api.ECacheKey.ProjectView}${Api.ECacheKey.ListId}${type}`;
|
|
9998
|
+
}
|
|
9999
|
+
return `${Api.ECacheKey.ProjectView}${Api.ECacheKey.ListId}`;
|
|
10000
|
+
}
|
|
10001
|
+
ProjectView.GetListCacheKey = GetListCacheKey;
|
|
10002
|
+
})(ProjectView || (ProjectView = {}));
|
|
10003
|
+
|
|
10004
|
+
function getTemplateSettings(apiGetter, reqParams) {
|
|
10005
|
+
var _a;
|
|
10006
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
10007
|
+
const { view } = yield ProjectView.Get({
|
|
10008
|
+
api: apiGetter.getApi(Api.TEMPLATE_ACCOUNT_ID),
|
|
10009
|
+
viewId: "default",
|
|
10010
|
+
req: reqParams
|
|
10011
|
+
});
|
|
10012
|
+
return (_a = view.Settings) !== null && _a !== void 0 ? _a : {};
|
|
10013
|
+
});
|
|
10014
|
+
}
|
|
10015
|
+
function checkSourceToTemplate(items, templateItem, addIfMissing) {
|
|
10016
|
+
const index = items.findIndex(x => x.Name === templateItem.Name);
|
|
10017
|
+
if (index > -1) {
|
|
10018
|
+
templateItem.IsDefault = true;
|
|
10019
|
+
templateItem.IsEnabled = items[index].IsEnabled;
|
|
10020
|
+
items[index] = templateItem;
|
|
10021
|
+
}
|
|
10022
|
+
else if (addIfMissing) {
|
|
10023
|
+
templateItem.IsDefault = true;
|
|
10024
|
+
items.push(templateItem);
|
|
10025
|
+
}
|
|
10026
|
+
}
|
|
10027
|
+
/**
|
|
10028
|
+
* Describes a terrain or map source that are found in project view records.
|
|
10029
|
+
* This is a concept we want to trash as we're moving towards storing tileset ids instead.
|
|
10030
|
+
* This will help at least understand and manage this dying concept.
|
|
10031
|
+
*/
|
|
10032
|
+
var ProjectViewLegacyTile;
|
|
10033
|
+
(function (ProjectViewLegacyTile) {
|
|
10034
|
+
function MergeMapTemplateData(params) {
|
|
10035
|
+
var _a;
|
|
10036
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
10037
|
+
let { getter, sources: items, addIfMissing, req: reqParams } = params;
|
|
10038
|
+
if (!getter) {
|
|
10039
|
+
getter = ENVIRONMENT.Api().GetBruceGetter();
|
|
10040
|
+
}
|
|
10041
|
+
const settings = yield getTemplateSettings(getter, reqParams);
|
|
10042
|
+
const maps = (_a = settings.CesiumMapSources) !== null && _a !== void 0 ? _a : [];
|
|
10043
|
+
for (let i = 0; i < maps.length; i++) {
|
|
10044
|
+
const mapSource = maps[i];
|
|
10045
|
+
checkSourceToTemplate(items, mapSource, addIfMissing);
|
|
10046
|
+
}
|
|
10047
|
+
return {
|
|
10048
|
+
sources: items
|
|
10049
|
+
};
|
|
10050
|
+
});
|
|
10051
|
+
}
|
|
10052
|
+
ProjectViewLegacyTile.MergeMapTemplateData = MergeMapTemplateData;
|
|
10053
|
+
function MergeTerrainTemplateData(params) {
|
|
10054
|
+
var _a;
|
|
10055
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
10056
|
+
let { getter, sources: items, addIfMissing, req: reqParams } = params;
|
|
10057
|
+
if (!getter) {
|
|
10058
|
+
getter = ENVIRONMENT.Api().GetBruceGetter();
|
|
10059
|
+
}
|
|
10060
|
+
const settings = yield getTemplateSettings(getter, reqParams);
|
|
10061
|
+
const terrains = (_a = settings.CesiumTerrainSources) !== null && _a !== void 0 ? _a : [];
|
|
10062
|
+
for (let i = 0; i < terrains.length; i++) {
|
|
10063
|
+
const terrainSource = terrains[i];
|
|
10064
|
+
checkSourceToTemplate(items, terrainSource, addIfMissing);
|
|
10065
|
+
}
|
|
10066
|
+
return {
|
|
10067
|
+
sources: items
|
|
10068
|
+
};
|
|
10069
|
+
});
|
|
10070
|
+
}
|
|
10071
|
+
ProjectViewLegacyTile.MergeTerrainTemplateData = MergeTerrainTemplateData;
|
|
10072
|
+
})(ProjectViewLegacyTile || (ProjectViewLegacyTile = {}));
|
|
10073
|
+
|
|
10074
|
+
/**
|
|
10075
|
+
* A tile is an imagery or terrain tileset definition.
|
|
10076
|
+
*/
|
|
10077
|
+
var ProjectViewTile;
|
|
10078
|
+
(function (ProjectViewTile) {
|
|
10079
|
+
/**
|
|
10080
|
+
* Available imagery defaults.
|
|
10081
|
+
*/
|
|
10082
|
+
let EDefaultImagery;
|
|
10083
|
+
(function (EDefaultImagery) {
|
|
10084
|
+
EDefaultImagery["BingMapsAerial"] = "bingmapsaerial";
|
|
10085
|
+
EDefaultImagery["BingMapsAerialWithLabels"] = "bingmapsaerialwithlabels";
|
|
10086
|
+
EDefaultImagery["BingMapsRoads"] = "bingmapsroads";
|
|
10087
|
+
EDefaultImagery["MapboxSatellite"] = "mapboxsatellite";
|
|
10088
|
+
EDefaultImagery["MapBoxStreets"] = "mapboxstreets";
|
|
10089
|
+
EDefaultImagery["MapBoxStreetsClassic"] = "mapboxstreetsclassic";
|
|
10090
|
+
EDefaultImagery["EsriWorldImagery"] = "esriworldimagery";
|
|
10091
|
+
EDefaultImagery["EsriWorldStreetMap"] = "esriworldstreetmap";
|
|
10092
|
+
EDefaultImagery["EsriNationalGeographic"] = "esrinationalgeographic";
|
|
10093
|
+
EDefaultImagery["OpenStreetMap"] = "openstreetmap";
|
|
10094
|
+
EDefaultImagery["LINZ"] = "linz";
|
|
10095
|
+
EDefaultImagery["StamenWaterColor"] = "stamenwatercolor";
|
|
10096
|
+
EDefaultImagery["StamenToner"] = "stamentoner";
|
|
10097
|
+
EDefaultImagery["Grid"] = "grid";
|
|
10098
|
+
EDefaultImagery["ThunderforestCycle"] = "thunderforestcycle";
|
|
10099
|
+
EDefaultImagery["ThunderforestTransport"] = "thunderforesttransport";
|
|
10100
|
+
EDefaultImagery["ThunderforestLandscape"] = "thunderforestlandscape";
|
|
10101
|
+
})(EDefaultImagery = ProjectViewTile.EDefaultImagery || (ProjectViewTile.EDefaultImagery = {}));
|
|
10102
|
+
/**
|
|
10103
|
+
* Prepared array for UI.
|
|
10104
|
+
* TODO: Im not happy with icon urls sitting in the code. I'd prefer we ship these icons in the library as files.
|
|
10105
|
+
*/
|
|
10106
|
+
ProjectViewTile.DefaultImagery = [
|
|
10107
|
+
{
|
|
10108
|
+
id: EDefaultImagery.BingMapsAerial,
|
|
10109
|
+
name: "Bing Maps Aerial",
|
|
10110
|
+
iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/bingAerial.png"
|
|
10111
|
+
},
|
|
10112
|
+
{
|
|
10113
|
+
id: EDefaultImagery.BingMapsAerialWithLabels,
|
|
10114
|
+
name: "Bing Maps Aerial with Labels",
|
|
10115
|
+
iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/bingAerialLabels.png"
|
|
10116
|
+
},
|
|
10117
|
+
{
|
|
10118
|
+
id: EDefaultImagery.BingMapsRoads,
|
|
10119
|
+
name: "Bing Maps Roads",
|
|
10120
|
+
iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/bingRoads.png"
|
|
10121
|
+
},
|
|
10122
|
+
{
|
|
10123
|
+
id: EDefaultImagery.MapboxSatellite,
|
|
10124
|
+
name: "Mapbox Satellite",
|
|
10125
|
+
iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/mapboxSatellite.png"
|
|
10126
|
+
},
|
|
10127
|
+
{
|
|
10128
|
+
id: EDefaultImagery.MapBoxStreets,
|
|
10129
|
+
name: "Mapbox Streets",
|
|
10130
|
+
iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/mapboxTerrain.png"
|
|
10131
|
+
},
|
|
10132
|
+
{
|
|
10133
|
+
id: EDefaultImagery.MapBoxStreetsClassic,
|
|
10134
|
+
name: "Mapbox Streets Classic",
|
|
10135
|
+
iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/mapboxStreets.png"
|
|
10136
|
+
},
|
|
10137
|
+
{
|
|
10138
|
+
id: EDefaultImagery.EsriWorldImagery,
|
|
10139
|
+
name: "Esri World Imagery",
|
|
10140
|
+
iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/esriWorldImagery.png"
|
|
10141
|
+
},
|
|
10142
|
+
{
|
|
10143
|
+
id: EDefaultImagery.EsriWorldStreetMap,
|
|
10144
|
+
name: "Esri World Street Map",
|
|
10145
|
+
iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/esriWorldStreetMap.png"
|
|
10146
|
+
},
|
|
10147
|
+
{
|
|
10148
|
+
id: EDefaultImagery.EsriNationalGeographic,
|
|
10149
|
+
name: "Esri National Geographic",
|
|
10150
|
+
iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/esriNationalGeographic.png"
|
|
10151
|
+
},
|
|
10152
|
+
{
|
|
10153
|
+
id: EDefaultImagery.OpenStreetMap,
|
|
10154
|
+
name: "Open Street Map",
|
|
10155
|
+
iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/openStreetMap.png"
|
|
10156
|
+
},
|
|
10157
|
+
{
|
|
10158
|
+
id: EDefaultImagery.LINZ,
|
|
10159
|
+
name: "LINZ",
|
|
10160
|
+
iconUrl: "https://template.ui.nextspace.host/media/linz.jpg"
|
|
10161
|
+
},
|
|
10162
|
+
{
|
|
10163
|
+
id: EDefaultImagery.StamenWaterColor,
|
|
10164
|
+
name: "Stamen Water Color",
|
|
10165
|
+
iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/stamenWatercolor.png"
|
|
10166
|
+
},
|
|
10167
|
+
{
|
|
10168
|
+
id: EDefaultImagery.StamenToner,
|
|
10169
|
+
name: "Stamen Toner",
|
|
10170
|
+
iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/stamenToner.png"
|
|
10171
|
+
},
|
|
10172
|
+
{
|
|
10173
|
+
id: EDefaultImagery.ThunderforestCycle,
|
|
10174
|
+
name: "Thunderforest Cycle"
|
|
10175
|
+
},
|
|
10176
|
+
{
|
|
10177
|
+
id: EDefaultImagery.ThunderforestTransport,
|
|
10178
|
+
name: "Thunderforest Transport"
|
|
10179
|
+
},
|
|
10180
|
+
{
|
|
10181
|
+
id: EDefaultImagery.ThunderforestLandscape,
|
|
10182
|
+
name: "Thunderforest Landscape"
|
|
10183
|
+
},
|
|
10184
|
+
{
|
|
10185
|
+
id: EDefaultImagery.Grid,
|
|
10186
|
+
name: "Grid",
|
|
10187
|
+
iconUrl: "https://template.api.nextspace-uat.net/file/2885d8df-028b-4f5c-80b3-2634f7e7cf69.png"
|
|
10188
|
+
}
|
|
10189
|
+
];
|
|
10190
|
+
/**
|
|
10191
|
+
* Available terrain defaults.
|
|
10192
|
+
*/
|
|
10193
|
+
let EDefaultTerrain;
|
|
10194
|
+
(function (EDefaultTerrain) {
|
|
10195
|
+
EDefaultTerrain["CesiumWorldTerrain"] = "cesiumworldterrain";
|
|
10196
|
+
EDefaultTerrain["FlatTerrain"] = "flatterrain";
|
|
10197
|
+
EDefaultTerrain["LINZ"] = "linz";
|
|
10198
|
+
})(EDefaultTerrain = ProjectViewTile.EDefaultTerrain || (ProjectViewTile.EDefaultTerrain = {}));
|
|
10199
|
+
/**
|
|
10200
|
+
* Prepared array for UI.
|
|
10201
|
+
* TODO: Im not happy with icon urls sitting in the code. I'd prefer we ship these icons in the library as files.
|
|
10202
|
+
*/
|
|
10203
|
+
ProjectViewTile.DefaultTerrains = [
|
|
10204
|
+
{
|
|
10205
|
+
id: EDefaultTerrain.CesiumWorldTerrain,
|
|
10206
|
+
name: "Cesium World Terrain",
|
|
10207
|
+
iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/TerrainProviders/CesiumWorldTerrain.png"
|
|
10208
|
+
},
|
|
10209
|
+
{
|
|
10210
|
+
id: EDefaultTerrain.LINZ,
|
|
10211
|
+
name: "LINZ",
|
|
10212
|
+
iconUrl: "https://template.ui.nextspace.host/media/linz.jpg"
|
|
10213
|
+
},
|
|
10214
|
+
{
|
|
10215
|
+
id: EDefaultTerrain.FlatTerrain,
|
|
10216
|
+
name: "Flat Terrain",
|
|
10217
|
+
}
|
|
10218
|
+
];
|
|
10219
|
+
})(ProjectViewTile || (ProjectViewTile = {}));
|
|
10220
|
+
|
|
10221
|
+
/**
|
|
10222
|
+
* Deprecated Project View record.
|
|
10223
|
+
* This was used in the legacy web Navigator.
|
|
10224
|
+
*/
|
|
10225
|
+
var ProjectViewLegacy;
|
|
10226
|
+
(function (ProjectViewLegacy) {
|
|
10227
|
+
ProjectViewLegacy.DATA_VERSION = 1;
|
|
10228
|
+
})(ProjectViewLegacy || (ProjectViewLegacy = {}));
|
|
10229
|
+
|
|
10230
|
+
/**
|
|
10231
|
+
* Deprecated Project View Bookmark record.
|
|
10232
|
+
* This was used in the legacy web Navigator.
|
|
10233
|
+
*/
|
|
10234
|
+
var ProjectViewLegacyBookmark;
|
|
10235
|
+
(function (ProjectViewLegacyBookmark) {
|
|
10236
|
+
ProjectViewLegacyBookmark.DATA_VERSION = 1;
|
|
10237
|
+
})(ProjectViewLegacyBookmark || (ProjectViewLegacyBookmark = {}));
|
|
10238
|
+
|
|
10239
|
+
/**
|
|
10240
|
+
* Describes the "Pending Action" concept within Nextspace.
|
|
10241
|
+
* A pending action is a record of a server-side background process.
|
|
10242
|
+
* This record is used to monitor its progress and completion state.
|
|
10243
|
+
*/
|
|
10244
|
+
var PendingAction;
|
|
10245
|
+
(function (PendingAction) {
|
|
10246
|
+
/**
|
|
10247
|
+
* Available pending action statuses.
|
|
10248
|
+
*/
|
|
10249
|
+
let EStatus;
|
|
10250
|
+
(function (EStatus) {
|
|
10251
|
+
EStatus["InProgress"] = "IN_PROGRESS";
|
|
10252
|
+
EStatus["Cancelled"] = "CANCELLED";
|
|
10253
|
+
EStatus["Complete"] = "COMPLETE";
|
|
10254
|
+
EStatus["Failed"] = "FAILED";
|
|
10255
|
+
})(EStatus = PendingAction.EStatus || (PendingAction.EStatus = {}));
|
|
10256
|
+
/**
|
|
10257
|
+
* Available message types.
|
|
10027
10258
|
*/
|
|
10028
|
-
|
|
10029
|
-
|
|
10030
|
-
|
|
10031
|
-
|
|
10032
|
-
|
|
10033
|
-
|
|
10034
|
-
|
|
10035
|
-
},
|
|
10036
|
-
CameraZoomSettings: [
|
|
10037
|
-
{
|
|
10038
|
-
DisplayType: ZoomControl.EDisplayType.Model3D,
|
|
10039
|
-
MaxZoom: 100000,
|
|
10040
|
-
MinZoom: 0,
|
|
10041
|
-
StyleID: styleId
|
|
10042
|
-
}
|
|
10043
|
-
]
|
|
10044
|
-
};
|
|
10045
|
-
}
|
|
10046
|
-
MenuItem.CreateFromTypeId = CreateFromTypeId;
|
|
10259
|
+
let EMessageType;
|
|
10260
|
+
(function (EMessageType) {
|
|
10261
|
+
EMessageType["Warn"] = "WARNING";
|
|
10262
|
+
EMessageType["Error"] = "ERROR";
|
|
10263
|
+
EMessageType["Status"] = "STATUS";
|
|
10264
|
+
EMessageType["Info"] = "INFO";
|
|
10265
|
+
})(EMessageType = PendingAction.EMessageType || (PendingAction.EMessageType = {}));
|
|
10047
10266
|
/**
|
|
10048
|
-
*
|
|
10049
|
-
* @param
|
|
10050
|
-
* @param type
|
|
10267
|
+
* Returns a pending action record.
|
|
10268
|
+
* @param params
|
|
10051
10269
|
* @returns
|
|
10052
10270
|
*/
|
|
10053
|
-
function
|
|
10054
|
-
|
|
10055
|
-
|
|
10056
|
-
|
|
10057
|
-
|
|
10058
|
-
|
|
10059
|
-
|
|
10060
|
-
|
|
10061
|
-
|
|
10062
|
-
|
|
10063
|
-
};
|
|
10064
|
-
}
|
|
10065
|
-
else if (type == Tileset.EType.EntitiesSet) {
|
|
10066
|
-
return {
|
|
10067
|
-
id: ObjectUtils.UId(),
|
|
10068
|
-
Type: EType.EntityTileset,
|
|
10069
|
-
Caption: "Generated Entities Menu Item",
|
|
10070
|
-
FlyTo: false,
|
|
10071
|
-
tileset: {
|
|
10072
|
-
TilesetID: tilesetId
|
|
10073
|
-
}
|
|
10074
|
-
};
|
|
10075
|
-
}
|
|
10076
|
-
else if (type == Tileset.EType.PointCloud) {
|
|
10077
|
-
return {
|
|
10078
|
-
id: ObjectUtils.UId(),
|
|
10079
|
-
Type: EType.PointCloud,
|
|
10080
|
-
Caption: "Generated Point Cloud Menu Item",
|
|
10081
|
-
FlyTo: false,
|
|
10082
|
-
tileset: {
|
|
10083
|
-
TilesetID: tilesetId
|
|
10084
|
-
}
|
|
10085
|
-
};
|
|
10086
|
-
}
|
|
10087
|
-
else if (type == Tileset.EType.EntitiesMap) {
|
|
10271
|
+
function Get(params) {
|
|
10272
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
10273
|
+
let { api, actionId, req: reqParams } = params;
|
|
10274
|
+
if (!actionId) {
|
|
10275
|
+
throw ("Action ID is required.");
|
|
10276
|
+
}
|
|
10277
|
+
if (!api) {
|
|
10278
|
+
api = ENVIRONMENT.Api().GetBruceApi();
|
|
10279
|
+
}
|
|
10280
|
+
const data = yield api.GET(`pendingAction/${actionId}`, Api.PrepReqParams(reqParams));
|
|
10088
10281
|
return {
|
|
10089
|
-
|
|
10090
|
-
Type: EType.EntityRaster,
|
|
10091
|
-
Caption: "Generated Entities Menu Item",
|
|
10092
|
-
tileset: {
|
|
10093
|
-
TilesetID: tilesetId
|
|
10094
|
-
}
|
|
10282
|
+
action: data
|
|
10095
10283
|
};
|
|
10096
|
-
}
|
|
10097
|
-
throw ("Tileset type not supported.");
|
|
10284
|
+
});
|
|
10098
10285
|
}
|
|
10099
|
-
|
|
10100
|
-
})(MenuItem || (MenuItem = {}));
|
|
10101
|
-
|
|
10102
|
-
/**
|
|
10103
|
-
* Describe the "Project View Bookmark" concept within Nextspace.
|
|
10104
|
-
* This is referred to as "slides" in older code.
|
|
10105
|
-
*
|
|
10106
|
-
* A bookmark is a snapshot of what should be displayed and how in a particular project view.
|
|
10107
|
-
*/
|
|
10108
|
-
var ProjectViewBookmark;
|
|
10109
|
-
(function (ProjectViewBookmark) {
|
|
10110
|
-
// This is the expected default version for the DataVersion value.
|
|
10111
|
-
// This value should NOT be changed without looking at our API and seeing what the default value is.
|
|
10112
|
-
ProjectViewBookmark.DEFAULT_DATA_VERSION = 2;
|
|
10286
|
+
PendingAction.Get = Get;
|
|
10113
10287
|
/**
|
|
10114
|
-
*
|
|
10115
|
-
*
|
|
10288
|
+
* Returns a list of pending action records.
|
|
10289
|
+
* @param params
|
|
10290
|
+
* @returns
|
|
10116
10291
|
*/
|
|
10117
|
-
|
|
10118
|
-
|
|
10119
|
-
|
|
10120
|
-
|
|
10121
|
-
|
|
10292
|
+
function GetRelevantList(params) {
|
|
10293
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
10294
|
+
let { api, stricter, reqParams } = params;
|
|
10295
|
+
if (!api) {
|
|
10296
|
+
api = ENVIRONMENT.Api().GetBruceApi();
|
|
10297
|
+
}
|
|
10298
|
+
const data = yield api.GET(`pendingActions/important?Update=${Boolean(stricter)}`, Api.PrepReqParams(reqParams));
|
|
10299
|
+
return {
|
|
10300
|
+
actions: data.Items
|
|
10301
|
+
};
|
|
10302
|
+
});
|
|
10303
|
+
}
|
|
10304
|
+
PendingAction.GetRelevantList = GetRelevantList;
|
|
10122
10305
|
/**
|
|
10123
|
-
*
|
|
10306
|
+
* Returns a list of pending action record messages.
|
|
10124
10307
|
* @param params
|
|
10125
10308
|
* @returns
|
|
10126
10309
|
*/
|
|
10127
|
-
function
|
|
10310
|
+
function GetMessages(params) {
|
|
10128
10311
|
return __awaiter(this, void 0, void 0, function* () {
|
|
10129
|
-
let { api,
|
|
10130
|
-
if (!viewId || !bookmarkId) {
|
|
10131
|
-
throw ("View ID and Bookmark ID are required.");
|
|
10132
|
-
}
|
|
10312
|
+
let { api, actionId, order, startIndex, amount, req: reqParams, types } = params;
|
|
10133
10313
|
if (!api) {
|
|
10134
10314
|
api = ENVIRONMENT.Api().GetBruceApi();
|
|
10135
10315
|
}
|
|
10136
|
-
|
|
10137
|
-
|
|
10138
|
-
if (cache === null || cache === void 0 ? void 0 : cache.found) {
|
|
10139
|
-
return cache.data;
|
|
10316
|
+
if (amount == null) {
|
|
10317
|
+
amount = 500;
|
|
10140
10318
|
}
|
|
10141
|
-
|
|
10142
|
-
|
|
10143
|
-
|
|
10144
|
-
|
|
10145
|
-
|
|
10146
|
-
|
|
10147
|
-
|
|
10148
|
-
|
|
10149
|
-
|
|
10319
|
+
if (startIndex == null) {
|
|
10320
|
+
startIndex = 0;
|
|
10321
|
+
}
|
|
10322
|
+
if (order == null) {
|
|
10323
|
+
order = Api.ESortOrder.Asc;
|
|
10324
|
+
}
|
|
10325
|
+
let args = `?SortOrder=${order == Api.ESortOrder.Desc ? "DESC" : "ASC"}&PageSize=${amount}&PageIndex=${startIndex}`;
|
|
10326
|
+
if (types === null || types === void 0 ? void 0 : types.length) {
|
|
10327
|
+
for (let i = 0; i < types.length; i++) {
|
|
10328
|
+
args += `&Type=${types[i]}`;
|
|
10150
10329
|
}
|
|
10151
|
-
}
|
|
10152
|
-
yield api.
|
|
10153
|
-
|
|
10154
|
-
|
|
10155
|
-
|
|
10156
|
-
});
|
|
10157
|
-
return prom;
|
|
10330
|
+
}
|
|
10331
|
+
const data = yield api.GET(`pendingAction/${actionId}/progressMessages` + args, Api.PrepReqParams(reqParams));
|
|
10332
|
+
return {
|
|
10333
|
+
messages: data.Items
|
|
10334
|
+
};
|
|
10158
10335
|
});
|
|
10159
10336
|
}
|
|
10160
|
-
|
|
10337
|
+
PendingAction.GetMessages = GetMessages;
|
|
10161
10338
|
/**
|
|
10162
|
-
*
|
|
10339
|
+
* Requests to cancel a pending action.
|
|
10163
10340
|
* @param params
|
|
10164
10341
|
*/
|
|
10165
|
-
function
|
|
10342
|
+
function Cancel(params) {
|
|
10166
10343
|
return __awaiter(this, void 0, void 0, function* () {
|
|
10167
|
-
let { api,
|
|
10168
|
-
if (!
|
|
10169
|
-
throw ("
|
|
10344
|
+
let { api, actionId, req: reqParams } = params;
|
|
10345
|
+
if (!actionId) {
|
|
10346
|
+
throw ("Action ID is required.");
|
|
10170
10347
|
}
|
|
10171
10348
|
if (!api) {
|
|
10172
10349
|
api = ENVIRONMENT.Api().GetBruceApi();
|
|
10173
10350
|
}
|
|
10174
|
-
yield api.DELETE(`
|
|
10175
|
-
api.Cache.Remove(GetCacheKey(viewId, bookmarkId));
|
|
10176
|
-
api.Cache.Remove(GetListCacheKey(viewId));
|
|
10351
|
+
yield api.DELETE(`pendingAction/${actionId}`, Api.PrepReqParams(reqParams));
|
|
10177
10352
|
});
|
|
10178
10353
|
}
|
|
10179
|
-
|
|
10354
|
+
PendingAction.Cancel = Cancel;
|
|
10355
|
+
})(PendingAction || (PendingAction = {}));
|
|
10356
|
+
|
|
10357
|
+
// Some dead accounts that we don't want to show in the UI.
|
|
10358
|
+
// Some accounts may not be "dead" but instead purposely don't have a NextspaceAPI database so we'll avoid them too.
|
|
10359
|
+
const ACCOUNT_EXCLUSIONS = ["hyperportal", "hypeportal", "bviewer"];
|
|
10360
|
+
/**
|
|
10361
|
+
* Describes the "Client Account" concept within Nextspace.
|
|
10362
|
+
* A client account is a database instance that holds one or many users.
|
|
10363
|
+
*/
|
|
10364
|
+
var Account;
|
|
10365
|
+
(function (Account) {
|
|
10180
10366
|
/**
|
|
10181
|
-
*
|
|
10367
|
+
* Known Nextspace applications we store settings for.
|
|
10368
|
+
*/
|
|
10369
|
+
let EAppId;
|
|
10370
|
+
(function (EAppId) {
|
|
10371
|
+
EAppId["BruceApi"] = "BruceAPI";
|
|
10372
|
+
EAppId["Navigator"] = "Navigator";
|
|
10373
|
+
EAppId["Operator"] = "BruceClientAdmin";
|
|
10374
|
+
})(EAppId = Account.EAppId || (Account.EAppId = {}));
|
|
10375
|
+
/**
|
|
10376
|
+
* Possible starter content options.
|
|
10377
|
+
* When creating a new account you can populate it with certain default data.
|
|
10378
|
+
*/
|
|
10379
|
+
let EStarterContent;
|
|
10380
|
+
(function (EStarterContent) {
|
|
10381
|
+
EStarterContent["Default"] = "default";
|
|
10382
|
+
EStarterContent["None"] = "none";
|
|
10383
|
+
})(EStarterContent = Account.EStarterContent || (Account.EStarterContent = {}));
|
|
10384
|
+
/**
|
|
10385
|
+
* Gets a client account record by ID.
|
|
10182
10386
|
* @param params
|
|
10183
10387
|
* @returns
|
|
10184
10388
|
*/
|
|
10185
|
-
function
|
|
10389
|
+
function Get(params) {
|
|
10186
10390
|
return __awaiter(this, void 0, void 0, function* () {
|
|
10187
|
-
let { api,
|
|
10188
|
-
if (!viewId) {
|
|
10189
|
-
throw ("View ID is required.");
|
|
10190
|
-
}
|
|
10391
|
+
let { api, accountId: id, req: reqParams } = params;
|
|
10191
10392
|
if (!api) {
|
|
10192
|
-
api = ENVIRONMENT.Api().
|
|
10393
|
+
api = ENVIRONMENT.Api().GetGuardianApi();
|
|
10193
10394
|
}
|
|
10194
|
-
const cache = yield api.GetCacheItem(
|
|
10395
|
+
const cache = yield api.GetCacheItem(GetCacheKey(id), reqParams);
|
|
10195
10396
|
if (cache === null || cache === void 0 ? void 0 : cache.found) {
|
|
10196
10397
|
return cache.data;
|
|
10197
10398
|
}
|
|
10198
|
-
const
|
|
10399
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
10199
10400
|
try {
|
|
10200
|
-
const data = yield api.GET(`
|
|
10201
|
-
|
|
10202
|
-
|
|
10203
|
-
// Maybe better to load list cache when getting 1 slide and seeing if it's in there.
|
|
10204
|
-
// WARNING: Right now the data matches, in the future the list may contain a shortened result.
|
|
10205
|
-
for (let i = 0; i < items.length; i++) {
|
|
10206
|
-
const item = items[i];
|
|
10207
|
-
const prom = new Promise((res) => {
|
|
10208
|
-
res({
|
|
10209
|
-
bookmark: item
|
|
10210
|
-
});
|
|
10211
|
-
});
|
|
10401
|
+
const data = yield api.GET(`accountbyid/${id}`, reqParams);
|
|
10402
|
+
// Update the cache by subdomain as well in case it's different to the ID.
|
|
10403
|
+
if ((data === null || data === void 0 ? void 0 : data.ID) && (reqParams === null || reqParams === void 0 ? void 0 : reqParams.noCache) != false) {
|
|
10212
10404
|
yield api.SetCacheItem({
|
|
10213
|
-
key:
|
|
10405
|
+
key: data.Subdomain,
|
|
10214
10406
|
value: prom,
|
|
10215
10407
|
req: reqParams
|
|
10216
10408
|
});
|
|
10217
10409
|
}
|
|
10218
10410
|
res({
|
|
10219
|
-
|
|
10411
|
+
account: data
|
|
10220
10412
|
});
|
|
10221
10413
|
}
|
|
10222
10414
|
catch (e) {
|
|
@@ -10224,127 +10416,42 @@ var ProjectViewBookmark;
|
|
|
10224
10416
|
}
|
|
10225
10417
|
}));
|
|
10226
10418
|
yield api.SetCacheItem({
|
|
10227
|
-
key:
|
|
10228
|
-
value:
|
|
10419
|
+
key: GetCacheKey(id),
|
|
10420
|
+
value: prom,
|
|
10229
10421
|
req: reqParams
|
|
10230
10422
|
});
|
|
10231
|
-
return
|
|
10232
|
-
});
|
|
10233
|
-
}
|
|
10234
|
-
ProjectViewBookmark.GetList = GetList;
|
|
10235
|
-
/**
|
|
10236
|
-
* Creates or updates a bookmark record.
|
|
10237
|
-
* @param params
|
|
10238
|
-
* @returns
|
|
10239
|
-
*/
|
|
10240
|
-
function Update(params) {
|
|
10241
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
10242
|
-
let { api, viewId, bookmark: data, req: reqParams } = params;
|
|
10243
|
-
if (!api) {
|
|
10244
|
-
api = ENVIRONMENT.Api().GetBruceApi();
|
|
10245
|
-
}
|
|
10246
|
-
if (!(data === null || data === void 0 ? void 0 : data.Title)) {
|
|
10247
|
-
data.Title = data.ID;
|
|
10248
|
-
}
|
|
10249
|
-
const res = yield api.POST(`ui.view/${viewId}/slide/${data.ID ? data.ID : ""}`, data, Api.PrepReqParams(reqParams));
|
|
10250
|
-
api.Cache.Remove(GetCacheKey(viewId, data.ID));
|
|
10251
|
-
api.Cache.Remove(GetListCacheKey(viewId));
|
|
10252
|
-
return {
|
|
10253
|
-
bookmark: res
|
|
10254
|
-
};
|
|
10255
|
-
});
|
|
10256
|
-
}
|
|
10257
|
-
ProjectViewBookmark.Update = Update;
|
|
10258
|
-
/**
|
|
10259
|
-
* Sets the order of bookmarks within a project view.
|
|
10260
|
-
* @param params
|
|
10261
|
-
*/
|
|
10262
|
-
function SetOrder(params) {
|
|
10263
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
10264
|
-
let { api, viewId, bookmarkIds, req: reqParams } = params;
|
|
10265
|
-
if (!api) {
|
|
10266
|
-
api = ENVIRONMENT.Api().GetBruceApi();
|
|
10267
|
-
}
|
|
10268
|
-
const reqData = {
|
|
10269
|
-
"UISlide.ID": bookmarkIds,
|
|
10270
|
-
"DisplayOrder.Start": 0
|
|
10271
|
-
};
|
|
10272
|
-
yield api.POST(`ui.view/${viewId}/slides/setOrder`, reqData, Api.PrepReqParams(reqParams));
|
|
10273
|
-
yield api.Cache.RemoveByStartsWith(GetListCacheKey(viewId));
|
|
10423
|
+
return prom;
|
|
10274
10424
|
});
|
|
10275
10425
|
}
|
|
10276
|
-
|
|
10277
|
-
/**
|
|
10278
|
-
* Returns cache identifier for a bookmark.
|
|
10279
|
-
* Example: {
|
|
10280
|
-
* const api: BruceApi.Api = ...;
|
|
10281
|
-
* const key = GetCacheKey("abc", "def");
|
|
10282
|
-
* api.Cache.Remove(key);
|
|
10283
|
-
* }
|
|
10284
|
-
* @param viewId
|
|
10285
|
-
* @param bookmarkId
|
|
10286
|
-
* @returns
|
|
10287
|
-
*/
|
|
10288
|
-
function GetCacheKey(viewId, bookmarkId) {
|
|
10289
|
-
return `${Api.ECacheKey.ProjectViewBookmark}${Api.ECacheKey.Id}${viewId}${Api.ECacheKey.Id}${bookmarkId}`;
|
|
10290
|
-
}
|
|
10291
|
-
ProjectViewBookmark.GetCacheKey = GetCacheKey;
|
|
10292
|
-
/**
|
|
10293
|
-
* Returns cache identifier for a list of bookmarks.
|
|
10294
|
-
* Example: {
|
|
10295
|
-
* const api: BruceApi.Api = ...;
|
|
10296
|
-
* const key = GetListCacheKey("abc");
|
|
10297
|
-
* api.Cache.Remove(key);
|
|
10298
|
-
* }
|
|
10299
|
-
* @param viewId
|
|
10300
|
-
* @returns
|
|
10301
|
-
*/
|
|
10302
|
-
function GetListCacheKey(viewId) {
|
|
10303
|
-
return `${Api.ECacheKey.ProjectViewBookmark}${Api.ECacheKey.Id}${viewId}`;
|
|
10304
|
-
}
|
|
10305
|
-
ProjectViewBookmark.GetListCacheKey = GetListCacheKey;
|
|
10306
|
-
})(ProjectViewBookmark || (ProjectViewBookmark = {}));
|
|
10307
|
-
|
|
10308
|
-
/**
|
|
10309
|
-
* Describes the "Project View" concept within Nextspace.
|
|
10310
|
-
* A project view is a collection of settings for a visualization application we support.
|
|
10311
|
-
* It will describe what panels to show and how, it will also describe all possible ways data can be displayed.
|
|
10312
|
-
*/
|
|
10313
|
-
var ProjectView;
|
|
10314
|
-
(function (ProjectView) {
|
|
10315
|
-
// This is the expected default version for the DataVersion value.
|
|
10316
|
-
// This value should NOT be changed without looking at our API and seeing what the default value is.
|
|
10317
|
-
ProjectView.DEFAULT_DATA_VERSION = 2;
|
|
10318
|
-
// Our Cesium web navigator.
|
|
10319
|
-
ProjectView.TYPE_WEB_3D_NAVIGATOR = "WEB_3D_NAVIGATOR";
|
|
10320
|
-
// Our (currently WIP) 2D web navigator. Also known as our graph viewer.
|
|
10321
|
-
ProjectView.TYPE_WEB_2D_NAVIGATOR = "WEB_2D_NAVIGATOR";
|
|
10322
|
-
// Defaulting to 3D navigator for backwards compatibility.
|
|
10323
|
-
ProjectView.DEFAULT_TYPE = ProjectView.TYPE_WEB_3D_NAVIGATOR;
|
|
10426
|
+
Account.Get = Get;
|
|
10324
10427
|
/**
|
|
10325
|
-
*
|
|
10428
|
+
* Returns a client account record by subdomain or ID.
|
|
10326
10429
|
* @param params
|
|
10327
10430
|
* @returns
|
|
10328
10431
|
*/
|
|
10329
|
-
function
|
|
10432
|
+
function GetBySubdomain(params) {
|
|
10330
10433
|
return __awaiter(this, void 0, void 0, function* () {
|
|
10331
|
-
let { api,
|
|
10332
|
-
if (!viewId) {
|
|
10333
|
-
throw ("View ID is required.");
|
|
10334
|
-
}
|
|
10434
|
+
let { api, subdomain, req: reqParams } = params;
|
|
10335
10435
|
if (!api) {
|
|
10336
|
-
api = ENVIRONMENT.Api().
|
|
10436
|
+
api = ENVIRONMENT.Api().GetGuardianApi();
|
|
10337
10437
|
}
|
|
10338
|
-
const
|
|
10339
|
-
const cache = yield api.GetCacheItem(key, reqParams);
|
|
10438
|
+
const cache = yield api.GetCacheItem(GetCacheKey(subdomain), reqParams);
|
|
10340
10439
|
if (cache === null || cache === void 0 ? void 0 : cache.found) {
|
|
10341
10440
|
return cache.data;
|
|
10342
10441
|
}
|
|
10343
10442
|
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
10344
10443
|
try {
|
|
10345
|
-
const data = yield api.GET(`
|
|
10444
|
+
const data = yield api.GET(`account/${subdomain}`, reqParams);
|
|
10445
|
+
// Update the cache by ID as well in case it's different to the subdomain.
|
|
10446
|
+
if ((data === null || data === void 0 ? void 0 : data.ID) && (reqParams === null || reqParams === void 0 ? void 0 : reqParams.noCache) != false) {
|
|
10447
|
+
yield api.SetCacheItem({
|
|
10448
|
+
key: data.ID,
|
|
10449
|
+
value: prom,
|
|
10450
|
+
req: reqParams
|
|
10451
|
+
});
|
|
10452
|
+
}
|
|
10346
10453
|
res({
|
|
10347
|
-
|
|
10454
|
+
account: data
|
|
10348
10455
|
});
|
|
10349
10456
|
}
|
|
10350
10457
|
catch (e) {
|
|
@@ -10352,34 +10459,36 @@ var ProjectView;
|
|
|
10352
10459
|
}
|
|
10353
10460
|
}));
|
|
10354
10461
|
yield api.SetCacheItem({
|
|
10355
|
-
key,
|
|
10462
|
+
key: GetCacheKey(subdomain),
|
|
10356
10463
|
value: prom,
|
|
10357
10464
|
req: reqParams
|
|
10358
10465
|
});
|
|
10359
10466
|
return prom;
|
|
10360
10467
|
});
|
|
10361
10468
|
}
|
|
10362
|
-
|
|
10469
|
+
Account.GetBySubdomain = GetBySubdomain;
|
|
10363
10470
|
/**
|
|
10364
|
-
* Gets a list of
|
|
10471
|
+
* Gets a list of client accounts related to the current session user.
|
|
10365
10472
|
* @param params
|
|
10366
10473
|
* @returns
|
|
10367
10474
|
*/
|
|
10368
|
-
function
|
|
10475
|
+
function GetRelatedList(params) {
|
|
10369
10476
|
return __awaiter(this, void 0, void 0, function* () {
|
|
10370
|
-
let { api, req: reqParams
|
|
10477
|
+
let { api, req: reqParams } = params;
|
|
10371
10478
|
if (!api) {
|
|
10372
|
-
api = ENVIRONMENT.Api().
|
|
10479
|
+
api = ENVIRONMENT.Api().GetGuardianApi();
|
|
10373
10480
|
}
|
|
10374
|
-
const cache = yield api.GetCacheItem(GetListCacheKey(
|
|
10481
|
+
const cache = yield api.GetCacheItem(GetListCacheKey(api.GetSessionId()), reqParams);
|
|
10375
10482
|
if (cache === null || cache === void 0 ? void 0 : cache.found) {
|
|
10376
10483
|
return cache.data;
|
|
10377
10484
|
}
|
|
10485
|
+
const req = api.GET("user/relatedClientAccounts", reqParams);
|
|
10378
10486
|
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
10379
10487
|
try {
|
|
10380
|
-
const data = yield
|
|
10488
|
+
const data = yield req;
|
|
10489
|
+
const items = data.Items.filter((x) => !ACCOUNT_EXCLUSIONS.includes(x.ID));
|
|
10381
10490
|
res({
|
|
10382
|
-
|
|
10491
|
+
accounts: items
|
|
10383
10492
|
});
|
|
10384
10493
|
}
|
|
10385
10494
|
catch (e) {
|
|
@@ -10387,458 +10496,345 @@ var ProjectView;
|
|
|
10387
10496
|
}
|
|
10388
10497
|
}));
|
|
10389
10498
|
yield api.SetCacheItem({
|
|
10390
|
-
key: GetListCacheKey(
|
|
10499
|
+
key: GetListCacheKey(api.GetSessionId()),
|
|
10391
10500
|
value: prom,
|
|
10392
10501
|
req: reqParams
|
|
10393
10502
|
});
|
|
10394
10503
|
return prom;
|
|
10395
10504
|
});
|
|
10396
10505
|
}
|
|
10397
|
-
|
|
10398
|
-
/**
|
|
10399
|
-
* Deletes a project view.
|
|
10400
|
-
* @param params
|
|
10401
|
-
*/
|
|
10402
|
-
function Delete(params) {
|
|
10403
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
10404
|
-
let { api, viewId, req: reqParams } = params;
|
|
10405
|
-
if (!viewId) {
|
|
10406
|
-
throw ("View ID is required.");
|
|
10407
|
-
}
|
|
10408
|
-
if (!api) {
|
|
10409
|
-
api = ENVIRONMENT.Api().GetBruceApi();
|
|
10410
|
-
}
|
|
10411
|
-
yield api.DELETE(`ui.view/${viewId}`, Api.PrepReqParams(reqParams));
|
|
10412
|
-
api.Cache.Remove(GetCacheKey(viewId));
|
|
10413
|
-
api.Cache.RemoveByStartsWith(GetListCacheKey());
|
|
10414
|
-
});
|
|
10415
|
-
}
|
|
10416
|
-
ProjectView.Delete = Delete;
|
|
10506
|
+
Account.GetRelatedList = GetRelatedList;
|
|
10417
10507
|
/**
|
|
10418
|
-
*
|
|
10508
|
+
* Gets application settings for a specific client account.
|
|
10419
10509
|
* @param params
|
|
10420
10510
|
* @returns
|
|
10421
10511
|
*/
|
|
10422
|
-
function
|
|
10512
|
+
function GetAppSettings(params) {
|
|
10423
10513
|
return __awaiter(this, void 0, void 0, function* () {
|
|
10424
|
-
let { api,
|
|
10514
|
+
let { api, accountId: id, appId, req: reqParams } = params;
|
|
10425
10515
|
if (!api) {
|
|
10426
|
-
api = ENVIRONMENT.Api().
|
|
10427
|
-
}
|
|
10428
|
-
if (!data) {
|
|
10429
|
-
data = {};
|
|
10430
|
-
}
|
|
10431
|
-
const isNew = !data.ID;
|
|
10432
|
-
if (!data.ID) {
|
|
10433
|
-
// Short ID to keep the URL short.
|
|
10434
|
-
// 8 length = 4,294,967,296 combinations.
|
|
10435
|
-
data.ID = ObjectUtils.UId(8);
|
|
10436
|
-
}
|
|
10437
|
-
if (!data.Name) {
|
|
10438
|
-
data.Name = data.ID;
|
|
10439
|
-
}
|
|
10440
|
-
if (!data.CreatedByUIVersion) {
|
|
10441
|
-
data.CreatedByUIVersion = "-1";
|
|
10442
|
-
}
|
|
10443
|
-
if (isNew) {
|
|
10444
|
-
data = yield api.POST(`ui.view/${data.ID}`, data, Api.PrepReqParams(reqParams));
|
|
10516
|
+
api = ENVIRONMENT.Api().GetGuardianApi();
|
|
10445
10517
|
}
|
|
10446
|
-
|
|
10447
|
-
|
|
10518
|
+
const cache = yield api.GetCacheItem(GetCacheKey(id, appId), reqParams);
|
|
10519
|
+
if (cache === null || cache === void 0 ? void 0 : cache.found) {
|
|
10520
|
+
return cache.data;
|
|
10448
10521
|
}
|
|
10449
|
-
api.
|
|
10450
|
-
|
|
10451
|
-
|
|
10452
|
-
|
|
10453
|
-
|
|
10454
|
-
|
|
10455
|
-
|
|
10456
|
-
|
|
10457
|
-
|
|
10458
|
-
|
|
10459
|
-
|
|
10460
|
-
|
|
10461
|
-
|
|
10462
|
-
|
|
10463
|
-
|
|
10464
|
-
|
|
10465
|
-
|
|
10466
|
-
|
|
10467
|
-
|
|
10468
|
-
|
|
10469
|
-
}
|
|
10470
|
-
ProjectView.GetCacheKey = GetCacheKey;
|
|
10471
|
-
/**
|
|
10472
|
-
* Returns cache identifier for a list of project views.
|
|
10473
|
-
* Example: {
|
|
10474
|
-
* const api: BruceApi.Api = ...;
|
|
10475
|
-
* const key = GetListCacheKey();
|
|
10476
|
-
* api.Cache.Remove(key);
|
|
10477
|
-
* }
|
|
10478
|
-
* @param type optional filter for the type of project view.
|
|
10479
|
-
* @returns
|
|
10480
|
-
*/
|
|
10481
|
-
function GetListCacheKey(type) {
|
|
10482
|
-
if (type) {
|
|
10483
|
-
return `${Api.ECacheKey.ProjectView}${Api.ECacheKey.ListId}${type}`;
|
|
10484
|
-
}
|
|
10485
|
-
return `${Api.ECacheKey.ProjectView}${Api.ECacheKey.ListId}`;
|
|
10486
|
-
}
|
|
10487
|
-
ProjectView.GetListCacheKey = GetListCacheKey;
|
|
10488
|
-
})(ProjectView || (ProjectView = {}));
|
|
10489
|
-
|
|
10490
|
-
function getTemplateSettings(apiGetter, reqParams) {
|
|
10491
|
-
var _a;
|
|
10492
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
10493
|
-
const { view } = yield ProjectView.Get({
|
|
10494
|
-
api: apiGetter.getApi(Api.TEMPLATE_ACCOUNT_ID),
|
|
10495
|
-
viewId: "default",
|
|
10496
|
-
req: reqParams
|
|
10522
|
+
const req = yield api.GET(`account/${id}?ApplicationID=${appId}`, reqParams);
|
|
10523
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
10524
|
+
var _a;
|
|
10525
|
+
try {
|
|
10526
|
+
const data = yield req;
|
|
10527
|
+
const settings = (_a = data === null || data === void 0 ? void 0 : data["Application.Settings"]) !== null && _a !== void 0 ? _a : {};
|
|
10528
|
+
res({
|
|
10529
|
+
settings: settings
|
|
10530
|
+
});
|
|
10531
|
+
}
|
|
10532
|
+
catch (e) {
|
|
10533
|
+
rej(e);
|
|
10534
|
+
}
|
|
10535
|
+
}));
|
|
10536
|
+
yield api.SetCacheItem({
|
|
10537
|
+
key: GetCacheKey(id, appId),
|
|
10538
|
+
value: prom,
|
|
10539
|
+
req: reqParams
|
|
10540
|
+
});
|
|
10541
|
+
return prom;
|
|
10497
10542
|
});
|
|
10498
|
-
return (_a = view.Settings) !== null && _a !== void 0 ? _a : {};
|
|
10499
|
-
});
|
|
10500
|
-
}
|
|
10501
|
-
function checkSourceToTemplate(items, templateItem, addIfMissing) {
|
|
10502
|
-
const index = items.findIndex(x => x.Name === templateItem.Name);
|
|
10503
|
-
if (index > -1) {
|
|
10504
|
-
templateItem.IsDefault = true;
|
|
10505
|
-
templateItem.IsEnabled = items[index].IsEnabled;
|
|
10506
|
-
items[index] = templateItem;
|
|
10507
|
-
}
|
|
10508
|
-
else if (addIfMissing) {
|
|
10509
|
-
templateItem.IsDefault = true;
|
|
10510
|
-
items.push(templateItem);
|
|
10511
10543
|
}
|
|
10512
|
-
|
|
10513
|
-
/**
|
|
10514
|
-
|
|
10515
|
-
|
|
10516
|
-
|
|
10517
|
-
|
|
10518
|
-
|
|
10519
|
-
|
|
10520
|
-
function MergeMapTemplateData(params) {
|
|
10521
|
-
var _a;
|
|
10544
|
+
Account.GetAppSettings = GetAppSettings;
|
|
10545
|
+
/**
|
|
10546
|
+
* Updates application settings for a specific client account + application.
|
|
10547
|
+
* WARNING: Do not update API settings without knowing what you're doing.
|
|
10548
|
+
* @param params
|
|
10549
|
+
* @returns
|
|
10550
|
+
*/
|
|
10551
|
+
function UpdateAppSettings(params) {
|
|
10522
10552
|
return __awaiter(this, void 0, void 0, function* () {
|
|
10523
|
-
let {
|
|
10524
|
-
if (!
|
|
10525
|
-
|
|
10526
|
-
}
|
|
10527
|
-
const settings = yield getTemplateSettings(getter, reqParams);
|
|
10528
|
-
const maps = (_a = settings.CesiumMapSources) !== null && _a !== void 0 ? _a : [];
|
|
10529
|
-
for (let i = 0; i < maps.length; i++) {
|
|
10530
|
-
const mapSource = maps[i];
|
|
10531
|
-
checkSourceToTemplate(items, mapSource, addIfMissing);
|
|
10553
|
+
let { api, accountId: id, appId, settings: data, req: reqParams } = params;
|
|
10554
|
+
if (!api) {
|
|
10555
|
+
api = ENVIRONMENT.Api().GetGuardianApi();
|
|
10532
10556
|
}
|
|
10557
|
+
const res = yield api.POST(`account/${id}/applicationSettings/${appId}`, data, reqParams);
|
|
10558
|
+
yield api.Cache.RemoveByStartsWith(Api.ECacheKey.Account + Api.ECacheKey.Id + id);
|
|
10533
10559
|
return {
|
|
10534
|
-
|
|
10560
|
+
settings: res
|
|
10535
10561
|
};
|
|
10536
10562
|
});
|
|
10537
10563
|
}
|
|
10538
|
-
|
|
10539
|
-
|
|
10540
|
-
|
|
10564
|
+
Account.UpdateAppSettings = UpdateAppSettings;
|
|
10565
|
+
/**
|
|
10566
|
+
* Creates a new Nextspace account using given details.
|
|
10567
|
+
* @param params
|
|
10568
|
+
* @returns
|
|
10569
|
+
*/
|
|
10570
|
+
function Create(params) {
|
|
10541
10571
|
return __awaiter(this, void 0, void 0, function* () {
|
|
10542
|
-
let {
|
|
10543
|
-
if (!
|
|
10544
|
-
|
|
10572
|
+
let { api, accountId: id, name, hostingLocationKey, starterContent, req: reqParams } = params;
|
|
10573
|
+
if (!id || !name || !hostingLocationKey) {
|
|
10574
|
+
throw new Error("Id, Name and hostingLocationKey are required.");
|
|
10545
10575
|
}
|
|
10546
|
-
|
|
10547
|
-
|
|
10548
|
-
for (let i = 0; i < terrains.length; i++) {
|
|
10549
|
-
const terrainSource = terrains[i];
|
|
10550
|
-
checkSourceToTemplate(items, terrainSource, addIfMissing);
|
|
10576
|
+
if (!api) {
|
|
10577
|
+
api = ENVIRONMENT.Api().GetBruceApi();
|
|
10551
10578
|
}
|
|
10552
|
-
|
|
10553
|
-
|
|
10579
|
+
if (!starterContent) {
|
|
10580
|
+
starterContent = EStarterContent.None;
|
|
10581
|
+
}
|
|
10582
|
+
const reqData = {
|
|
10583
|
+
"Name": name,
|
|
10584
|
+
"HostingLocation.Key": hostingLocationKey,
|
|
10585
|
+
"StarterContent": starterContent
|
|
10586
|
+
};
|
|
10587
|
+
const res = yield api.POST(`clientAccount/${id}`, reqData, Api.PrepReqParams(reqParams));
|
|
10588
|
+
const resData = {
|
|
10589
|
+
account: res
|
|
10554
10590
|
};
|
|
10591
|
+
api.Cache.Remove(GetListCacheKey(api.GetSessionId()));
|
|
10592
|
+
return resData;
|
|
10555
10593
|
});
|
|
10556
10594
|
}
|
|
10557
|
-
|
|
10558
|
-
})(ProjectViewLegacyTile || (ProjectViewLegacyTile = {}));
|
|
10559
|
-
|
|
10560
|
-
/**
|
|
10561
|
-
* A tile is an imagery or terrain tileset definition.
|
|
10562
|
-
*/
|
|
10563
|
-
var ProjectViewTile;
|
|
10564
|
-
(function (ProjectViewTile) {
|
|
10565
|
-
/**
|
|
10566
|
-
* Available imagery defaults.
|
|
10567
|
-
*/
|
|
10568
|
-
let EDefaultImagery;
|
|
10569
|
-
(function (EDefaultImagery) {
|
|
10570
|
-
EDefaultImagery["BingMapsAerial"] = "bingmapsaerial";
|
|
10571
|
-
EDefaultImagery["BingMapsAerialWithLabels"] = "bingmapsaerialwithlabels";
|
|
10572
|
-
EDefaultImagery["BingMapsRoads"] = "bingmapsroads";
|
|
10573
|
-
EDefaultImagery["MapboxSatellite"] = "mapboxsatellite";
|
|
10574
|
-
EDefaultImagery["MapBoxStreets"] = "mapboxstreets";
|
|
10575
|
-
EDefaultImagery["MapBoxStreetsClassic"] = "mapboxstreetsclassic";
|
|
10576
|
-
EDefaultImagery["EsriWorldImagery"] = "esriworldimagery";
|
|
10577
|
-
EDefaultImagery["EsriWorldStreetMap"] = "esriworldstreetmap";
|
|
10578
|
-
EDefaultImagery["EsriNationalGeographic"] = "esrinationalgeographic";
|
|
10579
|
-
EDefaultImagery["OpenStreetMap"] = "openstreetmap";
|
|
10580
|
-
EDefaultImagery["LINZ"] = "linz";
|
|
10581
|
-
EDefaultImagery["StamenWaterColor"] = "stamenwatercolor";
|
|
10582
|
-
EDefaultImagery["StamenToner"] = "stamentoner";
|
|
10583
|
-
EDefaultImagery["Grid"] = "grid";
|
|
10584
|
-
EDefaultImagery["ThunderforestCycle"] = "thunderforestcycle";
|
|
10585
|
-
EDefaultImagery["ThunderforestTransport"] = "thunderforesttransport";
|
|
10586
|
-
EDefaultImagery["ThunderforestLandscape"] = "thunderforestlandscape";
|
|
10587
|
-
})(EDefaultImagery = ProjectViewTile.EDefaultImagery || (ProjectViewTile.EDefaultImagery = {}));
|
|
10595
|
+
Account.Create = Create;
|
|
10588
10596
|
/**
|
|
10589
|
-
*
|
|
10590
|
-
*
|
|
10597
|
+
* Returns cache identifier for an account by ID.
|
|
10598
|
+
* Example: {
|
|
10599
|
+
* const api: BruceApi.Api = ...;
|
|
10600
|
+
* const key = GetCacheKey(1);
|
|
10601
|
+
* api.Cache.Remove(key);
|
|
10602
|
+
* }
|
|
10603
|
+
* @param accountId
|
|
10604
|
+
* @param appSettingsId
|
|
10605
|
+
* @returns
|
|
10591
10606
|
*/
|
|
10592
|
-
|
|
10593
|
-
{
|
|
10594
|
-
|
|
10595
|
-
name: "Bing Maps Aerial",
|
|
10596
|
-
iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/bingAerial.png"
|
|
10597
|
-
},
|
|
10598
|
-
{
|
|
10599
|
-
id: EDefaultImagery.BingMapsAerialWithLabels,
|
|
10600
|
-
name: "Bing Maps Aerial with Labels",
|
|
10601
|
-
iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/bingAerialLabels.png"
|
|
10602
|
-
},
|
|
10603
|
-
{
|
|
10604
|
-
id: EDefaultImagery.BingMapsRoads,
|
|
10605
|
-
name: "Bing Maps Roads",
|
|
10606
|
-
iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/bingRoads.png"
|
|
10607
|
-
},
|
|
10608
|
-
{
|
|
10609
|
-
id: EDefaultImagery.MapboxSatellite,
|
|
10610
|
-
name: "Mapbox Satellite",
|
|
10611
|
-
iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/mapboxSatellite.png"
|
|
10612
|
-
},
|
|
10613
|
-
{
|
|
10614
|
-
id: EDefaultImagery.MapBoxStreets,
|
|
10615
|
-
name: "Mapbox Streets",
|
|
10616
|
-
iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/mapboxTerrain.png"
|
|
10617
|
-
},
|
|
10618
|
-
{
|
|
10619
|
-
id: EDefaultImagery.MapBoxStreetsClassic,
|
|
10620
|
-
name: "Mapbox Streets Classic",
|
|
10621
|
-
iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/mapboxStreets.png"
|
|
10622
|
-
},
|
|
10623
|
-
{
|
|
10624
|
-
id: EDefaultImagery.EsriWorldImagery,
|
|
10625
|
-
name: "Esri World Imagery",
|
|
10626
|
-
iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/esriWorldImagery.png"
|
|
10627
|
-
},
|
|
10628
|
-
{
|
|
10629
|
-
id: EDefaultImagery.EsriWorldStreetMap,
|
|
10630
|
-
name: "Esri World Street Map",
|
|
10631
|
-
iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/esriWorldStreetMap.png"
|
|
10632
|
-
},
|
|
10633
|
-
{
|
|
10634
|
-
id: EDefaultImagery.EsriNationalGeographic,
|
|
10635
|
-
name: "Esri National Geographic",
|
|
10636
|
-
iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/esriNationalGeographic.png"
|
|
10637
|
-
},
|
|
10638
|
-
{
|
|
10639
|
-
id: EDefaultImagery.OpenStreetMap,
|
|
10640
|
-
name: "Open Street Map",
|
|
10641
|
-
iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/openStreetMap.png"
|
|
10642
|
-
},
|
|
10643
|
-
{
|
|
10644
|
-
id: EDefaultImagery.LINZ,
|
|
10645
|
-
name: "LINZ",
|
|
10646
|
-
iconUrl: "https://template.ui.nextspace.host/media/linz.jpg"
|
|
10647
|
-
},
|
|
10648
|
-
{
|
|
10649
|
-
id: EDefaultImagery.StamenWaterColor,
|
|
10650
|
-
name: "Stamen Water Color",
|
|
10651
|
-
iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/stamenWatercolor.png"
|
|
10652
|
-
},
|
|
10653
|
-
{
|
|
10654
|
-
id: EDefaultImagery.StamenToner,
|
|
10655
|
-
name: "Stamen Toner",
|
|
10656
|
-
iconUrl: "https://template.ui.nextspace.host/Default/media/Cesium/ImageryProviders/stamenToner.png"
|
|
10657
|
-
},
|
|
10658
|
-
{
|
|
10659
|
-
id: EDefaultImagery.ThunderforestCycle,
|
|
10660
|
-
name: "Thunderforest Cycle"
|
|
10661
|
-
},
|
|
10662
|
-
{
|
|
10663
|
-
id: EDefaultImagery.ThunderforestTransport,
|
|
10664
|
-
name: "Thunderforest Transport"
|
|
10665
|
-
},
|
|
10666
|
-
{
|
|
10667
|
-
id: EDefaultImagery.ThunderforestLandscape,
|
|
10668
|
-
name: "Thunderforest Landscape"
|
|
10669
|
-
},
|
|
10670
|
-
{
|
|
10671
|
-
id: EDefaultImagery.Grid,
|
|
10672
|
-
name: "Grid",
|
|
10673
|
-
iconUrl: "https://template.api.nextspace-uat.net/file/2885d8df-028b-4f5c-80b3-2634f7e7cf69.png"
|
|
10607
|
+
function GetCacheKey(accountId, appSettingsId) {
|
|
10608
|
+
if (appSettingsId) {
|
|
10609
|
+
return Api.ECacheKey.Account + Api.ECacheKey.Id + accountId + Api.ECacheKey + appSettingsId;
|
|
10674
10610
|
}
|
|
10675
|
-
|
|
10611
|
+
return Api.ECacheKey.Account + Api.ECacheKey.Id + accountId;
|
|
10612
|
+
}
|
|
10613
|
+
Account.GetCacheKey = GetCacheKey;
|
|
10676
10614
|
/**
|
|
10677
|
-
*
|
|
10615
|
+
* Returns cache identifier for a list of accounts by session ID.
|
|
10616
|
+
* Example: {
|
|
10617
|
+
* const api: BruceApi.Api = ...;
|
|
10618
|
+
* const key = GetListCacheKey(api.GetSessionId());
|
|
10619
|
+
* api.Cache.Remove(key);
|
|
10620
|
+
* }
|
|
10621
|
+
* @param ssid
|
|
10622
|
+
* @returns
|
|
10678
10623
|
*/
|
|
10679
|
-
|
|
10680
|
-
|
|
10681
|
-
|
|
10682
|
-
|
|
10683
|
-
EDefaultTerrain["LINZ"] = "linz";
|
|
10684
|
-
})(EDefaultTerrain = ProjectViewTile.EDefaultTerrain || (ProjectViewTile.EDefaultTerrain = {}));
|
|
10624
|
+
function GetListCacheKey(ssid) {
|
|
10625
|
+
return Api.ECacheKey.Account + Api.ECacheKey.Session + Api.ECacheKey.Id + ssid;
|
|
10626
|
+
}
|
|
10627
|
+
Account.GetListCacheKey = GetListCacheKey;
|
|
10685
10628
|
/**
|
|
10686
|
-
*
|
|
10687
|
-
*
|
|
10629
|
+
* Returns cache identifier for a list of database regions.
|
|
10630
|
+
* Example: {
|
|
10631
|
+
* const api: BruceApi.Api = ...;
|
|
10632
|
+
* const key = GetDbRegionListCacheKey();
|
|
10633
|
+
* api.Cache.Remove(key);
|
|
10634
|
+
* }
|
|
10635
|
+
* @returns
|
|
10688
10636
|
*/
|
|
10689
|
-
|
|
10690
|
-
|
|
10691
|
-
|
|
10692
|
-
|
|
10693
|
-
|
|
10694
|
-
},
|
|
10695
|
-
{
|
|
10696
|
-
id: EDefaultTerrain.LINZ,
|
|
10697
|
-
name: "LINZ",
|
|
10698
|
-
iconUrl: "https://template.ui.nextspace.host/media/linz.jpg"
|
|
10699
|
-
},
|
|
10700
|
-
{
|
|
10701
|
-
id: EDefaultTerrain.FlatTerrain,
|
|
10702
|
-
name: "Flat Terrain",
|
|
10703
|
-
}
|
|
10704
|
-
];
|
|
10705
|
-
})(ProjectViewTile || (ProjectViewTile = {}));
|
|
10706
|
-
|
|
10707
|
-
/**
|
|
10708
|
-
* Deprecated Project View record.
|
|
10709
|
-
* This was used in the legacy web Navigator.
|
|
10710
|
-
*/
|
|
10711
|
-
var ProjectViewLegacy;
|
|
10712
|
-
(function (ProjectViewLegacy) {
|
|
10713
|
-
ProjectViewLegacy.DATA_VERSION = 1;
|
|
10714
|
-
})(ProjectViewLegacy || (ProjectViewLegacy = {}));
|
|
10715
|
-
|
|
10716
|
-
/**
|
|
10717
|
-
* Deprecated Project View Bookmark record.
|
|
10718
|
-
* This was used in the legacy web Navigator.
|
|
10719
|
-
*/
|
|
10720
|
-
var ProjectViewLegacyBookmark;
|
|
10721
|
-
(function (ProjectViewLegacyBookmark) {
|
|
10722
|
-
ProjectViewLegacyBookmark.DATA_VERSION = 1;
|
|
10723
|
-
})(ProjectViewLegacyBookmark || (ProjectViewLegacyBookmark = {}));
|
|
10637
|
+
function GetDbRegionListCacheKey() {
|
|
10638
|
+
return Api.ECacheKey.DatabaseRegion;
|
|
10639
|
+
}
|
|
10640
|
+
Account.GetDbRegionListCacheKey = GetDbRegionListCacheKey;
|
|
10641
|
+
})(Account || (Account = {}));
|
|
10724
10642
|
|
|
10725
10643
|
/**
|
|
10726
|
-
*
|
|
10727
|
-
* A
|
|
10728
|
-
* This record is used to monitor its progress and completion state.
|
|
10644
|
+
* A hosting location is a record for a possible bruce-api server configuration.
|
|
10645
|
+
* A hosting location will have one or many database servers as well, this is an additional setting.
|
|
10729
10646
|
*/
|
|
10730
|
-
var
|
|
10731
|
-
(function (
|
|
10732
|
-
/**
|
|
10733
|
-
* Available pending action statuses.
|
|
10734
|
-
*/
|
|
10735
|
-
let EStatus;
|
|
10736
|
-
(function (EStatus) {
|
|
10737
|
-
EStatus["InProgress"] = "IN_PROGRESS";
|
|
10738
|
-
EStatus["Cancelled"] = "CANCELLED";
|
|
10739
|
-
EStatus["Complete"] = "COMPLETE";
|
|
10740
|
-
EStatus["Failed"] = "FAILED";
|
|
10741
|
-
})(EStatus = PendingAction.EStatus || (PendingAction.EStatus = {}));
|
|
10647
|
+
var HostingLocation;
|
|
10648
|
+
(function (HostingLocation) {
|
|
10742
10649
|
/**
|
|
10743
|
-
*
|
|
10650
|
+
* Returns a list of hosting locations.
|
|
10651
|
+
* @Warning: This will not return the Settings property.
|
|
10652
|
+
* @param params
|
|
10653
|
+
* @returns
|
|
10744
10654
|
*/
|
|
10745
|
-
|
|
10746
|
-
|
|
10747
|
-
|
|
10748
|
-
|
|
10749
|
-
|
|
10750
|
-
|
|
10751
|
-
|
|
10655
|
+
function GetList(params) {
|
|
10656
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
10657
|
+
let { api, req } = params;
|
|
10658
|
+
if (!api) {
|
|
10659
|
+
api = ENVIRONMENT.Api().GetGuardianApi();
|
|
10660
|
+
}
|
|
10661
|
+
const res = yield api.GET("hostinglocations", Api.PrepReqParams(req));
|
|
10662
|
+
return {
|
|
10663
|
+
locations: res.Items
|
|
10664
|
+
};
|
|
10665
|
+
});
|
|
10666
|
+
}
|
|
10667
|
+
HostingLocation.GetList = GetList;
|
|
10752
10668
|
/**
|
|
10753
|
-
* Returns a
|
|
10669
|
+
* Returns a hosting location record by ID.
|
|
10754
10670
|
* @param params
|
|
10755
10671
|
* @returns
|
|
10756
10672
|
*/
|
|
10757
|
-
function
|
|
10673
|
+
function GetById(params) {
|
|
10758
10674
|
return __awaiter(this, void 0, void 0, function* () {
|
|
10759
|
-
let {
|
|
10760
|
-
if (!
|
|
10761
|
-
throw ("
|
|
10675
|
+
let { id, api, req } = params;
|
|
10676
|
+
if (!id) {
|
|
10677
|
+
throw ("Invalid id");
|
|
10762
10678
|
}
|
|
10763
10679
|
if (!api) {
|
|
10764
|
-
api = ENVIRONMENT.Api().
|
|
10680
|
+
api = ENVIRONMENT.Api().GetGuardianApi();
|
|
10765
10681
|
}
|
|
10766
|
-
const
|
|
10682
|
+
const res = yield api.GET(`hostinglocation/id/${id}`, Api.PrepReqParams(req));
|
|
10767
10683
|
return {
|
|
10768
|
-
|
|
10684
|
+
location: res
|
|
10769
10685
|
};
|
|
10770
10686
|
});
|
|
10771
10687
|
}
|
|
10772
|
-
|
|
10688
|
+
HostingLocation.GetById = GetById;
|
|
10773
10689
|
/**
|
|
10774
|
-
* Returns a
|
|
10690
|
+
* Returns a hosting location record by key.
|
|
10775
10691
|
* @param params
|
|
10776
10692
|
* @returns
|
|
10777
10693
|
*/
|
|
10778
|
-
function
|
|
10694
|
+
function GetByKey(params) {
|
|
10779
10695
|
return __awaiter(this, void 0, void 0, function* () {
|
|
10780
|
-
let {
|
|
10696
|
+
let { key, api, req } = params;
|
|
10697
|
+
if (!key) {
|
|
10698
|
+
throw ("Invalid key");
|
|
10699
|
+
}
|
|
10781
10700
|
if (!api) {
|
|
10782
|
-
api = ENVIRONMENT.Api().
|
|
10701
|
+
api = ENVIRONMENT.Api().GetGuardianApi();
|
|
10783
10702
|
}
|
|
10784
|
-
const
|
|
10703
|
+
const res = yield api.GET(`hostinglocation/key/${key}`, Api.PrepReqParams(req));
|
|
10785
10704
|
return {
|
|
10786
|
-
|
|
10705
|
+
location: res
|
|
10787
10706
|
};
|
|
10788
10707
|
});
|
|
10789
10708
|
}
|
|
10790
|
-
|
|
10709
|
+
HostingLocation.GetByKey = GetByKey;
|
|
10791
10710
|
/**
|
|
10792
|
-
* Returns
|
|
10711
|
+
* Returns hostingLocationKey from given db url.
|
|
10712
|
+
* Some older accounts don't have this set, so we need to guess it.
|
|
10793
10713
|
* @param params
|
|
10794
10714
|
* @returns
|
|
10795
10715
|
*/
|
|
10796
|
-
function
|
|
10716
|
+
function GuessKey(params) {
|
|
10717
|
+
const { DBServer: databaseUrl } = params;
|
|
10718
|
+
if (databaseUrl.includes("hyperfarm-prod-instance-1")) {
|
|
10719
|
+
return "HYPERFARM";
|
|
10720
|
+
}
|
|
10721
|
+
if (databaseUrl.includes("prod-syd1.nextspace.host")) {
|
|
10722
|
+
return "AU-VULTR-FIRST";
|
|
10723
|
+
}
|
|
10724
|
+
else if (databaseUrl.includes("prod-nyc1.nextspace.host")) {
|
|
10725
|
+
return "US-VULTR-FIRST";
|
|
10726
|
+
}
|
|
10727
|
+
else if (databaseUrl.includes("prod-ams1.nextspace.host")) {
|
|
10728
|
+
return "EU-VULTR-FIRST";
|
|
10729
|
+
}
|
|
10730
|
+
else if (databaseUrl.includes("prod-sing1.nextspace.host")) {
|
|
10731
|
+
return "SE-VULTR-FIRST";
|
|
10732
|
+
}
|
|
10733
|
+
else if (databaseUrl.includes("dev-first")) {
|
|
10734
|
+
return "DEV-FIRST";
|
|
10735
|
+
}
|
|
10736
|
+
else if (databaseUrl.includes(".ap-southeast-1.")) {
|
|
10737
|
+
return "SE";
|
|
10738
|
+
}
|
|
10739
|
+
else if (databaseUrl.includes(".us-west-1.")) {
|
|
10740
|
+
return "US";
|
|
10741
|
+
}
|
|
10742
|
+
else if (databaseUrl.includes(".eu-west-3.")) {
|
|
10743
|
+
return "EU";
|
|
10744
|
+
}
|
|
10745
|
+
else if (databaseUrl.includes("bruce-prod-au")) {
|
|
10746
|
+
return "AU";
|
|
10747
|
+
}
|
|
10748
|
+
else if (databaseUrl.includes("bruce-dev")) {
|
|
10749
|
+
return "DEV";
|
|
10750
|
+
}
|
|
10751
|
+
return null;
|
|
10752
|
+
}
|
|
10753
|
+
HostingLocation.GuessKey = GuessKey;
|
|
10754
|
+
/**
|
|
10755
|
+
* Returns a hosting location key by account ID.
|
|
10756
|
+
* @param params
|
|
10757
|
+
* @returns
|
|
10758
|
+
*/
|
|
10759
|
+
function GetKeyByAccountId(params) {
|
|
10797
10760
|
return __awaiter(this, void 0, void 0, function* () {
|
|
10798
|
-
let {
|
|
10761
|
+
let { accountId, apiSettings, api, account, req } = params;
|
|
10762
|
+
if (!accountId && !apiSettings) {
|
|
10763
|
+
throw ("Invalid accountId or apiSettings");
|
|
10764
|
+
}
|
|
10799
10765
|
if (!api) {
|
|
10800
|
-
api = ENVIRONMENT.Api().
|
|
10766
|
+
api = ENVIRONMENT.Api().GetGuardianApi();
|
|
10801
10767
|
}
|
|
10802
|
-
|
|
10803
|
-
|
|
10768
|
+
// We'll prioritize account record if provided.
|
|
10769
|
+
if (accountId && !account) {
|
|
10770
|
+
account = (yield Account.Get({
|
|
10771
|
+
accountId,
|
|
10772
|
+
api,
|
|
10773
|
+
req
|
|
10774
|
+
})).account;
|
|
10804
10775
|
}
|
|
10805
|
-
if (
|
|
10806
|
-
|
|
10776
|
+
if (account === null || account === void 0 ? void 0 : account["HostingLocation.Key"]) {
|
|
10777
|
+
return {
|
|
10778
|
+
key: account["HostingLocation.Key"],
|
|
10779
|
+
isLegacy: false
|
|
10780
|
+
};
|
|
10807
10781
|
}
|
|
10808
|
-
|
|
10809
|
-
|
|
10782
|
+
// Fallback to settings JSON for older records.
|
|
10783
|
+
const settings = apiSettings ? apiSettings : (yield Account.GetAppSettings({
|
|
10784
|
+
api,
|
|
10785
|
+
accountId,
|
|
10786
|
+
appId: Account.EAppId.BruceApi
|
|
10787
|
+
})).settings;
|
|
10788
|
+
let hostingKey = settings["HostingLocation.Key"];
|
|
10789
|
+
let isLegacy = false;
|
|
10790
|
+
if (!hostingKey) {
|
|
10791
|
+
hostingKey = settings.DBLocation;
|
|
10792
|
+
isLegacy = true;
|
|
10810
10793
|
}
|
|
10811
|
-
|
|
10812
|
-
|
|
10813
|
-
|
|
10814
|
-
|
|
10815
|
-
|
|
10794
|
+
if (!hostingKey) {
|
|
10795
|
+
hostingKey = GuessKey({
|
|
10796
|
+
DBServer: settings.DBServer
|
|
10797
|
+
});
|
|
10798
|
+
isLegacy = true;
|
|
10816
10799
|
}
|
|
10817
|
-
const data = yield api.GET(`pendingAction/${actionId}/progressMessages` + args, Api.PrepReqParams(reqParams));
|
|
10818
10800
|
return {
|
|
10819
|
-
|
|
10801
|
+
key: hostingKey,
|
|
10802
|
+
isLegacy
|
|
10820
10803
|
};
|
|
10821
10804
|
});
|
|
10822
10805
|
}
|
|
10823
|
-
|
|
10806
|
+
HostingLocation.GetKeyByAccountId = GetKeyByAccountId;
|
|
10824
10807
|
/**
|
|
10825
|
-
*
|
|
10808
|
+
* Returns a hosting location record by account ID.
|
|
10826
10809
|
* @param params
|
|
10810
|
+
* @returns
|
|
10827
10811
|
*/
|
|
10828
|
-
function
|
|
10812
|
+
function GetByAccountId(params) {
|
|
10829
10813
|
return __awaiter(this, void 0, void 0, function* () {
|
|
10830
|
-
let {
|
|
10831
|
-
if (!actionId) {
|
|
10832
|
-
throw ("Action ID is required.");
|
|
10833
|
-
}
|
|
10814
|
+
let { accountId, apiSettings, api, req, account } = params;
|
|
10834
10815
|
if (!api) {
|
|
10835
|
-
api = ENVIRONMENT.Api().
|
|
10816
|
+
api = ENVIRONMENT.Api().GetGuardianApi();
|
|
10836
10817
|
}
|
|
10837
|
-
yield
|
|
10818
|
+
const data = yield GetKeyByAccountId({
|
|
10819
|
+
accountId,
|
|
10820
|
+
account,
|
|
10821
|
+
apiSettings,
|
|
10822
|
+
api,
|
|
10823
|
+
req
|
|
10824
|
+
});
|
|
10825
|
+
if (!(data === null || data === void 0 ? void 0 : data.key)) {
|
|
10826
|
+
return null;
|
|
10827
|
+
}
|
|
10828
|
+
const key = yield GetByKey({
|
|
10829
|
+
key: data.key,
|
|
10830
|
+
api,
|
|
10831
|
+
req
|
|
10832
|
+
});
|
|
10833
|
+
return key;
|
|
10838
10834
|
});
|
|
10839
10835
|
}
|
|
10840
|
-
|
|
10841
|
-
})(
|
|
10836
|
+
HostingLocation.GetByAccountId = GetByAccountId;
|
|
10837
|
+
})(HostingLocation || (HostingLocation = {}));
|
|
10842
10838
|
|
|
10843
10839
|
/**
|
|
10844
10840
|
* Permissions in Nextspace are arbitrary strings with meaning in specific contexts.
|
|
@@ -13350,7 +13346,12 @@ var Plugin;
|
|
|
13350
13346
|
cacheKey = 0;
|
|
13351
13347
|
}
|
|
13352
13348
|
return {
|
|
13353
|
-
indexFileUrl:
|
|
13349
|
+
indexFileUrl: api.ConstructUrl({
|
|
13350
|
+
url: `ui.plugin/${pluginId}/file/index.jsc`,
|
|
13351
|
+
urlParams: {
|
|
13352
|
+
"version": String(cacheKey)
|
|
13353
|
+
}
|
|
13354
|
+
})
|
|
13354
13355
|
};
|
|
13355
13356
|
}
|
|
13356
13357
|
Plugin.GetLoadUrl = GetLoadUrl;
|
|
@@ -13733,7 +13734,7 @@ var DataSource;
|
|
|
13733
13734
|
})(DataSource || (DataSource = {}));
|
|
13734
13735
|
|
|
13735
13736
|
// This is updated with the package.json version on build.
|
|
13736
|
-
const VERSION = "4.5.
|
|
13737
|
+
const VERSION = "4.5.9";
|
|
13737
13738
|
|
|
13738
13739
|
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, EntityHistoricData, EntityTableView, Comment, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, ProjectViewLegacy, ProjectViewLegacyBookmark, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, Account, AccountInvite, AccountFeatures, AccountLimits, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, ImportCad, ImportCsv, ImportJson, ImportKml, ImportedFile, Markup, Uploader, Plugin, ENVIRONMENT, DataSource };
|
|
13739
13740
|
//# sourceMappingURL=bruce-models.es5.js.map
|