graphai 0.5.6 → 0.5.7
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.d.ts +1 -0
- package/lib/node.js +12 -1
- package/lib/type.d.ts +2 -0
- package/lib/validators/common.js +1 -0
- package/package.json +1 -1
package/lib/node.d.ts
CHANGED
package/lib/node.js
CHANGED
|
@@ -42,6 +42,7 @@ class ComputedNode extends Node {
|
|
|
42
42
|
this.params = data.params ?? {};
|
|
43
43
|
this.console = data.console ?? {};
|
|
44
44
|
this.filterParams = data.filterParams ?? {};
|
|
45
|
+
this.passThrough = data.passThrough;
|
|
45
46
|
this.retryLimit = data.retry ?? graph.retryLimit ?? 0;
|
|
46
47
|
this.timeout = data.timeout;
|
|
47
48
|
this.isResult = data.isResult ?? false;
|
|
@@ -247,7 +248,17 @@ class ComputedNode extends Node {
|
|
|
247
248
|
return;
|
|
248
249
|
}
|
|
249
250
|
this.state = type_1.NodeState.Completed;
|
|
250
|
-
this.result =
|
|
251
|
+
this.result = (() => {
|
|
252
|
+
if (result && this.passThrough) {
|
|
253
|
+
if ((0, utils_2.isObject)(result) && !Array.isArray(result)) {
|
|
254
|
+
return { ...result, ...this.passThrough };
|
|
255
|
+
}
|
|
256
|
+
else if (Array.isArray(result)) {
|
|
257
|
+
return result.map((r) => ((0, utils_2.isObject)(r) && !Array.isArray(r) ? { ...r, ...this.passThrough } : r));
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
return result;
|
|
261
|
+
})();
|
|
251
262
|
this.log.onComplete(this, this.graph, localLog);
|
|
252
263
|
this.onSetResult();
|
|
253
264
|
this.graph.onExecutionComplete(this);
|
package/lib/type.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export type ResultData<ResultType = DefaultResultData> = ResultType | undefined;
|
|
|
17
17
|
export type ResultDataDictionary<ResultType = DefaultResultData> = Record<string, ResultData<ResultType>>;
|
|
18
18
|
export type DefaultParamsType = Record<string, any>;
|
|
19
19
|
export type NodeDataParams<ParamsType = DefaultParamsType> = ParamsType;
|
|
20
|
+
export type PassThrough = Record<string, any>;
|
|
20
21
|
export type DataSource = {
|
|
21
22
|
nodeId?: string;
|
|
22
23
|
value?: any;
|
|
@@ -45,6 +46,7 @@ export type ComputedNodeData = {
|
|
|
45
46
|
graph?: GraphData | string;
|
|
46
47
|
isResult?: boolean;
|
|
47
48
|
priority?: number;
|
|
49
|
+
passThrough?: PassThrough;
|
|
48
50
|
console?: Record<string, string | boolean>;
|
|
49
51
|
};
|
|
50
52
|
export type NodeData = StaticNodeData | ComputedNodeData;
|
package/lib/validators/common.js
CHANGED