bruce-models 1.7.8 → 1.7.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 +46 -28
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +46 -28
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/account/account.js.map +1 -1
- package/dist/lib/api/bruce-api.js +46 -28
- package/dist/lib/api/bruce-api.js.map +1 -1
- package/dist/types/account/account.d.ts +4 -2
- package/dist/types/api/bruce-api.d.ts +2 -1
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -1070,15 +1070,18 @@
|
|
|
1070
1070
|
ssidHeader: "x-sessionid"
|
|
1071
1071
|
});
|
|
1072
1072
|
this.loadCancelled = false;
|
|
1073
|
-
let { accountId, env, cam, loadRegionalBaseUrl } = params;
|
|
1073
|
+
let { accountId, env, cam, loadRegionalBaseUrl, loadConfig } = params;
|
|
1074
1074
|
this.accountId = accountId;
|
|
1075
1075
|
this.env = env !== null && env !== void 0 ? env : exports.Api.EEnv.PROD;
|
|
1076
|
-
if (loadRegionalBaseUrl
|
|
1076
|
+
if (loadRegionalBaseUrl) {
|
|
1077
|
+
loadConfig = true;
|
|
1078
|
+
}
|
|
1079
|
+
if (!cam && loadConfig) {
|
|
1077
1080
|
cam = new exports.CamApi.Api({
|
|
1078
1081
|
env: this.env
|
|
1079
1082
|
});
|
|
1080
1083
|
}
|
|
1081
|
-
this.loadProm = this.init(cam,
|
|
1084
|
+
this.loadProm = this.init(cam, loadConfig);
|
|
1082
1085
|
}
|
|
1083
1086
|
get MessageBroker() {
|
|
1084
1087
|
return this.messageBroker;
|
|
@@ -1091,11 +1094,11 @@
|
|
|
1091
1094
|
/**
|
|
1092
1095
|
* Loads regional base url and sets up message broker.
|
|
1093
1096
|
* @param cam Required for loading regional base url.
|
|
1094
|
-
* @param
|
|
1097
|
+
* @param loadConfig
|
|
1095
1098
|
* @returns
|
|
1096
1099
|
*/
|
|
1097
|
-
init(cam,
|
|
1098
|
-
var _a;
|
|
1100
|
+
init(cam, loadConfig) {
|
|
1101
|
+
var _a, _b, _c;
|
|
1099
1102
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1100
1103
|
if (!this.accountId) {
|
|
1101
1104
|
throw ("accountId is required.");
|
|
@@ -1121,32 +1124,47 @@
|
|
|
1121
1124
|
throw ("Specified Environment is not valid. SuppliedEnv=" + env);
|
|
1122
1125
|
}
|
|
1123
1126
|
this.baseUrl = url;
|
|
1124
|
-
if (cam) {
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
if (
|
|
1140
|
-
|
|
1141
|
-
endpoint += "/";
|
|
1142
|
-
}
|
|
1143
|
-
this.baseUrl = endpoint;
|
|
1127
|
+
if (cam && loadConfig) {
|
|
1128
|
+
// Attempt to load an account specific base url.
|
|
1129
|
+
// This could be one with a region specific endpoint.
|
|
1130
|
+
try {
|
|
1131
|
+
const settings = (yield exports.Account.GetAppSettings({
|
|
1132
|
+
api: cam,
|
|
1133
|
+
accountId: this.accountId,
|
|
1134
|
+
appId: exports.Account.EAppId.BruceApi
|
|
1135
|
+
})).settings;
|
|
1136
|
+
if (this.loadCancelled) {
|
|
1137
|
+
console.warn("BruceApi: Loading was cancelled due to SetBaseUrl being called, not setting regional base url.");
|
|
1138
|
+
return;
|
|
1139
|
+
}
|
|
1140
|
+
let endpoint = (_a = settings.BruceAPIURL) === null || _a === void 0 ? void 0 : _a[env];
|
|
1141
|
+
if (typeof endpoint == "string") {
|
|
1142
|
+
if (!endpoint.endsWith("/")) {
|
|
1143
|
+
endpoint += "/";
|
|
1144
1144
|
}
|
|
1145
|
+
this.baseUrl = endpoint;
|
|
1145
1146
|
}
|
|
1146
|
-
|
|
1147
|
-
|
|
1147
|
+
const api = new BruceApi.Api({
|
|
1148
|
+
accountId: this.accountId,
|
|
1149
|
+
cam: cam,
|
|
1150
|
+
env: this.env,
|
|
1151
|
+
// Must be false.
|
|
1152
|
+
// Else we get stuck in nested init loop.
|
|
1153
|
+
loadConfig: false
|
|
1154
|
+
});
|
|
1155
|
+
// CDN urls.
|
|
1156
|
+
const region = (yield exports.Account.GetDbRegions({
|
|
1157
|
+
api,
|
|
1158
|
+
key: settings.DBServer
|
|
1159
|
+
})).regions[0];
|
|
1160
|
+
if (region === null || region === void 0 ? void 0 : region.CDN) {
|
|
1161
|
+
this.EntityCdnUrl = (_b = region.CDN.entityURL) === null || _b === void 0 ? void 0 : _b[env];
|
|
1162
|
+
this.LegacyTilesetCdnUrl = (_c = region.CDN.legacyTilesetURL) === null || _c === void 0 ? void 0 : _c[env];
|
|
1148
1163
|
}
|
|
1149
1164
|
}
|
|
1165
|
+
catch (e) {
|
|
1166
|
+
console.error(e);
|
|
1167
|
+
}
|
|
1150
1168
|
}
|
|
1151
1169
|
try {
|
|
1152
1170
|
this.messageBroker = new exports.MessageBroker.WebSocketBroker(this.baseUrl, this.env);
|