@avaprotocol/sdk-js 2.3.13-de.0 → 2.3.13-dev.1

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.
Files changed (41) hide show
  1. package/dist/index.js +1103 -401
  2. package/dist/index.mjs +1107 -405
  3. package/dist/models/node/branch.d.ts.map +1 -1
  4. package/dist/models/node/branch.js +12 -3
  5. package/dist/models/node/contractRead.d.ts.map +1 -1
  6. package/dist/models/node/contractRead.js +12 -3
  7. package/dist/models/node/contractWrite.d.ts.map +1 -1
  8. package/dist/models/node/contractWrite.js +12 -3
  9. package/dist/models/node/customCode.d.ts.map +1 -1
  10. package/dist/models/node/customCode.js +12 -4
  11. package/dist/models/node/ethTransfer.d.ts.map +1 -1
  12. package/dist/models/node/ethTransfer.js +12 -3
  13. package/dist/models/node/filter.d.ts.map +1 -1
  14. package/dist/models/node/filter.js +12 -3
  15. package/dist/models/node/graphqlQuery.d.ts.map +1 -1
  16. package/dist/models/node/graphqlQuery.js +12 -3
  17. package/dist/models/node/interface.d.ts +3 -2
  18. package/dist/models/node/interface.d.ts.map +1 -1
  19. package/dist/models/node/interface.js +17 -2
  20. package/dist/models/node/loop.d.ts.map +1 -1
  21. package/dist/models/node/loop.js +9 -0
  22. package/dist/models/node/restApi.d.ts.map +1 -1
  23. package/dist/models/node/restApi.js +15 -1
  24. package/dist/models/step.d.ts +1 -0
  25. package/dist/models/step.d.ts.map +1 -1
  26. package/dist/models/step.js +308 -206
  27. package/dist/models/trigger/block.d.ts.map +1 -1
  28. package/dist/models/trigger/block.js +13 -0
  29. package/dist/models/trigger/cron.d.ts.map +1 -1
  30. package/dist/models/trigger/cron.js +20 -0
  31. package/dist/models/trigger/event.d.ts.map +1 -1
  32. package/dist/models/trigger/fixedTime.d.ts.map +1 -1
  33. package/dist/models/trigger/interface.d.ts +4 -5
  34. package/dist/models/trigger/interface.d.ts.map +1 -1
  35. package/dist/models/trigger/interface.js +4 -2
  36. package/dist/models/trigger/manual.d.ts.map +1 -1
  37. package/dist/models/trigger/manual.js +13 -0
  38. package/dist/utils.d.ts +20 -0
  39. package/dist/utils.d.ts.map +1 -1
  40. package/dist/utils.js +52 -0
  41. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"branch.d.ts","sourceRoot":"","sources":["../../../src/models/node/branch.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,eAAe,EAAa,MAAM,oBAAoB,CAAC;AAC1F,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAKhD,cAAM,UAAW,SAAQ,IAAI;gBACf,KAAK,EAAE,eAAe;IAIlC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,UAAU;IAqBrD,SAAS,IAAI,MAAM,CAAC,QAAQ;IA+B5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAMrE;AACD,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"branch.d.ts","sourceRoot":"","sources":["../../../src/models/node/branch.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,eAAe,EAAa,MAAM,oBAAoB,CAAC;AAC1F,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAMhD,cAAM,UAAW,SAAQ,IAAI;gBACf,KAAK,EAAE,eAAe;IAIlC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,UAAU;IAyBrD,SAAS,IAAI,MAAM,CAAC,QAAQ;IAsC5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAMrE;AACD,eAAe,UAAU,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { NodeType } from "@avaprotocol/types";
2
2
  import Node from "./interface";
3
3
  import * as avs_pb from "@/grpc_codegen/avs_pb";
4
+ import { convertInputToProtobuf, extractInputFromProtobuf } from "../../utils";
4
5
  // Required props for constructor: id, name, type and data: { conditions }
5
6
  class BranchNode extends Node {
6
7
  constructor(props) {
@@ -18,17 +19,20 @@ class BranchNode extends Node {
18
19
  expression: condition.expression,
19
20
  })) || [],
20
21
  };
22
+ // Extract input data if present
23
+ const input = extractInputFromProtobuf(raw.getBranch()?.getInput());
21
24
  return new BranchNode({
22
25
  ...obj,
23
26
  type: NodeType.Branch,
24
27
  data: data,
28
+ input: input,
25
29
  });
26
30
  }
27
31
  toRequest() {
28
32
  const request = new avs_pb.TaskNode();
29
33
  request.setId(this.id);
30
34
  request.setName(this.name);
31
- const nodeData = new avs_pb.BranchNode();
35
+ const node = new avs_pb.BranchNode();
32
36
  const config = new avs_pb.BranchNode.Config();
33
37
  if (this.data.conditions &&
34
38
  this.data.conditions.length > 0) {
@@ -41,8 +45,13 @@ class BranchNode extends Node {
41
45
  });
42
46
  config.setConditionsList(conditionsList);
43
47
  }
44
- nodeData.setConfig(config);
45
- request.setBranch(nodeData);
48
+ node.setConfig(config);
49
+ // Set input data if provided
50
+ const inputValue = convertInputToProtobuf(this.input);
51
+ if (inputValue) {
52
+ node.setInput(inputValue);
53
+ }
54
+ request.setBranch(node);
46
55
  return request;
47
56
  }
48
57
  static fromOutputData(outputData) {
@@ -1 +1 @@
1
- {"version":3,"file":"contractRead.d.ts","sourceRoot":"","sources":["../../../src/models/node/contractRead.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAkC,qBAAqB,EAAa,MAAM,oBAAoB,CAAC;AAMtG,cAAM,gBAAiB,SAAQ,IAAI;gBACrB,KAAK,EAAE,qBAAqB;IAIxC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,gBAAgB;IAsB3D,SAAS,IAAI,MAAM,CAAC,QAAQ;IA8B5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAmBrE;AAED,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"contractRead.d.ts","sourceRoot":"","sources":["../../../src/models/node/contractRead.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAkC,qBAAqB,EAAa,MAAM,oBAAoB,CAAC;AAMtG,cAAM,gBAAiB,SAAQ,IAAI;gBACrB,KAAK,EAAE,qBAAqB;IAIxC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,gBAAgB;IA0B3D,SAAS,IAAI,MAAM,CAAC,QAAQ;IAoC5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAmBrE;AAED,eAAe,gBAAgB,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import Node from "./interface";
2
2
  import * as avs_pb from "@/grpc_codegen/avs_pb";
3
3
  import { NodeType } from "@avaprotocol/types";
4
+ import { convertInputToProtobuf, extractInputFromProtobuf } from "../../utils";
4
5
  // Required props for constructor: id, name, type and data
5
6
  class ContractReadNode extends Node {
6
7
  constructor(props) {
@@ -19,17 +20,20 @@ class ContractReadNode extends Node {
19
20
  methodName: call.methodName,
20
21
  })) || [],
21
22
  };
23
+ // Extract input data if present
24
+ const input = extractInputFromProtobuf(raw.getContractRead()?.getInput());
22
25
  return new ContractReadNode({
23
26
  ...obj,
24
27
  type: NodeType.ContractRead,
25
28
  data: data,
29
+ input: input,
26
30
  });
27
31
  }
28
32
  toRequest() {
29
33
  const request = new avs_pb.TaskNode();
30
34
  request.setId(this.id);
31
35
  request.setName(this.name);
32
- const nodeData = new avs_pb.ContractReadNode();
36
+ const node = new avs_pb.ContractReadNode();
33
37
  const config = new avs_pb.ContractReadNode.Config();
34
38
  config.setContractAddress(this.data.contractAddress);
35
39
  config.setContractAbi(this.data.contractAbi);
@@ -43,8 +47,13 @@ class ContractReadNode extends Node {
43
47
  }
44
48
  config.addMethodCalls(methodCallMsg);
45
49
  });
46
- nodeData.setConfig(config);
47
- request.setContractRead(nodeData);
50
+ node.setConfig(config);
51
+ // Set input data if provided
52
+ const inputValue = convertInputToProtobuf(this.input);
53
+ if (inputValue) {
54
+ node.setInput(inputValue);
55
+ }
56
+ request.setContractRead(node);
48
57
  return request;
49
58
  }
50
59
  static fromOutputData(outputData) {
@@ -1 +1 @@
1
- {"version":3,"file":"contractWrite.d.ts","sourceRoot":"","sources":["../../../src/models/node/contractWrite.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAmC,sBAAsB,EAAa,MAAM,oBAAoB,CAAC;AAKxG,cAAM,iBAAkB,SAAQ,IAAI;gBACtB,KAAK,EAAE,sBAAsB;IAIzC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,iBAAiB;IAuB5D,SAAS,IAAI,MAAM,CAAC,QAAQ;IA+B5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAyDrE;AAED,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"contractWrite.d.ts","sourceRoot":"","sources":["../../../src/models/node/contractWrite.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAmC,sBAAsB,EAAa,MAAM,oBAAoB,CAAC;AAMxG,cAAM,iBAAkB,SAAQ,IAAI;gBACtB,KAAK,EAAE,sBAAsB;IAIzC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,iBAAiB;IA2B5D,SAAS,IAAI,MAAM,CAAC,QAAQ;IAqC5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAyDrE;AAED,eAAe,iBAAiB,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import Node from "./interface";
2
2
  import * as avs_pb from "@/grpc_codegen/avs_pb";
3
3
  import { NodeType } from "@avaprotocol/types";
4
+ import { convertInputToProtobuf, extractInputFromProtobuf } from "../../utils";
4
5
  // Required props for constructor: id, name, type and data: { config: { contractAddress, callData, contractAbi, methodCallsList? } }
5
6
  class ContractWriteNode extends Node {
6
7
  constructor(props) {
@@ -20,17 +21,20 @@ class ContractWriteNode extends Node {
20
21
  methodName: call.methodName,
21
22
  })) || [],
22
23
  };
24
+ // Extract input data if present
25
+ const input = extractInputFromProtobuf(raw.getContractWrite()?.getInput());
23
26
  return new ContractWriteNode({
24
27
  ...obj,
25
28
  type: NodeType.ContractWrite,
26
29
  data: data,
30
+ input: input,
27
31
  });
28
32
  }
29
33
  toRequest() {
30
34
  const request = new avs_pb.TaskNode();
31
35
  request.setId(this.id);
32
36
  request.setName(this.name);
33
- const nodeData = new avs_pb.ContractWriteNode();
37
+ const node = new avs_pb.ContractWriteNode();
34
38
  const config = new avs_pb.ContractWriteNode.Config();
35
39
  config.setContractAddress(this.data.contractAddress);
36
40
  config.setCallData(this.data.callData);
@@ -45,8 +49,13 @@ class ContractWriteNode extends Node {
45
49
  }
46
50
  config.addMethodCalls(methodCallMsg);
47
51
  });
48
- nodeData.setConfig(config);
49
- request.setContractWrite(nodeData);
52
+ node.setConfig(config);
53
+ // Set input data if provided
54
+ const inputValue = convertInputToProtobuf(this.input);
55
+ if (inputValue) {
56
+ node.setInput(inputValue);
57
+ }
58
+ request.setContractWrite(node);
50
59
  return request;
51
60
  }
52
61
  static fromOutputData(outputData) {
@@ -1 +1 @@
1
- {"version":3,"file":"customCode.d.ts","sourceRoot":"","sources":["../../../src/models/node/customCode.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAIL,mBAAmB,EAEpB,MAAM,oBAAoB,CAAC;AAK5B,cAAM,cAAe,SAAQ,IAAI;gBACnB,KAAK,EAAE,mBAAmB;IAItC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,cAAc;IAmBzD,SAAS,IAAI,MAAM,CAAC,QAAQ;IAqB5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAkBrE;AAED,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"customCode.d.ts","sourceRoot":"","sources":["../../../src/models/node/customCode.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAIL,mBAAmB,EAEpB,MAAM,oBAAoB,CAAC;AAK5B,cAAM,cAAe,SAAQ,IAAI;gBACnB,KAAK,EAAE,mBAAmB;IAItC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,cAAc;IAuBzD,SAAS,IAAI,MAAM,CAAC,QAAQ;IA2B5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAkBrE;AAED,eAAe,cAAc,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import Node from "./interface";
2
2
  import * as avs_pb from "@/grpc_codegen/avs_pb";
3
3
  import { NodeType, } from "@avaprotocol/types";
4
- import { convertProtobufValueToJs } from "../../utils";
4
+ import { convertProtobufValueToJs, convertInputToProtobuf, extractInputFromProtobuf } from "../../utils";
5
5
  // Required props for constructor: id, name, type and data: { lang: number, source: string }
6
6
  class CustomCodeNode extends Node {
7
7
  constructor(props) {
@@ -16,23 +16,31 @@ class CustomCodeNode extends Node {
16
16
  lang: rawConfig.lang,
17
17
  source: rawConfig.source,
18
18
  };
19
+ // Extract input data if present
20
+ const input = extractInputFromProtobuf(raw.getCustomCode()?.getInput());
19
21
  return new CustomCodeNode({
20
22
  ...obj,
21
23
  type: NodeType.CustomCode,
22
24
  data: convertedConfig,
25
+ input: input,
23
26
  });
24
27
  }
25
28
  toRequest() {
26
29
  const request = new avs_pb.TaskNode();
27
30
  request.setId(this.id);
28
31
  request.setName(this.name);
29
- const nodeData = new avs_pb.CustomCodeNode();
32
+ const node = new avs_pb.CustomCodeNode();
30
33
  const config = new avs_pb.CustomCodeNode.Config();
31
34
  // Set lang using enum value (cast to protobuf Lang type)
32
35
  config.setLang(this.data.lang);
33
36
  config.setSource(this.data.source);
34
- nodeData.setConfig(config);
35
- request.setCustomCode(nodeData);
37
+ node.setConfig(config);
38
+ // Set input data if provided
39
+ const inputValue = convertInputToProtobuf(this.input);
40
+ if (inputValue) {
41
+ node.setInput(inputValue);
42
+ }
43
+ request.setCustomCode(node);
36
44
  return request;
37
45
  }
38
46
  static fromOutputData(outputData) {
@@ -1 +1 @@
1
- {"version":3,"file":"ethTransfer.d.ts","sourceRoot":"","sources":["../../../src/models/node/ethTransfer.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAiC,oBAAoB,EAAa,MAAM,oBAAoB,CAAC;AAKpG,cAAM,eAAgB,SAAQ,IAAI;gBACpB,KAAK,EAAE,oBAAoB;IAIvC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,eAAe;IAU1D,SAAS,IAAI,MAAM,CAAC,QAAQ;IAkB5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAIrE;AAED,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"ethTransfer.d.ts","sourceRoot":"","sources":["../../../src/models/node/ethTransfer.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAiC,oBAAoB,EAAa,MAAM,oBAAoB,CAAC;AAMpG,cAAM,eAAgB,SAAQ,IAAI;gBACpB,KAAK,EAAE,oBAAoB;IAIvC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,eAAe;IAe1D,SAAS,IAAI,MAAM,CAAC,QAAQ;IAwB5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAIrE;AAED,eAAe,eAAe,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import Node from "./interface";
2
2
  import * as avs_pb from "@/grpc_codegen/avs_pb";
3
3
  import { NodeType } from "@avaprotocol/types";
4
+ import { convertInputToProtobuf, extractInputFromProtobuf } from "../../utils";
4
5
  // Required props for constructor: id, name, type and data: { destination, amount }
5
6
  class ETHTransferNode extends Node {
6
7
  constructor(props) {
@@ -9,22 +10,30 @@ class ETHTransferNode extends Node {
9
10
  static fromResponse(raw) {
10
11
  // Convert the raw object to ETHTransferNodeProps, which should keep name and id
11
12
  const obj = raw.toObject();
13
+ // Extract input data if present
14
+ const input = extractInputFromProtobuf(raw.getEthTransfer()?.getInput());
12
15
  return new ETHTransferNode({
13
16
  ...obj,
14
17
  type: NodeType.ETHTransfer,
15
18
  data: raw.getEthTransfer().getConfig().toObject(),
19
+ input: input,
16
20
  });
17
21
  }
18
22
  toRequest() {
19
23
  const request = new avs_pb.TaskNode();
20
24
  request.setId(this.id);
21
25
  request.setName(this.name);
22
- const nodeData = new avs_pb.ETHTransferNode();
26
+ const node = new avs_pb.ETHTransferNode();
23
27
  const config = new avs_pb.ETHTransferNode.Config();
24
28
  config.setDestination(this.data.destination);
25
29
  config.setAmount(this.data.amount);
26
- nodeData.setConfig(config);
27
- request.setEthTransfer(nodeData);
30
+ node.setConfig(config);
31
+ // Set input data if provided
32
+ const inputValue = convertInputToProtobuf(this.input);
33
+ if (inputValue) {
34
+ node.setInput(inputValue);
35
+ }
36
+ request.setEthTransfer(node);
28
37
  return request;
29
38
  }
30
39
  static fromOutputData(outputData) {
@@ -1 +1 @@
1
- {"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../../src/models/node/filter.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAA4B,eAAe,EAAa,MAAM,oBAAoB,CAAC;AAK1F,cAAM,UAAW,SAAQ,IAAI;gBACf,KAAK,EAAE,eAAe;IAIlC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,UAAU;IAUrD,SAAS,IAAI,MAAM,CAAC,QAAQ;IAiB5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAIrE;AAED,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../../src/models/node/filter.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAA4B,eAAe,EAAa,MAAM,oBAAoB,CAAC;AAM1F,cAAM,UAAW,SAAQ,IAAI;gBACf,KAAK,EAAE,eAAe;IAIlC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,UAAU;IAerD,SAAS,IAAI,MAAM,CAAC,QAAQ;IAuB5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAIrE;AAED,eAAe,UAAU,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import Node from "./interface";
2
2
  import * as avs_pb from "@/grpc_codegen/avs_pb";
3
3
  import { NodeType } from "@avaprotocol/types";
4
+ import { convertInputToProtobuf, extractInputFromProtobuf } from "../../utils";
4
5
  // Required props for constructor: id, name, type and data: { expression, sourceId }
5
6
  class FilterNode extends Node {
6
7
  constructor(props) {
@@ -9,22 +10,30 @@ class FilterNode extends Node {
9
10
  static fromResponse(raw) {
10
11
  // Convert the raw object to FilterNodeProps, which should keep name and id
11
12
  const obj = raw.toObject();
13
+ // Extract input data if present
14
+ const input = extractInputFromProtobuf(raw.getFilter()?.getInput());
12
15
  return new FilterNode({
13
16
  ...obj,
14
17
  type: NodeType.Filter,
15
18
  data: raw.getFilter().getConfig().toObject(),
19
+ input: input,
16
20
  });
17
21
  }
18
22
  toRequest() {
19
23
  const request = new avs_pb.TaskNode();
20
24
  request.setId(this.id);
21
25
  request.setName(this.name);
22
- const nodeData = new avs_pb.FilterNode();
26
+ const node = new avs_pb.FilterNode();
23
27
  const config = new avs_pb.FilterNode.Config();
24
28
  config.setExpression(this.data.expression);
25
29
  config.setSourceId(this.data.sourceId || '');
26
- nodeData.setConfig(config);
27
- request.setFilter(nodeData);
30
+ node.setConfig(config);
31
+ // Set input data if provided
32
+ const inputValue = convertInputToProtobuf(this.input);
33
+ if (inputValue) {
34
+ node.setInput(inputValue);
35
+ }
36
+ request.setFilter(node);
28
37
  return request;
29
38
  }
30
39
  static fromOutputData(outputData) {
@@ -1 +1 @@
1
- {"version":3,"file":"graphqlQuery.d.ts","sourceRoot":"","sources":["../../../src/models/node/graphqlQuery.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAkC,qBAAqB,EAAa,MAAM,oBAAoB,CAAC;AAKtG,cAAM,gBAAiB,SAAQ,IAAI;gBACrB,KAAK,EAAE,qBAAqB;IAQxC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,gBAAgB;IAU3D,SAAS,IAAI,MAAM,CAAC,QAAQ;IA2B5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAIrE;AAED,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"graphqlQuery.d.ts","sourceRoot":"","sources":["../../../src/models/node/graphqlQuery.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAkC,qBAAqB,EAAa,MAAM,oBAAoB,CAAC;AAMtG,cAAM,gBAAiB,SAAQ,IAAI;gBACrB,KAAK,EAAE,qBAAqB;IAQxC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,gBAAgB;IAe3D,SAAS,IAAI,MAAM,CAAC,QAAQ;IAiC5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAIrE;AAED,eAAe,gBAAgB,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import Node from "./interface";
2
2
  import * as avs_pb from "@/grpc_codegen/avs_pb";
3
3
  import { NodeType } from "@avaprotocol/types";
4
+ import { convertInputToProtobuf, extractInputFromProtobuf } from "../../utils";
4
5
  // Required props for constructor: id, name, type and data: { url, query, variablesMap }
5
6
  class GraphQLQueryNode extends Node {
6
7
  constructor(props) {
@@ -13,17 +14,20 @@ class GraphQLQueryNode extends Node {
13
14
  static fromResponse(raw) {
14
15
  // Convert the raw object to GraphQLQueryNodeProps, which should keep name and id
15
16
  const obj = raw.toObject();
17
+ // Extract input data if present
18
+ const input = extractInputFromProtobuf(raw.getGraphqlQuery()?.getInput());
16
19
  return new GraphQLQueryNode({
17
20
  ...obj,
18
21
  type: NodeType.GraphQLQuery,
19
22
  data: raw.getGraphqlQuery().getConfig().toObject(),
23
+ input: input,
20
24
  });
21
25
  }
22
26
  toRequest() {
23
27
  const request = new avs_pb.TaskNode();
24
28
  request.setId(this.id);
25
29
  request.setName(this.name);
26
- const nodeData = new avs_pb.GraphQLQueryNode();
30
+ const node = new avs_pb.GraphQLQueryNode();
27
31
  const config = new avs_pb.GraphQLQueryNode.Config();
28
32
  config.setUrl(this.data.url);
29
33
  config.setQuery(this.data.query);
@@ -34,8 +38,13 @@ class GraphQLQueryNode extends Node {
34
38
  variablesMap.set(key, value);
35
39
  });
36
40
  }
37
- nodeData.setConfig(config);
38
- request.setGraphqlQuery(nodeData);
41
+ node.setConfig(config);
42
+ // Set input data if provided
43
+ const inputValue = convertInputToProtobuf(this.input);
44
+ if (inputValue) {
45
+ node.setInput(inputValue);
46
+ }
47
+ request.setGraphqlQuery(node);
39
48
  return request;
40
49
  }
41
50
  static fromOutputData(outputData) {
@@ -8,13 +8,14 @@ export declare const ProtobufNodePropsUtils: {
8
8
  getGoStringType: (props: ProtobufNodeProps) => string;
9
9
  fromGoStringType: (goStringType: string, baseProps: Omit<ProtobufNodeProps, "type">) => ProtobufNodeProps;
10
10
  };
11
- declare class Node implements NodeProps {
11
+ export default abstract class Node implements NodeProps {
12
12
  id: string;
13
13
  name: string;
14
14
  type: NodeType;
15
15
  data: NodeData;
16
+ input?: Record<string, any>;
16
17
  constructor(props: NodeProps);
17
18
  toRequest(): avs_pb.TaskNode;
19
+ static fromResponse(raw: avs_pb.TaskNode): Node;
18
20
  }
19
- export default Node;
20
21
  //# sourceMappingURL=interface.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../src/models/node/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAA0C,SAAS,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAI3G,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,YAAY,GACnC,QAAQ,CAeV;AAGD,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAClC,MAAM,CAAC,QAAQ,CAAC,QAAQ,EACtB,aAAa,GACb,eAAe,GACf,cAAc,GACd,kBAAkB,GAClB,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,YAAY,CACf,GAAG;IAEF,IAAI,EAAE,GAAG,CAAC;CACX,CAAC;AAGF,eAAO,MAAM,sBAAsB;6BAER,iBAAiB,KAAG,MAAM;qCAKlB,MAAM,aAAa,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAC,KAAG,iBAAiB;CAMxG,CAAC;AAEF,cAAM,IAAK,YAAW,SAAS;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,QAAQ,CAAC;gBAEH,KAAK,EAAE,SAAS;IAO5B,SAAS,IAAI,MAAM,CAAC,QAAQ;CAU7B;AAED,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../src/models/node/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAA0C,SAAS,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAK3G,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,YAAY,GACnC,QAAQ,CAeV;AAGD,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAClC,MAAM,CAAC,QAAQ,CAAC,QAAQ,EACtB,aAAa,GACb,eAAe,GACf,cAAc,GACd,kBAAkB,GAClB,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,YAAY,CACf,GAAG;IAEF,IAAI,EAAE,GAAG,CAAC;CACX,CAAC;AAGF,eAAO,MAAM,sBAAsB;6BAER,iBAAiB,KAAG,MAAM;qCAKlB,MAAM,aAAa,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAC,KAAG,iBAAiB;CAMxG,CAAC;AAEF,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,IAAK,YAAW,SAAS;IACrD,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;gBAEhB,KAAK,EAAE,SAAS;IAS5B,SAAS,IAAI,MAAM,CAAC,QAAQ;IAW5B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,IAAI;CAehD"}
@@ -1,6 +1,7 @@
1
1
  import * as avs_pb from "@/grpc_codegen/avs_pb";
2
2
  import { NodeType, NodeTypeGoConverter } from "@avaprotocol/types";
3
3
  import _ from "lodash";
4
+ import { extractInputFromProtobuf } from "../../utils";
4
5
  // Function to convert TaskStatus to string
5
6
  export function covertNodeTypeToString(status) {
6
7
  const conversionMap = {
@@ -31,12 +32,14 @@ export const ProtobufNodePropsUtils = {
31
32
  };
32
33
  }
33
34
  };
34
- class Node {
35
+ export default class Node {
35
36
  constructor(props) {
36
37
  this.id = props.id;
37
38
  this.name = props.name;
38
39
  this.type = props.type;
39
40
  this.data = props.data;
41
+ // Convert from protobuf AsObject to JavaScript object if needed
42
+ this.input = props.input ? extractInputFromProtobuf(props.input) : undefined;
40
43
  }
41
44
  toRequest() {
42
45
  const request = new avs_pb.TaskNode();
@@ -47,5 +50,17 @@ class Node {
47
50
  }
48
51
  return request;
49
52
  }
53
+ static fromResponse(raw) {
54
+ // Convert the raw object to NodeProps, which should keep name and id
55
+ const obj = raw.toObject();
56
+ // Extract input data using the utility function
57
+ let input = undefined;
58
+ if (raw.hasInput()) {
59
+ input = raw.getInput().toObject();
60
+ }
61
+ return new this({
62
+ ...obj,
63
+ input: input,
64
+ });
65
+ }
50
66
  }
51
- export default Node;
@@ -1 +1 @@
1
- {"version":3,"file":"loop.d.ts","sourceRoot":"","sources":["../../../src/models/node/loop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,EAGL,aAAa,EAEd,MAAM,oBAAoB,CAAC;AAI5B,cAAM,QAAS,SAAQ,IAAI;gBACb,KAAK,EAAE,aAAa;IAIhC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,QAAQ;IA+BnD,SAAS,IAAI,MAAM,CAAC,QAAQ;IAuI5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAuCrE;AAED,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"loop.d.ts","sourceRoot":"","sources":["../../../src/models/node/loop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,EAGL,aAAa,EAEd,MAAM,oBAAoB,CAAC;AAI5B,cAAM,QAAS,SAAQ,IAAI;gBACb,KAAK,EAAE,aAAa;IAIhC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,QAAQ;IAmCnD,SAAS,IAAI,MAAM,CAAC,QAAQ;IA6I5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAuCrE;AAED,eAAe,QAAQ,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import * as avs_pb from "@/grpc_codegen/avs_pb";
2
2
  import Node from "./interface";
3
3
  import { NodeType, } from "@avaprotocol/types";
4
+ import { convertInputToProtobuf, extractInputFromProtobuf } from "../../utils";
4
5
  class LoopNode extends Node {
5
6
  constructor(props) {
6
7
  super({ ...props, type: NodeType.Loop, data: props.data });
@@ -26,10 +27,13 @@ class LoopNode extends Node {
26
27
  contractWrite: loopNodeData.contractWrite,
27
28
  graphqlDataQuery: loopNodeData.graphqlDataQuery,
28
29
  };
30
+ // Extract input data if present
31
+ const input = extractInputFromProtobuf(raw.getLoop()?.getInput());
29
32
  return new LoopNode({
30
33
  ...obj,
31
34
  type: NodeType.Loop,
32
35
  data: data,
36
+ input: input,
33
37
  });
34
38
  }
35
39
  toRequest() {
@@ -44,6 +48,11 @@ class LoopNode extends Node {
44
48
  config.setIterVal(data.iterVal || "");
45
49
  config.setIterKey(data.iterKey || "");
46
50
  loopNode.setConfig(config);
51
+ // Set input data if provided
52
+ const inputValue = convertInputToProtobuf(this.input);
53
+ if (inputValue) {
54
+ loopNode.setInput(inputValue);
55
+ }
47
56
  // Handle nested nodes - these still use the nested structure within LoopNodeData
48
57
  if (data.ethTransfer) {
49
58
  const ethTransfer = new avs_pb.ETHTransferNode();
@@ -1 +1 @@
1
- {"version":3,"file":"restApi.d.ts","sourceRoot":"","sources":["../../../src/models/node/restApi.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAIL,gBAAgB,EAEjB,MAAM,oBAAoB,CAAC;AAM5B,cAAM,WAAY,SAAQ,IAAI;gBAChB,KAAK,EAAE,gBAAgB;IAInC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,WAAW;IAUtD,SAAS,IAAI,MAAM,CAAC,QAAQ;IAgC5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAerE;AAED,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"restApi.d.ts","sourceRoot":"","sources":["../../../src/models/node/restApi.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAGL,gBAAgB,EAEjB,MAAM,oBAAoB,CAAC;AAS5B,cAAM,WAAY,SAAQ,IAAI;gBAChB,KAAK,EAAE,gBAAgB;IAInC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,WAAW;IAmBtD,SAAS,IAAI,MAAM,CAAC,QAAQ;IAyC5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAerE;AAED,eAAe,WAAW,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import Node from "./interface";
2
2
  import * as avs_pb from "@/grpc_codegen/avs_pb";
3
3
  import { NodeType, } from "@avaprotocol/types";
4
- import { convertProtobufValueToJs } from "../../utils";
4
+ import { convertProtobufValueToJs, convertInputToProtobuf, extractInputFromProtobuf, } from "../../utils";
5
5
  // Required props for constructor: id, name, type and data: { url, method, headersMap, body }
6
6
  class RestAPINode extends Node {
7
7
  constructor(props) {
@@ -10,10 +10,17 @@ class RestAPINode extends Node {
10
10
  static fromResponse(raw) {
11
11
  // Convert the raw object to RestAPINodeProps, which should keep name and id
12
12
  const obj = raw.toObject();
13
+ // Extract input data from top-level TaskNode.input field (not nested RestAPINode.input)
14
+ // This matches where we set it in toRequest() and where the Go backend looks for it
15
+ let input = undefined;
16
+ if (raw.hasInput()) {
17
+ input = extractInputFromProtobuf(raw.getInput());
18
+ }
13
19
  return new RestAPINode({
14
20
  ...obj,
15
21
  type: NodeType.RestAPI,
16
22
  data: raw.getRestApi().getConfig().toObject(),
23
+ input: input, // Include input data from top-level TaskNode
17
24
  });
18
25
  }
19
26
  toRequest() {
@@ -33,6 +40,13 @@ class RestAPINode extends Node {
33
40
  });
34
41
  }
35
42
  nodeData.setConfig(config);
43
+ // Use the standard utility function to convert input field to protobuf format
44
+ const inputValue = convertInputToProtobuf(this.input);
45
+ if (inputValue) {
46
+ // Set input on the top-level TaskNode, not the nested RestAPINode
47
+ // This matches where the Go backend's ExtractNodeInputData() looks for it
48
+ request.setInput(inputValue);
49
+ }
36
50
  request.setRestApi(nodeData);
37
51
  return request;
38
52
  }
@@ -8,6 +8,7 @@ declare class Step implements StepProps {
8
8
  error: string;
9
9
  log: string;
10
10
  inputsList: string[];
11
+ input?: any;
11
12
  output: OutputDataProps;
12
13
  startAt: number;
13
14
  endAt: number;
@@ -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,EAAE,eAAe,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;gBAEF,KAAK,EAAE,SAAS;IAa5B;;;OAGG;IACH,MAAM,IAAI,SAAS;IAenB,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI,GAAG,eAAe;IAgQ9D,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI,GAAG,IAAI;CAgBvD;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,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,MAAM,EAAE,eAAe,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;gBAEF,KAAK,EAAE,SAAS;IAc5B;;;OAGG;IACH,MAAM,IAAI,SAAS;IAgBnB,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI,GAAG,eAAe;IA+S9D,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI,GAAG,IAAI;CAkFvD;AAED,eAAe,IAAI,CAAC"}