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 CHANGED
@@ -27,6 +27,7 @@ export declare class ComputedNode extends Node {
27
27
  readonly priority: number;
28
28
  error?: Error;
29
29
  transactionId: undefined | number;
30
+ private readonly passThrough?;
30
31
  readonly anyInput: boolean;
31
32
  dataSources: NestedDataSource;
32
33
  private inputs?;
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 = 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;
@@ -16,6 +16,7 @@ exports.computedNodeAttributeKeys = [
16
16
  "unless",
17
17
  "filterParams",
18
18
  "console",
19
+ "passThrough",
19
20
  ];
20
21
  exports.staticNodeAttributeKeys = ["value", "update", "isResult"];
21
22
  class ValidationError extends Error {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphai",
3
- "version": "0.5.6",
3
+ "version": "0.5.7",
4
4
  "description": "Asynchronous data flow execution engine for agentic AI apps.",
5
5
  "main": "lib/index.js",
6
6
  "files": [