@avaprotocol/sdk-js 2.3.9 → 2.3.11
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 +14 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +146 -103
- package/dist/index.mjs +149 -104
- package/dist/models/node/customCode.d.ts.map +1 -1
- package/dist/models/node/customCode.js +9 -1
- package/dist/models/node/factory.d.ts.map +1 -1
- package/dist/models/node/factory.js +11 -37
- package/dist/models/node/loop.d.ts.map +1 -1
- package/dist/models/node/loop.js +30 -2
- package/dist/models/step.d.ts.map +1 -1
- package/dist/models/step.js +37 -27
- package/dist/models/trigger/block.d.ts.map +1 -1
- package/dist/models/trigger/block.js +11 -2
- package/dist/models/trigger/cron.d.ts.map +1 -1
- package/dist/models/trigger/cron.js +10 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @avaprotocol/sdk-js
|
|
2
2
|
|
|
3
|
+
## 2.3.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 8ebfb1e: Update the RunNodeWithInputsResponse type dependency
|
|
8
|
+
|
|
9
|
+
## 2.3.10
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 72339c5: Updated and tested loop functions; test empty data returned
|
|
14
|
+
- Updated dependencies [72339c5]
|
|
15
|
+
- @avaprotocol/types@2.2.9
|
|
16
|
+
|
|
3
17
|
## 2.3.9
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -336,6 +336,6 @@ declare class Client extends BaseClient {
|
|
|
336
336
|
export * from "./models/node/factory";
|
|
337
337
|
export * from "./models/trigger/factory";
|
|
338
338
|
export { Client, Workflow, Edge, Execution, Step, NodeFactory, TriggerFactory, Secret, };
|
|
339
|
-
export type { TokenMetadata, GetTokenMetadataRequest, GetTokenMetadataResponse, TokenSource } from "@avaprotocol/types";
|
|
340
|
-
export { TimeoutPresets, type TimeoutConfig, type TimeoutError } from "@avaprotocol/types";
|
|
339
|
+
export type { TokenMetadata, GetTokenMetadataRequest, GetTokenMetadataResponse, TokenSource, } from "@avaprotocol/types";
|
|
340
|
+
export { TimeoutPresets, type TimeoutConfig, type TimeoutError, } from "@avaprotocol/types";
|
|
341
341
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,QAAQ,EAAU,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAEhD,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AACzC,OAAO,IAAI,MAAM,eAAe,CAAC;AACjC,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAC3C,OAAO,IAAI,MAAM,eAAe,CAAC;AACjC,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,cAAc,MAAM,0BAA0B,CAAC;AACtD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAOL,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,cAA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AAK,YAAY,GAClB,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -16149,11 +16149,18 @@ var BlockTrigger2 = class _BlockTrigger extends interface_default {
|
|
|
16149
16149
|
request.setId(this.id);
|
|
16150
16150
|
request.setType(avs_pb2.TriggerType.TRIGGER_TYPE_BLOCK);
|
|
16151
16151
|
if (!this.data) {
|
|
16152
|
-
throw new Error(`Trigger data is missing for
|
|
16152
|
+
throw new Error(`Trigger data is missing for block`);
|
|
16153
|
+
}
|
|
16154
|
+
const blockData = this.data;
|
|
16155
|
+
if (blockData.interval === null || blockData.interval === void 0) {
|
|
16156
|
+
throw new Error("Interval is required for block trigger");
|
|
16157
|
+
}
|
|
16158
|
+
if (blockData.interval <= 0) {
|
|
16159
|
+
throw new Error("Interval must be greater than 0");
|
|
16153
16160
|
}
|
|
16154
16161
|
const trigger = new avs_pb2.BlockTrigger();
|
|
16155
16162
|
const config = new avs_pb2.BlockTrigger.Config();
|
|
16156
|
-
config.setInterval(
|
|
16163
|
+
config.setInterval(blockData.interval);
|
|
16157
16164
|
trigger.setConfig(config);
|
|
16158
16165
|
request.setBlock(trigger);
|
|
16159
16166
|
return request;
|
|
@@ -16210,9 +16217,16 @@ var CronTrigger2 = class _CronTrigger extends interface_default {
|
|
|
16210
16217
|
if (!this.data) {
|
|
16211
16218
|
throw new Error(`Trigger data is missing for ${this.type}`);
|
|
16212
16219
|
}
|
|
16220
|
+
const cronData = this.data;
|
|
16221
|
+
if (cronData.schedules === null || cronData.schedules === void 0) {
|
|
16222
|
+
throw new Error("Schedules are required for cron trigger");
|
|
16223
|
+
}
|
|
16224
|
+
if (!Array.isArray(cronData.schedules) || cronData.schedules.length === 0) {
|
|
16225
|
+
throw new Error("Schedules are required for cron trigger");
|
|
16226
|
+
}
|
|
16213
16227
|
const trigger = new avs_pb3.CronTrigger();
|
|
16214
16228
|
const config = new avs_pb3.CronTrigger.Config();
|
|
16215
|
-
config.setSchedulesList(
|
|
16229
|
+
config.setSchedulesList(cronData.schedules);
|
|
16216
16230
|
trigger.setConfig(config);
|
|
16217
16231
|
request.setCron(trigger);
|
|
16218
16232
|
return request;
|
|
@@ -16876,7 +16890,11 @@ var CustomCodeNode2 = class _CustomCodeNode extends interface_default2 {
|
|
|
16876
16890
|
static fromOutputData(outputData) {
|
|
16877
16891
|
const customCodeOutput = outputData.getCustomCode();
|
|
16878
16892
|
if (customCodeOutput?.getData()) {
|
|
16879
|
-
|
|
16893
|
+
const result = convertProtobufValueToJs(customCodeOutput.getData());
|
|
16894
|
+
if (result && typeof result === "object" && Object.keys(result).length === 1 && "data" in result) {
|
|
16895
|
+
return result.data;
|
|
16896
|
+
}
|
|
16897
|
+
return result;
|
|
16880
16898
|
}
|
|
16881
16899
|
return null;
|
|
16882
16900
|
}
|
|
@@ -17221,18 +17239,22 @@ var LoopNode2 = class _LoopNode extends interface_default2 {
|
|
|
17221
17239
|
const contractWrite = new avs_pb17.ContractWriteNode();
|
|
17222
17240
|
if (data.contractWrite.config) {
|
|
17223
17241
|
const config2 = new avs_pb17.ContractWriteNode.Config();
|
|
17224
|
-
config2.setContractAddress(
|
|
17242
|
+
config2.setContractAddress(
|
|
17243
|
+
data.contractWrite.config.contractAddress
|
|
17244
|
+
);
|
|
17225
17245
|
config2.setCallData(data.contractWrite.config.callData);
|
|
17226
17246
|
config2.setContractAbi(data.contractWrite.config.contractAbi);
|
|
17227
17247
|
const methodCalls = data.contractWrite.config.methodCallsList || [];
|
|
17228
|
-
methodCalls.forEach(
|
|
17229
|
-
|
|
17230
|
-
|
|
17231
|
-
|
|
17232
|
-
|
|
17248
|
+
methodCalls.forEach(
|
|
17249
|
+
(methodCall) => {
|
|
17250
|
+
const methodCallMsg = new avs_pb17.ContractWriteNode.MethodCall();
|
|
17251
|
+
methodCallMsg.setCallData(methodCall.callData);
|
|
17252
|
+
if (methodCall.methodName) {
|
|
17253
|
+
methodCallMsg.setMethodName(methodCall.methodName);
|
|
17254
|
+
}
|
|
17255
|
+
config2.addMethodCalls(methodCallMsg);
|
|
17233
17256
|
}
|
|
17234
|
-
|
|
17235
|
-
});
|
|
17257
|
+
);
|
|
17236
17258
|
contractWrite.setConfig(config2);
|
|
17237
17259
|
}
|
|
17238
17260
|
loopNode.setContractWrite(contractWrite);
|
|
@@ -17240,17 +17262,21 @@ var LoopNode2 = class _LoopNode extends interface_default2 {
|
|
|
17240
17262
|
const contractRead = new avs_pb17.ContractReadNode();
|
|
17241
17263
|
if (data.contractRead.config) {
|
|
17242
17264
|
const config2 = new avs_pb17.ContractReadNode.Config();
|
|
17243
|
-
config2.setContractAddress(
|
|
17265
|
+
config2.setContractAddress(
|
|
17266
|
+
data.contractRead.config.contractAddress
|
|
17267
|
+
);
|
|
17244
17268
|
config2.setContractAbi(data.contractRead.config.contractAbi);
|
|
17245
17269
|
const methodCalls = data.contractRead.config.methodCallsList || [];
|
|
17246
|
-
methodCalls.forEach(
|
|
17247
|
-
|
|
17248
|
-
|
|
17249
|
-
|
|
17250
|
-
|
|
17270
|
+
methodCalls.forEach(
|
|
17271
|
+
(methodCall) => {
|
|
17272
|
+
const methodCallMsg = new avs_pb17.ContractReadNode.MethodCall();
|
|
17273
|
+
methodCallMsg.setCallData(methodCall.callData);
|
|
17274
|
+
if (methodCall.methodName) {
|
|
17275
|
+
methodCallMsg.setMethodName(methodCall.methodName);
|
|
17276
|
+
}
|
|
17277
|
+
config2.addMethodCalls(methodCallMsg);
|
|
17251
17278
|
}
|
|
17252
|
-
|
|
17253
|
-
});
|
|
17279
|
+
);
|
|
17254
17280
|
contractRead.setConfig(config2);
|
|
17255
17281
|
}
|
|
17256
17282
|
loopNode.setContractRead(contractRead);
|
|
@@ -17261,9 +17287,11 @@ var LoopNode2 = class _LoopNode extends interface_default2 {
|
|
|
17261
17287
|
config2.setUrl(data.graphqlDataQuery.config.url);
|
|
17262
17288
|
config2.setQuery(data.graphqlDataQuery.config.query);
|
|
17263
17289
|
if (data.graphqlDataQuery.config.variablesMap && data.graphqlDataQuery.config.variablesMap.length > 0) {
|
|
17264
|
-
data.graphqlDataQuery.config.variablesMap.forEach(
|
|
17265
|
-
|
|
17266
|
-
|
|
17290
|
+
data.graphqlDataQuery.config.variablesMap.forEach(
|
|
17291
|
+
([key, value]) => {
|
|
17292
|
+
config2.getVariablesMap().set(key, value);
|
|
17293
|
+
}
|
|
17294
|
+
);
|
|
17267
17295
|
}
|
|
17268
17296
|
graphqlQuery.setConfig(config2);
|
|
17269
17297
|
}
|
|
@@ -17276,9 +17304,11 @@ var LoopNode2 = class _LoopNode extends interface_default2 {
|
|
|
17276
17304
|
config2.setMethod(data.restApi.config.method);
|
|
17277
17305
|
config2.setBody(data.restApi.config.body || "");
|
|
17278
17306
|
if (data.restApi.config.headersMap && data.restApi.config.headersMap.length > 0) {
|
|
17279
|
-
data.restApi.config.headersMap.forEach(
|
|
17280
|
-
|
|
17281
|
-
|
|
17307
|
+
data.restApi.config.headersMap.forEach(
|
|
17308
|
+
([key, value]) => {
|
|
17309
|
+
config2.getHeadersMap().set(key, value);
|
|
17310
|
+
}
|
|
17311
|
+
);
|
|
17282
17312
|
}
|
|
17283
17313
|
restApi.setConfig(config2);
|
|
17284
17314
|
}
|
|
@@ -17297,8 +17327,27 @@ var LoopNode2 = class _LoopNode extends interface_default2 {
|
|
|
17297
17327
|
return node;
|
|
17298
17328
|
}
|
|
17299
17329
|
static fromOutputData(outputData) {
|
|
17330
|
+
const customCodeOutput = outputData.getCustomCode();
|
|
17331
|
+
if (customCodeOutput) {
|
|
17332
|
+
const result = customCodeOutput.toObject();
|
|
17333
|
+
if (result && typeof result === "object" && Object.keys(result).length === 1 && "data" in result) {
|
|
17334
|
+
return result.data;
|
|
17335
|
+
}
|
|
17336
|
+
return result;
|
|
17337
|
+
}
|
|
17300
17338
|
const loopOutput = outputData.getLoop();
|
|
17301
|
-
|
|
17339
|
+
if (loopOutput) {
|
|
17340
|
+
const loopObj = loopOutput.toObject();
|
|
17341
|
+
if (loopObj.data && typeof loopObj.data === "string") {
|
|
17342
|
+
try {
|
|
17343
|
+
return JSON.parse(loopObj.data);
|
|
17344
|
+
} catch (e) {
|
|
17345
|
+
return loopObj.data;
|
|
17346
|
+
}
|
|
17347
|
+
}
|
|
17348
|
+
return loopObj;
|
|
17349
|
+
}
|
|
17350
|
+
return null;
|
|
17302
17351
|
}
|
|
17303
17352
|
};
|
|
17304
17353
|
var loop_default = LoopNode2;
|
|
@@ -17360,50 +17409,29 @@ var NodeFactory = class {
|
|
|
17360
17409
|
}
|
|
17361
17410
|
}
|
|
17362
17411
|
static fromOutputData(outputData) {
|
|
17363
|
-
let nodeOutput = null;
|
|
17364
|
-
let rawData = null;
|
|
17365
17412
|
switch (outputData.getOutputDataCase()) {
|
|
17366
17413
|
case avs_pb18.RunNodeWithInputsResp.OutputDataCase.REST_API:
|
|
17367
|
-
|
|
17368
|
-
break;
|
|
17414
|
+
return restApi_default.fromOutputData(outputData);
|
|
17369
17415
|
case avs_pb18.RunNodeWithInputsResp.OutputDataCase.CUSTOM_CODE:
|
|
17370
|
-
|
|
17371
|
-
break;
|
|
17416
|
+
return customCode_default.fromOutputData(outputData);
|
|
17372
17417
|
case avs_pb18.RunNodeWithInputsResp.OutputDataCase.CONTRACT_READ:
|
|
17373
|
-
|
|
17374
|
-
break;
|
|
17418
|
+
return contractRead_default.fromOutputData(outputData);
|
|
17375
17419
|
case avs_pb18.RunNodeWithInputsResp.OutputDataCase.CONTRACT_WRITE:
|
|
17376
|
-
|
|
17377
|
-
break;
|
|
17420
|
+
return contractWrite_default.fromOutputData(outputData);
|
|
17378
17421
|
case avs_pb18.RunNodeWithInputsResp.OutputDataCase.ETH_TRANSFER:
|
|
17379
|
-
|
|
17380
|
-
break;
|
|
17422
|
+
return ethTransfer_default.fromOutputData(outputData);
|
|
17381
17423
|
case avs_pb18.RunNodeWithInputsResp.OutputDataCase.GRAPHQL:
|
|
17382
|
-
|
|
17383
|
-
break;
|
|
17424
|
+
return graphqlQuery_default.fromOutputData(outputData);
|
|
17384
17425
|
case avs_pb18.RunNodeWithInputsResp.OutputDataCase.BRANCH:
|
|
17385
|
-
|
|
17386
|
-
break;
|
|
17426
|
+
return branch_default.fromOutputData(outputData);
|
|
17387
17427
|
case avs_pb18.RunNodeWithInputsResp.OutputDataCase.FILTER:
|
|
17388
|
-
|
|
17389
|
-
break;
|
|
17428
|
+
return filter_default.fromOutputData(outputData);
|
|
17390
17429
|
case avs_pb18.RunNodeWithInputsResp.OutputDataCase.LOOP:
|
|
17391
|
-
|
|
17392
|
-
break;
|
|
17430
|
+
return loop_default.fromOutputData(outputData);
|
|
17393
17431
|
case avs_pb18.RunNodeWithInputsResp.OutputDataCase.OUTPUT_DATA_NOT_SET:
|
|
17394
17432
|
default:
|
|
17395
17433
|
throw new Error(`Unsupported output data case: ${outputData.getOutputDataCase()}`);
|
|
17396
17434
|
}
|
|
17397
|
-
if (!nodeOutput) {
|
|
17398
|
-
return null;
|
|
17399
|
-
}
|
|
17400
|
-
if (typeof nodeOutput.getData === "function") {
|
|
17401
|
-
rawData = nodeOutput.getData();
|
|
17402
|
-
if (rawData) {
|
|
17403
|
-
return convertProtobufValueToJs(rawData);
|
|
17404
|
-
}
|
|
17405
|
-
}
|
|
17406
|
-
return nodeOutput.toObject();
|
|
17407
17435
|
}
|
|
17408
17436
|
};
|
|
17409
17437
|
var factory_default2 = NodeFactory;
|
|
@@ -17544,6 +17572,7 @@ var workflow_default = Workflow;
|
|
|
17544
17572
|
|
|
17545
17573
|
// src/models/step.ts
|
|
17546
17574
|
var avs_pb20 = __toESM(require_avs_pb());
|
|
17575
|
+
var import_struct_pb2 = require("google-protobuf/google/protobuf/struct_pb");
|
|
17547
17576
|
var Step = class _Step {
|
|
17548
17577
|
constructor(props) {
|
|
17549
17578
|
this.id = props.id;
|
|
@@ -17624,32 +17653,20 @@ var Step = class _Step {
|
|
|
17624
17653
|
if (nodeOutputMessage) {
|
|
17625
17654
|
const results = nodeOutputMessage.getResultsList();
|
|
17626
17655
|
if (results && results.length > 0) {
|
|
17627
|
-
|
|
17628
|
-
const
|
|
17629
|
-
|
|
17630
|
-
|
|
17631
|
-
|
|
17632
|
-
});
|
|
17656
|
+
const resultArray = results.map((result) => {
|
|
17657
|
+
const dataFields = result.getDataList().map((field) => ({
|
|
17658
|
+
name: field.getName(),
|
|
17659
|
+
type: field.getType(),
|
|
17660
|
+
value: field.getValue()
|
|
17661
|
+
}));
|
|
17633
17662
|
return {
|
|
17634
17663
|
methodName: result.getMethodName(),
|
|
17635
17664
|
success: result.getSuccess(),
|
|
17636
17665
|
error: result.getError(),
|
|
17637
|
-
data:
|
|
17666
|
+
data: dataFields
|
|
17638
17667
|
};
|
|
17639
|
-
}
|
|
17640
|
-
|
|
17641
|
-
const structuredData = {};
|
|
17642
|
-
result.getDataList().forEach((field) => {
|
|
17643
|
-
structuredData[field.getName()] = field.getValue();
|
|
17644
|
-
});
|
|
17645
|
-
return {
|
|
17646
|
-
methodName: result.getMethodName(),
|
|
17647
|
-
success: result.getSuccess(),
|
|
17648
|
-
error: result.getError(),
|
|
17649
|
-
data: structuredData
|
|
17650
|
-
};
|
|
17651
|
-
});
|
|
17652
|
-
}
|
|
17668
|
+
});
|
|
17669
|
+
return { results: resultArray };
|
|
17653
17670
|
}
|
|
17654
17671
|
}
|
|
17655
17672
|
return void 0;
|
|
@@ -17721,7 +17738,25 @@ var Step = class _Step {
|
|
|
17721
17738
|
return step.getBranch()?.toObject();
|
|
17722
17739
|
case avs_pb20.Execution.Step.OutputDataCase.FILTER:
|
|
17723
17740
|
nodeOutputMessage = step.getFilter();
|
|
17724
|
-
|
|
17741
|
+
if (nodeOutputMessage && nodeOutputMessage.hasData()) {
|
|
17742
|
+
const rawData = nodeOutputMessage.getData();
|
|
17743
|
+
if (rawData) {
|
|
17744
|
+
if (typeof rawData.unpack === "function") {
|
|
17745
|
+
try {
|
|
17746
|
+
const unpackedValue = rawData.unpack(import_struct_pb2.Value.deserializeBinary, "google.protobuf.Value");
|
|
17747
|
+
if (unpackedValue) {
|
|
17748
|
+
return convertProtobufValueToJs(unpackedValue);
|
|
17749
|
+
}
|
|
17750
|
+
} catch (error) {
|
|
17751
|
+
console.warn("Failed to unpack FilterNode Any wrapper:", error);
|
|
17752
|
+
return void 0;
|
|
17753
|
+
}
|
|
17754
|
+
}
|
|
17755
|
+
console.warn("FilterNode output data is not an Any wrapper - this is unexpected");
|
|
17756
|
+
return void 0;
|
|
17757
|
+
}
|
|
17758
|
+
}
|
|
17759
|
+
return void 0;
|
|
17725
17760
|
case avs_pb20.Execution.Step.OutputDataCase.LOOP:
|
|
17726
17761
|
const loopOutput = step.getLoop();
|
|
17727
17762
|
if (!loopOutput) return void 0;
|
|
@@ -18039,36 +18074,40 @@ var BaseClient = class {
|
|
|
18039
18074
|
let timeoutId;
|
|
18040
18075
|
const timeoutPromise = new Promise((_4, timeoutReject) => {
|
|
18041
18076
|
timeoutId = setTimeout(() => {
|
|
18042
|
-
const error = new Error(
|
|
18077
|
+
const error = new Error(
|
|
18078
|
+
`gRPC request timeout after ${timeout}ms for method ${method}`
|
|
18079
|
+
);
|
|
18043
18080
|
error.isTimeout = true;
|
|
18044
18081
|
error.attemptsMade = attempt;
|
|
18045
18082
|
error.methodName = method;
|
|
18046
18083
|
timeoutReject(error);
|
|
18047
18084
|
}, timeout);
|
|
18048
18085
|
});
|
|
18049
|
-
const grpcPromise = new Promise(
|
|
18050
|
-
|
|
18051
|
-
|
|
18052
|
-
|
|
18053
|
-
|
|
18054
|
-
|
|
18055
|
-
const call = this.rpcClient[method](
|
|
18056
|
-
request,
|
|
18057
|
-
metadata,
|
|
18058
|
-
(error, response) => {
|
|
18059
|
-
if (error) {
|
|
18060
|
-
grpcReject(error);
|
|
18061
|
-
} else {
|
|
18062
|
-
grpcResolve(response);
|
|
18063
|
-
}
|
|
18064
|
-
}
|
|
18065
|
-
);
|
|
18066
|
-
timeoutPromise.catch(() => {
|
|
18067
|
-
if (call && call.cancel) {
|
|
18068
|
-
call.cancel();
|
|
18086
|
+
const grpcPromise = new Promise(
|
|
18087
|
+
(grpcResolve, grpcReject) => {
|
|
18088
|
+
const metadata = new import_grpc_js.Metadata();
|
|
18089
|
+
const authKey = options?.authKey || this.authKey;
|
|
18090
|
+
if (authKey) {
|
|
18091
|
+
metadata.set(import_types20.AUTH_KEY_HEADER, authKey);
|
|
18069
18092
|
}
|
|
18070
|
-
|
|
18071
|
-
|
|
18093
|
+
const call = this.rpcClient[method](
|
|
18094
|
+
request,
|
|
18095
|
+
metadata,
|
|
18096
|
+
(error, response) => {
|
|
18097
|
+
if (error) {
|
|
18098
|
+
grpcReject(error);
|
|
18099
|
+
} else {
|
|
18100
|
+
grpcResolve(response);
|
|
18101
|
+
}
|
|
18102
|
+
}
|
|
18103
|
+
);
|
|
18104
|
+
timeoutPromise.catch(() => {
|
|
18105
|
+
if (call && call.cancel) {
|
|
18106
|
+
call.cancel();
|
|
18107
|
+
}
|
|
18108
|
+
});
|
|
18109
|
+
}
|
|
18110
|
+
);
|
|
18072
18111
|
Promise.race([grpcPromise, timeoutPromise]).then((result) => {
|
|
18073
18112
|
clearTimeout(timeoutId);
|
|
18074
18113
|
resolve(result);
|
|
@@ -18077,7 +18116,10 @@ var BaseClient = class {
|
|
|
18077
18116
|
const isTimeoutError = error.isTimeout || error.message?.includes("timeout");
|
|
18078
18117
|
const isRetryableError = isTimeoutError || error.code === import_grpc_js.status.UNAVAILABLE || error.code === import_grpc_js.status.DEADLINE_EXCEEDED || error.code === import_grpc_js.status.RESOURCE_EXHAUSTED;
|
|
18079
18118
|
if (isRetryableError && attempt < retries) {
|
|
18080
|
-
console.warn(
|
|
18119
|
+
console.warn(
|
|
18120
|
+
`gRPC ${method} attempt ${attempt} failed, retrying in ${retryDelay}ms:`,
|
|
18121
|
+
error.message
|
|
18122
|
+
);
|
|
18081
18123
|
setTimeout(executeRequest, retryDelay);
|
|
18082
18124
|
} else {
|
|
18083
18125
|
if (isTimeoutError && !error.isTimeout) {
|
|
@@ -18607,6 +18649,7 @@ var Client = class extends BaseClient {
|
|
|
18607
18649
|
return {
|
|
18608
18650
|
success: false,
|
|
18609
18651
|
error: `Trigger type "${nodeType}" should use the runTrigger() method instead of runNodeWithInputs()`,
|
|
18652
|
+
data: null,
|
|
18610
18653
|
nodeId: ""
|
|
18611
18654
|
};
|
|
18612
18655
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -16120,11 +16120,18 @@ var BlockTrigger2 = class _BlockTrigger extends interface_default {
|
|
|
16120
16120
|
request.setId(this.id);
|
|
16121
16121
|
request.setType(avs_pb2.TriggerType.TRIGGER_TYPE_BLOCK);
|
|
16122
16122
|
if (!this.data) {
|
|
16123
|
-
throw new Error(`Trigger data is missing for
|
|
16123
|
+
throw new Error(`Trigger data is missing for block`);
|
|
16124
|
+
}
|
|
16125
|
+
const blockData = this.data;
|
|
16126
|
+
if (blockData.interval === null || blockData.interval === void 0) {
|
|
16127
|
+
throw new Error("Interval is required for block trigger");
|
|
16128
|
+
}
|
|
16129
|
+
if (blockData.interval <= 0) {
|
|
16130
|
+
throw new Error("Interval must be greater than 0");
|
|
16124
16131
|
}
|
|
16125
16132
|
const trigger = new avs_pb2.BlockTrigger();
|
|
16126
16133
|
const config = new avs_pb2.BlockTrigger.Config();
|
|
16127
|
-
config.setInterval(
|
|
16134
|
+
config.setInterval(blockData.interval);
|
|
16128
16135
|
trigger.setConfig(config);
|
|
16129
16136
|
request.setBlock(trigger);
|
|
16130
16137
|
return request;
|
|
@@ -16181,9 +16188,16 @@ var CronTrigger2 = class _CronTrigger extends interface_default {
|
|
|
16181
16188
|
if (!this.data) {
|
|
16182
16189
|
throw new Error(`Trigger data is missing for ${this.type}`);
|
|
16183
16190
|
}
|
|
16191
|
+
const cronData = this.data;
|
|
16192
|
+
if (cronData.schedules === null || cronData.schedules === void 0) {
|
|
16193
|
+
throw new Error("Schedules are required for cron trigger");
|
|
16194
|
+
}
|
|
16195
|
+
if (!Array.isArray(cronData.schedules) || cronData.schedules.length === 0) {
|
|
16196
|
+
throw new Error("Schedules are required for cron trigger");
|
|
16197
|
+
}
|
|
16184
16198
|
const trigger = new avs_pb3.CronTrigger();
|
|
16185
16199
|
const config = new avs_pb3.CronTrigger.Config();
|
|
16186
|
-
config.setSchedulesList(
|
|
16200
|
+
config.setSchedulesList(cronData.schedules);
|
|
16187
16201
|
trigger.setConfig(config);
|
|
16188
16202
|
request.setCron(trigger);
|
|
16189
16203
|
return request;
|
|
@@ -16855,7 +16869,11 @@ var CustomCodeNode2 = class _CustomCodeNode extends interface_default2 {
|
|
|
16855
16869
|
static fromOutputData(outputData) {
|
|
16856
16870
|
const customCodeOutput = outputData.getCustomCode();
|
|
16857
16871
|
if (customCodeOutput?.getData()) {
|
|
16858
|
-
|
|
16872
|
+
const result = convertProtobufValueToJs(customCodeOutput.getData());
|
|
16873
|
+
if (result && typeof result === "object" && Object.keys(result).length === 1 && "data" in result) {
|
|
16874
|
+
return result.data;
|
|
16875
|
+
}
|
|
16876
|
+
return result;
|
|
16859
16877
|
}
|
|
16860
16878
|
return null;
|
|
16861
16879
|
}
|
|
@@ -17149,7 +17167,9 @@ var filter_default = FilterNode2;
|
|
|
17149
17167
|
|
|
17150
17168
|
// src/models/node/loop.ts
|
|
17151
17169
|
var avs_pb17 = __toESM(require_avs_pb());
|
|
17152
|
-
import {
|
|
17170
|
+
import {
|
|
17171
|
+
NodeType as NodeType11
|
|
17172
|
+
} from "@avaprotocol/types";
|
|
17153
17173
|
var LoopNode2 = class _LoopNode extends interface_default2 {
|
|
17154
17174
|
constructor(props) {
|
|
17155
17175
|
super({ ...props, type: NodeType11.Loop, data: props.data });
|
|
@@ -17202,18 +17222,22 @@ var LoopNode2 = class _LoopNode extends interface_default2 {
|
|
|
17202
17222
|
const contractWrite = new avs_pb17.ContractWriteNode();
|
|
17203
17223
|
if (data.contractWrite.config) {
|
|
17204
17224
|
const config2 = new avs_pb17.ContractWriteNode.Config();
|
|
17205
|
-
config2.setContractAddress(
|
|
17225
|
+
config2.setContractAddress(
|
|
17226
|
+
data.contractWrite.config.contractAddress
|
|
17227
|
+
);
|
|
17206
17228
|
config2.setCallData(data.contractWrite.config.callData);
|
|
17207
17229
|
config2.setContractAbi(data.contractWrite.config.contractAbi);
|
|
17208
17230
|
const methodCalls = data.contractWrite.config.methodCallsList || [];
|
|
17209
|
-
methodCalls.forEach(
|
|
17210
|
-
|
|
17211
|
-
|
|
17212
|
-
|
|
17213
|
-
|
|
17231
|
+
methodCalls.forEach(
|
|
17232
|
+
(methodCall) => {
|
|
17233
|
+
const methodCallMsg = new avs_pb17.ContractWriteNode.MethodCall();
|
|
17234
|
+
methodCallMsg.setCallData(methodCall.callData);
|
|
17235
|
+
if (methodCall.methodName) {
|
|
17236
|
+
methodCallMsg.setMethodName(methodCall.methodName);
|
|
17237
|
+
}
|
|
17238
|
+
config2.addMethodCalls(methodCallMsg);
|
|
17214
17239
|
}
|
|
17215
|
-
|
|
17216
|
-
});
|
|
17240
|
+
);
|
|
17217
17241
|
contractWrite.setConfig(config2);
|
|
17218
17242
|
}
|
|
17219
17243
|
loopNode.setContractWrite(contractWrite);
|
|
@@ -17221,17 +17245,21 @@ var LoopNode2 = class _LoopNode extends interface_default2 {
|
|
|
17221
17245
|
const contractRead = new avs_pb17.ContractReadNode();
|
|
17222
17246
|
if (data.contractRead.config) {
|
|
17223
17247
|
const config2 = new avs_pb17.ContractReadNode.Config();
|
|
17224
|
-
config2.setContractAddress(
|
|
17248
|
+
config2.setContractAddress(
|
|
17249
|
+
data.contractRead.config.contractAddress
|
|
17250
|
+
);
|
|
17225
17251
|
config2.setContractAbi(data.contractRead.config.contractAbi);
|
|
17226
17252
|
const methodCalls = data.contractRead.config.methodCallsList || [];
|
|
17227
|
-
methodCalls.forEach(
|
|
17228
|
-
|
|
17229
|
-
|
|
17230
|
-
|
|
17231
|
-
|
|
17253
|
+
methodCalls.forEach(
|
|
17254
|
+
(methodCall) => {
|
|
17255
|
+
const methodCallMsg = new avs_pb17.ContractReadNode.MethodCall();
|
|
17256
|
+
methodCallMsg.setCallData(methodCall.callData);
|
|
17257
|
+
if (methodCall.methodName) {
|
|
17258
|
+
methodCallMsg.setMethodName(methodCall.methodName);
|
|
17259
|
+
}
|
|
17260
|
+
config2.addMethodCalls(methodCallMsg);
|
|
17232
17261
|
}
|
|
17233
|
-
|
|
17234
|
-
});
|
|
17262
|
+
);
|
|
17235
17263
|
contractRead.setConfig(config2);
|
|
17236
17264
|
}
|
|
17237
17265
|
loopNode.setContractRead(contractRead);
|
|
@@ -17242,9 +17270,11 @@ var LoopNode2 = class _LoopNode extends interface_default2 {
|
|
|
17242
17270
|
config2.setUrl(data.graphqlDataQuery.config.url);
|
|
17243
17271
|
config2.setQuery(data.graphqlDataQuery.config.query);
|
|
17244
17272
|
if (data.graphqlDataQuery.config.variablesMap && data.graphqlDataQuery.config.variablesMap.length > 0) {
|
|
17245
|
-
data.graphqlDataQuery.config.variablesMap.forEach(
|
|
17246
|
-
|
|
17247
|
-
|
|
17273
|
+
data.graphqlDataQuery.config.variablesMap.forEach(
|
|
17274
|
+
([key, value]) => {
|
|
17275
|
+
config2.getVariablesMap().set(key, value);
|
|
17276
|
+
}
|
|
17277
|
+
);
|
|
17248
17278
|
}
|
|
17249
17279
|
graphqlQuery.setConfig(config2);
|
|
17250
17280
|
}
|
|
@@ -17257,9 +17287,11 @@ var LoopNode2 = class _LoopNode extends interface_default2 {
|
|
|
17257
17287
|
config2.setMethod(data.restApi.config.method);
|
|
17258
17288
|
config2.setBody(data.restApi.config.body || "");
|
|
17259
17289
|
if (data.restApi.config.headersMap && data.restApi.config.headersMap.length > 0) {
|
|
17260
|
-
data.restApi.config.headersMap.forEach(
|
|
17261
|
-
|
|
17262
|
-
|
|
17290
|
+
data.restApi.config.headersMap.forEach(
|
|
17291
|
+
([key, value]) => {
|
|
17292
|
+
config2.getHeadersMap().set(key, value);
|
|
17293
|
+
}
|
|
17294
|
+
);
|
|
17263
17295
|
}
|
|
17264
17296
|
restApi.setConfig(config2);
|
|
17265
17297
|
}
|
|
@@ -17278,8 +17310,27 @@ var LoopNode2 = class _LoopNode extends interface_default2 {
|
|
|
17278
17310
|
return node;
|
|
17279
17311
|
}
|
|
17280
17312
|
static fromOutputData(outputData) {
|
|
17313
|
+
const customCodeOutput = outputData.getCustomCode();
|
|
17314
|
+
if (customCodeOutput) {
|
|
17315
|
+
const result = customCodeOutput.toObject();
|
|
17316
|
+
if (result && typeof result === "object" && Object.keys(result).length === 1 && "data" in result) {
|
|
17317
|
+
return result.data;
|
|
17318
|
+
}
|
|
17319
|
+
return result;
|
|
17320
|
+
}
|
|
17281
17321
|
const loopOutput = outputData.getLoop();
|
|
17282
|
-
|
|
17322
|
+
if (loopOutput) {
|
|
17323
|
+
const loopObj = loopOutput.toObject();
|
|
17324
|
+
if (loopObj.data && typeof loopObj.data === "string") {
|
|
17325
|
+
try {
|
|
17326
|
+
return JSON.parse(loopObj.data);
|
|
17327
|
+
} catch (e) {
|
|
17328
|
+
return loopObj.data;
|
|
17329
|
+
}
|
|
17330
|
+
}
|
|
17331
|
+
return loopObj;
|
|
17332
|
+
}
|
|
17333
|
+
return null;
|
|
17283
17334
|
}
|
|
17284
17335
|
};
|
|
17285
17336
|
var loop_default = LoopNode2;
|
|
@@ -17343,50 +17394,29 @@ var NodeFactory = class {
|
|
|
17343
17394
|
}
|
|
17344
17395
|
}
|
|
17345
17396
|
static fromOutputData(outputData) {
|
|
17346
|
-
let nodeOutput = null;
|
|
17347
|
-
let rawData = null;
|
|
17348
17397
|
switch (outputData.getOutputDataCase()) {
|
|
17349
17398
|
case avs_pb18.RunNodeWithInputsResp.OutputDataCase.REST_API:
|
|
17350
|
-
|
|
17351
|
-
break;
|
|
17399
|
+
return restApi_default.fromOutputData(outputData);
|
|
17352
17400
|
case avs_pb18.RunNodeWithInputsResp.OutputDataCase.CUSTOM_CODE:
|
|
17353
|
-
|
|
17354
|
-
break;
|
|
17401
|
+
return customCode_default.fromOutputData(outputData);
|
|
17355
17402
|
case avs_pb18.RunNodeWithInputsResp.OutputDataCase.CONTRACT_READ:
|
|
17356
|
-
|
|
17357
|
-
break;
|
|
17403
|
+
return contractRead_default.fromOutputData(outputData);
|
|
17358
17404
|
case avs_pb18.RunNodeWithInputsResp.OutputDataCase.CONTRACT_WRITE:
|
|
17359
|
-
|
|
17360
|
-
break;
|
|
17405
|
+
return contractWrite_default.fromOutputData(outputData);
|
|
17361
17406
|
case avs_pb18.RunNodeWithInputsResp.OutputDataCase.ETH_TRANSFER:
|
|
17362
|
-
|
|
17363
|
-
break;
|
|
17407
|
+
return ethTransfer_default.fromOutputData(outputData);
|
|
17364
17408
|
case avs_pb18.RunNodeWithInputsResp.OutputDataCase.GRAPHQL:
|
|
17365
|
-
|
|
17366
|
-
break;
|
|
17409
|
+
return graphqlQuery_default.fromOutputData(outputData);
|
|
17367
17410
|
case avs_pb18.RunNodeWithInputsResp.OutputDataCase.BRANCH:
|
|
17368
|
-
|
|
17369
|
-
break;
|
|
17411
|
+
return branch_default.fromOutputData(outputData);
|
|
17370
17412
|
case avs_pb18.RunNodeWithInputsResp.OutputDataCase.FILTER:
|
|
17371
|
-
|
|
17372
|
-
break;
|
|
17413
|
+
return filter_default.fromOutputData(outputData);
|
|
17373
17414
|
case avs_pb18.RunNodeWithInputsResp.OutputDataCase.LOOP:
|
|
17374
|
-
|
|
17375
|
-
break;
|
|
17415
|
+
return loop_default.fromOutputData(outputData);
|
|
17376
17416
|
case avs_pb18.RunNodeWithInputsResp.OutputDataCase.OUTPUT_DATA_NOT_SET:
|
|
17377
17417
|
default:
|
|
17378
17418
|
throw new Error(`Unsupported output data case: ${outputData.getOutputDataCase()}`);
|
|
17379
17419
|
}
|
|
17380
|
-
if (!nodeOutput) {
|
|
17381
|
-
return null;
|
|
17382
|
-
}
|
|
17383
|
-
if (typeof nodeOutput.getData === "function") {
|
|
17384
|
-
rawData = nodeOutput.getData();
|
|
17385
|
-
if (rawData) {
|
|
17386
|
-
return convertProtobufValueToJs(rawData);
|
|
17387
|
-
}
|
|
17388
|
-
}
|
|
17389
|
-
return nodeOutput.toObject();
|
|
17390
17420
|
}
|
|
17391
17421
|
};
|
|
17392
17422
|
var factory_default2 = NodeFactory;
|
|
@@ -17527,6 +17557,7 @@ var workflow_default = Workflow;
|
|
|
17527
17557
|
|
|
17528
17558
|
// src/models/step.ts
|
|
17529
17559
|
var avs_pb20 = __toESM(require_avs_pb());
|
|
17560
|
+
import { Value as ProtobufValue2 } from "google-protobuf/google/protobuf/struct_pb";
|
|
17530
17561
|
var Step = class _Step {
|
|
17531
17562
|
constructor(props) {
|
|
17532
17563
|
this.id = props.id;
|
|
@@ -17607,32 +17638,20 @@ var Step = class _Step {
|
|
|
17607
17638
|
if (nodeOutputMessage) {
|
|
17608
17639
|
const results = nodeOutputMessage.getResultsList();
|
|
17609
17640
|
if (results && results.length > 0) {
|
|
17610
|
-
|
|
17611
|
-
const
|
|
17612
|
-
|
|
17613
|
-
|
|
17614
|
-
|
|
17615
|
-
});
|
|
17641
|
+
const resultArray = results.map((result) => {
|
|
17642
|
+
const dataFields = result.getDataList().map((field) => ({
|
|
17643
|
+
name: field.getName(),
|
|
17644
|
+
type: field.getType(),
|
|
17645
|
+
value: field.getValue()
|
|
17646
|
+
}));
|
|
17616
17647
|
return {
|
|
17617
17648
|
methodName: result.getMethodName(),
|
|
17618
17649
|
success: result.getSuccess(),
|
|
17619
17650
|
error: result.getError(),
|
|
17620
|
-
data:
|
|
17651
|
+
data: dataFields
|
|
17621
17652
|
};
|
|
17622
|
-
}
|
|
17623
|
-
|
|
17624
|
-
const structuredData = {};
|
|
17625
|
-
result.getDataList().forEach((field) => {
|
|
17626
|
-
structuredData[field.getName()] = field.getValue();
|
|
17627
|
-
});
|
|
17628
|
-
return {
|
|
17629
|
-
methodName: result.getMethodName(),
|
|
17630
|
-
success: result.getSuccess(),
|
|
17631
|
-
error: result.getError(),
|
|
17632
|
-
data: structuredData
|
|
17633
|
-
};
|
|
17634
|
-
});
|
|
17635
|
-
}
|
|
17653
|
+
});
|
|
17654
|
+
return { results: resultArray };
|
|
17636
17655
|
}
|
|
17637
17656
|
}
|
|
17638
17657
|
return void 0;
|
|
@@ -17704,7 +17723,25 @@ var Step = class _Step {
|
|
|
17704
17723
|
return step.getBranch()?.toObject();
|
|
17705
17724
|
case avs_pb20.Execution.Step.OutputDataCase.FILTER:
|
|
17706
17725
|
nodeOutputMessage = step.getFilter();
|
|
17707
|
-
|
|
17726
|
+
if (nodeOutputMessage && nodeOutputMessage.hasData()) {
|
|
17727
|
+
const rawData = nodeOutputMessage.getData();
|
|
17728
|
+
if (rawData) {
|
|
17729
|
+
if (typeof rawData.unpack === "function") {
|
|
17730
|
+
try {
|
|
17731
|
+
const unpackedValue = rawData.unpack(ProtobufValue2.deserializeBinary, "google.protobuf.Value");
|
|
17732
|
+
if (unpackedValue) {
|
|
17733
|
+
return convertProtobufValueToJs(unpackedValue);
|
|
17734
|
+
}
|
|
17735
|
+
} catch (error) {
|
|
17736
|
+
console.warn("Failed to unpack FilterNode Any wrapper:", error);
|
|
17737
|
+
return void 0;
|
|
17738
|
+
}
|
|
17739
|
+
}
|
|
17740
|
+
console.warn("FilterNode output data is not an Any wrapper - this is unexpected");
|
|
17741
|
+
return void 0;
|
|
17742
|
+
}
|
|
17743
|
+
}
|
|
17744
|
+
return void 0;
|
|
17708
17745
|
case avs_pb20.Execution.Step.OutputDataCase.LOOP:
|
|
17709
17746
|
const loopOutput = step.getLoop();
|
|
17710
17747
|
if (!loopOutput) return void 0;
|
|
@@ -18032,36 +18069,40 @@ var BaseClient = class {
|
|
|
18032
18069
|
let timeoutId;
|
|
18033
18070
|
const timeoutPromise = new Promise((_4, timeoutReject) => {
|
|
18034
18071
|
timeoutId = setTimeout(() => {
|
|
18035
|
-
const error = new Error(
|
|
18072
|
+
const error = new Error(
|
|
18073
|
+
`gRPC request timeout after ${timeout}ms for method ${method}`
|
|
18074
|
+
);
|
|
18036
18075
|
error.isTimeout = true;
|
|
18037
18076
|
error.attemptsMade = attempt;
|
|
18038
18077
|
error.methodName = method;
|
|
18039
18078
|
timeoutReject(error);
|
|
18040
18079
|
}, timeout);
|
|
18041
18080
|
});
|
|
18042
|
-
const grpcPromise = new Promise(
|
|
18043
|
-
|
|
18044
|
-
|
|
18045
|
-
|
|
18046
|
-
|
|
18047
|
-
|
|
18048
|
-
const call = this.rpcClient[method](
|
|
18049
|
-
request,
|
|
18050
|
-
metadata,
|
|
18051
|
-
(error, response) => {
|
|
18052
|
-
if (error) {
|
|
18053
|
-
grpcReject(error);
|
|
18054
|
-
} else {
|
|
18055
|
-
grpcResolve(response);
|
|
18056
|
-
}
|
|
18057
|
-
}
|
|
18058
|
-
);
|
|
18059
|
-
timeoutPromise.catch(() => {
|
|
18060
|
-
if (call && call.cancel) {
|
|
18061
|
-
call.cancel();
|
|
18081
|
+
const grpcPromise = new Promise(
|
|
18082
|
+
(grpcResolve, grpcReject) => {
|
|
18083
|
+
const metadata = new Metadata();
|
|
18084
|
+
const authKey = options?.authKey || this.authKey;
|
|
18085
|
+
if (authKey) {
|
|
18086
|
+
metadata.set(AUTH_KEY_HEADER, authKey);
|
|
18062
18087
|
}
|
|
18063
|
-
|
|
18064
|
-
|
|
18088
|
+
const call = this.rpcClient[method](
|
|
18089
|
+
request,
|
|
18090
|
+
metadata,
|
|
18091
|
+
(error, response) => {
|
|
18092
|
+
if (error) {
|
|
18093
|
+
grpcReject(error);
|
|
18094
|
+
} else {
|
|
18095
|
+
grpcResolve(response);
|
|
18096
|
+
}
|
|
18097
|
+
}
|
|
18098
|
+
);
|
|
18099
|
+
timeoutPromise.catch(() => {
|
|
18100
|
+
if (call && call.cancel) {
|
|
18101
|
+
call.cancel();
|
|
18102
|
+
}
|
|
18103
|
+
});
|
|
18104
|
+
}
|
|
18105
|
+
);
|
|
18065
18106
|
Promise.race([grpcPromise, timeoutPromise]).then((result) => {
|
|
18066
18107
|
clearTimeout(timeoutId);
|
|
18067
18108
|
resolve(result);
|
|
@@ -18070,7 +18111,10 @@ var BaseClient = class {
|
|
|
18070
18111
|
const isTimeoutError = error.isTimeout || error.message?.includes("timeout");
|
|
18071
18112
|
const isRetryableError = isTimeoutError || error.code === status.UNAVAILABLE || error.code === status.DEADLINE_EXCEEDED || error.code === status.RESOURCE_EXHAUSTED;
|
|
18072
18113
|
if (isRetryableError && attempt < retries) {
|
|
18073
|
-
console.warn(
|
|
18114
|
+
console.warn(
|
|
18115
|
+
`gRPC ${method} attempt ${attempt} failed, retrying in ${retryDelay}ms:`,
|
|
18116
|
+
error.message
|
|
18117
|
+
);
|
|
18074
18118
|
setTimeout(executeRequest, retryDelay);
|
|
18075
18119
|
} else {
|
|
18076
18120
|
if (isTimeoutError && !error.isTimeout) {
|
|
@@ -18600,6 +18644,7 @@ var Client = class extends BaseClient {
|
|
|
18600
18644
|
return {
|
|
18601
18645
|
success: false,
|
|
18602
18646
|
error: `Trigger type "${nodeType}" should use the runTrigger() method instead of runNodeWithInputs()`,
|
|
18647
|
+
data: null,
|
|
18603
18648
|
nodeId: ""
|
|
18604
18649
|
};
|
|
18605
18650
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customCode.d.ts","sourceRoot":"","sources":["../../../src/models/node/customCode.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAIL,mBAAmB,EAEpB,MAAM,oBAAoB,CAAC;AAK5B,cAAM,cAAe,SAAQ,IAAI;gBACnB,KAAK,EAAE,mBAAmB;IAItC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,cAAc;IAmBzD,SAAS,IAAI,MAAM,CAAC,QAAQ;IAqB5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;
|
|
1
|
+
{"version":3,"file":"customCode.d.ts","sourceRoot":"","sources":["../../../src/models/node/customCode.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAIL,mBAAmB,EAEpB,MAAM,oBAAoB,CAAC;AAK5B,cAAM,cAAe,SAAQ,IAAI;gBACnB,KAAK,EAAE,mBAAmB;IAItC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,cAAc;IAmBzD,SAAS,IAAI,MAAM,CAAC,QAAQ;IAqB5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAkBrE;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -39,7 +39,15 @@ class CustomCodeNode extends Node {
|
|
|
39
39
|
const customCodeOutput = outputData.getCustomCode();
|
|
40
40
|
if (customCodeOutput?.getData()) {
|
|
41
41
|
// Use the modern protobuf conversion function
|
|
42
|
-
|
|
42
|
+
const result = convertProtobufValueToJs(customCodeOutput.getData());
|
|
43
|
+
// SPECIAL FIX: Check if the result is incorrectly wrapped with a single "data" property
|
|
44
|
+
// This handles the case where primitive values get wrapped as {"data": value}
|
|
45
|
+
if (result && typeof result === 'object' &&
|
|
46
|
+
Object.keys(result).length === 1 &&
|
|
47
|
+
'data' in result) {
|
|
48
|
+
return result.data;
|
|
49
|
+
}
|
|
50
|
+
return result;
|
|
43
51
|
}
|
|
44
52
|
return null;
|
|
45
53
|
}
|
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/models/node/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAGhD,OAAO,iBAAiB,MAAM,iBAAiB,CAAC;AAChD,OAAO,cAAc,MAAM,cA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Y,EACV,SAAS,EACT,sBAAsB,EACtB,qBAAqB,EACrB,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,aAAa,GACd,CAAC"}
|
|
@@ -11,7 +11,6 @@ import BranchNode from "./branch";
|
|
|
11
11
|
import FilterNode from "./filter";
|
|
12
12
|
import LoopNode from "./loop";
|
|
13
13
|
import { NodeType } from "@avaprotocol/types";
|
|
14
|
-
import { convertProtobufValueToJs } from "../../utils";
|
|
15
14
|
class NodeFactory {
|
|
16
15
|
static create(props) {
|
|
17
16
|
switch (props.type) {
|
|
@@ -67,56 +66,31 @@ class NodeFactory {
|
|
|
67
66
|
}
|
|
68
67
|
}
|
|
69
68
|
static fromOutputData(outputData) {
|
|
70
|
-
//
|
|
71
|
-
// This
|
|
72
|
-
let nodeOutput = null;
|
|
73
|
-
let rawData = null;
|
|
74
|
-
// Get the specific node output based on the case
|
|
69
|
+
// Delegate to the specific node type's fromOutputData method
|
|
70
|
+
// This is the correct approach, similar to how TriggerFactory.fromOutputData works
|
|
75
71
|
switch (outputData.getOutputDataCase()) {
|
|
76
72
|
case avs_pb.RunNodeWithInputsResp.OutputDataCase.REST_API:
|
|
77
|
-
|
|
78
|
-
break;
|
|
73
|
+
return RestAPINode.fromOutputData(outputData);
|
|
79
74
|
case avs_pb.RunNodeWithInputsResp.OutputDataCase.CUSTOM_CODE:
|
|
80
|
-
|
|
81
|
-
break;
|
|
75
|
+
return CustomCodeNode.fromOutputData(outputData);
|
|
82
76
|
case avs_pb.RunNodeWithInputsResp.OutputDataCase.CONTRACT_READ:
|
|
83
|
-
|
|
84
|
-
break;
|
|
77
|
+
return ContractReadNode.fromOutputData(outputData);
|
|
85
78
|
case avs_pb.RunNodeWithInputsResp.OutputDataCase.CONTRACT_WRITE:
|
|
86
|
-
|
|
87
|
-
break;
|
|
79
|
+
return ContractWriteNode.fromOutputData(outputData);
|
|
88
80
|
case avs_pb.RunNodeWithInputsResp.OutputDataCase.ETH_TRANSFER:
|
|
89
|
-
|
|
90
|
-
break;
|
|
81
|
+
return ETHTransferNode.fromOutputData(outputData);
|
|
91
82
|
case avs_pb.RunNodeWithInputsResp.OutputDataCase.GRAPHQL:
|
|
92
|
-
|
|
93
|
-
break;
|
|
83
|
+
return GraphQLQueryNode.fromOutputData(outputData);
|
|
94
84
|
case avs_pb.RunNodeWithInputsResp.OutputDataCase.BRANCH:
|
|
95
|
-
|
|
96
|
-
break;
|
|
85
|
+
return BranchNode.fromOutputData(outputData);
|
|
97
86
|
case avs_pb.RunNodeWithInputsResp.OutputDataCase.FILTER:
|
|
98
|
-
|
|
99
|
-
break;
|
|
87
|
+
return FilterNode.fromOutputData(outputData);
|
|
100
88
|
case avs_pb.RunNodeWithInputsResp.OutputDataCase.LOOP:
|
|
101
|
-
|
|
102
|
-
break;
|
|
89
|
+
return LoopNode.fromOutputData(outputData);
|
|
103
90
|
case avs_pb.RunNodeWithInputsResp.OutputDataCase.OUTPUT_DATA_NOT_SET:
|
|
104
91
|
default:
|
|
105
92
|
throw new Error(`Unsupported output data case: ${outputData.getOutputDataCase()}`);
|
|
106
93
|
}
|
|
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
94
|
}
|
|
121
95
|
}
|
|
122
96
|
export default NodeFactory;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loop.d.ts","sourceRoot":"","sources":["../../../src/models/node/loop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,
|
|
1
|
+
{"version":3,"file":"loop.d.ts","sourceRoot":"","sources":["../../../src/models/node/loop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,EAGL,aAAa,EAEd,MAAM,oBAAoB,CAAC;AAI5B,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;IAuI5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAuCrE;AAED,eAAe,QAAQ,CAAC"}
|
package/dist/models/node/loop.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
2
2
|
import Node from "./interface";
|
|
3
|
-
import { NodeType } from "@avaprotocol/types";
|
|
3
|
+
import { NodeType, } from "@avaprotocol/types";
|
|
4
4
|
class LoopNode extends Node {
|
|
5
5
|
constructor(props) {
|
|
6
6
|
super({ ...props, type: NodeType.Loop, data: props.data });
|
|
@@ -143,8 +143,36 @@ class LoopNode extends Node {
|
|
|
143
143
|
return node;
|
|
144
144
|
}
|
|
145
145
|
static fromOutputData(outputData) {
|
|
146
|
+
// For immediate execution, data comes as CustomCode format
|
|
147
|
+
const customCodeOutput = outputData.getCustomCode();
|
|
148
|
+
if (customCodeOutput) {
|
|
149
|
+
const result = customCodeOutput.toObject();
|
|
150
|
+
// Handle nested data structure
|
|
151
|
+
if (result &&
|
|
152
|
+
typeof result === "object" &&
|
|
153
|
+
Object.keys(result).length === 1 &&
|
|
154
|
+
"data" in result) {
|
|
155
|
+
return result.data;
|
|
156
|
+
}
|
|
157
|
+
return result;
|
|
158
|
+
}
|
|
159
|
+
// For workflow execution, data comes as Loop format with JSON string
|
|
146
160
|
const loopOutput = outputData.getLoop();
|
|
147
|
-
|
|
161
|
+
if (loopOutput) {
|
|
162
|
+
const loopObj = loopOutput.toObject();
|
|
163
|
+
// If there's a data field that's a JSON string, parse it
|
|
164
|
+
if (loopObj.data && typeof loopObj.data === "string") {
|
|
165
|
+
try {
|
|
166
|
+
return JSON.parse(loopObj.data);
|
|
167
|
+
}
|
|
168
|
+
catch (e) {
|
|
169
|
+
// If JSON parsing fails, return the raw data
|
|
170
|
+
return loopObj.data;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return loopObj;
|
|
174
|
+
}
|
|
175
|
+
return null;
|
|
148
176
|
}
|
|
149
177
|
}
|
|
150
178
|
export default LoopNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../src/models/step.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;
|
|
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,EAAE,eAAe,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;gBAEF,KAAK,EAAE,SAAS;IAa5B;;;OAGG;IACH,MAAM,IAAI,SAAS;IAenB,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI,GAAG,eAAe;IAgQ9D,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI,GAAG,IAAI;CAgBvD;AAED,eAAe,IAAI,CAAC"}
|
package/dist/models/step.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
2
|
+
import { Value as ProtobufValue } from "google-protobuf/google/protobuf/struct_pb";
|
|
2
3
|
import { convertProtobufValueToJs, convertProtobufStepTypeToSdk, } from "../utils";
|
|
3
4
|
class Step {
|
|
4
5
|
constructor(props) {
|
|
@@ -91,35 +92,23 @@ class Step {
|
|
|
91
92
|
if (nodeOutputMessage) {
|
|
92
93
|
const results = nodeOutputMessage.getResultsList();
|
|
93
94
|
if (results && results.length > 0) {
|
|
94
|
-
//
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
95
|
+
// Always return wrapped format { results: [...] } to match ContractReadNode.fromOutputData
|
|
96
|
+
const resultArray = results.map((result) => {
|
|
97
|
+
// Match the exact format from ContractReadNode.fromOutputData
|
|
98
|
+
const dataFields = result.getDataList().map((field) => ({
|
|
99
|
+
name: field.getName(),
|
|
100
|
+
type: field.getType(),
|
|
101
|
+
value: field.getValue()
|
|
102
|
+
}));
|
|
101
103
|
return {
|
|
102
104
|
methodName: result.getMethodName(),
|
|
103
105
|
success: result.getSuccess(),
|
|
104
106
|
error: result.getError(),
|
|
105
|
-
data:
|
|
107
|
+
data: dataFields,
|
|
106
108
|
};
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
return results.map((result) => {
|
|
111
|
-
const structuredData = {};
|
|
112
|
-
result.getDataList().forEach((field) => {
|
|
113
|
-
structuredData[field.getName()] = field.getValue();
|
|
114
|
-
});
|
|
115
|
-
return {
|
|
116
|
-
methodName: result.getMethodName(),
|
|
117
|
-
success: result.getSuccess(),
|
|
118
|
-
error: result.getError(),
|
|
119
|
-
data: structuredData,
|
|
120
|
-
};
|
|
121
|
-
});
|
|
122
|
-
}
|
|
109
|
+
});
|
|
110
|
+
// Return wrapped format consistently for all cases
|
|
111
|
+
return { results: resultArray };
|
|
123
112
|
}
|
|
124
113
|
}
|
|
125
114
|
return undefined;
|
|
@@ -198,9 +187,30 @@ class Step {
|
|
|
198
187
|
return step.getBranch()?.toObject();
|
|
199
188
|
case avs_pb.Execution.Step.OutputDataCase.FILTER:
|
|
200
189
|
nodeOutputMessage = step.getFilter();
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
190
|
+
if (nodeOutputMessage && nodeOutputMessage.hasData()) {
|
|
191
|
+
const rawData = nodeOutputMessage.getData();
|
|
192
|
+
if (rawData) {
|
|
193
|
+
// Handle Any wrapper - need to unpack it first
|
|
194
|
+
if (typeof rawData.unpack === 'function') {
|
|
195
|
+
try {
|
|
196
|
+
// For Any types, unpack to Value and then convert
|
|
197
|
+
const unpackedValue = rawData.unpack(ProtobufValue.deserializeBinary, 'google.protobuf.Value');
|
|
198
|
+
if (unpackedValue) {
|
|
199
|
+
return convertProtobufValueToJs(unpackedValue);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
catch (error) {
|
|
203
|
+
// If unpacking fails, log error and return undefined
|
|
204
|
+
console.warn('Failed to unpack FilterNode Any wrapper:', error);
|
|
205
|
+
return undefined;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
// If no unpack method, this is unexpected for FilterNode
|
|
209
|
+
console.warn('FilterNode output data is not an Any wrapper - this is unexpected');
|
|
210
|
+
return undefined;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return undefined;
|
|
204
214
|
case avs_pb.Execution.Step.OutputDataCase.LOOP:
|
|
205
215
|
const loopOutput = step.getLoop();
|
|
206
216
|
if (!loopOutput)
|
|
@@ -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,OAA0B,MAAM,aAAa,CAAC;AACrD,OAAO,EAAqC,kBAAkB,EAAE,iBAAiB,EAAgB,MAAM,oBAAoB,CAAC;AAK5H,cAAM,YAAa,SAAQ,OAAO;gBACpB,KAAK,EAAE,iBAAiB;IAIpC,SAAS,IAAI,MAAM,CAAC,WAAW;
|
|
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,OAA0B,MAAM,aAAa,CAAC;AACrD,OAAO,EAAqC,kBAAkB,EAAE,iBAAiB,EAAgB,MAAM,oBAAoB,CAAC;AAK5H,cAAM,YAAa,SAAQ,OAAO;gBACpB,KAAK,EAAE,iBAAiB;IAIpC,SAAS,IAAI,MAAM,CAAC,WAAW;IAgC/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"}
|
|
@@ -12,11 +12,20 @@ class BlockTrigger extends Trigger {
|
|
|
12
12
|
request.setId(this.id);
|
|
13
13
|
request.setType(avs_pb.TriggerType.TRIGGER_TYPE_BLOCK);
|
|
14
14
|
if (!this.data) {
|
|
15
|
-
throw new Error(`Trigger data is missing for
|
|
15
|
+
throw new Error(`Trigger data is missing for block`);
|
|
16
|
+
}
|
|
17
|
+
const blockData = this.data;
|
|
18
|
+
// Validate interval is present and not null/undefined
|
|
19
|
+
if (blockData.interval === null || blockData.interval === undefined) {
|
|
20
|
+
throw new Error("Interval is required for block trigger");
|
|
21
|
+
}
|
|
22
|
+
// Validate interval is greater than 0
|
|
23
|
+
if (blockData.interval <= 0) {
|
|
24
|
+
throw new Error("Interval must be greater than 0");
|
|
16
25
|
}
|
|
17
26
|
const trigger = new avs_pb.BlockTrigger();
|
|
18
27
|
const config = new avs_pb.BlockTrigger.Config();
|
|
19
|
-
config.setInterval(
|
|
28
|
+
config.setInterval(blockData.interval);
|
|
20
29
|
trigger.setConfig(config);
|
|
21
30
|
request.setBlock(trigger);
|
|
22
31
|
return request;
|
|
@@ -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,OAA0B,MAAM,aAAa,CAAC;AACrD,OAAO,EAAoC,iBAAiB,EAAE,gBAAgB,EAAgB,MAAM,oBAAoB,CAAC;AAEzH,cAAM,WAAY,SAAQ,OAAO;gBACnB,KAAK,EAAE,gBAAgB;IAInC,SAAS,IAAI,MAAM,CAAC,WAAW;
|
|
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,OAA0B,MAAM,aAAa,CAAC;AACrD,OAAO,EAAoC,iBAAiB,EAAE,gBAAgB,EAAgB,MAAM,oBAAoB,CAAC;AAEzH,cAAM,WAAY,SAAQ,OAAO;gBACnB,KAAK,EAAE,gBAAgB;IAInC,SAAS,IAAI,MAAM,CAAC,WAAW;IAgC/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,WAAW;IAuBzD;;;;OAIG;IACH,SAAS,IAAI,iBAAiB,GAAG,SAAS;IAI1C;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,GAAG;CAW9D;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -13,9 +13,18 @@ class CronTrigger extends Trigger {
|
|
|
13
13
|
if (!this.data) {
|
|
14
14
|
throw new Error(`Trigger data is missing for ${this.type}`);
|
|
15
15
|
}
|
|
16
|
+
const cronData = this.data;
|
|
17
|
+
// Validate schedules is present and not null/undefined
|
|
18
|
+
if (cronData.schedules === null || cronData.schedules === undefined) {
|
|
19
|
+
throw new Error("Schedules are required for cron trigger");
|
|
20
|
+
}
|
|
21
|
+
// Validate schedules is not empty
|
|
22
|
+
if (!Array.isArray(cronData.schedules) || cronData.schedules.length === 0) {
|
|
23
|
+
throw new Error("Schedules are required for cron trigger");
|
|
24
|
+
}
|
|
16
25
|
const trigger = new avs_pb.CronTrigger();
|
|
17
26
|
const config = new avs_pb.CronTrigger.Config();
|
|
18
|
-
config.setSchedulesList(
|
|
27
|
+
config.setSchedulesList(cronData.schedules);
|
|
19
28
|
trigger.setConfig(config);
|
|
20
29
|
request.setCron(trigger);
|
|
21
30
|
return request;
|
package/package.json
CHANGED