bruce-models 2.0.0 → 2.0.2
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 +71 -23
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +71 -23
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/account/account.js +38 -0
- package/dist/lib/account/account.js.map +1 -1
- package/dist/lib/api/bruce-api.js +33 -23
- package/dist/lib/api/bruce-api.js.map +1 -1
- package/dist/lib/entity/entity-attribute.js.map +1 -1
- package/dist/types/account/account-settings.d.ts +1 -0
- package/dist/types/account/account.d.ts +3 -0
- package/dist/types/entity/entity-attribute.d.ts +0 -2
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -905,6 +905,44 @@
|
|
|
905
905
|
});
|
|
906
906
|
}
|
|
907
907
|
Account.GetDbRegions = GetDbRegions;
|
|
908
|
+
function GuessDbLocation(params) {
|
|
909
|
+
const { DBServer: databaseUrl } = params;
|
|
910
|
+
if (databaseUrl.includes("hyperfarm-prod-instance-1")) {
|
|
911
|
+
return "HYPERFARM";
|
|
912
|
+
}
|
|
913
|
+
if (databaseUrl.includes("prod-syd1.nextspace.host")) {
|
|
914
|
+
return "AU-VULTR-FIRST";
|
|
915
|
+
}
|
|
916
|
+
else if (databaseUrl.includes("prod-nyc1.nextspace.host")) {
|
|
917
|
+
return "US-VULTR-FIRST";
|
|
918
|
+
}
|
|
919
|
+
else if (databaseUrl.includes("prod-ams1.nextspace.host")) {
|
|
920
|
+
return "EU-VULTR-FIRST";
|
|
921
|
+
}
|
|
922
|
+
else if (databaseUrl.includes("prod-sing1.nextspace.host")) {
|
|
923
|
+
return "SE-VULTR-FIRST";
|
|
924
|
+
}
|
|
925
|
+
else if (databaseUrl.includes("dev-first")) {
|
|
926
|
+
return "DEV-FIRST";
|
|
927
|
+
}
|
|
928
|
+
else if (databaseUrl.includes(".ap-southeast-1.")) {
|
|
929
|
+
return "SE";
|
|
930
|
+
}
|
|
931
|
+
else if (databaseUrl.includes(".us-west-1.")) {
|
|
932
|
+
return "US";
|
|
933
|
+
}
|
|
934
|
+
else if (databaseUrl.includes(".eu-west-3.")) {
|
|
935
|
+
return "EU";
|
|
936
|
+
}
|
|
937
|
+
else if (databaseUrl.includes("bruce-prod-au")) {
|
|
938
|
+
return "AU";
|
|
939
|
+
}
|
|
940
|
+
else if (databaseUrl.includes("bruce-dev")) {
|
|
941
|
+
return "DEV";
|
|
942
|
+
}
|
|
943
|
+
return null;
|
|
944
|
+
}
|
|
945
|
+
Account.GuessDbLocation = GuessDbLocation;
|
|
908
946
|
})(exports.Account || (exports.Account = {}));
|
|
909
947
|
|
|
910
948
|
(function (CamApi) {
|
|
@@ -1200,31 +1238,41 @@
|
|
|
1200
1238
|
}
|
|
1201
1239
|
this.baseUrl = endpoint;
|
|
1202
1240
|
}
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1241
|
+
let dbLocation = settings.DBLocation;
|
|
1242
|
+
if (!dbLocation) {
|
|
1243
|
+
dbLocation = exports.Account.GuessDbLocation({
|
|
1244
|
+
DBServer: settings.DBServer,
|
|
1245
|
+
});
|
|
1246
|
+
}
|
|
1247
|
+
if (dbLocation) {
|
|
1248
|
+
dbLocation = dbLocation.trim();
|
|
1249
|
+
const api = new BruceApi.Api({
|
|
1250
|
+
accountId: this.accountId,
|
|
1251
|
+
cam: cam,
|
|
1252
|
+
env: this.env,
|
|
1253
|
+
// Must be false.
|
|
1254
|
+
// Else we get stuck in nested init loop.
|
|
1255
|
+
loadConfig: false
|
|
1256
|
+
});
|
|
1257
|
+
// CDN urls.
|
|
1258
|
+
const regions = (yield exports.Account.GetDbRegions({
|
|
1259
|
+
api,
|
|
1260
|
+
key: dbLocation
|
|
1261
|
+
})).regions;
|
|
1262
|
+
const region = regions.find(x => { var _a; return ((_a = x.key) === null || _a === void 0 ? void 0 : _a.trim()) == dbLocation; });
|
|
1263
|
+
if (region === null || region === void 0 ? void 0 : region.CDN) {
|
|
1264
|
+
this.EntityCdnUrl = (_b = region.CDN.entityURL) === null || _b === void 0 ? void 0 : _b[env];
|
|
1265
|
+
// We need to fix our configs.
|
|
1266
|
+
if (this.EntityCdnUrl) {
|
|
1267
|
+
if (this.EntityCdnUrl.includes("entitiesListForCDN")) {
|
|
1268
|
+
this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", this.accountId);
|
|
1269
|
+
}
|
|
1270
|
+
else {
|
|
1271
|
+
this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", "entitiesListForCDN/" + this.accountId);
|
|
1272
|
+
}
|
|
1225
1273
|
}
|
|
1274
|
+
this.LegacyTilesetCdnUrl = (_c = region.CDN.legacyTilesetURL) === null || _c === void 0 ? void 0 : _c[env];
|
|
1226
1275
|
}
|
|
1227
|
-
this.LegacyTilesetCdnUrl = (_c = region.CDN.legacyTilesetURL) === null || _c === void 0 ? void 0 : _c[env];
|
|
1228
1276
|
}
|
|
1229
1277
|
}
|
|
1230
1278
|
catch (e) {
|