@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.mjs 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
  };
@@ -17259,59 +17425,136 @@ var fixedTime_default = FixedTimeTrigger2;
17259
17425
 
17260
17426
  // src/models/trigger/manual.ts
17261
17427
  var avs_pb6 = __toESM(require_avs_pb());
17262
- import { TriggerType as TriggerType11 } from "@avaprotocol/types";
17263
- var ManualTrigger = class _ManualTrigger extends Trigger {
17428
+ import {
17429
+ TriggerType as TriggerType11
17430
+ } from "@avaprotocol/types";
17431
+ var ManualTrigger2 = class _ManualTrigger extends Trigger {
17264
17432
  constructor(props) {
17265
- super({ ...props, type: TriggerType11.Manual, data: props.data || null });
17433
+ super({
17434
+ ...props,
17435
+ type: TriggerType11.Manual,
17436
+ data: props.data,
17437
+ input: props.input
17438
+ });
17439
+ this.headersMap = props.headersMap;
17440
+ this.pathParamsMap = props.pathParamsMap;
17266
17441
  }
17267
17442
  toRequest() {
17268
17443
  const trigger = new avs_pb6.TaskTrigger();
17269
17444
  trigger.setId(this.id);
17270
17445
  trigger.setName(this.name);
17271
17446
  trigger.setType(avs_pb6.TriggerType.TRIGGER_TYPE_MANUAL);
17272
- trigger.setManual(true);
17273
- const inputValue = convertInputToProtobuf(this.input);
17274
- if (inputValue) {
17275
- trigger.setInput(inputValue);
17447
+ const manualTrigger = new avs_pb6.ManualTrigger();
17448
+ const config = new avs_pb6.ManualTrigger.Config();
17449
+ const dataToSend = this.data ?? this.input;
17450
+ if (dataToSend !== null && dataToSend !== void 0) {
17451
+ const inputValue = convertInputToProtobuf(dataToSend);
17452
+ if (inputValue) {
17453
+ config.setData(inputValue);
17454
+ }
17455
+ }
17456
+ if (this.headersMap && this.headersMap.length > 0) {
17457
+ const headersMap = config.getHeadersMap();
17458
+ this.headersMap.forEach(([key, value]) => {
17459
+ headersMap.set(key, value);
17460
+ });
17276
17461
  }
17462
+ if (this.pathParamsMap && this.pathParamsMap.length > 0) {
17463
+ const pathParamsMap = config.getPathparamsMap();
17464
+ this.pathParamsMap.forEach(([key, value]) => {
17465
+ pathParamsMap.set(key, value);
17466
+ });
17467
+ }
17468
+ manualTrigger.setConfig(config);
17469
+ trigger.setManual(manualTrigger);
17277
17470
  return trigger;
17278
17471
  }
17279
17472
  static fromResponse(raw) {
17280
17473
  const obj = raw.toObject();
17281
- let input = void 0;
17282
- if (raw.hasInput()) {
17283
- input = extractInputFromProtobuf(raw.getInput());
17474
+ let data = null;
17475
+ const input = void 0;
17476
+ let headersMap = void 0;
17477
+ let pathParamsMap = void 0;
17478
+ const manualTrigger = raw.getManual();
17479
+ if (manualTrigger) {
17480
+ const config = manualTrigger.getConfig();
17481
+ if (config) {
17482
+ if (config.hasData()) {
17483
+ data = extractInputFromProtobuf(config.getData());
17484
+ }
17485
+ const headersMapProto = config.getHeadersMap();
17486
+ if (headersMapProto && headersMapProto.getLength() > 0) {
17487
+ headersMap = [];
17488
+ headersMapProto.forEach((value, key) => {
17489
+ headersMap.push([key, value]);
17490
+ });
17491
+ }
17492
+ const pathParamsMapProto = config.getPathparamsMap();
17493
+ if (pathParamsMapProto && pathParamsMapProto.getLength() > 0) {
17494
+ pathParamsMap = [];
17495
+ pathParamsMapProto.forEach((value, key) => {
17496
+ pathParamsMap.push([key, value]);
17497
+ });
17498
+ }
17499
+ }
17284
17500
  }
17285
17501
  return new _ManualTrigger({
17286
17502
  ...obj,
17287
17503
  type: TriggerType11.Manual,
17288
- data: null,
17289
- // Manual triggers don't have data in the protobuf response
17290
- input
17504
+ data,
17505
+ input,
17506
+ headersMap,
17507
+ pathParamsMap
17291
17508
  });
17292
17509
  }
17293
17510
  getInputVariables() {
17294
- return this.data;
17295
- }
17296
- /**
17297
- * Convert raw data from runTrigger response to ManualOutput format
17298
- * @param rawData - The raw data from the gRPC response
17299
- * @returns {ManualTriggerOutput | undefined} - The converted data
17300
- */
17301
- getOutput() {
17302
- return this.output;
17511
+ return this.input;
17303
17512
  }
17304
17513
  /**
17305
17514
  * Extract output data from RunTriggerResp for manual triggers
17306
17515
  * @param outputData - The RunTriggerResp containing manual trigger output
17307
- * @returns Plain JavaScript object with manual trigger data
17516
+ * @returns Plain JavaScript object with manual trigger data in standard structure
17308
17517
  */
17309
17518
  static fromOutputData(outputData) {
17310
17519
  const manualOutput = outputData.getManualTrigger();
17311
- return manualOutput?.toObject() || null;
17520
+ if (!manualOutput) {
17521
+ return null;
17522
+ }
17523
+ const result = {};
17524
+ const dataValue = manualOutput.getData();
17525
+ if (dataValue) {
17526
+ try {
17527
+ result.data = convertProtobufValueToJs(dataValue);
17528
+ } catch (error) {
17529
+ console.warn(
17530
+ "Failed to convert manual trigger data from protobuf Value:",
17531
+ error
17532
+ );
17533
+ result.data = dataValue;
17534
+ }
17535
+ } else {
17536
+ result.data = null;
17537
+ }
17538
+ const headersMapProto = manualOutput.getHeadersMap();
17539
+ if (headersMapProto && headersMapProto.getLength() > 0) {
17540
+ const headersArray = [];
17541
+ headersMapProto.forEach((value, key) => {
17542
+ headersArray.push([key, value]);
17543
+ });
17544
+ result.headers = headersArray;
17545
+ }
17546
+ const pathParamsMapProto = manualOutput.getPathparamsMap();
17547
+ if (pathParamsMapProto && pathParamsMapProto.getLength() > 0) {
17548
+ const pathParamsArray = [];
17549
+ pathParamsMapProto.forEach((value, key) => {
17550
+ pathParamsArray.push([key, value]);
17551
+ });
17552
+ result.pathParams = pathParamsArray;
17553
+ }
17554
+ return result;
17312
17555
  }
17313
17556
  };
17314
- var manual_default = ManualTrigger;
17557
+ var manual_default = ManualTrigger2;
17315
17558
 
17316
17559
  // src/models/trigger/factory.ts
17317
17560
  import {
@@ -17427,6 +17670,29 @@ var ContractWriteNode2 = class _ContractWriteNode extends Node {
17427
17670
  constructor(props) {
17428
17671
  super({ ...props, type: NodeType3.ContractWrite, data: props.data });
17429
17672
  }
17673
+ /**
17674
+ * Create a protobuf ContractWriteNode from config data
17675
+ * @param configData - The configuration data for the contract write node
17676
+ * @returns Configured avs_pb.ContractWriteNode
17677
+ */
17678
+ static createProtobufNode(configData) {
17679
+ const node = new avs_pb9.ContractWriteNode();
17680
+ const config = new avs_pb9.ContractWriteNode.Config();
17681
+ config.setContractAddress(configData.contractAddress);
17682
+ config.setCallData(configData.callData);
17683
+ config.setContractAbi(configData.contractAbi);
17684
+ const methodCalls = configData.methodCalls || [];
17685
+ methodCalls.forEach((methodCall) => {
17686
+ const methodCallMsg = new avs_pb9.ContractWriteNode.MethodCall();
17687
+ methodCallMsg.setCallData(methodCall.callData);
17688
+ if (methodCall.methodName) {
17689
+ methodCallMsg.setMethodName(methodCall.methodName);
17690
+ }
17691
+ config.addMethodCalls(methodCallMsg);
17692
+ });
17693
+ node.setConfig(config);
17694
+ return node;
17695
+ }
17430
17696
  static fromResponse(raw) {
17431
17697
  const obj = raw.toObject();
17432
17698
  const protobufData = raw.getContractWrite().getConfig().toObject();
@@ -17454,25 +17720,9 @@ var ContractWriteNode2 = class _ContractWriteNode extends Node {
17454
17720
  const request = new avs_pb9.TaskNode();
17455
17721
  request.setId(this.id);
17456
17722
  request.setName(this.name);
17457
- const node = new avs_pb9.ContractWriteNode();
17458
- const config = new avs_pb9.ContractWriteNode.Config();
17459
- config.setContractAddress(
17460
- this.data.contractAddress
17461
- );
17462
- config.setCallData(this.data.callData);
17463
- config.setContractAbi(this.data.contractAbi);
17464
- const methodCalls = this.data.methodCalls || [];
17465
- methodCalls.forEach(
17466
- (methodCall) => {
17467
- const methodCallMsg = new avs_pb9.ContractWriteNode.MethodCall();
17468
- methodCallMsg.setCallData(methodCall.callData);
17469
- if (methodCall.methodName) {
17470
- methodCallMsg.setMethodName(methodCall.methodName);
17471
- }
17472
- config.addMethodCalls(methodCallMsg);
17473
- }
17723
+ const node = _ContractWriteNode.createProtobufNode(
17724
+ this.data
17474
17725
  );
17475
- node.setConfig(config);
17476
17726
  const inputValue = convertInputToProtobuf(this.input);
17477
17727
  if (inputValue) {
17478
17728
  request.setInput(inputValue);
@@ -17500,6 +17750,19 @@ var CustomCodeNode2 = class _CustomCodeNode extends Node {
17500
17750
  constructor(props) {
17501
17751
  super({ ...props, type: NodeType4.CustomCode, data: props.data });
17502
17752
  }
17753
+ /**
17754
+ * Create a protobuf CustomCodeNode from config data
17755
+ * @param configData - The configuration data for the custom code node
17756
+ * @returns Configured avs_pb.CustomCodeNode
17757
+ */
17758
+ static createProtobufNode(configData) {
17759
+ const node = new avs_pb10.CustomCodeNode();
17760
+ const config = new avs_pb10.CustomCodeNode.Config();
17761
+ config.setLang(configData.lang);
17762
+ config.setSource(configData.source);
17763
+ node.setConfig(config);
17764
+ return node;
17765
+ }
17503
17766
  static fromResponse(raw) {
17504
17767
  const obj = raw.toObject();
17505
17768
  const rawConfig = raw.getCustomCode().getConfig().toObject();
@@ -17522,11 +17785,9 @@ var CustomCodeNode2 = class _CustomCodeNode extends Node {
17522
17785
  const request = new avs_pb10.TaskNode();
17523
17786
  request.setId(this.id);
17524
17787
  request.setName(this.name);
17525
- const node = new avs_pb10.CustomCodeNode();
17526
- const config = new avs_pb10.CustomCodeNode.Config();
17527
- config.setLang(this.data.lang);
17528
- config.setSource(this.data.source);
17529
- node.setConfig(config);
17788
+ const node = _CustomCodeNode.createProtobufNode(
17789
+ this.data
17790
+ );
17530
17791
  const inputValue = convertInputToProtobuf(this.input);
17531
17792
  if (inputValue) {
17532
17793
  request.setInput(inputValue);
@@ -17559,6 +17820,25 @@ var GraphQLQueryNode2 = class _GraphQLQueryNode extends Node {
17559
17820
  data: props.data
17560
17821
  });
17561
17822
  }
17823
+ /**
17824
+ * Create a protobuf GraphQLQueryNode from config data
17825
+ * @param configData - The configuration data for the GraphQL query node
17826
+ * @returns Configured avs_pb.GraphQLQueryNode
17827
+ */
17828
+ static createProtobufNode(configData) {
17829
+ const node = new avs_pb11.GraphQLQueryNode();
17830
+ const config = new avs_pb11.GraphQLQueryNode.Config();
17831
+ config.setUrl(configData.url);
17832
+ config.setQuery(configData.query);
17833
+ if (configData.variablesMap && configData.variablesMap.length > 0) {
17834
+ const variablesMap = config.getVariablesMap();
17835
+ configData.variablesMap.forEach(([key, value]) => {
17836
+ variablesMap.set(key, value);
17837
+ });
17838
+ }
17839
+ node.setConfig(config);
17840
+ return node;
17841
+ }
17562
17842
  static fromResponse(raw) {
17563
17843
  const obj = raw.toObject();
17564
17844
  const input = extractInputFromProtobuf(raw.getGraphqlQuery()?.getInput());
@@ -17573,17 +17853,9 @@ var GraphQLQueryNode2 = class _GraphQLQueryNode extends Node {
17573
17853
  const request = new avs_pb11.TaskNode();
17574
17854
  request.setId(this.id);
17575
17855
  request.setName(this.name);
17576
- const node = new avs_pb11.GraphQLQueryNode();
17577
- const config = new avs_pb11.GraphQLQueryNode.Config();
17578
- config.setUrl(this.data.url);
17579
- config.setQuery(this.data.query);
17580
- if (this.data.variablesMap && this.data.variablesMap.length > 0) {
17581
- const variablesMap = config.getVariablesMap();
17582
- this.data.variablesMap.forEach(([key, value]) => {
17583
- variablesMap.set(key, value);
17584
- });
17585
- }
17586
- node.setConfig(config);
17856
+ const node = _GraphQLQueryNode.createProtobufNode(
17857
+ this.data
17858
+ );
17587
17859
  const inputValue = convertInputToProtobuf(this.input);
17588
17860
  if (inputValue) {
17589
17861
  node.setInput(inputValue);
@@ -17607,6 +17879,26 @@ var RestAPINode2 = class _RestAPINode extends Node {
17607
17879
  constructor(props) {
17608
17880
  super({ ...props, type: NodeType6.RestAPI, data: props.data });
17609
17881
  }
17882
+ /**
17883
+ * Create a protobuf RestAPINode from config data
17884
+ * @param configData - The configuration data for the REST API node
17885
+ * @returns Configured avs_pb.RestAPINode
17886
+ */
17887
+ static createProtobufNode(configData) {
17888
+ const node = new avs_pb12.RestAPINode();
17889
+ const config = new avs_pb12.RestAPINode.Config();
17890
+ config.setUrl(configData.url);
17891
+ config.setMethod(configData.method);
17892
+ config.setBody(configData.body || "");
17893
+ if (configData.headersMap && configData.headersMap.length > 0) {
17894
+ const headersMap = config.getHeadersMap();
17895
+ configData.headersMap.forEach(([key, value]) => {
17896
+ headersMap.set(key, value);
17897
+ });
17898
+ }
17899
+ node.setConfig(config);
17900
+ return node;
17901
+ }
17610
17902
  static fromResponse(raw) {
17611
17903
  const obj = raw.toObject();
17612
17904
  let input = void 0;
@@ -17625,20 +17917,9 @@ var RestAPINode2 = class _RestAPINode extends Node {
17625
17917
  const request = new avs_pb12.TaskNode();
17626
17918
  request.setId(this.id);
17627
17919
  request.setName(this.name);
17628
- const nodeData = new avs_pb12.RestAPINode();
17629
- const config = new avs_pb12.RestAPINode.Config();
17630
- config.setUrl(this.data.url);
17631
- config.setMethod(this.data.method);
17632
- config.setBody(this.data.body || "");
17633
- if (this.data.headersMap && this.data.headersMap.length > 0) {
17634
- const headersMap = config.getHeadersMap();
17635
- this.data.headersMap.forEach(
17636
- ([key, value]) => {
17637
- headersMap.set(key, value);
17638
- }
17639
- );
17640
- }
17641
- nodeData.setConfig(config);
17920
+ const nodeData = _RestAPINode.createProtobufNode(
17921
+ this.data
17922
+ );
17642
17923
  const inputValue = convertInputToProtobuf(this.input);
17643
17924
  if (inputValue) {
17644
17925
  request.setInput(inputValue);
@@ -17670,6 +17951,31 @@ var ContractReadNode2 = class _ContractReadNode extends Node {
17670
17951
  constructor(props) {
17671
17952
  super({ ...props, type: NodeType7.ContractRead, data: props.data });
17672
17953
  }
17954
+ /**
17955
+ * Create a protobuf ContractReadNode from config data
17956
+ * @param configData - The configuration data for the contract read node
17957
+ * @returns Configured avs_pb.ContractReadNode
17958
+ */
17959
+ static createProtobufNode(configData) {
17960
+ const node = new avs_pb13.ContractReadNode();
17961
+ const config = new avs_pb13.ContractReadNode.Config();
17962
+ config.setContractAddress(configData.contractAddress);
17963
+ config.setContractAbi(configData.contractAbi);
17964
+ const methodCalls = configData.methodCalls || [];
17965
+ methodCalls.forEach((methodCall) => {
17966
+ const methodCallMsg = new avs_pb13.ContractReadNode.MethodCall();
17967
+ methodCallMsg.setCallData(methodCall.callData);
17968
+ if (methodCall.methodName) {
17969
+ methodCallMsg.setMethodName(methodCall.methodName);
17970
+ }
17971
+ if (methodCall.applyToFields) {
17972
+ methodCallMsg.setApplyToFieldsList(methodCall.applyToFields);
17973
+ }
17974
+ config.addMethodCalls(methodCallMsg);
17975
+ });
17976
+ node.setConfig(config);
17977
+ return node;
17978
+ }
17673
17979
  static fromResponse(raw) {
17674
17980
  const obj = raw.toObject();
17675
17981
  const protobufData = raw.getContractRead().getConfig().toObject();
@@ -17697,27 +18003,9 @@ var ContractReadNode2 = class _ContractReadNode extends Node {
17697
18003
  const request = new avs_pb13.TaskNode();
17698
18004
  request.setId(this.id);
17699
18005
  request.setName(this.name);
17700
- const node = new avs_pb13.ContractReadNode();
17701
- const config = new avs_pb13.ContractReadNode.Config();
17702
- config.setContractAddress(
17703
- this.data.contractAddress
18006
+ const node = _ContractReadNode.createProtobufNode(
18007
+ this.data
17704
18008
  );
17705
- config.setContractAbi(this.data.contractAbi);
17706
- const methodCalls = this.data.methodCalls || [];
17707
- methodCalls.forEach(
17708
- (methodCall) => {
17709
- const methodCallMsg = new avs_pb13.ContractReadNode.MethodCall();
17710
- methodCallMsg.setCallData(methodCall.callData);
17711
- if (methodCall.methodName) {
17712
- methodCallMsg.setMethodName(methodCall.methodName);
17713
- }
17714
- if (methodCall.applyToFields) {
17715
- methodCallMsg.setApplyToFieldsList(methodCall.applyToFields);
17716
- }
17717
- config.addMethodCalls(methodCallMsg);
17718
- }
17719
- );
17720
- node.setConfig(config);
17721
18009
  const inputValue = convertInputToProtobuf(this.input);
17722
18010
  if (inputValue) {
17723
18011
  request.setInput(inputValue);
@@ -17755,6 +18043,19 @@ var ETHTransferNode2 = class _ETHTransferNode extends Node {
17755
18043
  constructor(props) {
17756
18044
  super({ ...props, type: NodeType8.ETHTransfer, data: props.data });
17757
18045
  }
18046
+ /**
18047
+ * Create a protobuf ETHTransferNode from config data
18048
+ * @param configData - The configuration data for the ETH transfer node
18049
+ * @returns Configured avs_pb.ETHTransferNode
18050
+ */
18051
+ static createProtobufNode(configData) {
18052
+ const node = new avs_pb14.ETHTransferNode();
18053
+ const config = new avs_pb14.ETHTransferNode.Config();
18054
+ config.setDestination(configData.destination);
18055
+ config.setAmount(configData.amount);
18056
+ node.setConfig(config);
18057
+ return node;
18058
+ }
17758
18059
  static fromResponse(raw) {
17759
18060
  const obj = raw.toObject();
17760
18061
  const input = extractInputFromProtobuf(raw.getEthTransfer()?.getInput());
@@ -17769,11 +18070,9 @@ var ETHTransferNode2 = class _ETHTransferNode extends Node {
17769
18070
  const request = new avs_pb14.TaskNode();
17770
18071
  request.setId(this.id);
17771
18072
  request.setName(this.name);
17772
- const node = new avs_pb14.ETHTransferNode();
17773
- const config = new avs_pb14.ETHTransferNode.Config();
17774
- config.setDestination(this.data.destination);
17775
- config.setAmount(this.data.amount);
17776
- node.setConfig(config);
18073
+ const node = _ETHTransferNode.createProtobufNode(
18074
+ this.data
18075
+ );
17777
18076
  const inputValue = convertInputToProtobuf(this.input);
17778
18077
  if (inputValue) {
17779
18078
  node.setInput(inputValue);
@@ -17849,7 +18148,10 @@ var branch_default = BranchNode2;
17849
18148
 
17850
18149
  // src/models/node/filter.ts
17851
18150
  var avs_pb16 = __toESM(require_avs_pb());
17852
- import { NodeType as NodeType10 } from "@avaprotocol/types";
18151
+ import {
18152
+ NodeType as NodeType10
18153
+ } from "@avaprotocol/types";
18154
+ import { Value as Value2 } from "google-protobuf/google/protobuf/struct_pb";
17853
18155
  var FilterNode2 = class _FilterNode extends Node {
17854
18156
  constructor(props) {
17855
18157
  super({ ...props, type: NodeType10.Filter, data: props.data });
@@ -17882,7 +18184,21 @@ var FilterNode2 = class _FilterNode extends Node {
17882
18184
  }
17883
18185
  static fromOutputData(outputData) {
17884
18186
  const filterOutput = outputData.getFilter();
17885
- return filterOutput?.toObject() || null;
18187
+ if (!filterOutput) {
18188
+ throw new Error("FilterNode output data is missing");
18189
+ }
18190
+ const anyData = filterOutput.getData();
18191
+ if (!anyData) {
18192
+ throw new Error("FilterNode output data.getData() is missing");
18193
+ }
18194
+ const value = Value2.deserializeBinary(anyData.getValue_asU8());
18195
+ const result = value.toJavaScript();
18196
+ if (result && typeof result === "object" && !Array.isArray(result) && result.data) {
18197
+ return result.data;
18198
+ }
18199
+ throw new Error(
18200
+ "FilterNode output data does not contain expected data structure"
18201
+ );
17886
18202
  }
17887
18203
  };
17888
18204
  var filter_default = FilterNode2;
@@ -17890,7 +18206,8 @@ var filter_default = FilterNode2;
17890
18206
  // src/models/node/loop.ts
17891
18207
  var avs_pb17 = __toESM(require_avs_pb());
17892
18208
  import {
17893
- NodeType as NodeType11
18209
+ NodeType as NodeType11,
18210
+ ExecutionMode
17894
18211
  } from "@avaprotocol/types";
17895
18212
  var LoopNode2 = class _LoopNode extends Node {
17896
18213
  constructor(props) {
@@ -17906,13 +18223,12 @@ var LoopNode2 = class _LoopNode extends Node {
17906
18223
  const loopNodeData = loopNode.toObject();
17907
18224
  const data = {
17908
18225
  ...configData,
17909
- // Keep the nested node structures from the full object
17910
- restApi: loopNodeData.restApi,
17911
- customCode: loopNodeData.customCode,
17912
- ethTransfer: loopNodeData.ethTransfer,
17913
- contractRead: loopNodeData.contractRead,
17914
- contractWrite: loopNodeData.contractWrite,
17915
- graphqlDataQuery: loopNodeData.graphqlDataQuery
18226
+ // Extract runner data from the oneof runner field
18227
+ runner: this.extractRunnerFromProtobuf(loopNodeData),
18228
+ // Map execution mode from protobuf enum to ExecutionMode enum
18229
+ executionMode: this.mapExecutionModeFromProtobuf(
18230
+ configData?.executionMode
18231
+ )
17916
18232
  };
17917
18233
  let input = void 0;
17918
18234
  if (raw.hasInput()) {
@@ -17925,6 +18241,54 @@ var LoopNode2 = class _LoopNode extends Node {
17925
18241
  input
17926
18242
  });
17927
18243
  }
18244
+ static extractRunnerFromProtobuf(loopNodeData) {
18245
+ const runnerMapping = {
18246
+ restApi: "restApi",
18247
+ customCode: "customCode",
18248
+ ethTransfer: "ethTransfer",
18249
+ contractRead: "contractRead",
18250
+ contractWrite: "contractWrite",
18251
+ graphqlDataQuery: "graphqlDataQuery"
18252
+ };
18253
+ for (const [type, key] of Object.entries(runnerMapping)) {
18254
+ if (loopNodeData[key]) {
18255
+ return { type, data: loopNodeData[key] };
18256
+ }
18257
+ }
18258
+ return null;
18259
+ }
18260
+ static mapExecutionModeFromProtobuf(executionMode) {
18261
+ switch (executionMode) {
18262
+ case 0:
18263
+ return ExecutionMode.Sequential;
18264
+ case 1:
18265
+ return ExecutionMode.Parallel;
18266
+ default:
18267
+ return ExecutionMode.Sequential;
18268
+ }
18269
+ }
18270
+ mapExecutionModeToProtobuf(executionMode) {
18271
+ if (!executionMode) {
18272
+ return 0;
18273
+ }
18274
+ if (typeof executionMode === "string") {
18275
+ switch (executionMode.toLowerCase()) {
18276
+ case "parallel":
18277
+ return 1;
18278
+ case "sequential":
18279
+ default:
18280
+ return 0;
18281
+ }
18282
+ } else {
18283
+ switch (executionMode) {
18284
+ case ExecutionMode.Parallel:
18285
+ return 1;
18286
+ case ExecutionMode.Sequential:
18287
+ default:
18288
+ return 0;
18289
+ }
18290
+ }
18291
+ }
17928
18292
  toRequest() {
17929
18293
  const node = new avs_pb17.TaskNode();
17930
18294
  const loopNode = new avs_pb17.LoopNode();
@@ -17935,113 +18299,103 @@ var LoopNode2 = class _LoopNode extends Node {
17935
18299
  config.setSourceId(data.sourceId || "");
17936
18300
  config.setIterVal(data.iterVal || "");
17937
18301
  config.setIterKey(data.iterKey || "");
18302
+ const executionMode = this.mapExecutionModeToProtobuf(data.executionMode);
18303
+ config.setExecutionMode(executionMode);
17938
18304
  loopNode.setConfig(config);
17939
18305
  const inputValue = convertInputToProtobuf(this.input);
17940
18306
  if (inputValue) {
17941
18307
  node.setInput(inputValue);
17942
18308
  }
17943
- if (data.ethTransfer) {
17944
- const ethTransfer = new avs_pb17.ETHTransferNode();
17945
- if (data.ethTransfer.config) {
17946
- const config2 = new avs_pb17.ETHTransferNode.Config();
17947
- config2.setDestination(data.ethTransfer.config.destination);
17948
- config2.setAmount(data.ethTransfer.config.amount);
17949
- ethTransfer.setConfig(config2);
17950
- }
17951
- loopNode.setEthTransfer(ethTransfer);
17952
- } else if (data.contractWrite) {
17953
- const contractWrite = new avs_pb17.ContractWriteNode();
17954
- if (data.contractWrite.config) {
17955
- const config2 = new avs_pb17.ContractWriteNode.Config();
17956
- config2.setContractAddress(
17957
- data.contractWrite.config.contractAddress
17958
- );
17959
- config2.setCallData(data.contractWrite.config.callData);
17960
- config2.setContractAbi(data.contractWrite.config.contractAbi);
17961
- const methodCalls = data.contractWrite.config.methodCallsList || [];
17962
- methodCalls.forEach(
17963
- (methodCall) => {
17964
- const methodCallMsg = new avs_pb17.ContractWriteNode.MethodCall();
17965
- methodCallMsg.setCallData(methodCall.callData);
17966
- if (methodCall.methodName) {
17967
- methodCallMsg.setMethodName(methodCall.methodName);
17968
- }
17969
- config2.addMethodCalls(methodCallMsg);
17970
- }
17971
- );
17972
- contractWrite.setConfig(config2);
17973
- }
17974
- loopNode.setContractWrite(contractWrite);
17975
- } else if (data.contractRead) {
17976
- const contractRead = new avs_pb17.ContractReadNode();
17977
- if (data.contractRead.config) {
17978
- const config2 = new avs_pb17.ContractReadNode.Config();
17979
- config2.setContractAddress(
17980
- data.contractRead.config.contractAddress
17981
- );
17982
- config2.setContractAbi(data.contractRead.config.contractAbi);
17983
- const methodCalls = data.contractRead.config.methodCallsList || [];
17984
- methodCalls.forEach(
17985
- (methodCall) => {
17986
- const methodCallMsg = new avs_pb17.ContractReadNode.MethodCall();
17987
- methodCallMsg.setCallData(methodCall.callData);
17988
- if (methodCall.methodName) {
17989
- methodCallMsg.setMethodName(methodCall.methodName);
17990
- }
17991
- if (methodCall.applyToFields) {
17992
- methodCallMsg.setApplyToFieldsList(methodCall.applyToFields);
17993
- }
17994
- config2.addMethodCalls(methodCallMsg);
17995
- }
17996
- );
17997
- contractRead.setConfig(config2);
17998
- }
17999
- loopNode.setContractRead(contractRead);
18000
- } else if (data.graphqlDataQuery) {
18001
- const graphqlQuery = new avs_pb17.GraphQLQueryNode();
18002
- if (data.graphqlDataQuery.config) {
18003
- const config2 = new avs_pb17.GraphQLQueryNode.Config();
18004
- config2.setUrl(data.graphqlDataQuery.config.url);
18005
- config2.setQuery(data.graphqlDataQuery.config.query);
18006
- if (data.graphqlDataQuery.config.variablesMap && data.graphqlDataQuery.config.variablesMap.length > 0) {
18007
- data.graphqlDataQuery.config.variablesMap.forEach(
18008
- ([key, value]) => {
18009
- config2.getVariablesMap().set(key, value);
18010
- }
18011
- );
18309
+ if (data.runner) {
18310
+ this.setRunnerOnProtobuf(loopNode, data.runner);
18311
+ }
18312
+ node.setLoop(loopNode);
18313
+ return node;
18314
+ }
18315
+ setRunnerOnProtobuf(loopNode, runner) {
18316
+ if (!runner || !runner.type || !runner.data) {
18317
+ return;
18318
+ }
18319
+ switch (runner.type) {
18320
+ case "ethTransfer": {
18321
+ const ethTransferData = runner.data;
18322
+ if (ethTransferData.config) {
18323
+ const ethConfig = ethTransferData.config;
18324
+ const ethTransfer = ethTransfer_default.createProtobufNode({
18325
+ destination: ethConfig.destination,
18326
+ amount: ethConfig.amount
18327
+ });
18328
+ loopNode.setEthTransfer(ethTransfer);
18012
18329
  }
18013
- graphqlQuery.setConfig(config2);
18014
- }
18015
- loopNode.setGraphqlDataQuery(graphqlQuery);
18016
- } else if (data.restApi) {
18017
- const restApi = new avs_pb17.RestAPINode();
18018
- if (data.restApi.config) {
18019
- const config2 = new avs_pb17.RestAPINode.Config();
18020
- config2.setUrl(data.restApi.config.url);
18021
- config2.setMethod(data.restApi.config.method);
18022
- config2.setBody(data.restApi.config.body || "");
18023
- if (data.restApi.config.headersMap && data.restApi.config.headersMap.length > 0) {
18024
- data.restApi.config.headersMap.forEach(
18025
- ([key, value]) => {
18026
- config2.getHeadersMap().set(key, value);
18027
- }
18028
- );
18330
+ break;
18331
+ }
18332
+ case "contractWrite": {
18333
+ const contractWriteData = runner.data;
18334
+ if (contractWriteData.config) {
18335
+ const writeConfig = contractWriteData.config;
18336
+ const contractWrite = contractWrite_default.createProtobufNode({
18337
+ contractAddress: writeConfig.contractAddress,
18338
+ callData: writeConfig.callData,
18339
+ contractAbi: writeConfig.contractAbi,
18340
+ methodCalls: writeConfig.methodCallsList || []
18341
+ });
18342
+ loopNode.setContractWrite(contractWrite);
18343
+ }
18344
+ break;
18345
+ }
18346
+ case "contractRead": {
18347
+ const contractReadData = runner.data;
18348
+ if (contractReadData.config) {
18349
+ const readConfig = contractReadData.config;
18350
+ const contractRead = contractRead_default.createProtobufNode({
18351
+ contractAddress: readConfig.contractAddress,
18352
+ contractAbi: readConfig.contractAbi,
18353
+ methodCalls: readConfig.methodCallsList || []
18354
+ });
18355
+ loopNode.setContractRead(contractRead);
18356
+ }
18357
+ break;
18358
+ }
18359
+ case "graphqlDataQuery": {
18360
+ const graphqlData = runner.data;
18361
+ if (graphqlData.config) {
18362
+ const gqlConfig = graphqlData.config;
18363
+ const graphqlQuery = graphqlQuery_default.createProtobufNode({
18364
+ url: gqlConfig.url,
18365
+ query: gqlConfig.query,
18366
+ variablesMap: gqlConfig.variablesMap
18367
+ });
18368
+ loopNode.setGraphqlDataQuery(graphqlQuery);
18369
+ }
18370
+ break;
18371
+ }
18372
+ case "restApi": {
18373
+ const restApiData = runner.data;
18374
+ if (restApiData.config) {
18375
+ const apiConfig = restApiData.config;
18376
+ const restApi = restApi_default.createProtobufNode({
18377
+ url: apiConfig.url,
18378
+ method: apiConfig.method,
18379
+ body: apiConfig.body || "",
18380
+ headersMap: apiConfig.headersMap
18381
+ });
18382
+ loopNode.setRestApi(restApi);
18029
18383
  }
18030
- restApi.setConfig(config2);
18384
+ break;
18031
18385
  }
18032
- loopNode.setRestApi(restApi);
18033
- } else if (data.customCode) {
18034
- const customCode = new avs_pb17.CustomCodeNode();
18035
- if (data.customCode.config) {
18036
- const config2 = new avs_pb17.CustomCodeNode.Config();
18037
- config2.setLang(data.customCode.config.lang);
18038
- config2.setSource(data.customCode.config.source);
18039
- customCode.setConfig(config2);
18386
+ case "customCode": {
18387
+ const customCodeData = runner.data;
18388
+ if (customCodeData.config) {
18389
+ const codeConfig = customCodeData.config;
18390
+ const customCode = customCode_default.createProtobufNode({
18391
+ lang: codeConfig.lang,
18392
+ source: codeConfig.source
18393
+ });
18394
+ loopNode.setCustomCode(customCode);
18395
+ }
18396
+ break;
18040
18397
  }
18041
- loopNode.setCustomCode(customCode);
18042
18398
  }
18043
- node.setLoop(loopNode);
18044
- return node;
18045
18399
  }
18046
18400
  static fromOutputData(outputData) {
18047
18401
  const customCodeOutput = outputData.getCustomCode();
@@ -18058,7 +18412,7 @@ var LoopNode2 = class _LoopNode extends Node {
18058
18412
  if (loopObj.data && typeof loopObj.data === "string") {
18059
18413
  try {
18060
18414
  return JSON.parse(loopObj.data);
18061
- } catch (e) {
18415
+ } catch {
18062
18416
  return loopObj.data;
18063
18417
  }
18064
18418
  }
@@ -18290,7 +18644,6 @@ var Workflow = class _Workflow {
18290
18644
  if (this.name) {
18291
18645
  request.setName(this.name);
18292
18646
  }
18293
- console.log(`\u{1F4E4} Workflow serialization: ${this.nodes.length} nodes, ${this.edges.length} edges -> protobuf: ${request.getNodesList().length} nodes, ${request.getEdgesList().length} edges`);
18294
18647
  return request;
18295
18648
  }
18296
18649
  /**
@@ -18389,44 +18742,210 @@ var Step = class _Step {
18389
18742
  return void 0;
18390
18743
  // Trigger outputs
18391
18744
  case avs_pb20.Execution.Step.OutputDataCase.BLOCK_TRIGGER:
18392
- return typeof step.getBlockTrigger === "function" ? step.getBlockTrigger()?.toObject() : step.blockTrigger;
18745
+ const blockTrigger = typeof step.getBlockTrigger === "function" ? step.getBlockTrigger()?.toObject() : step.blockTrigger;
18746
+ return { data: blockTrigger };
18747
+ // ✅ Use standard structure
18393
18748
  case avs_pb20.Execution.Step.OutputDataCase.FIXED_TIME_TRIGGER:
18394
- return typeof step.getFixedTimeTrigger === "function" ? step.getFixedTimeTrigger()?.toObject() : step.fixedTimeTrigger;
18749
+ const fixedTimeTrigger = typeof step.getFixedTimeTrigger === "function" ? step.getFixedTimeTrigger()?.toObject() : step.fixedTimeTrigger;
18750
+ return { data: fixedTimeTrigger };
18751
+ // ✅ Use standard structure
18395
18752
  case avs_pb20.Execution.Step.OutputDataCase.CRON_TRIGGER:
18396
- return typeof step.getCronTrigger === "function" ? step.getCronTrigger()?.toObject() : step.cronTrigger;
18753
+ const cronTrigger = typeof step.getCronTrigger === "function" ? step.getCronTrigger()?.toObject() : step.cronTrigger;
18754
+ return { data: cronTrigger };
18755
+ // ✅ Use standard structure
18397
18756
  case avs_pb20.Execution.Step.OutputDataCase.EVENT_TRIGGER:
18398
18757
  const eventTrigger = typeof step.getEventTrigger === "function" ? step.getEventTrigger() : step.eventTrigger;
18399
18758
  if (eventTrigger) {
18400
18759
  if (typeof eventTrigger.hasData === "function" && eventTrigger.hasData()) {
18401
18760
  try {
18402
- return convertProtobufValueToJs(eventTrigger.getData());
18761
+ const eventData = convertProtobufValueToJs(
18762
+ eventTrigger.getData()
18763
+ );
18764
+ return { data: eventData };
18403
18765
  } catch (error) {
18404
18766
  console.warn(
18405
18767
  "Failed to convert event trigger data from protobuf Value:",
18406
18768
  error
18407
18769
  );
18408
- return eventTrigger.getData();
18770
+ return { data: eventTrigger.getData() };
18409
18771
  }
18410
18772
  } else if (eventTrigger.data) {
18411
- return typeof eventTrigger.data.getKindCase === "function" ? convertProtobufValueToJs(eventTrigger.data) : eventTrigger.data;
18773
+ const eventData = typeof eventTrigger.data.getKindCase === "function" ? convertProtobufValueToJs(eventTrigger.data) : eventTrigger.data;
18774
+ return { data: eventData };
18412
18775
  }
18413
18776
  if (typeof eventTrigger.hasEvmLog === "function" && eventTrigger.hasEvmLog()) {
18414
- return eventTrigger.getEvmLog()?.toObject();
18777
+ return { data: eventTrigger.getEvmLog()?.toObject() };
18415
18778
  } else if (typeof eventTrigger.hasTransferLog === "function" && eventTrigger.hasTransferLog()) {
18416
- return eventTrigger.getTransferLog()?.toObject();
18779
+ return { data: eventTrigger.getTransferLog()?.toObject() };
18417
18780
  } else if (eventTrigger.evmLog) {
18418
- return eventTrigger.evmLog;
18781
+ return { data: eventTrigger.evmLog };
18419
18782
  } else if (eventTrigger.transferLog) {
18420
- return eventTrigger.transferLog;
18783
+ return { data: eventTrigger.transferLog };
18421
18784
  }
18422
18785
  }
18423
- return void 0;
18424
- case avs_pb20.Execution.Step.OutputDataCase.MANUAL_TRIGGER:
18425
- return typeof step.getManualTrigger === "function" ? step.getManualTrigger()?.toObject() || void 0 : step.manualTrigger;
18786
+ return { data: null };
18787
+ // ✅ Use standard structure
18788
+ case avs_pb20.Execution.Step.OutputDataCase.MANUAL_TRIGGER: {
18789
+ const manualTrigger = typeof step.getManualTrigger === "function" ? step.getManualTrigger() : step.manualTrigger;
18790
+ if (manualTrigger) {
18791
+ const result = {};
18792
+ if (typeof manualTrigger.hasData === "function" && manualTrigger.hasData()) {
18793
+ try {
18794
+ const userData = convertProtobufValueToJs(
18795
+ manualTrigger.getData()
18796
+ );
18797
+ if (userData && typeof userData === "object" && userData.data !== void 0 && (userData.headers !== void 0 || userData.pathParams !== void 0)) {
18798
+ result.data = userData.data;
18799
+ if (userData.headers) {
18800
+ if (Array.isArray(userData.headers)) {
18801
+ if (userData.headers.length > 0 && Array.isArray(userData.headers[0])) {
18802
+ result.headers = userData.headers;
18803
+ } else {
18804
+ const headersArray = [];
18805
+ for (const header of userData.headers) {
18806
+ for (const [key, value] of Object.entries(header)) {
18807
+ headersArray.push([key, value]);
18808
+ }
18809
+ }
18810
+ result.headers = headersArray;
18811
+ }
18812
+ } else {
18813
+ const headersArray = [];
18814
+ for (const [key, value] of Object.entries(userData.headers)) {
18815
+ headersArray.push([key, value]);
18816
+ }
18817
+ result.headers = headersArray;
18818
+ }
18819
+ }
18820
+ if (userData.pathParams) {
18821
+ if (Array.isArray(userData.pathParams)) {
18822
+ if (userData.pathParams.length > 0 && Array.isArray(userData.pathParams[0])) {
18823
+ result.pathParams = userData.pathParams;
18824
+ } else {
18825
+ const pathParamsArray = [];
18826
+ for (const pathParam of userData.pathParams) {
18827
+ for (const [key, value] of Object.entries(pathParam)) {
18828
+ pathParamsArray.push([key, value]);
18829
+ }
18830
+ }
18831
+ result.pathParams = pathParamsArray;
18832
+ }
18833
+ } else {
18834
+ const pathParamsArray = [];
18835
+ for (const [key, value] of Object.entries(userData.pathParams)) {
18836
+ pathParamsArray.push([key, value]);
18837
+ }
18838
+ result.pathParams = pathParamsArray;
18839
+ }
18840
+ }
18841
+ } else {
18842
+ result.data = userData;
18843
+ }
18844
+ } catch (error) {
18845
+ console.warn(
18846
+ "Failed to convert manual trigger data from protobuf Value:",
18847
+ error
18848
+ );
18849
+ result.data = manualTrigger.getData();
18850
+ }
18851
+ } else if (manualTrigger.data) {
18852
+ const userData = typeof manualTrigger.data.getKindCase === "function" ? convertProtobufValueToJs(manualTrigger.data) : manualTrigger.data;
18853
+ if (userData && typeof userData === "object" && userData.data !== void 0 && (userData.headers !== void 0 || userData.pathParams !== void 0)) {
18854
+ result.data = userData.data;
18855
+ if (userData.headers) {
18856
+ if (Array.isArray(userData.headers)) {
18857
+ if (userData.headers.length > 0 && Array.isArray(userData.headers[0])) {
18858
+ result.headers = userData.headers;
18859
+ } else {
18860
+ const headersArray = [];
18861
+ for (const header of userData.headers) {
18862
+ for (const [key, value] of Object.entries(header)) {
18863
+ headersArray.push([key, value]);
18864
+ }
18865
+ }
18866
+ result.headers = headersArray;
18867
+ }
18868
+ } else {
18869
+ const headersArray = [];
18870
+ for (const [key, value] of Object.entries(userData.headers)) {
18871
+ headersArray.push([key, value]);
18872
+ }
18873
+ result.headers = headersArray;
18874
+ }
18875
+ }
18876
+ if (userData.pathParams) {
18877
+ if (Array.isArray(userData.pathParams)) {
18878
+ if (userData.pathParams.length > 0 && Array.isArray(userData.pathParams[0])) {
18879
+ result.pathParams = userData.pathParams;
18880
+ } else {
18881
+ const pathParamsArray = [];
18882
+ for (const pathParam of userData.pathParams) {
18883
+ for (const [key, value] of Object.entries(pathParam)) {
18884
+ pathParamsArray.push([key, value]);
18885
+ }
18886
+ }
18887
+ result.pathParams = pathParamsArray;
18888
+ }
18889
+ } else {
18890
+ const pathParamsArray = [];
18891
+ for (const [key, value] of Object.entries(userData.pathParams)) {
18892
+ pathParamsArray.push([key, value]);
18893
+ }
18894
+ result.pathParams = pathParamsArray;
18895
+ }
18896
+ }
18897
+ } else {
18898
+ result.data = userData;
18899
+ }
18900
+ }
18901
+ if (typeof manualTrigger.getHeadersMap === "function") {
18902
+ const headersMap = manualTrigger.getHeadersMap();
18903
+ if (headersMap && headersMap.getLength() > 0) {
18904
+ const headersArray = [];
18905
+ headersMap.forEach((value, key) => {
18906
+ headersArray.push([key, value]);
18907
+ });
18908
+ result.headers = headersArray;
18909
+ }
18910
+ } else if (manualTrigger.headers) {
18911
+ const headersArray = [];
18912
+ for (const [key, value] of Object.entries(manualTrigger.headers)) {
18913
+ headersArray.push([key, value]);
18914
+ }
18915
+ result.headers = headersArray;
18916
+ }
18917
+ if (typeof manualTrigger.getPathparamsMap === "function") {
18918
+ const pathParamsMap = manualTrigger.getPathparamsMap();
18919
+ if (pathParamsMap && pathParamsMap.getLength() > 0) {
18920
+ const pathParamsArray = [];
18921
+ pathParamsMap.forEach((value, key) => {
18922
+ pathParamsArray.push([key, value]);
18923
+ });
18924
+ result.pathParams = pathParamsArray;
18925
+ }
18926
+ } else if (manualTrigger.pathparams) {
18927
+ const pathParamsArray = [];
18928
+ for (const [key, value] of Object.entries(manualTrigger.pathparams)) {
18929
+ pathParamsArray.push([key, value]);
18930
+ }
18931
+ result.pathParams = pathParamsArray;
18932
+ }
18933
+ if (Object.keys(result).length === 0) {
18934
+ const objData = manualTrigger.toObject?.() || manualTrigger;
18935
+ if (objData && objData.data === void 0) {
18936
+ result.data = null;
18937
+ } else {
18938
+ return { data: objData };
18939
+ }
18940
+ }
18941
+ return result;
18942
+ }
18943
+ return { data: null };
18944
+ }
18426
18945
  // Node outputs - RESTORE MISSING CASES
18427
18946
  case avs_pb20.Execution.Step.OutputDataCase.ETH_TRANSFER:
18428
18947
  return typeof step.getEthTransfer === "function" ? step.getEthTransfer()?.toObject() : step.ethTransfer;
18429
- case avs_pb20.Execution.Step.OutputDataCase.CUSTOM_CODE:
18948
+ case avs_pb20.Execution.Step.OutputDataCase.CUSTOM_CODE: {
18430
18949
  const customCodeOutput = typeof step.getCustomCode === "function" ? step.getCustomCode() : step.customCode;
18431
18950
  if (customCodeOutput) {
18432
18951
  if (typeof customCodeOutput.hasData === "function" && customCodeOutput.hasData()) {
@@ -18440,7 +18959,8 @@ var Step = class _Step {
18440
18959
  }
18441
18960
  }
18442
18961
  return void 0;
18443
- case avs_pb20.Execution.Step.OutputDataCase.REST_API:
18962
+ }
18963
+ case avs_pb20.Execution.Step.OutputDataCase.REST_API: {
18444
18964
  const restApiOutput = typeof step.getRestApi === "function" ? step.getRestApi() : step.restApi;
18445
18965
  if (restApiOutput) {
18446
18966
  if (typeof restApiOutput.hasData === "function" && restApiOutput.hasData()) {
@@ -18454,9 +18974,10 @@ var Step = class _Step {
18454
18974
  }
18455
18975
  }
18456
18976
  return void 0;
18977
+ }
18457
18978
  case avs_pb20.Execution.Step.OutputDataCase.BRANCH:
18458
18979
  return typeof step.getBranch === "function" ? step.getBranch()?.toObject() : step.branch;
18459
- case avs_pb20.Execution.Step.OutputDataCase.LOOP:
18980
+ case avs_pb20.Execution.Step.OutputDataCase.LOOP: {
18460
18981
  const loopOutput = typeof step.getLoop === "function" ? step.getLoop() : step.loop;
18461
18982
  if (loopOutput) {
18462
18983
  if (typeof loopOutput.getData === "function" && loopOutput.getData()) {
@@ -18474,7 +18995,8 @@ var Step = class _Step {
18474
18995
  }
18475
18996
  }
18476
18997
  return void 0;
18477
- case avs_pb20.Execution.Step.OutputDataCase.GRAPHQL:
18998
+ }
18999
+ case avs_pb20.Execution.Step.OutputDataCase.GRAPHQL: {
18478
19000
  const graphqlOutput = typeof step.getGraphql === "function" ? step.getGraphql() : step.graphql;
18479
19001
  if (graphqlOutput) {
18480
19002
  try {
@@ -18484,7 +19006,8 @@ var Step = class _Step {
18484
19006
  }
18485
19007
  }
18486
19008
  return void 0;
18487
- case avs_pb20.Execution.Step.OutputDataCase.CONTRACT_READ:
19009
+ }
19010
+ case avs_pb20.Execution.Step.OutputDataCase.CONTRACT_READ: {
18488
19011
  const contractReadOutput = typeof step.getContractRead === "function" ? step.getContractRead() : step.contractRead;
18489
19012
  if (contractReadOutput) {
18490
19013
  if (typeof contractReadOutput.hasData === "function" && contractReadOutput.hasData()) {
@@ -18524,7 +19047,8 @@ var Step = class _Step {
18524
19047
  return outputObj;
18525
19048
  }
18526
19049
  return void 0;
18527
- case avs_pb20.Execution.Step.OutputDataCase.CONTRACT_WRITE:
19050
+ }
19051
+ case avs_pb20.Execution.Step.OutputDataCase.CONTRACT_WRITE: {
18528
19052
  const contractWriteOutput = typeof step.getContractWrite === "function" ? step.getContractWrite() : step.contractWrite;
18529
19053
  if (contractWriteOutput) {
18530
19054
  if (typeof contractWriteOutput.hasData === "function" && contractWriteOutput.hasData()) {
@@ -18567,7 +19091,8 @@ var Step = class _Step {
18567
19091
  return outputObj;
18568
19092
  }
18569
19093
  return void 0;
18570
- case avs_pb20.Execution.Step.OutputDataCase.FILTER:
19094
+ }
19095
+ case avs_pb20.Execution.Step.OutputDataCase.FILTER: {
18571
19096
  const filterOutput = typeof step.getFilter === "function" ? step.getFilter() : step.filter;
18572
19097
  if (filterOutput) {
18573
19098
  try {
@@ -18577,6 +19102,7 @@ var Step = class _Step {
18577
19102
  }
18578
19103
  }
18579
19104
  return void 0;
19105
+ }
18580
19106
  default:
18581
19107
  console.warn(
18582
19108
  `Unhandled output data type in Step.getOutput: ${step.getOutputDataCase()}`
@@ -19285,7 +19811,22 @@ var Client = class extends BaseClient {
19285
19811
  case TriggerType13.Manual: {
19286
19812
  const manualData = triggerData;
19287
19813
  const manualOutput = new avs_pb22.ManualTrigger.Output();
19288
- if (manualData.runAt) manualOutput.setRunAt(manualData.runAt);
19814
+ if (manualData.data) {
19815
+ const protobufValue = convertJSValueToProtobuf(manualData.data);
19816
+ manualOutput.setData(protobufValue);
19817
+ }
19818
+ if (manualData.headersMap) {
19819
+ const headersMap = manualOutput.getHeadersMap();
19820
+ manualData.headersMap.forEach(([key, value]) => {
19821
+ headersMap.set(key, value);
19822
+ });
19823
+ }
19824
+ if (manualData.pathParamsMap) {
19825
+ const pathParamsMap = manualOutput.getPathparamsMap();
19826
+ manualData.pathParamsMap.forEach(([key, value]) => {
19827
+ pathParamsMap.set(key, value);
19828
+ });
19829
+ }
19289
19830
  request.setManualTrigger(manualOutput);
19290
19831
  break;
19291
19832
  }