@avaprotocol/sdk-js 2.7.3 → 2.7.5-dev.0

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.
@@ -0,0 +1,12 @@
1
+ import * as avs_pb from "@/grpc_codegen/avs_pb";
2
+ import { EdgeProps } from "@avaprotocol/types";
3
+ declare class Edge implements EdgeProps {
4
+ id: string;
5
+ source: string;
6
+ target: string;
7
+ constructor(edge: EdgeProps);
8
+ static fromResponse(edge: avs_pb.TaskEdge): Edge;
9
+ toRequest(): avs_pb.TaskEdge;
10
+ }
11
+ export default Edge;
12
+ //# sourceMappingURL=edge.d.ts.map
@@ -9,6 +9,7 @@ declare class Execution implements ExecutionProps {
9
9
  error: string;
10
10
  index: number;
11
11
  steps: Step[];
12
+ totalGasCost?: string;
12
13
  constructor(props: ExecutionProps);
13
14
  /**
14
15
  * Convert Execution instance to plain object (ExecutionProps)
@@ -1 +1 @@
1
- {"version":3,"file":"execution.d.ts","sourceRoot":"","sources":["../../src/models/execution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAqC,cAAc,EAAa,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACnH,OAAO,IAAI,MAAM,QAAQ,CAAC;AAuB1B,cAAM,SAAU,YAAW,cAAc;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,eAAe,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,IAAI,EAAE,CAAC;gBAEF,KAAK,EAAE,cAAc;IAWjC;;;OAGG;IACH,MAAM,IAAI,cAAc;IAYxB,MAAM,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,SAAS,GAAG,SAAS;CAe5D;AAED,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"execution.d.ts","sourceRoot":"","sources":["../../src/models/execution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAqC,cAAc,EAAa,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACnH,OAAO,IAAI,MAAM,QAAQ,CAAC;AAuB1B,cAAM,SAAU,YAAW,cAAc;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,eAAe,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;gBAEV,KAAK,EAAE,cAAc;IAYjC;;;OAGG;IACH,MAAM,IAAI,cAAc;IAaxB,MAAM,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,SAAS,GAAG,SAAS;CAgB5D;AAED,eAAe,SAAS,CAAC"}
@@ -28,6 +28,7 @@ class Execution {
28
28
  this.error = props.error;
29
29
  this.index = props.index;
30
30
  this.steps = props.steps.map(s => new Step(s));
31
+ this.totalGasCost = props.totalGasCost;
31
32
  }
32
33
  /**
33
34
  * Convert Execution instance to plain object (ExecutionProps)
@@ -42,6 +43,7 @@ class Execution {
42
43
  error: this.error,
43
44
  index: this.index,
44
45
  steps: this.steps.map(step => step.toJson()),
46
+ ...(this.totalGasCost && { totalGasCost: this.totalGasCost }),
45
47
  };
46
48
  }
47
49
  static fromResponse(execution) {
@@ -52,6 +54,7 @@ class Execution {
52
54
  status: convertProtobufExecutionStatusToTypes(execution.getStatus()),
53
55
  error: execution.getError(),
54
56
  index: execution.getIndex(),
57
+ totalGasCost: execution.getTotalGasCost() || undefined,
55
58
  steps: execution
56
59
  .getStepsList()
57
60
  .map((step) => Step.fromResponse(step)),
@@ -0,0 +1,11 @@
1
+ import { BranchNodeProps } from "@avaprotocol/types";
2
+ import Node from "./interface";
3
+ import * as avs_pb from "@/grpc_codegen/avs_pb";
4
+ declare class BranchNode extends Node {
5
+ constructor(props: BranchNodeProps);
6
+ static fromResponse(raw: avs_pb.TaskNode): BranchNode;
7
+ toRequest(): avs_pb.TaskNode;
8
+ static fromOutputData(outputData: avs_pb.RunNodeWithInputsResp): any;
9
+ }
10
+ export default BranchNode;
11
+ //# sourceMappingURL=branch.d.ts.map
@@ -0,0 +1,17 @@
1
+ import Node from "./interface";
2
+ import * as avs_pb from "@/grpc_codegen/avs_pb";
3
+ import { ContractReadNodeData, ContractReadNodeProps } from "@avaprotocol/types";
4
+ declare class ContractReadNode extends Node {
5
+ constructor(props: ContractReadNodeProps);
6
+ /**
7
+ * Create a protobuf ContractReadNode from config data
8
+ * @param configData - The configuration data for the contract read node
9
+ * @returns Configured avs_pb.ContractReadNode
10
+ */
11
+ static createProtobufNode(configData: ContractReadNodeData): avs_pb.ContractReadNode;
12
+ static fromResponse(raw: avs_pb.TaskNode): ContractReadNode;
13
+ toRequest(): avs_pb.TaskNode;
14
+ static fromOutputData(outputData: avs_pb.RunNodeWithInputsResp): unknown | null;
15
+ }
16
+ export default ContractReadNode;
17
+ //# sourceMappingURL=contractRead.d.ts.map
@@ -0,0 +1,20 @@
1
+ import Node from "./interface";
2
+ import * as avs_pb from "@/grpc_codegen/avs_pb";
3
+ import { CustomCodeLang, CustomCodeNodeProps } from "@avaprotocol/types";
4
+ declare class CustomCodeNode extends Node {
5
+ constructor(props: CustomCodeNodeProps);
6
+ /**
7
+ * Create a protobuf CustomCodeNode from config data
8
+ * @param configData - The configuration data for the custom code node
9
+ * @returns Configured avs_pb.CustomCodeNode
10
+ */
11
+ static createProtobufNode(configData: {
12
+ lang: CustomCodeLang | string | number;
13
+ source: string;
14
+ }): avs_pb.CustomCodeNode;
15
+ static fromResponse(raw: avs_pb.TaskNode): CustomCodeNode;
16
+ toRequest(): avs_pb.TaskNode;
17
+ static fromOutputData(outputData: avs_pb.RunNodeWithInputsResp): any;
18
+ }
19
+ export default CustomCodeNode;
20
+ //# sourceMappingURL=customCode.d.ts.map
@@ -0,0 +1,20 @@
1
+ import Node from "./interface";
2
+ import * as avs_pb from "@/grpc_codegen/avs_pb";
3
+ import { ETHTransferNodeProps } from "@avaprotocol/types";
4
+ declare class ETHTransferNode extends Node {
5
+ constructor(props: ETHTransferNodeProps);
6
+ /**
7
+ * Create a protobuf ETHTransferNode from config data
8
+ * @param configData - The configuration data for the ETH transfer node
9
+ * @returns Configured avs_pb.ETHTransferNode
10
+ */
11
+ static createProtobufNode(configData: {
12
+ destination: string;
13
+ amount: string;
14
+ }): avs_pb.ETHTransferNode;
15
+ static fromResponse(raw: avs_pb.TaskNode): ETHTransferNode;
16
+ toRequest(): avs_pb.TaskNode;
17
+ static fromOutputData(outputData: avs_pb.RunNodeWithInputsResp): any;
18
+ }
19
+ export default ETHTransferNode;
20
+ //# sourceMappingURL=ethTransfer.d.ts.map
@@ -0,0 +1,23 @@
1
+ import * as avs_pb from "@/grpc_codegen/avs_pb";
2
+ import ContractWriteNode from "./contractWrite";
3
+ import CustomCodeNode from "./customCode";
4
+ import GraphQLQueryNode from "./graphqlQuery";
5
+ import Node from "./interface";
6
+ import RestAPINode from "./restApi";
7
+ import ContractReadNode from "./contractRead";
8
+ import ETHTransferNode from "./ethTransfer";
9
+ import BranchNode from "./branch";
10
+ import FilterNode from "./filter";
11
+ import LoopNode from "./loop";
12
+ import { ContractWriteNodeData, ContractReadNodeData, BranchNodeData, ETHTransferNodeData, GraphQLQueryNodeData, RestAPINodeData, CustomCodeNodeData, FilterNodeData, LoopNodeData, NodeProps, ContractWriteNodeProps, ContractReadNodeProps, BranchNodeProps, ETHTransferNodeProps, GraphQLQueryNodeProps, RestAPINodeProps, CustomCodeNodeProps, FilterNodeProps, LoopNodeProps } from "@avaprotocol/types";
13
+ declare class NodeFactory {
14
+ static create(props: NodeProps): Node;
15
+ static createNodes(props: NodeProps[]): Node[];
16
+ static fromResponse(raw: avs_pb.TaskNode): Node;
17
+ static fromOutputData(outputData: avs_pb.RunNodeWithInputsResp): any;
18
+ }
19
+ export default NodeFactory;
20
+ export { Node, ContractWriteNode, ContractReadNode, BranchNode, ETHTransferNode, GraphQLQueryNode, RestAPINode, CustomCodeNode, FilterNode, LoopNode, };
21
+ export type { ContractWriteNodeData, ContractReadNodeData, BranchNodeData, ETHTransferNodeData, GraphQLQueryNodeData, RestAPINodeData, CustomCodeNodeData, FilterNodeData, LoopNodeData, };
22
+ export type { NodeProps, ContractWriteNodeProps, ContractReadNodeProps, BranchNodeProps, ETHTransferNodeProps, GraphQLQueryNodeProps, RestAPINodeProps, CustomCodeNodeProps, FilterNodeProps, LoopNodeProps, };
23
+ //# sourceMappingURL=factory.d.ts.map
@@ -0,0 +1,20 @@
1
+ import * as avs_pb from "@/grpc_codegen/avs_pb";
2
+ import { NodeType, NodeProps, NodeData } from "@avaprotocol/types";
3
+ export declare function covertNodeTypeToString(status: avs_pb.TaskNode.TaskTypeCase): NodeType;
4
+ export type ProtobufNodeProps = Omit<avs_pb.TaskNode.AsObject, "ethTransfer" | "contractWrite" | "contractRead" | "graphqlDataQuery" | "restApi" | "branch" | "filter" | "loop" | "customCode"> & {
5
+ data: any;
6
+ };
7
+ export declare const ProtobufNodePropsUtils: {
8
+ getGoStringType: (props: ProtobufNodeProps) => string;
9
+ fromGoStringType: (goStringType: string, baseProps: Omit<ProtobufNodeProps, "type">) => ProtobufNodeProps;
10
+ };
11
+ export default abstract class Node implements NodeProps {
12
+ id: string;
13
+ name: string;
14
+ type: NodeType;
15
+ data: NodeData;
16
+ constructor(props: NodeProps);
17
+ toRequest(): avs_pb.TaskNode;
18
+ static fromResponse(raw: avs_pb.TaskNode): Node;
19
+ }
20
+ //# sourceMappingURL=interface.d.ts.map
@@ -0,0 +1,15 @@
1
+ import * as avs_pb from "@/grpc_codegen/avs_pb";
2
+ import Node from "./interface";
3
+ import { LoopNodeProps } from "@avaprotocol/types";
4
+ declare class LoopNode extends Node {
5
+ constructor(props: LoopNodeProps);
6
+ static fromResponse(raw: avs_pb.TaskNode): LoopNode;
7
+ private static extractRunnerFromProtobuf;
8
+ private static mapExecutionModeFromProtobuf;
9
+ private mapExecutionModeToProtobuf;
10
+ toRequest(): avs_pb.TaskNode;
11
+ private setRunnerOnProtobuf;
12
+ static fromOutputData(outputData: avs_pb.RunNodeWithInputsResp): unknown;
13
+ }
14
+ export default LoopNode;
15
+ //# sourceMappingURL=loop.d.ts.map
@@ -0,0 +1,22 @@
1
+ import Node from "./interface";
2
+ import * as avs_pb from "@/grpc_codegen/avs_pb";
3
+ import { RestAPINodeProps } from "@avaprotocol/types";
4
+ declare class RestAPINode extends Node {
5
+ constructor(props: RestAPINodeProps);
6
+ /**
7
+ * Create a protobuf RestAPINode from config data
8
+ * @param configData - The configuration data for the REST API node
9
+ * @returns Configured avs_pb.RestAPINode
10
+ */
11
+ static createProtobufNode(configData: {
12
+ url: string;
13
+ method: string;
14
+ body?: string;
15
+ headers?: Record<string, string>;
16
+ }): avs_pb.RestAPINode;
17
+ static fromResponse(raw: avs_pb.TaskNode): RestAPINode;
18
+ toRequest(): avs_pb.TaskNode;
19
+ static fromOutputData(outputData: avs_pb.RunNodeWithInputsResp): Record<string, unknown> | null;
20
+ }
21
+ export default RestAPINode;
22
+ //# sourceMappingURL=restApi.d.ts.map
@@ -0,0 +1,16 @@
1
+ import * as avs_pb from "@/grpc_codegen/avs_pb";
2
+ import { SecretProps } from "@avaprotocol/types";
3
+ declare class Secret implements SecretProps {
4
+ name: string;
5
+ secret?: string;
6
+ workflowId?: string;
7
+ orgId?: string;
8
+ createdAt?: number;
9
+ updatedAt?: number;
10
+ createdBy?: string;
11
+ description?: string;
12
+ constructor(props: SecretProps);
13
+ toRequest(): avs_pb.CreateOrUpdateSecretReq;
14
+ }
15
+ export default Secret;
16
+ //# sourceMappingURL=secret.d.ts.map
@@ -14,6 +14,9 @@ declare class Step implements StepProps {
14
14
  endAt: number;
15
15
  metadata?: any;
16
16
  executionContext?: any;
17
+ gasUsed?: string;
18
+ gasPrice?: string;
19
+ totalGasCost?: string;
17
20
  constructor(props: StepProps);
18
21
  /**
19
22
  * Convert Step instance to plain object (StepProps)
@@ -1 +1 @@
1
- {"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../src/models/step.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAMhD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAEhE,cAAM,IAAK,YAAW,SAAS;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,MAAM,EAAE,eAAe,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,gBAAgB,CAAC,EAAE,GAAG,CAAC;gBAEX,KAAK,EAAE,SAAS;IAgB5B;;;OAGG;IACH,MAAM,IAAI,SAAS;IAkBnB,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI,GAAG,eAAe;IAoC9D,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAiEhC,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAkChC,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI,GAAG,IAAI;CAuGvD;AAED,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../src/models/step.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAMhD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAEhE,cAAM,IAAK,YAAW,SAAS;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,MAAM,EAAE,eAAe,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,gBAAgB,CAAC,EAAE,GAAG,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;gBAEV,KAAK,EAAE,SAAS;IAmB5B;;;OAGG;IACH,MAAM,IAAI,SAAS;IAqBnB,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI,GAAG,eAAe;IAoC9D,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAiEhC,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAkChC,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI,GAAG,IAAI;CAsHvD;AAED,eAAe,IAAI,CAAC"}
@@ -15,6 +15,9 @@ class Step {
15
15
  this.endAt = props.endAt;
16
16
  this.metadata = props.metadata;
17
17
  this.executionContext = props.executionContext;
18
+ this.gasUsed = props.gasUsed;
19
+ this.gasPrice = props.gasPrice;
20
+ this.totalGasCost = props.totalGasCost;
18
21
  }
19
22
  /**
20
23
  * Convert Step instance to plain object (StepProps)
@@ -35,6 +38,9 @@ class Step {
35
38
  endAt: this.endAt,
36
39
  metadata: this.metadata,
37
40
  executionContext: this.executionContext,
41
+ ...(this.gasUsed && { gasUsed: this.gasUsed }),
42
+ ...(this.gasPrice && { gasPrice: this.gasPrice }),
43
+ ...(this.totalGasCost && { totalGasCost: this.totalGasCost }),
38
44
  };
39
45
  }
40
46
  static getOutput(step) {
@@ -209,6 +215,15 @@ class Step {
209
215
  const getEndAt = () => typeof step.getEndAt === "function"
210
216
  ? step.getEndAt()
211
217
  : step.endAt;
218
+ const getGasUsed = () => typeof step.getGasUsed === "function"
219
+ ? step.getGasUsed()
220
+ : step.gasUsed;
221
+ const getGasPrice = () => typeof step.getGasPrice === "function"
222
+ ? step.getGasPrice()
223
+ : step.gasPrice;
224
+ const getTotalGasCost = () => typeof step.getTotalGasCost === "function"
225
+ ? step.getTotalGasCost()
226
+ : step.totalGasCost;
212
227
  // Extract step-level metadata if present (per protobuf: Execution.Step.metadata)
213
228
  let stepMetadata = undefined;
214
229
  if (typeof step.getMetadata === "function" &&
@@ -251,6 +266,9 @@ class Step {
251
266
  endAt: getEndAt(),
252
267
  metadata: stepMetadata,
253
268
  executionContext,
269
+ gasUsed: getGasUsed() || undefined,
270
+ gasPrice: getGasPrice() || undefined,
271
+ totalGasCost: getTotalGasCost() || undefined,
254
272
  });
255
273
  }
256
274
  }
@@ -0,0 +1,48 @@
1
+ import * as avs_pb from "@/grpc_codegen/avs_pb";
2
+ import Node from "./node/interface";
3
+ import Edge from "./edge";
4
+ import Trigger from "./trigger/interface";
5
+ export declare const DefaultExpiredAt = -1;
6
+ import { WorkflowStatus, WorkflowProps, InputVariables } from "@avaprotocol/types";
7
+ export declare function convertStatusToString(status: avs_pb.TaskStatus): WorkflowStatus;
8
+ declare class Workflow implements WorkflowProps {
9
+ smartWalletAddress: string;
10
+ trigger: Trigger;
11
+ nodes: Node[];
12
+ edges: Edge[];
13
+ startAt: number;
14
+ expiredAt: number;
15
+ maxExecution: number;
16
+ id?: string;
17
+ owner?: string;
18
+ name?: string;
19
+ completedAt?: number;
20
+ status?: WorkflowStatus;
21
+ lastRanAt?: number;
22
+ executionCount?: number;
23
+ inputVariables?: InputVariables;
24
+ /**
25
+ * Create an instance of Workflow from user inputs
26
+ * @param props
27
+ */
28
+ constructor(props: WorkflowProps);
29
+ /**
30
+ * Create an instance of Workflow from AVS getWorkflow response
31
+ * @param res
32
+ * @returns
33
+ */
34
+ static fromResponse(obj: avs_pb.Task): Workflow;
35
+ /**
36
+ * Create an instance of Workflow with only selected fields
37
+ * @param obj
38
+ */
39
+ static fromListResponse(obj: avs_pb.Task): Workflow;
40
+ toRequest(): avs_pb.CreateTaskReq;
41
+ /**
42
+ * Convert Workflow instance to plain object (WorkflowProps)
43
+ * This is useful for serialization, especially with Next.js Server Components
44
+ */
45
+ toJson(): WorkflowProps;
46
+ }
47
+ export default Workflow;
48
+ //# sourceMappingURL=workflow.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../src/models/workflow.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,IAAI,MAAM,kBAAkB,CAAC;AACpC,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAG1C,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnE,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,CAAC,UAAU,GACxB,cAAc,CAUhB;AAED,cAAM,QAAS,YAAW,aAAa;IACrC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IAGrB,EAAE,CAAC,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AAM,CAAC;IAGrB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,cAAc,CAAC;IAEhC;;;OAGG;gBACS,KAAK,EAAE,aAAa;IAwBhC;;;;OAIG;IACH,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,GAAG,QAAQ;IAkC/C;;;OAGG;IACH,MAAM,CAAC,gBAAgB,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,GAAG,QAAQ;IAyBnD,SAAS,IAAI,MAAM,CAAC,aAAa;IAyEjC;;;OAGG;IACH,MAAM,IAAI,aAAa;CAmBxB;AAED,eAAe,QAAQ,CAAC"}
@@ -5,6 +5,7 @@ import TriggerFactory from "./trigger/factory";
5
5
  import NodeFactory from "./node/factory";
6
6
  export const DefaultExpiredAt = -1; // TODO: explain the meaning of -1
7
7
  import { WorkflowStatus } from "@avaprotocol/types";
8
+ import { convertJSValueToProtobuf } from "../utils";
8
9
  // Function to convert TaskStatus to string
9
10
  export function convertStatusToString(status) {
10
11
  const conversionMap = {
@@ -40,6 +41,7 @@ class Workflow {
40
41
  this.status = props.status;
41
42
  this.completedAt = props.completedAt;
42
43
  this.lastRanAt = props.lastRanAt;
44
+ this.inputVariables = props.inputVariables;
43
45
  }
44
46
  /**
45
47
  * Create an instance of Workflow from AVS getWorkflow response
@@ -145,6 +147,24 @@ class Workflow {
145
147
  if (this.name) {
146
148
  request.setName(this.name);
147
149
  }
150
+ // Add input variables if provided
151
+ console.log('🔍 [DEBUG] Workflow.toRequest() inputVariables check:', {
152
+ hasInputVariables: !!this.inputVariables,
153
+ inputVariables: this.inputVariables,
154
+ inputVariablesType: typeof this.inputVariables,
155
+ inputVariablesKeys: this.inputVariables ? Object.keys(this.inputVariables) : [],
156
+ });
157
+ if (this.inputVariables) {
158
+ const inputVarsMap = request.getInputVariablesMap();
159
+ for (const [key, value] of Object.entries(this.inputVariables)) {
160
+ console.log('🔍 [DEBUG] Converting inputVariable:', { key, value, valueType: typeof value });
161
+ inputVarsMap.set(key, convertJSValueToProtobuf(value));
162
+ }
163
+ console.log('🔍 [DEBUG] Final inputVarsMap size:', inputVarsMap.getLength());
164
+ }
165
+ else {
166
+ console.log('🔍 [DEBUG] No inputVariables to add to request');
167
+ }
148
168
  return request;
149
169
  }
150
170
  /**
@@ -167,6 +187,7 @@ class Workflow {
167
187
  status: this.status,
168
188
  completedAt: this.completedAt,
169
189
  lastRanAt: this.lastRanAt,
190
+ inputVariables: this.inputVariables,
170
191
  };
171
192
  }
172
193
  }
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,IAAI,aAAa,EAGvB,MAAM,2CAA2C,CAAC;AAGnD;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,CAAC,EAAE,aAAa,GAAG,GAAG,CAiCnE;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,GAAG,GAAG,aAAa,CA6BlE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,CAAC,GAAG,GAAG,EAAE,KAAK,EAAE,GAAG,GAAG,CAAC,CAatD;AAED;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAkB5E;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CA0BzE;AAED;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CASzE;AAED;;;;;;;;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,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC/C,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAiCjC;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAsB7D"}
package/dist/utils.js CHANGED
@@ -55,6 +55,7 @@ export function convertProtobufValueToJs(value) {
55
55
  * @returns The protobuf Value object
56
56
  */
57
57
  export function convertJSValueToProtobuf(value) {
58
+ console.log('🔍 [DEBUG] convertJSValueToProtobuf called with:', { value, type: typeof value });
58
59
  const protobufValue = new ProtobufValue();
59
60
  if (value === null || value === undefined) {
60
61
  protobufValue.setNullValue(0); // NULL_VALUE = 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avaprotocol/sdk-js",
3
- "version": "2.7.3",
3
+ "version": "2.7.5-dev.0",
4
4
  "description": "A JavaScript/TypeScript SDK designed to simplify integration with Ava Protocol's AVS",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -31,7 +31,7 @@
31
31
  "prepare": "node ../../scripts/prepare-package.js"
32
32
  },
33
33
  "dependencies": {
34
- "@avaprotocol/types": "^2.5.3",
34
+ "@avaprotocol/types": "^2.5.4",
35
35
  "@grpc/grpc-js": "^1.11.3",
36
36
  "@grpc/proto-loader": "^0.7.13",
37
37
  "dotenv": "^16.4.5",