@avaprotocol/sdk-js 2.4.3 → 2.5.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.
Files changed (38) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +791 -255
  4. package/dist/index.mjs +799 -258
  5. package/dist/models/node/contractRead.d.ts +14 -0
  6. package/dist/models/node/contractRead.d.ts.map +1 -1
  7. package/dist/models/node/contractRead.js +27 -18
  8. package/dist/models/node/contractWrite.d.ts +14 -0
  9. package/dist/models/node/contractWrite.d.ts.map +1 -1
  10. package/dist/models/node/contractWrite.js +25 -16
  11. package/dist/models/node/customCode.d.ts +10 -1
  12. package/dist/models/node/customCode.d.ts.map +1 -1
  13. package/dist/models/node/customCode.js +19 -9
  14. package/dist/models/node/ethTransfer.d.ts +9 -0
  15. package/dist/models/node/ethTransfer.d.ts.map +1 -1
  16. package/dist/models/node/ethTransfer.js +14 -5
  17. package/dist/models/node/filter.d.ts.map +1 -1
  18. package/dist/models/node/filter.js +22 -3
  19. package/dist/models/node/graphqlQuery.d.ts +10 -0
  20. package/dist/models/node/graphqlQuery.d.ts.map +1 -1
  21. package/dist/models/node/graphqlQuery.js +20 -12
  22. package/dist/models/node/loop.d.ts +5 -1
  23. package/dist/models/node/loop.d.ts.map +1 -1
  24. package/dist/models/node/loop.js +151 -99
  25. package/dist/models/node/restApi.d.ts +11 -0
  26. package/dist/models/node/restApi.d.ts.map +1 -1
  27. package/dist/models/node/restApi.js +21 -13
  28. package/dist/models/step.d.ts.map +1 -1
  29. package/dist/models/step.js +239 -21
  30. package/dist/models/trigger/manual.d.ts +6 -10
  31. package/dist/models/trigger/manual.d.ts.map +1 -1
  32. package/dist/models/trigger/manual.js +108 -25
  33. package/dist/models/workflow.d.ts.map +1 -1
  34. package/dist/models/workflow.js +0 -2
  35. package/dist/utils.d.ts +0 -14
  36. package/dist/utils.d.ts.map +1 -1
  37. package/dist/utils.js +0 -62
  38. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -107,6 +107,7 @@ var require_avs_pb = __commonJS({
107
107
  goog.exportSymbol("proto.aggregator.Execution", null, global);
108
108
  goog.exportSymbol("proto.aggregator.Execution.Step", null, global);
109
109
  goog.exportSymbol("proto.aggregator.Execution.Step.OutputDataCase", null, global);
110
+ goog.exportSymbol("proto.aggregator.ExecutionMode", null, global);
110
111
  goog.exportSymbol("proto.aggregator.ExecutionReq", null, global);
111
112
  goog.exportSymbol("proto.aggregator.ExecutionStatus", null, global);
112
113
  goog.exportSymbol("proto.aggregator.ExecutionStatusResp", null, global);
@@ -2946,7 +2947,11 @@ var require_avs_pb = __commonJS({
2946
2947
  return proto.aggregator.ManualTrigger.Config.toObject(opt_includeInstance, this);
2947
2948
  };
2948
2949
  proto.aggregator.ManualTrigger.Config.toObject = function(includeInstance, msg) {
2949
- var f, obj = {};
2950
+ var f, obj = {
2951
+ data: (f = msg.getData()) && google_protobuf_struct_pb2.Value.toObject(includeInstance, f),
2952
+ headersMap: (f = msg.getHeadersMap()) ? f.toObject(includeInstance, void 0) : [],
2953
+ pathparamsMap: (f = msg.getPathparamsMap()) ? f.toObject(includeInstance, void 0) : []
2954
+ };
2950
2955
  if (includeInstance) {
2951
2956
  obj.$jspbMessageInstance = msg;
2952
2957
  }
@@ -2965,6 +2970,23 @@ var require_avs_pb = __commonJS({
2965
2970
  }
2966
2971
  var field = reader.getFieldNumber();
2967
2972
  switch (field) {
2973
+ case 1:
2974
+ var value = new google_protobuf_struct_pb2.Value();
2975
+ reader.readMessage(value, google_protobuf_struct_pb2.Value.deserializeBinaryFromReader);
2976
+ msg.setData(value);
2977
+ break;
2978
+ case 2:
2979
+ var value = msg.getHeadersMap();
2980
+ reader.readMessage(value, function(message, reader2) {
2981
+ jspb.Map.deserializeBinary(message, reader2, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readString, null, "", "");
2982
+ });
2983
+ break;
2984
+ case 3:
2985
+ var value = msg.getPathparamsMap();
2986
+ reader.readMessage(value, function(message, reader2) {
2987
+ jspb.Map.deserializeBinary(message, reader2, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readString, null, "", "");
2988
+ });
2989
+ break;
2968
2990
  default:
2969
2991
  reader.skipField();
2970
2992
  break;
@@ -2979,6 +3001,67 @@ var require_avs_pb = __commonJS({
2979
3001
  };
2980
3002
  proto.aggregator.ManualTrigger.Config.serializeBinaryToWriter = function(message, writer) {
2981
3003
  var f = void 0;
3004
+ f = message.getData();
3005
+ if (f != null) {
3006
+ writer.writeMessage(
3007
+ 1,
3008
+ f,
3009
+ google_protobuf_struct_pb2.Value.serializeBinaryToWriter
3010
+ );
3011
+ }
3012
+ f = message.getHeadersMap(true);
3013
+ if (f && f.getLength() > 0) {
3014
+ f.serializeBinary(2, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeString);
3015
+ }
3016
+ f = message.getPathparamsMap(true);
3017
+ if (f && f.getLength() > 0) {
3018
+ f.serializeBinary(3, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeString);
3019
+ }
3020
+ };
3021
+ proto.aggregator.ManualTrigger.Config.prototype.getData = function() {
3022
+ return (
3023
+ /** @type{?proto.google.protobuf.Value} */
3024
+ jspb.Message.getWrapperField(this, google_protobuf_struct_pb2.Value, 1)
3025
+ );
3026
+ };
3027
+ proto.aggregator.ManualTrigger.Config.prototype.setData = function(value) {
3028
+ return jspb.Message.setWrapperField(this, 1, value);
3029
+ };
3030
+ proto.aggregator.ManualTrigger.Config.prototype.clearData = function() {
3031
+ return this.setData(void 0);
3032
+ };
3033
+ proto.aggregator.ManualTrigger.Config.prototype.hasData = function() {
3034
+ return jspb.Message.getField(this, 1) != null;
3035
+ };
3036
+ proto.aggregator.ManualTrigger.Config.prototype.getHeadersMap = function(opt_noLazyCreate) {
3037
+ return (
3038
+ /** @type {!jspb.Map<string,string>} */
3039
+ jspb.Message.getMapField(
3040
+ this,
3041
+ 2,
3042
+ opt_noLazyCreate,
3043
+ null
3044
+ )
3045
+ );
3046
+ };
3047
+ proto.aggregator.ManualTrigger.Config.prototype.clearHeadersMap = function() {
3048
+ this.getHeadersMap().clear();
3049
+ return this;
3050
+ };
3051
+ proto.aggregator.ManualTrigger.Config.prototype.getPathparamsMap = function(opt_noLazyCreate) {
3052
+ return (
3053
+ /** @type {!jspb.Map<string,string>} */
3054
+ jspb.Message.getMapField(
3055
+ this,
3056
+ 3,
3057
+ opt_noLazyCreate,
3058
+ null
3059
+ )
3060
+ );
3061
+ };
3062
+ proto.aggregator.ManualTrigger.Config.prototype.clearPathparamsMap = function() {
3063
+ this.getPathparamsMap().clear();
3064
+ return this;
2982
3065
  };
2983
3066
  if (jspb.Message.GENERATE_TO_OBJECT) {
2984
3067
  proto.aggregator.ManualTrigger.Output.prototype.toObject = function(opt_includeInstance) {
@@ -2986,7 +3069,9 @@ var require_avs_pb = __commonJS({
2986
3069
  };
2987
3070
  proto.aggregator.ManualTrigger.Output.toObject = function(includeInstance, msg) {
2988
3071
  var f, obj = {
2989
- runAt: jspb.Message.getFieldWithDefault(msg, 1, 0)
3072
+ data: (f = msg.getData()) && google_protobuf_struct_pb2.Value.toObject(includeInstance, f),
3073
+ headersMap: (f = msg.getHeadersMap()) ? f.toObject(includeInstance, void 0) : [],
3074
+ pathparamsMap: (f = msg.getPathparamsMap()) ? f.toObject(includeInstance, void 0) : []
2990
3075
  };
2991
3076
  if (includeInstance) {
2992
3077
  obj.$jspbMessageInstance = msg;
@@ -3007,11 +3092,21 @@ var require_avs_pb = __commonJS({
3007
3092
  var field = reader.getFieldNumber();
3008
3093
  switch (field) {
3009
3094
  case 1:
3010
- var value = (
3011
- /** @type {number} */
3012
- reader.readUint64()
3013
- );
3014
- msg.setRunAt(value);
3095
+ var value = new google_protobuf_struct_pb2.Value();
3096
+ reader.readMessage(value, google_protobuf_struct_pb2.Value.deserializeBinaryFromReader);
3097
+ msg.setData(value);
3098
+ break;
3099
+ case 2:
3100
+ var value = msg.getHeadersMap();
3101
+ reader.readMessage(value, function(message, reader2) {
3102
+ jspb.Map.deserializeBinary(message, reader2, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readString, null, "", "");
3103
+ });
3104
+ break;
3105
+ case 3:
3106
+ var value = msg.getPathparamsMap();
3107
+ reader.readMessage(value, function(message, reader2) {
3108
+ jspb.Map.deserializeBinary(message, reader2, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readString, null, "", "");
3109
+ });
3015
3110
  break;
3016
3111
  default:
3017
3112
  reader.skipField();
@@ -3027,22 +3122,67 @@ var require_avs_pb = __commonJS({
3027
3122
  };
3028
3123
  proto.aggregator.ManualTrigger.Output.serializeBinaryToWriter = function(message, writer) {
3029
3124
  var f = void 0;
3030
- f = message.getRunAt();
3031
- if (f !== 0) {
3032
- writer.writeUint64(
3125
+ f = message.getData();
3126
+ if (f != null) {
3127
+ writer.writeMessage(
3033
3128
  1,
3034
- f
3129
+ f,
3130
+ google_protobuf_struct_pb2.Value.serializeBinaryToWriter
3035
3131
  );
3036
3132
  }
3133
+ f = message.getHeadersMap(true);
3134
+ if (f && f.getLength() > 0) {
3135
+ f.serializeBinary(2, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeString);
3136
+ }
3137
+ f = message.getPathparamsMap(true);
3138
+ if (f && f.getLength() > 0) {
3139
+ f.serializeBinary(3, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeString);
3140
+ }
3037
3141
  };
3038
- proto.aggregator.ManualTrigger.Output.prototype.getRunAt = function() {
3142
+ proto.aggregator.ManualTrigger.Output.prototype.getData = function() {
3039
3143
  return (
3040
- /** @type {number} */
3041
- jspb.Message.getFieldWithDefault(this, 1, 0)
3144
+ /** @type{?proto.google.protobuf.Value} */
3145
+ jspb.Message.getWrapperField(this, google_protobuf_struct_pb2.Value, 1)
3042
3146
  );
3043
3147
  };
3044
- proto.aggregator.ManualTrigger.Output.prototype.setRunAt = function(value) {
3045
- return jspb.Message.setProto3IntField(this, 1, value);
3148
+ proto.aggregator.ManualTrigger.Output.prototype.setData = function(value) {
3149
+ return jspb.Message.setWrapperField(this, 1, value);
3150
+ };
3151
+ proto.aggregator.ManualTrigger.Output.prototype.clearData = function() {
3152
+ return this.setData(void 0);
3153
+ };
3154
+ proto.aggregator.ManualTrigger.Output.prototype.hasData = function() {
3155
+ return jspb.Message.getField(this, 1) != null;
3156
+ };
3157
+ proto.aggregator.ManualTrigger.Output.prototype.getHeadersMap = function(opt_noLazyCreate) {
3158
+ return (
3159
+ /** @type {!jspb.Map<string,string>} */
3160
+ jspb.Message.getMapField(
3161
+ this,
3162
+ 2,
3163
+ opt_noLazyCreate,
3164
+ null
3165
+ )
3166
+ );
3167
+ };
3168
+ proto.aggregator.ManualTrigger.Output.prototype.clearHeadersMap = function() {
3169
+ this.getHeadersMap().clear();
3170
+ return this;
3171
+ };
3172
+ proto.aggregator.ManualTrigger.Output.prototype.getPathparamsMap = function(opt_noLazyCreate) {
3173
+ return (
3174
+ /** @type {!jspb.Map<string,string>} */
3175
+ jspb.Message.getMapField(
3176
+ this,
3177
+ 3,
3178
+ opt_noLazyCreate,
3179
+ null
3180
+ )
3181
+ );
3182
+ };
3183
+ proto.aggregator.ManualTrigger.Output.prototype.clearPathparamsMap = function() {
3184
+ this.getPathparamsMap().clear();
3185
+ return this;
3046
3186
  };
3047
3187
  proto.aggregator.ManualTrigger.prototype.getConfig = function() {
3048
3188
  return (
@@ -3097,7 +3237,7 @@ var require_avs_pb = __commonJS({
3097
3237
  var f, obj = {
3098
3238
  name: jspb.Message.getFieldWithDefault(msg, 1, ""),
3099
3239
  type: jspb.Message.getFieldWithDefault(msg, 8, 0),
3100
- manual: jspb.Message.getBooleanFieldWithDefault(msg, 2, false),
3240
+ manual: (f = msg.getManual()) && proto.aggregator.ManualTrigger.toObject(includeInstance, f),
3101
3241
  fixedTime: (f = msg.getFixedTime()) && proto.aggregator.FixedTimeTrigger.toObject(includeInstance, f),
3102
3242
  cron: (f = msg.getCron()) && proto.aggregator.CronTrigger.toObject(includeInstance, f),
3103
3243
  block: (f = msg.getBlock()) && proto.aggregator.BlockTrigger.toObject(includeInstance, f),
@@ -3138,10 +3278,8 @@ var require_avs_pb = __commonJS({
3138
3278
  msg.setType(value);
3139
3279
  break;
3140
3280
  case 2:
3141
- var value = (
3142
- /** @type {boolean} */
3143
- reader.readBool()
3144
- );
3281
+ var value = new proto.aggregator.ManualTrigger();
3282
+ reader.readMessage(value, proto.aggregator.ManualTrigger.deserializeBinaryFromReader);
3145
3283
  msg.setManual(value);
3146
3284
  break;
3147
3285
  case 3:
@@ -3204,12 +3342,12 @@ var require_avs_pb = __commonJS({
3204
3342
  f
3205
3343
  );
3206
3344
  }
3207
- f = /** @type {boolean} */
3208
- jspb.Message.getField(message, 2);
3345
+ f = message.getManual();
3209
3346
  if (f != null) {
3210
- writer.writeBool(
3347
+ writer.writeMessage(
3211
3348
  2,
3212
- f
3349
+ f,
3350
+ proto.aggregator.ManualTrigger.serializeBinaryToWriter
3213
3351
  );
3214
3352
  }
3215
3353
  f = message.getFixedTime();
@@ -3280,15 +3418,15 @@ var require_avs_pb = __commonJS({
3280
3418
  };
3281
3419
  proto.aggregator.TaskTrigger.prototype.getManual = function() {
3282
3420
  return (
3283
- /** @type {boolean} */
3284
- jspb.Message.getBooleanFieldWithDefault(this, 2, false)
3421
+ /** @type{?proto.aggregator.ManualTrigger} */
3422
+ jspb.Message.getWrapperField(this, proto.aggregator.ManualTrigger, 2)
3285
3423
  );
3286
3424
  };
3287
3425
  proto.aggregator.TaskTrigger.prototype.setManual = function(value) {
3288
- return jspb.Message.setOneofField(this, 2, proto.aggregator.TaskTrigger.oneofGroups_[0], value);
3426
+ return jspb.Message.setOneofWrapperField(this, 2, proto.aggregator.TaskTrigger.oneofGroups_[0], value);
3289
3427
  };
3290
3428
  proto.aggregator.TaskTrigger.prototype.clearManual = function() {
3291
- return jspb.Message.setOneofField(this, 2, proto.aggregator.TaskTrigger.oneofGroups_[0], void 0);
3429
+ return this.setManual(void 0);
3292
3430
  };
3293
3431
  proto.aggregator.TaskTrigger.prototype.hasManual = function() {
3294
3432
  return jspb.Message.getField(this, 2) != null;
@@ -7412,7 +7550,8 @@ var require_avs_pb = __commonJS({
7412
7550
  var f, obj = {
7413
7551
  sourceId: jspb.Message.getFieldWithDefault(msg, 1, ""),
7414
7552
  iterVal: jspb.Message.getFieldWithDefault(msg, 2, ""),
7415
- iterKey: jspb.Message.getFieldWithDefault(msg, 3, "")
7553
+ iterKey: jspb.Message.getFieldWithDefault(msg, 3, ""),
7554
+ executionMode: jspb.Message.getFieldWithDefault(msg, 4, 0)
7416
7555
  };
7417
7556
  if (includeInstance) {
7418
7557
  obj.$jspbMessageInstance = msg;
@@ -7453,6 +7592,13 @@ var require_avs_pb = __commonJS({
7453
7592
  );
7454
7593
  msg.setIterKey(value);
7455
7594
  break;
7595
+ case 4:
7596
+ var value = (
7597
+ /** @type {!proto.aggregator.ExecutionMode} */
7598
+ reader.readEnum()
7599
+ );
7600
+ msg.setExecutionMode(value);
7601
+ break;
7456
7602
  default:
7457
7603
  reader.skipField();
7458
7604
  break;
@@ -7488,6 +7634,13 @@ var require_avs_pb = __commonJS({
7488
7634
  f
7489
7635
  );
7490
7636
  }
7637
+ f = message.getExecutionMode();
7638
+ if (f !== 0) {
7639
+ writer.writeEnum(
7640
+ 4,
7641
+ f
7642
+ );
7643
+ }
7491
7644
  };
7492
7645
  proto.aggregator.LoopNode.Config.prototype.getSourceId = function() {
7493
7646
  return (
@@ -7516,6 +7669,15 @@ var require_avs_pb = __commonJS({
7516
7669
  proto.aggregator.LoopNode.Config.prototype.setIterKey = function(value) {
7517
7670
  return jspb.Message.setProto3StringField(this, 3, value);
7518
7671
  };
7672
+ proto.aggregator.LoopNode.Config.prototype.getExecutionMode = function() {
7673
+ return (
7674
+ /** @type {!proto.aggregator.ExecutionMode} */
7675
+ jspb.Message.getFieldWithDefault(this, 4, 0)
7676
+ );
7677
+ };
7678
+ proto.aggregator.LoopNode.Config.prototype.setExecutionMode = function(value) {
7679
+ return jspb.Message.setProto3EnumField(this, 4, value);
7680
+ };
7519
7681
  if (jspb.Message.GENERATE_TO_OBJECT) {
7520
7682
  proto.aggregator.LoopNode.Output.prototype.toObject = function(opt_includeInstance) {
7521
7683
  return proto.aggregator.LoopNode.Output.toObject(opt_includeInstance, this);
@@ -15775,6 +15937,10 @@ var require_avs_pb = __commonJS({
15775
15937
  NODE_TYPE_FILTER: 8,
15776
15938
  NODE_TYPE_LOOP: 9
15777
15939
  };
15940
+ proto.aggregator.ExecutionMode = {
15941
+ EXECUTION_MODE_SEQUENTIAL: 0,
15942
+ EXECUTION_MODE_PARALLEL: 1
15943
+ };
15778
15944
  proto.aggregator.Lang = {
15779
15945
  JAVASCRIPT: 0
15780
15946
  };
@@ -17284,58 +17450,133 @@ var fixedTime_default = FixedTimeTrigger2;
17284
17450
  // src/models/trigger/manual.ts
17285
17451
  var avs_pb6 = __toESM(require_avs_pb());
17286
17452
  var import_types6 = require("@avaprotocol/types");
17287
- var ManualTrigger = class _ManualTrigger extends Trigger {
17453
+ var ManualTrigger2 = class _ManualTrigger extends Trigger {
17288
17454
  constructor(props) {
17289
- super({ ...props, type: import_types6.TriggerType.Manual, data: props.data || null });
17455
+ super({
17456
+ ...props,
17457
+ type: import_types6.TriggerType.Manual,
17458
+ data: props.data,
17459
+ input: props.input
17460
+ });
17461
+ this.headersMap = props.headersMap;
17462
+ this.pathParamsMap = props.pathParamsMap;
17290
17463
  }
17291
17464
  toRequest() {
17292
17465
  const trigger = new avs_pb6.TaskTrigger();
17293
17466
  trigger.setId(this.id);
17294
17467
  trigger.setName(this.name);
17295
17468
  trigger.setType(avs_pb6.TriggerType.TRIGGER_TYPE_MANUAL);
17296
- trigger.setManual(true);
17297
- const inputValue = convertInputToProtobuf(this.input);
17298
- if (inputValue) {
17299
- trigger.setInput(inputValue);
17469
+ const manualTrigger = new avs_pb6.ManualTrigger();
17470
+ const config = new avs_pb6.ManualTrigger.Config();
17471
+ const dataToSend = this.data ?? this.input;
17472
+ if (dataToSend !== null && dataToSend !== void 0) {
17473
+ const inputValue = convertInputToProtobuf(dataToSend);
17474
+ if (inputValue) {
17475
+ config.setData(inputValue);
17476
+ }
17477
+ }
17478
+ if (this.headersMap && this.headersMap.length > 0) {
17479
+ const headersMap = config.getHeadersMap();
17480
+ this.headersMap.forEach(([key, value]) => {
17481
+ headersMap.set(key, value);
17482
+ });
17300
17483
  }
17484
+ if (this.pathParamsMap && this.pathParamsMap.length > 0) {
17485
+ const pathParamsMap = config.getPathparamsMap();
17486
+ this.pathParamsMap.forEach(([key, value]) => {
17487
+ pathParamsMap.set(key, value);
17488
+ });
17489
+ }
17490
+ manualTrigger.setConfig(config);
17491
+ trigger.setManual(manualTrigger);
17301
17492
  return trigger;
17302
17493
  }
17303
17494
  static fromResponse(raw) {
17304
17495
  const obj = raw.toObject();
17305
- let input = void 0;
17306
- if (raw.hasInput()) {
17307
- input = extractInputFromProtobuf(raw.getInput());
17496
+ let data = null;
17497
+ const input = void 0;
17498
+ let headersMap = void 0;
17499
+ let pathParamsMap = void 0;
17500
+ const manualTrigger = raw.getManual();
17501
+ if (manualTrigger) {
17502
+ const config = manualTrigger.getConfig();
17503
+ if (config) {
17504
+ if (config.hasData()) {
17505
+ data = extractInputFromProtobuf(config.getData());
17506
+ }
17507
+ const headersMapProto = config.getHeadersMap();
17508
+ if (headersMapProto && headersMapProto.getLength() > 0) {
17509
+ headersMap = [];
17510
+ headersMapProto.forEach((value, key) => {
17511
+ headersMap.push([key, value]);
17512
+ });
17513
+ }
17514
+ const pathParamsMapProto = config.getPathparamsMap();
17515
+ if (pathParamsMapProto && pathParamsMapProto.getLength() > 0) {
17516
+ pathParamsMap = [];
17517
+ pathParamsMapProto.forEach((value, key) => {
17518
+ pathParamsMap.push([key, value]);
17519
+ });
17520
+ }
17521
+ }
17308
17522
  }
17309
17523
  return new _ManualTrigger({
17310
17524
  ...obj,
17311
17525
  type: import_types6.TriggerType.Manual,
17312
- data: null,
17313
- // Manual triggers don't have data in the protobuf response
17314
- input
17526
+ data,
17527
+ input,
17528
+ headersMap,
17529
+ pathParamsMap
17315
17530
  });
17316
17531
  }
17317
17532
  getInputVariables() {
17318
- return this.data;
17319
- }
17320
- /**
17321
- * Convert raw data from runTrigger response to ManualOutput format
17322
- * @param rawData - The raw data from the gRPC response
17323
- * @returns {ManualTriggerOutput | undefined} - The converted data
17324
- */
17325
- getOutput() {
17326
- return this.output;
17533
+ return this.input;
17327
17534
  }
17328
17535
  /**
17329
17536
  * Extract output data from RunTriggerResp for manual triggers
17330
17537
  * @param outputData - The RunTriggerResp containing manual trigger output
17331
- * @returns Plain JavaScript object with manual trigger data
17538
+ * @returns Plain JavaScript object with manual trigger data in standard structure
17332
17539
  */
17333
17540
  static fromOutputData(outputData) {
17334
17541
  const manualOutput = outputData.getManualTrigger();
17335
- return manualOutput?.toObject() || null;
17542
+ if (!manualOutput) {
17543
+ return null;
17544
+ }
17545
+ const result = {};
17546
+ const dataValue = manualOutput.getData();
17547
+ if (dataValue) {
17548
+ try {
17549
+ result.data = convertProtobufValueToJs(dataValue);
17550
+ } catch (error) {
17551
+ console.warn(
17552
+ "Failed to convert manual trigger data from protobuf Value:",
17553
+ error
17554
+ );
17555
+ result.data = dataValue;
17556
+ }
17557
+ } else {
17558
+ result.data = null;
17559
+ }
17560
+ const headersMapProto = manualOutput.getHeadersMap();
17561
+ if (headersMapProto && headersMapProto.getLength() > 0) {
17562
+ const headersArray = [];
17563
+ headersMapProto.forEach((value, key) => {
17564
+ headersArray.push([key, value]);
17565
+ });
17566
+ result.headers = headersArray;
17567
+ }
17568
+ const pathParamsMapProto = manualOutput.getPathparamsMap();
17569
+ if (pathParamsMapProto && pathParamsMapProto.getLength() > 0) {
17570
+ const pathParamsArray = [];
17571
+ pathParamsMapProto.forEach((value, key) => {
17572
+ pathParamsArray.push([key, value]);
17573
+ });
17574
+ result.pathParams = pathParamsArray;
17575
+ }
17576
+ return result;
17336
17577
  }
17337
17578
  };
17338
- var manual_default = ManualTrigger;
17579
+ var manual_default = ManualTrigger2;
17339
17580
 
17340
17581
  // src/models/trigger/factory.ts
17341
17582
  var import_types7 = require("@avaprotocol/types");
@@ -17447,6 +17688,29 @@ var ContractWriteNode2 = class _ContractWriteNode extends Node {
17447
17688
  constructor(props) {
17448
17689
  super({ ...props, type: import_types9.NodeType.ContractWrite, data: props.data });
17449
17690
  }
17691
+ /**
17692
+ * Create a protobuf ContractWriteNode from config data
17693
+ * @param configData - The configuration data for the contract write node
17694
+ * @returns Configured avs_pb.ContractWriteNode
17695
+ */
17696
+ static createProtobufNode(configData) {
17697
+ const node = new avs_pb9.ContractWriteNode();
17698
+ const config = new avs_pb9.ContractWriteNode.Config();
17699
+ config.setContractAddress(configData.contractAddress);
17700
+ config.setCallData(configData.callData);
17701
+ config.setContractAbi(configData.contractAbi);
17702
+ const methodCalls = configData.methodCalls || [];
17703
+ methodCalls.forEach((methodCall) => {
17704
+ const methodCallMsg = new avs_pb9.ContractWriteNode.MethodCall();
17705
+ methodCallMsg.setCallData(methodCall.callData);
17706
+ if (methodCall.methodName) {
17707
+ methodCallMsg.setMethodName(methodCall.methodName);
17708
+ }
17709
+ config.addMethodCalls(methodCallMsg);
17710
+ });
17711
+ node.setConfig(config);
17712
+ return node;
17713
+ }
17450
17714
  static fromResponse(raw) {
17451
17715
  const obj = raw.toObject();
17452
17716
  const protobufData = raw.getContractWrite().getConfig().toObject();
@@ -17474,25 +17738,9 @@ var ContractWriteNode2 = class _ContractWriteNode extends Node {
17474
17738
  const request = new avs_pb9.TaskNode();
17475
17739
  request.setId(this.id);
17476
17740
  request.setName(this.name);
17477
- const node = new avs_pb9.ContractWriteNode();
17478
- const config = new avs_pb9.ContractWriteNode.Config();
17479
- config.setContractAddress(
17480
- this.data.contractAddress
17481
- );
17482
- config.setCallData(this.data.callData);
17483
- config.setContractAbi(this.data.contractAbi);
17484
- const methodCalls = this.data.methodCalls || [];
17485
- methodCalls.forEach(
17486
- (methodCall) => {
17487
- const methodCallMsg = new avs_pb9.ContractWriteNode.MethodCall();
17488
- methodCallMsg.setCallData(methodCall.callData);
17489
- if (methodCall.methodName) {
17490
- methodCallMsg.setMethodName(methodCall.methodName);
17491
- }
17492
- config.addMethodCalls(methodCallMsg);
17493
- }
17741
+ const node = _ContractWriteNode.createProtobufNode(
17742
+ this.data
17494
17743
  );
17495
- node.setConfig(config);
17496
17744
  const inputValue = convertInputToProtobuf(this.input);
17497
17745
  if (inputValue) {
17498
17746
  request.setInput(inputValue);
@@ -17518,6 +17766,19 @@ var CustomCodeNode2 = class _CustomCodeNode extends Node {
17518
17766
  constructor(props) {
17519
17767
  super({ ...props, type: import_types10.NodeType.CustomCode, data: props.data });
17520
17768
  }
17769
+ /**
17770
+ * Create a protobuf CustomCodeNode from config data
17771
+ * @param configData - The configuration data for the custom code node
17772
+ * @returns Configured avs_pb.CustomCodeNode
17773
+ */
17774
+ static createProtobufNode(configData) {
17775
+ const node = new avs_pb10.CustomCodeNode();
17776
+ const config = new avs_pb10.CustomCodeNode.Config();
17777
+ config.setLang(configData.lang);
17778
+ config.setSource(configData.source);
17779
+ node.setConfig(config);
17780
+ return node;
17781
+ }
17521
17782
  static fromResponse(raw) {
17522
17783
  const obj = raw.toObject();
17523
17784
  const rawConfig = raw.getCustomCode().getConfig().toObject();
@@ -17540,11 +17801,9 @@ var CustomCodeNode2 = class _CustomCodeNode extends Node {
17540
17801
  const request = new avs_pb10.TaskNode();
17541
17802
  request.setId(this.id);
17542
17803
  request.setName(this.name);
17543
- const node = new avs_pb10.CustomCodeNode();
17544
- const config = new avs_pb10.CustomCodeNode.Config();
17545
- config.setLang(this.data.lang);
17546
- config.setSource(this.data.source);
17547
- node.setConfig(config);
17804
+ const node = _CustomCodeNode.createProtobufNode(
17805
+ this.data
17806
+ );
17548
17807
  const inputValue = convertInputToProtobuf(this.input);
17549
17808
  if (inputValue) {
17550
17809
  request.setInput(inputValue);
@@ -17577,6 +17836,25 @@ var GraphQLQueryNode2 = class _GraphQLQueryNode extends Node {
17577
17836
  data: props.data
17578
17837
  });
17579
17838
  }
17839
+ /**
17840
+ * Create a protobuf GraphQLQueryNode from config data
17841
+ * @param configData - The configuration data for the GraphQL query node
17842
+ * @returns Configured avs_pb.GraphQLQueryNode
17843
+ */
17844
+ static createProtobufNode(configData) {
17845
+ const node = new avs_pb11.GraphQLQueryNode();
17846
+ const config = new avs_pb11.GraphQLQueryNode.Config();
17847
+ config.setUrl(configData.url);
17848
+ config.setQuery(configData.query);
17849
+ if (configData.variablesMap && configData.variablesMap.length > 0) {
17850
+ const variablesMap = config.getVariablesMap();
17851
+ configData.variablesMap.forEach(([key, value]) => {
17852
+ variablesMap.set(key, value);
17853
+ });
17854
+ }
17855
+ node.setConfig(config);
17856
+ return node;
17857
+ }
17580
17858
  static fromResponse(raw) {
17581
17859
  const obj = raw.toObject();
17582
17860
  const input = extractInputFromProtobuf(raw.getGraphqlQuery()?.getInput());
@@ -17591,17 +17869,9 @@ var GraphQLQueryNode2 = class _GraphQLQueryNode extends Node {
17591
17869
  const request = new avs_pb11.TaskNode();
17592
17870
  request.setId(this.id);
17593
17871
  request.setName(this.name);
17594
- const node = new avs_pb11.GraphQLQueryNode();
17595
- const config = new avs_pb11.GraphQLQueryNode.Config();
17596
- config.setUrl(this.data.url);
17597
- config.setQuery(this.data.query);
17598
- if (this.data.variablesMap && this.data.variablesMap.length > 0) {
17599
- const variablesMap = config.getVariablesMap();
17600
- this.data.variablesMap.forEach(([key, value]) => {
17601
- variablesMap.set(key, value);
17602
- });
17603
- }
17604
- node.setConfig(config);
17872
+ const node = _GraphQLQueryNode.createProtobufNode(
17873
+ this.data
17874
+ );
17605
17875
  const inputValue = convertInputToProtobuf(this.input);
17606
17876
  if (inputValue) {
17607
17877
  node.setInput(inputValue);
@@ -17623,6 +17893,26 @@ var RestAPINode2 = class _RestAPINode extends Node {
17623
17893
  constructor(props) {
17624
17894
  super({ ...props, type: import_types12.NodeType.RestAPI, data: props.data });
17625
17895
  }
17896
+ /**
17897
+ * Create a protobuf RestAPINode from config data
17898
+ * @param configData - The configuration data for the REST API node
17899
+ * @returns Configured avs_pb.RestAPINode
17900
+ */
17901
+ static createProtobufNode(configData) {
17902
+ const node = new avs_pb12.RestAPINode();
17903
+ const config = new avs_pb12.RestAPINode.Config();
17904
+ config.setUrl(configData.url);
17905
+ config.setMethod(configData.method);
17906
+ config.setBody(configData.body || "");
17907
+ if (configData.headersMap && configData.headersMap.length > 0) {
17908
+ const headersMap = config.getHeadersMap();
17909
+ configData.headersMap.forEach(([key, value]) => {
17910
+ headersMap.set(key, value);
17911
+ });
17912
+ }
17913
+ node.setConfig(config);
17914
+ return node;
17915
+ }
17626
17916
  static fromResponse(raw) {
17627
17917
  const obj = raw.toObject();
17628
17918
  let input = void 0;
@@ -17641,20 +17931,9 @@ var RestAPINode2 = class _RestAPINode extends Node {
17641
17931
  const request = new avs_pb12.TaskNode();
17642
17932
  request.setId(this.id);
17643
17933
  request.setName(this.name);
17644
- const nodeData = new avs_pb12.RestAPINode();
17645
- const config = new avs_pb12.RestAPINode.Config();
17646
- config.setUrl(this.data.url);
17647
- config.setMethod(this.data.method);
17648
- config.setBody(this.data.body || "");
17649
- if (this.data.headersMap && this.data.headersMap.length > 0) {
17650
- const headersMap = config.getHeadersMap();
17651
- this.data.headersMap.forEach(
17652
- ([key, value]) => {
17653
- headersMap.set(key, value);
17654
- }
17655
- );
17656
- }
17657
- nodeData.setConfig(config);
17934
+ const nodeData = _RestAPINode.createProtobufNode(
17935
+ this.data
17936
+ );
17658
17937
  const inputValue = convertInputToProtobuf(this.input);
17659
17938
  if (inputValue) {
17660
17939
  request.setInput(inputValue);
@@ -17684,6 +17963,31 @@ var ContractReadNode2 = class _ContractReadNode extends Node {
17684
17963
  constructor(props) {
17685
17964
  super({ ...props, type: import_types13.NodeType.ContractRead, data: props.data });
17686
17965
  }
17966
+ /**
17967
+ * Create a protobuf ContractReadNode from config data
17968
+ * @param configData - The configuration data for the contract read node
17969
+ * @returns Configured avs_pb.ContractReadNode
17970
+ */
17971
+ static createProtobufNode(configData) {
17972
+ const node = new avs_pb13.ContractReadNode();
17973
+ const config = new avs_pb13.ContractReadNode.Config();
17974
+ config.setContractAddress(configData.contractAddress);
17975
+ config.setContractAbi(configData.contractAbi);
17976
+ const methodCalls = configData.methodCalls || [];
17977
+ methodCalls.forEach((methodCall) => {
17978
+ const methodCallMsg = new avs_pb13.ContractReadNode.MethodCall();
17979
+ methodCallMsg.setCallData(methodCall.callData);
17980
+ if (methodCall.methodName) {
17981
+ methodCallMsg.setMethodName(methodCall.methodName);
17982
+ }
17983
+ if (methodCall.applyToFields) {
17984
+ methodCallMsg.setApplyToFieldsList(methodCall.applyToFields);
17985
+ }
17986
+ config.addMethodCalls(methodCallMsg);
17987
+ });
17988
+ node.setConfig(config);
17989
+ return node;
17990
+ }
17687
17991
  static fromResponse(raw) {
17688
17992
  const obj = raw.toObject();
17689
17993
  const protobufData = raw.getContractRead().getConfig().toObject();
@@ -17711,27 +18015,9 @@ var ContractReadNode2 = class _ContractReadNode extends Node {
17711
18015
  const request = new avs_pb13.TaskNode();
17712
18016
  request.setId(this.id);
17713
18017
  request.setName(this.name);
17714
- const node = new avs_pb13.ContractReadNode();
17715
- const config = new avs_pb13.ContractReadNode.Config();
17716
- config.setContractAddress(
17717
- this.data.contractAddress
17718
- );
17719
- config.setContractAbi(this.data.contractAbi);
17720
- const methodCalls = this.data.methodCalls || [];
17721
- methodCalls.forEach(
17722
- (methodCall) => {
17723
- const methodCallMsg = new avs_pb13.ContractReadNode.MethodCall();
17724
- methodCallMsg.setCallData(methodCall.callData);
17725
- if (methodCall.methodName) {
17726
- methodCallMsg.setMethodName(methodCall.methodName);
17727
- }
17728
- if (methodCall.applyToFields) {
17729
- methodCallMsg.setApplyToFieldsList(methodCall.applyToFields);
17730
- }
17731
- config.addMethodCalls(methodCallMsg);
17732
- }
18018
+ const node = _ContractReadNode.createProtobufNode(
18019
+ this.data
17733
18020
  );
17734
- node.setConfig(config);
17735
18021
  const inputValue = convertInputToProtobuf(this.input);
17736
18022
  if (inputValue) {
17737
18023
  request.setInput(inputValue);
@@ -17769,6 +18055,19 @@ var ETHTransferNode2 = class _ETHTransferNode extends Node {
17769
18055
  constructor(props) {
17770
18056
  super({ ...props, type: import_types14.NodeType.ETHTransfer, data: props.data });
17771
18057
  }
18058
+ /**
18059
+ * Create a protobuf ETHTransferNode from config data
18060
+ * @param configData - The configuration data for the ETH transfer node
18061
+ * @returns Configured avs_pb.ETHTransferNode
18062
+ */
18063
+ static createProtobufNode(configData) {
18064
+ const node = new avs_pb14.ETHTransferNode();
18065
+ const config = new avs_pb14.ETHTransferNode.Config();
18066
+ config.setDestination(configData.destination);
18067
+ config.setAmount(configData.amount);
18068
+ node.setConfig(config);
18069
+ return node;
18070
+ }
17772
18071
  static fromResponse(raw) {
17773
18072
  const obj = raw.toObject();
17774
18073
  const input = extractInputFromProtobuf(raw.getEthTransfer()?.getInput());
@@ -17783,11 +18082,9 @@ var ETHTransferNode2 = class _ETHTransferNode extends Node {
17783
18082
  const request = new avs_pb14.TaskNode();
17784
18083
  request.setId(this.id);
17785
18084
  request.setName(this.name);
17786
- const node = new avs_pb14.ETHTransferNode();
17787
- const config = new avs_pb14.ETHTransferNode.Config();
17788
- config.setDestination(this.data.destination);
17789
- config.setAmount(this.data.amount);
17790
- node.setConfig(config);
18085
+ const node = _ETHTransferNode.createProtobufNode(
18086
+ this.data
18087
+ );
17791
18088
  const inputValue = convertInputToProtobuf(this.input);
17792
18089
  if (inputValue) {
17793
18090
  node.setInput(inputValue);
@@ -17864,6 +18161,7 @@ var branch_default = BranchNode2;
17864
18161
  // src/models/node/filter.ts
17865
18162
  var avs_pb16 = __toESM(require_avs_pb());
17866
18163
  var import_types16 = require("@avaprotocol/types");
18164
+ var import_struct_pb2 = require("google-protobuf/google/protobuf/struct_pb");
17867
18165
  var FilterNode2 = class _FilterNode extends Node {
17868
18166
  constructor(props) {
17869
18167
  super({ ...props, type: import_types16.NodeType.Filter, data: props.data });
@@ -17896,7 +18194,21 @@ var FilterNode2 = class _FilterNode extends Node {
17896
18194
  }
17897
18195
  static fromOutputData(outputData) {
17898
18196
  const filterOutput = outputData.getFilter();
17899
- return filterOutput?.toObject() || null;
18197
+ if (!filterOutput) {
18198
+ throw new Error("FilterNode output data is missing");
18199
+ }
18200
+ const anyData = filterOutput.getData();
18201
+ if (!anyData) {
18202
+ throw new Error("FilterNode output data.getData() is missing");
18203
+ }
18204
+ const value = import_struct_pb2.Value.deserializeBinary(anyData.getValue_asU8());
18205
+ const result = value.toJavaScript();
18206
+ if (result && typeof result === "object" && !Array.isArray(result) && result.data) {
18207
+ return result.data;
18208
+ }
18209
+ throw new Error(
18210
+ "FilterNode output data does not contain expected data structure"
18211
+ );
17900
18212
  }
17901
18213
  };
17902
18214
  var filter_default = FilterNode2;
@@ -17918,13 +18230,12 @@ var LoopNode2 = class _LoopNode extends Node {
17918
18230
  const loopNodeData = loopNode.toObject();
17919
18231
  const data = {
17920
18232
  ...configData,
17921
- // Keep the nested node structures from the full object
17922
- restApi: loopNodeData.restApi,
17923
- customCode: loopNodeData.customCode,
17924
- ethTransfer: loopNodeData.ethTransfer,
17925
- contractRead: loopNodeData.contractRead,
17926
- contractWrite: loopNodeData.contractWrite,
17927
- graphqlDataQuery: loopNodeData.graphqlDataQuery
18233
+ // Extract runner data from the oneof runner field
18234
+ runner: this.extractRunnerFromProtobuf(loopNodeData),
18235
+ // Map execution mode from protobuf enum to ExecutionMode enum
18236
+ executionMode: this.mapExecutionModeFromProtobuf(
18237
+ configData?.executionMode
18238
+ )
17928
18239
  };
17929
18240
  let input = void 0;
17930
18241
  if (raw.hasInput()) {
@@ -17937,6 +18248,54 @@ var LoopNode2 = class _LoopNode extends Node {
17937
18248
  input
17938
18249
  });
17939
18250
  }
18251
+ static extractRunnerFromProtobuf(loopNodeData) {
18252
+ const runnerMapping = {
18253
+ restApi: "restApi",
18254
+ customCode: "customCode",
18255
+ ethTransfer: "ethTransfer",
18256
+ contractRead: "contractRead",
18257
+ contractWrite: "contractWrite",
18258
+ graphqlDataQuery: "graphqlDataQuery"
18259
+ };
18260
+ for (const [type, key] of Object.entries(runnerMapping)) {
18261
+ if (loopNodeData[key]) {
18262
+ return { type, data: loopNodeData[key] };
18263
+ }
18264
+ }
18265
+ return null;
18266
+ }
18267
+ static mapExecutionModeFromProtobuf(executionMode) {
18268
+ switch (executionMode) {
18269
+ case 0:
18270
+ return import_types17.ExecutionMode.Sequential;
18271
+ case 1:
18272
+ return import_types17.ExecutionMode.Parallel;
18273
+ default:
18274
+ return import_types17.ExecutionMode.Sequential;
18275
+ }
18276
+ }
18277
+ mapExecutionModeToProtobuf(executionMode) {
18278
+ if (!executionMode) {
18279
+ return 0;
18280
+ }
18281
+ if (typeof executionMode === "string") {
18282
+ switch (executionMode.toLowerCase()) {
18283
+ case "parallel":
18284
+ return 1;
18285
+ case "sequential":
18286
+ default:
18287
+ return 0;
18288
+ }
18289
+ } else {
18290
+ switch (executionMode) {
18291
+ case import_types17.ExecutionMode.Parallel:
18292
+ return 1;
18293
+ case import_types17.ExecutionMode.Sequential:
18294
+ default:
18295
+ return 0;
18296
+ }
18297
+ }
18298
+ }
17940
18299
  toRequest() {
17941
18300
  const node = new avs_pb17.TaskNode();
17942
18301
  const loopNode = new avs_pb17.LoopNode();
@@ -17947,113 +18306,103 @@ var LoopNode2 = class _LoopNode extends Node {
17947
18306
  config.setSourceId(data.sourceId || "");
17948
18307
  config.setIterVal(data.iterVal || "");
17949
18308
  config.setIterKey(data.iterKey || "");
18309
+ const executionMode = this.mapExecutionModeToProtobuf(data.executionMode);
18310
+ config.setExecutionMode(executionMode);
17950
18311
  loopNode.setConfig(config);
17951
18312
  const inputValue = convertInputToProtobuf(this.input);
17952
18313
  if (inputValue) {
17953
18314
  node.setInput(inputValue);
17954
18315
  }
17955
- if (data.ethTransfer) {
17956
- const ethTransfer = new avs_pb17.ETHTransferNode();
17957
- if (data.ethTransfer.config) {
17958
- const config2 = new avs_pb17.ETHTransferNode.Config();
17959
- config2.setDestination(data.ethTransfer.config.destination);
17960
- config2.setAmount(data.ethTransfer.config.amount);
17961
- ethTransfer.setConfig(config2);
17962
- }
17963
- loopNode.setEthTransfer(ethTransfer);
17964
- } else if (data.contractWrite) {
17965
- const contractWrite = new avs_pb17.ContractWriteNode();
17966
- if (data.contractWrite.config) {
17967
- const config2 = new avs_pb17.ContractWriteNode.Config();
17968
- config2.setContractAddress(
17969
- data.contractWrite.config.contractAddress
17970
- );
17971
- config2.setCallData(data.contractWrite.config.callData);
17972
- config2.setContractAbi(data.contractWrite.config.contractAbi);
17973
- const methodCalls = data.contractWrite.config.methodCallsList || [];
17974
- methodCalls.forEach(
17975
- (methodCall) => {
17976
- const methodCallMsg = new avs_pb17.ContractWriteNode.MethodCall();
17977
- methodCallMsg.setCallData(methodCall.callData);
17978
- if (methodCall.methodName) {
17979
- methodCallMsg.setMethodName(methodCall.methodName);
17980
- }
17981
- config2.addMethodCalls(methodCallMsg);
17982
- }
17983
- );
17984
- contractWrite.setConfig(config2);
17985
- }
17986
- loopNode.setContractWrite(contractWrite);
17987
- } else if (data.contractRead) {
17988
- const contractRead = new avs_pb17.ContractReadNode();
17989
- if (data.contractRead.config) {
17990
- const config2 = new avs_pb17.ContractReadNode.Config();
17991
- config2.setContractAddress(
17992
- data.contractRead.config.contractAddress
17993
- );
17994
- config2.setContractAbi(data.contractRead.config.contractAbi);
17995
- const methodCalls = data.contractRead.config.methodCallsList || [];
17996
- methodCalls.forEach(
17997
- (methodCall) => {
17998
- const methodCallMsg = new avs_pb17.ContractReadNode.MethodCall();
17999
- methodCallMsg.setCallData(methodCall.callData);
18000
- if (methodCall.methodName) {
18001
- methodCallMsg.setMethodName(methodCall.methodName);
18002
- }
18003
- if (methodCall.applyToFields) {
18004
- methodCallMsg.setApplyToFieldsList(methodCall.applyToFields);
18005
- }
18006
- config2.addMethodCalls(methodCallMsg);
18007
- }
18008
- );
18009
- contractRead.setConfig(config2);
18010
- }
18011
- loopNode.setContractRead(contractRead);
18012
- } else if (data.graphqlDataQuery) {
18013
- const graphqlQuery = new avs_pb17.GraphQLQueryNode();
18014
- if (data.graphqlDataQuery.config) {
18015
- const config2 = new avs_pb17.GraphQLQueryNode.Config();
18016
- config2.setUrl(data.graphqlDataQuery.config.url);
18017
- config2.setQuery(data.graphqlDataQuery.config.query);
18018
- if (data.graphqlDataQuery.config.variablesMap && data.graphqlDataQuery.config.variablesMap.length > 0) {
18019
- data.graphqlDataQuery.config.variablesMap.forEach(
18020
- ([key, value]) => {
18021
- config2.getVariablesMap().set(key, value);
18022
- }
18023
- );
18316
+ if (data.runner) {
18317
+ this.setRunnerOnProtobuf(loopNode, data.runner);
18318
+ }
18319
+ node.setLoop(loopNode);
18320
+ return node;
18321
+ }
18322
+ setRunnerOnProtobuf(loopNode, runner) {
18323
+ if (!runner || !runner.type || !runner.data) {
18324
+ return;
18325
+ }
18326
+ switch (runner.type) {
18327
+ case "ethTransfer": {
18328
+ const ethTransferData = runner.data;
18329
+ if (ethTransferData.config) {
18330
+ const ethConfig = ethTransferData.config;
18331
+ const ethTransfer = ethTransfer_default.createProtobufNode({
18332
+ destination: ethConfig.destination,
18333
+ amount: ethConfig.amount
18334
+ });
18335
+ loopNode.setEthTransfer(ethTransfer);
18024
18336
  }
18025
- graphqlQuery.setConfig(config2);
18026
- }
18027
- loopNode.setGraphqlDataQuery(graphqlQuery);
18028
- } else if (data.restApi) {
18029
- const restApi = new avs_pb17.RestAPINode();
18030
- if (data.restApi.config) {
18031
- const config2 = new avs_pb17.RestAPINode.Config();
18032
- config2.setUrl(data.restApi.config.url);
18033
- config2.setMethod(data.restApi.config.method);
18034
- config2.setBody(data.restApi.config.body || "");
18035
- if (data.restApi.config.headersMap && data.restApi.config.headersMap.length > 0) {
18036
- data.restApi.config.headersMap.forEach(
18037
- ([key, value]) => {
18038
- config2.getHeadersMap().set(key, value);
18039
- }
18040
- );
18337
+ break;
18338
+ }
18339
+ case "contractWrite": {
18340
+ const contractWriteData = runner.data;
18341
+ if (contractWriteData.config) {
18342
+ const writeConfig = contractWriteData.config;
18343
+ const contractWrite = contractWrite_default.createProtobufNode({
18344
+ contractAddress: writeConfig.contractAddress,
18345
+ callData: writeConfig.callData,
18346
+ contractAbi: writeConfig.contractAbi,
18347
+ methodCalls: writeConfig.methodCallsList || []
18348
+ });
18349
+ loopNode.setContractWrite(contractWrite);
18350
+ }
18351
+ break;
18352
+ }
18353
+ case "contractRead": {
18354
+ const contractReadData = runner.data;
18355
+ if (contractReadData.config) {
18356
+ const readConfig = contractReadData.config;
18357
+ const contractRead = contractRead_default.createProtobufNode({
18358
+ contractAddress: readConfig.contractAddress,
18359
+ contractAbi: readConfig.contractAbi,
18360
+ methodCalls: readConfig.methodCallsList || []
18361
+ });
18362
+ loopNode.setContractRead(contractRead);
18041
18363
  }
18042
- restApi.setConfig(config2);
18364
+ break;
18365
+ }
18366
+ case "graphqlDataQuery": {
18367
+ const graphqlData = runner.data;
18368
+ if (graphqlData.config) {
18369
+ const gqlConfig = graphqlData.config;
18370
+ const graphqlQuery = graphqlQuery_default.createProtobufNode({
18371
+ url: gqlConfig.url,
18372
+ query: gqlConfig.query,
18373
+ variablesMap: gqlConfig.variablesMap
18374
+ });
18375
+ loopNode.setGraphqlDataQuery(graphqlQuery);
18376
+ }
18377
+ break;
18378
+ }
18379
+ case "restApi": {
18380
+ const restApiData = runner.data;
18381
+ if (restApiData.config) {
18382
+ const apiConfig = restApiData.config;
18383
+ const restApi = restApi_default.createProtobufNode({
18384
+ url: apiConfig.url,
18385
+ method: apiConfig.method,
18386
+ body: apiConfig.body || "",
18387
+ headersMap: apiConfig.headersMap
18388
+ });
18389
+ loopNode.setRestApi(restApi);
18390
+ }
18391
+ break;
18043
18392
  }
18044
- loopNode.setRestApi(restApi);
18045
- } else if (data.customCode) {
18046
- const customCode = new avs_pb17.CustomCodeNode();
18047
- if (data.customCode.config) {
18048
- const config2 = new avs_pb17.CustomCodeNode.Config();
18049
- config2.setLang(data.customCode.config.lang);
18050
- config2.setSource(data.customCode.config.source);
18051
- customCode.setConfig(config2);
18393
+ case "customCode": {
18394
+ const customCodeData = runner.data;
18395
+ if (customCodeData.config) {
18396
+ const codeConfig = customCodeData.config;
18397
+ const customCode = customCode_default.createProtobufNode({
18398
+ lang: codeConfig.lang,
18399
+ source: codeConfig.source
18400
+ });
18401
+ loopNode.setCustomCode(customCode);
18402
+ }
18403
+ break;
18052
18404
  }
18053
- loopNode.setCustomCode(customCode);
18054
18405
  }
18055
- node.setLoop(loopNode);
18056
- return node;
18057
18406
  }
18058
18407
  static fromOutputData(outputData) {
18059
18408
  const customCodeOutput = outputData.getCustomCode();
@@ -18070,7 +18419,7 @@ var LoopNode2 = class _LoopNode extends Node {
18070
18419
  if (loopObj.data && typeof loopObj.data === "string") {
18071
18420
  try {
18072
18421
  return JSON.parse(loopObj.data);
18073
- } catch (e) {
18422
+ } catch {
18074
18423
  return loopObj.data;
18075
18424
  }
18076
18425
  }
@@ -18300,7 +18649,6 @@ var Workflow = class _Workflow {
18300
18649
  if (this.name) {
18301
18650
  request.setName(this.name);
18302
18651
  }
18303
- console.log(`\u{1F4E4} Workflow serialization: ${this.nodes.length} nodes, ${this.edges.length} edges -> protobuf: ${request.getNodesList().length} nodes, ${request.getEdgesList().length} edges`);
18304
18652
  return request;
18305
18653
  }
18306
18654
  /**
@@ -18399,44 +18747,210 @@ var Step = class _Step {
18399
18747
  return void 0;
18400
18748
  // Trigger outputs
18401
18749
  case avs_pb20.Execution.Step.OutputDataCase.BLOCK_TRIGGER:
18402
- return typeof step.getBlockTrigger === "function" ? step.getBlockTrigger()?.toObject() : step.blockTrigger;
18750
+ const blockTrigger = typeof step.getBlockTrigger === "function" ? step.getBlockTrigger()?.toObject() : step.blockTrigger;
18751
+ return { data: blockTrigger };
18752
+ // ✅ Use standard structure
18403
18753
  case avs_pb20.Execution.Step.OutputDataCase.FIXED_TIME_TRIGGER:
18404
- return typeof step.getFixedTimeTrigger === "function" ? step.getFixedTimeTrigger()?.toObject() : step.fixedTimeTrigger;
18754
+ const fixedTimeTrigger = typeof step.getFixedTimeTrigger === "function" ? step.getFixedTimeTrigger()?.toObject() : step.fixedTimeTrigger;
18755
+ return { data: fixedTimeTrigger };
18756
+ // ✅ Use standard structure
18405
18757
  case avs_pb20.Execution.Step.OutputDataCase.CRON_TRIGGER:
18406
- return typeof step.getCronTrigger === "function" ? step.getCronTrigger()?.toObject() : step.cronTrigger;
18758
+ const cronTrigger = typeof step.getCronTrigger === "function" ? step.getCronTrigger()?.toObject() : step.cronTrigger;
18759
+ return { data: cronTrigger };
18760
+ // ✅ Use standard structure
18407
18761
  case avs_pb20.Execution.Step.OutputDataCase.EVENT_TRIGGER:
18408
18762
  const eventTrigger = typeof step.getEventTrigger === "function" ? step.getEventTrigger() : step.eventTrigger;
18409
18763
  if (eventTrigger) {
18410
18764
  if (typeof eventTrigger.hasData === "function" && eventTrigger.hasData()) {
18411
18765
  try {
18412
- return convertProtobufValueToJs(eventTrigger.getData());
18766
+ const eventData = convertProtobufValueToJs(
18767
+ eventTrigger.getData()
18768
+ );
18769
+ return { data: eventData };
18413
18770
  } catch (error) {
18414
18771
  console.warn(
18415
18772
  "Failed to convert event trigger data from protobuf Value:",
18416
18773
  error
18417
18774
  );
18418
- return eventTrigger.getData();
18775
+ return { data: eventTrigger.getData() };
18419
18776
  }
18420
18777
  } else if (eventTrigger.data) {
18421
- return typeof eventTrigger.data.getKindCase === "function" ? convertProtobufValueToJs(eventTrigger.data) : eventTrigger.data;
18778
+ const eventData = typeof eventTrigger.data.getKindCase === "function" ? convertProtobufValueToJs(eventTrigger.data) : eventTrigger.data;
18779
+ return { data: eventData };
18422
18780
  }
18423
18781
  if (typeof eventTrigger.hasEvmLog === "function" && eventTrigger.hasEvmLog()) {
18424
- return eventTrigger.getEvmLog()?.toObject();
18782
+ return { data: eventTrigger.getEvmLog()?.toObject() };
18425
18783
  } else if (typeof eventTrigger.hasTransferLog === "function" && eventTrigger.hasTransferLog()) {
18426
- return eventTrigger.getTransferLog()?.toObject();
18784
+ return { data: eventTrigger.getTransferLog()?.toObject() };
18427
18785
  } else if (eventTrigger.evmLog) {
18428
- return eventTrigger.evmLog;
18786
+ return { data: eventTrigger.evmLog };
18429
18787
  } else if (eventTrigger.transferLog) {
18430
- return eventTrigger.transferLog;
18788
+ return { data: eventTrigger.transferLog };
18431
18789
  }
18432
18790
  }
18433
- return void 0;
18434
- case avs_pb20.Execution.Step.OutputDataCase.MANUAL_TRIGGER:
18435
- return typeof step.getManualTrigger === "function" ? step.getManualTrigger()?.toObject() || void 0 : step.manualTrigger;
18791
+ return { data: null };
18792
+ // ✅ Use standard structure
18793
+ case avs_pb20.Execution.Step.OutputDataCase.MANUAL_TRIGGER: {
18794
+ const manualTrigger = typeof step.getManualTrigger === "function" ? step.getManualTrigger() : step.manualTrigger;
18795
+ if (manualTrigger) {
18796
+ const result = {};
18797
+ if (typeof manualTrigger.hasData === "function" && manualTrigger.hasData()) {
18798
+ try {
18799
+ const userData = convertProtobufValueToJs(
18800
+ manualTrigger.getData()
18801
+ );
18802
+ if (userData && typeof userData === "object" && userData.data !== void 0 && (userData.headers !== void 0 || userData.pathParams !== void 0)) {
18803
+ result.data = userData.data;
18804
+ if (userData.headers) {
18805
+ if (Array.isArray(userData.headers)) {
18806
+ if (userData.headers.length > 0 && Array.isArray(userData.headers[0])) {
18807
+ result.headers = userData.headers;
18808
+ } else {
18809
+ const headersArray = [];
18810
+ for (const header of userData.headers) {
18811
+ for (const [key, value] of Object.entries(header)) {
18812
+ headersArray.push([key, value]);
18813
+ }
18814
+ }
18815
+ result.headers = headersArray;
18816
+ }
18817
+ } else {
18818
+ const headersArray = [];
18819
+ for (const [key, value] of Object.entries(userData.headers)) {
18820
+ headersArray.push([key, value]);
18821
+ }
18822
+ result.headers = headersArray;
18823
+ }
18824
+ }
18825
+ if (userData.pathParams) {
18826
+ if (Array.isArray(userData.pathParams)) {
18827
+ if (userData.pathParams.length > 0 && Array.isArray(userData.pathParams[0])) {
18828
+ result.pathParams = userData.pathParams;
18829
+ } else {
18830
+ const pathParamsArray = [];
18831
+ for (const pathParam of userData.pathParams) {
18832
+ for (const [key, value] of Object.entries(pathParam)) {
18833
+ pathParamsArray.push([key, value]);
18834
+ }
18835
+ }
18836
+ result.pathParams = pathParamsArray;
18837
+ }
18838
+ } else {
18839
+ const pathParamsArray = [];
18840
+ for (const [key, value] of Object.entries(userData.pathParams)) {
18841
+ pathParamsArray.push([key, value]);
18842
+ }
18843
+ result.pathParams = pathParamsArray;
18844
+ }
18845
+ }
18846
+ } else {
18847
+ result.data = userData;
18848
+ }
18849
+ } catch (error) {
18850
+ console.warn(
18851
+ "Failed to convert manual trigger data from protobuf Value:",
18852
+ error
18853
+ );
18854
+ result.data = manualTrigger.getData();
18855
+ }
18856
+ } else if (manualTrigger.data) {
18857
+ const userData = typeof manualTrigger.data.getKindCase === "function" ? convertProtobufValueToJs(manualTrigger.data) : manualTrigger.data;
18858
+ if (userData && typeof userData === "object" && userData.data !== void 0 && (userData.headers !== void 0 || userData.pathParams !== void 0)) {
18859
+ result.data = userData.data;
18860
+ if (userData.headers) {
18861
+ if (Array.isArray(userData.headers)) {
18862
+ if (userData.headers.length > 0 && Array.isArray(userData.headers[0])) {
18863
+ result.headers = userData.headers;
18864
+ } else {
18865
+ const headersArray = [];
18866
+ for (const header of userData.headers) {
18867
+ for (const [key, value] of Object.entries(header)) {
18868
+ headersArray.push([key, value]);
18869
+ }
18870
+ }
18871
+ result.headers = headersArray;
18872
+ }
18873
+ } else {
18874
+ const headersArray = [];
18875
+ for (const [key, value] of Object.entries(userData.headers)) {
18876
+ headersArray.push([key, value]);
18877
+ }
18878
+ result.headers = headersArray;
18879
+ }
18880
+ }
18881
+ if (userData.pathParams) {
18882
+ if (Array.isArray(userData.pathParams)) {
18883
+ if (userData.pathParams.length > 0 && Array.isArray(userData.pathParams[0])) {
18884
+ result.pathParams = userData.pathParams;
18885
+ } else {
18886
+ const pathParamsArray = [];
18887
+ for (const pathParam of userData.pathParams) {
18888
+ for (const [key, value] of Object.entries(pathParam)) {
18889
+ pathParamsArray.push([key, value]);
18890
+ }
18891
+ }
18892
+ result.pathParams = pathParamsArray;
18893
+ }
18894
+ } else {
18895
+ const pathParamsArray = [];
18896
+ for (const [key, value] of Object.entries(userData.pathParams)) {
18897
+ pathParamsArray.push([key, value]);
18898
+ }
18899
+ result.pathParams = pathParamsArray;
18900
+ }
18901
+ }
18902
+ } else {
18903
+ result.data = userData;
18904
+ }
18905
+ }
18906
+ if (typeof manualTrigger.getHeadersMap === "function") {
18907
+ const headersMap = manualTrigger.getHeadersMap();
18908
+ if (headersMap && headersMap.getLength() > 0) {
18909
+ const headersArray = [];
18910
+ headersMap.forEach((value, key) => {
18911
+ headersArray.push([key, value]);
18912
+ });
18913
+ result.headers = headersArray;
18914
+ }
18915
+ } else if (manualTrigger.headers) {
18916
+ const headersArray = [];
18917
+ for (const [key, value] of Object.entries(manualTrigger.headers)) {
18918
+ headersArray.push([key, value]);
18919
+ }
18920
+ result.headers = headersArray;
18921
+ }
18922
+ if (typeof manualTrigger.getPathparamsMap === "function") {
18923
+ const pathParamsMap = manualTrigger.getPathparamsMap();
18924
+ if (pathParamsMap && pathParamsMap.getLength() > 0) {
18925
+ const pathParamsArray = [];
18926
+ pathParamsMap.forEach((value, key) => {
18927
+ pathParamsArray.push([key, value]);
18928
+ });
18929
+ result.pathParams = pathParamsArray;
18930
+ }
18931
+ } else if (manualTrigger.pathparams) {
18932
+ const pathParamsArray = [];
18933
+ for (const [key, value] of Object.entries(manualTrigger.pathparams)) {
18934
+ pathParamsArray.push([key, value]);
18935
+ }
18936
+ result.pathParams = pathParamsArray;
18937
+ }
18938
+ if (Object.keys(result).length === 0) {
18939
+ const objData = manualTrigger.toObject?.() || manualTrigger;
18940
+ if (objData && objData.data === void 0) {
18941
+ result.data = null;
18942
+ } else {
18943
+ return { data: objData };
18944
+ }
18945
+ }
18946
+ return result;
18947
+ }
18948
+ return { data: null };
18949
+ }
18436
18950
  // Node outputs - RESTORE MISSING CASES
18437
18951
  case avs_pb20.Execution.Step.OutputDataCase.ETH_TRANSFER:
18438
18952
  return typeof step.getEthTransfer === "function" ? step.getEthTransfer()?.toObject() : step.ethTransfer;
18439
- case avs_pb20.Execution.Step.OutputDataCase.CUSTOM_CODE:
18953
+ case avs_pb20.Execution.Step.OutputDataCase.CUSTOM_CODE: {
18440
18954
  const customCodeOutput = typeof step.getCustomCode === "function" ? step.getCustomCode() : step.customCode;
18441
18955
  if (customCodeOutput) {
18442
18956
  if (typeof customCodeOutput.hasData === "function" && customCodeOutput.hasData()) {
@@ -18450,7 +18964,8 @@ var Step = class _Step {
18450
18964
  }
18451
18965
  }
18452
18966
  return void 0;
18453
- case avs_pb20.Execution.Step.OutputDataCase.REST_API:
18967
+ }
18968
+ case avs_pb20.Execution.Step.OutputDataCase.REST_API: {
18454
18969
  const restApiOutput = typeof step.getRestApi === "function" ? step.getRestApi() : step.restApi;
18455
18970
  if (restApiOutput) {
18456
18971
  if (typeof restApiOutput.hasData === "function" && restApiOutput.hasData()) {
@@ -18464,9 +18979,10 @@ var Step = class _Step {
18464
18979
  }
18465
18980
  }
18466
18981
  return void 0;
18982
+ }
18467
18983
  case avs_pb20.Execution.Step.OutputDataCase.BRANCH:
18468
18984
  return typeof step.getBranch === "function" ? step.getBranch()?.toObject() : step.branch;
18469
- case avs_pb20.Execution.Step.OutputDataCase.LOOP:
18985
+ case avs_pb20.Execution.Step.OutputDataCase.LOOP: {
18470
18986
  const loopOutput = typeof step.getLoop === "function" ? step.getLoop() : step.loop;
18471
18987
  if (loopOutput) {
18472
18988
  if (typeof loopOutput.getData === "function" && loopOutput.getData()) {
@@ -18484,7 +19000,8 @@ var Step = class _Step {
18484
19000
  }
18485
19001
  }
18486
19002
  return void 0;
18487
- case avs_pb20.Execution.Step.OutputDataCase.GRAPHQL:
19003
+ }
19004
+ case avs_pb20.Execution.Step.OutputDataCase.GRAPHQL: {
18488
19005
  const graphqlOutput = typeof step.getGraphql === "function" ? step.getGraphql() : step.graphql;
18489
19006
  if (graphqlOutput) {
18490
19007
  try {
@@ -18494,7 +19011,8 @@ var Step = class _Step {
18494
19011
  }
18495
19012
  }
18496
19013
  return void 0;
18497
- case avs_pb20.Execution.Step.OutputDataCase.CONTRACT_READ:
19014
+ }
19015
+ case avs_pb20.Execution.Step.OutputDataCase.CONTRACT_READ: {
18498
19016
  const contractReadOutput = typeof step.getContractRead === "function" ? step.getContractRead() : step.contractRead;
18499
19017
  if (contractReadOutput) {
18500
19018
  if (typeof contractReadOutput.hasData === "function" && contractReadOutput.hasData()) {
@@ -18534,7 +19052,8 @@ var Step = class _Step {
18534
19052
  return outputObj;
18535
19053
  }
18536
19054
  return void 0;
18537
- case avs_pb20.Execution.Step.OutputDataCase.CONTRACT_WRITE:
19055
+ }
19056
+ case avs_pb20.Execution.Step.OutputDataCase.CONTRACT_WRITE: {
18538
19057
  const contractWriteOutput = typeof step.getContractWrite === "function" ? step.getContractWrite() : step.contractWrite;
18539
19058
  if (contractWriteOutput) {
18540
19059
  if (typeof contractWriteOutput.hasData === "function" && contractWriteOutput.hasData()) {
@@ -18577,7 +19096,8 @@ var Step = class _Step {
18577
19096
  return outputObj;
18578
19097
  }
18579
19098
  return void 0;
18580
- case avs_pb20.Execution.Step.OutputDataCase.FILTER:
19099
+ }
19100
+ case avs_pb20.Execution.Step.OutputDataCase.FILTER: {
18581
19101
  const filterOutput = typeof step.getFilter === "function" ? step.getFilter() : step.filter;
18582
19102
  if (filterOutput) {
18583
19103
  try {
@@ -18587,6 +19107,7 @@ var Step = class _Step {
18587
19107
  }
18588
19108
  }
18589
19109
  return void 0;
19110
+ }
18590
19111
  default:
18591
19112
  console.warn(
18592
19113
  `Unhandled output data type in Step.getOutput: ${step.getOutputDataCase()}`
@@ -19285,7 +19806,22 @@ var Client = class extends BaseClient {
19285
19806
  case import_types20.TriggerType.Manual: {
19286
19807
  const manualData = triggerData;
19287
19808
  const manualOutput = new avs_pb22.ManualTrigger.Output();
19288
- if (manualData.runAt) manualOutput.setRunAt(manualData.runAt);
19809
+ if (manualData.data) {
19810
+ const protobufValue = convertJSValueToProtobuf(manualData.data);
19811
+ manualOutput.setData(protobufValue);
19812
+ }
19813
+ if (manualData.headersMap) {
19814
+ const headersMap = manualOutput.getHeadersMap();
19815
+ manualData.headersMap.forEach(([key, value]) => {
19816
+ headersMap.set(key, value);
19817
+ });
19818
+ }
19819
+ if (manualData.pathParamsMap) {
19820
+ const pathParamsMap = manualOutput.getPathparamsMap();
19821
+ manualData.pathParamsMap.forEach(([key, value]) => {
19822
+ pathParamsMap.set(key, value);
19823
+ });
19824
+ }
19289
19825
  request.setManualTrigger(manualOutput);
19290
19826
  break;
19291
19827
  }