@avaprotocol/sdk-js 2.4.3 → 2.5.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.
- package/CHANGELOG.md +19 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +791 -255
- package/dist/index.mjs +799 -258
- package/dist/models/node/contractRead.d.ts +14 -0
- package/dist/models/node/contractRead.d.ts.map +1 -1
- package/dist/models/node/contractRead.js +27 -18
- package/dist/models/node/contractWrite.d.ts +14 -0
- package/dist/models/node/contractWrite.d.ts.map +1 -1
- package/dist/models/node/contractWrite.js +25 -16
- package/dist/models/node/customCode.d.ts +10 -1
- package/dist/models/node/customCode.d.ts.map +1 -1
- package/dist/models/node/customCode.js +19 -9
- package/dist/models/node/ethTransfer.d.ts +9 -0
- package/dist/models/node/ethTransfer.d.ts.map +1 -1
- package/dist/models/node/ethTransfer.js +14 -5
- package/dist/models/node/filter.d.ts.map +1 -1
- package/dist/models/node/filter.js +22 -3
- package/dist/models/node/graphqlQuery.d.ts +10 -0
- package/dist/models/node/graphqlQuery.d.ts.map +1 -1
- package/dist/models/node/graphqlQuery.js +20 -12
- package/dist/models/node/loop.d.ts +5 -1
- package/dist/models/node/loop.d.ts.map +1 -1
- package/dist/models/node/loop.js +151 -99
- package/dist/models/node/restApi.d.ts +11 -0
- package/dist/models/node/restApi.d.ts.map +1 -1
- package/dist/models/node/restApi.js +21 -13
- package/dist/models/step.d.ts.map +1 -1
- package/dist/models/step.js +239 -21
- package/dist/models/trigger/manual.d.ts +6 -10
- package/dist/models/trigger/manual.d.ts.map +1 -1
- package/dist/models/trigger/manual.js +108 -25
- package/dist/models/workflow.d.ts.map +1 -1
- package/dist/models/workflow.js +0 -2
- package/dist/utils.d.ts +0 -14
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +0 -62
- package/package.json +2 -2
|
@@ -3,6 +3,20 @@ import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
|
3
3
|
import { ContractReadNodeProps } from "@avaprotocol/types";
|
|
4
4
|
declare class ContractReadNode extends Node {
|
|
5
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: {
|
|
12
|
+
contractAddress: string;
|
|
13
|
+
contractAbi: string;
|
|
14
|
+
methodCalls?: Array<{
|
|
15
|
+
callData: string;
|
|
16
|
+
methodName?: string;
|
|
17
|
+
applyToFields?: string[];
|
|
18
|
+
}>;
|
|
19
|
+
}): avs_pb.ContractReadNode;
|
|
6
20
|
static fromResponse(raw: avs_pb.TaskNode): ContractReadNode;
|
|
7
21
|
toRequest(): avs_pb.TaskNode;
|
|
8
22
|
static fromOutputData(outputData: avs_pb.RunNodeWithInputsResp): any;
|
|
@@ -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,EAGL,qBAAqB,EAEtB,MAAM,oBAAoB,CAAC;AAS5B,cAAM,gBAAiB,SAAQ,IAAI;gBACrB,KAAK,EAAE,qBAAqB;IAIxC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,gBAAgB;IAgC3D,SAAS,IAAI,MAAM,CAAC,QAAQ;
|
|
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,EAGL,qBAAqB,EAEtB,MAAM,oBAAoB,CAAC;AAS5B,cAAM,gBAAiB,SAAQ,IAAI;gBACrB,KAAK,EAAE,qBAAqB;IAIxC;;;;OAIG;IACH,MAAM,CAAC,kBAAkB,CAAC,UAAU,EAAE;QACpC,eAAe,EAAE,MAAM,CAAC;QACxB,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,CAAC,EAAE,KAAK,CAAC;YAClB,QAAQ,EAAE,MAAM,CAAC;YACjB,UAAU,CAAC,EAAE,MAAM,CAAC;YACpB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;SAC1B,CAAC,CAAC;KACJ,GAAG,MAAM,CAAC,gBAAgB;IAyB3B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,gBAAgB;IAgC3D,SAAS,IAAI,MAAM,CAAC,QAAQ;IAsB5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAyBrE;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -7,6 +7,32 @@ class ContractReadNode extends Node {
|
|
|
7
7
|
constructor(props) {
|
|
8
8
|
super({ ...props, type: NodeType.ContractRead, data: props.data });
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Create a protobuf ContractReadNode from config data
|
|
12
|
+
* @param configData - The configuration data for the contract read node
|
|
13
|
+
* @returns Configured avs_pb.ContractReadNode
|
|
14
|
+
*/
|
|
15
|
+
static createProtobufNode(configData) {
|
|
16
|
+
const node = new avs_pb.ContractReadNode();
|
|
17
|
+
const config = new avs_pb.ContractReadNode.Config();
|
|
18
|
+
config.setContractAddress(configData.contractAddress);
|
|
19
|
+
config.setContractAbi(configData.contractAbi);
|
|
20
|
+
// Handle method calls array
|
|
21
|
+
const methodCalls = configData.methodCalls || [];
|
|
22
|
+
methodCalls.forEach((methodCall) => {
|
|
23
|
+
const methodCallMsg = new avs_pb.ContractReadNode.MethodCall();
|
|
24
|
+
methodCallMsg.setCallData(methodCall.callData);
|
|
25
|
+
if (methodCall.methodName) {
|
|
26
|
+
methodCallMsg.setMethodName(methodCall.methodName);
|
|
27
|
+
}
|
|
28
|
+
if (methodCall.applyToFields) {
|
|
29
|
+
methodCallMsg.setApplyToFieldsList(methodCall.applyToFields);
|
|
30
|
+
}
|
|
31
|
+
config.addMethodCalls(methodCallMsg);
|
|
32
|
+
});
|
|
33
|
+
node.setConfig(config);
|
|
34
|
+
return node;
|
|
35
|
+
}
|
|
10
36
|
static fromResponse(raw) {
|
|
11
37
|
// Convert the raw object to ContractReadNodeProps, which should keep name and id
|
|
12
38
|
const obj = raw.toObject();
|
|
@@ -38,24 +64,7 @@ class ContractReadNode extends Node {
|
|
|
38
64
|
const request = new avs_pb.TaskNode();
|
|
39
65
|
request.setId(this.id);
|
|
40
66
|
request.setName(this.name);
|
|
41
|
-
const node =
|
|
42
|
-
const config = new avs_pb.ContractReadNode.Config();
|
|
43
|
-
config.setContractAddress(this.data.contractAddress);
|
|
44
|
-
config.setContractAbi(this.data.contractAbi);
|
|
45
|
-
// Handle method calls array
|
|
46
|
-
const methodCalls = this.data.methodCalls || [];
|
|
47
|
-
methodCalls.forEach((methodCall) => {
|
|
48
|
-
const methodCallMsg = new avs_pb.ContractReadNode.MethodCall();
|
|
49
|
-
methodCallMsg.setCallData(methodCall.callData);
|
|
50
|
-
if (methodCall.methodName) {
|
|
51
|
-
methodCallMsg.setMethodName(methodCall.methodName);
|
|
52
|
-
}
|
|
53
|
-
if (methodCall.applyToFields) {
|
|
54
|
-
methodCallMsg.setApplyToFieldsList(methodCall.applyToFields);
|
|
55
|
-
}
|
|
56
|
-
config.addMethodCalls(methodCallMsg);
|
|
57
|
-
});
|
|
58
|
-
node.setConfig(config);
|
|
67
|
+
const node = ContractReadNode.createProtobufNode(this.data);
|
|
59
68
|
// Set input data on the top-level TaskNode, not the nested ContractReadNode
|
|
60
69
|
// This matches where the Go backend's ExtractNodeInputData() looks for it
|
|
61
70
|
const inputValue = convertInputToProtobuf(this.input);
|
|
@@ -3,6 +3,20 @@ import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
|
3
3
|
import { ContractWriteNodeProps } from "@avaprotocol/types";
|
|
4
4
|
declare class ContractWriteNode extends Node {
|
|
5
5
|
constructor(props: ContractWriteNodeProps);
|
|
6
|
+
/**
|
|
7
|
+
* Create a protobuf ContractWriteNode from config data
|
|
8
|
+
* @param configData - The configuration data for the contract write node
|
|
9
|
+
* @returns Configured avs_pb.ContractWriteNode
|
|
10
|
+
*/
|
|
11
|
+
static createProtobufNode(configData: {
|
|
12
|
+
contractAddress: string;
|
|
13
|
+
callData: string;
|
|
14
|
+
contractAbi: string;
|
|
15
|
+
methodCalls?: Array<{
|
|
16
|
+
callData: string;
|
|
17
|
+
methodName?: string;
|
|
18
|
+
}>;
|
|
19
|
+
}): avs_pb.ContractWriteNode;
|
|
6
20
|
static fromResponse(raw: avs_pb.TaskNode): ContractWriteNode;
|
|
7
21
|
toRequest(): avs_pb.TaskNode;
|
|
8
22
|
static fromOutputData(outputData: avs_pb.RunNodeWithInputsResp): any;
|
|
@@ -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,EAGL,sBAAsB,EAEvB,MAAM,oBAAoB,CAAC;AAM5B,cAAM,iBAAkB,SAAQ,IAAI;gBACtB,KAAK,EAAE,sBAAsB;IAIzC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,iBAAiB;IAgC5D,SAAS,IAAI,MAAM,CAAC,QAAQ;
|
|
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,EAGL,sBAAsB,EAEvB,MAAM,oBAAoB,CAAC;AAM5B,cAAM,iBAAkB,SAAQ,IAAI;gBACtB,KAAK,EAAE,sBAAsB;IAIzC;;;;OAIG;IACH,MAAM,CAAC,kBAAkB,CAAC,UAAU,EAAE;QACpC,eAAe,EAAE,MAAM,CAAC;QACxB,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,CAAC,EAAE,KAAK,CAAC;YAClB,QAAQ,EAAE,MAAM,CAAC;YACjB,UAAU,CAAC,EAAE,MAAM,CAAC;SACrB,CAAC,CAAC;KACJ,GAAG,MAAM,CAAC,iBAAiB;IAuB5B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,iBAAiB;IAgC5D,SAAS,IAAI,MAAM,CAAC,QAAQ;IAsB5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAcrE;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -8,6 +8,30 @@ class ContractWriteNode extends Node {
|
|
|
8
8
|
constructor(props) {
|
|
9
9
|
super({ ...props, type: NodeType.ContractWrite, data: props.data });
|
|
10
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Create a protobuf ContractWriteNode from config data
|
|
13
|
+
* @param configData - The configuration data for the contract write node
|
|
14
|
+
* @returns Configured avs_pb.ContractWriteNode
|
|
15
|
+
*/
|
|
16
|
+
static createProtobufNode(configData) {
|
|
17
|
+
const node = new avs_pb.ContractWriteNode();
|
|
18
|
+
const config = new avs_pb.ContractWriteNode.Config();
|
|
19
|
+
config.setContractAddress(configData.contractAddress);
|
|
20
|
+
config.setCallData(configData.callData);
|
|
21
|
+
config.setContractAbi(configData.contractAbi);
|
|
22
|
+
// Handle method calls array
|
|
23
|
+
const methodCalls = configData.methodCalls || [];
|
|
24
|
+
methodCalls.forEach((methodCall) => {
|
|
25
|
+
const methodCallMsg = new avs_pb.ContractWriteNode.MethodCall();
|
|
26
|
+
methodCallMsg.setCallData(methodCall.callData);
|
|
27
|
+
if (methodCall.methodName) {
|
|
28
|
+
methodCallMsg.setMethodName(methodCall.methodName);
|
|
29
|
+
}
|
|
30
|
+
config.addMethodCalls(methodCallMsg);
|
|
31
|
+
});
|
|
32
|
+
node.setConfig(config);
|
|
33
|
+
return node;
|
|
34
|
+
}
|
|
11
35
|
static fromResponse(raw) {
|
|
12
36
|
// Convert the raw object to ContractWriteNodeProps, which should keep name and id
|
|
13
37
|
const obj = raw.toObject();
|
|
@@ -39,22 +63,7 @@ class ContractWriteNode extends Node {
|
|
|
39
63
|
const request = new avs_pb.TaskNode();
|
|
40
64
|
request.setId(this.id);
|
|
41
65
|
request.setName(this.name);
|
|
42
|
-
const node =
|
|
43
|
-
const config = new avs_pb.ContractWriteNode.Config();
|
|
44
|
-
config.setContractAddress(this.data.contractAddress);
|
|
45
|
-
config.setCallData(this.data.callData);
|
|
46
|
-
config.setContractAbi(this.data.contractAbi);
|
|
47
|
-
// Handle method calls array
|
|
48
|
-
const methodCalls = this.data.methodCalls || [];
|
|
49
|
-
methodCalls.forEach((methodCall) => {
|
|
50
|
-
const methodCallMsg = new avs_pb.ContractWriteNode.MethodCall();
|
|
51
|
-
methodCallMsg.setCallData(methodCall.callData);
|
|
52
|
-
if (methodCall.methodName) {
|
|
53
|
-
methodCallMsg.setMethodName(methodCall.methodName);
|
|
54
|
-
}
|
|
55
|
-
config.addMethodCalls(methodCallMsg);
|
|
56
|
-
});
|
|
57
|
-
node.setConfig(config);
|
|
66
|
+
const node = ContractWriteNode.createProtobufNode(this.data);
|
|
58
67
|
// Set input data on the top-level TaskNode, not the nested ContractWriteNode
|
|
59
68
|
// This matches where the Go backend's ExtractNodeInputData() looks for it
|
|
60
69
|
const inputValue = convertInputToProtobuf(this.input);
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import Node from "./interface";
|
|
2
2
|
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
3
|
-
import { CustomCodeNodeProps } from "@avaprotocol/types";
|
|
3
|
+
import { CustomCodeLang, CustomCodeNodeProps } from "@avaprotocol/types";
|
|
4
4
|
declare class CustomCodeNode extends Node {
|
|
5
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;
|
|
6
15
|
static fromResponse(raw: avs_pb.TaskNode): CustomCodeNode;
|
|
7
16
|
toRequest(): avs_pb.TaskNode;
|
|
8
17
|
static fromOutputData(outputData: avs_pb.RunNodeWithInputsResp): any;
|
|
@@ -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,
|
|
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,EAGL,cAAc,EACd,mBAAmB,EAEpB,MAAM,oBAAoB,CAAC;AAS5B,cAAM,cAAe,SAAQ,IAAI;gBACnB,KAAK,EAAE,mBAAmB;IAItC;;;;OAIG;IACH,MAAM,CAAC,kBAAkB,CAAC,UAAU,EAAE;QACpC,IAAI,EAAE,cAAc,GAAG,MAAM,GAAG,MAAM,CAAC;QACvC,MAAM,EAAE,MAAM,CAAC;KAChB,GAAG,MAAM,CAAC,cAAc;IAYzB,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,cAAc;IA2BzD,SAAS,IAAI,MAAM,CAAC,QAAQ;IAsB5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAqBrE;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -1,12 +1,26 @@
|
|
|
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, convertInputToProtobuf, extractInputFromProtobuf } 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) {
|
|
8
8
|
super({ ...props, type: NodeType.CustomCode, data: props.data });
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Create a protobuf CustomCodeNode from config data
|
|
12
|
+
* @param configData - The configuration data for the custom code node
|
|
13
|
+
* @returns Configured avs_pb.CustomCodeNode
|
|
14
|
+
*/
|
|
15
|
+
static createProtobufNode(configData) {
|
|
16
|
+
const node = new avs_pb.CustomCodeNode();
|
|
17
|
+
const config = new avs_pb.CustomCodeNode.Config();
|
|
18
|
+
// Set lang using enum value (cast to protobuf Lang type)
|
|
19
|
+
config.setLang(configData.lang);
|
|
20
|
+
config.setSource(configData.source);
|
|
21
|
+
node.setConfig(config);
|
|
22
|
+
return node;
|
|
23
|
+
}
|
|
10
24
|
static fromResponse(raw) {
|
|
11
25
|
// Convert the raw object to CustomCodeNodeProps, which should keep name and id
|
|
12
26
|
const obj = raw.toObject();
|
|
@@ -33,12 +47,7 @@ class CustomCodeNode extends Node {
|
|
|
33
47
|
const request = new avs_pb.TaskNode();
|
|
34
48
|
request.setId(this.id);
|
|
35
49
|
request.setName(this.name);
|
|
36
|
-
const node =
|
|
37
|
-
const config = new avs_pb.CustomCodeNode.Config();
|
|
38
|
-
// Set lang using enum value (cast to protobuf Lang type)
|
|
39
|
-
config.setLang(this.data.lang);
|
|
40
|
-
config.setSource(this.data.source);
|
|
41
|
-
node.setConfig(config);
|
|
50
|
+
const node = CustomCodeNode.createProtobufNode(this.data);
|
|
42
51
|
// Set input data on the top-level TaskNode, not the nested CustomCodeNode
|
|
43
52
|
// This matches where the Go backend's ExtractNodeInputData() looks for it
|
|
44
53
|
const inputValue = convertInputToProtobuf(this.input);
|
|
@@ -55,9 +64,10 @@ class CustomCodeNode extends Node {
|
|
|
55
64
|
const result = convertProtobufValueToJs(customCodeOutput.getData());
|
|
56
65
|
// SPECIAL FIX: Check if the result is incorrectly wrapped with a single "data" property
|
|
57
66
|
// This handles the case where primitive values get wrapped as {"data": value}
|
|
58
|
-
if (result &&
|
|
67
|
+
if (result &&
|
|
68
|
+
typeof result === "object" &&
|
|
59
69
|
Object.keys(result).length === 1 &&
|
|
60
|
-
|
|
70
|
+
"data" in result) {
|
|
61
71
|
return result.data;
|
|
62
72
|
}
|
|
63
73
|
return result;
|
|
@@ -3,6 +3,15 @@ import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
|
3
3
|
import { ETHTransferNodeProps } from "@avaprotocol/types";
|
|
4
4
|
declare class ETHTransferNode extends Node {
|
|
5
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;
|
|
6
15
|
static fromResponse(raw: avs_pb.TaskNode): ETHTransferNode;
|
|
7
16
|
toRequest(): avs_pb.TaskNode;
|
|
8
17
|
static fromOutputData(outputData: avs_pb.RunNodeWithInputsResp): any;
|
|
@@ -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;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;
|
|
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;;;;OAIG;IACH,MAAM,CAAC,kBAAkB,CAAC,UAAU,EAAE;QACpC,WAAW,EAAE,MAAM,CAAC;QACpB,MAAM,EAAE,MAAM,CAAC;KAChB,GAAG,MAAM,CAAC,eAAe;IAW1B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,eAAe;IAe1D,SAAS,IAAI,MAAM,CAAC,QAAQ;IAqB5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAIrE;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -7,6 +7,19 @@ class ETHTransferNode extends Node {
|
|
|
7
7
|
constructor(props) {
|
|
8
8
|
super({ ...props, type: NodeType.ETHTransfer, data: props.data });
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Create a protobuf ETHTransferNode from config data
|
|
12
|
+
* @param configData - The configuration data for the ETH transfer node
|
|
13
|
+
* @returns Configured avs_pb.ETHTransferNode
|
|
14
|
+
*/
|
|
15
|
+
static createProtobufNode(configData) {
|
|
16
|
+
const node = new avs_pb.ETHTransferNode();
|
|
17
|
+
const config = new avs_pb.ETHTransferNode.Config();
|
|
18
|
+
config.setDestination(configData.destination);
|
|
19
|
+
config.setAmount(configData.amount);
|
|
20
|
+
node.setConfig(config);
|
|
21
|
+
return node;
|
|
22
|
+
}
|
|
10
23
|
static fromResponse(raw) {
|
|
11
24
|
// Convert the raw object to ETHTransferNodeProps, which should keep name and id
|
|
12
25
|
const obj = raw.toObject();
|
|
@@ -23,11 +36,7 @@ class ETHTransferNode extends Node {
|
|
|
23
36
|
const request = new avs_pb.TaskNode();
|
|
24
37
|
request.setId(this.id);
|
|
25
38
|
request.setName(this.name);
|
|
26
|
-
const node =
|
|
27
|
-
const config = new avs_pb.ETHTransferNode.Config();
|
|
28
|
-
config.setDestination(this.data.destination);
|
|
29
|
-
config.setAmount(this.data.amount);
|
|
30
|
-
node.setConfig(config);
|
|
39
|
+
const node = ETHTransferNode.createProtobufNode(this.data);
|
|
31
40
|
// Set input data if provided
|
|
32
41
|
const inputValue = convertInputToProtobuf(this.input);
|
|
33
42
|
if (inputValue) {
|
|
@@ -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,
|
|
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,EAGL,eAAe,EAEhB,MAAM,oBAAoB,CAAC;AAM5B,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;CAgCrE;AAED,eAAe,UAAU,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import Node from "./interface";
|
|
2
2
|
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
3
|
-
import { NodeType } from "@avaprotocol/types";
|
|
3
|
+
import { NodeType, } from "@avaprotocol/types";
|
|
4
4
|
import { convertInputToProtobuf, extractInputFromProtobuf } from "../../utils";
|
|
5
|
+
import { Value } from "google-protobuf/google/protobuf/struct_pb";
|
|
5
6
|
// Required props for constructor: id, name, type and data: { expression, sourceId }
|
|
6
7
|
class FilterNode extends Node {
|
|
7
8
|
constructor(props) {
|
|
@@ -26,7 +27,7 @@ class FilterNode extends Node {
|
|
|
26
27
|
const node = new avs_pb.FilterNode();
|
|
27
28
|
const config = new avs_pb.FilterNode.Config();
|
|
28
29
|
config.setExpression(this.data.expression);
|
|
29
|
-
config.setSourceId(this.data.sourceId ||
|
|
30
|
+
config.setSourceId(this.data.sourceId || "");
|
|
30
31
|
node.setConfig(config);
|
|
31
32
|
// Set input data if provided
|
|
32
33
|
const inputValue = convertInputToProtobuf(this.input);
|
|
@@ -38,7 +39,25 @@ class FilterNode extends Node {
|
|
|
38
39
|
}
|
|
39
40
|
static fromOutputData(outputData) {
|
|
40
41
|
const filterOutput = outputData.getFilter();
|
|
41
|
-
|
|
42
|
+
if (!filterOutput) {
|
|
43
|
+
throw new Error("FilterNode output data is missing");
|
|
44
|
+
}
|
|
45
|
+
const anyData = filterOutput.getData();
|
|
46
|
+
if (!anyData) {
|
|
47
|
+
throw new Error("FilterNode output data.getData() is missing");
|
|
48
|
+
}
|
|
49
|
+
// Unpack the Any to get the Value
|
|
50
|
+
const value = Value.deserializeBinary(anyData.getValue_asU8());
|
|
51
|
+
// Convert the Value to JavaScript
|
|
52
|
+
const result = value.toJavaScript();
|
|
53
|
+
// The result contains the entire response object, extract the data array
|
|
54
|
+
if (result &&
|
|
55
|
+
typeof result === "object" &&
|
|
56
|
+
!Array.isArray(result) &&
|
|
57
|
+
result.data) {
|
|
58
|
+
return result.data;
|
|
59
|
+
}
|
|
60
|
+
throw new Error("FilterNode output data does not contain expected data structure");
|
|
42
61
|
}
|
|
43
62
|
}
|
|
44
63
|
export default FilterNode;
|
|
@@ -3,6 +3,16 @@ import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
|
3
3
|
import { GraphQLQueryNodeProps } from "@avaprotocol/types";
|
|
4
4
|
declare class GraphQLQueryNode extends Node {
|
|
5
5
|
constructor(props: GraphQLQueryNodeProps);
|
|
6
|
+
/**
|
|
7
|
+
* Create a protobuf GraphQLQueryNode from config data
|
|
8
|
+
* @param configData - The configuration data for the GraphQL query node
|
|
9
|
+
* @returns Configured avs_pb.GraphQLQueryNode
|
|
10
|
+
*/
|
|
11
|
+
static createProtobufNode(configData: {
|
|
12
|
+
url: string;
|
|
13
|
+
query: string;
|
|
14
|
+
variablesMap?: Array<[string, string]>;
|
|
15
|
+
}): avs_pb.GraphQLQueryNode;
|
|
6
16
|
static fromResponse(raw: avs_pb.TaskNode): GraphQLQueryNode;
|
|
7
17
|
toRequest(): avs_pb.TaskNode;
|
|
8
18
|
static fromOutputData(outputData: avs_pb.RunNodeWithInputsResp): any;
|
|
@@ -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;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;
|
|
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;;;;OAIG;IACH,MAAM,CAAC,kBAAkB,CAAC,UAAU,EAAE;QACpC,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE,MAAM,CAAC;QACd,YAAY,CAAC,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;KACxC,GAAG,MAAM,CAAC,gBAAgB;IAkB3B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,gBAAgB;IAe3D,SAAS,IAAI,MAAM,CAAC,QAAQ;IAqB5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAIrE;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -11,6 +11,25 @@ class GraphQLQueryNode extends Node {
|
|
|
11
11
|
data: props.data,
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Create a protobuf GraphQLQueryNode from config data
|
|
16
|
+
* @param configData - The configuration data for the GraphQL query node
|
|
17
|
+
* @returns Configured avs_pb.GraphQLQueryNode
|
|
18
|
+
*/
|
|
19
|
+
static createProtobufNode(configData) {
|
|
20
|
+
const node = new avs_pb.GraphQLQueryNode();
|
|
21
|
+
const config = new avs_pb.GraphQLQueryNode.Config();
|
|
22
|
+
config.setUrl(configData.url);
|
|
23
|
+
config.setQuery(configData.query);
|
|
24
|
+
if (configData.variablesMap && configData.variablesMap.length > 0) {
|
|
25
|
+
const variablesMap = config.getVariablesMap();
|
|
26
|
+
configData.variablesMap.forEach(([key, value]) => {
|
|
27
|
+
variablesMap.set(key, value);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
node.setConfig(config);
|
|
31
|
+
return node;
|
|
32
|
+
}
|
|
14
33
|
static fromResponse(raw) {
|
|
15
34
|
// Convert the raw object to GraphQLQueryNodeProps, which should keep name and id
|
|
16
35
|
const obj = raw.toObject();
|
|
@@ -27,18 +46,7 @@ class GraphQLQueryNode extends Node {
|
|
|
27
46
|
const request = new avs_pb.TaskNode();
|
|
28
47
|
request.setId(this.id);
|
|
29
48
|
request.setName(this.name);
|
|
30
|
-
const node =
|
|
31
|
-
const config = new avs_pb.GraphQLQueryNode.Config();
|
|
32
|
-
config.setUrl(this.data.url);
|
|
33
|
-
config.setQuery(this.data.query);
|
|
34
|
-
if (this.data.variablesMap &&
|
|
35
|
-
this.data.variablesMap.length > 0) {
|
|
36
|
-
const variablesMap = config.getVariablesMap();
|
|
37
|
-
this.data.variablesMap.forEach(([key, value]) => {
|
|
38
|
-
variablesMap.set(key, value);
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
node.setConfig(config);
|
|
49
|
+
const node = GraphQLQueryNode.createProtobufNode(this.data);
|
|
42
50
|
// Set input data if provided
|
|
43
51
|
const inputValue = convertInputToProtobuf(this.input);
|
|
44
52
|
if (inputValue) {
|
|
@@ -4,8 +4,12 @@ import { LoopNodeProps } from "@avaprotocol/types";
|
|
|
4
4
|
declare class LoopNode extends Node {
|
|
5
5
|
constructor(props: LoopNodeProps);
|
|
6
6
|
static fromResponse(raw: avs_pb.TaskNode): LoopNode;
|
|
7
|
+
private static extractRunnerFromProtobuf;
|
|
8
|
+
private static mapExecutionModeFromProtobuf;
|
|
9
|
+
private mapExecutionModeToProtobuf;
|
|
7
10
|
toRequest(): avs_pb.TaskNode;
|
|
8
|
-
|
|
11
|
+
private setRunnerOnProtobuf;
|
|
12
|
+
static fromOutputData(outputData: avs_pb.RunNodeWithInputsResp): unknown;
|
|
9
13
|
}
|
|
10
14
|
export default LoopNode;
|
|
11
15
|
//# sourceMappingURL=loop.d.ts.map
|
|
@@ -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;
|
|
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;AAO/B,OAAO,EAGL,aAAa,EAGd,MAAM,oBAAoB,CAAC;AAG5B,cAAM,QAAS,SAAQ,IAAI;gBACb,KAAK,EAAE,aAAa;IAIhC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,QAAQ;IAsCnD,OAAO,CAAC,MAAM,CAAC,yBAAyB;IAsBxC,OAAO,CAAC,MAAM,CAAC,4BAA4B;IAe3C,OAAO,CAAC,0BAA0B;IA4BlC,SAAS,IAAI,MAAM,CAAC,QAAQ;IAqC5B,OAAO,CAAC,mBAAmB;IA2G3B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,OAAO;CAuCzE;AAED,eAAe,QAAQ,CAAC"}
|