graphai 1.0.13 → 2.0.0
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/lib/bundle.cjs.js +1 -1
- package/lib/bundle.cjs.js.map +1 -1
- package/lib/bundle.esm.js +138 -131
- package/lib/bundle.esm.js.map +1 -1
- package/lib/bundle.umd.js +1 -1
- package/lib/bundle.umd.js.map +1 -1
- package/lib/graphai.d.ts +1 -1
- package/lib/graphai.js +4 -4
- package/lib/node.js +3 -2
- package/lib/utils/result.js +2 -1
- package/lib/utils/utils.d.ts +2 -1
- package/lib/utils/utils.js +13 -7
- package/package.json +1 -1
package/lib/utils/utils.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { DataSource, AgentFunction, AgentFunctionInfo, NodeData, StaticNodeData, ComputedNodeData, NodeState } from "../type";
|
|
2
|
+
import type { GraphNodes } from "../node";
|
|
2
3
|
export declare const sleep: (milliseconds: number) => Promise<unknown>;
|
|
3
|
-
export declare const parseNodeName: (inputNodeId: any, isSelfNode?: boolean) => DataSource;
|
|
4
|
+
export declare const parseNodeName: (inputNodeId: any, isSelfNode?: boolean, nodes?: GraphNodes) => DataSource;
|
|
4
5
|
export declare function assert(condition: boolean, message: string, isWarn?: boolean): asserts condition;
|
|
5
6
|
export declare const isObject: <Values = unknown>(x: unknown) => x is Record<string, Values>;
|
|
6
7
|
export declare const isNull: (data: unknown) => data is null | undefined;
|
package/lib/utils/utils.js
CHANGED
|
@@ -4,11 +4,12 @@ exports.loopCounterKey = exports.isStaticNodeData = exports.isComputedNodeData =
|
|
|
4
4
|
exports.assert = assert;
|
|
5
5
|
const type_1 = require("../type");
|
|
6
6
|
const GraphAILogger_1 = require("./GraphAILogger");
|
|
7
|
+
const prop_function_1 = require("./prop_function");
|
|
7
8
|
const sleep = async (milliseconds) => {
|
|
8
9
|
return await new Promise((resolve) => setTimeout(resolve, milliseconds));
|
|
9
10
|
};
|
|
10
11
|
exports.sleep = sleep;
|
|
11
|
-
const parseNodeName = (inputNodeId, isSelfNode = false) => {
|
|
12
|
+
const parseNodeName = (inputNodeId, isSelfNode = false, nodes) => {
|
|
12
13
|
if (isSelfNode) {
|
|
13
14
|
if (typeof inputNodeId === "string" && inputNodeId[0] === ".") {
|
|
14
15
|
const parts = inputNodeId.split(".");
|
|
@@ -19,14 +20,19 @@ const parseNodeName = (inputNodeId, isSelfNode = false) => {
|
|
|
19
20
|
if (typeof inputNodeId === "string") {
|
|
20
21
|
const regex = /^:(.*)$/;
|
|
21
22
|
const match = inputNodeId.match(regex);
|
|
22
|
-
if (
|
|
23
|
-
|
|
23
|
+
if (match) {
|
|
24
|
+
const parts = match[1].split(/(?<!\()\.(?!\))/);
|
|
25
|
+
if (parts.length == 1) {
|
|
26
|
+
return { nodeId: parts[0] };
|
|
27
|
+
}
|
|
28
|
+
return { nodeId: parts[0], propIds: parts.slice(1) };
|
|
24
29
|
}
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
const regexUtil = /^@(.*)$/;
|
|
31
|
+
const matchUtil = inputNodeId.match(regexUtil);
|
|
32
|
+
// Only when just called from resultsOfInner
|
|
33
|
+
if (nodes && matchUtil) {
|
|
34
|
+
return { value: (0, prop_function_1.utilsFunctions)(inputNodeId, nodes) };
|
|
28
35
|
}
|
|
29
|
-
return { nodeId: parts[0], propIds: parts.slice(1) };
|
|
30
36
|
}
|
|
31
37
|
return { value: inputNodeId }; // non-string literal
|
|
32
38
|
};
|