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.es5.js
CHANGED
|
@@ -1088,15 +1088,18 @@ var BruceApi;
|
|
|
1088
1088
|
ssidHeader: "x-sessionid"
|
|
1089
1089
|
});
|
|
1090
1090
|
this.loadCancelled = false;
|
|
1091
|
-
let { accountId, env, cam, loadRegionalBaseUrl } = params;
|
|
1091
|
+
let { accountId, env, cam, loadRegionalBaseUrl, loadConfig } = params;
|
|
1092
1092
|
this.accountId = accountId;
|
|
1093
1093
|
this.env = env !== null && env !== void 0 ? env : Api.EEnv.PROD;
|
|
1094
|
-
if (loadRegionalBaseUrl
|
|
1094
|
+
if (loadRegionalBaseUrl) {
|
|
1095
|
+
loadConfig = true;
|
|
1096
|
+
}
|
|
1097
|
+
if (!cam && loadConfig) {
|
|
1095
1098
|
cam = new CamApi.Api({
|
|
1096
1099
|
env: this.env
|
|
1097
1100
|
});
|
|
1098
1101
|
}
|
|
1099
|
-
this.loadProm = this.init(cam,
|
|
1102
|
+
this.loadProm = this.init(cam, loadConfig);
|
|
1100
1103
|
}
|
|
1101
1104
|
get MessageBroker() {
|
|
1102
1105
|
return this.messageBroker;
|
|
@@ -1109,11 +1112,11 @@ var BruceApi;
|
|
|
1109
1112
|
/**
|
|
1110
1113
|
* Loads regional base url and sets up message broker.
|
|
1111
1114
|
* @param cam Required for loading regional base url.
|
|
1112
|
-
* @param
|
|
1115
|
+
* @param loadConfig
|
|
1113
1116
|
* @returns
|
|
1114
1117
|
*/
|
|
1115
|
-
init(cam,
|
|
1116
|
-
var _a;
|
|
1118
|
+
init(cam, loadConfig) {
|
|
1119
|
+
var _a, _b, _c;
|
|
1117
1120
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1118
1121
|
if (!this.accountId) {
|
|
1119
1122
|
throw ("accountId is required.");
|
|
@@ -1139,32 +1142,47 @@ var BruceApi;
|
|
|
1139
1142
|
throw ("Specified Environment is not valid. SuppliedEnv=" + env);
|
|
1140
1143
|
}
|
|
1141
1144
|
this.baseUrl = url;
|
|
1142
|
-
if (cam) {
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
if (
|
|
1158
|
-
|
|
1159
|
-
endpoint += "/";
|
|
1160
|
-
}
|
|
1161
|
-
this.baseUrl = endpoint;
|
|
1145
|
+
if (cam && loadConfig) {
|
|
1146
|
+
// Attempt to load an account specific base url.
|
|
1147
|
+
// This could be one with a region specific endpoint.
|
|
1148
|
+
try {
|
|
1149
|
+
const settings = (yield Account.GetAppSettings({
|
|
1150
|
+
api: cam,
|
|
1151
|
+
accountId: this.accountId,
|
|
1152
|
+
appId: Account.EAppId.BruceApi
|
|
1153
|
+
})).settings;
|
|
1154
|
+
if (this.loadCancelled) {
|
|
1155
|
+
console.warn("BruceApi: Loading was cancelled due to SetBaseUrl being called, not setting regional base url.");
|
|
1156
|
+
return;
|
|
1157
|
+
}
|
|
1158
|
+
let endpoint = (_a = settings.BruceAPIURL) === null || _a === void 0 ? void 0 : _a[env];
|
|
1159
|
+
if (typeof endpoint == "string") {
|
|
1160
|
+
if (!endpoint.endsWith("/")) {
|
|
1161
|
+
endpoint += "/";
|
|
1162
1162
|
}
|
|
1163
|
+
this.baseUrl = endpoint;
|
|
1163
1164
|
}
|
|
1164
|
-
|
|
1165
|
-
|
|
1165
|
+
const api = new BruceApi.Api({
|
|
1166
|
+
accountId: this.accountId,
|
|
1167
|
+
cam: cam,
|
|
1168
|
+
env: this.env,
|
|
1169
|
+
// Must be false.
|
|
1170
|
+
// Else we get stuck in nested init loop.
|
|
1171
|
+
loadConfig: false
|
|
1172
|
+
});
|
|
1173
|
+
// CDN urls.
|
|
1174
|
+
const region = (yield Account.GetDbRegions({
|
|
1175
|
+
api,
|
|
1176
|
+
key: settings.DBServer
|
|
1177
|
+
})).regions[0];
|
|
1178
|
+
if (region === null || region === void 0 ? void 0 : region.CDN) {
|
|
1179
|
+
this.EntityCdnUrl = (_b = region.CDN.entityURL) === null || _b === void 0 ? void 0 : _b[env];
|
|
1180
|
+
this.LegacyTilesetCdnUrl = (_c = region.CDN.legacyTilesetURL) === null || _c === void 0 ? void 0 : _c[env];
|
|
1166
1181
|
}
|
|
1167
1182
|
}
|
|
1183
|
+
catch (e) {
|
|
1184
|
+
console.error(e);
|
|
1185
|
+
}
|
|
1168
1186
|
}
|
|
1169
1187
|
try {
|
|
1170
1188
|
this.messageBroker = new MessageBroker.WebSocketBroker(this.baseUrl, this.env);
|