bruce-models 0.4.6 → 0.4.8
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 +29 -1
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +29 -1
- 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/lib/entity/entity.js +1 -1
- package/dist/lib/entity/entity.js.map +1 -1
- package/dist/types/entity/entity-relation.d.ts +1 -0
- package/package.json +1 -1
package/dist/bruce-models.es5.js
CHANGED
|
@@ -1363,7 +1363,7 @@ var Entity;
|
|
|
1363
1363
|
// Attribute filter.
|
|
1364
1364
|
(!requestFilter ? "" : "&Filter=" + Api.Encode(JSON.stringify(requestFilter))) +
|
|
1365
1365
|
// Order by attribute + sort order.
|
|
1366
|
-
(!filter.orderBy ? "" : "&OrderBy=" +
|
|
1366
|
+
(!filter.orderBy ? "" : "&OrderBy=" + JSON.stringify(filter.orderBy)) +
|
|
1367
1367
|
(filter.sortOrder ? "&SortOrder=" + (filter.sortOrder == Api.ESortOrder.Asc ? "ASC" : "DESC") : "");
|
|
1368
1368
|
return [4 /*yield*/, api.GET(url, Api.PrepReqParams())];
|
|
1369
1369
|
case 1:
|
|
@@ -2677,6 +2677,34 @@ var EntityRelation;
|
|
|
2677
2677
|
return Api.ECacheKey.Relation + Api.ECacheKey.RelationType + Api.ECacheKey.Id + params.typeId + Api.ECacheKey.Id + params.oneWayOnly + Api.ECacheKey.Id + params.loadEntityData;
|
|
2678
2678
|
}
|
|
2679
2679
|
EntityRelation.GetListCacheKey = GetListCacheKey;
|
|
2680
|
+
function Create(api, data) {
|
|
2681
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2682
|
+
var reqData, url;
|
|
2683
|
+
return __generator(this, function (_a) {
|
|
2684
|
+
switch (_a.label) {
|
|
2685
|
+
case 0:
|
|
2686
|
+
if (!data["Principal.Entity.ID"] || !data["Related.Entity.ID"] || !data["Relation.Type.ID"]) {
|
|
2687
|
+
throw ("Principal Entity ID, Related Entity ID, and Relation Type ID are required.");
|
|
2688
|
+
}
|
|
2689
|
+
reqData = {
|
|
2690
|
+
"Related.Entity.ID": [data["Related.Entity.ID"]]
|
|
2691
|
+
};
|
|
2692
|
+
url = "entity/" + data["Principal.Entity.ID"] + "/relation/" + data["Relation.Type.ID"] + "/add";
|
|
2693
|
+
return [4 /*yield*/, api.POST(url, reqData, Api.PrepReqParams())];
|
|
2694
|
+
case 1:
|
|
2695
|
+
data = _a.sent();
|
|
2696
|
+
api.Cache.RemoveByStartsWith(Api.ECacheKey.Relation + Api.ECacheKey.Id + data["Principal.Entity.ID"]);
|
|
2697
|
+
api.Cache.RemoveByStartsWith(Api.ECacheKey.Relation + Api.ECacheKey.Id + data["Related.Entity.ID"]);
|
|
2698
|
+
api.Cache.RemoveByStartsWith(Api.ECacheKey.Relation + Api.ECacheKey.RelationType + Api.ECacheKey.Id + data["Relation.Type.ID"]);
|
|
2699
|
+
if (data["Data.Entity.ID"]) {
|
|
2700
|
+
api.Cache.RemoveByStartsWith(Api.ECacheKey.Relation + Api.ECacheKey.Entity + Api.ECacheKey.Id + data["Data.Entity.ID"]);
|
|
2701
|
+
}
|
|
2702
|
+
return [2 /*return*/, data];
|
|
2703
|
+
}
|
|
2704
|
+
});
|
|
2705
|
+
});
|
|
2706
|
+
}
|
|
2707
|
+
EntityRelation.Create = Create;
|
|
2680
2708
|
function Update(api, data) {
|
|
2681
2709
|
return __awaiter(this, void 0, void 0, function () {
|
|
2682
2710
|
var url;
|