@avaprotocol/sdk-js 2.3.13-dev.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.
- package/dist/index.js +309 -248
- package/dist/index.mjs +309 -248
- package/dist/models/node/branch.js +4 -4
- package/dist/models/node/contractRead.js +4 -4
- package/dist/models/node/contractWrite.js +4 -4
- package/dist/models/node/customCode.js +4 -4
- package/dist/models/node/ethTransfer.js +4 -4
- package/dist/models/node/filter.js +4 -4
- package/dist/models/node/graphqlQuery.js +4 -4
- package/dist/models/node/interface.d.ts +2 -2
- package/dist/models/node/interface.d.ts.map +1 -1
- package/dist/models/node/interface.js +17 -3
- package/dist/models/step.d.ts.map +1 -1
- package/dist/models/step.js +300 -209
- package/dist/models/trigger/block.d.ts.map +1 -1
- package/dist/models/trigger/block.js +1 -1
- package/dist/models/trigger/event.d.ts.map +1 -1
- package/dist/models/trigger/fixedTime.d.ts.map +1 -1
- package/dist/models/trigger/interface.d.ts +4 -6
- package/dist/models/trigger/interface.d.ts.map +1 -1
- package/dist/models/trigger/interface.js +3 -3
- package/dist/utils.d.ts +2 -2
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +22 -4
- package/package.json +2 -2
|
@@ -32,7 +32,7 @@ class BranchNode extends Node {
|
|
|
32
32
|
const request = new avs_pb.TaskNode();
|
|
33
33
|
request.setId(this.id);
|
|
34
34
|
request.setName(this.name);
|
|
35
|
-
const
|
|
35
|
+
const node = new avs_pb.BranchNode();
|
|
36
36
|
const config = new avs_pb.BranchNode.Config();
|
|
37
37
|
if (this.data.conditions &&
|
|
38
38
|
this.data.conditions.length > 0) {
|
|
@@ -45,13 +45,13 @@ class BranchNode extends Node {
|
|
|
45
45
|
});
|
|
46
46
|
config.setConditionsList(conditionsList);
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
node.setConfig(config);
|
|
49
49
|
// Set input data if provided
|
|
50
50
|
const inputValue = convertInputToProtobuf(this.input);
|
|
51
51
|
if (inputValue) {
|
|
52
|
-
|
|
52
|
+
node.setInput(inputValue);
|
|
53
53
|
}
|
|
54
|
-
request.setBranch(
|
|
54
|
+
request.setBranch(node);
|
|
55
55
|
return request;
|
|
56
56
|
}
|
|
57
57
|
static fromOutputData(outputData) {
|
|
@@ -33,7 +33,7 @@ class ContractReadNode extends Node {
|
|
|
33
33
|
const request = new avs_pb.TaskNode();
|
|
34
34
|
request.setId(this.id);
|
|
35
35
|
request.setName(this.name);
|
|
36
|
-
const
|
|
36
|
+
const node = new avs_pb.ContractReadNode();
|
|
37
37
|
const config = new avs_pb.ContractReadNode.Config();
|
|
38
38
|
config.setContractAddress(this.data.contractAddress);
|
|
39
39
|
config.setContractAbi(this.data.contractAbi);
|
|
@@ -47,13 +47,13 @@ class ContractReadNode extends Node {
|
|
|
47
47
|
}
|
|
48
48
|
config.addMethodCalls(methodCallMsg);
|
|
49
49
|
});
|
|
50
|
-
|
|
50
|
+
node.setConfig(config);
|
|
51
51
|
// Set input data if provided
|
|
52
52
|
const inputValue = convertInputToProtobuf(this.input);
|
|
53
53
|
if (inputValue) {
|
|
54
|
-
|
|
54
|
+
node.setInput(inputValue);
|
|
55
55
|
}
|
|
56
|
-
request.setContractRead(
|
|
56
|
+
request.setContractRead(node);
|
|
57
57
|
return request;
|
|
58
58
|
}
|
|
59
59
|
static fromOutputData(outputData) {
|
|
@@ -34,7 +34,7 @@ class ContractWriteNode extends Node {
|
|
|
34
34
|
const request = new avs_pb.TaskNode();
|
|
35
35
|
request.setId(this.id);
|
|
36
36
|
request.setName(this.name);
|
|
37
|
-
const
|
|
37
|
+
const node = new avs_pb.ContractWriteNode();
|
|
38
38
|
const config = new avs_pb.ContractWriteNode.Config();
|
|
39
39
|
config.setContractAddress(this.data.contractAddress);
|
|
40
40
|
config.setCallData(this.data.callData);
|
|
@@ -49,13 +49,13 @@ class ContractWriteNode extends Node {
|
|
|
49
49
|
}
|
|
50
50
|
config.addMethodCalls(methodCallMsg);
|
|
51
51
|
});
|
|
52
|
-
|
|
52
|
+
node.setConfig(config);
|
|
53
53
|
// Set input data if provided
|
|
54
54
|
const inputValue = convertInputToProtobuf(this.input);
|
|
55
55
|
if (inputValue) {
|
|
56
|
-
|
|
56
|
+
node.setInput(inputValue);
|
|
57
57
|
}
|
|
58
|
-
request.setContractWrite(
|
|
58
|
+
request.setContractWrite(node);
|
|
59
59
|
return request;
|
|
60
60
|
}
|
|
61
61
|
static fromOutputData(outputData) {
|
|
@@ -29,18 +29,18 @@ class CustomCodeNode extends Node {
|
|
|
29
29
|
const request = new avs_pb.TaskNode();
|
|
30
30
|
request.setId(this.id);
|
|
31
31
|
request.setName(this.name);
|
|
32
|
-
const
|
|
32
|
+
const node = new avs_pb.CustomCodeNode();
|
|
33
33
|
const config = new avs_pb.CustomCodeNode.Config();
|
|
34
34
|
// Set lang using enum value (cast to protobuf Lang type)
|
|
35
35
|
config.setLang(this.data.lang);
|
|
36
36
|
config.setSource(this.data.source);
|
|
37
|
-
|
|
37
|
+
node.setConfig(config);
|
|
38
38
|
// Set input data if provided
|
|
39
39
|
const inputValue = convertInputToProtobuf(this.input);
|
|
40
40
|
if (inputValue) {
|
|
41
|
-
|
|
41
|
+
node.setInput(inputValue);
|
|
42
42
|
}
|
|
43
|
-
request.setCustomCode(
|
|
43
|
+
request.setCustomCode(node);
|
|
44
44
|
return request;
|
|
45
45
|
}
|
|
46
46
|
static fromOutputData(outputData) {
|
|
@@ -23,17 +23,17 @@ class ETHTransferNode extends Node {
|
|
|
23
23
|
const request = new avs_pb.TaskNode();
|
|
24
24
|
request.setId(this.id);
|
|
25
25
|
request.setName(this.name);
|
|
26
|
-
const
|
|
26
|
+
const node = new avs_pb.ETHTransferNode();
|
|
27
27
|
const config = new avs_pb.ETHTransferNode.Config();
|
|
28
28
|
config.setDestination(this.data.destination);
|
|
29
29
|
config.setAmount(this.data.amount);
|
|
30
|
-
|
|
30
|
+
node.setConfig(config);
|
|
31
31
|
// Set input data if provided
|
|
32
32
|
const inputValue = convertInputToProtobuf(this.input);
|
|
33
33
|
if (inputValue) {
|
|
34
|
-
|
|
34
|
+
node.setInput(inputValue);
|
|
35
35
|
}
|
|
36
|
-
request.setEthTransfer(
|
|
36
|
+
request.setEthTransfer(node);
|
|
37
37
|
return request;
|
|
38
38
|
}
|
|
39
39
|
static fromOutputData(outputData) {
|
|
@@ -23,17 +23,17 @@ class FilterNode extends Node {
|
|
|
23
23
|
const request = new avs_pb.TaskNode();
|
|
24
24
|
request.setId(this.id);
|
|
25
25
|
request.setName(this.name);
|
|
26
|
-
const
|
|
26
|
+
const node = new avs_pb.FilterNode();
|
|
27
27
|
const config = new avs_pb.FilterNode.Config();
|
|
28
28
|
config.setExpression(this.data.expression);
|
|
29
29
|
config.setSourceId(this.data.sourceId || '');
|
|
30
|
-
|
|
30
|
+
node.setConfig(config);
|
|
31
31
|
// Set input data if provided
|
|
32
32
|
const inputValue = convertInputToProtobuf(this.input);
|
|
33
33
|
if (inputValue) {
|
|
34
|
-
|
|
34
|
+
node.setInput(inputValue);
|
|
35
35
|
}
|
|
36
|
-
request.setFilter(
|
|
36
|
+
request.setFilter(node);
|
|
37
37
|
return request;
|
|
38
38
|
}
|
|
39
39
|
static fromOutputData(outputData) {
|
|
@@ -27,7 +27,7 @@ class GraphQLQueryNode extends Node {
|
|
|
27
27
|
const request = new avs_pb.TaskNode();
|
|
28
28
|
request.setId(this.id);
|
|
29
29
|
request.setName(this.name);
|
|
30
|
-
const
|
|
30
|
+
const node = new avs_pb.GraphQLQueryNode();
|
|
31
31
|
const config = new avs_pb.GraphQLQueryNode.Config();
|
|
32
32
|
config.setUrl(this.data.url);
|
|
33
33
|
config.setQuery(this.data.query);
|
|
@@ -38,13 +38,13 @@ class GraphQLQueryNode extends Node {
|
|
|
38
38
|
variablesMap.set(key, value);
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
node.setConfig(config);
|
|
42
42
|
// Set input data if provided
|
|
43
43
|
const inputValue = convertInputToProtobuf(this.input);
|
|
44
44
|
if (inputValue) {
|
|
45
|
-
|
|
45
|
+
node.setInput(inputValue);
|
|
46
46
|
}
|
|
47
|
-
request.setGraphqlQuery(
|
|
47
|
+
request.setGraphqlQuery(node);
|
|
48
48
|
return request;
|
|
49
49
|
}
|
|
50
50
|
static fromOutputData(outputData) {
|
|
@@ -8,7 +8,7 @@ export declare const ProtobufNodePropsUtils: {
|
|
|
8
8
|
getGoStringType: (props: ProtobufNodeProps) => string;
|
|
9
9
|
fromGoStringType: (goStringType: string, baseProps: Omit<ProtobufNodeProps, "type">) => ProtobufNodeProps;
|
|
10
10
|
};
|
|
11
|
-
|
|
11
|
+
export default abstract class Node implements NodeProps {
|
|
12
12
|
id: string;
|
|
13
13
|
name: string;
|
|
14
14
|
type: NodeType;
|
|
@@ -16,6 +16,6 @@ declare class Node implements NodeProps {
|
|
|
16
16
|
input?: Record<string, any>;
|
|
17
17
|
constructor(props: NodeProps);
|
|
18
18
|
toRequest(): avs_pb.TaskNode;
|
|
19
|
+
static fromResponse(raw: avs_pb.TaskNode): Node;
|
|
19
20
|
}
|
|
20
|
-
export default Node;
|
|
21
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;
|
|
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,13 +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;
|
|
40
|
-
|
|
41
|
+
// Convert from protobuf AsObject to JavaScript object if needed
|
|
42
|
+
this.input = props.input ? extractInputFromProtobuf(props.input) : undefined;
|
|
41
43
|
}
|
|
42
44
|
toRequest() {
|
|
43
45
|
const request = new avs_pb.TaskNode();
|
|
@@ -48,5 +50,17 @@ class Node {
|
|
|
48
50
|
}
|
|
49
51
|
return request;
|
|
50
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
|
+
}
|
|
51
66
|
}
|
|
52
|
-
export default Node;
|
|
@@ -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,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;
|
|
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"}
|