bruce-models 2.2.9 → 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.
@@ -1166,7 +1166,7 @@
1166
1166
  return null;
1167
1167
  }
1168
1168
  HostingLocation.GuessKey = GuessKey;
1169
- function GetByAccountId(params) {
1169
+ function GetKeyByAccountId(params) {
1170
1170
  return __awaiter(this, void 0, void 0, function* () {
1171
1171
  const { accountId, apiSettings, api, req } = params;
1172
1172
  if (!accountId && !apiSettings) {
@@ -1178,23 +1178,42 @@
1178
1178
  appId: exports.Account.EAppId.BruceApi
1179
1179
  })).settings;
1180
1180
  let hostingKey = settings["HostingLocation.Key"];
1181
+ let isLegacy = false;
1181
1182
  if (!hostingKey) {
1182
1183
  hostingKey = settings.DBLocation;
1184
+ isLegacy = true;
1183
1185
  }
1184
1186
  if (!hostingKey) {
1185
1187
  hostingKey = GuessKey({
1186
1188
  DBServer: settings.DBServer
1187
1189
  });
1190
+ isLegacy = true;
1188
1191
  }
1189
- if (!hostingKey) {
1192
+ return {
1193
+ key: hostingKey,
1194
+ isLegacy
1195
+ };
1196
+ });
1197
+ }
1198
+ HostingLocation.GetKeyByAccountId = GetKeyByAccountId;
1199
+ function GetByAccountId(params) {
1200
+ return __awaiter(this, void 0, void 0, function* () {
1201
+ const { accountId, apiSettings, api, req } = params;
1202
+ const data = yield GetKeyByAccountId({
1203
+ accountId,
1204
+ apiSettings,
1205
+ api,
1206
+ req
1207
+ });
1208
+ if (!(data === null || data === void 0 ? void 0 : data.key)) {
1190
1209
  return null;
1191
1210
  }
1192
- const data = yield GetByKey({
1193
- key: hostingKey,
1211
+ const key = yield GetByKey({
1212
+ key: data.key,
1194
1213
  api,
1195
1214
  req
1196
1215
  });
1197
- return data;
1216
+ return key;
1198
1217
  });
1199
1218
  }
1200
1219
  HostingLocation.GetByAccountId = GetByAccountId;