@rkmodules/rules 0.0.118 → 0.0.119
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.cjs.js +100 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +100 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/lib/Primitives/Json/arrayToList.d.ts +2 -0
- package/dist/lib/Primitives/Json/explodeObject.d.ts +2 -0
- package/dist/lib/Primitives/List/uniqueItems.d.ts +2 -0
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -3,8 +3,8 @@ import React, { createContext, memo, useEffect, useLayoutEffect, useState, useCa
|
|
|
3
3
|
import { Handle, Position, useReactFlow, useConnection, getSimpleBezierPath, ReactFlowProvider, useOnSelectionChange, applyNodeChanges, applyEdgeChanges, ReactFlow, Background, BackgroundVariant, Controls } from '@xyflow/react';
|
|
4
4
|
import katex from 'katex';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
|
-
import rcin from 'rc-input-number';
|
|
7
6
|
import useInner from '@rkmodules/use-inner';
|
|
7
|
+
import rcin from 'rc-input-number';
|
|
8
8
|
import { useLongPress } from 'use-long-press';
|
|
9
9
|
import { create as create$1 } from 'zustand';
|
|
10
10
|
import { persist } from 'zustand/middleware';
|
|
@@ -1749,6 +1749,28 @@ var listInput = {
|
|
|
1749
1749
|
}); },
|
|
1750
1750
|
};
|
|
1751
1751
|
|
|
1752
|
+
var uniqueItems = {
|
|
1753
|
+
name: "uniqueItems",
|
|
1754
|
+
label: "Unique Items",
|
|
1755
|
+
description: "Removes duplicate items from a list",
|
|
1756
|
+
inputs: {
|
|
1757
|
+
items: "any",
|
|
1758
|
+
},
|
|
1759
|
+
outputs: {
|
|
1760
|
+
unique: "any",
|
|
1761
|
+
},
|
|
1762
|
+
impl: function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
1763
|
+
var _c = _b.items, items = _c === void 0 ? {} : _c;
|
|
1764
|
+
return __generator(this, function (_d) {
|
|
1765
|
+
return [2 /*return*/, {
|
|
1766
|
+
unique: mapTreeBranch(items, function (items) {
|
|
1767
|
+
return Array.from(new Set(items));
|
|
1768
|
+
}),
|
|
1769
|
+
}];
|
|
1770
|
+
});
|
|
1771
|
+
}); },
|
|
1772
|
+
};
|
|
1773
|
+
|
|
1752
1774
|
var _a$6;
|
|
1753
1775
|
var primitives$6 = (_a$6 = {},
|
|
1754
1776
|
_a$6[listInput.name] = listInput,
|
|
@@ -1758,6 +1780,7 @@ var primitives$6 = (_a$6 = {},
|
|
|
1758
1780
|
_a$6[relativeItem.name] = relativeItem,
|
|
1759
1781
|
_a$6[relativeItems.name] = relativeItems,
|
|
1760
1782
|
_a$6[concat.name] = concat,
|
|
1783
|
+
_a$6[uniqueItems.name] = uniqueItems,
|
|
1761
1784
|
_a$6);
|
|
1762
1785
|
|
|
1763
1786
|
var splitGroup = {
|
|
@@ -2312,12 +2335,87 @@ var objectEntries = {
|
|
|
2312
2335
|
}); },
|
|
2313
2336
|
};
|
|
2314
2337
|
|
|
2338
|
+
var arrayToList = {
|
|
2339
|
+
name: "arrayToList",
|
|
2340
|
+
label: "Array to List",
|
|
2341
|
+
description: "Separates array",
|
|
2342
|
+
inputs: {
|
|
2343
|
+
items: "any",
|
|
2344
|
+
},
|
|
2345
|
+
params: {
|
|
2346
|
+
split: { type: "boolean", default: false, label: "split groups" },
|
|
2347
|
+
},
|
|
2348
|
+
outputs: {
|
|
2349
|
+
arrays: "any",
|
|
2350
|
+
},
|
|
2351
|
+
impl: function (_a, params_1) { return __awaiter(void 0, [_a, params_1], void 0, function (_b, params) {
|
|
2352
|
+
var _c = _b.items, items = _c === void 0 ? {} : _c;
|
|
2353
|
+
return __generator(this, function (_d) {
|
|
2354
|
+
if (params.split) {
|
|
2355
|
+
items = graftTree(items);
|
|
2356
|
+
}
|
|
2357
|
+
return [2 /*return*/, {
|
|
2358
|
+
arrays: mapTreeBranch(items, function (items) {
|
|
2359
|
+
return items.flat();
|
|
2360
|
+
}),
|
|
2361
|
+
}];
|
|
2362
|
+
});
|
|
2363
|
+
}); },
|
|
2364
|
+
};
|
|
2365
|
+
|
|
2366
|
+
var explodeObject = {
|
|
2367
|
+
name: "explodeObject",
|
|
2368
|
+
label: "Explode Object",
|
|
2369
|
+
description: "Separates all fields of an object",
|
|
2370
|
+
nodeType: "DynamicOutput",
|
|
2371
|
+
inputs: {
|
|
2372
|
+
object: "any",
|
|
2373
|
+
},
|
|
2374
|
+
params: {
|
|
2375
|
+
split: { type: "boolean", default: false, label: "split groups" },
|
|
2376
|
+
},
|
|
2377
|
+
outputs: {
|
|
2378
|
+
// values: "any",
|
|
2379
|
+
},
|
|
2380
|
+
impl: function (_a, params_1) { return __awaiter(void 0, [_a, params_1], void 0, function (_b, params) {
|
|
2381
|
+
var outputs;
|
|
2382
|
+
var _c = _b.object, object = _c === void 0 ? {} : _c;
|
|
2383
|
+
return __generator(this, function (_d) {
|
|
2384
|
+
outputs = {};
|
|
2385
|
+
if (params.split) {
|
|
2386
|
+
object = graftTree(object);
|
|
2387
|
+
}
|
|
2388
|
+
forEachBranch(object, function (branch, path) {
|
|
2389
|
+
branch.forEach(function (obj, index) {
|
|
2390
|
+
if (!obj)
|
|
2391
|
+
return;
|
|
2392
|
+
var props = obj || {};
|
|
2393
|
+
Object.entries(props).forEach(function (_a) {
|
|
2394
|
+
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
2395
|
+
if (key[0] === "_")
|
|
2396
|
+
return;
|
|
2397
|
+
if (!outputs[key]) {
|
|
2398
|
+
outputs[key] = {};
|
|
2399
|
+
}
|
|
2400
|
+
[].concat(value).forEach(function (v) {
|
|
2401
|
+
pushItem(outputs[key], path, v);
|
|
2402
|
+
});
|
|
2403
|
+
});
|
|
2404
|
+
});
|
|
2405
|
+
});
|
|
2406
|
+
return [2 /*return*/, outputs];
|
|
2407
|
+
});
|
|
2408
|
+
}); },
|
|
2409
|
+
};
|
|
2410
|
+
|
|
2315
2411
|
var _a$1;
|
|
2316
2412
|
var primitives$1 = (_a$1 = {},
|
|
2317
2413
|
_a$1[object.name] = object,
|
|
2318
2414
|
_a$1[listToArray.name] = listToArray,
|
|
2415
|
+
_a$1[arrayToList.name] = arrayToList,
|
|
2319
2416
|
_a$1[mergeObject.name] = mergeObject,
|
|
2320
2417
|
_a$1[objectEntries.name] = objectEntries,
|
|
2418
|
+
_a$1[explodeObject.name] = explodeObject,
|
|
2321
2419
|
_a$1);
|
|
2322
2420
|
|
|
2323
2421
|
var Lib = {
|
|
@@ -5881,7 +5979,7 @@ function GenericNode(_a) {
|
|
|
5881
5979
|
var engine = useEngine();
|
|
5882
5980
|
var _d = __read(React.useState({}), 2), result = _d[0], setResult = _d[1];
|
|
5883
5981
|
var _e = __read(React.useState(null), 2), duration = _e[0], setDuration = _e[1];
|
|
5884
|
-
var _f = __read(
|
|
5982
|
+
var _f = __read(useInner(((_c = outputEntries[0]) === null || _c === void 0 ? void 0 : _c[0]) || null, [outputs, data.outputDefs]), 2), focus = _f[0], setFocus = _f[1];
|
|
5885
5983
|
var _g = __read(React.useState(false), 2), showPreview = _g[0], setShowPreview = _g[1];
|
|
5886
5984
|
var previewValue = focus ? result[focus] : Object.values(result)[0];
|
|
5887
5985
|
React.useEffect(function () {
|