@rkmodules/rules 0.0.155 → 0.0.157

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.
@@ -1865,12 +1865,69 @@ var coalesce = {
1865
1865
  }); },
1866
1866
  };
1867
1867
 
1868
+ var destructureList = {
1869
+ name: "destructureList",
1870
+ label: "Destructure List",
1871
+ description: "Separates an list into a part with the specified values and the rest",
1872
+ inputs: {
1873
+ list: "any",
1874
+ items: { type: "any" },
1875
+ },
1876
+ params: {
1877
+ // all: { type: "boolean", default: true, label: "all fields" },
1878
+ },
1879
+ outputs: {
1880
+ included: "any",
1881
+ excluded: "any",
1882
+ matches: "boolean",
1883
+ },
1884
+ impl: function (_a, params_1) { return __awaiter(void 0, [_a, params_1], void 0, function (_b, params) {
1885
+ var split;
1886
+ var _c = _b.list, list = _c === void 0 ? {} : _c, _d = _b.items, items = _d === void 0 ? {} : _d;
1887
+ return __generator(this, function (_e) {
1888
+ split = nAryOnTreeBranch([list, items], function (_a) {
1889
+ var _b = __read(_a, 2), _c = _b[0], list = _c === void 0 ? [] : _c, _d = _b[1], items = _d === void 0 ? [] : _d;
1890
+ var included = [];
1891
+ var excluded = [];
1892
+ var matches = [];
1893
+ console.log("Destructuring list", list, items);
1894
+ list.forEach(function (value) {
1895
+ var m = items.includes(value);
1896
+ matches.push(m);
1897
+ if (m) {
1898
+ included.push(value);
1899
+ }
1900
+ else {
1901
+ excluded.push(value);
1902
+ }
1903
+ });
1904
+ return [[included, excluded, matches]];
1905
+ });
1906
+ return [2 /*return*/, {
1907
+ included: mapTree(split, function (_a) {
1908
+ var _b = __read(_a, 1), l = _b[0];
1909
+ return l;
1910
+ }),
1911
+ excluded: mapTree(split, function (_a) {
1912
+ var _b = __read(_a, 2); _b[0]; var e = _b[1];
1913
+ return e;
1914
+ }),
1915
+ matches: mapTree(split, function (_a) {
1916
+ var _b = __read(_a, 3); _b[0]; _b[1]; var m = _b[2];
1917
+ return m;
1918
+ }),
1919
+ }];
1920
+ });
1921
+ }); },
1922
+ };
1923
+
1868
1924
  var _a$6;
1869
1925
  var primitives$6 = (_a$6 = {},
1870
1926
  _a$6[listInput.name] = listInput,
1871
1927
  _a$6[listItem.name] = listItem,
1872
1928
  _a$6[listLength.name] = listLength,
1873
1929
  _a$6[filterList.name] = filterList,
1930
+ _a$6[destructureList.name] = destructureList,
1874
1931
  _a$6[relativeItem.name] = relativeItem,
1875
1932
  _a$6[relativeItems.name] = relativeItems,
1876
1933
  _a$6[concat.name] = concat,
@@ -2657,8 +2714,8 @@ var destructureObject = {
2657
2714
  all: { type: "boolean", default: true, label: "all fields" },
2658
2715
  },
2659
2716
  outputs: {
2660
- object: "any",
2661
- exclusion: "any",
2717
+ included: "any",
2718
+ excluded: "any",
2662
2719
  },
2663
2720
  impl: function (_a, params_1) { return __awaiter(void 0, [_a, params_1], void 0, function (_b, params) {
2664
2721
  var split;
@@ -2671,27 +2728,27 @@ var destructureObject = {
2671
2728
  }
2672
2729
  split = nAryOnTree([object, fields], function (_a) {
2673
2730
  var _b = __read(_a, 2), obj = _b[0], _c = _b[1], flds = _c === void 0 ? [] : _c;
2674
- var newObj = {};
2675
- var exclusion = {};
2731
+ var included = {};
2732
+ var excluded = {};
2676
2733
  if (typeof obj !== "object" || obj === null)
2677
2734
  return DISCARD;
2678
2735
  Object.entries(obj).forEach(function (_a) {
2679
2736
  var _b = __read(_a, 2), key = _b[0], value = _b[1];
2680
2737
  if (flds.includes(key)) {
2681
- newObj[key] = value;
2738
+ included[key] = value;
2682
2739
  }
2683
2740
  else {
2684
- exclusion[key] = value;
2741
+ excluded[key] = value;
2685
2742
  }
2686
2743
  });
2687
- return [[newObj, exclusion]];
2744
+ return [[included, excluded]];
2688
2745
  }, true);
2689
2746
  return [2 /*return*/, {
2690
- object: mapTree(split, function (_a) {
2691
- var _b = __read(_a, 2), o = _b[0]; _b[1];
2692
- return o;
2747
+ included: mapTree(split, function (_a) {
2748
+ var _b = __read(_a, 2), i = _b[0]; _b[1];
2749
+ return i;
2693
2750
  }),
2694
- exclusion: mapTree(split, function (_a) {
2751
+ excluded: mapTree(split, function (_a) {
2695
2752
  var _b = __read(_a, 2); _b[0]; var e = _b[1];
2696
2753
  return e;
2697
2754
  }),
@@ -8590,4 +8647,4 @@ function DDContext(_a) {
8590
8647
  }
8591
8648
 
8592
8649
  export { DDContext, DISCARD, Engine, Flow, FlowContext, GenericNode, Input, InputBoolean, InputNumber, InputSelect, InputString, InputText, Lib, Output, Param, binaryOnTree, binaryOnTreeBranch, broadCast, deRefEdgeHandle, ensureBranch, expandTree, forEachBranch, forEachItem, getBranch, getBranches, getItem, getPaths, getPositions, getReferences, getValue$1 as getValue, getVariable, graftTree, hasReference, interpolate, isEmpty, isEmptyTree, isReference, isSingleTon, isTree, mapTree, mapTreeBranch, nAryOnTree, nAryOnTreeBranch, normalizePaths, normalizeVarDef, parseReference, primitives, pushItem, safeName, sameShape, simplifyTree$1 as simplifyTree, toArray, topSort, treeSize, treeStats, trimTree, uid$1 as uid, useControls, useDraggableNode, useEngine, useFlow, useFunction, useGraphedFunction, usePositions, usePrompts, useUpdatePositions, useVariable, variableStore };
8593
- //# sourceMappingURL=index.esm.js.map
8650
+ //# sourceMappingURL=index.esm.mjs.map