@avaprotocol/sdk-js 2.5.2-dev.1 → 2.6.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/CHANGELOG.md +19 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +774 -2617
- package/dist/index.mjs +788 -2619
- package/dist/models/node/branch.d.ts.map +1 -1
- package/dist/models/node/branch.js +2 -11
- 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 +5 -14
- package/dist/models/node/contractWrite.d.ts +2 -1
- package/dist/models/node/contractWrite.d.ts.map +1 -1
- package/dist/models/node/contractWrite.js +4 -14
- package/dist/models/node/customCode.d.ts.map +1 -1
- package/dist/models/node/customCode.js +1 -14
- package/dist/models/node/ethTransfer.d.ts.map +1 -1
- package/dist/models/node/ethTransfer.js +6 -11
- package/dist/models/node/filter.d.ts.map +1 -1
- package/dist/models/node/filter.js +20 -18
- package/dist/models/node/graphqlQuery.d.ts.map +1 -1
- package/dist/models/node/graphqlQuery.js +5 -11
- package/dist/models/node/interface.d.ts +0 -1
- package/dist/models/node/interface.d.ts.map +1 -1
- package/dist/models/node/interface.js +0 -8
- package/dist/models/node/loop.d.ts.map +1 -1
- package/dist/models/node/loop.js +58 -85
- package/dist/models/node/restApi.d.ts.map +1 -1
- package/dist/models/node/restApi.js +1 -15
- package/dist/models/step.d.ts +3 -1
- package/dist/models/step.d.ts.map +1 -1
- package/dist/models/step.js +104 -365
- package/dist/models/trigger/block.d.ts.map +1 -1
- package/dist/models/trigger/block.js +18 -20
- package/dist/models/trigger/cron.d.ts.map +1 -1
- package/dist/models/trigger/cron.js +9 -28
- package/dist/models/trigger/event.d.ts.map +1 -1
- package/dist/models/trigger/event.js +1 -12
- package/dist/models/trigger/fixedTime.d.ts.map +1 -1
- package/dist/models/trigger/fixedTime.js +9 -20
- package/dist/models/trigger/interface.d.ts +1 -1
- package/dist/models/trigger/interface.d.ts.map +1 -1
- package/dist/models/trigger/interface.js +7 -2
- package/dist/models/trigger/manual.d.ts +0 -3
- package/dist/models/trigger/manual.d.ts.map +1 -1
- package/dist/models/trigger/manual.js +33 -44
- package/package.json +2 -2
package/dist/models/node/loop.js
CHANGED
|
@@ -7,7 +7,6 @@ import GraphQLQueryNode from "./graphqlQuery";
|
|
|
7
7
|
import ContractReadNode from "./contractRead";
|
|
8
8
|
import ContractWriteNode from "./contractWrite";
|
|
9
9
|
import { NodeType, ExecutionMode, } from "@avaprotocol/types";
|
|
10
|
-
import { convertInputToProtobuf, extractInputFromProtobuf } from "../../utils";
|
|
11
10
|
class LoopNode extends Node {
|
|
12
11
|
constructor(props) {
|
|
13
12
|
super({ ...props, type: NodeType.Loop, data: props.data });
|
|
@@ -30,17 +29,10 @@ class LoopNode extends Node {
|
|
|
30
29
|
// Map execution mode from protobuf enum to ExecutionMode enum
|
|
31
30
|
executionMode: this.mapExecutionModeFromProtobuf(configData?.executionMode),
|
|
32
31
|
};
|
|
33
|
-
// Extract input data from top-level TaskNode.input field (not nested LoopNode.input)
|
|
34
|
-
// This matches where we set it in toRequest() and where the Go backend looks for it
|
|
35
|
-
let input = undefined;
|
|
36
|
-
if (raw.hasInput()) {
|
|
37
|
-
input = extractInputFromProtobuf(raw.getInput());
|
|
38
|
-
}
|
|
39
32
|
return new LoopNode({
|
|
40
33
|
...obj,
|
|
41
34
|
type: NodeType.Loop,
|
|
42
35
|
data: data,
|
|
43
|
-
input: input,
|
|
44
36
|
});
|
|
45
37
|
}
|
|
46
38
|
static extractRunnerFromProtobuf(loopNodeData) {
|
|
@@ -106,19 +98,13 @@ class LoopNode extends Node {
|
|
|
106
98
|
const data = this.data;
|
|
107
99
|
// Set the loop config from the flat data structure
|
|
108
100
|
const config = new avs_pb.LoopNode.Config();
|
|
109
|
-
config.
|
|
101
|
+
config.setInputNodeName(data.inputNodeName || "");
|
|
110
102
|
config.setIterVal(data.iterVal || "");
|
|
111
103
|
config.setIterKey(data.iterKey || "");
|
|
112
104
|
// Set execution mode - map ExecutionMode enum to protobuf enum
|
|
113
105
|
const executionMode = this.mapExecutionModeToProtobuf(data.executionMode);
|
|
114
106
|
config.setExecutionMode(executionMode);
|
|
115
107
|
loopNode.setConfig(config);
|
|
116
|
-
// Set input data on the top-level TaskNode, not the nested LoopNode
|
|
117
|
-
// This matches where the Go backend's ExtractNodeInputData() looks for it
|
|
118
|
-
const inputValue = convertInputToProtobuf(this.input);
|
|
119
|
-
if (inputValue) {
|
|
120
|
-
node.setInput(inputValue);
|
|
121
|
-
}
|
|
122
108
|
// Handle runner - check the runner field and set the appropriate oneof field
|
|
123
109
|
if (data.runner) {
|
|
124
110
|
this.setRunnerOnProtobuf(loopNode, data.runner);
|
|
@@ -127,86 +113,73 @@ class LoopNode extends Node {
|
|
|
127
113
|
return node;
|
|
128
114
|
}
|
|
129
115
|
setRunnerOnProtobuf(loopNode, runner) {
|
|
130
|
-
if (!runner || !runner.type
|
|
116
|
+
if (!runner || !runner.type) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
// Support both old structure (runner.data.config) and new structure (runner.config)
|
|
120
|
+
const config = runner.config || (runner.data && runner.data.config);
|
|
121
|
+
if (!config) {
|
|
131
122
|
return;
|
|
132
123
|
}
|
|
133
124
|
switch (runner.type) {
|
|
134
125
|
case "ethTransfer": {
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
});
|
|
142
|
-
loopNode.setEthTransfer(ethTransfer);
|
|
143
|
-
}
|
|
126
|
+
const ethConfig = config;
|
|
127
|
+
const ethTransfer = ETHTransferNode.createProtobufNode({
|
|
128
|
+
destination: ethConfig.destination,
|
|
129
|
+
amount: ethConfig.amount,
|
|
130
|
+
});
|
|
131
|
+
loopNode.setEthTransfer(ethTransfer);
|
|
144
132
|
break;
|
|
145
133
|
}
|
|
146
134
|
case "contractWrite": {
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
});
|
|
156
|
-
loopNode.setContractWrite(contractWrite);
|
|
157
|
-
}
|
|
135
|
+
const writeConfig = config;
|
|
136
|
+
const contractWrite = ContractWriteNode.createProtobufNode({
|
|
137
|
+
contractAddress: writeConfig.contractAddress,
|
|
138
|
+
callData: writeConfig.callData,
|
|
139
|
+
contractAbi: writeConfig.contractAbi,
|
|
140
|
+
methodCalls: writeConfig.methodCallsList || [],
|
|
141
|
+
});
|
|
142
|
+
loopNode.setContractWrite(contractWrite);
|
|
158
143
|
break;
|
|
159
144
|
}
|
|
160
145
|
case "contractRead": {
|
|
161
|
-
const
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
});
|
|
169
|
-
loopNode.setContractRead(contractRead);
|
|
170
|
-
}
|
|
146
|
+
const readConfig = config;
|
|
147
|
+
const contractRead = ContractReadNode.createProtobufNode({
|
|
148
|
+
contractAddress: readConfig.contractAddress,
|
|
149
|
+
contractAbi: readConfig.contractAbi,
|
|
150
|
+
methodCalls: readConfig.methodCallsList || [],
|
|
151
|
+
});
|
|
152
|
+
loopNode.setContractRead(contractRead);
|
|
171
153
|
break;
|
|
172
154
|
}
|
|
173
155
|
case "graphqlDataQuery": {
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
});
|
|
182
|
-
loopNode.setGraphqlDataQuery(graphqlQuery);
|
|
183
|
-
}
|
|
156
|
+
const gqlConfig = config;
|
|
157
|
+
const graphqlQuery = GraphQLQueryNode.createProtobufNode({
|
|
158
|
+
url: gqlConfig.url,
|
|
159
|
+
query: gqlConfig.query,
|
|
160
|
+
variablesMap: gqlConfig.variablesMap,
|
|
161
|
+
});
|
|
162
|
+
loopNode.setGraphqlDataQuery(graphqlQuery);
|
|
184
163
|
break;
|
|
185
164
|
}
|
|
186
165
|
case "restApi": {
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
});
|
|
196
|
-
loopNode.setRestApi(restApi);
|
|
197
|
-
}
|
|
166
|
+
const apiConfig = config;
|
|
167
|
+
const restApi = RestAPINode.createProtobufNode({
|
|
168
|
+
url: apiConfig.url,
|
|
169
|
+
method: apiConfig.method,
|
|
170
|
+
body: apiConfig.body || "",
|
|
171
|
+
headers: apiConfig.headers,
|
|
172
|
+
});
|
|
173
|
+
loopNode.setRestApi(restApi);
|
|
198
174
|
break;
|
|
199
175
|
}
|
|
200
176
|
case "customCode": {
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
});
|
|
208
|
-
loopNode.setCustomCode(customCode);
|
|
209
|
-
}
|
|
177
|
+
const codeConfig = config;
|
|
178
|
+
const customCode = CustomCodeNode.createProtobufNode({
|
|
179
|
+
lang: codeConfig.lang,
|
|
180
|
+
source: codeConfig.source,
|
|
181
|
+
});
|
|
182
|
+
loopNode.setCustomCode(customCode);
|
|
210
183
|
break;
|
|
211
184
|
}
|
|
212
185
|
}
|
|
@@ -225,21 +198,21 @@ class LoopNode extends Node {
|
|
|
225
198
|
}
|
|
226
199
|
return result;
|
|
227
200
|
}
|
|
228
|
-
// For workflow execution, data comes as Loop format with
|
|
201
|
+
// For workflow execution, data comes as Loop format with new protobuf Value
|
|
229
202
|
const loopOutput = outputData.getLoop();
|
|
230
203
|
if (loopOutput) {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
if (
|
|
204
|
+
// Extract data from the new data field
|
|
205
|
+
const dataValue = loopOutput.getData();
|
|
206
|
+
if (dataValue) {
|
|
234
207
|
try {
|
|
235
|
-
|
|
208
|
+
// Convert protobuf Value to JavaScript
|
|
209
|
+
return dataValue.toJavaScript();
|
|
236
210
|
}
|
|
237
|
-
catch {
|
|
238
|
-
|
|
239
|
-
return
|
|
211
|
+
catch (error) {
|
|
212
|
+
console.warn("Failed to convert loop data from protobuf Value:", error);
|
|
213
|
+
return null;
|
|
240
214
|
}
|
|
241
215
|
}
|
|
242
|
-
return loopObj;
|
|
243
216
|
}
|
|
244
217
|
return null;
|
|
245
218
|
}
|
|
@@ -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;
|
|
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;CAelC;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Node from "./interface";
|
|
2
2
|
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
3
3
|
import { NodeType, } from "@avaprotocol/types";
|
|
4
|
-
import { convertProtobufValueToJs,
|
|
4
|
+
import { convertProtobufValueToJs, } from "../../utils";
|
|
5
5
|
// Required props for constructor: id, name, type and data: { url, method, headersMap, body }
|
|
6
6
|
class RestAPINode extends Node {
|
|
7
7
|
constructor(props) {
|
|
@@ -30,12 +30,6 @@ class RestAPINode extends Node {
|
|
|
30
30
|
static fromResponse(raw) {
|
|
31
31
|
// Convert the raw object to RestAPINodeProps, which should keep name and id
|
|
32
32
|
const obj = raw.toObject();
|
|
33
|
-
// Extract input data from top-level TaskNode.input field (not nested RestAPINode.input)
|
|
34
|
-
// This matches where we set it in toRequest() and where the Go backend looks for it
|
|
35
|
-
let input = undefined;
|
|
36
|
-
if (raw.hasInput()) {
|
|
37
|
-
input = extractInputFromProtobuf(raw.getInput());
|
|
38
|
-
}
|
|
39
33
|
return new RestAPINode({
|
|
40
34
|
...obj,
|
|
41
35
|
type: NodeType.RestAPI,
|
|
@@ -52,7 +46,6 @@ class RestAPINode extends Node {
|
|
|
52
46
|
return headers;
|
|
53
47
|
})(),
|
|
54
48
|
},
|
|
55
|
-
input: input, // Include input data from top-level TaskNode
|
|
56
49
|
});
|
|
57
50
|
}
|
|
58
51
|
toRequest() {
|
|
@@ -60,13 +53,6 @@ class RestAPINode extends Node {
|
|
|
60
53
|
request.setId(this.id);
|
|
61
54
|
request.setName(this.name);
|
|
62
55
|
const nodeData = RestAPINode.createProtobufNode(this.data);
|
|
63
|
-
// Use the standard utility function to convert input field to protobuf format
|
|
64
|
-
const inputValue = convertInputToProtobuf(this.input);
|
|
65
|
-
if (inputValue) {
|
|
66
|
-
// Set input on the top-level TaskNode, not the nested RestAPINode
|
|
67
|
-
// This matches where the Go backend's ExtractNodeInputData() looks for it
|
|
68
|
-
request.setInput(inputValue);
|
|
69
|
-
}
|
|
70
56
|
request.setRestApi(nodeData);
|
|
71
57
|
return request;
|
|
72
58
|
}
|
package/dist/models/step.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ declare class Step implements StepProps {
|
|
|
8
8
|
error: string;
|
|
9
9
|
log: string;
|
|
10
10
|
inputsList: string[];
|
|
11
|
-
|
|
11
|
+
config?: any;
|
|
12
12
|
output: OutputDataProps;
|
|
13
13
|
startAt: number;
|
|
14
14
|
endAt: number;
|
|
@@ -19,6 +19,8 @@ declare class Step implements StepProps {
|
|
|
19
19
|
*/
|
|
20
20
|
toJson(): StepProps;
|
|
21
21
|
static getOutput(step: avs_pb.Execution.Step): OutputDataProps;
|
|
22
|
+
private static extractOutputData;
|
|
23
|
+
private static getOutputDataCase;
|
|
22
24
|
static fromResponse(step: avs_pb.Execution.Step): Step;
|
|
23
25
|
}
|
|
24
26
|
export default Step;
|
|
@@ -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,YA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