graphai 0.6.20 → 0.6.22
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 +18 -9
- 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 +4 -2
- package/lib/graphai.js +6 -0
- package/lib/index.d.ts +1 -1
- package/lib/node.d.ts +1 -0
- package/lib/node.js +12 -9
- package/lib/type.d.ts +1 -0
- package/package.json +1 -1
package/lib/node.js
CHANGED
|
@@ -126,13 +126,16 @@ class ComputedNode extends Node {
|
|
|
126
126
|
this.pendings.add(source.nodeId);
|
|
127
127
|
return source;
|
|
128
128
|
}
|
|
129
|
+
updateState(state) {
|
|
130
|
+
this.state = state;
|
|
131
|
+
if (this.debugInfo) {
|
|
132
|
+
this.debugInfo.state = state;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
129
135
|
resetPending() {
|
|
130
136
|
this.pendings.clear();
|
|
131
137
|
if (this.state === type_1.NodeState.Executing) {
|
|
132
|
-
this.
|
|
133
|
-
if (this.debugInfo) {
|
|
134
|
-
this.debugInfo.state = type_1.NodeState.Abort;
|
|
135
|
-
}
|
|
138
|
+
this.updateState(type_1.NodeState.Abort);
|
|
136
139
|
}
|
|
137
140
|
if (this.debugInfo && this.debugInfo.subGraphs) {
|
|
138
141
|
this.debugInfo.subGraphs.forEach((graph) => graph.abort());
|
|
@@ -145,7 +148,7 @@ class ComputedNode extends Node {
|
|
|
145
148
|
this.isSkip = !!((this.ifSource && !(0, utils_2.isLogicallyTrue)(this.graph.resultOf(this.ifSource))) ||
|
|
146
149
|
(this.unlessSource && (0, utils_2.isLogicallyTrue)(this.graph.resultOf(this.unlessSource))));
|
|
147
150
|
if (this.isSkip && this.defaultValue === undefined) {
|
|
148
|
-
this.
|
|
151
|
+
this.updateState(type_1.NodeState.Skipped);
|
|
149
152
|
this.log.onSkipped(this, this.graph);
|
|
150
153
|
return false;
|
|
151
154
|
}
|
|
@@ -155,7 +158,7 @@ class ComputedNode extends Node {
|
|
|
155
158
|
// the "retry" if specified. The transaction log must be updated before
|
|
156
159
|
// callling this method.
|
|
157
160
|
retry(state, error) {
|
|
158
|
-
this.state
|
|
161
|
+
this.updateState(state); // this.execute() will update to NodeState.Executing
|
|
159
162
|
this.log.onError(this, this.graph, error.message);
|
|
160
163
|
if (this.retryCount < this.retryLimit) {
|
|
161
164
|
this.retryCount++;
|
|
@@ -175,7 +178,7 @@ class ComputedNode extends Node {
|
|
|
175
178
|
}
|
|
176
179
|
// This method is called right before the Graph add this node to the task manager.
|
|
177
180
|
beforeAddTask() {
|
|
178
|
-
this.
|
|
181
|
+
this.updateState(type_1.NodeState.Queued);
|
|
179
182
|
this.log.beforeAddTask(this, this.graph);
|
|
180
183
|
}
|
|
181
184
|
// This method is called when the data became available on one of nodes,
|
|
@@ -304,7 +307,7 @@ class ComputedNode extends Node {
|
|
|
304
307
|
if (this.state == type_1.NodeState.Abort) {
|
|
305
308
|
return;
|
|
306
309
|
}
|
|
307
|
-
this.
|
|
310
|
+
this.updateState(type_1.NodeState.Completed);
|
|
308
311
|
this.result = this.getResult(result);
|
|
309
312
|
if (this.output) {
|
|
310
313
|
this.result = (0, result_1.resultsOf)(this.output, { self: this }, this.graph.propFunctions, true);
|
|
@@ -316,7 +319,7 @@ class ComputedNode extends Node {
|
|
|
316
319
|
// This private method (called only by execute()) prepares the ComputedNode object
|
|
317
320
|
// for execution, and create a new transaction to record it.
|
|
318
321
|
prepareExecute(transactionId, inputs) {
|
|
319
|
-
this.
|
|
322
|
+
this.updateState(type_1.NodeState.Executing);
|
|
320
323
|
this.log.beforeExecute(this, this.graph, transactionId, inputs);
|
|
321
324
|
this.transactionId = transactionId;
|
|
322
325
|
}
|
package/lib/type.d.ts
CHANGED
|
@@ -154,4 +154,5 @@ export type AgentFunctionInfo = {
|
|
|
154
154
|
};
|
|
155
155
|
export type AgentFunctionInfoDictionary = Record<string, AgentFunctionInfo>;
|
|
156
156
|
export type PropFunction = (result: ResultData, propId: string) => ResultData;
|
|
157
|
+
export type CallbackFunction = (log: TransactionLog, isUpdate: boolean) => void;
|
|
157
158
|
export {};
|