bruce-models 0.4.9 → 0.5.1

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.
@@ -1231,6 +1231,30 @@ var Entity;
1231
1231
  });
1232
1232
  }
1233
1233
  Entity.Delete = Delete;
1234
+ function DeleteList(api, entityIds) {
1235
+ return __awaiter(this, void 0, void 0, function () {
1236
+ var i, entityId;
1237
+ return __generator(this, function (_a) {
1238
+ switch (_a.label) {
1239
+ case 0:
1240
+ if (!(entityIds === null || entityIds === void 0 ? void 0 : entityIds.length)) {
1241
+ throw ("Entity IDs are required.");
1242
+ }
1243
+ return [4 /*yield*/, api.POST("deleteEntities", {
1244
+ Items: entityIds
1245
+ }, Api.PrepReqParams())];
1246
+ case 1:
1247
+ _a.sent();
1248
+ for (i = 0; i < entityIds.length; i++) {
1249
+ entityId = entityIds[i];
1250
+ api.Cache.Remove(GetCacheKey(entityId));
1251
+ }
1252
+ return [2 /*return*/];
1253
+ }
1254
+ });
1255
+ });
1256
+ }
1257
+ Entity.DeleteList = DeleteList;
1234
1258
  function Update(api, data, override) {
1235
1259
  var _a, _b;
1236
1260
  return __awaiter(this, void 0, void 0, function () {
@@ -2673,8 +2697,12 @@ var EntityRelation;
2673
2697
  return Api.ECacheKey.Relation + Api.ECacheKey.Entity + Api.ECacheKey.Id + entityId;
2674
2698
  }
2675
2699
  EntityRelation.GetEntityCacheKey = GetEntityCacheKey;
2676
- function GetListCacheKey(params) {
2677
- return Api.ECacheKey.Relation + Api.ECacheKey.RelationType + Api.ECacheKey.Id + params.typeId + Api.ECacheKey.Id + params.oneWayOnly + Api.ECacheKey.Id + params.loadEntityData;
2700
+ function GetListCacheKey(entityId, params) {
2701
+ return Api.ECacheKey.Relation + Api.ECacheKey.RelationType +
2702
+ Api.ECacheKey.Id + params.typeId +
2703
+ Api.ECacheKey.Id + params.oneWayOnly +
2704
+ Api.ECacheKey.Id + params.loadEntityData +
2705
+ Api.ECacheKey.Entity + Api.ECacheKey.Id + entityId;
2678
2706
  }
2679
2707
  EntityRelation.GetListCacheKey = GetListCacheKey;
2680
2708
  function Create(api, data) {
@@ -2739,7 +2767,7 @@ var EntityRelation;
2739
2767
  throw ("Entity ID is required.");
2740
2768
  }
2741
2769
  params = __assign({ typeId: "", oneWayOnly: false, loadEntityData: false }, params);
2742
- cacheData = api.Cache.Get(GetListCacheKey(params));
2770
+ cacheData = api.Cache.Get(GetListCacheKey(entityId, params));
2743
2771
  if (cacheData) {
2744
2772
  return [2 /*return*/, cacheData];
2745
2773
  }
@@ -2767,7 +2795,7 @@ var EntityRelation;
2767
2795
  }
2768
2796
  });
2769
2797
  }); });
2770
- api.Cache.Set(GetListCacheKey(params), req);
2798
+ api.Cache.Set(GetListCacheKey(entityId, params), req);
2771
2799
  return [2 /*return*/, req];
2772
2800
  });
2773
2801
  });
@@ -5351,10 +5379,16 @@ var UserGroup;
5351
5379
  var User;
5352
5380
  (function (User) {
5353
5381
  function GetCacheKey(userId, accountId) {
5382
+ if (!accountId) {
5383
+ accountId = "";
5384
+ }
5354
5385
  return Api.ECacheKey.User + Api.ECacheKey.Id + userId + Api.ECacheKey.Id + accountId;
5355
5386
  }
5356
5387
  User.GetCacheKey = GetCacheKey;
5357
5388
  function GetEmailCacheKey(email, accountId) {
5389
+ if (!accountId) {
5390
+ accountId = "";
5391
+ }
5358
5392
  return Api.ECacheKey.User + Api.ECacheKey.UserEmail + email + Api.ECacheKey.Id + accountId;
5359
5393
  }
5360
5394
  User.GetEmailCacheKey = GetEmailCacheKey;