@avaprotocol/sdk-js 2.1.0 → 2.2.0
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 +17 -0
- package/dist/index.d.ts +39 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +737 -67
- package/dist/index.mjs +741 -69
- package/dist/models/node/contractRead.d.ts.map +1 -1
- package/dist/models/node/contractRead.js +22 -5
- package/dist/models/node/loop.d.ts.map +1 -1
- package/dist/models/node/loop.js +10 -1
- package/dist/models/step.d.ts.map +1 -1
- package/dist/models/step.js +33 -4
- package/dist/models/trigger/event.js +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -66,6 +66,9 @@ var require_avs_pb = __commonJS({
|
|
|
66
66
|
goog.exportSymbol("proto.aggregator.BranchNode.Output", null, global);
|
|
67
67
|
goog.exportSymbol("proto.aggregator.ContractReadNode", null, global);
|
|
68
68
|
goog.exportSymbol("proto.aggregator.ContractReadNode.Config", null, global);
|
|
69
|
+
goog.exportSymbol("proto.aggregator.ContractReadNode.MethodCall", null, global);
|
|
70
|
+
goog.exportSymbol("proto.aggregator.ContractReadNode.MethodResult", null, global);
|
|
71
|
+
goog.exportSymbol("proto.aggregator.ContractReadNode.MethodResult.StructuredField", null, global);
|
|
69
72
|
goog.exportSymbol("proto.aggregator.ContractReadNode.Output", null, global);
|
|
70
73
|
goog.exportSymbol("proto.aggregator.ContractWriteNode", null, global);
|
|
71
74
|
goog.exportSymbol("proto.aggregator.ContractWriteNode.Config", null, global);
|
|
@@ -380,13 +383,34 @@ var require_avs_pb = __commonJS({
|
|
|
380
383
|
if (goog.DEBUG && !COMPILED) {
|
|
381
384
|
proto.aggregator.ContractReadNode.displayName = "proto.aggregator.ContractReadNode";
|
|
382
385
|
}
|
|
383
|
-
proto.aggregator.ContractReadNode.
|
|
386
|
+
proto.aggregator.ContractReadNode.MethodCall = function(opt_data) {
|
|
384
387
|
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
|
|
385
388
|
};
|
|
389
|
+
goog.inherits(proto.aggregator.ContractReadNode.MethodCall, jspb.Message);
|
|
390
|
+
if (goog.DEBUG && !COMPILED) {
|
|
391
|
+
proto.aggregator.ContractReadNode.MethodCall.displayName = "proto.aggregator.ContractReadNode.MethodCall";
|
|
392
|
+
}
|
|
393
|
+
proto.aggregator.ContractReadNode.Config = function(opt_data) {
|
|
394
|
+
jspb.Message.initialize(this, opt_data, 0, -1, proto.aggregator.ContractReadNode.Config.repeatedFields_, null);
|
|
395
|
+
};
|
|
386
396
|
goog.inherits(proto.aggregator.ContractReadNode.Config, jspb.Message);
|
|
387
397
|
if (goog.DEBUG && !COMPILED) {
|
|
388
398
|
proto.aggregator.ContractReadNode.Config.displayName = "proto.aggregator.ContractReadNode.Config";
|
|
389
399
|
}
|
|
400
|
+
proto.aggregator.ContractReadNode.MethodResult = function(opt_data) {
|
|
401
|
+
jspb.Message.initialize(this, opt_data, 0, -1, proto.aggregator.ContractReadNode.MethodResult.repeatedFields_, null);
|
|
402
|
+
};
|
|
403
|
+
goog.inherits(proto.aggregator.ContractReadNode.MethodResult, jspb.Message);
|
|
404
|
+
if (goog.DEBUG && !COMPILED) {
|
|
405
|
+
proto.aggregator.ContractReadNode.MethodResult.displayName = "proto.aggregator.ContractReadNode.MethodResult";
|
|
406
|
+
}
|
|
407
|
+
proto.aggregator.ContractReadNode.MethodResult.StructuredField = function(opt_data) {
|
|
408
|
+
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
|
|
409
|
+
};
|
|
410
|
+
goog.inherits(proto.aggregator.ContractReadNode.MethodResult.StructuredField, jspb.Message);
|
|
411
|
+
if (goog.DEBUG && !COMPILED) {
|
|
412
|
+
proto.aggregator.ContractReadNode.MethodResult.StructuredField.displayName = "proto.aggregator.ContractReadNode.MethodResult.StructuredField";
|
|
413
|
+
}
|
|
390
414
|
proto.aggregator.ContractReadNode.Output = function(opt_data) {
|
|
391
415
|
jspb.Message.initialize(this, opt_data, 0, -1, proto.aggregator.ContractReadNode.Output.repeatedFields_, null);
|
|
392
416
|
};
|
|
@@ -3854,6 +3878,95 @@ var require_avs_pb = __commonJS({
|
|
|
3854
3878
|
);
|
|
3855
3879
|
}
|
|
3856
3880
|
};
|
|
3881
|
+
if (jspb.Message.GENERATE_TO_OBJECT) {
|
|
3882
|
+
proto.aggregator.ContractReadNode.MethodCall.prototype.toObject = function(opt_includeInstance) {
|
|
3883
|
+
return proto.aggregator.ContractReadNode.MethodCall.toObject(opt_includeInstance, this);
|
|
3884
|
+
};
|
|
3885
|
+
proto.aggregator.ContractReadNode.MethodCall.toObject = function(includeInstance, msg) {
|
|
3886
|
+
var f, obj = {
|
|
3887
|
+
callData: jspb.Message.getFieldWithDefault(msg, 1, ""),
|
|
3888
|
+
methodName: jspb.Message.getFieldWithDefault(msg, 2, "")
|
|
3889
|
+
};
|
|
3890
|
+
if (includeInstance) {
|
|
3891
|
+
obj.$jspbMessageInstance = msg;
|
|
3892
|
+
}
|
|
3893
|
+
return obj;
|
|
3894
|
+
};
|
|
3895
|
+
}
|
|
3896
|
+
proto.aggregator.ContractReadNode.MethodCall.deserializeBinary = function(bytes) {
|
|
3897
|
+
var reader = new jspb.BinaryReader(bytes);
|
|
3898
|
+
var msg = new proto.aggregator.ContractReadNode.MethodCall();
|
|
3899
|
+
return proto.aggregator.ContractReadNode.MethodCall.deserializeBinaryFromReader(msg, reader);
|
|
3900
|
+
};
|
|
3901
|
+
proto.aggregator.ContractReadNode.MethodCall.deserializeBinaryFromReader = function(msg, reader) {
|
|
3902
|
+
while (reader.nextField()) {
|
|
3903
|
+
if (reader.isEndGroup()) {
|
|
3904
|
+
break;
|
|
3905
|
+
}
|
|
3906
|
+
var field = reader.getFieldNumber();
|
|
3907
|
+
switch (field) {
|
|
3908
|
+
case 1:
|
|
3909
|
+
var value = (
|
|
3910
|
+
/** @type {string} */
|
|
3911
|
+
reader.readString()
|
|
3912
|
+
);
|
|
3913
|
+
msg.setCallData(value);
|
|
3914
|
+
break;
|
|
3915
|
+
case 2:
|
|
3916
|
+
var value = (
|
|
3917
|
+
/** @type {string} */
|
|
3918
|
+
reader.readString()
|
|
3919
|
+
);
|
|
3920
|
+
msg.setMethodName(value);
|
|
3921
|
+
break;
|
|
3922
|
+
default:
|
|
3923
|
+
reader.skipField();
|
|
3924
|
+
break;
|
|
3925
|
+
}
|
|
3926
|
+
}
|
|
3927
|
+
return msg;
|
|
3928
|
+
};
|
|
3929
|
+
proto.aggregator.ContractReadNode.MethodCall.prototype.serializeBinary = function() {
|
|
3930
|
+
var writer = new jspb.BinaryWriter();
|
|
3931
|
+
proto.aggregator.ContractReadNode.MethodCall.serializeBinaryToWriter(this, writer);
|
|
3932
|
+
return writer.getResultBuffer();
|
|
3933
|
+
};
|
|
3934
|
+
proto.aggregator.ContractReadNode.MethodCall.serializeBinaryToWriter = function(message, writer) {
|
|
3935
|
+
var f = void 0;
|
|
3936
|
+
f = message.getCallData();
|
|
3937
|
+
if (f.length > 0) {
|
|
3938
|
+
writer.writeString(
|
|
3939
|
+
1,
|
|
3940
|
+
f
|
|
3941
|
+
);
|
|
3942
|
+
}
|
|
3943
|
+
f = message.getMethodName();
|
|
3944
|
+
if (f.length > 0) {
|
|
3945
|
+
writer.writeString(
|
|
3946
|
+
2,
|
|
3947
|
+
f
|
|
3948
|
+
);
|
|
3949
|
+
}
|
|
3950
|
+
};
|
|
3951
|
+
proto.aggregator.ContractReadNode.MethodCall.prototype.getCallData = function() {
|
|
3952
|
+
return (
|
|
3953
|
+
/** @type {string} */
|
|
3954
|
+
jspb.Message.getFieldWithDefault(this, 1, "")
|
|
3955
|
+
);
|
|
3956
|
+
};
|
|
3957
|
+
proto.aggregator.ContractReadNode.MethodCall.prototype.setCallData = function(value) {
|
|
3958
|
+
return jspb.Message.setProto3StringField(this, 1, value);
|
|
3959
|
+
};
|
|
3960
|
+
proto.aggregator.ContractReadNode.MethodCall.prototype.getMethodName = function() {
|
|
3961
|
+
return (
|
|
3962
|
+
/** @type {string} */
|
|
3963
|
+
jspb.Message.getFieldWithDefault(this, 2, "")
|
|
3964
|
+
);
|
|
3965
|
+
};
|
|
3966
|
+
proto.aggregator.ContractReadNode.MethodCall.prototype.setMethodName = function(value) {
|
|
3967
|
+
return jspb.Message.setProto3StringField(this, 2, value);
|
|
3968
|
+
};
|
|
3969
|
+
proto.aggregator.ContractReadNode.Config.repeatedFields_ = [3];
|
|
3857
3970
|
if (jspb.Message.GENERATE_TO_OBJECT) {
|
|
3858
3971
|
proto.aggregator.ContractReadNode.Config.prototype.toObject = function(opt_includeInstance) {
|
|
3859
3972
|
return proto.aggregator.ContractReadNode.Config.toObject(opt_includeInstance, this);
|
|
@@ -3861,8 +3974,12 @@ var require_avs_pb = __commonJS({
|
|
|
3861
3974
|
proto.aggregator.ContractReadNode.Config.toObject = function(includeInstance, msg) {
|
|
3862
3975
|
var f, obj = {
|
|
3863
3976
|
contractAddress: jspb.Message.getFieldWithDefault(msg, 1, ""),
|
|
3864
|
-
|
|
3865
|
-
|
|
3977
|
+
contractAbi: jspb.Message.getFieldWithDefault(msg, 2, ""),
|
|
3978
|
+
methodCallsList: jspb.Message.toObjectList(
|
|
3979
|
+
msg.getMethodCallsList(),
|
|
3980
|
+
proto.aggregator.ContractReadNode.MethodCall.toObject,
|
|
3981
|
+
includeInstance
|
|
3982
|
+
)
|
|
3866
3983
|
};
|
|
3867
3984
|
if (includeInstance) {
|
|
3868
3985
|
obj.$jspbMessageInstance = msg;
|
|
@@ -3894,14 +4011,12 @@ var require_avs_pb = __commonJS({
|
|
|
3894
4011
|
/** @type {string} */
|
|
3895
4012
|
reader.readString()
|
|
3896
4013
|
);
|
|
3897
|
-
msg.
|
|
4014
|
+
msg.setContractAbi(value);
|
|
3898
4015
|
break;
|
|
3899
4016
|
case 3:
|
|
3900
|
-
var value = (
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
);
|
|
3904
|
-
msg.setContractAbi(value);
|
|
4017
|
+
var value = new proto.aggregator.ContractReadNode.MethodCall();
|
|
4018
|
+
reader.readMessage(value, proto.aggregator.ContractReadNode.MethodCall.deserializeBinaryFromReader);
|
|
4019
|
+
msg.addMethodCalls(value);
|
|
3905
4020
|
break;
|
|
3906
4021
|
default:
|
|
3907
4022
|
reader.skipField();
|
|
@@ -3924,18 +4039,19 @@ var require_avs_pb = __commonJS({
|
|
|
3924
4039
|
f
|
|
3925
4040
|
);
|
|
3926
4041
|
}
|
|
3927
|
-
f = message.
|
|
4042
|
+
f = message.getContractAbi();
|
|
3928
4043
|
if (f.length > 0) {
|
|
3929
4044
|
writer.writeString(
|
|
3930
4045
|
2,
|
|
3931
4046
|
f
|
|
3932
4047
|
);
|
|
3933
4048
|
}
|
|
3934
|
-
f = message.
|
|
4049
|
+
f = message.getMethodCallsList();
|
|
3935
4050
|
if (f.length > 0) {
|
|
3936
|
-
writer.
|
|
4051
|
+
writer.writeRepeatedMessage(
|
|
3937
4052
|
3,
|
|
3938
|
-
f
|
|
4053
|
+
f,
|
|
4054
|
+
proto.aggregator.ContractReadNode.MethodCall.serializeBinaryToWriter
|
|
3939
4055
|
);
|
|
3940
4056
|
}
|
|
3941
4057
|
};
|
|
@@ -3948,24 +4064,288 @@ var require_avs_pb = __commonJS({
|
|
|
3948
4064
|
proto.aggregator.ContractReadNode.Config.prototype.setContractAddress = function(value) {
|
|
3949
4065
|
return jspb.Message.setProto3StringField(this, 1, value);
|
|
3950
4066
|
};
|
|
3951
|
-
proto.aggregator.ContractReadNode.Config.prototype.
|
|
4067
|
+
proto.aggregator.ContractReadNode.Config.prototype.getContractAbi = function() {
|
|
3952
4068
|
return (
|
|
3953
4069
|
/** @type {string} */
|
|
3954
4070
|
jspb.Message.getFieldWithDefault(this, 2, "")
|
|
3955
4071
|
);
|
|
3956
4072
|
};
|
|
3957
|
-
proto.aggregator.ContractReadNode.Config.prototype.
|
|
4073
|
+
proto.aggregator.ContractReadNode.Config.prototype.setContractAbi = function(value) {
|
|
3958
4074
|
return jspb.Message.setProto3StringField(this, 2, value);
|
|
3959
4075
|
};
|
|
3960
|
-
proto.aggregator.ContractReadNode.Config.prototype.
|
|
4076
|
+
proto.aggregator.ContractReadNode.Config.prototype.getMethodCallsList = function() {
|
|
4077
|
+
return (
|
|
4078
|
+
/** @type{!Array<!proto.aggregator.ContractReadNode.MethodCall>} */
|
|
4079
|
+
jspb.Message.getRepeatedWrapperField(this, proto.aggregator.ContractReadNode.MethodCall, 3)
|
|
4080
|
+
);
|
|
4081
|
+
};
|
|
4082
|
+
proto.aggregator.ContractReadNode.Config.prototype.setMethodCallsList = function(value) {
|
|
4083
|
+
return jspb.Message.setRepeatedWrapperField(this, 3, value);
|
|
4084
|
+
};
|
|
4085
|
+
proto.aggregator.ContractReadNode.Config.prototype.addMethodCalls = function(opt_value, opt_index) {
|
|
4086
|
+
return jspb.Message.addToRepeatedWrapperField(this, 3, opt_value, proto.aggregator.ContractReadNode.MethodCall, opt_index);
|
|
4087
|
+
};
|
|
4088
|
+
proto.aggregator.ContractReadNode.Config.prototype.clearMethodCallsList = function() {
|
|
4089
|
+
return this.setMethodCallsList([]);
|
|
4090
|
+
};
|
|
4091
|
+
proto.aggregator.ContractReadNode.MethodResult.repeatedFields_ = [1];
|
|
4092
|
+
if (jspb.Message.GENERATE_TO_OBJECT) {
|
|
4093
|
+
proto.aggregator.ContractReadNode.MethodResult.prototype.toObject = function(opt_includeInstance) {
|
|
4094
|
+
return proto.aggregator.ContractReadNode.MethodResult.toObject(opt_includeInstance, this);
|
|
4095
|
+
};
|
|
4096
|
+
proto.aggregator.ContractReadNode.MethodResult.toObject = function(includeInstance, msg) {
|
|
4097
|
+
var f, obj = {
|
|
4098
|
+
dataList: jspb.Message.toObjectList(
|
|
4099
|
+
msg.getDataList(),
|
|
4100
|
+
proto.aggregator.ContractReadNode.MethodResult.StructuredField.toObject,
|
|
4101
|
+
includeInstance
|
|
4102
|
+
),
|
|
4103
|
+
methodName: jspb.Message.getFieldWithDefault(msg, 2, ""),
|
|
4104
|
+
success: jspb.Message.getBooleanFieldWithDefault(msg, 3, false),
|
|
4105
|
+
error: jspb.Message.getFieldWithDefault(msg, 4, "")
|
|
4106
|
+
};
|
|
4107
|
+
if (includeInstance) {
|
|
4108
|
+
obj.$jspbMessageInstance = msg;
|
|
4109
|
+
}
|
|
4110
|
+
return obj;
|
|
4111
|
+
};
|
|
4112
|
+
}
|
|
4113
|
+
proto.aggregator.ContractReadNode.MethodResult.deserializeBinary = function(bytes) {
|
|
4114
|
+
var reader = new jspb.BinaryReader(bytes);
|
|
4115
|
+
var msg = new proto.aggregator.ContractReadNode.MethodResult();
|
|
4116
|
+
return proto.aggregator.ContractReadNode.MethodResult.deserializeBinaryFromReader(msg, reader);
|
|
4117
|
+
};
|
|
4118
|
+
proto.aggregator.ContractReadNode.MethodResult.deserializeBinaryFromReader = function(msg, reader) {
|
|
4119
|
+
while (reader.nextField()) {
|
|
4120
|
+
if (reader.isEndGroup()) {
|
|
4121
|
+
break;
|
|
4122
|
+
}
|
|
4123
|
+
var field = reader.getFieldNumber();
|
|
4124
|
+
switch (field) {
|
|
4125
|
+
case 1:
|
|
4126
|
+
var value = new proto.aggregator.ContractReadNode.MethodResult.StructuredField();
|
|
4127
|
+
reader.readMessage(value, proto.aggregator.ContractReadNode.MethodResult.StructuredField.deserializeBinaryFromReader);
|
|
4128
|
+
msg.addData(value);
|
|
4129
|
+
break;
|
|
4130
|
+
case 2:
|
|
4131
|
+
var value = (
|
|
4132
|
+
/** @type {string} */
|
|
4133
|
+
reader.readString()
|
|
4134
|
+
);
|
|
4135
|
+
msg.setMethodName(value);
|
|
4136
|
+
break;
|
|
4137
|
+
case 3:
|
|
4138
|
+
var value = (
|
|
4139
|
+
/** @type {boolean} */
|
|
4140
|
+
reader.readBool()
|
|
4141
|
+
);
|
|
4142
|
+
msg.setSuccess(value);
|
|
4143
|
+
break;
|
|
4144
|
+
case 4:
|
|
4145
|
+
var value = (
|
|
4146
|
+
/** @type {string} */
|
|
4147
|
+
reader.readString()
|
|
4148
|
+
);
|
|
4149
|
+
msg.setError(value);
|
|
4150
|
+
break;
|
|
4151
|
+
default:
|
|
4152
|
+
reader.skipField();
|
|
4153
|
+
break;
|
|
4154
|
+
}
|
|
4155
|
+
}
|
|
4156
|
+
return msg;
|
|
4157
|
+
};
|
|
4158
|
+
proto.aggregator.ContractReadNode.MethodResult.prototype.serializeBinary = function() {
|
|
4159
|
+
var writer = new jspb.BinaryWriter();
|
|
4160
|
+
proto.aggregator.ContractReadNode.MethodResult.serializeBinaryToWriter(this, writer);
|
|
4161
|
+
return writer.getResultBuffer();
|
|
4162
|
+
};
|
|
4163
|
+
proto.aggregator.ContractReadNode.MethodResult.serializeBinaryToWriter = function(message, writer) {
|
|
4164
|
+
var f = void 0;
|
|
4165
|
+
f = message.getDataList();
|
|
4166
|
+
if (f.length > 0) {
|
|
4167
|
+
writer.writeRepeatedMessage(
|
|
4168
|
+
1,
|
|
4169
|
+
f,
|
|
4170
|
+
proto.aggregator.ContractReadNode.MethodResult.StructuredField.serializeBinaryToWriter
|
|
4171
|
+
);
|
|
4172
|
+
}
|
|
4173
|
+
f = message.getMethodName();
|
|
4174
|
+
if (f.length > 0) {
|
|
4175
|
+
writer.writeString(
|
|
4176
|
+
2,
|
|
4177
|
+
f
|
|
4178
|
+
);
|
|
4179
|
+
}
|
|
4180
|
+
f = message.getSuccess();
|
|
4181
|
+
if (f) {
|
|
4182
|
+
writer.writeBool(
|
|
4183
|
+
3,
|
|
4184
|
+
f
|
|
4185
|
+
);
|
|
4186
|
+
}
|
|
4187
|
+
f = message.getError();
|
|
4188
|
+
if (f.length > 0) {
|
|
4189
|
+
writer.writeString(
|
|
4190
|
+
4,
|
|
4191
|
+
f
|
|
4192
|
+
);
|
|
4193
|
+
}
|
|
4194
|
+
};
|
|
4195
|
+
if (jspb.Message.GENERATE_TO_OBJECT) {
|
|
4196
|
+
proto.aggregator.ContractReadNode.MethodResult.StructuredField.prototype.toObject = function(opt_includeInstance) {
|
|
4197
|
+
return proto.aggregator.ContractReadNode.MethodResult.StructuredField.toObject(opt_includeInstance, this);
|
|
4198
|
+
};
|
|
4199
|
+
proto.aggregator.ContractReadNode.MethodResult.StructuredField.toObject = function(includeInstance, msg) {
|
|
4200
|
+
var f, obj = {
|
|
4201
|
+
name: jspb.Message.getFieldWithDefault(msg, 1, ""),
|
|
4202
|
+
type: jspb.Message.getFieldWithDefault(msg, 2, ""),
|
|
4203
|
+
value: jspb.Message.getFieldWithDefault(msg, 3, "")
|
|
4204
|
+
};
|
|
4205
|
+
if (includeInstance) {
|
|
4206
|
+
obj.$jspbMessageInstance = msg;
|
|
4207
|
+
}
|
|
4208
|
+
return obj;
|
|
4209
|
+
};
|
|
4210
|
+
}
|
|
4211
|
+
proto.aggregator.ContractReadNode.MethodResult.StructuredField.deserializeBinary = function(bytes) {
|
|
4212
|
+
var reader = new jspb.BinaryReader(bytes);
|
|
4213
|
+
var msg = new proto.aggregator.ContractReadNode.MethodResult.StructuredField();
|
|
4214
|
+
return proto.aggregator.ContractReadNode.MethodResult.StructuredField.deserializeBinaryFromReader(msg, reader);
|
|
4215
|
+
};
|
|
4216
|
+
proto.aggregator.ContractReadNode.MethodResult.StructuredField.deserializeBinaryFromReader = function(msg, reader) {
|
|
4217
|
+
while (reader.nextField()) {
|
|
4218
|
+
if (reader.isEndGroup()) {
|
|
4219
|
+
break;
|
|
4220
|
+
}
|
|
4221
|
+
var field = reader.getFieldNumber();
|
|
4222
|
+
switch (field) {
|
|
4223
|
+
case 1:
|
|
4224
|
+
var value = (
|
|
4225
|
+
/** @type {string} */
|
|
4226
|
+
reader.readString()
|
|
4227
|
+
);
|
|
4228
|
+
msg.setName(value);
|
|
4229
|
+
break;
|
|
4230
|
+
case 2:
|
|
4231
|
+
var value = (
|
|
4232
|
+
/** @type {string} */
|
|
4233
|
+
reader.readString()
|
|
4234
|
+
);
|
|
4235
|
+
msg.setType(value);
|
|
4236
|
+
break;
|
|
4237
|
+
case 3:
|
|
4238
|
+
var value = (
|
|
4239
|
+
/** @type {string} */
|
|
4240
|
+
reader.readString()
|
|
4241
|
+
);
|
|
4242
|
+
msg.setValue(value);
|
|
4243
|
+
break;
|
|
4244
|
+
default:
|
|
4245
|
+
reader.skipField();
|
|
4246
|
+
break;
|
|
4247
|
+
}
|
|
4248
|
+
}
|
|
4249
|
+
return msg;
|
|
4250
|
+
};
|
|
4251
|
+
proto.aggregator.ContractReadNode.MethodResult.StructuredField.prototype.serializeBinary = function() {
|
|
4252
|
+
var writer = new jspb.BinaryWriter();
|
|
4253
|
+
proto.aggregator.ContractReadNode.MethodResult.StructuredField.serializeBinaryToWriter(this, writer);
|
|
4254
|
+
return writer.getResultBuffer();
|
|
4255
|
+
};
|
|
4256
|
+
proto.aggregator.ContractReadNode.MethodResult.StructuredField.serializeBinaryToWriter = function(message, writer) {
|
|
4257
|
+
var f = void 0;
|
|
4258
|
+
f = message.getName();
|
|
4259
|
+
if (f.length > 0) {
|
|
4260
|
+
writer.writeString(
|
|
4261
|
+
1,
|
|
4262
|
+
f
|
|
4263
|
+
);
|
|
4264
|
+
}
|
|
4265
|
+
f = message.getType();
|
|
4266
|
+
if (f.length > 0) {
|
|
4267
|
+
writer.writeString(
|
|
4268
|
+
2,
|
|
4269
|
+
f
|
|
4270
|
+
);
|
|
4271
|
+
}
|
|
4272
|
+
f = message.getValue();
|
|
4273
|
+
if (f.length > 0) {
|
|
4274
|
+
writer.writeString(
|
|
4275
|
+
3,
|
|
4276
|
+
f
|
|
4277
|
+
);
|
|
4278
|
+
}
|
|
4279
|
+
};
|
|
4280
|
+
proto.aggregator.ContractReadNode.MethodResult.StructuredField.prototype.getName = function() {
|
|
4281
|
+
return (
|
|
4282
|
+
/** @type {string} */
|
|
4283
|
+
jspb.Message.getFieldWithDefault(this, 1, "")
|
|
4284
|
+
);
|
|
4285
|
+
};
|
|
4286
|
+
proto.aggregator.ContractReadNode.MethodResult.StructuredField.prototype.setName = function(value) {
|
|
4287
|
+
return jspb.Message.setProto3StringField(this, 1, value);
|
|
4288
|
+
};
|
|
4289
|
+
proto.aggregator.ContractReadNode.MethodResult.StructuredField.prototype.getType = function() {
|
|
4290
|
+
return (
|
|
4291
|
+
/** @type {string} */
|
|
4292
|
+
jspb.Message.getFieldWithDefault(this, 2, "")
|
|
4293
|
+
);
|
|
4294
|
+
};
|
|
4295
|
+
proto.aggregator.ContractReadNode.MethodResult.StructuredField.prototype.setType = function(value) {
|
|
4296
|
+
return jspb.Message.setProto3StringField(this, 2, value);
|
|
4297
|
+
};
|
|
4298
|
+
proto.aggregator.ContractReadNode.MethodResult.StructuredField.prototype.getValue = function() {
|
|
3961
4299
|
return (
|
|
3962
4300
|
/** @type {string} */
|
|
3963
4301
|
jspb.Message.getFieldWithDefault(this, 3, "")
|
|
3964
4302
|
);
|
|
3965
4303
|
};
|
|
3966
|
-
proto.aggregator.ContractReadNode.
|
|
4304
|
+
proto.aggregator.ContractReadNode.MethodResult.StructuredField.prototype.setValue = function(value) {
|
|
3967
4305
|
return jspb.Message.setProto3StringField(this, 3, value);
|
|
3968
4306
|
};
|
|
4307
|
+
proto.aggregator.ContractReadNode.MethodResult.prototype.getDataList = function() {
|
|
4308
|
+
return (
|
|
4309
|
+
/** @type{!Array<!proto.aggregator.ContractReadNode.MethodResult.StructuredField>} */
|
|
4310
|
+
jspb.Message.getRepeatedWrapperField(this, proto.aggregator.ContractReadNode.MethodResult.StructuredField, 1)
|
|
4311
|
+
);
|
|
4312
|
+
};
|
|
4313
|
+
proto.aggregator.ContractReadNode.MethodResult.prototype.setDataList = function(value) {
|
|
4314
|
+
return jspb.Message.setRepeatedWrapperField(this, 1, value);
|
|
4315
|
+
};
|
|
4316
|
+
proto.aggregator.ContractReadNode.MethodResult.prototype.addData = function(opt_value, opt_index) {
|
|
4317
|
+
return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.aggregator.ContractReadNode.MethodResult.StructuredField, opt_index);
|
|
4318
|
+
};
|
|
4319
|
+
proto.aggregator.ContractReadNode.MethodResult.prototype.clearDataList = function() {
|
|
4320
|
+
return this.setDataList([]);
|
|
4321
|
+
};
|
|
4322
|
+
proto.aggregator.ContractReadNode.MethodResult.prototype.getMethodName = function() {
|
|
4323
|
+
return (
|
|
4324
|
+
/** @type {string} */
|
|
4325
|
+
jspb.Message.getFieldWithDefault(this, 2, "")
|
|
4326
|
+
);
|
|
4327
|
+
};
|
|
4328
|
+
proto.aggregator.ContractReadNode.MethodResult.prototype.setMethodName = function(value) {
|
|
4329
|
+
return jspb.Message.setProto3StringField(this, 2, value);
|
|
4330
|
+
};
|
|
4331
|
+
proto.aggregator.ContractReadNode.MethodResult.prototype.getSuccess = function() {
|
|
4332
|
+
return (
|
|
4333
|
+
/** @type {boolean} */
|
|
4334
|
+
jspb.Message.getBooleanFieldWithDefault(this, 3, false)
|
|
4335
|
+
);
|
|
4336
|
+
};
|
|
4337
|
+
proto.aggregator.ContractReadNode.MethodResult.prototype.setSuccess = function(value) {
|
|
4338
|
+
return jspb.Message.setProto3BooleanField(this, 3, value);
|
|
4339
|
+
};
|
|
4340
|
+
proto.aggregator.ContractReadNode.MethodResult.prototype.getError = function() {
|
|
4341
|
+
return (
|
|
4342
|
+
/** @type {string} */
|
|
4343
|
+
jspb.Message.getFieldWithDefault(this, 4, "")
|
|
4344
|
+
);
|
|
4345
|
+
};
|
|
4346
|
+
proto.aggregator.ContractReadNode.MethodResult.prototype.setError = function(value) {
|
|
4347
|
+
return jspb.Message.setProto3StringField(this, 4, value);
|
|
4348
|
+
};
|
|
3969
4349
|
proto.aggregator.ContractReadNode.Output.repeatedFields_ = [1];
|
|
3970
4350
|
if (jspb.Message.GENERATE_TO_OBJECT) {
|
|
3971
4351
|
proto.aggregator.ContractReadNode.Output.prototype.toObject = function(opt_includeInstance) {
|
|
@@ -3973,9 +4353,9 @@ var require_avs_pb = __commonJS({
|
|
|
3973
4353
|
};
|
|
3974
4354
|
proto.aggregator.ContractReadNode.Output.toObject = function(includeInstance, msg) {
|
|
3975
4355
|
var f, obj = {
|
|
3976
|
-
|
|
3977
|
-
msg.
|
|
3978
|
-
|
|
4356
|
+
resultsList: jspb.Message.toObjectList(
|
|
4357
|
+
msg.getResultsList(),
|
|
4358
|
+
proto.aggregator.ContractReadNode.MethodResult.toObject,
|
|
3979
4359
|
includeInstance
|
|
3980
4360
|
)
|
|
3981
4361
|
};
|
|
@@ -3998,9 +4378,9 @@ var require_avs_pb = __commonJS({
|
|
|
3998
4378
|
var field = reader.getFieldNumber();
|
|
3999
4379
|
switch (field) {
|
|
4000
4380
|
case 1:
|
|
4001
|
-
var value = new
|
|
4002
|
-
reader.readMessage(value,
|
|
4003
|
-
msg.
|
|
4381
|
+
var value = new proto.aggregator.ContractReadNode.MethodResult();
|
|
4382
|
+
reader.readMessage(value, proto.aggregator.ContractReadNode.MethodResult.deserializeBinaryFromReader);
|
|
4383
|
+
msg.addResults(value);
|
|
4004
4384
|
break;
|
|
4005
4385
|
default:
|
|
4006
4386
|
reader.skipField();
|
|
@@ -4016,29 +4396,29 @@ var require_avs_pb = __commonJS({
|
|
|
4016
4396
|
};
|
|
4017
4397
|
proto.aggregator.ContractReadNode.Output.serializeBinaryToWriter = function(message, writer) {
|
|
4018
4398
|
var f = void 0;
|
|
4019
|
-
f = message.
|
|
4399
|
+
f = message.getResultsList();
|
|
4020
4400
|
if (f.length > 0) {
|
|
4021
4401
|
writer.writeRepeatedMessage(
|
|
4022
4402
|
1,
|
|
4023
4403
|
f,
|
|
4024
|
-
|
|
4404
|
+
proto.aggregator.ContractReadNode.MethodResult.serializeBinaryToWriter
|
|
4025
4405
|
);
|
|
4026
4406
|
}
|
|
4027
4407
|
};
|
|
4028
|
-
proto.aggregator.ContractReadNode.Output.prototype.
|
|
4408
|
+
proto.aggregator.ContractReadNode.Output.prototype.getResultsList = function() {
|
|
4029
4409
|
return (
|
|
4030
|
-
/** @type{!Array<!proto.
|
|
4031
|
-
jspb.Message.getRepeatedWrapperField(this,
|
|
4410
|
+
/** @type{!Array<!proto.aggregator.ContractReadNode.MethodResult>} */
|
|
4411
|
+
jspb.Message.getRepeatedWrapperField(this, proto.aggregator.ContractReadNode.MethodResult, 1)
|
|
4032
4412
|
);
|
|
4033
4413
|
};
|
|
4034
|
-
proto.aggregator.ContractReadNode.Output.prototype.
|
|
4414
|
+
proto.aggregator.ContractReadNode.Output.prototype.setResultsList = function(value) {
|
|
4035
4415
|
return jspb.Message.setRepeatedWrapperField(this, 1, value);
|
|
4036
4416
|
};
|
|
4037
|
-
proto.aggregator.ContractReadNode.Output.prototype.
|
|
4038
|
-
return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.
|
|
4417
|
+
proto.aggregator.ContractReadNode.Output.prototype.addResults = function(opt_value, opt_index) {
|
|
4418
|
+
return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.aggregator.ContractReadNode.MethodResult, opt_index);
|
|
4039
4419
|
};
|
|
4040
|
-
proto.aggregator.ContractReadNode.Output.prototype.
|
|
4041
|
-
return this.
|
|
4420
|
+
proto.aggregator.ContractReadNode.Output.prototype.clearResultsList = function() {
|
|
4421
|
+
return this.setResultsList([]);
|
|
4042
4422
|
};
|
|
4043
4423
|
proto.aggregator.ContractReadNode.prototype.getConfig = function() {
|
|
4044
4424
|
return (
|
|
@@ -14514,6 +14894,7 @@ __export(index_exports, {
|
|
|
14514
14894
|
RestAPINode: () => restApi_default,
|
|
14515
14895
|
Secret: () => secret_default,
|
|
14516
14896
|
Step: () => step_default,
|
|
14897
|
+
TimeoutPresets: () => import_types21.TimeoutPresets,
|
|
14517
14898
|
Trigger: () => interface_default,
|
|
14518
14899
|
TriggerFactory: () => factory_default,
|
|
14519
14900
|
Workflow: () => workflow_default
|
|
@@ -15375,18 +15756,35 @@ var ContractReadNode2 = class _ContractReadNode extends interface_default2 {
|
|
|
15375
15756
|
const nodeData = new avs_pb13.ContractReadNode();
|
|
15376
15757
|
const config = new avs_pb13.ContractReadNode.Config();
|
|
15377
15758
|
config.setContractAddress(this.data.contractAddress);
|
|
15378
|
-
config.setCallData(this.data.callData);
|
|
15379
15759
|
config.setContractAbi(this.data.contractAbi);
|
|
15760
|
+
const methodCalls = this.data.methodCallsList || [];
|
|
15761
|
+
methodCalls.forEach((methodCall) => {
|
|
15762
|
+
const methodCallMsg = new avs_pb13.ContractReadNode.MethodCall();
|
|
15763
|
+
methodCallMsg.setCallData(methodCall.callData);
|
|
15764
|
+
if (methodCall.methodName) {
|
|
15765
|
+
methodCallMsg.setMethodName(methodCall.methodName);
|
|
15766
|
+
}
|
|
15767
|
+
config.addMethodCalls(methodCallMsg);
|
|
15768
|
+
});
|
|
15380
15769
|
nodeData.setConfig(config);
|
|
15381
15770
|
request.setContractRead(nodeData);
|
|
15382
15771
|
return request;
|
|
15383
15772
|
}
|
|
15384
15773
|
static fromOutputData(outputData) {
|
|
15385
15774
|
const contractReadOutput = outputData.getContractRead();
|
|
15386
|
-
if (contractReadOutput && contractReadOutput.
|
|
15387
|
-
const
|
|
15775
|
+
if (contractReadOutput && contractReadOutput.getResultsList()) {
|
|
15776
|
+
const resultsList = contractReadOutput.getResultsList();
|
|
15388
15777
|
return {
|
|
15389
|
-
|
|
15778
|
+
results: resultsList.map((result) => ({
|
|
15779
|
+
methodName: result.getMethodName(),
|
|
15780
|
+
success: result.getSuccess(),
|
|
15781
|
+
error: result.getError(),
|
|
15782
|
+
data: result.getDataList().map((field) => ({
|
|
15783
|
+
name: field.getName(),
|
|
15784
|
+
type: field.getType(),
|
|
15785
|
+
value: field.getValue()
|
|
15786
|
+
}))
|
|
15787
|
+
}))
|
|
15390
15788
|
};
|
|
15391
15789
|
}
|
|
15392
15790
|
return null;
|
|
@@ -15573,8 +15971,16 @@ var LoopNode2 = class _LoopNode extends interface_default2 {
|
|
|
15573
15971
|
if (data.contractRead.config) {
|
|
15574
15972
|
const config2 = new avs_pb17.ContractReadNode.Config();
|
|
15575
15973
|
config2.setContractAddress(data.contractRead.config.contractAddress);
|
|
15576
|
-
config2.setCallData(data.contractRead.config.callData);
|
|
15577
15974
|
config2.setContractAbi(data.contractRead.config.contractAbi);
|
|
15975
|
+
const methodCalls = data.contractRead.config.methodCallsList || [];
|
|
15976
|
+
methodCalls.forEach((methodCall) => {
|
|
15977
|
+
const methodCallMsg = new avs_pb17.ContractReadNode.MethodCall();
|
|
15978
|
+
methodCallMsg.setCallData(methodCall.callData);
|
|
15979
|
+
if (methodCall.methodName) {
|
|
15980
|
+
methodCallMsg.setMethodName(methodCall.methodName);
|
|
15981
|
+
}
|
|
15982
|
+
config2.addMethodCalls(methodCallMsg);
|
|
15983
|
+
});
|
|
15578
15984
|
contractRead.setConfig(config2);
|
|
15579
15985
|
}
|
|
15580
15986
|
loopNode.setContractRead(contractRead);
|
|
@@ -15734,7 +16140,7 @@ var factory_default2 = NodeFactory;
|
|
|
15734
16140
|
|
|
15735
16141
|
// src/models/workflow.ts
|
|
15736
16142
|
var import_types19 = require("@avaprotocol/types");
|
|
15737
|
-
function convertStatusToString(
|
|
16143
|
+
function convertStatusToString(status2) {
|
|
15738
16144
|
const conversionMap = {
|
|
15739
16145
|
[avs_pb19.TaskStatus.ACTIVE]: import_types19.WorkflowStatus.Active,
|
|
15740
16146
|
[avs_pb19.TaskStatus.COMPLETED]: import_types19.WorkflowStatus.Completed,
|
|
@@ -15742,7 +16148,7 @@ function convertStatusToString(status) {
|
|
|
15742
16148
|
[avs_pb19.TaskStatus.CANCELED]: import_types19.WorkflowStatus.Canceled,
|
|
15743
16149
|
[avs_pb19.TaskStatus.EXECUTING]: import_types19.WorkflowStatus.Executing
|
|
15744
16150
|
};
|
|
15745
|
-
return conversionMap[
|
|
16151
|
+
return conversionMap[status2];
|
|
15746
16152
|
}
|
|
15747
16153
|
var Workflow = class _Workflow {
|
|
15748
16154
|
/**
|
|
@@ -15946,9 +16352,37 @@ var Step = class _Step {
|
|
|
15946
16352
|
case avs_pb20.Execution.Step.OutputDataCase.CONTRACT_READ:
|
|
15947
16353
|
nodeOutputMessage = step.getContractRead();
|
|
15948
16354
|
if (nodeOutputMessage) {
|
|
15949
|
-
|
|
16355
|
+
const results = nodeOutputMessage.getResultsList();
|
|
16356
|
+
if (results && results.length > 0) {
|
|
16357
|
+
if (results.length === 1) {
|
|
16358
|
+
const result = results[0];
|
|
16359
|
+
const structuredData = {};
|
|
16360
|
+
result.getDataList().forEach((field) => {
|
|
16361
|
+
structuredData[field.getName()] = field.getValue();
|
|
16362
|
+
});
|
|
16363
|
+
return {
|
|
16364
|
+
methodName: result.getMethodName(),
|
|
16365
|
+
success: result.getSuccess(),
|
|
16366
|
+
error: result.getError(),
|
|
16367
|
+
data: structuredData
|
|
16368
|
+
};
|
|
16369
|
+
} else {
|
|
16370
|
+
return results.map((result) => {
|
|
16371
|
+
const structuredData = {};
|
|
16372
|
+
result.getDataList().forEach((field) => {
|
|
16373
|
+
structuredData[field.getName()] = field.getValue();
|
|
16374
|
+
});
|
|
16375
|
+
return {
|
|
16376
|
+
methodName: result.getMethodName(),
|
|
16377
|
+
success: result.getSuccess(),
|
|
16378
|
+
error: result.getError(),
|
|
16379
|
+
data: structuredData
|
|
16380
|
+
};
|
|
16381
|
+
});
|
|
16382
|
+
}
|
|
16383
|
+
}
|
|
15950
16384
|
}
|
|
15951
|
-
return
|
|
16385
|
+
return void 0;
|
|
15952
16386
|
case avs_pb20.Execution.Step.OutputDataCase.CONTRACT_WRITE:
|
|
15953
16387
|
return step.getContractWrite()?.toObject();
|
|
15954
16388
|
case avs_pb20.Execution.Step.OutputDataCase.CUSTOM_CODE:
|
|
@@ -16059,6 +16493,7 @@ var secret_default = Secret;
|
|
|
16059
16493
|
|
|
16060
16494
|
// src/index.ts
|
|
16061
16495
|
var import_types20 = require("@avaprotocol/types");
|
|
16496
|
+
var import_types21 = require("@avaprotocol/types");
|
|
16062
16497
|
var BaseClient = class {
|
|
16063
16498
|
constructor(opts) {
|
|
16064
16499
|
this.endpoint = opts.endpoint;
|
|
@@ -16067,8 +16502,67 @@ var BaseClient = class {
|
|
|
16067
16502
|
import_grpc_js.credentials.createInsecure()
|
|
16068
16503
|
);
|
|
16069
16504
|
this.factoryAddress = opts.factoryAddress;
|
|
16505
|
+
this.timeoutConfig = {
|
|
16506
|
+
timeout: 3e4,
|
|
16507
|
+
retries: 0,
|
|
16508
|
+
retryDelay: 0,
|
|
16509
|
+
...opts.timeout
|
|
16510
|
+
};
|
|
16070
16511
|
this.metadata = new import_grpc_js.Metadata();
|
|
16071
16512
|
}
|
|
16513
|
+
/**
|
|
16514
|
+
* Set default timeout configuration for all requests
|
|
16515
|
+
* @param config - The timeout configuration
|
|
16516
|
+
*/
|
|
16517
|
+
setTimeoutConfig(config) {
|
|
16518
|
+
this.timeoutConfig = { ...this.timeoutConfig, ...config };
|
|
16519
|
+
}
|
|
16520
|
+
/**
|
|
16521
|
+
* Get the current timeout configuration
|
|
16522
|
+
* @returns {TimeoutConfig} - The current timeout configuration
|
|
16523
|
+
*/
|
|
16524
|
+
getTimeoutConfig() {
|
|
16525
|
+
return { ...this.timeoutConfig };
|
|
16526
|
+
}
|
|
16527
|
+
/**
|
|
16528
|
+
* Send a fast gRPC request using FAST preset (5s timeout, 2 retries)
|
|
16529
|
+
* @param method - The method name to call
|
|
16530
|
+
* @param request - The request object
|
|
16531
|
+
* @param options - Request options
|
|
16532
|
+
* @returns {Promise<TResponse>} - The response from the server
|
|
16533
|
+
*/
|
|
16534
|
+
sendFastRequest(method, request, options) {
|
|
16535
|
+
return this.sendGrpcRequest(method, request, {
|
|
16536
|
+
...options,
|
|
16537
|
+
timeout: import_types20.TimeoutPresets.FAST
|
|
16538
|
+
});
|
|
16539
|
+
}
|
|
16540
|
+
/**
|
|
16541
|
+
* Send a slow gRPC request using SLOW preset (2min timeout, 2 retries)
|
|
16542
|
+
* @param method - The method name to call
|
|
16543
|
+
* @param request - The request object
|
|
16544
|
+
* @param options - Request options
|
|
16545
|
+
* @returns {Promise<TResponse>} - The response from the server
|
|
16546
|
+
*/
|
|
16547
|
+
sendSlowRequest(method, request, options) {
|
|
16548
|
+
return this.sendGrpcRequest(method, request, {
|
|
16549
|
+
...options,
|
|
16550
|
+
timeout: import_types20.TimeoutPresets.SLOW
|
|
16551
|
+
});
|
|
16552
|
+
}
|
|
16553
|
+
/**
|
|
16554
|
+
* Send a no-retry gRPC request using NO_RETRY preset (30s timeout, no retries)
|
|
16555
|
+
* @param method - The method name to call
|
|
16556
|
+
* @param request - The request object
|
|
16557
|
+
* @param options - Request options
|
|
16558
|
+
* @returns {Promise<TResponse>} - The response from the server
|
|
16559
|
+
*/
|
|
16560
|
+
sendNoRetryRequest(method, request, options) {
|
|
16561
|
+
return this.sendGrpcRequest(method, request, {
|
|
16562
|
+
...options,
|
|
16563
|
+
timeout: import_types20.TimeoutPresets.NO_RETRY
|
|
16564
|
+
});
|
|
16565
|
+
}
|
|
16072
16566
|
/**
|
|
16073
16567
|
* Check if the auth key is valid by decoding the JWT token and checking the expiration
|
|
16074
16568
|
* @param key - The auth key
|
|
@@ -16161,30 +16655,126 @@ var BaseClient = class {
|
|
|
16161
16655
|
return this.factoryAddress;
|
|
16162
16656
|
}
|
|
16163
16657
|
/**
|
|
16164
|
-
* Send a gRPC request with authentication and error handling
|
|
16658
|
+
* Send a gRPC request with authentication, timeout support, and error handling
|
|
16165
16659
|
* @param method - The method name to call
|
|
16166
16660
|
* @param request - The request object
|
|
16167
|
-
* @param options - Request options
|
|
16661
|
+
* @param options - Request options including timeout configuration
|
|
16168
16662
|
* @returns {Promise<TResponse>} - The response from the server
|
|
16169
16663
|
*/
|
|
16170
16664
|
sendGrpcRequest(method, request, options) {
|
|
16171
16665
|
return new Promise((resolve, reject) => {
|
|
16172
|
-
const
|
|
16173
|
-
|
|
16174
|
-
|
|
16175
|
-
|
|
16176
|
-
|
|
16177
|
-
|
|
16178
|
-
|
|
16179
|
-
|
|
16180
|
-
|
|
16181
|
-
if (
|
|
16182
|
-
|
|
16183
|
-
} else {
|
|
16184
|
-
resolve(response);
|
|
16666
|
+
const debugMode = process.env.GRPC_DEBUG === "true";
|
|
16667
|
+
if (debugMode) {
|
|
16668
|
+
console.log(`\u{1F50D} [GRPC-DEBUG] Starting ${method} request:`, {
|
|
16669
|
+
method,
|
|
16670
|
+
hasAuthKey: !!(options?.authKey || this.authKey),
|
|
16671
|
+
endpoint: this.endpoint
|
|
16672
|
+
});
|
|
16673
|
+
try {
|
|
16674
|
+
const serializedRequest = request.serializeBinary?.();
|
|
16675
|
+
if (serializedRequest) {
|
|
16676
|
+
console.log(`\u{1F50D} [GRPC-DEBUG] Request serialized, size: ${serializedRequest.length} bytes`);
|
|
16185
16677
|
}
|
|
16678
|
+
} catch (error) {
|
|
16679
|
+
console.error(`\u274C [GRPC-DEBUG] Failed to serialize request for logging:`, error);
|
|
16186
16680
|
}
|
|
16187
|
-
|
|
16681
|
+
}
|
|
16682
|
+
const timeoutConfig = {
|
|
16683
|
+
...this.timeoutConfig,
|
|
16684
|
+
...options?.timeout
|
|
16685
|
+
};
|
|
16686
|
+
const {
|
|
16687
|
+
timeout = timeoutConfig.timeout || 3e4,
|
|
16688
|
+
retries = timeoutConfig.retries || 3,
|
|
16689
|
+
retryDelay = timeoutConfig.retryDelay || 1e3
|
|
16690
|
+
} = timeoutConfig;
|
|
16691
|
+
if (debugMode) {
|
|
16692
|
+
console.log(`\u{1F50D} [GRPC-DEBUG] Timeout configuration:`, {
|
|
16693
|
+
timeout,
|
|
16694
|
+
retries,
|
|
16695
|
+
retryDelay
|
|
16696
|
+
});
|
|
16697
|
+
}
|
|
16698
|
+
let attempt = 0;
|
|
16699
|
+
const executeRequest = () => {
|
|
16700
|
+
attempt++;
|
|
16701
|
+
let timeoutId;
|
|
16702
|
+
const timeoutPromise = new Promise((_4, timeoutReject) => {
|
|
16703
|
+
timeoutId = setTimeout(() => {
|
|
16704
|
+
const error = new Error(`gRPC request timeout after ${timeout}ms for method ${method}`);
|
|
16705
|
+
error.isTimeout = true;
|
|
16706
|
+
error.attemptsMade = attempt;
|
|
16707
|
+
error.methodName = method;
|
|
16708
|
+
timeoutReject(error);
|
|
16709
|
+
}, timeout);
|
|
16710
|
+
});
|
|
16711
|
+
const grpcPromise = new Promise((grpcResolve, grpcReject) => {
|
|
16712
|
+
const metadata = new import_grpc_js.Metadata();
|
|
16713
|
+
const authKey = options?.authKey || this.authKey;
|
|
16714
|
+
if (authKey) {
|
|
16715
|
+
metadata.set(import_types20.AUTH_KEY_HEADER, authKey);
|
|
16716
|
+
}
|
|
16717
|
+
if (debugMode) {
|
|
16718
|
+
console.log(`\u{1F50D} [GRPC-DEBUG] Making gRPC call for ${method}, attempt ${attempt}`);
|
|
16719
|
+
}
|
|
16720
|
+
const call = this.rpcClient[method](
|
|
16721
|
+
request,
|
|
16722
|
+
metadata,
|
|
16723
|
+
(error, response) => {
|
|
16724
|
+
if (error) {
|
|
16725
|
+
if (debugMode) {
|
|
16726
|
+
console.error(`\u274C [GRPC-DEBUG] gRPC call failed for ${method}:`, {
|
|
16727
|
+
code: error.code,
|
|
16728
|
+
message: error.message,
|
|
16729
|
+
details: error.details,
|
|
16730
|
+
metadata: error.metadata?.getMap ? error.metadata.getMap() : error.metadata
|
|
16731
|
+
});
|
|
16732
|
+
}
|
|
16733
|
+
grpcReject(error);
|
|
16734
|
+
} else {
|
|
16735
|
+
if (debugMode) {
|
|
16736
|
+
try {
|
|
16737
|
+
const responseObj = response?.toObject ? response.toObject() : response;
|
|
16738
|
+
console.log(`\u2705 [GRPC-DEBUG] gRPC call succeeded for ${method}:`, {
|
|
16739
|
+
responseType: typeof response,
|
|
16740
|
+
hasToObject: !!response?.toObject,
|
|
16741
|
+
sampleResponse: JSON.stringify(responseObj).substring(0, 500) + (JSON.stringify(responseObj).length > 500 ? "..." : "")
|
|
16742
|
+
});
|
|
16743
|
+
} catch (parseError) {
|
|
16744
|
+
console.log(`\u2705 [GRPC-DEBUG] gRPC call succeeded for ${method}, but failed to parse response for logging:`, parseError);
|
|
16745
|
+
}
|
|
16746
|
+
}
|
|
16747
|
+
grpcResolve(response);
|
|
16748
|
+
}
|
|
16749
|
+
}
|
|
16750
|
+
);
|
|
16751
|
+
timeoutPromise.catch(() => {
|
|
16752
|
+
if (call && call.cancel) {
|
|
16753
|
+
call.cancel();
|
|
16754
|
+
}
|
|
16755
|
+
});
|
|
16756
|
+
});
|
|
16757
|
+
Promise.race([grpcPromise, timeoutPromise]).then((result) => {
|
|
16758
|
+
clearTimeout(timeoutId);
|
|
16759
|
+
resolve(result);
|
|
16760
|
+
}).catch((error) => {
|
|
16761
|
+
clearTimeout(timeoutId);
|
|
16762
|
+
const isTimeoutError = error.isTimeout || error.message?.includes("timeout");
|
|
16763
|
+
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;
|
|
16764
|
+
if (isRetryableError && attempt < retries) {
|
|
16765
|
+
console.warn(`gRPC ${method} attempt ${attempt} failed, retrying in ${retryDelay}ms:`, error.message);
|
|
16766
|
+
setTimeout(executeRequest, retryDelay);
|
|
16767
|
+
} else {
|
|
16768
|
+
if (isTimeoutError && !error.isTimeout) {
|
|
16769
|
+
error.isTimeout = true;
|
|
16770
|
+
error.attemptsMade = attempt;
|
|
16771
|
+
error.methodName = method;
|
|
16772
|
+
}
|
|
16773
|
+
reject(error);
|
|
16774
|
+
}
|
|
16775
|
+
});
|
|
16776
|
+
};
|
|
16777
|
+
executeRequest();
|
|
16188
16778
|
});
|
|
16189
16779
|
}
|
|
16190
16780
|
};
|
|
@@ -16691,6 +17281,14 @@ var Client = class extends BaseClient {
|
|
|
16691
17281
|
* @returns {Promise<RunNodeWithInputsResponse>} - The response from running the node
|
|
16692
17282
|
*/
|
|
16693
17283
|
async runNodeWithInputs({ nodeType, nodeConfig, inputVariables = {} }, options) {
|
|
17284
|
+
const debugMode = process.env.GRPC_DEBUG === "true";
|
|
17285
|
+
if (debugMode) {
|
|
17286
|
+
console.log("\u{1F50D} [GRPC-DEBUG] runNodeWithInputs called with:", {
|
|
17287
|
+
nodeType,
|
|
17288
|
+
nodeConfig: JSON.stringify(nodeConfig, null, 2),
|
|
17289
|
+
inputVariables: JSON.stringify(inputVariables, null, 2)
|
|
17290
|
+
});
|
|
17291
|
+
}
|
|
16694
17292
|
const triggerTypes = [
|
|
16695
17293
|
import_types20.TriggerType.Block,
|
|
16696
17294
|
import_types20.TriggerType.FixedTime,
|
|
@@ -16708,23 +17306,94 @@ var Client = class extends BaseClient {
|
|
|
16708
17306
|
const request = new avs_pb22.RunNodeWithInputsReq();
|
|
16709
17307
|
const protobufNodeType = import_types20.NodeTypeGoConverter.fromGoString(nodeType);
|
|
16710
17308
|
request.setNodeType(protobufNodeType);
|
|
17309
|
+
if (debugMode) {
|
|
17310
|
+
console.log("\u{1F50D} [GRPC-DEBUG] Converted nodeType:", {
|
|
17311
|
+
original: nodeType,
|
|
17312
|
+
protobuf: protobufNodeType
|
|
17313
|
+
});
|
|
17314
|
+
}
|
|
16711
17315
|
const nodeConfigMap = request.getNodeConfigMap();
|
|
16712
17316
|
for (const [key, value] of Object.entries(nodeConfig)) {
|
|
16713
|
-
|
|
17317
|
+
try {
|
|
17318
|
+
const protobufValue = convertJSValueToProtobuf(value);
|
|
17319
|
+
nodeConfigMap.set(key, protobufValue);
|
|
17320
|
+
if (debugMode) {
|
|
17321
|
+
console.log(`\u{1F50D} [GRPC-DEBUG] Converted nodeConfig[${key}]:`, {
|
|
17322
|
+
original: value,
|
|
17323
|
+
protobuf: protobufValue?.toObject ? protobufValue.toObject() : protobufValue
|
|
17324
|
+
});
|
|
17325
|
+
}
|
|
17326
|
+
} catch (error) {
|
|
17327
|
+
console.error(`\u274C [GRPC-DEBUG] Failed to convert nodeConfig[${key}]:`, error);
|
|
17328
|
+
throw error;
|
|
17329
|
+
}
|
|
16714
17330
|
}
|
|
16715
17331
|
if (inputVariables && Object.keys(inputVariables).length > 0) {
|
|
16716
17332
|
const inputVarsMap = request.getInputVariablesMap();
|
|
16717
17333
|
for (const [key, value] of Object.entries(inputVariables)) {
|
|
16718
|
-
|
|
17334
|
+
try {
|
|
17335
|
+
const protobufValue = convertJSValueToProtobuf(value);
|
|
17336
|
+
inputVarsMap.set(key, protobufValue);
|
|
17337
|
+
if (debugMode) {
|
|
17338
|
+
console.log(`\u{1F50D} [GRPC-DEBUG] Converted inputVariable[${key}]:`, {
|
|
17339
|
+
original: value,
|
|
17340
|
+
protobuf: protobufValue?.toObject ? protobufValue.toObject() : protobufValue
|
|
17341
|
+
});
|
|
17342
|
+
}
|
|
17343
|
+
} catch (error) {
|
|
17344
|
+
console.error(`\u274C [GRPC-DEBUG] Failed to convert inputVariable[${key}]:`, error);
|
|
17345
|
+
throw error;
|
|
17346
|
+
}
|
|
16719
17347
|
}
|
|
16720
17348
|
}
|
|
16721
|
-
|
|
16722
|
-
|
|
16723
|
-
|
|
16724
|
-
|
|
16725
|
-
|
|
16726
|
-
|
|
16727
|
-
|
|
17349
|
+
if (debugMode) {
|
|
17350
|
+
try {
|
|
17351
|
+
const serializedRequest = request.serializeBinary();
|
|
17352
|
+
console.log("\u{1F50D} [GRPC-DEBUG] Request serialized successfully, size:", serializedRequest.length, "bytes");
|
|
17353
|
+
} catch (error) {
|
|
17354
|
+
console.error("\u274C [GRPC-DEBUG] Failed to serialize request:", error);
|
|
17355
|
+
throw error;
|
|
17356
|
+
}
|
|
17357
|
+
}
|
|
17358
|
+
try {
|
|
17359
|
+
const result = await this.sendGrpcRequest("runNodeWithInputs", request, options);
|
|
17360
|
+
if (debugMode) {
|
|
17361
|
+
console.log("\u{1F50D} [GRPC-DEBUG] Response received successfully:", {
|
|
17362
|
+
success: result.getSuccess(),
|
|
17363
|
+
error: result.getError(),
|
|
17364
|
+
nodeId: result.getNodeId(),
|
|
17365
|
+
outputDataCase: result.getOutputDataCase()
|
|
17366
|
+
});
|
|
17367
|
+
}
|
|
17368
|
+
let responseData;
|
|
17369
|
+
try {
|
|
17370
|
+
responseData = factory_default2.fromOutputData(result);
|
|
17371
|
+
if (debugMode) {
|
|
17372
|
+
console.log("\u{1F50D} [GRPC-DEBUG] Output data parsed successfully:", responseData);
|
|
17373
|
+
}
|
|
17374
|
+
} catch (error) {
|
|
17375
|
+
console.error("\u274C [GRPC-DEBUG] Failed to parse output data:", error);
|
|
17376
|
+
if (debugMode) {
|
|
17377
|
+
console.log("\u{1F50D} [GRPC-DEBUG] Raw response object:", result.toObject());
|
|
17378
|
+
}
|
|
17379
|
+
throw error;
|
|
17380
|
+
}
|
|
17381
|
+
return {
|
|
17382
|
+
success: result.getSuccess(),
|
|
17383
|
+
data: responseData,
|
|
17384
|
+
error: result.getError(),
|
|
17385
|
+
nodeId: result.getNodeId()
|
|
17386
|
+
};
|
|
17387
|
+
} catch (error) {
|
|
17388
|
+
console.error("\u274C [GRPC-DEBUG] runNodeWithInputs failed:", {
|
|
17389
|
+
error: error instanceof Error ? error.message : String(error),
|
|
17390
|
+
stack: error instanceof Error ? error.stack : void 0,
|
|
17391
|
+
nodeType,
|
|
17392
|
+
nodeConfig,
|
|
17393
|
+
inputVariables
|
|
17394
|
+
});
|
|
17395
|
+
throw error;
|
|
17396
|
+
}
|
|
16728
17397
|
}
|
|
16729
17398
|
/**
|
|
16730
17399
|
* Run a trigger for testing purposes
|
|
@@ -16830,6 +17499,7 @@ var Client = class extends BaseClient {
|
|
|
16830
17499
|
RestAPINode,
|
|
16831
17500
|
Secret,
|
|
16832
17501
|
Step,
|
|
17502
|
+
TimeoutPresets,
|
|
16833
17503
|
Trigger,
|
|
16834
17504
|
TriggerFactory,
|
|
16835
17505
|
Workflow
|