bruce-models 2.0.1 → 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.
@@ -916,6 +916,44 @@ var Account;
916
916
  });
917
917
  }
918
918
  Account.GetDbRegions = GetDbRegions;
919
+ function GuessDbLocation(params) {
920
+ const { DBServer: databaseUrl } = params;
921
+ if (databaseUrl.includes("hyperfarm-prod-instance-1")) {
922
+ return "HYPERFARM";
923
+ }
924
+ if (databaseUrl.includes("prod-syd1.nextspace.host")) {
925
+ return "AU-VULTR-FIRST";
926
+ }
927
+ else if (databaseUrl.includes("prod-nyc1.nextspace.host")) {
928
+ return "US-VULTR-FIRST";
929
+ }
930
+ else if (databaseUrl.includes("prod-ams1.nextspace.host")) {
931
+ return "EU-VULTR-FIRST";
932
+ }
933
+ else if (databaseUrl.includes("prod-sing1.nextspace.host")) {
934
+ return "SE-VULTR-FIRST";
935
+ }
936
+ else if (databaseUrl.includes("dev-first")) {
937
+ return "DEV-FIRST";
938
+ }
939
+ else if (databaseUrl.includes(".ap-southeast-1.")) {
940
+ return "SE";
941
+ }
942
+ else if (databaseUrl.includes(".us-west-1.")) {
943
+ return "US";
944
+ }
945
+ else if (databaseUrl.includes(".eu-west-3.")) {
946
+ return "EU";
947
+ }
948
+ else if (databaseUrl.includes("bruce-prod-au")) {
949
+ return "AU";
950
+ }
951
+ else if (databaseUrl.includes("bruce-dev")) {
952
+ return "DEV";
953
+ }
954
+ return null;
955
+ }
956
+ Account.GuessDbLocation = GuessDbLocation;
919
957
  })(Account || (Account = {}));
920
958
 
921
959
  /**
@@ -1218,8 +1256,14 @@ var BruceApi;
1218
1256
  }
1219
1257
  this.baseUrl = endpoint;
1220
1258
  }
1221
- if (settings.DBLocation) {
1222
- const dbLocation = settings.DBLocation.trim();
1259
+ let dbLocation = settings.DBLocation;
1260
+ if (!dbLocation) {
1261
+ dbLocation = Account.GuessDbLocation({
1262
+ DBServer: settings.DBServer,
1263
+ });
1264
+ }
1265
+ if (dbLocation) {
1266
+ dbLocation = dbLocation.trim();
1223
1267
  const api = new BruceApi.Api({
1224
1268
  accountId: this.accountId,
1225
1269
  cam: cam,