@avaprotocol/sdk-js 2.3.13-dev.0 → 2.3.13
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 +317 -252
- package/dist/index.mjs +317 -252
- package/dist/models/node/branch.js +4 -4
- package/dist/models/node/contractRead.js +4 -4
- package/dist/models/node/contractWrite.js +4 -4
- package/dist/models/node/customCode.js +4 -4
- package/dist/models/node/ethTransfer.js +4 -4
- package/dist/models/node/filter.js +4 -4
- package/dist/models/node/graphqlQuery.js +4 -4
- package/dist/models/node/interface.d.ts +2 -2
- package/dist/models/node/interface.d.ts.map +1 -1
- package/dist/models/node/interface.js +17 -3
- package/dist/models/step.d.ts.map +1 -1
- package/dist/models/step.js +314 -212
- package/dist/models/trigger/block.d.ts.map +1 -1
- package/dist/models/trigger/block.js +1 -1
- package/dist/models/trigger/event.d.ts.map +1 -1
- package/dist/models/trigger/fixedTime.d.ts.map +1 -1
- package/dist/models/trigger/interface.d.ts +2 -5
- package/dist/models/trigger/interface.d.ts.map +1 -1
- package/dist/models/trigger/interface.js +3 -3
- package/dist/utils.d.ts +2 -2
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +22 -4
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -16579,13 +16579,13 @@ __export(index_exports, {
|
|
|
16579
16579
|
GraphQLQueryNode: () => graphqlQuery_default,
|
|
16580
16580
|
LoopNode: () => loop_default,
|
|
16581
16581
|
ManualTrigger: () => manual_default,
|
|
16582
|
-
Node: () =>
|
|
16582
|
+
Node: () => Node,
|
|
16583
16583
|
NodeFactory: () => factory_default2,
|
|
16584
16584
|
RestAPINode: () => restApi_default,
|
|
16585
16585
|
Secret: () => secret_default,
|
|
16586
16586
|
Step: () => step_default,
|
|
16587
16587
|
TimeoutPresets: () => import_types21.TimeoutPresets,
|
|
16588
|
-
Trigger: () =>
|
|
16588
|
+
Trigger: () => Trigger,
|
|
16589
16589
|
TriggerFactory: () => factory_default,
|
|
16590
16590
|
Workflow: () => workflow_default
|
|
16591
16591
|
});
|
|
@@ -16625,39 +16625,6 @@ var avs_pb7 = __toESM(require_avs_pb());
|
|
|
16625
16625
|
// src/models/trigger/block.ts
|
|
16626
16626
|
var avs_pb2 = __toESM(require_avs_pb());
|
|
16627
16627
|
|
|
16628
|
-
// src/models/trigger/interface.ts
|
|
16629
|
-
var Trigger = class {
|
|
16630
|
-
/**
|
|
16631
|
-
* Create an instance of Trigger from user inputs
|
|
16632
|
-
* @param props
|
|
16633
|
-
*/
|
|
16634
|
-
constructor(props) {
|
|
16635
|
-
this.id = props.id;
|
|
16636
|
-
this.name = props.name;
|
|
16637
|
-
this.type = props.type;
|
|
16638
|
-
this.data = props.data;
|
|
16639
|
-
this.output = props.output;
|
|
16640
|
-
this.input = props.input;
|
|
16641
|
-
}
|
|
16642
|
-
toRequest() {
|
|
16643
|
-
throw new Error("Method not implemented.");
|
|
16644
|
-
}
|
|
16645
|
-
getOutput() {
|
|
16646
|
-
return this.output;
|
|
16647
|
-
}
|
|
16648
|
-
toJson() {
|
|
16649
|
-
return {
|
|
16650
|
-
id: this.id,
|
|
16651
|
-
name: this.name,
|
|
16652
|
-
type: this.type,
|
|
16653
|
-
data: this.data,
|
|
16654
|
-
output: this.output,
|
|
16655
|
-
input: this.input
|
|
16656
|
-
};
|
|
16657
|
-
}
|
|
16658
|
-
};
|
|
16659
|
-
var interface_default = Trigger;
|
|
16660
|
-
|
|
16661
16628
|
// src/utils.ts
|
|
16662
16629
|
var import_struct_pb = require("google-protobuf/google/protobuf/struct_pb");
|
|
16663
16630
|
var import_types = require("@avaprotocol/types");
|
|
@@ -16803,16 +16770,61 @@ function extractInputFromProtobuf(inputValue) {
|
|
|
16803
16770
|
if (!inputValue) {
|
|
16804
16771
|
return void 0;
|
|
16805
16772
|
}
|
|
16806
|
-
|
|
16807
|
-
|
|
16808
|
-
|
|
16773
|
+
if (typeof inputValue === "object" && !inputValue.toJavaScript) {
|
|
16774
|
+
if (!Array.isArray(inputValue)) {
|
|
16775
|
+
return inputValue;
|
|
16776
|
+
}
|
|
16777
|
+
return void 0;
|
|
16778
|
+
}
|
|
16779
|
+
try {
|
|
16780
|
+
const protobufValue = inputValue;
|
|
16781
|
+
const inputJavaScript = protobufValue.toJavaScript();
|
|
16782
|
+
if (inputJavaScript && typeof inputJavaScript === "object" && !Array.isArray(inputJavaScript)) {
|
|
16783
|
+
return inputJavaScript;
|
|
16784
|
+
}
|
|
16785
|
+
} catch (error) {
|
|
16786
|
+
if (typeof inputValue === "object" && !Array.isArray(inputValue)) {
|
|
16787
|
+
return inputValue;
|
|
16788
|
+
}
|
|
16809
16789
|
}
|
|
16810
16790
|
return void 0;
|
|
16811
16791
|
}
|
|
16812
16792
|
|
|
16793
|
+
// src/models/trigger/interface.ts
|
|
16794
|
+
var Trigger = class {
|
|
16795
|
+
/**
|
|
16796
|
+
* Create an instance of Trigger from user inputs
|
|
16797
|
+
* @param props
|
|
16798
|
+
*/
|
|
16799
|
+
constructor(props) {
|
|
16800
|
+
this.id = props.id;
|
|
16801
|
+
this.name = props.name;
|
|
16802
|
+
this.type = props.type;
|
|
16803
|
+
this.data = props.data;
|
|
16804
|
+
this.output = props.output;
|
|
16805
|
+
this.input = props.input ? extractInputFromProtobuf(props.input) : void 0;
|
|
16806
|
+
}
|
|
16807
|
+
toRequest() {
|
|
16808
|
+
throw new Error("Method not implemented.");
|
|
16809
|
+
}
|
|
16810
|
+
getOutput() {
|
|
16811
|
+
return this.output;
|
|
16812
|
+
}
|
|
16813
|
+
toJson() {
|
|
16814
|
+
return {
|
|
16815
|
+
id: this.id,
|
|
16816
|
+
name: this.name,
|
|
16817
|
+
type: this.type,
|
|
16818
|
+
data: this.data,
|
|
16819
|
+
output: this.output,
|
|
16820
|
+
input: this.input
|
|
16821
|
+
};
|
|
16822
|
+
}
|
|
16823
|
+
};
|
|
16824
|
+
|
|
16813
16825
|
// src/models/trigger/block.ts
|
|
16814
16826
|
var import_types2 = require("@avaprotocol/types");
|
|
16815
|
-
var BlockTrigger2 = class _BlockTrigger extends
|
|
16827
|
+
var BlockTrigger2 = class _BlockTrigger extends Trigger {
|
|
16816
16828
|
constructor(props) {
|
|
16817
16829
|
super({ ...props, type: import_types2.TriggerType.Block, data: props.data });
|
|
16818
16830
|
}
|
|
@@ -16889,7 +16901,7 @@ var block_default = BlockTrigger2;
|
|
|
16889
16901
|
var avs_pb3 = __toESM(require_avs_pb());
|
|
16890
16902
|
var google_protobuf_struct_pb = __toESM(require("google-protobuf/google/protobuf/struct_pb"));
|
|
16891
16903
|
var import_types3 = require("@avaprotocol/types");
|
|
16892
|
-
var CronTrigger2 = class _CronTrigger extends
|
|
16904
|
+
var CronTrigger2 = class _CronTrigger extends Trigger {
|
|
16893
16905
|
constructor(props) {
|
|
16894
16906
|
super({ ...props, type: import_types3.TriggerType.Cron, data: props.data });
|
|
16895
16907
|
}
|
|
@@ -16978,7 +16990,7 @@ var cron_default = CronTrigger2;
|
|
|
16978
16990
|
// src/models/trigger/event.ts
|
|
16979
16991
|
var avs_pb4 = __toESM(require_avs_pb());
|
|
16980
16992
|
var import_types4 = require("@avaprotocol/types");
|
|
16981
|
-
var EventTrigger2 = class _EventTrigger extends
|
|
16993
|
+
var EventTrigger2 = class _EventTrigger extends Trigger {
|
|
16982
16994
|
constructor(props) {
|
|
16983
16995
|
super({ ...props, type: import_types4.TriggerType.Event, data: props.data });
|
|
16984
16996
|
}
|
|
@@ -17095,7 +17107,7 @@ var event_default = EventTrigger2;
|
|
|
17095
17107
|
// src/models/trigger/fixedTime.ts
|
|
17096
17108
|
var avs_pb5 = __toESM(require_avs_pb());
|
|
17097
17109
|
var import_types5 = require("@avaprotocol/types");
|
|
17098
|
-
var FixedTimeTrigger2 = class _FixedTimeTrigger extends
|
|
17110
|
+
var FixedTimeTrigger2 = class _FixedTimeTrigger extends Trigger {
|
|
17099
17111
|
constructor(props) {
|
|
17100
17112
|
super({ ...props, type: import_types5.TriggerType.FixedTime, data: props.data });
|
|
17101
17113
|
}
|
|
@@ -17160,7 +17172,7 @@ var fixedTime_default = FixedTimeTrigger2;
|
|
|
17160
17172
|
// src/models/trigger/manual.ts
|
|
17161
17173
|
var avs_pb6 = __toESM(require_avs_pb());
|
|
17162
17174
|
var import_types6 = require("@avaprotocol/types");
|
|
17163
|
-
var ManualTrigger = class _ManualTrigger extends
|
|
17175
|
+
var ManualTrigger = class _ManualTrigger extends Trigger {
|
|
17164
17176
|
constructor(props) {
|
|
17165
17177
|
super({ ...props, type: import_types6.TriggerType.Manual, data: props.data || null });
|
|
17166
17178
|
}
|
|
@@ -17312,12 +17324,13 @@ var avs_pb8 = __toESM(require_avs_pb());
|
|
|
17312
17324
|
var import_types8 = require("@avaprotocol/types");
|
|
17313
17325
|
var import_lodash = __toESM(require("lodash"));
|
|
17314
17326
|
var Node = class {
|
|
17327
|
+
// Use JavaScript object type for internal storage
|
|
17315
17328
|
constructor(props) {
|
|
17316
17329
|
this.id = props.id;
|
|
17317
17330
|
this.name = props.name;
|
|
17318
17331
|
this.type = props.type;
|
|
17319
17332
|
this.data = props.data;
|
|
17320
|
-
this.input = props.input;
|
|
17333
|
+
this.input = props.input ? extractInputFromProtobuf(props.input) : void 0;
|
|
17321
17334
|
}
|
|
17322
17335
|
toRequest() {
|
|
17323
17336
|
const request = new avs_pb8.TaskNode();
|
|
@@ -17328,13 +17341,23 @@ var Node = class {
|
|
|
17328
17341
|
}
|
|
17329
17342
|
return request;
|
|
17330
17343
|
}
|
|
17344
|
+
static fromResponse(raw) {
|
|
17345
|
+
const obj = raw.toObject();
|
|
17346
|
+
let input = void 0;
|
|
17347
|
+
if (raw.hasInput()) {
|
|
17348
|
+
input = raw.getInput().toObject();
|
|
17349
|
+
}
|
|
17350
|
+
return new this({
|
|
17351
|
+
...obj,
|
|
17352
|
+
input
|
|
17353
|
+
});
|
|
17354
|
+
}
|
|
17331
17355
|
};
|
|
17332
|
-
var interface_default2 = Node;
|
|
17333
17356
|
|
|
17334
17357
|
// src/models/node/contractWrite.ts
|
|
17335
17358
|
var avs_pb9 = __toESM(require_avs_pb());
|
|
17336
17359
|
var import_types9 = require("@avaprotocol/types");
|
|
17337
|
-
var ContractWriteNode2 = class _ContractWriteNode extends
|
|
17360
|
+
var ContractWriteNode2 = class _ContractWriteNode extends Node {
|
|
17338
17361
|
constructor(props) {
|
|
17339
17362
|
super({ ...props, type: import_types9.NodeType.ContractWrite, data: props.data });
|
|
17340
17363
|
}
|
|
@@ -17362,7 +17385,7 @@ var ContractWriteNode2 = class _ContractWriteNode extends interface_default2 {
|
|
|
17362
17385
|
const request = new avs_pb9.TaskNode();
|
|
17363
17386
|
request.setId(this.id);
|
|
17364
17387
|
request.setName(this.name);
|
|
17365
|
-
const
|
|
17388
|
+
const node = new avs_pb9.ContractWriteNode();
|
|
17366
17389
|
const config = new avs_pb9.ContractWriteNode.Config();
|
|
17367
17390
|
config.setContractAddress(this.data.contractAddress);
|
|
17368
17391
|
config.setCallData(this.data.callData);
|
|
@@ -17376,12 +17399,12 @@ var ContractWriteNode2 = class _ContractWriteNode extends interface_default2 {
|
|
|
17376
17399
|
}
|
|
17377
17400
|
config.addMethodCalls(methodCallMsg);
|
|
17378
17401
|
});
|
|
17379
|
-
|
|
17402
|
+
node.setConfig(config);
|
|
17380
17403
|
const inputValue = convertInputToProtobuf(this.input);
|
|
17381
17404
|
if (inputValue) {
|
|
17382
|
-
|
|
17405
|
+
node.setInput(inputValue);
|
|
17383
17406
|
}
|
|
17384
|
-
request.setContractWrite(
|
|
17407
|
+
request.setContractWrite(node);
|
|
17385
17408
|
return request;
|
|
17386
17409
|
}
|
|
17387
17410
|
static fromOutputData(outputData) {
|
|
@@ -17443,7 +17466,7 @@ var contractWrite_default = ContractWriteNode2;
|
|
|
17443
17466
|
// src/models/node/customCode.ts
|
|
17444
17467
|
var avs_pb10 = __toESM(require_avs_pb());
|
|
17445
17468
|
var import_types10 = require("@avaprotocol/types");
|
|
17446
|
-
var CustomCodeNode2 = class _CustomCodeNode extends
|
|
17469
|
+
var CustomCodeNode2 = class _CustomCodeNode extends Node {
|
|
17447
17470
|
constructor(props) {
|
|
17448
17471
|
super({ ...props, type: import_types10.NodeType.CustomCode, data: props.data });
|
|
17449
17472
|
}
|
|
@@ -17466,16 +17489,16 @@ var CustomCodeNode2 = class _CustomCodeNode extends interface_default2 {
|
|
|
17466
17489
|
const request = new avs_pb10.TaskNode();
|
|
17467
17490
|
request.setId(this.id);
|
|
17468
17491
|
request.setName(this.name);
|
|
17469
|
-
const
|
|
17492
|
+
const node = new avs_pb10.CustomCodeNode();
|
|
17470
17493
|
const config = new avs_pb10.CustomCodeNode.Config();
|
|
17471
17494
|
config.setLang(this.data.lang);
|
|
17472
17495
|
config.setSource(this.data.source);
|
|
17473
|
-
|
|
17496
|
+
node.setConfig(config);
|
|
17474
17497
|
const inputValue = convertInputToProtobuf(this.input);
|
|
17475
17498
|
if (inputValue) {
|
|
17476
|
-
|
|
17499
|
+
node.setInput(inputValue);
|
|
17477
17500
|
}
|
|
17478
|
-
request.setCustomCode(
|
|
17501
|
+
request.setCustomCode(node);
|
|
17479
17502
|
return request;
|
|
17480
17503
|
}
|
|
17481
17504
|
static fromOutputData(outputData) {
|
|
@@ -17495,7 +17518,7 @@ var customCode_default = CustomCodeNode2;
|
|
|
17495
17518
|
// src/models/node/graphqlQuery.ts
|
|
17496
17519
|
var avs_pb11 = __toESM(require_avs_pb());
|
|
17497
17520
|
var import_types11 = require("@avaprotocol/types");
|
|
17498
|
-
var GraphQLQueryNode2 = class _GraphQLQueryNode extends
|
|
17521
|
+
var GraphQLQueryNode2 = class _GraphQLQueryNode extends Node {
|
|
17499
17522
|
constructor(props) {
|
|
17500
17523
|
super({
|
|
17501
17524
|
...props,
|
|
@@ -17517,7 +17540,7 @@ var GraphQLQueryNode2 = class _GraphQLQueryNode extends interface_default2 {
|
|
|
17517
17540
|
const request = new avs_pb11.TaskNode();
|
|
17518
17541
|
request.setId(this.id);
|
|
17519
17542
|
request.setName(this.name);
|
|
17520
|
-
const
|
|
17543
|
+
const node = new avs_pb11.GraphQLQueryNode();
|
|
17521
17544
|
const config = new avs_pb11.GraphQLQueryNode.Config();
|
|
17522
17545
|
config.setUrl(this.data.url);
|
|
17523
17546
|
config.setQuery(this.data.query);
|
|
@@ -17527,12 +17550,12 @@ var GraphQLQueryNode2 = class _GraphQLQueryNode extends interface_default2 {
|
|
|
17527
17550
|
variablesMap.set(key, value);
|
|
17528
17551
|
});
|
|
17529
17552
|
}
|
|
17530
|
-
|
|
17553
|
+
node.setConfig(config);
|
|
17531
17554
|
const inputValue = convertInputToProtobuf(this.input);
|
|
17532
17555
|
if (inputValue) {
|
|
17533
|
-
|
|
17556
|
+
node.setInput(inputValue);
|
|
17534
17557
|
}
|
|
17535
|
-
request.setGraphqlQuery(
|
|
17558
|
+
request.setGraphqlQuery(node);
|
|
17536
17559
|
return request;
|
|
17537
17560
|
}
|
|
17538
17561
|
static fromOutputData(outputData) {
|
|
@@ -17545,7 +17568,7 @@ var graphqlQuery_default = GraphQLQueryNode2;
|
|
|
17545
17568
|
// src/models/node/restApi.ts
|
|
17546
17569
|
var avs_pb12 = __toESM(require_avs_pb());
|
|
17547
17570
|
var import_types12 = require("@avaprotocol/types");
|
|
17548
|
-
var RestAPINode2 = class _RestAPINode extends
|
|
17571
|
+
var RestAPINode2 = class _RestAPINode extends Node {
|
|
17549
17572
|
constructor(props) {
|
|
17550
17573
|
super({ ...props, type: import_types12.NodeType.RestAPI, data: props.data });
|
|
17551
17574
|
}
|
|
@@ -17606,7 +17629,7 @@ var restApi_default = RestAPINode2;
|
|
|
17606
17629
|
// src/models/node/contractRead.ts
|
|
17607
17630
|
var avs_pb13 = __toESM(require_avs_pb());
|
|
17608
17631
|
var import_types13 = require("@avaprotocol/types");
|
|
17609
|
-
var ContractReadNode2 = class _ContractReadNode extends
|
|
17632
|
+
var ContractReadNode2 = class _ContractReadNode extends Node {
|
|
17610
17633
|
constructor(props) {
|
|
17611
17634
|
super({ ...props, type: import_types13.NodeType.ContractRead, data: props.data });
|
|
17612
17635
|
}
|
|
@@ -17633,7 +17656,7 @@ var ContractReadNode2 = class _ContractReadNode extends interface_default2 {
|
|
|
17633
17656
|
const request = new avs_pb13.TaskNode();
|
|
17634
17657
|
request.setId(this.id);
|
|
17635
17658
|
request.setName(this.name);
|
|
17636
|
-
const
|
|
17659
|
+
const node = new avs_pb13.ContractReadNode();
|
|
17637
17660
|
const config = new avs_pb13.ContractReadNode.Config();
|
|
17638
17661
|
config.setContractAddress(this.data.contractAddress);
|
|
17639
17662
|
config.setContractAbi(this.data.contractAbi);
|
|
@@ -17646,12 +17669,12 @@ var ContractReadNode2 = class _ContractReadNode extends interface_default2 {
|
|
|
17646
17669
|
}
|
|
17647
17670
|
config.addMethodCalls(methodCallMsg);
|
|
17648
17671
|
});
|
|
17649
|
-
|
|
17672
|
+
node.setConfig(config);
|
|
17650
17673
|
const inputValue = convertInputToProtobuf(this.input);
|
|
17651
17674
|
if (inputValue) {
|
|
17652
|
-
|
|
17675
|
+
node.setInput(inputValue);
|
|
17653
17676
|
}
|
|
17654
|
-
request.setContractRead(
|
|
17677
|
+
request.setContractRead(node);
|
|
17655
17678
|
return request;
|
|
17656
17679
|
}
|
|
17657
17680
|
static fromOutputData(outputData) {
|
|
@@ -17679,7 +17702,7 @@ var contractRead_default = ContractReadNode2;
|
|
|
17679
17702
|
// src/models/node/ethTransfer.ts
|
|
17680
17703
|
var avs_pb14 = __toESM(require_avs_pb());
|
|
17681
17704
|
var import_types14 = require("@avaprotocol/types");
|
|
17682
|
-
var ETHTransferNode2 = class _ETHTransferNode extends
|
|
17705
|
+
var ETHTransferNode2 = class _ETHTransferNode extends Node {
|
|
17683
17706
|
constructor(props) {
|
|
17684
17707
|
super({ ...props, type: import_types14.NodeType.ETHTransfer, data: props.data });
|
|
17685
17708
|
}
|
|
@@ -17697,16 +17720,16 @@ var ETHTransferNode2 = class _ETHTransferNode extends interface_default2 {
|
|
|
17697
17720
|
const request = new avs_pb14.TaskNode();
|
|
17698
17721
|
request.setId(this.id);
|
|
17699
17722
|
request.setName(this.name);
|
|
17700
|
-
const
|
|
17723
|
+
const node = new avs_pb14.ETHTransferNode();
|
|
17701
17724
|
const config = new avs_pb14.ETHTransferNode.Config();
|
|
17702
17725
|
config.setDestination(this.data.destination);
|
|
17703
17726
|
config.setAmount(this.data.amount);
|
|
17704
|
-
|
|
17727
|
+
node.setConfig(config);
|
|
17705
17728
|
const inputValue = convertInputToProtobuf(this.input);
|
|
17706
17729
|
if (inputValue) {
|
|
17707
|
-
|
|
17730
|
+
node.setInput(inputValue);
|
|
17708
17731
|
}
|
|
17709
|
-
request.setEthTransfer(
|
|
17732
|
+
request.setEthTransfer(node);
|
|
17710
17733
|
return request;
|
|
17711
17734
|
}
|
|
17712
17735
|
static fromOutputData(outputData) {
|
|
@@ -17719,7 +17742,7 @@ var ethTransfer_default = ETHTransferNode2;
|
|
|
17719
17742
|
// src/models/node/branch.ts
|
|
17720
17743
|
var import_types15 = require("@avaprotocol/types");
|
|
17721
17744
|
var avs_pb15 = __toESM(require_avs_pb());
|
|
17722
|
-
var BranchNode2 = class _BranchNode extends
|
|
17745
|
+
var BranchNode2 = class _BranchNode extends Node {
|
|
17723
17746
|
constructor(props) {
|
|
17724
17747
|
super({ ...props, type: import_types15.NodeType.Branch, data: props.data });
|
|
17725
17748
|
}
|
|
@@ -17745,7 +17768,7 @@ var BranchNode2 = class _BranchNode extends interface_default2 {
|
|
|
17745
17768
|
const request = new avs_pb15.TaskNode();
|
|
17746
17769
|
request.setId(this.id);
|
|
17747
17770
|
request.setName(this.name);
|
|
17748
|
-
const
|
|
17771
|
+
const node = new avs_pb15.BranchNode();
|
|
17749
17772
|
const config = new avs_pb15.BranchNode.Config();
|
|
17750
17773
|
if (this.data.conditions && this.data.conditions.length > 0) {
|
|
17751
17774
|
const conditionsList = this.data.conditions.map(
|
|
@@ -17759,12 +17782,12 @@ var BranchNode2 = class _BranchNode extends interface_default2 {
|
|
|
17759
17782
|
);
|
|
17760
17783
|
config.setConditionsList(conditionsList);
|
|
17761
17784
|
}
|
|
17762
|
-
|
|
17785
|
+
node.setConfig(config);
|
|
17763
17786
|
const inputValue = convertInputToProtobuf(this.input);
|
|
17764
17787
|
if (inputValue) {
|
|
17765
|
-
|
|
17788
|
+
node.setInput(inputValue);
|
|
17766
17789
|
}
|
|
17767
|
-
request.setBranch(
|
|
17790
|
+
request.setBranch(node);
|
|
17768
17791
|
return request;
|
|
17769
17792
|
}
|
|
17770
17793
|
static fromOutputData(outputData) {
|
|
@@ -17778,7 +17801,7 @@ var branch_default = BranchNode2;
|
|
|
17778
17801
|
// src/models/node/filter.ts
|
|
17779
17802
|
var avs_pb16 = __toESM(require_avs_pb());
|
|
17780
17803
|
var import_types16 = require("@avaprotocol/types");
|
|
17781
|
-
var FilterNode2 = class _FilterNode extends
|
|
17804
|
+
var FilterNode2 = class _FilterNode extends Node {
|
|
17782
17805
|
constructor(props) {
|
|
17783
17806
|
super({ ...props, type: import_types16.NodeType.Filter, data: props.data });
|
|
17784
17807
|
}
|
|
@@ -17796,16 +17819,16 @@ var FilterNode2 = class _FilterNode extends interface_default2 {
|
|
|
17796
17819
|
const request = new avs_pb16.TaskNode();
|
|
17797
17820
|
request.setId(this.id);
|
|
17798
17821
|
request.setName(this.name);
|
|
17799
|
-
const
|
|
17822
|
+
const node = new avs_pb16.FilterNode();
|
|
17800
17823
|
const config = new avs_pb16.FilterNode.Config();
|
|
17801
17824
|
config.setExpression(this.data.expression);
|
|
17802
17825
|
config.setSourceId(this.data.sourceId || "");
|
|
17803
|
-
|
|
17826
|
+
node.setConfig(config);
|
|
17804
17827
|
const inputValue = convertInputToProtobuf(this.input);
|
|
17805
17828
|
if (inputValue) {
|
|
17806
|
-
|
|
17829
|
+
node.setInput(inputValue);
|
|
17807
17830
|
}
|
|
17808
|
-
request.setFilter(
|
|
17831
|
+
request.setFilter(node);
|
|
17809
17832
|
return request;
|
|
17810
17833
|
}
|
|
17811
17834
|
static fromOutputData(outputData) {
|
|
@@ -17818,7 +17841,7 @@ var filter_default = FilterNode2;
|
|
|
17818
17841
|
// src/models/node/loop.ts
|
|
17819
17842
|
var avs_pb17 = __toESM(require_avs_pb());
|
|
17820
17843
|
var import_types17 = require("@avaprotocol/types");
|
|
17821
|
-
var LoopNode2 = class _LoopNode extends
|
|
17844
|
+
var LoopNode2 = class _LoopNode extends Node {
|
|
17822
17845
|
constructor(props) {
|
|
17823
17846
|
super({ ...props, type: import_types17.NodeType.Loop, data: props.data });
|
|
17824
17847
|
}
|
|
@@ -18209,7 +18232,6 @@ var workflow_default = Workflow;
|
|
|
18209
18232
|
|
|
18210
18233
|
// src/models/step.ts
|
|
18211
18234
|
var avs_pb20 = __toESM(require_avs_pb());
|
|
18212
|
-
var import_struct_pb2 = require("google-protobuf/google/protobuf/struct_pb");
|
|
18213
18235
|
var Step = class _Step {
|
|
18214
18236
|
constructor(props) {
|
|
18215
18237
|
this.id = props.id;
|
|
@@ -18244,222 +18266,265 @@ var Step = class _Step {
|
|
|
18244
18266
|
};
|
|
18245
18267
|
}
|
|
18246
18268
|
static getOutput(step) {
|
|
18247
|
-
const
|
|
18248
|
-
|
|
18249
|
-
|
|
18269
|
+
const getOutputDataCase = () => {
|
|
18270
|
+
if (typeof step.getOutputDataCase === "function") {
|
|
18271
|
+
return step.getOutputDataCase();
|
|
18272
|
+
}
|
|
18273
|
+
const stepObj = step;
|
|
18274
|
+
if (stepObj.blockTrigger)
|
|
18275
|
+
return avs_pb20.Execution.Step.OutputDataCase.BLOCK_TRIGGER;
|
|
18276
|
+
if (stepObj.fixedTimeTrigger)
|
|
18277
|
+
return avs_pb20.Execution.Step.OutputDataCase.FIXED_TIME_TRIGGER;
|
|
18278
|
+
if (stepObj.cronTrigger)
|
|
18279
|
+
return avs_pb20.Execution.Step.OutputDataCase.CRON_TRIGGER;
|
|
18280
|
+
if (stepObj.eventTrigger)
|
|
18281
|
+
return avs_pb20.Execution.Step.OutputDataCase.EVENT_TRIGGER;
|
|
18282
|
+
if (stepObj.manualTrigger)
|
|
18283
|
+
return avs_pb20.Execution.Step.OutputDataCase.MANUAL_TRIGGER;
|
|
18284
|
+
if (stepObj.ethTransfer)
|
|
18285
|
+
return avs_pb20.Execution.Step.OutputDataCase.ETH_TRANSFER;
|
|
18286
|
+
if (stepObj.graphql) return avs_pb20.Execution.Step.OutputDataCase.GRAPHQL;
|
|
18287
|
+
if (stepObj.contractRead)
|
|
18288
|
+
return avs_pb20.Execution.Step.OutputDataCase.CONTRACT_READ;
|
|
18289
|
+
if (stepObj.contractWrite)
|
|
18290
|
+
return avs_pb20.Execution.Step.OutputDataCase.CONTRACT_WRITE;
|
|
18291
|
+
if (stepObj.customCode)
|
|
18292
|
+
return avs_pb20.Execution.Step.OutputDataCase.CUSTOM_CODE;
|
|
18293
|
+
if (stepObj.restApi) return avs_pb20.Execution.Step.OutputDataCase.REST_API;
|
|
18294
|
+
if (stepObj.branch) return avs_pb20.Execution.Step.OutputDataCase.BRANCH;
|
|
18295
|
+
if (stepObj.filter) return avs_pb20.Execution.Step.OutputDataCase.FILTER;
|
|
18296
|
+
if (stepObj.loop) return avs_pb20.Execution.Step.OutputDataCase.LOOP;
|
|
18297
|
+
return avs_pb20.Execution.Step.OutputDataCase.OUTPUT_DATA_NOT_SET;
|
|
18298
|
+
};
|
|
18299
|
+
switch (getOutputDataCase()) {
|
|
18250
18300
|
case avs_pb20.Execution.Step.OutputDataCase.OUTPUT_DATA_NOT_SET:
|
|
18251
18301
|
return void 0;
|
|
18252
18302
|
// Trigger outputs
|
|
18253
18303
|
case avs_pb20.Execution.Step.OutputDataCase.BLOCK_TRIGGER:
|
|
18254
|
-
|
|
18255
|
-
return blockOutput ? { blockNumber: blockOutput.blockNumber } : void 0;
|
|
18304
|
+
return typeof step.getBlockTrigger === "function" ? step.getBlockTrigger()?.toObject() : step.blockTrigger;
|
|
18256
18305
|
case avs_pb20.Execution.Step.OutputDataCase.FIXED_TIME_TRIGGER:
|
|
18257
|
-
|
|
18258
|
-
return fixedTimeOutput ? {
|
|
18259
|
-
timestamp: fixedTimeOutput.timestamp,
|
|
18260
|
-
timestampIso: fixedTimeOutput.timestampIso
|
|
18261
|
-
} : void 0;
|
|
18306
|
+
return typeof step.getFixedTimeTrigger === "function" ? step.getFixedTimeTrigger()?.toObject() : step.fixedTimeTrigger;
|
|
18262
18307
|
case avs_pb20.Execution.Step.OutputDataCase.CRON_TRIGGER:
|
|
18263
|
-
|
|
18264
|
-
return cronOutput ? {
|
|
18265
|
-
timestamp: cronOutput.timestamp,
|
|
18266
|
-
timestampIso: cronOutput.timestampIso
|
|
18267
|
-
} : void 0;
|
|
18308
|
+
return typeof step.getCronTrigger === "function" ? step.getCronTrigger()?.toObject() : step.cronTrigger;
|
|
18268
18309
|
case avs_pb20.Execution.Step.OutputDataCase.EVENT_TRIGGER:
|
|
18269
|
-
const eventTrigger = step.getEventTrigger();
|
|
18310
|
+
const eventTrigger = typeof step.getEventTrigger === "function" ? step.getEventTrigger() : step.eventTrigger;
|
|
18270
18311
|
if (eventTrigger) {
|
|
18271
|
-
if (eventTrigger.hasEvmLog()) {
|
|
18312
|
+
if (typeof eventTrigger.hasEvmLog === "function" && eventTrigger.hasEvmLog()) {
|
|
18272
18313
|
return eventTrigger.getEvmLog()?.toObject();
|
|
18273
|
-
} else if (eventTrigger.hasTransferLog()) {
|
|
18314
|
+
} else if (typeof eventTrigger.hasTransferLog === "function" && eventTrigger.hasTransferLog()) {
|
|
18274
18315
|
return eventTrigger.getTransferLog()?.toObject();
|
|
18316
|
+
} else if (eventTrigger.evmLog) {
|
|
18317
|
+
return eventTrigger.evmLog;
|
|
18318
|
+
} else if (eventTrigger.transferLog) {
|
|
18319
|
+
return eventTrigger.transferLog;
|
|
18275
18320
|
}
|
|
18276
18321
|
}
|
|
18277
18322
|
return void 0;
|
|
18278
18323
|
case avs_pb20.Execution.Step.OutputDataCase.MANUAL_TRIGGER:
|
|
18279
|
-
|
|
18280
|
-
|
|
18281
|
-
// Node outputs
|
|
18324
|
+
return typeof step.getManualTrigger === "function" ? step.getManualTrigger()?.toObject() || void 0 : step.manualTrigger;
|
|
18325
|
+
// Node outputs - RESTORE MISSING CASES
|
|
18282
18326
|
case avs_pb20.Execution.Step.OutputDataCase.ETH_TRANSFER:
|
|
18283
|
-
|
|
18284
|
-
|
|
18285
|
-
|
|
18286
|
-
|
|
18287
|
-
|
|
18288
|
-
|
|
18289
|
-
|
|
18290
|
-
|
|
18291
|
-
|
|
18292
|
-
|
|
18293
|
-
|
|
18294
|
-
|
|
18295
|
-
const resultArray = results.map((result) => {
|
|
18296
|
-
const dataFields = result.getDataList().map((field) => ({
|
|
18297
|
-
name: field.getName(),
|
|
18298
|
-
type: field.getType(),
|
|
18299
|
-
value: field.getValue()
|
|
18300
|
-
}));
|
|
18301
|
-
return {
|
|
18302
|
-
methodName: result.getMethodName(),
|
|
18303
|
-
success: result.getSuccess(),
|
|
18304
|
-
error: result.getError(),
|
|
18305
|
-
data: dataFields
|
|
18306
|
-
};
|
|
18307
|
-
});
|
|
18308
|
-
return { results: resultArray };
|
|
18327
|
+
return typeof step.getEthTransfer === "function" ? step.getEthTransfer()?.toObject() : step.ethTransfer;
|
|
18328
|
+
case avs_pb20.Execution.Step.OutputDataCase.CUSTOM_CODE:
|
|
18329
|
+
const customCodeOutput = typeof step.getCustomCode === "function" ? step.getCustomCode() : step.customCode;
|
|
18330
|
+
if (customCodeOutput) {
|
|
18331
|
+
if (typeof customCodeOutput.hasData === "function" && customCodeOutput.hasData()) {
|
|
18332
|
+
try {
|
|
18333
|
+
return convertProtobufValueToJs(customCodeOutput.getData());
|
|
18334
|
+
} catch {
|
|
18335
|
+
return customCodeOutput.getData();
|
|
18336
|
+
}
|
|
18337
|
+
} else if (customCodeOutput.data) {
|
|
18338
|
+
return typeof customCodeOutput.data.getKindCase === "function" ? convertProtobufValueToJs(customCodeOutput.data) : customCodeOutput.data;
|
|
18309
18339
|
}
|
|
18310
18340
|
}
|
|
18311
18341
|
return void 0;
|
|
18312
|
-
case avs_pb20.Execution.Step.OutputDataCase.
|
|
18313
|
-
|
|
18314
|
-
if (
|
|
18315
|
-
|
|
18316
|
-
|
|
18317
|
-
|
|
18318
|
-
|
|
18319
|
-
|
|
18320
|
-
transaction: result.getTransaction() ? {
|
|
18321
|
-
hash: result.getTransaction()?.getHash(),
|
|
18322
|
-
status: result.getTransaction()?.getStatus(),
|
|
18323
|
-
blockNumber: result.getTransaction()?.getBlockNumber(),
|
|
18324
|
-
blockHash: result.getTransaction()?.getBlockHash(),
|
|
18325
|
-
gasUsed: result.getTransaction()?.getGasUsed(),
|
|
18326
|
-
gasLimit: result.getTransaction()?.getGasLimit(),
|
|
18327
|
-
gasPrice: result.getTransaction()?.getGasPrice(),
|
|
18328
|
-
effectiveGasPrice: result.getTransaction()?.getEffectiveGasPrice(),
|
|
18329
|
-
from: result.getTransaction()?.getFrom(),
|
|
18330
|
-
to: result.getTransaction()?.getTo(),
|
|
18331
|
-
value: result.getTransaction()?.getValue(),
|
|
18332
|
-
nonce: result.getTransaction()?.getNonce(),
|
|
18333
|
-
transactionIndex: result.getTransaction()?.getTransactionIndex(),
|
|
18334
|
-
confirmations: result.getTransaction()?.getConfirmations(),
|
|
18335
|
-
timestamp: result.getTransaction()?.getTimestamp()
|
|
18336
|
-
} : null,
|
|
18337
|
-
events: result.getEventsList().map((event) => ({
|
|
18338
|
-
eventName: event.getEventName(),
|
|
18339
|
-
address: event.getAddress(),
|
|
18340
|
-
topics: event.getTopicsList(),
|
|
18341
|
-
data: event.getData(),
|
|
18342
|
-
decoded: event.getDecodedMap() ? Object.fromEntries(event.getDecodedMap().toArray()) : {}
|
|
18343
|
-
})),
|
|
18344
|
-
error: result.getError() ? {
|
|
18345
|
-
code: result.getError()?.getCode(),
|
|
18346
|
-
message: result.getError()?.getMessage(),
|
|
18347
|
-
revertReason: result.getError()?.getRevertReason()
|
|
18348
|
-
} : null,
|
|
18349
|
-
returnData: result.getReturnData() ? {
|
|
18350
|
-
name: result.getReturnData()?.getName(),
|
|
18351
|
-
type: result.getReturnData()?.getType(),
|
|
18352
|
-
value: result.getReturnData()?.getValue()
|
|
18353
|
-
} : null,
|
|
18354
|
-
inputData: result.getInputData()
|
|
18355
|
-
}));
|
|
18356
|
-
if (transformedResults.length === 1) {
|
|
18357
|
-
return {
|
|
18358
|
-
results: transformedResults,
|
|
18359
|
-
// Legacy compatibility fields
|
|
18360
|
-
transaction: transformedResults[0].transaction,
|
|
18361
|
-
success: transformedResults[0].success,
|
|
18362
|
-
hash: transformedResults[0].transaction?.hash
|
|
18363
|
-
};
|
|
18364
|
-
} else {
|
|
18365
|
-
return { results: transformedResults };
|
|
18342
|
+
case avs_pb20.Execution.Step.OutputDataCase.REST_API:
|
|
18343
|
+
const restApiOutput = typeof step.getRestApi === "function" ? step.getRestApi() : step.restApi;
|
|
18344
|
+
if (restApiOutput) {
|
|
18345
|
+
if (typeof restApiOutput.hasData === "function" && restApiOutput.hasData()) {
|
|
18346
|
+
try {
|
|
18347
|
+
return convertProtobufValueToJs(restApiOutput.getData());
|
|
18348
|
+
} catch {
|
|
18349
|
+
return restApiOutput.getData();
|
|
18366
18350
|
}
|
|
18351
|
+
} else if (restApiOutput.data) {
|
|
18352
|
+
return typeof restApiOutput.data.getKindCase === "function" ? convertProtobufValueToJs(restApiOutput.data) : restApiOutput.data;
|
|
18367
18353
|
}
|
|
18368
18354
|
}
|
|
18369
18355
|
return void 0;
|
|
18370
|
-
case avs_pb20.Execution.Step.OutputDataCase.CUSTOM_CODE:
|
|
18371
|
-
nodeOutputMessage = step.getCustomCode();
|
|
18372
|
-
return nodeOutputMessage && nodeOutputMessage.hasData() ? convertProtobufValueToJs(nodeOutputMessage.getData()) : void 0;
|
|
18373
|
-
case avs_pb20.Execution.Step.OutputDataCase.REST_API:
|
|
18374
|
-
nodeOutputMessage = step.getRestApi();
|
|
18375
|
-
return nodeOutputMessage && nodeOutputMessage.hasData() ? convertProtobufValueToJs(nodeOutputMessage.getData()) : void 0;
|
|
18376
18356
|
case avs_pb20.Execution.Step.OutputDataCase.BRANCH:
|
|
18377
|
-
return step.getBranch()?.toObject();
|
|
18378
|
-
case avs_pb20.Execution.Step.OutputDataCase.
|
|
18379
|
-
|
|
18380
|
-
if (
|
|
18381
|
-
|
|
18382
|
-
|
|
18383
|
-
|
|
18384
|
-
|
|
18385
|
-
|
|
18386
|
-
if (unpackedValue) {
|
|
18387
|
-
return convertProtobufValueToJs(unpackedValue);
|
|
18388
|
-
}
|
|
18389
|
-
} catch (error) {
|
|
18390
|
-
console.warn("Failed to unpack FilterNode Any wrapper:", error);
|
|
18391
|
-
return void 0;
|
|
18392
|
-
}
|
|
18357
|
+
return typeof step.getBranch === "function" ? step.getBranch()?.toObject() : step.branch;
|
|
18358
|
+
case avs_pb20.Execution.Step.OutputDataCase.LOOP:
|
|
18359
|
+
const loopOutput = typeof step.getLoop === "function" ? step.getLoop() : step.loop;
|
|
18360
|
+
if (loopOutput) {
|
|
18361
|
+
if (typeof loopOutput.getData === "function" && loopOutput.getData()) {
|
|
18362
|
+
try {
|
|
18363
|
+
return JSON.parse(loopOutput.getData());
|
|
18364
|
+
} catch {
|
|
18365
|
+
return loopOutput.getData();
|
|
18393
18366
|
}
|
|
18394
|
-
|
|
18367
|
+
} else if (loopOutput.data) {
|
|
18368
|
+
try {
|
|
18369
|
+
return typeof loopOutput.data === "string" ? JSON.parse(loopOutput.data) : loopOutput.data;
|
|
18370
|
+
} catch {
|
|
18371
|
+
return loopOutput.data;
|
|
18372
|
+
}
|
|
18373
|
+
}
|
|
18374
|
+
}
|
|
18375
|
+
return void 0;
|
|
18376
|
+
case avs_pb20.Execution.Step.OutputDataCase.GRAPHQL:
|
|
18377
|
+
const graphqlOutput = typeof step.getGraphql === "function" ? step.getGraphql() : step.graphql;
|
|
18378
|
+
if (graphqlOutput) {
|
|
18379
|
+
try {
|
|
18380
|
+
return typeof graphqlOutput.toObject === "function" ? graphqlOutput.toObject() : graphqlOutput;
|
|
18381
|
+
} catch {
|
|
18395
18382
|
return void 0;
|
|
18396
18383
|
}
|
|
18397
18384
|
}
|
|
18398
18385
|
return void 0;
|
|
18399
|
-
case avs_pb20.Execution.Step.OutputDataCase.
|
|
18400
|
-
const
|
|
18401
|
-
if (
|
|
18402
|
-
|
|
18403
|
-
|
|
18404
|
-
|
|
18405
|
-
|
|
18406
|
-
|
|
18407
|
-
|
|
18408
|
-
|
|
18409
|
-
|
|
18410
|
-
|
|
18411
|
-
|
|
18412
|
-
|
|
18413
|
-
|
|
18414
|
-
|
|
18415
|
-
|
|
18416
|
-
|
|
18417
|
-
|
|
18418
|
-
|
|
18419
|
-
|
|
18420
|
-
|
|
18421
|
-
|
|
18422
|
-
|
|
18423
|
-
|
|
18424
|
-
|
|
18386
|
+
case avs_pb20.Execution.Step.OutputDataCase.CONTRACT_READ:
|
|
18387
|
+
const contractReadOutput = typeof step.getContractRead === "function" ? step.getContractRead() : step.contractRead;
|
|
18388
|
+
if (contractReadOutput) {
|
|
18389
|
+
const outputObj = typeof contractReadOutput.toObject === "function" ? contractReadOutput.toObject() : contractReadOutput;
|
|
18390
|
+
if (outputObj && outputObj.resultsList) {
|
|
18391
|
+
const { resultsList, ...cleanOutputObj } = outputObj;
|
|
18392
|
+
return {
|
|
18393
|
+
...cleanOutputObj,
|
|
18394
|
+
results: resultsList.map((result) => ({
|
|
18395
|
+
methodName: result.methodName,
|
|
18396
|
+
success: result.success,
|
|
18397
|
+
error: result.error,
|
|
18398
|
+
data: result.dataList || []
|
|
18399
|
+
}))
|
|
18400
|
+
};
|
|
18401
|
+
}
|
|
18402
|
+
return outputObj;
|
|
18403
|
+
}
|
|
18404
|
+
return void 0;
|
|
18405
|
+
case avs_pb20.Execution.Step.OutputDataCase.CONTRACT_WRITE:
|
|
18406
|
+
const contractWriteOutput = typeof step.getContractWrite === "function" ? step.getContractWrite() : step.contractWrite;
|
|
18407
|
+
if (contractWriteOutput) {
|
|
18408
|
+
const outputObj = typeof contractWriteOutput.toObject === "function" ? contractWriteOutput.toObject() : contractWriteOutput;
|
|
18409
|
+
if (outputObj && outputObj.resultsList) {
|
|
18410
|
+
const transformedResults = outputObj.resultsList.map(
|
|
18411
|
+
(result) => ({
|
|
18412
|
+
methodName: result.methodName,
|
|
18413
|
+
success: result.success,
|
|
18414
|
+
transaction: result.transaction ? {
|
|
18415
|
+
hash: result.transaction.hash,
|
|
18416
|
+
status: result.transaction.status,
|
|
18417
|
+
blockNumber: result.transaction.blockNumber,
|
|
18418
|
+
blockHash: result.transaction.blockHash,
|
|
18419
|
+
gasUsed: result.transaction.gasUsed,
|
|
18420
|
+
gasLimit: result.transaction.gasLimit,
|
|
18421
|
+
gasPrice: result.transaction.gasPrice,
|
|
18422
|
+
effectiveGasPrice: result.transaction.effectiveGasPrice,
|
|
18423
|
+
from: result.transaction.from,
|
|
18424
|
+
to: result.transaction.to,
|
|
18425
|
+
value: result.transaction.value,
|
|
18426
|
+
nonce: result.transaction.nonce,
|
|
18427
|
+
transactionIndex: result.transaction.transactionIndex,
|
|
18428
|
+
confirmations: result.transaction.confirmations,
|
|
18429
|
+
timestamp: result.transaction.timestamp
|
|
18430
|
+
} : null,
|
|
18431
|
+
events: result.eventsList?.map((event) => ({
|
|
18432
|
+
eventName: event.eventName,
|
|
18433
|
+
address: event.address,
|
|
18434
|
+
topics: event.topicsList || [],
|
|
18435
|
+
data: event.data,
|
|
18436
|
+
decoded: event.decodedMap || {}
|
|
18437
|
+
})) || [],
|
|
18438
|
+
error: result.error ? {
|
|
18439
|
+
code: result.error.code,
|
|
18440
|
+
message: result.error.message,
|
|
18441
|
+
revertReason: result.error.revertReason
|
|
18442
|
+
} : null,
|
|
18443
|
+
returnData: result.returnData ? {
|
|
18444
|
+
name: result.returnData.name,
|
|
18445
|
+
type: result.returnData.type,
|
|
18446
|
+
value: result.returnData.value
|
|
18447
|
+
} : null,
|
|
18448
|
+
inputData: result.inputData
|
|
18449
|
+
})
|
|
18450
|
+
);
|
|
18451
|
+
const { resultsList, ...cleanOutputObj } = outputObj;
|
|
18452
|
+
return {
|
|
18453
|
+
...cleanOutputObj,
|
|
18454
|
+
results: transformedResults,
|
|
18455
|
+
// For backward compatibility, provide legacy fields from first result
|
|
18456
|
+
...transformedResults.length > 0 && {
|
|
18457
|
+
transaction: transformedResults[0].transaction,
|
|
18458
|
+
success: transformedResults[0].success,
|
|
18459
|
+
hash: transformedResults[0].transaction?.hash
|
|
18425
18460
|
}
|
|
18426
|
-
|
|
18427
|
-
});
|
|
18461
|
+
};
|
|
18428
18462
|
}
|
|
18429
|
-
|
|
18430
|
-
|
|
18463
|
+
return outputObj;
|
|
18464
|
+
}
|
|
18465
|
+
return void 0;
|
|
18466
|
+
case avs_pb20.Execution.Step.OutputDataCase.FILTER:
|
|
18467
|
+
const filterOutput = typeof step.getFilter === "function" ? step.getFilter() : step.filter;
|
|
18468
|
+
if (filterOutput) {
|
|
18469
|
+
try {
|
|
18470
|
+
return typeof filterOutput.toObject === "function" ? filterOutput.toObject() : filterOutput;
|
|
18471
|
+
} catch {
|
|
18472
|
+
return void 0;
|
|
18431
18473
|
}
|
|
18432
|
-
return { data: parsedData };
|
|
18433
|
-
} catch (e) {
|
|
18434
|
-
return { data: loopData };
|
|
18435
18474
|
}
|
|
18475
|
+
return void 0;
|
|
18436
18476
|
default:
|
|
18437
18477
|
console.warn(
|
|
18438
|
-
`Unhandled output data type in Step.getOutput: ${
|
|
18478
|
+
`Unhandled output data type in Step.getOutput: ${step.getOutputDataCase()}`
|
|
18439
18479
|
);
|
|
18440
18480
|
return void 0;
|
|
18441
18481
|
}
|
|
18442
18482
|
}
|
|
18443
18483
|
static fromResponse(step) {
|
|
18444
18484
|
let inputData = void 0;
|
|
18445
|
-
if (step.hasInput()) {
|
|
18485
|
+
if (typeof step.hasInput === "function" && step.hasInput()) {
|
|
18446
18486
|
const inputValue = step.getInput();
|
|
18447
18487
|
if (inputValue) {
|
|
18448
|
-
|
|
18488
|
+
try {
|
|
18489
|
+
inputData = convertProtobufValueToJs(inputValue);
|
|
18490
|
+
} catch (error) {
|
|
18491
|
+
console.warn("Failed to convert protobuf input value:", error);
|
|
18492
|
+
inputData = inputValue;
|
|
18493
|
+
}
|
|
18494
|
+
}
|
|
18495
|
+
} else if (step.input) {
|
|
18496
|
+
const inputValue = step.input;
|
|
18497
|
+
if (typeof inputValue === "object" && !inputValue.getKindCase) {
|
|
18498
|
+
inputData = inputValue;
|
|
18499
|
+
} else {
|
|
18500
|
+
try {
|
|
18501
|
+
inputData = convertProtobufValueToJs(inputValue);
|
|
18502
|
+
} catch (error) {
|
|
18503
|
+
inputData = inputValue;
|
|
18504
|
+
}
|
|
18449
18505
|
}
|
|
18450
18506
|
}
|
|
18507
|
+
const getId = () => typeof step.getId === "function" ? step.getId() : step.id;
|
|
18508
|
+
const getType = () => typeof step.getType === "function" ? step.getType() : step.type;
|
|
18509
|
+
const getName = () => typeof step.getName === "function" ? step.getName() : step.name;
|
|
18510
|
+
const getSuccess = () => typeof step.getSuccess === "function" ? step.getSuccess() : step.success;
|
|
18511
|
+
const getError = () => typeof step.getError === "function" ? step.getError() : step.error;
|
|
18512
|
+
const getLog = () => typeof step.getLog === "function" ? step.getLog() : step.log;
|
|
18513
|
+
const getInputsList = () => typeof step.getInputsList === "function" ? step.getInputsList() : step.inputsList || [];
|
|
18514
|
+
const getStartAt = () => typeof step.getStartAt === "function" ? step.getStartAt() : step.startAt;
|
|
18515
|
+
const getEndAt = () => typeof step.getEndAt === "function" ? step.getEndAt() : step.endAt;
|
|
18451
18516
|
return new _Step({
|
|
18452
|
-
id:
|
|
18453
|
-
type: convertProtobufStepTypeToSdk(
|
|
18454
|
-
name:
|
|
18455
|
-
success:
|
|
18456
|
-
error:
|
|
18457
|
-
log:
|
|
18458
|
-
inputsList:
|
|
18517
|
+
id: getId(),
|
|
18518
|
+
type: convertProtobufStepTypeToSdk(getType()),
|
|
18519
|
+
name: getName(),
|
|
18520
|
+
success: getSuccess(),
|
|
18521
|
+
error: getError(),
|
|
18522
|
+
log: getLog(),
|
|
18523
|
+
inputsList: getInputsList(),
|
|
18459
18524
|
input: inputData,
|
|
18460
18525
|
output: _Step.getOutput(step),
|
|
18461
|
-
startAt:
|
|
18462
|
-
endAt:
|
|
18526
|
+
startAt: getStartAt(),
|
|
18527
|
+
endAt: getEndAt()
|
|
18463
18528
|
});
|
|
18464
18529
|
}
|
|
18465
18530
|
// Client side does not generate the step, so there's no toRequest() method
|