@avaprotocol/sdk-js 2.6.11 → 2.6.12
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 +8 -0
- package/dist/index.js +39 -7
- package/dist/index.mjs +39 -7
- package/dist/models/node/contractRead.js +2 -2
- package/dist/models/node/contractWrite.d.ts.map +1 -1
- package/dist/models/node/contractWrite.js +6 -5
- package/dist/models/node/graphqlQuery.d.ts +21 -0
- package/dist/models/node/graphqlQuery.d.ts.map +1 -1
- package/dist/models/node/graphqlQuery.js +13 -6
- package/dist/models/node/loop.js +1 -1
- package/dist/models/node/restApi.d.ts.map +1 -1
- package/dist/models/node/restApi.js +0 -1
- package/dist/models/step.d.ts.map +1 -1
- package/dist/models/step.js +33 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -16487,7 +16487,7 @@ var ContractWriteNode2 = class _ContractWriteNode extends Node {
|
|
|
16487
16487
|
return value;
|
|
16488
16488
|
});
|
|
16489
16489
|
config.setContractAbiList(abiValueList);
|
|
16490
|
-
const methodCalls = configData.methodCalls
|
|
16490
|
+
const methodCalls = configData.methodCalls;
|
|
16491
16491
|
methodCalls.forEach((methodCall) => {
|
|
16492
16492
|
const methodCallMsg = new avs_pb9.ContractWriteNode.MethodCall();
|
|
16493
16493
|
if (methodCall.callData) {
|
|
@@ -16625,9 +16625,9 @@ var GraphQLQueryNode2 = class _GraphQLQueryNode extends Node {
|
|
|
16625
16625
|
const config = new avs_pb11.GraphQLQueryNode.Config();
|
|
16626
16626
|
config.setUrl(configData.url);
|
|
16627
16627
|
config.setQuery(configData.query);
|
|
16628
|
-
if (configData.
|
|
16628
|
+
if (configData.variables && Object.keys(configData.variables).length > 0) {
|
|
16629
16629
|
const variablesMap = config.getVariablesMap();
|
|
16630
|
-
configData.
|
|
16630
|
+
Object.entries(configData.variables).forEach(([key, value]) => {
|
|
16631
16631
|
variablesMap.set(key, value);
|
|
16632
16632
|
});
|
|
16633
16633
|
}
|
|
@@ -16636,10 +16636,20 @@ var GraphQLQueryNode2 = class _GraphQLQueryNode extends Node {
|
|
|
16636
16636
|
}
|
|
16637
16637
|
static fromResponse(raw) {
|
|
16638
16638
|
const obj = raw.toObject();
|
|
16639
|
+
const config = raw.getGraphqlQuery().getConfig();
|
|
16640
|
+
const variablesMap = config.getVariablesMap();
|
|
16641
|
+
const variables = {};
|
|
16642
|
+
variablesMap.forEach((value, key) => {
|
|
16643
|
+
variables[key] = value;
|
|
16644
|
+
});
|
|
16639
16645
|
return new _GraphQLQueryNode({
|
|
16640
16646
|
...obj,
|
|
16641
16647
|
type: import_types11.NodeType.GraphQLQuery,
|
|
16642
|
-
data:
|
|
16648
|
+
data: {
|
|
16649
|
+
url: config.getUrl(),
|
|
16650
|
+
query: config.getQuery(),
|
|
16651
|
+
variables
|
|
16652
|
+
}
|
|
16643
16653
|
});
|
|
16644
16654
|
}
|
|
16645
16655
|
toRequest() {
|
|
@@ -16726,7 +16736,6 @@ var RestAPINode2 = class _RestAPINode extends Node {
|
|
|
16726
16736
|
static fromOutputData(outputData) {
|
|
16727
16737
|
const restApiOutput = outputData.getRestApi();
|
|
16728
16738
|
if (!restApiOutput) {
|
|
16729
|
-
console.log("Debug RestAPI: No restApiOutput found");
|
|
16730
16739
|
return null;
|
|
16731
16740
|
}
|
|
16732
16741
|
const rawData = restApiOutput.getData();
|
|
@@ -16763,7 +16772,7 @@ var ContractReadNode2 = class _ContractReadNode extends Node {
|
|
|
16763
16772
|
return value;
|
|
16764
16773
|
});
|
|
16765
16774
|
config.setContractAbiList(abiValueList);
|
|
16766
|
-
const methodCalls = configData.methodCalls
|
|
16775
|
+
const methodCalls = configData.methodCalls;
|
|
16767
16776
|
methodCalls.forEach((methodCall) => {
|
|
16768
16777
|
const methodCallMsg = new avs_pb13.ContractReadNode.MethodCall();
|
|
16769
16778
|
methodCallMsg.setMethodName(methodCall.methodName);
|
|
@@ -17133,7 +17142,7 @@ var LoopNode2 = class _LoopNode extends Node {
|
|
|
17133
17142
|
const graphqlQuery = graphqlQuery_default.createProtobufNode({
|
|
17134
17143
|
url: gqlConfig.url,
|
|
17135
17144
|
query: gqlConfig.query,
|
|
17136
|
-
|
|
17145
|
+
variables: gqlConfig.variables
|
|
17137
17146
|
});
|
|
17138
17147
|
loopNode.setGraphqlDataQuery(graphqlQuery);
|
|
17139
17148
|
break;
|
|
@@ -17473,6 +17482,22 @@ var Step = class _Step {
|
|
|
17473
17482
|
static getOutput(step) {
|
|
17474
17483
|
const outputData = this.extractOutputData(step);
|
|
17475
17484
|
if (!outputData) return null;
|
|
17485
|
+
const outputCase = this.getOutputDataCase(step);
|
|
17486
|
+
if (outputCase === avs_pb20.Execution.Step.OutputDataCase.CONTRACT_WRITE || outputCase === avs_pb20.Execution.Step.OutputDataCase.CONTRACT_READ) {
|
|
17487
|
+
try {
|
|
17488
|
+
const result = {};
|
|
17489
|
+
if (typeof outputData.getData === "function") {
|
|
17490
|
+
result.data = convertProtobufValueToJs(outputData.getData());
|
|
17491
|
+
}
|
|
17492
|
+
if (typeof outputData.getMetadata === "function") {
|
|
17493
|
+
result.metadata = convertProtobufValueToJs(outputData.getMetadata());
|
|
17494
|
+
}
|
|
17495
|
+
return result;
|
|
17496
|
+
} catch (error) {
|
|
17497
|
+
console.warn("Failed to convert ContractWrite/ContractRead protobuf to JavaScript:", error);
|
|
17498
|
+
return outputData.getData ? outputData.getData() : null;
|
|
17499
|
+
}
|
|
17500
|
+
}
|
|
17476
17501
|
if (typeof outputData.hasData === "function" && outputData.hasData()) {
|
|
17477
17502
|
try {
|
|
17478
17503
|
return convertProtobufValueToJs(outputData.getData());
|
|
@@ -17480,6 +17505,13 @@ var Step = class _Step {
|
|
|
17480
17505
|
console.warn("Failed to convert protobuf Value to JavaScript:", error);
|
|
17481
17506
|
return outputData.getData();
|
|
17482
17507
|
}
|
|
17508
|
+
} else if (typeof outputData.getData === "function") {
|
|
17509
|
+
try {
|
|
17510
|
+
return convertProtobufValueToJs(outputData.getData());
|
|
17511
|
+
} catch (error) {
|
|
17512
|
+
console.warn("Failed to convert protobuf Value to JavaScript:", error);
|
|
17513
|
+
return outputData.getData();
|
|
17514
|
+
}
|
|
17483
17515
|
} else if (outputData.data) {
|
|
17484
17516
|
return typeof outputData.data.getKindCase === "function" ? convertProtobufValueToJs(outputData.data) : outputData.data;
|
|
17485
17517
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -16475,7 +16475,7 @@ var ContractWriteNode2 = class _ContractWriteNode extends Node {
|
|
|
16475
16475
|
return value;
|
|
16476
16476
|
});
|
|
16477
16477
|
config.setContractAbiList(abiValueList);
|
|
16478
|
-
const methodCalls = configData.methodCalls
|
|
16478
|
+
const methodCalls = configData.methodCalls;
|
|
16479
16479
|
methodCalls.forEach((methodCall) => {
|
|
16480
16480
|
const methodCallMsg = new avs_pb9.ContractWriteNode.MethodCall();
|
|
16481
16481
|
if (methodCall.callData) {
|
|
@@ -16617,9 +16617,9 @@ var GraphQLQueryNode2 = class _GraphQLQueryNode extends Node {
|
|
|
16617
16617
|
const config = new avs_pb11.GraphQLQueryNode.Config();
|
|
16618
16618
|
config.setUrl(configData.url);
|
|
16619
16619
|
config.setQuery(configData.query);
|
|
16620
|
-
if (configData.
|
|
16620
|
+
if (configData.variables && Object.keys(configData.variables).length > 0) {
|
|
16621
16621
|
const variablesMap = config.getVariablesMap();
|
|
16622
|
-
configData.
|
|
16622
|
+
Object.entries(configData.variables).forEach(([key, value]) => {
|
|
16623
16623
|
variablesMap.set(key, value);
|
|
16624
16624
|
});
|
|
16625
16625
|
}
|
|
@@ -16628,10 +16628,20 @@ var GraphQLQueryNode2 = class _GraphQLQueryNode extends Node {
|
|
|
16628
16628
|
}
|
|
16629
16629
|
static fromResponse(raw) {
|
|
16630
16630
|
const obj = raw.toObject();
|
|
16631
|
+
const config = raw.getGraphqlQuery().getConfig();
|
|
16632
|
+
const variablesMap = config.getVariablesMap();
|
|
16633
|
+
const variables = {};
|
|
16634
|
+
variablesMap.forEach((value, key) => {
|
|
16635
|
+
variables[key] = value;
|
|
16636
|
+
});
|
|
16631
16637
|
return new _GraphQLQueryNode({
|
|
16632
16638
|
...obj,
|
|
16633
16639
|
type: NodeType5.GraphQLQuery,
|
|
16634
|
-
data:
|
|
16640
|
+
data: {
|
|
16641
|
+
url: config.getUrl(),
|
|
16642
|
+
query: config.getQuery(),
|
|
16643
|
+
variables
|
|
16644
|
+
}
|
|
16635
16645
|
});
|
|
16636
16646
|
}
|
|
16637
16647
|
toRequest() {
|
|
@@ -16720,7 +16730,6 @@ var RestAPINode2 = class _RestAPINode extends Node {
|
|
|
16720
16730
|
static fromOutputData(outputData) {
|
|
16721
16731
|
const restApiOutput = outputData.getRestApi();
|
|
16722
16732
|
if (!restApiOutput) {
|
|
16723
|
-
console.log("Debug RestAPI: No restApiOutput found");
|
|
16724
16733
|
return null;
|
|
16725
16734
|
}
|
|
16726
16735
|
const rawData = restApiOutput.getData();
|
|
@@ -16759,7 +16768,7 @@ var ContractReadNode2 = class _ContractReadNode extends Node {
|
|
|
16759
16768
|
return value;
|
|
16760
16769
|
});
|
|
16761
16770
|
config.setContractAbiList(abiValueList);
|
|
16762
|
-
const methodCalls = configData.methodCalls
|
|
16771
|
+
const methodCalls = configData.methodCalls;
|
|
16763
16772
|
methodCalls.forEach((methodCall) => {
|
|
16764
16773
|
const methodCallMsg = new avs_pb13.ContractReadNode.MethodCall();
|
|
16765
16774
|
methodCallMsg.setMethodName(methodCall.methodName);
|
|
@@ -17138,7 +17147,7 @@ var LoopNode2 = class _LoopNode extends Node {
|
|
|
17138
17147
|
const graphqlQuery = graphqlQuery_default.createProtobufNode({
|
|
17139
17148
|
url: gqlConfig.url,
|
|
17140
17149
|
query: gqlConfig.query,
|
|
17141
|
-
|
|
17150
|
+
variables: gqlConfig.variables
|
|
17142
17151
|
});
|
|
17143
17152
|
loopNode.setGraphqlDataQuery(graphqlQuery);
|
|
17144
17153
|
break;
|
|
@@ -17480,6 +17489,22 @@ var Step = class _Step {
|
|
|
17480
17489
|
static getOutput(step) {
|
|
17481
17490
|
const outputData = this.extractOutputData(step);
|
|
17482
17491
|
if (!outputData) return null;
|
|
17492
|
+
const outputCase = this.getOutputDataCase(step);
|
|
17493
|
+
if (outputCase === avs_pb20.Execution.Step.OutputDataCase.CONTRACT_WRITE || outputCase === avs_pb20.Execution.Step.OutputDataCase.CONTRACT_READ) {
|
|
17494
|
+
try {
|
|
17495
|
+
const result = {};
|
|
17496
|
+
if (typeof outputData.getData === "function") {
|
|
17497
|
+
result.data = convertProtobufValueToJs(outputData.getData());
|
|
17498
|
+
}
|
|
17499
|
+
if (typeof outputData.getMetadata === "function") {
|
|
17500
|
+
result.metadata = convertProtobufValueToJs(outputData.getMetadata());
|
|
17501
|
+
}
|
|
17502
|
+
return result;
|
|
17503
|
+
} catch (error) {
|
|
17504
|
+
console.warn("Failed to convert ContractWrite/ContractRead protobuf to JavaScript:", error);
|
|
17505
|
+
return outputData.getData ? outputData.getData() : null;
|
|
17506
|
+
}
|
|
17507
|
+
}
|
|
17483
17508
|
if (typeof outputData.hasData === "function" && outputData.hasData()) {
|
|
17484
17509
|
try {
|
|
17485
17510
|
return convertProtobufValueToJs(outputData.getData());
|
|
@@ -17487,6 +17512,13 @@ var Step = class _Step {
|
|
|
17487
17512
|
console.warn("Failed to convert protobuf Value to JavaScript:", error);
|
|
17488
17513
|
return outputData.getData();
|
|
17489
17514
|
}
|
|
17515
|
+
} else if (typeof outputData.getData === "function") {
|
|
17516
|
+
try {
|
|
17517
|
+
return convertProtobufValueToJs(outputData.getData());
|
|
17518
|
+
} catch (error) {
|
|
17519
|
+
console.warn("Failed to convert protobuf Value to JavaScript:", error);
|
|
17520
|
+
return outputData.getData();
|
|
17521
|
+
}
|
|
17490
17522
|
} else if (outputData.data) {
|
|
17491
17523
|
return typeof outputData.data.getKindCase === "function" ? convertProtobufValueToJs(outputData.data) : outputData.data;
|
|
17492
17524
|
}
|
|
@@ -24,8 +24,8 @@ class ContractReadNode extends Node {
|
|
|
24
24
|
return value;
|
|
25
25
|
});
|
|
26
26
|
config.setContractAbiList(abiValueList);
|
|
27
|
-
// Handle method calls array
|
|
28
|
-
const methodCalls = configData.methodCalls
|
|
27
|
+
// Handle method calls array (now required)
|
|
28
|
+
const methodCalls = configData.methodCalls;
|
|
29
29
|
methodCalls.forEach((methodCall) => {
|
|
30
30
|
const methodCallMsg = new avs_pb.ContractReadNode.MethodCall();
|
|
31
31
|
methodCallMsg.setMethodName(methodCall.methodName);
|
|
@@ -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;AAEhD,OAAO,EAEL,qBAAqB,EACrB,sBAAsB,EAEvB,MAAM,oBAAoB,CAAC;AAK5B,cAAM,iBAAkB,SAAQ,IAAI;gBACtB,KAAK,EAAE,sBAAsB;IAIzC;;;;OAIG;IACH,MAAM,CAAC,kBAAkB,CAAC,UAAU,EAAE,qBAAqB,GAAG,MAAM,CAAC,iBAAiB;IAuCtF,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,iBAAiB;IA8B5D,SAAS,IAAI,MAAM,CAAC,QAAQ;IAe5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;
|
|
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;AAEhD,OAAO,EAEL,qBAAqB,EACrB,sBAAsB,EAEvB,MAAM,oBAAoB,CAAC;AAK5B,cAAM,iBAAkB,SAAQ,IAAI;gBACtB,KAAK,EAAE,sBAAsB;IAIzC;;;;OAIG;IACH,MAAM,CAAC,kBAAkB,CAAC,UAAU,EAAE,qBAAqB,GAAG,MAAM,CAAC,iBAAiB;IAuCtF,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,iBAAiB;IA8B5D,SAAS,IAAI,MAAM,CAAC,QAAQ;IAe5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAYrE;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -25,8 +25,8 @@ class ContractWriteNode extends Node {
|
|
|
25
25
|
return value;
|
|
26
26
|
});
|
|
27
27
|
config.setContractAbiList(abiValueList);
|
|
28
|
-
// Handle method calls array
|
|
29
|
-
const methodCalls = configData.methodCalls
|
|
28
|
+
// Handle method calls array (now required)
|
|
29
|
+
const methodCalls = configData.methodCalls;
|
|
30
30
|
methodCalls.forEach((methodCall) => {
|
|
31
31
|
const methodCallMsg = new avs_pb.ContractWriteNode.MethodCall();
|
|
32
32
|
// Set callData only if provided (now optional)
|
|
@@ -81,10 +81,11 @@ class ContractWriteNode extends Node {
|
|
|
81
81
|
const contractWriteOutput = outputData.getContractWrite();
|
|
82
82
|
if (!contractWriteOutput)
|
|
83
83
|
return null;
|
|
84
|
-
//
|
|
85
|
-
//
|
|
84
|
+
// ContractWrite decoded events are stored in data field (flattened object format)
|
|
85
|
+
// This contains parsed receipt logs/events, similar to ContractRead format
|
|
86
86
|
const dataValue = contractWriteOutput.getData();
|
|
87
|
-
// Convert protobuf Value to JavaScript object (
|
|
87
|
+
// Convert protobuf Value to JavaScript object (decoded events object)
|
|
88
|
+
// Return empty object if no events were decoded from transaction receipts
|
|
88
89
|
return dataValue ? convertProtobufValueToJs(dataValue) : {};
|
|
89
90
|
}
|
|
90
91
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import Node from "./interface";
|
|
2
|
+
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
3
|
+
import { GraphQLQueryNodeProps } from "@avaprotocol/types";
|
|
4
|
+
declare class GraphQLQueryNode extends Node {
|
|
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
|
+
variables?: Record<string, string>;
|
|
15
|
+
}): avs_pb.GraphQLQueryNode;
|
|
16
|
+
static fromResponse(raw: avs_pb.TaskNode): GraphQLQueryNode;
|
|
17
|
+
toRequest(): avs_pb.TaskNode;
|
|
18
|
+
static fromOutputData(outputData: avs_pb.RunNodeWithInputsResp): Record<string, unknown> | null;
|
|
19
|
+
}
|
|
20
|
+
export default GraphQLQueryNode;
|
|
21
|
+
//# 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,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAGL,qBAAqB,EAEtB,MAAM,oBAAoB,CAAC;AAK5B,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,
|
|
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,EAGL,qBAAqB,EAEtB,MAAM,oBAAoB,CAAC;AAK5B,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,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACpC,GAAG,MAAM,CAAC,gBAAgB;IAkB3B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,gBAAgB;IAuB3D,SAAS,IAAI,MAAM,CAAC,QAAQ;IAe5B,MAAM,CAAC,cAAc,CACnB,UAAU,EAAE,MAAM,CAAC,qBAAqB,GACvC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;CAclC;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -21,9 +21,9 @@ class GraphQLQueryNode extends Node {
|
|
|
21
21
|
const config = new avs_pb.GraphQLQueryNode.Config();
|
|
22
22
|
config.setUrl(configData.url);
|
|
23
23
|
config.setQuery(configData.query);
|
|
24
|
-
if (configData.
|
|
24
|
+
if (configData.variables && Object.keys(configData.variables).length > 0) {
|
|
25
25
|
const variablesMap = config.getVariablesMap();
|
|
26
|
-
configData.
|
|
26
|
+
Object.entries(configData.variables).forEach(([key, value]) => {
|
|
27
27
|
variablesMap.set(key, value);
|
|
28
28
|
});
|
|
29
29
|
}
|
|
@@ -33,13 +33,20 @@ class GraphQLQueryNode extends Node {
|
|
|
33
33
|
static fromResponse(raw) {
|
|
34
34
|
// Convert the raw object to GraphQLQueryNodeProps, which should keep name and id
|
|
35
35
|
const obj = raw.toObject();
|
|
36
|
+
const config = raw.getGraphqlQuery().getConfig();
|
|
37
|
+
const variablesMap = config.getVariablesMap();
|
|
38
|
+
const variables = {};
|
|
39
|
+
variablesMap.forEach((value, key) => {
|
|
40
|
+
variables[key] = value;
|
|
41
|
+
});
|
|
36
42
|
return new GraphQLQueryNode({
|
|
37
43
|
...obj,
|
|
38
44
|
type: NodeType.GraphQLQuery,
|
|
39
|
-
data:
|
|
40
|
-
.
|
|
41
|
-
.
|
|
42
|
-
|
|
45
|
+
data: {
|
|
46
|
+
url: config.getUrl(),
|
|
47
|
+
query: config.getQuery(),
|
|
48
|
+
variables: variables,
|
|
49
|
+
},
|
|
43
50
|
});
|
|
44
51
|
}
|
|
45
52
|
toRequest() {
|
package/dist/models/node/loop.js
CHANGED
|
@@ -166,7 +166,7 @@ class LoopNode extends Node {
|
|
|
166
166
|
const graphqlQuery = GraphQLQueryNode.createProtobufNode({
|
|
167
167
|
url: gqlConfig.url,
|
|
168
168
|
query: gqlConfig.query,
|
|
169
|
-
|
|
169
|
+
variables: gqlConfig.variables,
|
|
170
170
|
});
|
|
171
171
|
loopNode.setGraphqlDataQuery(graphqlQuery);
|
|
172
172
|
break;
|
|
@@ -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,EAGL,gBAAgB,EAEjB,MAAM,oBAAoB,CAAC;AAS5B,cAAM,WAAY,SAAQ,IAAI;gBAChB,KAAK,EAAE,gBAAgB;IAInC;;;;OAIG;IACH,MAAM,CAAC,kBAAkB,CAAC,UAAU,EAAE;QACpC,GAAG,EAAE,MAAM,CAAC;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAClC,GAAG,MAAM,CAAC,WAAW;IAmBtB,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,WAAW;IAuBtD,SAAS,IAAI,MAAM,CAAC,QAAQ;IAe5B,MAAM,CAAC,cAAc,CACnB,UAAU,EAAE,MAAM,CAAC,qBAAqB,GACvC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;
|
|
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;;;;OAIG;IACH,MAAM,CAAC,kBAAkB,CAAC,UAAU,EAAE;QACpC,GAAG,EAAE,MAAM,CAAC;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAClC,GAAG,MAAM,CAAC,WAAW;IAmBtB,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,WAAW;IAuBtD,SAAS,IAAI,MAAM,CAAC,QAAQ;IAe5B,MAAM,CAAC,cAAc,CACnB,UAAU,EAAE,MAAM,CAAC,qBAAqB,GACvC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;CAclC;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -59,7 +59,6 @@ class RestAPINode extends Node {
|
|
|
59
59
|
static fromOutputData(outputData) {
|
|
60
60
|
const restApiOutput = outputData.getRestApi();
|
|
61
61
|
if (!restApiOutput) {
|
|
62
|
-
console.log("Debug RestAPI: No restApiOutput found");
|
|
63
62
|
return null;
|
|
64
63
|
}
|
|
65
64
|
// Use convertProtobufValueToJs to get clean JavaScript objects
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../src/models/step.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAMhD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAEhE,cAAM,IAAK,YAAW,SAAS;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,MAAM,EAAE,eAAe,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;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,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,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;IAwD9D,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAiEhC,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAgChC,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI,GAAG,IAAI;CAqEvD;AAED,eAAe,IAAI,CAAC"}
|
package/dist/models/step.js
CHANGED
|
@@ -37,7 +37,30 @@ class Step {
|
|
|
37
37
|
const outputData = this.extractOutputData(step);
|
|
38
38
|
if (!outputData)
|
|
39
39
|
return null;
|
|
40
|
-
|
|
40
|
+
const outputCase = this.getOutputDataCase(step);
|
|
41
|
+
// 🚀 Special handling for ContractWrite and ContractRead - return both data and metadata
|
|
42
|
+
if (outputCase === avs_pb.Execution.Step.OutputDataCase.CONTRACT_WRITE ||
|
|
43
|
+
outputCase === avs_pb.Execution.Step.OutputDataCase.CONTRACT_READ) {
|
|
44
|
+
try {
|
|
45
|
+
const result = {};
|
|
46
|
+
// Extract data field (decoded events/results)
|
|
47
|
+
if (typeof outputData.getData === "function") {
|
|
48
|
+
result.data = convertProtobufValueToJs(outputData.getData());
|
|
49
|
+
}
|
|
50
|
+
// Extract metadata field (method execution details)
|
|
51
|
+
if (typeof outputData.getMetadata === "function") {
|
|
52
|
+
result.metadata = convertProtobufValueToJs(outputData.getMetadata());
|
|
53
|
+
}
|
|
54
|
+
// Return both data and metadata for ContractWrite and ContractRead
|
|
55
|
+
// This ensures consistent structure between simulated and deployed workflow execution
|
|
56
|
+
return result;
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
console.warn("Failed to convert ContractWrite/ContractRead protobuf to JavaScript:", error);
|
|
60
|
+
return outputData.getData ? outputData.getData() : null;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
// STANDARDIZED Direct Mapping - ALL other triggers and nodes use the same logic
|
|
41
64
|
if (typeof outputData.hasData === "function" && outputData.hasData()) {
|
|
42
65
|
try {
|
|
43
66
|
return convertProtobufValueToJs(outputData.getData());
|
|
@@ -47,6 +70,15 @@ class Step {
|
|
|
47
70
|
return outputData.getData();
|
|
48
71
|
}
|
|
49
72
|
}
|
|
73
|
+
else if (typeof outputData.getData === "function") {
|
|
74
|
+
try {
|
|
75
|
+
return convertProtobufValueToJs(outputData.getData());
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
console.warn("Failed to convert protobuf Value to JavaScript:", error);
|
|
79
|
+
return outputData.getData();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
50
82
|
else if (outputData.data) {
|
|
51
83
|
// For plain objects, try to convert or use directly
|
|
52
84
|
return typeof outputData.data.getKindCase === "function"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@avaprotocol/sdk-js",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.12",
|
|
4
4
|
"description": "A JavaScript/TypeScript SDK designed to simplify integration with Ava Protocol's AVS",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"prepare": "node ../../scripts/prepare-package.js"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@avaprotocol/types": "^2.4.
|
|
34
|
+
"@avaprotocol/types": "^2.4.10",
|
|
35
35
|
"@grpc/grpc-js": "^1.11.3",
|
|
36
36
|
"@grpc/proto-loader": "^0.7.13",
|
|
37
37
|
"dotenv": "^16.4.5",
|