bruce-models 2.2.9 → 2.3.1
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 +210 -201
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +205 -196
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/api/bruce-api.js +29 -40
- package/dist/lib/api/bruce-api.js.map +1 -1
- package/dist/lib/server/hosting-location.js +24 -5
- package/dist/lib/server/hosting-location.js.map +1 -1
- package/dist/types/account/account-settings.d.ts +0 -3
- package/dist/types/server/hosting-location.d.ts +9 -0
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -727,158 +727,6 @@
|
|
|
727
727
|
}
|
|
728
728
|
}
|
|
729
729
|
|
|
730
|
-
const ACCOUNT_EXCLUSIONS = ["hyperportal", "hypeportal", "bviewer"];
|
|
731
|
-
(function (Account) {
|
|
732
|
-
function GetCacheKey(accountId, appSettingsId) {
|
|
733
|
-
if (appSettingsId) {
|
|
734
|
-
return exports.Api.ECacheKey.Account + exports.Api.ECacheKey.Id + accountId + exports.Api.ECacheKey + appSettingsId;
|
|
735
|
-
}
|
|
736
|
-
return exports.Api.ECacheKey.Account + exports.Api.ECacheKey.Id + accountId;
|
|
737
|
-
}
|
|
738
|
-
Account.GetCacheKey = GetCacheKey;
|
|
739
|
-
function GetListCacheKey(ssid) {
|
|
740
|
-
return exports.Api.ECacheKey.Account + exports.Api.ECacheKey.Session + exports.Api.ECacheKey.Id + ssid;
|
|
741
|
-
}
|
|
742
|
-
Account.GetListCacheKey = GetListCacheKey;
|
|
743
|
-
function GetDbRegionListCacheKey() {
|
|
744
|
-
return exports.Api.ECacheKey.DatabaseRegion;
|
|
745
|
-
}
|
|
746
|
-
Account.GetDbRegionListCacheKey = GetDbRegionListCacheKey;
|
|
747
|
-
let EAppId;
|
|
748
|
-
(function (EAppId) {
|
|
749
|
-
EAppId["BruceApi"] = "BruceAPI";
|
|
750
|
-
EAppId["Navigator"] = "Navigator";
|
|
751
|
-
})(EAppId = Account.EAppId || (Account.EAppId = {}));
|
|
752
|
-
let EStarterContent;
|
|
753
|
-
(function (EStarterContent) {
|
|
754
|
-
EStarterContent["Default"] = "default";
|
|
755
|
-
EStarterContent["None"] = "none";
|
|
756
|
-
})(EStarterContent = Account.EStarterContent || (Account.EStarterContent = {}));
|
|
757
|
-
function Get(params) {
|
|
758
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
759
|
-
const { api, accountId: id, req: reqParams } = params;
|
|
760
|
-
const cacheData = yield api.GetCacheItem(GetCacheKey(id), reqParams);
|
|
761
|
-
if (cacheData) {
|
|
762
|
-
return cacheData;
|
|
763
|
-
}
|
|
764
|
-
const req = yield api.GET(`account/${id}`, reqParams);
|
|
765
|
-
const resData = {
|
|
766
|
-
account: req
|
|
767
|
-
};
|
|
768
|
-
yield api.SetCacheItem({
|
|
769
|
-
key: GetCacheKey(id),
|
|
770
|
-
value: resData,
|
|
771
|
-
req: reqParams
|
|
772
|
-
});
|
|
773
|
-
return resData;
|
|
774
|
-
});
|
|
775
|
-
}
|
|
776
|
-
Account.Get = Get;
|
|
777
|
-
function GetRelatedList(params) {
|
|
778
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
779
|
-
const { api, req: reqParams } = params;
|
|
780
|
-
const cacheData = yield api.GetCacheItem(GetListCacheKey(api.GetSessionId()), reqParams);
|
|
781
|
-
if (cacheData) {
|
|
782
|
-
return cacheData;
|
|
783
|
-
}
|
|
784
|
-
const req = api.GET("user/relatedClientAccounts", reqParams);
|
|
785
|
-
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
786
|
-
try {
|
|
787
|
-
const data = yield req;
|
|
788
|
-
const items = data.Items.filter((x) => !ACCOUNT_EXCLUSIONS.includes(x.ID));
|
|
789
|
-
res({
|
|
790
|
-
accounts: items
|
|
791
|
-
});
|
|
792
|
-
}
|
|
793
|
-
catch (e) {
|
|
794
|
-
rej(e);
|
|
795
|
-
}
|
|
796
|
-
}));
|
|
797
|
-
yield api.SetCacheItem({
|
|
798
|
-
key: GetListCacheKey(api.GetSessionId()),
|
|
799
|
-
value: prom,
|
|
800
|
-
req: reqParams
|
|
801
|
-
});
|
|
802
|
-
return prom;
|
|
803
|
-
});
|
|
804
|
-
}
|
|
805
|
-
Account.GetRelatedList = GetRelatedList;
|
|
806
|
-
function GetAppSettings(params) {
|
|
807
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
808
|
-
const { api, accountId: id, appId, req: reqParams } = params;
|
|
809
|
-
const cacheData = yield api.GetCacheItem(GetCacheKey(id, appId), reqParams);
|
|
810
|
-
if (cacheData) {
|
|
811
|
-
return cacheData;
|
|
812
|
-
}
|
|
813
|
-
const req = yield api.GET(`account/${id}?ApplicationID=${appId}`, reqParams);
|
|
814
|
-
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
815
|
-
var _a;
|
|
816
|
-
try {
|
|
817
|
-
const data = yield req;
|
|
818
|
-
const settings = (_a = data === null || data === void 0 ? void 0 : data["Application.Settings"]) !== null && _a !== void 0 ? _a : {};
|
|
819
|
-
res({
|
|
820
|
-
settings: settings
|
|
821
|
-
});
|
|
822
|
-
}
|
|
823
|
-
catch (e) {
|
|
824
|
-
rej(e);
|
|
825
|
-
}
|
|
826
|
-
}));
|
|
827
|
-
yield api.SetCacheItem({
|
|
828
|
-
key: GetCacheKey(id, appId),
|
|
829
|
-
value: prom,
|
|
830
|
-
req: reqParams
|
|
831
|
-
});
|
|
832
|
-
return prom;
|
|
833
|
-
});
|
|
834
|
-
}
|
|
835
|
-
Account.GetAppSettings = GetAppSettings;
|
|
836
|
-
/**
|
|
837
|
-
* WARNING: Do not update API settings without knowing what you're doing.
|
|
838
|
-
* @param params
|
|
839
|
-
* @returns
|
|
840
|
-
*/
|
|
841
|
-
function UpdateAppSettings(params) {
|
|
842
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
843
|
-
const { api, accountId: id, appId, settings: data, req: reqParams } = params;
|
|
844
|
-
const res = yield api.POST(`account/${id}/applicationSettings/${appId}`, data, reqParams);
|
|
845
|
-
yield api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.Account + exports.Api.ECacheKey.Id + id);
|
|
846
|
-
return {
|
|
847
|
-
settings: res
|
|
848
|
-
};
|
|
849
|
-
});
|
|
850
|
-
}
|
|
851
|
-
Account.UpdateAppSettings = UpdateAppSettings;
|
|
852
|
-
/**
|
|
853
|
-
* Creates a new Bruce account using given details.
|
|
854
|
-
* @param params
|
|
855
|
-
* @returns
|
|
856
|
-
*/
|
|
857
|
-
function Create(params) {
|
|
858
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
859
|
-
let { api, accountId: id, name, hostingLocationKey, starterContent, req: reqParams } = params;
|
|
860
|
-
if (!id || !name || !hostingLocationKey) {
|
|
861
|
-
throw new Error("Id, Name and hostingLocationKey are required.");
|
|
862
|
-
}
|
|
863
|
-
if (!starterContent) {
|
|
864
|
-
starterContent = EStarterContent.None;
|
|
865
|
-
}
|
|
866
|
-
const reqData = {
|
|
867
|
-
"Name": name,
|
|
868
|
-
"HostingLocation.Key": hostingLocationKey,
|
|
869
|
-
"StarterContent": starterContent
|
|
870
|
-
};
|
|
871
|
-
const res = yield api.POST(`clientAccount/${id}`, reqData, exports.Api.PrepReqParams(reqParams));
|
|
872
|
-
const resData = {
|
|
873
|
-
account: res
|
|
874
|
-
};
|
|
875
|
-
api.Cache.Remove(GetListCacheKey(api.GetSessionId()));
|
|
876
|
-
return resData;
|
|
877
|
-
});
|
|
878
|
-
}
|
|
879
|
-
Account.Create = Create;
|
|
880
|
-
})(exports.Account || (exports.Account = {}));
|
|
881
|
-
|
|
882
730
|
(function (MessageBroker) {
|
|
883
731
|
let EAction;
|
|
884
732
|
(function (EAction) {
|
|
@@ -1081,6 +929,158 @@
|
|
|
1081
929
|
GuardianApi.Api = Api$$1;
|
|
1082
930
|
})(exports.GuardianApi || (exports.GuardianApi = {}));
|
|
1083
931
|
|
|
932
|
+
const ACCOUNT_EXCLUSIONS = ["hyperportal", "hypeportal", "bviewer"];
|
|
933
|
+
(function (Account) {
|
|
934
|
+
function GetCacheKey(accountId, appSettingsId) {
|
|
935
|
+
if (appSettingsId) {
|
|
936
|
+
return exports.Api.ECacheKey.Account + exports.Api.ECacheKey.Id + accountId + exports.Api.ECacheKey + appSettingsId;
|
|
937
|
+
}
|
|
938
|
+
return exports.Api.ECacheKey.Account + exports.Api.ECacheKey.Id + accountId;
|
|
939
|
+
}
|
|
940
|
+
Account.GetCacheKey = GetCacheKey;
|
|
941
|
+
function GetListCacheKey(ssid) {
|
|
942
|
+
return exports.Api.ECacheKey.Account + exports.Api.ECacheKey.Session + exports.Api.ECacheKey.Id + ssid;
|
|
943
|
+
}
|
|
944
|
+
Account.GetListCacheKey = GetListCacheKey;
|
|
945
|
+
function GetDbRegionListCacheKey() {
|
|
946
|
+
return exports.Api.ECacheKey.DatabaseRegion;
|
|
947
|
+
}
|
|
948
|
+
Account.GetDbRegionListCacheKey = GetDbRegionListCacheKey;
|
|
949
|
+
let EAppId;
|
|
950
|
+
(function (EAppId) {
|
|
951
|
+
EAppId["BruceApi"] = "BruceAPI";
|
|
952
|
+
EAppId["Navigator"] = "Navigator";
|
|
953
|
+
})(EAppId = Account.EAppId || (Account.EAppId = {}));
|
|
954
|
+
let EStarterContent;
|
|
955
|
+
(function (EStarterContent) {
|
|
956
|
+
EStarterContent["Default"] = "default";
|
|
957
|
+
EStarterContent["None"] = "none";
|
|
958
|
+
})(EStarterContent = Account.EStarterContent || (Account.EStarterContent = {}));
|
|
959
|
+
function Get(params) {
|
|
960
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
961
|
+
const { api, accountId: id, req: reqParams } = params;
|
|
962
|
+
const cacheData = yield api.GetCacheItem(GetCacheKey(id), reqParams);
|
|
963
|
+
if (cacheData) {
|
|
964
|
+
return cacheData;
|
|
965
|
+
}
|
|
966
|
+
const req = yield api.GET(`account/${id}`, reqParams);
|
|
967
|
+
const resData = {
|
|
968
|
+
account: req
|
|
969
|
+
};
|
|
970
|
+
yield api.SetCacheItem({
|
|
971
|
+
key: GetCacheKey(id),
|
|
972
|
+
value: resData,
|
|
973
|
+
req: reqParams
|
|
974
|
+
});
|
|
975
|
+
return resData;
|
|
976
|
+
});
|
|
977
|
+
}
|
|
978
|
+
Account.Get = Get;
|
|
979
|
+
function GetRelatedList(params) {
|
|
980
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
981
|
+
const { api, req: reqParams } = params;
|
|
982
|
+
const cacheData = yield api.GetCacheItem(GetListCacheKey(api.GetSessionId()), reqParams);
|
|
983
|
+
if (cacheData) {
|
|
984
|
+
return cacheData;
|
|
985
|
+
}
|
|
986
|
+
const req = api.GET("user/relatedClientAccounts", reqParams);
|
|
987
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
988
|
+
try {
|
|
989
|
+
const data = yield req;
|
|
990
|
+
const items = data.Items.filter((x) => !ACCOUNT_EXCLUSIONS.includes(x.ID));
|
|
991
|
+
res({
|
|
992
|
+
accounts: items
|
|
993
|
+
});
|
|
994
|
+
}
|
|
995
|
+
catch (e) {
|
|
996
|
+
rej(e);
|
|
997
|
+
}
|
|
998
|
+
}));
|
|
999
|
+
yield api.SetCacheItem({
|
|
1000
|
+
key: GetListCacheKey(api.GetSessionId()),
|
|
1001
|
+
value: prom,
|
|
1002
|
+
req: reqParams
|
|
1003
|
+
});
|
|
1004
|
+
return prom;
|
|
1005
|
+
});
|
|
1006
|
+
}
|
|
1007
|
+
Account.GetRelatedList = GetRelatedList;
|
|
1008
|
+
function GetAppSettings(params) {
|
|
1009
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1010
|
+
const { api, accountId: id, appId, req: reqParams } = params;
|
|
1011
|
+
const cacheData = yield api.GetCacheItem(GetCacheKey(id, appId), reqParams);
|
|
1012
|
+
if (cacheData) {
|
|
1013
|
+
return cacheData;
|
|
1014
|
+
}
|
|
1015
|
+
const req = yield api.GET(`account/${id}?ApplicationID=${appId}`, reqParams);
|
|
1016
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
1017
|
+
var _a;
|
|
1018
|
+
try {
|
|
1019
|
+
const data = yield req;
|
|
1020
|
+
const settings = (_a = data === null || data === void 0 ? void 0 : data["Application.Settings"]) !== null && _a !== void 0 ? _a : {};
|
|
1021
|
+
res({
|
|
1022
|
+
settings: settings
|
|
1023
|
+
});
|
|
1024
|
+
}
|
|
1025
|
+
catch (e) {
|
|
1026
|
+
rej(e);
|
|
1027
|
+
}
|
|
1028
|
+
}));
|
|
1029
|
+
yield api.SetCacheItem({
|
|
1030
|
+
key: GetCacheKey(id, appId),
|
|
1031
|
+
value: prom,
|
|
1032
|
+
req: reqParams
|
|
1033
|
+
});
|
|
1034
|
+
return prom;
|
|
1035
|
+
});
|
|
1036
|
+
}
|
|
1037
|
+
Account.GetAppSettings = GetAppSettings;
|
|
1038
|
+
/**
|
|
1039
|
+
* WARNING: Do not update API settings without knowing what you're doing.
|
|
1040
|
+
* @param params
|
|
1041
|
+
* @returns
|
|
1042
|
+
*/
|
|
1043
|
+
function UpdateAppSettings(params) {
|
|
1044
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1045
|
+
const { api, accountId: id, appId, settings: data, req: reqParams } = params;
|
|
1046
|
+
const res = yield api.POST(`account/${id}/applicationSettings/${appId}`, data, reqParams);
|
|
1047
|
+
yield api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.Account + exports.Api.ECacheKey.Id + id);
|
|
1048
|
+
return {
|
|
1049
|
+
settings: res
|
|
1050
|
+
};
|
|
1051
|
+
});
|
|
1052
|
+
}
|
|
1053
|
+
Account.UpdateAppSettings = UpdateAppSettings;
|
|
1054
|
+
/**
|
|
1055
|
+
* Creates a new Bruce account using given details.
|
|
1056
|
+
* @param params
|
|
1057
|
+
* @returns
|
|
1058
|
+
*/
|
|
1059
|
+
function Create(params) {
|
|
1060
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1061
|
+
let { api, accountId: id, name, hostingLocationKey, starterContent, req: reqParams } = params;
|
|
1062
|
+
if (!id || !name || !hostingLocationKey) {
|
|
1063
|
+
throw new Error("Id, Name and hostingLocationKey are required.");
|
|
1064
|
+
}
|
|
1065
|
+
if (!starterContent) {
|
|
1066
|
+
starterContent = EStarterContent.None;
|
|
1067
|
+
}
|
|
1068
|
+
const reqData = {
|
|
1069
|
+
"Name": name,
|
|
1070
|
+
"HostingLocation.Key": hostingLocationKey,
|
|
1071
|
+
"StarterContent": starterContent
|
|
1072
|
+
};
|
|
1073
|
+
const res = yield api.POST(`clientAccount/${id}`, reqData, exports.Api.PrepReqParams(reqParams));
|
|
1074
|
+
const resData = {
|
|
1075
|
+
account: res
|
|
1076
|
+
};
|
|
1077
|
+
api.Cache.Remove(GetListCacheKey(api.GetSessionId()));
|
|
1078
|
+
return resData;
|
|
1079
|
+
});
|
|
1080
|
+
}
|
|
1081
|
+
Account.Create = Create;
|
|
1082
|
+
})(exports.Account || (exports.Account = {}));
|
|
1083
|
+
|
|
1084
1084
|
(function (HostingLocation) {
|
|
1085
1085
|
/**
|
|
1086
1086
|
* @Warning: This will not return the Settings property.
|
|
@@ -1166,7 +1166,7 @@
|
|
|
1166
1166
|
return null;
|
|
1167
1167
|
}
|
|
1168
1168
|
HostingLocation.GuessKey = GuessKey;
|
|
1169
|
-
function
|
|
1169
|
+
function GetKeyByAccountId(params) {
|
|
1170
1170
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1171
1171
|
const { accountId, apiSettings, api, req } = params;
|
|
1172
1172
|
if (!accountId && !apiSettings) {
|
|
@@ -1178,23 +1178,42 @@
|
|
|
1178
1178
|
appId: exports.Account.EAppId.BruceApi
|
|
1179
1179
|
})).settings;
|
|
1180
1180
|
let hostingKey = settings["HostingLocation.Key"];
|
|
1181
|
+
let isLegacy = false;
|
|
1181
1182
|
if (!hostingKey) {
|
|
1182
1183
|
hostingKey = settings.DBLocation;
|
|
1184
|
+
isLegacy = true;
|
|
1183
1185
|
}
|
|
1184
1186
|
if (!hostingKey) {
|
|
1185
1187
|
hostingKey = GuessKey({
|
|
1186
1188
|
DBServer: settings.DBServer
|
|
1187
1189
|
});
|
|
1190
|
+
isLegacy = true;
|
|
1188
1191
|
}
|
|
1189
|
-
|
|
1192
|
+
return {
|
|
1193
|
+
key: hostingKey,
|
|
1194
|
+
isLegacy
|
|
1195
|
+
};
|
|
1196
|
+
});
|
|
1197
|
+
}
|
|
1198
|
+
HostingLocation.GetKeyByAccountId = GetKeyByAccountId;
|
|
1199
|
+
function GetByAccountId(params) {
|
|
1200
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1201
|
+
const { accountId, apiSettings, api, req } = params;
|
|
1202
|
+
const data = yield GetKeyByAccountId({
|
|
1203
|
+
accountId,
|
|
1204
|
+
apiSettings,
|
|
1205
|
+
api,
|
|
1206
|
+
req
|
|
1207
|
+
});
|
|
1208
|
+
if (!(data === null || data === void 0 ? void 0 : data.key)) {
|
|
1190
1209
|
return null;
|
|
1191
1210
|
}
|
|
1192
|
-
const
|
|
1193
|
-
key:
|
|
1211
|
+
const key = yield GetByKey({
|
|
1212
|
+
key: data.key,
|
|
1194
1213
|
api,
|
|
1195
1214
|
req
|
|
1196
1215
|
});
|
|
1197
|
-
return
|
|
1216
|
+
return key;
|
|
1198
1217
|
});
|
|
1199
1218
|
}
|
|
1200
1219
|
HostingLocation.GetByAccountId = GetByAccountId;
|
|
@@ -1243,70 +1262,60 @@
|
|
|
1243
1262
|
* @returns
|
|
1244
1263
|
*/
|
|
1245
1264
|
init(guardian, loadConfig) {
|
|
1246
|
-
var _a, _b
|
|
1265
|
+
var _a, _b;
|
|
1247
1266
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1248
1267
|
if (!this.accountId) {
|
|
1249
1268
|
throw ("accountId is required.");
|
|
1250
1269
|
}
|
|
1251
|
-
// Set using a stable default.
|
|
1252
|
-
const prefix = `https://${this.accountId}.api.nextspace`;
|
|
1253
|
-
let url;
|
|
1254
1270
|
const env = this.env.toUpperCase();
|
|
1271
|
+
let domain = "nextspace.host";
|
|
1255
1272
|
switch (env) {
|
|
1256
1273
|
case exports.Api.EEnv.DEV:
|
|
1257
|
-
|
|
1274
|
+
domain = "nextspace-dev.net";
|
|
1258
1275
|
break;
|
|
1259
1276
|
case exports.Api.EEnv.STG:
|
|
1260
|
-
|
|
1277
|
+
domain = "nextspace-stg.net";
|
|
1261
1278
|
break;
|
|
1262
1279
|
case exports.Api.EEnv.UAT:
|
|
1263
|
-
|
|
1280
|
+
domain = "nextspace-uat.net";
|
|
1264
1281
|
break;
|
|
1265
1282
|
case exports.Api.EEnv.PROD:
|
|
1266
|
-
|
|
1283
|
+
domain = "nextspace.host";
|
|
1267
1284
|
break;
|
|
1268
1285
|
default:
|
|
1269
|
-
|
|
1286
|
+
console.error("Specified Environment is not valid. SuppliedEnv=" + env);
|
|
1270
1287
|
}
|
|
1271
|
-
|
|
1288
|
+
// Set using a stable default.
|
|
1289
|
+
this.baseUrl = `https://${this.accountId}.api.${domain}/`;
|
|
1272
1290
|
if (guardian && loadConfig) {
|
|
1273
|
-
// Attempt to load an account specific base url.
|
|
1274
|
-
// This could be one with a region specific endpoint.
|
|
1275
1291
|
try {
|
|
1276
|
-
const settings = (yield exports.Account.GetAppSettings({
|
|
1277
|
-
api: guardian,
|
|
1278
|
-
accountId: this.accountId,
|
|
1279
|
-
appId: exports.Account.EAppId.BruceApi
|
|
1280
|
-
})).settings;
|
|
1281
|
-
if (this.loadCancelled) {
|
|
1282
|
-
console.warn("BruceApi: Loading was cancelled due to SetBaseUrl being called, not setting regional base url.");
|
|
1283
|
-
return;
|
|
1284
|
-
}
|
|
1285
|
-
let endpoint = (_a = settings.BruceAPIURL) === null || _a === void 0 ? void 0 : _a[env];
|
|
1286
|
-
if (typeof endpoint == "string") {
|
|
1287
|
-
if (!endpoint.endsWith("/")) {
|
|
1288
|
-
endpoint += "/";
|
|
1289
|
-
}
|
|
1290
|
-
this.baseUrl = endpoint;
|
|
1291
|
-
}
|
|
1292
1292
|
const host = yield exports.HostingLocation.GetByAccountId({
|
|
1293
1293
|
accountId: this.accountId,
|
|
1294
|
-
apiSettings: settings,
|
|
1295
1294
|
api: guardian
|
|
1296
1295
|
});
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", this.accountId);
|
|
1296
|
+
if (host === null || host === void 0 ? void 0 : host.location) {
|
|
1297
|
+
// Attempt to load regional base url.
|
|
1298
|
+
if (host.location.BruceAPIURL) {
|
|
1299
|
+
const regionalUrl = host.location.BruceAPIURL.replace("<ACCOUNT>", this.accountId).replace("<DOMAIN>", domain);
|
|
1300
|
+
if (regionalUrl && regionalUrl.length > 1) {
|
|
1301
|
+
this.baseUrl = regionalUrl;
|
|
1304
1302
|
}
|
|
1305
|
-
|
|
1306
|
-
|
|
1303
|
+
}
|
|
1304
|
+
// Attempt to load CDN settings.
|
|
1305
|
+
const settings = host.location.Settings;
|
|
1306
|
+
if (settings === null || settings === void 0 ? void 0 : settings.CDN) {
|
|
1307
|
+
this.EntityCdnUrl = (_a = settings.CDN.entityURL) === null || _a === void 0 ? void 0 : _a[env];
|
|
1308
|
+
// We need to fix our configs.
|
|
1309
|
+
if (this.EntityCdnUrl) {
|
|
1310
|
+
if (this.EntityCdnUrl.includes("entitiesListForCDN")) {
|
|
1311
|
+
this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", this.accountId);
|
|
1312
|
+
}
|
|
1313
|
+
else {
|
|
1314
|
+
this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", "entitiesListForCDN/" + this.accountId);
|
|
1315
|
+
}
|
|
1307
1316
|
}
|
|
1317
|
+
this.LegacyTilesetCdnUrl = (_b = settings.CDN.legacyTilesetURL) === null || _b === void 0 ? void 0 : _b[env];
|
|
1308
1318
|
}
|
|
1309
|
-
this.LegacyTilesetCdnUrl = (_d = hostSettings.CDN.legacyTilesetURL) === null || _d === void 0 ? void 0 : _d[env];
|
|
1310
1319
|
}
|
|
1311
1320
|
}
|
|
1312
1321
|
catch (e) {
|