bruce-models 2.2.8 → 2.3.0

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.
@@ -1188,7 +1188,7 @@ var HostingLocation;
1188
1188
  return null;
1189
1189
  }
1190
1190
  HostingLocation.GuessKey = GuessKey;
1191
- function GetByAccountId(params) {
1191
+ function GetKeyByAccountId(params) {
1192
1192
  return __awaiter(this, void 0, void 0, function* () {
1193
1193
  const { accountId, apiSettings, api, req } = params;
1194
1194
  if (!accountId && !apiSettings) {
@@ -1200,23 +1200,42 @@ var HostingLocation;
1200
1200
  appId: Account.EAppId.BruceApi
1201
1201
  })).settings;
1202
1202
  let hostingKey = settings["HostingLocation.Key"];
1203
+ let isLegacy = false;
1203
1204
  if (!hostingKey) {
1204
- hostingKey = settings.DBServer;
1205
+ hostingKey = settings.DBLocation;
1206
+ isLegacy = true;
1205
1207
  }
1206
1208
  if (!hostingKey) {
1207
1209
  hostingKey = GuessKey({
1208
1210
  DBServer: settings.DBServer
1209
1211
  });
1212
+ isLegacy = true;
1210
1213
  }
1211
- if (!hostingKey) {
1214
+ return {
1215
+ key: hostingKey,
1216
+ isLegacy
1217
+ };
1218
+ });
1219
+ }
1220
+ HostingLocation.GetKeyByAccountId = GetKeyByAccountId;
1221
+ function GetByAccountId(params) {
1222
+ return __awaiter(this, void 0, void 0, function* () {
1223
+ const { accountId, apiSettings, api, req } = params;
1224
+ const data = yield GetKeyByAccountId({
1225
+ accountId,
1226
+ apiSettings,
1227
+ api,
1228
+ req
1229
+ });
1230
+ if (!(data === null || data === void 0 ? void 0 : data.key)) {
1212
1231
  return null;
1213
1232
  }
1214
- const data = yield GetByKey({
1215
- key: hostingKey,
1233
+ const key = yield GetByKey({
1234
+ key: data.key,
1216
1235
  api,
1217
1236
  req
1218
1237
  });
1219
- return data;
1238
+ return key;
1220
1239
  });
1221
1240
  }
1222
1241
  HostingLocation.GetByAccountId = GetByAccountId;