bruce-models 0.4.5 → 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.
@@ -1543,8 +1543,16 @@
1543
1543
  value = BruceVariable.SwapValues(value, entity);
1544
1544
  return eval(value);
1545
1545
  }
1546
- catch (e) {
1547
- console.error(e);
1546
+ catch (exception) {
1547
+ var e = exception;
1548
+ var suppress = false;
1549
+ if (e && typeof e == "object") {
1550
+ var msg = e.message;
1551
+ suppress = !!msg && msg.includes("Unexpected end");
1552
+ }
1553
+ if (!suppress) {
1554
+ console.error(e);
1555
+ }
1548
1556
  }
1549
1557
  }
1550
1558
  return value;
@@ -2598,6 +2606,34 @@
2598
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;
2599
2607
  }
2600
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;
2601
2637
  function Update(api, data) {
2602
2638
  return __awaiter(this, void 0, void 0, function () {
2603
2639
  var url;