bruce-models 3.5.5 → 3.5.7

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.
@@ -2947,14 +2947,14 @@
2947
2947
  if (!api) {
2948
2948
  api = exports.ENVIRONMENT.Api().GetBruceApi();
2949
2949
  }
2950
- const reqs = [];
2950
+ const crashRiskReqs = [];
2951
2951
  const reqIds = [];
2952
2952
  for (let i = 0; i < entityIds.length; i++) {
2953
2953
  const entityId = entityIds[i];
2954
2954
  const key = GetCacheKey({ entityId, expandRelations, expandLocation });
2955
2955
  const cache = api.GetCacheItem(key, reqParams);
2956
2956
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
2957
- reqs.push(cache.data);
2957
+ crashRiskReqs.push(cache.data);
2958
2958
  }
2959
2959
  else {
2960
2960
  reqIds.push(entityId);
@@ -2974,6 +2974,7 @@
2974
2974
  else if (expandLocation) {
2975
2975
  reqData["Expand"] = "location";
2976
2976
  }
2977
+ const reqs = [];
2977
2978
  if (reqIds.length > 0) {
2978
2979
  const req = api.POST("entities", reqData, exports.Api.PrepReqParams(reqParams));
2979
2980
  for (let i = 0; i < reqIds.length; i++) {
@@ -3000,8 +3001,22 @@
3000
3001
  reqs.push(prom);
3001
3002
  }
3002
3003
  }
3004
+ const entities = (yield Promise.all(reqs)).map(x => x === null || x === void 0 ? void 0 : x.entity).filter(x => !!x);
3005
+ // We'll try/catch the crash-risk ones and append the results.
3006
+ for (let i = 0; i < crashRiskReqs.length; i++) {
3007
+ const req = crashRiskReqs[i];
3008
+ try {
3009
+ const data = yield req;
3010
+ if (data === null || data === void 0 ? void 0 : data.entity) {
3011
+ entities.push(data.entity);
3012
+ }
3013
+ }
3014
+ catch (e) {
3015
+ // No showing error as we don't want to see it 2000 times.
3016
+ }
3017
+ }
3003
3018
  return {
3004
- entities: (yield Promise.all(reqs)).map(x => x === null || x === void 0 ? void 0 : x.entity).filter(x => !!x)
3019
+ entities: entities
3005
3020
  };
3006
3021
  });
3007
3022
  }
@@ -9635,10 +9650,13 @@
9635
9650
  */
9636
9651
  function Create(params) {
9637
9652
  return __awaiter(this, void 0, void 0, function* () {
9638
- let { api, accountId, login, userId, email, mobile, emailTemplateKey, groupIds, req } = params;
9653
+ let { api, accountId, login, userId, email, mobile, emailTemplateKey, groupIds, req, inviteMethod } = params;
9639
9654
  if (!api) {
9640
9655
  api = exports.ENVIRONMENT.Api().GetGuardianApi();
9641
9656
  }
9657
+ if (!(groupIds === null || groupIds === void 0 ? void 0 : groupIds.length)) {
9658
+ throw new Error("At least one User Group ID must be provided.");
9659
+ }
9642
9660
  const res = yield api.POST("invite/new", {
9643
9661
  accountId,
9644
9662
  login,
@@ -9646,7 +9664,8 @@
9646
9664
  mobile,
9647
9665
  userId,
9648
9666
  groupIds,
9649
- emailTemplateKey
9667
+ emailTemplateKey,
9668
+ inviteMethod
9650
9669
  }, exports.Api.PrepReqParams(req));
9651
9670
  return res;
9652
9671
  });
@@ -10615,7 +10634,7 @@
10615
10634
  })(exports.DataSource || (exports.DataSource = {}));
10616
10635
 
10617
10636
  // This is updated with the package.json version on build.
10618
- const VERSION = "3.5.5";
10637
+ const VERSION = "3.5.7";
10619
10638
 
10620
10639
  exports.VERSION = VERSION;
10621
10640
  exports.AbstractApi = AbstractApi;