@avaprotocol/sdk-js 1.6.5 → 1.6.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/index.d.ts +19 -28
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1201 -741
- package/dist/index.mjs +1213 -743
- package/dist/models/node/branch.d.ts +1 -0
- package/dist/models/node/branch.d.ts.map +1 -1
- package/dist/models/node/branch.js +4 -0
- package/dist/models/node/contractRead.d.ts +1 -0
- package/dist/models/node/contractRead.d.ts.map +1 -1
- package/dist/models/node/contractRead.js +11 -0
- package/dist/models/node/contractWrite.d.ts +1 -0
- package/dist/models/node/contractWrite.d.ts.map +1 -1
- package/dist/models/node/contractWrite.js +4 -0
- package/dist/models/node/customCode.d.ts +1 -0
- package/dist/models/node/customCode.d.ts.map +1 -1
- package/dist/models/node/customCode.js +9 -0
- package/dist/models/node/ethTransfer.d.ts +1 -0
- package/dist/models/node/ethTransfer.d.ts.map +1 -1
- package/dist/models/node/ethTransfer.js +4 -0
- package/dist/models/node/factory.d.ts +1 -0
- package/dist/models/node/factory.d.ts.map +1 -1
- package/dist/models/node/factory.js +54 -0
- package/dist/models/node/filter.d.ts +1 -0
- package/dist/models/node/filter.d.ts.map +1 -1
- package/dist/models/node/filter.js +4 -0
- package/dist/models/node/graphqlQuery.d.ts +1 -0
- package/dist/models/node/graphqlQuery.d.ts.map +1 -1
- package/dist/models/node/graphqlQuery.js +4 -0
- package/dist/models/node/loop.d.ts +1 -0
- package/dist/models/node/loop.d.ts.map +1 -1
- package/dist/models/node/loop.js +4 -0
- package/dist/models/node/restApi.d.ts +1 -0
- package/dist/models/node/restApi.d.ts.map +1 -1
- package/dist/models/node/restApi.js +15 -1
- package/dist/models/trigger/block.d.ts +6 -0
- package/dist/models/trigger/block.d.ts.map +1 -1
- package/dist/models/trigger/block.js +9 -0
- package/dist/models/trigger/cron.d.ts +7 -1
- package/dist/models/trigger/cron.d.ts.map +1 -1
- package/dist/models/trigger/cron.js +10 -1
- package/dist/models/trigger/event.d.ts +7 -1
- package/dist/models/trigger/event.d.ts.map +1 -1
- package/dist/models/trigger/event.js +10 -1
- package/dist/models/trigger/factory.d.ts +1 -0
- package/dist/models/trigger/factory.d.ts.map +1 -1
- package/dist/models/trigger/factory.js +42 -0
- package/dist/models/trigger/fixedTime.d.ts +7 -1
- package/dist/models/trigger/fixedTime.d.ts.map +1 -1
- package/dist/models/trigger/fixedTime.js +10 -1
- package/dist/models/trigger/interface.d.ts +1 -1
- package/dist/models/trigger/interface.d.ts.map +1 -1
- package/dist/models/trigger/manual.d.ts +13 -0
- package/dist/models/trigger/manual.d.ts.map +1 -1
- package/dist/models/trigger/manual.js +17 -0
- package/dist/utils.d.ts +34 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +116 -2
- package/package.json +2 -2
|
@@ -9,6 +9,7 @@ declare class BranchNode extends Node {
|
|
|
9
9
|
constructor(props: BranchNodeProps);
|
|
10
10
|
static fromResponse(raw: avs_pb.TaskNode): BranchNode;
|
|
11
11
|
toRequest(): avs_pb.TaskNode;
|
|
12
|
+
static fromOutputData(outputData: avs_pb.RunNodeWithInputsResp): any;
|
|
12
13
|
}
|
|
13
14
|
export default BranchNode;
|
|
14
15
|
//# sourceMappingURL=branch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"branch.d.ts","sourceRoot":"","sources":["../../../src/models/node/branch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAY,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAGhD,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG;IACxC,IAAI,EAAE,cAAc,CAAC;CACtB,CAAC;AAEF,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;
|
|
1
|
+
{"version":3,"file":"branch.d.ts","sourceRoot":"","sources":["../../../src/models/node/branch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAY,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAGhD,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG;IACxC,IAAI,EAAE,cAAc,CAAC;CACtB,CAAC;AAEF,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;IA+B5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAMrE;AACD,eAAe,UAAU,CAAC"}
|
|
@@ -9,6 +9,7 @@ declare class ContractReadNode extends Node {
|
|
|
9
9
|
constructor(props: ContractReadNodeProps);
|
|
10
10
|
static fromResponse(raw: avs_pb.TaskNode): ContractReadNode;
|
|
11
11
|
toRequest(): avs_pb.TaskNode;
|
|
12
|
+
static fromOutputData(outputData: avs_pb.RunNodeWithInputsResp): any;
|
|
12
13
|
}
|
|
13
14
|
export default ContractReadNode;
|
|
14
15
|
//# sourceMappingURL=contractRead.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contractRead.d.ts","sourceRoot":"","sources":["../../../src/models/node/contractRead.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAY,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"contractRead.d.ts","sourceRoot":"","sources":["../../../src/models/node/contractRead.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAY,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAIpE,MAAM,MAAM,qBAAqB,GAAG,SAAS,GAAG;IAC9C,IAAI,EAAE,oBAAoB,CAAC;CAC5B,CAAC;AAEF,cAAM,gBAAiB,SAAQ,IAAI;gBACrB,KAAK,EAAE,qBAAqB;IAIxC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,gBAAgB;IAU3D,SAAS,IAAI,MAAM,CAAC,QAAQ;IAoB5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAUrE;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 { convertProtobufValueToJs } from "../../utils";
|
|
4
5
|
class ContractReadNode extends Node {
|
|
5
6
|
constructor(props) {
|
|
6
7
|
super({ ...props, type: NodeType.ContractRead, data: props.data });
|
|
@@ -27,5 +28,15 @@ class ContractReadNode extends Node {
|
|
|
27
28
|
request.setContractRead(nodeData);
|
|
28
29
|
return request;
|
|
29
30
|
}
|
|
31
|
+
static fromOutputData(outputData) {
|
|
32
|
+
const contractReadOutput = outputData.getContractRead();
|
|
33
|
+
if (contractReadOutput && contractReadOutput.getDataList()) {
|
|
34
|
+
const dataList = contractReadOutput.getDataList();
|
|
35
|
+
return {
|
|
36
|
+
dataList: dataList.map((value) => convertProtobufValueToJs(value))
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
30
41
|
}
|
|
31
42
|
export default ContractReadNode;
|
|
@@ -9,6 +9,7 @@ declare class ContractWriteNode extends Node {
|
|
|
9
9
|
constructor(props: ContractWriteNodeProps);
|
|
10
10
|
static fromResponse(raw: avs_pb.TaskNode): ContractWriteNode;
|
|
11
11
|
toRequest(): avs_pb.TaskNode;
|
|
12
|
+
static fromOutputData(outputData: avs_pb.RunNodeWithInputsResp): any;
|
|
12
13
|
}
|
|
13
14
|
export default ContractWriteNode;
|
|
14
15
|
//# sourceMappingURL=contractWrite.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contractWrite.d.ts","sourceRoot":"","sources":["../../../src/models/node/contractWrite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAY,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAGrE,MAAM,MAAM,sBAAsB,GAAG,SAAS,GAAG;IAC/C,IAAI,EAAE,qBAAqB,CAAC;CAC7B,CAAC;AAEF,cAAM,iBAAkB,SAAQ,IAAI;gBACtB,KAAK,EAAE,sBAAsB;IAIzC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,iBAAiB;IAU5D,SAAS,IAAI,MAAM,CAAC,QAAQ;
|
|
1
|
+
{"version":3,"file":"contractWrite.d.ts","sourceRoot":"","sources":["../../../src/models/node/contractWrite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAY,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAGrE,MAAM,MAAM,sBAAsB,GAAG,SAAS,GAAG;IAC/C,IAAI,EAAE,qBAAqB,CAAC;CAC7B,CAAC;AAEF,cAAM,iBAAkB,SAAQ,IAAI;gBACtB,KAAK,EAAE,sBAAsB;IAIzC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,iBAAiB;IAU5D,SAAS,IAAI,MAAM,CAAC,QAAQ;IAmB5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAIrE;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -27,5 +27,9 @@ class ContractWriteNode extends Node {
|
|
|
27
27
|
request.setContractWrite(nodeData);
|
|
28
28
|
return request;
|
|
29
29
|
}
|
|
30
|
+
static fromOutputData(outputData) {
|
|
31
|
+
const contractWriteOutput = outputData.getContractWrite();
|
|
32
|
+
return contractWriteOutput?.toObject() || null;
|
|
33
|
+
}
|
|
30
34
|
}
|
|
31
35
|
export default ContractWriteNode;
|
|
@@ -9,6 +9,7 @@ declare class CustomCodeNode extends Node {
|
|
|
9
9
|
constructor(props: CustomCodeNodeProps);
|
|
10
10
|
static fromResponse(raw: avs_pb.TaskNode): CustomCodeNode;
|
|
11
11
|
toRequest(): avs_pb.TaskNode;
|
|
12
|
+
static fromOutputData(outputData: avs_pb.RunNodeWithInputsResp): any;
|
|
12
13
|
}
|
|
13
14
|
export default CustomCodeNode;
|
|
14
15
|
//# sourceMappingURL=customCode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customCode.d.ts","sourceRoot":"","sources":["../../../src/models/node/customCode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAY,kBAAkB,EAAmB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"customCode.d.ts","sourceRoot":"","sources":["../../../src/models/node/customCode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAY,kBAAkB,EAAmB,MAAM,oBAAoB,CAAC;AAInF,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG;IAC5C,IAAI,EAAE,kBAAkB,CAAC;CAC1B,CAAC;AAEF,cAAM,cAAe,SAAQ,IAAI;gBACnB,KAAK,EAAE,mBAAmB;IAItC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,cAAc;IAUzD,SAAS,IAAI,MAAM,CAAC,QAAQ;IAkB5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAQrE;AAED,eAAe,cAAc,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 { convertProtobufValueToJs } from "../../utils";
|
|
4
5
|
class CustomCodeNode extends Node {
|
|
5
6
|
constructor(props) {
|
|
6
7
|
super({ ...props, type: NodeType.CustomCode, data: props.data });
|
|
@@ -26,5 +27,13 @@ class CustomCodeNode extends Node {
|
|
|
26
27
|
request.setCustomCode(nodeData);
|
|
27
28
|
return request;
|
|
28
29
|
}
|
|
30
|
+
static fromOutputData(outputData) {
|
|
31
|
+
const customCodeOutput = outputData.getCustomCode();
|
|
32
|
+
if (customCodeOutput?.getData()) {
|
|
33
|
+
// Use the modern protobuf conversion function
|
|
34
|
+
return convertProtobufValueToJs(customCodeOutput.getData());
|
|
35
|
+
}
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
29
38
|
}
|
|
30
39
|
export default CustomCodeNode;
|
|
@@ -9,6 +9,7 @@ declare class ETHTransferNode extends Node {
|
|
|
9
9
|
constructor(props: ETHTransferNodeProps);
|
|
10
10
|
static fromResponse(raw: avs_pb.TaskNode): ETHTransferNode;
|
|
11
11
|
toRequest(): avs_pb.TaskNode;
|
|
12
|
+
static fromOutputData(outputData: avs_pb.RunNodeWithInputsResp): any;
|
|
12
13
|
}
|
|
13
14
|
export default ETHTransferNode;
|
|
14
15
|
//# sourceMappingURL=ethTransfer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ethTransfer.d.ts","sourceRoot":"","sources":["../../../src/models/node/ethTransfer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAY,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAGnE,MAAM,MAAM,oBAAoB,GAAG,SAAS,GAAG;IAC7C,IAAI,EAAE,mBAAmB,CAAC;CAC3B,CAAC;AAEF,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;
|
|
1
|
+
{"version":3,"file":"ethTransfer.d.ts","sourceRoot":"","sources":["../../../src/models/node/ethTransfer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAY,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAGnE,MAAM,MAAM,oBAAoB,GAAG,SAAS,GAAG;IAC7C,IAAI,EAAE,mBAAmB,CAAC;CAC3B,CAAC;AAEF,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"}
|
|
@@ -26,5 +26,9 @@ class ETHTransferNode extends Node {
|
|
|
26
26
|
request.setEthTransfer(nodeData);
|
|
27
27
|
return request;
|
|
28
28
|
}
|
|
29
|
+
static fromOutputData(outputData) {
|
|
30
|
+
const ethTransferOutput = outputData.getEthTransfer();
|
|
31
|
+
return ethTransferOutput?.toObject() || null;
|
|
32
|
+
}
|
|
29
33
|
}
|
|
30
34
|
export default ETHTransferNode;
|
|
@@ -14,6 +14,7 @@ declare class NodeFactory {
|
|
|
14
14
|
static create(props: NodeProps): Node;
|
|
15
15
|
static createNodes(props: NodeProps[]): Node[];
|
|
16
16
|
static fromResponse(raw: avs_pb.TaskNode): Node;
|
|
17
|
+
static fromOutputData(outputData: avs_pb.RunNodeWithInputsResp): any;
|
|
17
18
|
}
|
|
18
19
|
export default NodeFactory;
|
|
19
20
|
export { Node, ContractWriteNode, ContractReadNode, BranchNode, ETHTransferNode, GraphQLQueryNode, RestAPINode, CustomCodeNode, CustomCodeLangs, FilterNode, LoopNode, };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/models/node/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAEhD,OAAO,iBAAiB,EAAE,EACxB,sBAAsB,EACvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,cAAc,EAAE,EACrB,mBAAmB,EACpB,MAAM,cAAc,CAAC;AACtB,OAAO,gBAAgB,EAAE,EACvB,qBAAqB,EACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,IAAI,EAAE,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,WAAW,EAAE,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,gBAAgB,EAAE,EACvB,qBAAqB,EACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,eAAe,EAAE,EACtB,oBAAoB,EACrB,MAAM,eAAe,CAAC;AACvB,OAAO,UAAU,EAAE,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,UAAU,EAAE,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,QAAQ,EAAE,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,EAEL,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,YAAY,EACb,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/models/node/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAEhD,OAAO,iBAAiB,EAAE,EACxB,sBAAsB,EACvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,cAAc,EAAE,EACrB,mBAAmB,EACpB,MAAM,cAAc,CAAC;AACtB,OAAO,gBAAgB,EAAE,EACvB,qBAAqB,EACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,IAAI,EAAE,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,WAAW,EAAE,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,gBAAgB,EAAE,EACvB,qBAAqB,EACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,eAAe,EAAE,EACtB,oBAAoB,EACrB,MAAM,eAAe,CAAC;AACvB,OAAO,UAAU,EAAE,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,UAAU,EAAE,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,QAAQ,EAAE,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,EAEL,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,YAAY,EACb,MAAM,oBAAoB,CAAC;AAG5B,cAAM,WAAW;IACf,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IA2BrC,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE;IAI9C,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,IAAI;IAyB/C,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAyDrE;AAED,eAAe,WAAW,CAAC;AAG3B,OAAO,EACL,IAAI,EACJ,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,eAAe,EACf,UAAU,EACV,QAAQ,GACT,CAAC;AAGF,YAAY,EACV,qBAAqB,EACrB,oBAAoB,EACpB,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,YAAY,GACb,CAAC;AAGF,YAAY,EACV,SAAS,EACT,sBAAsB,EACtB,qBAAqB,EACrB,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,aAAa,GACd,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
1
2
|
import _ from "lodash";
|
|
2
3
|
import ContractWriteNode from "./contractWrite";
|
|
3
4
|
import CustomCodeNode from "./customCode";
|
|
@@ -10,6 +11,7 @@ import BranchNode from "./branch";
|
|
|
10
11
|
import FilterNode from "./filter";
|
|
11
12
|
import LoopNode from "./loop";
|
|
12
13
|
import { NodeType, CustomCodeLangs } from "@avaprotocol/types";
|
|
14
|
+
import { convertProtobufValueToJs } from "../../utils";
|
|
13
15
|
class NodeFactory {
|
|
14
16
|
static create(props) {
|
|
15
17
|
switch (props.type) {
|
|
@@ -64,6 +66,58 @@ class NodeFactory {
|
|
|
64
66
|
throw new Error(`Unsupported node type: ${raw.getName()}`);
|
|
65
67
|
}
|
|
66
68
|
}
|
|
69
|
+
static fromOutputData(outputData) {
|
|
70
|
+
// Generic approach: try to extract data from any output type using getData() method
|
|
71
|
+
// This works for all node types that follow the pattern of having a getData() method
|
|
72
|
+
let nodeOutput = null;
|
|
73
|
+
let rawData = null;
|
|
74
|
+
// Get the specific node output based on the case
|
|
75
|
+
switch (outputData.getOutputDataCase()) {
|
|
76
|
+
case avs_pb.RunNodeWithInputsResp.OutputDataCase.REST_API:
|
|
77
|
+
nodeOutput = outputData.getRestApi();
|
|
78
|
+
break;
|
|
79
|
+
case avs_pb.RunNodeWithInputsResp.OutputDataCase.CUSTOM_CODE:
|
|
80
|
+
nodeOutput = outputData.getCustomCode();
|
|
81
|
+
break;
|
|
82
|
+
case avs_pb.RunNodeWithInputsResp.OutputDataCase.CONTRACT_READ:
|
|
83
|
+
nodeOutput = outputData.getContractRead();
|
|
84
|
+
break;
|
|
85
|
+
case avs_pb.RunNodeWithInputsResp.OutputDataCase.CONTRACT_WRITE:
|
|
86
|
+
nodeOutput = outputData.getContractWrite();
|
|
87
|
+
break;
|
|
88
|
+
case avs_pb.RunNodeWithInputsResp.OutputDataCase.ETH_TRANSFER:
|
|
89
|
+
nodeOutput = outputData.getEthTransfer();
|
|
90
|
+
break;
|
|
91
|
+
case avs_pb.RunNodeWithInputsResp.OutputDataCase.GRAPHQL:
|
|
92
|
+
nodeOutput = outputData.getGraphql();
|
|
93
|
+
break;
|
|
94
|
+
case avs_pb.RunNodeWithInputsResp.OutputDataCase.BRANCH:
|
|
95
|
+
nodeOutput = outputData.getBranch();
|
|
96
|
+
break;
|
|
97
|
+
case avs_pb.RunNodeWithInputsResp.OutputDataCase.FILTER:
|
|
98
|
+
nodeOutput = outputData.getFilter();
|
|
99
|
+
break;
|
|
100
|
+
case avs_pb.RunNodeWithInputsResp.OutputDataCase.LOOP:
|
|
101
|
+
nodeOutput = outputData.getLoop();
|
|
102
|
+
break;
|
|
103
|
+
case avs_pb.RunNodeWithInputsResp.OutputDataCase.OUTPUT_DATA_NOT_SET:
|
|
104
|
+
default:
|
|
105
|
+
throw new Error(`Unsupported output data case: ${outputData.getOutputDataCase()}`);
|
|
106
|
+
}
|
|
107
|
+
if (!nodeOutput) {
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
// Try to get data using getData() method (works for most node types)
|
|
111
|
+
if (typeof nodeOutput.getData === 'function') {
|
|
112
|
+
rawData = nodeOutput.getData();
|
|
113
|
+
if (rawData) {
|
|
114
|
+
return convertProtobufValueToJs(rawData);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
// For node types that don't have getData() or have special structures,
|
|
118
|
+
// fall back to toObject() for now (can be specialized later if needed)
|
|
119
|
+
return nodeOutput.toObject();
|
|
120
|
+
}
|
|
67
121
|
}
|
|
68
122
|
export default NodeFactory;
|
|
69
123
|
// Node object definitions
|
|
@@ -9,6 +9,7 @@ declare class FilterNode extends Node {
|
|
|
9
9
|
constructor(props: FilterNodeProps);
|
|
10
10
|
static fromResponse(raw: avs_pb.TaskNode): FilterNode;
|
|
11
11
|
toRequest(): avs_pb.TaskNode;
|
|
12
|
+
static fromOutputData(outputData: avs_pb.RunNodeWithInputsResp): any;
|
|
12
13
|
}
|
|
13
14
|
export default FilterNode;
|
|
14
15
|
//# sourceMappingURL=filter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../../src/models/node/filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAY,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAG9D,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG;IACxC,IAAI,EAAE,cAAc,CAAC;CACtB,CAAC;AAEF,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;
|
|
1
|
+
{"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../../src/models/node/filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAY,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAG9D,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG;IACxC,IAAI,EAAE,cAAc,CAAC;CACtB,CAAC;AAEF,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"}
|
|
@@ -9,6 +9,7 @@ declare class GraphQLQueryNode extends Node {
|
|
|
9
9
|
constructor(props: GraphQLQueryNodeProps);
|
|
10
10
|
static fromResponse(raw: avs_pb.TaskNode): GraphQLQueryNode;
|
|
11
11
|
toRequest(): avs_pb.TaskNode;
|
|
12
|
+
static fromOutputData(outputData: avs_pb.RunNodeWithInputsResp): any;
|
|
12
13
|
}
|
|
13
14
|
export default GraphQLQueryNode;
|
|
14
15
|
//# sourceMappingURL=graphqlQuery.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphqlQuery.d.ts","sourceRoot":"","sources":["../../../src/models/node/graphqlQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAY,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAGpE,MAAM,MAAM,qBAAqB,GAAG,SAAS,GAAG;IAC9C,IAAI,EAAE,oBAAoB,CAAC;CAC5B,CAAC;AAEF,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;
|
|
1
|
+
{"version":3,"file":"graphqlQuery.d.ts","sourceRoot":"","sources":["../../../src/models/node/graphqlQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAY,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAGpE,MAAM,MAAM,qBAAqB,GAAG,SAAS,GAAG;IAC9C,IAAI,EAAE,oBAAoB,CAAC;CAC5B,CAAC;AAEF,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"}
|
|
@@ -37,5 +37,9 @@ class GraphQLQueryNode extends Node {
|
|
|
37
37
|
request.setGraphqlQuery(nodeData);
|
|
38
38
|
return request;
|
|
39
39
|
}
|
|
40
|
+
static fromOutputData(outputData) {
|
|
41
|
+
const graphqlOutput = outputData.getGraphql();
|
|
42
|
+
return graphqlOutput?.toObject() || null;
|
|
43
|
+
}
|
|
40
44
|
}
|
|
41
45
|
export default GraphQLQueryNode;
|
|
@@ -8,6 +8,7 @@ declare class LoopNode extends Node {
|
|
|
8
8
|
constructor(props: LoopNodeProps);
|
|
9
9
|
static fromResponse(raw: avs_pb.TaskNode): LoopNode;
|
|
10
10
|
toRequest(): avs_pb.TaskNode;
|
|
11
|
+
static fromOutputData(outputData: avs_pb.RunNodeWithInputsResp): any;
|
|
11
12
|
}
|
|
12
13
|
export default LoopNode;
|
|
13
14
|
//# 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,EAAE,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAY,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAG5D,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG;IACtC,IAAI,EAAE,YAAY,CAAC;CACpB,CAAC;AAEF,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;
|
|
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,EAAE,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAY,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAG5D,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG;IACtC,IAAI,EAAE,YAAY,CAAC;CACpB,CAAC;AAEF,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;IAkG5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAIrE;AAED,eAAe,QAAQ,CAAC"}
|
package/dist/models/node/loop.js
CHANGED
|
@@ -9,6 +9,7 @@ declare class RestAPINode extends Node {
|
|
|
9
9
|
constructor(props: RestAPINodeProps);
|
|
10
10
|
static fromResponse(raw: avs_pb.TaskNode): RestAPINode;
|
|
11
11
|
toRequest(): avs_pb.TaskNode;
|
|
12
|
+
static fromOutputData(outputData: avs_pb.RunNodeWithInputsResp): any;
|
|
12
13
|
}
|
|
13
14
|
export default RestAPINode;
|
|
14
15
|
//# sourceMappingURL=restApi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restApi.d.ts","sourceRoot":"","sources":["../../../src/models/node/restApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,
|
|
1
|
+
{"version":3,"file":"restApi.d.ts","sourceRoot":"","sources":["../../../src/models/node/restApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAEL,eAAe,EAEhB,MAAM,oBAAoB,CAAC;AAI5B,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG;IACzC,IAAI,EAAE,eAAe,CAAC;CACvB,CAAC;AAEF,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,6 +1,7 @@
|
|
|
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
|
+
import { convertProtobufValueToJs } from "../../utils";
|
|
4
5
|
class RestAPINode extends Node {
|
|
5
6
|
constructor(props) {
|
|
6
7
|
super({ ...props, type: NodeType.RestAPI, data: props.data });
|
|
@@ -34,5 +35,18 @@ class RestAPINode extends Node {
|
|
|
34
35
|
request.setRestApi(nodeData);
|
|
35
36
|
return request;
|
|
36
37
|
}
|
|
38
|
+
static fromOutputData(outputData) {
|
|
39
|
+
const restApiOutput = outputData.getRestApi();
|
|
40
|
+
if (!restApiOutput) {
|
|
41
|
+
console.log("Debug RestAPI: No restApiOutput found");
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
// Use convertProtobufValueToJs to get clean JavaScript objects
|
|
45
|
+
const rawData = restApiOutput.getData();
|
|
46
|
+
if (rawData) {
|
|
47
|
+
return convertProtobufValueToJs(rawData);
|
|
48
|
+
}
|
|
49
|
+
return restApiOutput.toObject();
|
|
50
|
+
}
|
|
37
51
|
}
|
|
38
52
|
export default RestAPINode;
|
|
@@ -14,6 +14,12 @@ declare class BlockTrigger extends Trigger {
|
|
|
14
14
|
* @returns {BlockTriggerOutput | undefined} - The converted data
|
|
15
15
|
*/
|
|
16
16
|
getOutput(): BlockTriggerOutput | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Extract output data from RunTriggerResp for block triggers
|
|
19
|
+
* @param outputData - The RunTriggerResp containing block trigger output
|
|
20
|
+
* @returns Plain JavaScript object with block trigger data
|
|
21
|
+
*/
|
|
22
|
+
static fromOutputData(outputData: avs_pb.RunTriggerResp): any;
|
|
17
23
|
}
|
|
18
24
|
export default BlockTrigger;
|
|
19
25
|
//# sourceMappingURL=block.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/block.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,OAAO,EAAE,EAAiB,YAAY,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAe,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAG3F,MAAM,MAAM,iBAAiB,GAAG,YAAY,GAAG;IAAE,IAAI,EAAE,oBAAoB,CAAA;CAAE,CAAC;AAE9E,cAAM,YAAa,SAAQ,OAAO;gBACpB,KAAK,EAAE,iBAAiB;IAIpC,SAAS,IAAI,MAAM,CAAC,WAAW;IAmB/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,YAAY;IAuB1D;;;;OAIG;IACH,SAAS,IAAI,kBAAkB,GAAG,SAAS;
|
|
1
|
+
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/block.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,OAAO,EAAE,EAAiB,YAAY,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAe,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAG3F,MAAM,MAAM,iBAAiB,GAAG,YAAY,GAAG;IAAE,IAAI,EAAE,oBAAoB,CAAA;CAAE,CAAC;AAE9E,cAAM,YAAa,SAAQ,OAAO;gBACpB,KAAK,EAAE,iBAAiB;IAIpC,SAAS,IAAI,MAAM,CAAC,WAAW;IAmB/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,YAAY;IAuB1D;;;;OAIG;IACH,SAAS,IAAI,kBAAkB,GAAG,SAAS;IAI3C;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,GAAG;CAI9D;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -45,5 +45,14 @@ class BlockTrigger extends Trigger {
|
|
|
45
45
|
getOutput() {
|
|
46
46
|
return this.output;
|
|
47
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Extract output data from RunTriggerResp for block triggers
|
|
50
|
+
* @param outputData - The RunTriggerResp containing block trigger output
|
|
51
|
+
* @returns Plain JavaScript object with block trigger data
|
|
52
|
+
*/
|
|
53
|
+
static fromOutputData(outputData) {
|
|
54
|
+
const blockOutput = outputData.getBlockTrigger();
|
|
55
|
+
return blockOutput?.toObject() || null;
|
|
56
|
+
}
|
|
48
57
|
}
|
|
49
58
|
export default BlockTrigger;
|
|
@@ -9,11 +9,17 @@ declare class CronTrigger extends Trigger {
|
|
|
9
9
|
toRequest(): avs_pb.TaskTrigger;
|
|
10
10
|
static fromResponse(raw: avs_pb.TaskTrigger): CronTrigger;
|
|
11
11
|
/**
|
|
12
|
-
* Convert raw data from
|
|
12
|
+
* Convert raw data from runTrigger response to CronOutput format
|
|
13
13
|
* @param rawData - The raw data from the gRPC response
|
|
14
14
|
* @returns {CronTriggerOutput | undefined} - The converted data
|
|
15
15
|
*/
|
|
16
16
|
getOutput(): CronTriggerOutput | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Extract output data from RunTriggerResp for cron triggers
|
|
19
|
+
* @param outputData - The RunTriggerResp containing cron trigger output
|
|
20
|
+
* @returns Plain JavaScript object with cron trigger data
|
|
21
|
+
*/
|
|
22
|
+
static fromOutputData(outputData: avs_pb.RunTriggerResp): any;
|
|
17
23
|
}
|
|
18
24
|
export default CronTrigger;
|
|
19
25
|
//# sourceMappingURL=cron.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cron.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/cron.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,OAAO,EAAE,EAAiB,YAAY,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAe,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAGzF,MAAM,MAAM,gBAAgB,GAAG,YAAY,GAAG;IAAE,IAAI,EAAE,mBAAmB,CAAA;CAAE,CAAC;AAE5E,cAAM,WAAY,SAAQ,OAAO;gBACnB,KAAK,EAAE,gBAAgB;IAInC,SAAS,IAAI,MAAM,CAAC,WAAW;IAmB/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,WAAW;IAuBzD;;;;OAIG;IACH,SAAS,IAAI,iBAAiB,GAAG,SAAS;
|
|
1
|
+
{"version":3,"file":"cron.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/cron.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,OAAO,EAAE,EAAiB,YAAY,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAe,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAGzF,MAAM,MAAM,gBAAgB,GAAG,YAAY,GAAG;IAAE,IAAI,EAAE,mBAAmB,CAAA;CAAE,CAAC;AAE5E,cAAM,WAAY,SAAQ,OAAO;gBACnB,KAAK,EAAE,gBAAgB;IAInC,SAAS,IAAI,MAAM,CAAC,WAAW;IAmB/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,WAAW;IAuBzD;;;;OAIG;IACH,SAAS,IAAI,iBAAiB,GAAG,SAAS;IAI1C;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,GAAG;CAI9D;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -38,12 +38,21 @@ class CronTrigger extends Trigger {
|
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
|
-
* Convert raw data from
|
|
41
|
+
* Convert raw data from runTrigger response to CronOutput format
|
|
42
42
|
* @param rawData - The raw data from the gRPC response
|
|
43
43
|
* @returns {CronTriggerOutput | undefined} - The converted data
|
|
44
44
|
*/
|
|
45
45
|
getOutput() {
|
|
46
46
|
return this.output;
|
|
47
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Extract output data from RunTriggerResp for cron triggers
|
|
50
|
+
* @param outputData - The RunTriggerResp containing cron trigger output
|
|
51
|
+
* @returns Plain JavaScript object with cron trigger data
|
|
52
|
+
*/
|
|
53
|
+
static fromOutputData(outputData) {
|
|
54
|
+
const cronOutput = outputData.getCronTrigger();
|
|
55
|
+
return cronOutput?.toObject() || null;
|
|
56
|
+
}
|
|
48
57
|
}
|
|
49
58
|
export default CronTrigger;
|
|
@@ -9,11 +9,17 @@ declare class EventTrigger extends Trigger {
|
|
|
9
9
|
toRequest(): avs_pb.TaskTrigger;
|
|
10
10
|
static fromResponse(raw: avs_pb.TaskTrigger): EventTrigger;
|
|
11
11
|
/**
|
|
12
|
-
* Convert raw data from
|
|
12
|
+
* Convert raw data from runTrigger response to EventOutput format
|
|
13
13
|
* @param rawData - The raw data from the gRPC response
|
|
14
14
|
* @returns {EventTriggerOutput | undefined} - The converted data
|
|
15
15
|
*/
|
|
16
16
|
getOutput(): EventTriggerOutput | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Extract output data from RunTriggerResp for event triggers
|
|
19
|
+
* @param outputData - The RunTriggerResp containing event trigger output
|
|
20
|
+
* @returns Plain JavaScript object with event trigger data
|
|
21
|
+
*/
|
|
22
|
+
static fromOutputData(outputData: avs_pb.RunTriggerResp): any;
|
|
17
23
|
}
|
|
18
24
|
export default EventTrigger;
|
|
19
25
|
//# sourceMappingURL=event.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/event.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,OAAO,EAAE,EAAiB,YAAY,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAe,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAsB3F,MAAM,MAAM,iBAAiB,GAAG,YAAY,GAAG;IAAE,IAAI,EAAE,oBAAoB,CAAA;CAAE,CAAC;AAE9E,cAAM,YAAa,SAAQ,OAAO;gBACpB,KAAK,EAAE,iBAAiB;IAIpC,SAAS,IAAI,MAAM,CAAC,WAAW;IAwC/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,YAAY;IAiC1D;;;;OAIG;IACH,SAAS,IAAI,kBAAkB,GAAG,SAAS;
|
|
1
|
+
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/event.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,OAAO,EAAE,EAAiB,YAAY,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAe,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAsB3F,MAAM,MAAM,iBAAiB,GAAG,YAAY,GAAG;IAAE,IAAI,EAAE,oBAAoB,CAAA;CAAE,CAAC;AAE9E,cAAM,YAAa,SAAQ,OAAO;gBACpB,KAAK,EAAE,iBAAiB;IAIpC,SAAS,IAAI,MAAM,CAAC,WAAW;IAwC/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,YAAY;IAiC1D;;;;OAIG;IACH,SAAS,IAAI,kBAAkB,GAAG,SAAS;IAI3C;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,GAAG;CAI9D;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -63,12 +63,21 @@ class EventTrigger extends Trigger {
|
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
|
-
* Convert raw data from
|
|
66
|
+
* Convert raw data from runTrigger response to EventOutput format
|
|
67
67
|
* @param rawData - The raw data from the gRPC response
|
|
68
68
|
* @returns {EventTriggerOutput | undefined} - The converted data
|
|
69
69
|
*/
|
|
70
70
|
getOutput() {
|
|
71
71
|
return this.output;
|
|
72
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Extract output data from RunTriggerResp for event triggers
|
|
75
|
+
* @param outputData - The RunTriggerResp containing event trigger output
|
|
76
|
+
* @returns Plain JavaScript object with event trigger data
|
|
77
|
+
*/
|
|
78
|
+
static fromOutputData(outputData) {
|
|
79
|
+
const eventOutput = outputData.getEventTrigger();
|
|
80
|
+
return eventOutput?.toObject() || null;
|
|
81
|
+
}
|
|
73
82
|
}
|
|
74
83
|
export default EventTrigger;
|
|
@@ -18,6 +18,7 @@ declare class TriggerFactory {
|
|
|
18
18
|
* @returns
|
|
19
19
|
*/
|
|
20
20
|
static fromResponse(raw: avs_pb.TaskTrigger): Trigger;
|
|
21
|
+
static fromOutputData(outputData: avs_pb.RunTriggerResp): any;
|
|
21
22
|
}
|
|
22
23
|
export default TriggerFactory;
|
|
23
24
|
export { Trigger, BlockTrigger, CronTrigger, EventTrigger, FixedTimeTrigger, ManualTrigger, };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,YAAY,EAAE,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,WAAW,EAAE,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AACvD,OAAO,YAAY,EAAE,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,gBAAgB,EAAE,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,aAAa,EAAE,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC7D,OAAO,OAAO,EAAE,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,YAAY,EAAE,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,WAAW,EAAE,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AACvD,OAAO,YAAY,EAAE,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,gBAAgB,EAAE,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,aAAa,EAAE,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC7D,OAAO,OAAO,EAAE,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAIpD,cAAM,cAAc;IAClB;;;;OAIG;IACH,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO;IAkB3C;;;;OAIG;IACH,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,OAAO;IAiBrD,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,GAAG;CA+C9D;AAED,eAAe,cAAc,CAAC;AAG9B,OAAO,EACL,OAAO,EACP,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,aAAa,GACd,CAAC;AAGF,YAAY,EACV,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,GACnB,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
1
2
|
import BlockTrigger from "./block";
|
|
2
3
|
import CronTrigger from "./cron";
|
|
3
4
|
import EventTrigger from "./event";
|
|
@@ -5,6 +6,7 @@ import FixedTimeTrigger from "./fixedTime";
|
|
|
5
6
|
import ManualTrigger from "./manual";
|
|
6
7
|
import Trigger from "./interface";
|
|
7
8
|
import { TriggerType } from "@avaprotocol/types";
|
|
9
|
+
import { convertProtobufValueToJs } from "../../utils";
|
|
8
10
|
class TriggerFactory {
|
|
9
11
|
/**
|
|
10
12
|
* Static factory method to create Trigger instances
|
|
@@ -48,6 +50,46 @@ class TriggerFactory {
|
|
|
48
50
|
throw new Error("Unknown trigger type");
|
|
49
51
|
}
|
|
50
52
|
}
|
|
53
|
+
static fromOutputData(outputData) {
|
|
54
|
+
// Generic approach: try to extract data from any output type using getData() method
|
|
55
|
+
// This works for all trigger types that follow the pattern of having a getData() method
|
|
56
|
+
let triggerOutput = null;
|
|
57
|
+
let rawData = null;
|
|
58
|
+
// Get the specific trigger output based on the case
|
|
59
|
+
switch (outputData.getOutputDataCase()) {
|
|
60
|
+
case avs_pb.RunTriggerResp.OutputDataCase.BLOCK_TRIGGER:
|
|
61
|
+
triggerOutput = outputData.getBlockTrigger();
|
|
62
|
+
break;
|
|
63
|
+
case avs_pb.RunTriggerResp.OutputDataCase.FIXED_TIME_TRIGGER:
|
|
64
|
+
triggerOutput = outputData.getFixedTimeTrigger();
|
|
65
|
+
break;
|
|
66
|
+
case avs_pb.RunTriggerResp.OutputDataCase.CRON_TRIGGER:
|
|
67
|
+
triggerOutput = outputData.getCronTrigger();
|
|
68
|
+
break;
|
|
69
|
+
case avs_pb.RunTriggerResp.OutputDataCase.EVENT_TRIGGER:
|
|
70
|
+
triggerOutput = outputData.getEventTrigger();
|
|
71
|
+
break;
|
|
72
|
+
case avs_pb.RunTriggerResp.OutputDataCase.MANUAL_TRIGGER:
|
|
73
|
+
triggerOutput = outputData.getManualTrigger();
|
|
74
|
+
break;
|
|
75
|
+
case avs_pb.RunTriggerResp.OutputDataCase.OUTPUT_DATA_NOT_SET:
|
|
76
|
+
default:
|
|
77
|
+
throw new Error(`Unsupported output data case: ${outputData.getOutputDataCase()}`);
|
|
78
|
+
}
|
|
79
|
+
if (!triggerOutput) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
// Try to get data using getData() method (works for most trigger types)
|
|
83
|
+
if (typeof triggerOutput.getData === 'function') {
|
|
84
|
+
rawData = triggerOutput.getData();
|
|
85
|
+
if (rawData) {
|
|
86
|
+
return convertProtobufValueToJs(rawData);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
// For trigger types that don't have getData() or have special structures,
|
|
90
|
+
// fall back to toObject() for now (can be specialized later if needed)
|
|
91
|
+
return triggerOutput.toObject();
|
|
92
|
+
}
|
|
51
93
|
}
|
|
52
94
|
export default TriggerFactory;
|
|
53
95
|
// Trigger object definitions
|
|
@@ -9,11 +9,17 @@ declare class FixedTimeTrigger extends Trigger {
|
|
|
9
9
|
toRequest(): avs_pb.TaskTrigger;
|
|
10
10
|
static fromResponse(raw: avs_pb.TaskTrigger): FixedTimeTrigger;
|
|
11
11
|
/**
|
|
12
|
-
* Convert raw data from
|
|
12
|
+
* Convert raw data from runTrigger response to FixedTimeOutput format
|
|
13
13
|
* @param rawData - The raw data from the gRPC response
|
|
14
14
|
* @returns {FixedTimeTriggerOutput | undefined} - The converted data
|
|
15
15
|
*/
|
|
16
16
|
getOutput(): FixedTimeTriggerOutput | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Extract output data from RunTriggerResp for fixed time triggers
|
|
19
|
+
* @param outputData - The RunTriggerResp containing fixed time trigger output
|
|
20
|
+
* @returns Plain JavaScript object with fixed time trigger data
|
|
21
|
+
*/
|
|
22
|
+
static fromOutputData(outputData: avs_pb.RunTriggerResp): any;
|
|
17
23
|
}
|
|
18
24
|
export default FixedTimeTrigger;
|
|
19
25
|
//# sourceMappingURL=fixedTime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fixedTime.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/fixedTime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,OAAO,EAAE,EAAiB,YAAY,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAe,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAGnG,MAAM,MAAM,qBAAqB,GAAG,YAAY,GAAG;IACjD,IAAI,EAAE,wBAAwB,CAAC;CAChC,CAAC;AAEF,cAAM,gBAAiB,SAAQ,OAAO;gBACxB,KAAK,EAAE,qBAAqB;IAIxC,SAAS,IAAI,MAAM,CAAC,WAAW;IAmB/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,gBAAgB;IAuB9D;;;;OAIG;IACH,SAAS,IAAI,sBAAsB,GAAG,SAAS;
|
|
1
|
+
{"version":3,"file":"fixedTime.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/fixedTime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,OAAO,EAAE,EAAiB,YAAY,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAe,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAGnG,MAAM,MAAM,qBAAqB,GAAG,YAAY,GAAG;IACjD,IAAI,EAAE,wBAAwB,CAAC;CAChC,CAAC;AAEF,cAAM,gBAAiB,SAAQ,OAAO;gBACxB,KAAK,EAAE,qBAAqB;IAIxC,SAAS,IAAI,MAAM,CAAC,WAAW;IAmB/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,gBAAgB;IAuB9D;;;;OAIG;IACH,SAAS,IAAI,sBAAsB,GAAG,SAAS;IAI/C;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,GAAG;CAI9D;AAED,eAAe,gBAAgB,CAAC"}
|