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.
@@ -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,8 +1238,14 @@
1200
1238
  }
1201
1239
  this.baseUrl = endpoint;
1202
1240
  }
1203
- if (settings.DBLocation) {
1204
- const dbLocation = settings.DBLocation.trim();
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();
1205
1249
  const api = new BruceApi.Api({
1206
1250
  accountId: this.accountId,
1207
1251
  cam: cam,