Skip to content

Commit

Permalink
Update lib
Browse files Browse the repository at this point in the history
  • Loading branch information
GitHub Actions Bot committed May 10, 2024
1 parent 66f17c6 commit 68483ce
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions lib/graphai.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ class GraphAI {
});
return nodes;
}
getValueFromResults(key, results) {
const source = (0, utils_1.parseNodeName)(key, this.version);
getValueFromResults(source, results) {
return (0, utils_1.getDataFromSource)(source.nodeId ? results[source.nodeId] : undefined, source);
}
// for static
Expand All @@ -59,7 +58,7 @@ class GraphAI {
const update = node?.update;
if (update && previousResults) {
const result = this.getValueFromResults(update, previousResults);
this.injectValue(nodeId, result, update);
this.injectValue(nodeId, result, update.nodeId);
}
}
});
Expand Down Expand Up @@ -199,7 +198,8 @@ class GraphAI {
this.initializeNodes(results);
// Notice that we need to check the while condition *after* calling initializeNodes.
if (loop.while) {
const value = this.getValueFromResults(loop.while, this.results(true));
const source = (0, utils_1.parseNodeName)(loop.while, this.version);
const value = this.getValueFromResults(source, this.results(true));
// NOTE: We treat an empty array as false.
if (Array.isArray(value) ? value.length === 0 : !value) {
return false; // while condition is not met
Expand Down
2 changes: 1 addition & 1 deletion lib/node.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export declare class ComputedNode extends Node {
}
export declare class StaticNode extends Node {
value?: ResultData;
readonly update?: string;
readonly update?: DataSource;
readonly isResult: boolean;
readonly isStaticNode = true;
readonly isComputedNode = false;
Expand Down
2 changes: 1 addition & 1 deletion lib/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ class StaticNode extends Node {
this.isStaticNode = true;
this.isComputedNode = false;
this.value = data.value;
this.update = data.update;
this.update = data.update ? (0, utils_2.parseNodeName)(data.update, graph.version) : undefined;
this.isResult = data.isResult ?? false;
}
injectValue(value, injectFrom) {
Expand Down

0 comments on commit 68483ce

Please sign in to comment.