@rkmodules/rules 0.0.85 → 0.0.86

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/index.esm.js CHANGED
@@ -2007,6 +2007,9 @@ var Engine = /** @class */ (function () {
2007
2007
  console.warn("Invalid nodes for edge deletion");
2008
2008
  return newFn;
2009
2009
  }
2010
+ if (!fn) {
2011
+ throw new Error("Function ".concat(to === null || to === void 0 ? void 0 : to.name, " not found in index, which is unexpected as you are deleting an edge to it."));
2012
+ }
2010
2013
  if (to.inputs && to.inputs[toField] === "<".concat(fromNode, ".").concat(fromField, ">")) {
2011
2014
  // revert to default value if exists
2012
2015
  delete to.inputs[toField];
@@ -2035,8 +2038,12 @@ var Engine = /** @class */ (function () {
2035
2038
  id = uid$1();
2036
2039
  }
2037
2040
  // get inputs defaults
2041
+ var fn = this.fnIndex[nodeName];
2042
+ if (!fn) {
2043
+ throw new Error("Function ".concat(nodeName, " not found in index. Use engine.build() to add custom functions."));
2044
+ }
2038
2045
  var inputs = {};
2039
- Object.entries(this.fnIndex[nodeName].inputs || {}).forEach(function (_a) {
2046
+ Object.entries(fn.inputs || {}).forEach(function (_a) {
2040
2047
  var _b = __read(_a, 2), key = _b[0], def = _b[1];
2041
2048
  var normDef = normalizeVarDef(def);
2042
2049
  if (normDef.default !== undefined) {
@@ -2045,7 +2052,7 @@ var Engine = /** @class */ (function () {
2045
2052
  });
2046
2053
  // get params defaults
2047
2054
  var params = {};
2048
- Object.entries(this.fnIndex[nodeName].params || {}).forEach(function (_a) {
2055
+ Object.entries(fn.params || {}).forEach(function (_a) {
2049
2056
  var _b = __read(_a, 2), key = _b[0], def = _b[1];
2050
2057
  var normDef = normalizeVarDef(def);
2051
2058
  if (normDef.default !== undefined) {