bruce-models 0.4.6 → 0.4.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.
- package/dist/bruce-models.es5.js +28 -0
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +28 -0
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/entity/entity-relation.js +28 -0
- package/dist/lib/entity/entity-relation.js.map +1 -1
- package/dist/types/entity/entity-relation.d.ts +1 -0
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -2606,6 +2606,34 @@
|
|
|
2606
2606
|
return exports.Api.ECacheKey.Relation + exports.Api.ECacheKey.RelationType + exports.Api.ECacheKey.Id + params.typeId + exports.Api.ECacheKey.Id + params.oneWayOnly + exports.Api.ECacheKey.Id + params.loadEntityData;
|
|
2607
2607
|
}
|
|
2608
2608
|
EntityRelation.GetListCacheKey = GetListCacheKey;
|
|
2609
|
+
function Create(api, data) {
|
|
2610
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2611
|
+
var reqData, url;
|
|
2612
|
+
return __generator(this, function (_a) {
|
|
2613
|
+
switch (_a.label) {
|
|
2614
|
+
case 0:
|
|
2615
|
+
if (!data["Principal.Entity.ID"] || !data["Related.Entity.ID"] || !data["Relation.Type.ID"]) {
|
|
2616
|
+
throw ("Principal Entity ID, Related Entity ID, and Relation Type ID are required.");
|
|
2617
|
+
}
|
|
2618
|
+
reqData = {
|
|
2619
|
+
"Related.Entity.ID": [data["Related.Entity.ID"]]
|
|
2620
|
+
};
|
|
2621
|
+
url = "entity/" + data["Principal.Entity.ID"] + "/relation/" + data["Relation.Type.ID"] + "/add";
|
|
2622
|
+
return [4 /*yield*/, api.POST(url, reqData, exports.Api.PrepReqParams())];
|
|
2623
|
+
case 1:
|
|
2624
|
+
data = _a.sent();
|
|
2625
|
+
api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.Relation + exports.Api.ECacheKey.Id + data["Principal.Entity.ID"]);
|
|
2626
|
+
api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.Relation + exports.Api.ECacheKey.Id + data["Related.Entity.ID"]);
|
|
2627
|
+
api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.Relation + exports.Api.ECacheKey.RelationType + exports.Api.ECacheKey.Id + data["Relation.Type.ID"]);
|
|
2628
|
+
if (data["Data.Entity.ID"]) {
|
|
2629
|
+
api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.Relation + exports.Api.ECacheKey.Entity + exports.Api.ECacheKey.Id + data["Data.Entity.ID"]);
|
|
2630
|
+
}
|
|
2631
|
+
return [2 /*return*/, data];
|
|
2632
|
+
}
|
|
2633
|
+
});
|
|
2634
|
+
});
|
|
2635
|
+
}
|
|
2636
|
+
EntityRelation.Create = Create;
|
|
2609
2637
|
function Update(api, data) {
|
|
2610
2638
|
return __awaiter(this, void 0, void 0, function () {
|
|
2611
2639
|
var url;
|