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.
- package/dist/bruce-models.es5.js +38 -4
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +38 -4
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/entity/entity-relation.js +8 -4
- package/dist/lib/entity/entity-relation.js.map +1 -1
- package/dist/lib/entity/entity.js +24 -0
- package/dist/lib/entity/entity.js.map +1 -1
- package/dist/lib/user/user.js +6 -0
- package/dist/lib/user/user.js.map +1 -1
- package/dist/types/entity/entity-relation.d.ts +1 -1
- package/dist/types/entity/entity.d.ts +1 -0
- package/dist/types/user/user.d.ts +2 -2
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -1209,6 +1209,30 @@
|
|
|
1209
1209
|
});
|
|
1210
1210
|
}
|
|
1211
1211
|
Entity.Delete = Delete;
|
|
1212
|
+
function DeleteList(api, entityIds) {
|
|
1213
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1214
|
+
var i, entityId;
|
|
1215
|
+
return __generator(this, function (_a) {
|
|
1216
|
+
switch (_a.label) {
|
|
1217
|
+
case 0:
|
|
1218
|
+
if (!(entityIds === null || entityIds === void 0 ? void 0 : entityIds.length)) {
|
|
1219
|
+
throw ("Entity IDs are required.");
|
|
1220
|
+
}
|
|
1221
|
+
return [4 /*yield*/, api.POST("deleteEntities", {
|
|
1222
|
+
Items: entityIds
|
|
1223
|
+
}, exports.Api.PrepReqParams())];
|
|
1224
|
+
case 1:
|
|
1225
|
+
_a.sent();
|
|
1226
|
+
for (i = 0; i < entityIds.length; i++) {
|
|
1227
|
+
entityId = entityIds[i];
|
|
1228
|
+
api.Cache.Remove(GetCacheKey(entityId));
|
|
1229
|
+
}
|
|
1230
|
+
return [2 /*return*/];
|
|
1231
|
+
}
|
|
1232
|
+
});
|
|
1233
|
+
});
|
|
1234
|
+
}
|
|
1235
|
+
Entity.DeleteList = DeleteList;
|
|
1212
1236
|
function Update(api, data, override) {
|
|
1213
1237
|
var _a, _b;
|
|
1214
1238
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -2602,8 +2626,12 @@
|
|
|
2602
2626
|
return exports.Api.ECacheKey.Relation + exports.Api.ECacheKey.Entity + exports.Api.ECacheKey.Id + entityId;
|
|
2603
2627
|
}
|
|
2604
2628
|
EntityRelation.GetEntityCacheKey = GetEntityCacheKey;
|
|
2605
|
-
function GetListCacheKey(params) {
|
|
2606
|
-
return exports.Api.ECacheKey.Relation + exports.Api.ECacheKey.RelationType +
|
|
2629
|
+
function GetListCacheKey(entityId, params) {
|
|
2630
|
+
return exports.Api.ECacheKey.Relation + exports.Api.ECacheKey.RelationType +
|
|
2631
|
+
exports.Api.ECacheKey.Id + params.typeId +
|
|
2632
|
+
exports.Api.ECacheKey.Id + params.oneWayOnly +
|
|
2633
|
+
exports.Api.ECacheKey.Id + params.loadEntityData +
|
|
2634
|
+
exports.Api.ECacheKey.Entity + exports.Api.ECacheKey.Id + entityId;
|
|
2607
2635
|
}
|
|
2608
2636
|
EntityRelation.GetListCacheKey = GetListCacheKey;
|
|
2609
2637
|
function Create(api, data) {
|
|
@@ -2668,7 +2696,7 @@
|
|
|
2668
2696
|
throw ("Entity ID is required.");
|
|
2669
2697
|
}
|
|
2670
2698
|
params = __assign({ typeId: "", oneWayOnly: false, loadEntityData: false }, params);
|
|
2671
|
-
cacheData = api.Cache.Get(GetListCacheKey(params));
|
|
2699
|
+
cacheData = api.Cache.Get(GetListCacheKey(entityId, params));
|
|
2672
2700
|
if (cacheData) {
|
|
2673
2701
|
return [2 /*return*/, cacheData];
|
|
2674
2702
|
}
|
|
@@ -2696,7 +2724,7 @@
|
|
|
2696
2724
|
}
|
|
2697
2725
|
});
|
|
2698
2726
|
}); });
|
|
2699
|
-
api.Cache.Set(GetListCacheKey(params), req);
|
|
2727
|
+
api.Cache.Set(GetListCacheKey(entityId, params), req);
|
|
2700
2728
|
return [2 /*return*/, req];
|
|
2701
2729
|
});
|
|
2702
2730
|
});
|
|
@@ -5156,10 +5184,16 @@
|
|
|
5156
5184
|
|
|
5157
5185
|
(function (User) {
|
|
5158
5186
|
function GetCacheKey(userId, accountId) {
|
|
5187
|
+
if (!accountId) {
|
|
5188
|
+
accountId = "";
|
|
5189
|
+
}
|
|
5159
5190
|
return exports.Api.ECacheKey.User + exports.Api.ECacheKey.Id + userId + exports.Api.ECacheKey.Id + accountId;
|
|
5160
5191
|
}
|
|
5161
5192
|
User.GetCacheKey = GetCacheKey;
|
|
5162
5193
|
function GetEmailCacheKey(email, accountId) {
|
|
5194
|
+
if (!accountId) {
|
|
5195
|
+
accountId = "";
|
|
5196
|
+
}
|
|
5163
5197
|
return exports.Api.ECacheKey.User + exports.Api.ECacheKey.UserEmail + email + exports.Api.ECacheKey.Id + accountId;
|
|
5164
5198
|
}
|
|
5165
5199
|
User.GetEmailCacheKey = GetEmailCacheKey;
|