graphai 0.5.12 → 0.5.13
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/node.js +1 -0
- package/lib/type.d.ts +1 -0
- package/lib/utils/utils.js +7 -2
- package/package.json +1 -1
package/lib/node.js
CHANGED
|
@@ -218,6 +218,7 @@ class ComputedNode extends Node {
|
|
|
218
218
|
if (this.nestedGraph) {
|
|
219
219
|
this.graph.taskManager.prepareForNesting();
|
|
220
220
|
context.taskManager = this.graph.taskManager;
|
|
221
|
+
context.onLogCallback = this.graph.onLogCallback;
|
|
221
222
|
if ("nodes" in this.nestedGraph) {
|
|
222
223
|
context.graphData = this.nestedGraph;
|
|
223
224
|
}
|
package/lib/type.d.ts
CHANGED
|
@@ -83,6 +83,7 @@ export type AgentFunctionContext<ParamsType = DefaultParamsType, InputDataType =
|
|
|
83
83
|
graphData?: GraphData;
|
|
84
84
|
agents?: AgentFunctionInfoDictionary;
|
|
85
85
|
taskManager?: TaskManager;
|
|
86
|
+
onLogCallback?: (log: TransactionLog, isUpdate: boolean) => void;
|
|
86
87
|
filterParams: AgentFilterParams;
|
|
87
88
|
agentFilters?: AgentFilterInfo[];
|
|
88
89
|
log?: TransactionLog[];
|
package/lib/utils/utils.js
CHANGED
|
@@ -92,15 +92,20 @@ const getNestedData = (result, propId) => {
|
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
-
else if (Number.isFinite(result)) {
|
|
95
|
+
else if (result !== undefined && Number.isFinite(result)) {
|
|
96
96
|
if (propId === "toString()") {
|
|
97
97
|
return String(result);
|
|
98
98
|
}
|
|
99
|
+
const regex = /^add\((-?\d+)\)$/;
|
|
100
|
+
const match = propId.match(regex);
|
|
101
|
+
if (match) {
|
|
102
|
+
return Number(result) + Number(match[1]);
|
|
103
|
+
}
|
|
99
104
|
}
|
|
100
105
|
return undefined;
|
|
101
106
|
};
|
|
102
107
|
const innerGetDataFromSource = (result, propIds) => {
|
|
103
|
-
if (result && propIds && propIds.length > 0) {
|
|
108
|
+
if (!(0, exports.isNull)(result) && propIds && propIds.length > 0) {
|
|
104
109
|
const propId = propIds[0];
|
|
105
110
|
const ret = getNestedData(result, propId);
|
|
106
111
|
if (ret === undefined) {
|