@avaprotocol/sdk-js 2.4.4 → 2.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2947,7 +2947,11 @@ var require_avs_pb = __commonJS({
2947
2947
  return proto.aggregator.ManualTrigger.Config.toObject(opt_includeInstance, this);
2948
2948
  };
2949
2949
  proto.aggregator.ManualTrigger.Config.toObject = function(includeInstance, msg) {
2950
- 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
+ };
2951
2955
  if (includeInstance) {
2952
2956
  obj.$jspbMessageInstance = msg;
2953
2957
  }
@@ -2966,6 +2970,23 @@ var require_avs_pb = __commonJS({
2966
2970
  }
2967
2971
  var field = reader.getFieldNumber();
2968
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;
2969
2990
  default:
2970
2991
  reader.skipField();
2971
2992
  break;
@@ -2980,6 +3001,67 @@ var require_avs_pb = __commonJS({
2980
3001
  };
2981
3002
  proto.aggregator.ManualTrigger.Config.serializeBinaryToWriter = function(message, writer) {
2982
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;
2983
3065
  };
2984
3066
  if (jspb.Message.GENERATE_TO_OBJECT) {
2985
3067
  proto.aggregator.ManualTrigger.Output.prototype.toObject = function(opt_includeInstance) {
@@ -2987,7 +3069,9 @@ var require_avs_pb = __commonJS({
2987
3069
  };
2988
3070
  proto.aggregator.ManualTrigger.Output.toObject = function(includeInstance, msg) {
2989
3071
  var f, obj = {
2990
- 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) : []
2991
3075
  };
2992
3076
  if (includeInstance) {
2993
3077
  obj.$jspbMessageInstance = msg;
@@ -3008,11 +3092,21 @@ var require_avs_pb = __commonJS({
3008
3092
  var field = reader.getFieldNumber();
3009
3093
  switch (field) {
3010
3094
  case 1:
3011
- var value = (
3012
- /** @type {number} */
3013
- reader.readUint64()
3014
- );
3015
- 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
+ });
3016
3110
  break;
3017
3111
  default:
3018
3112
  reader.skipField();
@@ -3028,22 +3122,67 @@ var require_avs_pb = __commonJS({
3028
3122
  };
3029
3123
  proto.aggregator.ManualTrigger.Output.serializeBinaryToWriter = function(message, writer) {
3030
3124
  var f = void 0;
3031
- f = message.getRunAt();
3032
- if (f !== 0) {
3033
- writer.writeUint64(
3125
+ f = message.getData();
3126
+ if (f != null) {
3127
+ writer.writeMessage(
3034
3128
  1,
3035
- f
3129
+ f,
3130
+ google_protobuf_struct_pb2.Value.serializeBinaryToWriter
3036
3131
  );
3037
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
+ }
3038
3141
  };
3039
- proto.aggregator.ManualTrigger.Output.prototype.getRunAt = function() {
3142
+ proto.aggregator.ManualTrigger.Output.prototype.getData = function() {
3040
3143
  return (
3041
- /** @type {number} */
3042
- jspb.Message.getFieldWithDefault(this, 1, 0)
3144
+ /** @type{?proto.google.protobuf.Value} */
3145
+ jspb.Message.getWrapperField(this, google_protobuf_struct_pb2.Value, 1)
3043
3146
  );
3044
3147
  };
3045
- proto.aggregator.ManualTrigger.Output.prototype.setRunAt = function(value) {
3046
- 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;
3047
3186
  };
3048
3187
  proto.aggregator.ManualTrigger.prototype.getConfig = function() {
3049
3188
  return (
@@ -3098,7 +3237,7 @@ var require_avs_pb = __commonJS({
3098
3237
  var f, obj = {
3099
3238
  name: jspb.Message.getFieldWithDefault(msg, 1, ""),
3100
3239
  type: jspb.Message.getFieldWithDefault(msg, 8, 0),
3101
- manual: jspb.Message.getBooleanFieldWithDefault(msg, 2, false),
3240
+ manual: (f = msg.getManual()) && proto.aggregator.ManualTrigger.toObject(includeInstance, f),
3102
3241
  fixedTime: (f = msg.getFixedTime()) && proto.aggregator.FixedTimeTrigger.toObject(includeInstance, f),
3103
3242
  cron: (f = msg.getCron()) && proto.aggregator.CronTrigger.toObject(includeInstance, f),
3104
3243
  block: (f = msg.getBlock()) && proto.aggregator.BlockTrigger.toObject(includeInstance, f),
@@ -3139,10 +3278,8 @@ var require_avs_pb = __commonJS({
3139
3278
  msg.setType(value);
3140
3279
  break;
3141
3280
  case 2:
3142
- var value = (
3143
- /** @type {boolean} */
3144
- reader.readBool()
3145
- );
3281
+ var value = new proto.aggregator.ManualTrigger();
3282
+ reader.readMessage(value, proto.aggregator.ManualTrigger.deserializeBinaryFromReader);
3146
3283
  msg.setManual(value);
3147
3284
  break;
3148
3285
  case 3:
@@ -3205,12 +3342,12 @@ var require_avs_pb = __commonJS({
3205
3342
  f
3206
3343
  );
3207
3344
  }
3208
- f = /** @type {boolean} */
3209
- jspb.Message.getField(message, 2);
3345
+ f = message.getManual();
3210
3346
  if (f != null) {
3211
- writer.writeBool(
3347
+ writer.writeMessage(
3212
3348
  2,
3213
- f
3349
+ f,
3350
+ proto.aggregator.ManualTrigger.serializeBinaryToWriter
3214
3351
  );
3215
3352
  }
3216
3353
  f = message.getFixedTime();
@@ -3281,15 +3418,15 @@ var require_avs_pb = __commonJS({
3281
3418
  };
3282
3419
  proto.aggregator.TaskTrigger.prototype.getManual = function() {
3283
3420
  return (
3284
- /** @type {boolean} */
3285
- jspb.Message.getBooleanFieldWithDefault(this, 2, false)
3421
+ /** @type{?proto.aggregator.ManualTrigger} */
3422
+ jspb.Message.getWrapperField(this, proto.aggregator.ManualTrigger, 2)
3286
3423
  );
3287
3424
  };
3288
3425
  proto.aggregator.TaskTrigger.prototype.setManual = function(value) {
3289
- 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);
3290
3427
  };
3291
3428
  proto.aggregator.TaskTrigger.prototype.clearManual = function() {
3292
- return jspb.Message.setOneofField(this, 2, proto.aggregator.TaskTrigger.oneofGroups_[0], void 0);
3429
+ return this.setManual(void 0);
3293
3430
  };
3294
3431
  proto.aggregator.TaskTrigger.prototype.hasManual = function() {
3295
3432
  return jspb.Message.getField(this, 2) != null;
@@ -17313,58 +17450,133 @@ var fixedTime_default = FixedTimeTrigger2;
17313
17450
  // src/models/trigger/manual.ts
17314
17451
  var avs_pb6 = __toESM(require_avs_pb());
17315
17452
  var import_types6 = require("@avaprotocol/types");
17316
- var ManualTrigger = class _ManualTrigger extends Trigger {
17453
+ var ManualTrigger2 = class _ManualTrigger extends Trigger {
17317
17454
  constructor(props) {
17318
- 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.headers = props.headers;
17462
+ this.pathParams = props.pathParams;
17319
17463
  }
17320
17464
  toRequest() {
17321
17465
  const trigger = new avs_pb6.TaskTrigger();
17322
17466
  trigger.setId(this.id);
17323
17467
  trigger.setName(this.name);
17324
17468
  trigger.setType(avs_pb6.TriggerType.TRIGGER_TYPE_MANUAL);
17325
- trigger.setManual(true);
17326
- const inputValue = convertInputToProtobuf(this.input);
17327
- if (inputValue) {
17328
- 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.headers && Object.keys(this.headers).length > 0) {
17479
+ const headersMap = config.getHeadersMap();
17480
+ Object.entries(this.headers).forEach(([key, value]) => {
17481
+ headersMap.set(key, value);
17482
+ });
17483
+ }
17484
+ if (this.pathParams && Object.keys(this.pathParams).length > 0) {
17485
+ const pathParamsMap = config.getPathparamsMap();
17486
+ Object.entries(this.pathParams).forEach(([key, value]) => {
17487
+ pathParamsMap.set(key, value);
17488
+ });
17329
17489
  }
17490
+ manualTrigger.setConfig(config);
17491
+ trigger.setManual(manualTrigger);
17330
17492
  return trigger;
17331
17493
  }
17332
17494
  static fromResponse(raw) {
17333
17495
  const obj = raw.toObject();
17334
- let input = void 0;
17335
- if (raw.hasInput()) {
17336
- input = extractInputFromProtobuf(raw.getInput());
17496
+ let data = null;
17497
+ const input = void 0;
17498
+ let headers = void 0;
17499
+ let pathParams = 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
+ headers = {};
17510
+ headersMapProto.forEach((value, key) => {
17511
+ headers[key] = value;
17512
+ });
17513
+ }
17514
+ const pathParamsMapProto = config.getPathparamsMap();
17515
+ if (pathParamsMapProto && pathParamsMapProto.getLength() > 0) {
17516
+ pathParams = {};
17517
+ pathParamsMapProto.forEach((value, key) => {
17518
+ pathParams[key] = value;
17519
+ });
17520
+ }
17521
+ }
17337
17522
  }
17338
17523
  return new _ManualTrigger({
17339
17524
  ...obj,
17340
17525
  type: import_types6.TriggerType.Manual,
17341
- data: null,
17342
- // Manual triggers don't have data in the protobuf response
17343
- input
17526
+ data,
17527
+ input,
17528
+ headers,
17529
+ pathParams
17344
17530
  });
17345
17531
  }
17346
17532
  getInputVariables() {
17347
- return this.data;
17348
- }
17349
- /**
17350
- * Convert raw data from runTrigger response to ManualOutput format
17351
- * @param rawData - The raw data from the gRPC response
17352
- * @returns {ManualTriggerOutput | undefined} - The converted data
17353
- */
17354
- getOutput() {
17355
- return this.output;
17533
+ return this.input;
17356
17534
  }
17357
17535
  /**
17358
17536
  * Extract output data from RunTriggerResp for manual triggers
17359
17537
  * @param outputData - The RunTriggerResp containing manual trigger output
17360
- * @returns Plain JavaScript object with manual trigger data
17538
+ * @returns Plain JavaScript object with manual trigger data in standard structure
17361
17539
  */
17362
17540
  static fromOutputData(outputData) {
17363
17541
  const manualOutput = outputData.getManualTrigger();
17364
- 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 headersObject = {};
17563
+ headersMapProto.forEach((value, key) => {
17564
+ headersObject[key] = value;
17565
+ });
17566
+ result.headers = headersObject;
17567
+ }
17568
+ const pathParamsMapProto = manualOutput.getPathparamsMap();
17569
+ if (pathParamsMapProto && pathParamsMapProto.getLength() > 0) {
17570
+ const pathParamsObject = {};
17571
+ pathParamsMapProto.forEach((value, key) => {
17572
+ pathParamsObject[key] = value;
17573
+ });
17574
+ result.pathParams = pathParamsObject;
17575
+ }
17576
+ return result;
17365
17577
  }
17366
17578
  };
17367
- var manual_default = ManualTrigger;
17579
+ var manual_default = ManualTrigger2;
17368
17580
 
17369
17581
  // src/models/trigger/factory.ts
17370
17582
  var import_types7 = require("@avaprotocol/types");
@@ -17692,9 +17904,9 @@ var RestAPINode2 = class _RestAPINode extends Node {
17692
17904
  config.setUrl(configData.url);
17693
17905
  config.setMethod(configData.method);
17694
17906
  config.setBody(configData.body || "");
17695
- if (configData.headersMap && configData.headersMap.length > 0) {
17907
+ if (configData.headers && Object.keys(configData.headers).length > 0) {
17696
17908
  const headersMap = config.getHeadersMap();
17697
- configData.headersMap.forEach(([key, value]) => {
17909
+ Object.entries(configData.headers).forEach(([key, value]) => {
17698
17910
  headersMap.set(key, value);
17699
17911
  });
17700
17912
  }
@@ -17710,7 +17922,19 @@ var RestAPINode2 = class _RestAPINode extends Node {
17710
17922
  return new _RestAPINode({
17711
17923
  ...obj,
17712
17924
  type: import_types12.NodeType.RestAPI,
17713
- data: raw.getRestApi().getConfig().toObject(),
17925
+ data: {
17926
+ url: raw.getRestApi().getConfig().getUrl(),
17927
+ method: raw.getRestApi().getConfig().getMethod(),
17928
+ body: raw.getRestApi().getConfig().getBody(),
17929
+ headers: (() => {
17930
+ const headersMap = raw.getRestApi().getConfig().getHeadersMap();
17931
+ const headers = {};
17932
+ headersMap.forEach((value, key) => {
17933
+ headers[key] = value;
17934
+ });
17935
+ return headers;
17936
+ })()
17937
+ },
17714
17938
  input
17715
17939
  // Include input data from top-level TaskNode
17716
17940
  });
@@ -17949,6 +18173,7 @@ var branch_default = BranchNode2;
17949
18173
  // src/models/node/filter.ts
17950
18174
  var avs_pb16 = __toESM(require_avs_pb());
17951
18175
  var import_types16 = require("@avaprotocol/types");
18176
+ var import_struct_pb2 = require("google-protobuf/google/protobuf/struct_pb");
17952
18177
  var FilterNode2 = class _FilterNode extends Node {
17953
18178
  constructor(props) {
17954
18179
  super({ ...props, type: import_types16.NodeType.Filter, data: props.data });
@@ -17981,7 +18206,21 @@ var FilterNode2 = class _FilterNode extends Node {
17981
18206
  }
17982
18207
  static fromOutputData(outputData) {
17983
18208
  const filterOutput = outputData.getFilter();
17984
- return filterOutput?.toObject() || null;
18209
+ if (!filterOutput) {
18210
+ throw new Error("FilterNode output data is missing");
18211
+ }
18212
+ const anyData = filterOutput.getData();
18213
+ if (!anyData) {
18214
+ throw new Error("FilterNode output data.getData() is missing");
18215
+ }
18216
+ const value = import_struct_pb2.Value.deserializeBinary(anyData.getValue_asU8());
18217
+ const result = value.toJavaScript();
18218
+ if (result && typeof result === "object" && !Array.isArray(result) && result.data) {
18219
+ return result.data;
18220
+ }
18221
+ throw new Error(
18222
+ "FilterNode output data does not contain expected data structure"
18223
+ );
17985
18224
  }
17986
18225
  };
17987
18226
  var filter_default = FilterNode2;
@@ -18022,18 +18261,18 @@ var LoopNode2 = class _LoopNode extends Node {
18022
18261
  });
18023
18262
  }
18024
18263
  static extractRunnerFromProtobuf(loopNodeData) {
18025
- if (loopNodeData.restApi) {
18026
- return { type: "restApi", data: loopNodeData.restApi };
18027
- } else if (loopNodeData.customCode) {
18028
- return { type: "customCode", data: loopNodeData.customCode };
18029
- } else if (loopNodeData.ethTransfer) {
18030
- return { type: "ethTransfer", data: loopNodeData.ethTransfer };
18031
- } else if (loopNodeData.contractRead) {
18032
- return { type: "contractRead", data: loopNodeData.contractRead };
18033
- } else if (loopNodeData.contractWrite) {
18034
- return { type: "contractWrite", data: loopNodeData.contractWrite };
18035
- } else if (loopNodeData.graphqlDataQuery) {
18036
- return { type: "graphqlDataQuery", data: loopNodeData.graphqlDataQuery };
18264
+ const runnerMapping = {
18265
+ restApi: "restApi",
18266
+ customCode: "customCode",
18267
+ ethTransfer: "ethTransfer",
18268
+ contractRead: "contractRead",
18269
+ contractWrite: "contractWrite",
18270
+ graphqlDataQuery: "graphqlDataQuery"
18271
+ };
18272
+ for (const [type, key] of Object.entries(runnerMapping)) {
18273
+ if (loopNodeData[key]) {
18274
+ return { type, data: loopNodeData[key] };
18275
+ }
18037
18276
  }
18038
18277
  return null;
18039
18278
  }
@@ -18053,9 +18292,9 @@ var LoopNode2 = class _LoopNode extends Node {
18053
18292
  }
18054
18293
  if (typeof executionMode === "string") {
18055
18294
  switch (executionMode.toLowerCase()) {
18056
- case "parallel":
18295
+ case import_types17.ExecutionMode.Parallel:
18057
18296
  return 1;
18058
- case "sequential":
18297
+ case import_types17.ExecutionMode.Sequential:
18059
18298
  default:
18060
18299
  return 0;
18061
18300
  }
@@ -18157,7 +18396,7 @@ var LoopNode2 = class _LoopNode extends Node {
18157
18396
  url: apiConfig.url,
18158
18397
  method: apiConfig.method,
18159
18398
  body: apiConfig.body || "",
18160
- headersMap: apiConfig.headersMap
18399
+ headers: apiConfig.headers
18161
18400
  });
18162
18401
  loopNode.setRestApi(restApi);
18163
18402
  }
@@ -18422,7 +18661,6 @@ var Workflow = class _Workflow {
18422
18661
  if (this.name) {
18423
18662
  request.setName(this.name);
18424
18663
  }
18425
- console.log(`\u{1F4E4} Workflow serialization: ${this.nodes.length} nodes, ${this.edges.length} edges -> protobuf: ${request.getNodesList().length} nodes, ${request.getEdgesList().length} edges`);
18426
18664
  return request;
18427
18665
  }
18428
18666
  /**
@@ -18521,44 +18759,218 @@ var Step = class _Step {
18521
18759
  return void 0;
18522
18760
  // Trigger outputs
18523
18761
  case avs_pb20.Execution.Step.OutputDataCase.BLOCK_TRIGGER:
18524
- return typeof step.getBlockTrigger === "function" ? step.getBlockTrigger()?.toObject() : step.blockTrigger;
18762
+ const blockTrigger = typeof step.getBlockTrigger === "function" ? step.getBlockTrigger()?.toObject() : step.blockTrigger;
18763
+ return { data: blockTrigger };
18764
+ // ✅ Use standard structure
18525
18765
  case avs_pb20.Execution.Step.OutputDataCase.FIXED_TIME_TRIGGER:
18526
- return typeof step.getFixedTimeTrigger === "function" ? step.getFixedTimeTrigger()?.toObject() : step.fixedTimeTrigger;
18766
+ const fixedTimeTrigger = typeof step.getFixedTimeTrigger === "function" ? step.getFixedTimeTrigger()?.toObject() : step.fixedTimeTrigger;
18767
+ return { data: fixedTimeTrigger };
18768
+ // ✅ Use standard structure
18527
18769
  case avs_pb20.Execution.Step.OutputDataCase.CRON_TRIGGER:
18528
- return typeof step.getCronTrigger === "function" ? step.getCronTrigger()?.toObject() : step.cronTrigger;
18770
+ const cronTrigger = typeof step.getCronTrigger === "function" ? step.getCronTrigger()?.toObject() : step.cronTrigger;
18771
+ return { data: cronTrigger };
18772
+ // ✅ Use standard structure
18529
18773
  case avs_pb20.Execution.Step.OutputDataCase.EVENT_TRIGGER:
18530
18774
  const eventTrigger = typeof step.getEventTrigger === "function" ? step.getEventTrigger() : step.eventTrigger;
18531
18775
  if (eventTrigger) {
18532
18776
  if (typeof eventTrigger.hasData === "function" && eventTrigger.hasData()) {
18533
18777
  try {
18534
- return convertProtobufValueToJs(eventTrigger.getData());
18778
+ const eventData = convertProtobufValueToJs(
18779
+ eventTrigger.getData()
18780
+ );
18781
+ return { data: eventData };
18535
18782
  } catch (error) {
18536
18783
  console.warn(
18537
18784
  "Failed to convert event trigger data from protobuf Value:",
18538
18785
  error
18539
18786
  );
18540
- return eventTrigger.getData();
18787
+ return { data: eventTrigger.getData() };
18541
18788
  }
18542
18789
  } else if (eventTrigger.data) {
18543
- return typeof eventTrigger.data.getKindCase === "function" ? convertProtobufValueToJs(eventTrigger.data) : eventTrigger.data;
18790
+ const eventData = typeof eventTrigger.data.getKindCase === "function" ? convertProtobufValueToJs(eventTrigger.data) : eventTrigger.data;
18791
+ return { data: eventData };
18544
18792
  }
18545
18793
  if (typeof eventTrigger.hasEvmLog === "function" && eventTrigger.hasEvmLog()) {
18546
- return eventTrigger.getEvmLog()?.toObject();
18794
+ return { data: eventTrigger.getEvmLog()?.toObject() };
18547
18795
  } else if (typeof eventTrigger.hasTransferLog === "function" && eventTrigger.hasTransferLog()) {
18548
- return eventTrigger.getTransferLog()?.toObject();
18796
+ return { data: eventTrigger.getTransferLog()?.toObject() };
18549
18797
  } else if (eventTrigger.evmLog) {
18550
- return eventTrigger.evmLog;
18798
+ return { data: eventTrigger.evmLog };
18551
18799
  } else if (eventTrigger.transferLog) {
18552
- return eventTrigger.transferLog;
18800
+ return { data: eventTrigger.transferLog };
18553
18801
  }
18554
18802
  }
18555
- return void 0;
18556
- case avs_pb20.Execution.Step.OutputDataCase.MANUAL_TRIGGER:
18557
- return typeof step.getManualTrigger === "function" ? step.getManualTrigger()?.toObject() || void 0 : step.manualTrigger;
18803
+ return { data: null };
18804
+ // ✅ Use standard structure
18805
+ case avs_pb20.Execution.Step.OutputDataCase.MANUAL_TRIGGER: {
18806
+ const manualTrigger = typeof step.getManualTrigger === "function" ? step.getManualTrigger() : step.manualTrigger;
18807
+ if (manualTrigger) {
18808
+ const result = {};
18809
+ if (typeof manualTrigger.hasData === "function" && manualTrigger.hasData()) {
18810
+ try {
18811
+ const userData = convertProtobufValueToJs(
18812
+ manualTrigger.getData()
18813
+ );
18814
+ if (userData && typeof userData === "object" && userData.data !== void 0 && (userData.headers !== void 0 || userData.pathParams !== void 0)) {
18815
+ result.data = userData.data;
18816
+ if (userData.headers) {
18817
+ if (Array.isArray(userData.headers)) {
18818
+ if (userData.headers.length > 0 && Array.isArray(userData.headers[0])) {
18819
+ const headersObject = {};
18820
+ for (const [key, value] of userData.headers) {
18821
+ headersObject[key] = value;
18822
+ }
18823
+ result.headers = headersObject;
18824
+ } else {
18825
+ const headersObject = {};
18826
+ for (const header of userData.headers) {
18827
+ for (const [key, value] of Object.entries(header)) {
18828
+ headersObject[key] = value;
18829
+ }
18830
+ }
18831
+ result.headers = headersObject;
18832
+ }
18833
+ } else {
18834
+ result.headers = userData.headers;
18835
+ }
18836
+ }
18837
+ if (userData.pathParams) {
18838
+ if (Array.isArray(userData.pathParams)) {
18839
+ if (userData.pathParams.length > 0 && Array.isArray(userData.pathParams[0])) {
18840
+ const pathParamsObject = {};
18841
+ for (const [key, value] of userData.pathParams) {
18842
+ pathParamsObject[key] = value;
18843
+ }
18844
+ result.pathParams = pathParamsObject;
18845
+ } else {
18846
+ const pathParamsObject = {};
18847
+ for (const pathParam of userData.pathParams) {
18848
+ for (const [key, value] of Object.entries(pathParam)) {
18849
+ pathParamsObject[key] = value;
18850
+ }
18851
+ }
18852
+ result.pathParams = pathParamsObject;
18853
+ }
18854
+ } else {
18855
+ result.pathParams = userData.pathParams;
18856
+ }
18857
+ }
18858
+ } else {
18859
+ result.data = userData;
18860
+ }
18861
+ } catch (error) {
18862
+ console.warn(
18863
+ "Failed to convert manual trigger data from protobuf Value:",
18864
+ error
18865
+ );
18866
+ result.data = manualTrigger.getData();
18867
+ }
18868
+ } else if (manualTrigger.data) {
18869
+ const userData = typeof manualTrigger.data.getKindCase === "function" ? convertProtobufValueToJs(manualTrigger.data) : manualTrigger.data;
18870
+ if (userData && typeof userData === "object" && userData.data !== void 0 && (userData.headers !== void 0 || userData.pathParams !== void 0)) {
18871
+ result.data = userData.data;
18872
+ if (userData.headers) {
18873
+ if (Array.isArray(userData.headers)) {
18874
+ if (userData.headers.length > 0 && Array.isArray(userData.headers[0])) {
18875
+ const headersObject = {};
18876
+ for (const [key, value] of userData.headers) {
18877
+ headersObject[key] = value;
18878
+ }
18879
+ result.headers = headersObject;
18880
+ } else {
18881
+ const headersObject = {};
18882
+ for (const header of userData.headers) {
18883
+ for (const [key, value] of Object.entries(header)) {
18884
+ headersObject[key] = value;
18885
+ }
18886
+ }
18887
+ result.headers = headersObject;
18888
+ }
18889
+ } else {
18890
+ result.headers = userData.headers;
18891
+ }
18892
+ }
18893
+ if (userData.pathParams) {
18894
+ if (Array.isArray(userData.pathParams)) {
18895
+ if (userData.pathParams.length > 0 && Array.isArray(userData.pathParams[0])) {
18896
+ const pathParamsObject = {};
18897
+ for (const [key, value] of userData.pathParams) {
18898
+ pathParamsObject[key] = value;
18899
+ }
18900
+ result.pathParams = pathParamsObject;
18901
+ } else {
18902
+ const pathParamsObject = {};
18903
+ for (const pathParam of userData.pathParams) {
18904
+ for (const [key, value] of Object.entries(pathParam)) {
18905
+ pathParamsObject[key] = value;
18906
+ }
18907
+ }
18908
+ result.pathParams = pathParamsObject;
18909
+ }
18910
+ } else {
18911
+ result.pathParams = userData.pathParams;
18912
+ }
18913
+ }
18914
+ } else {
18915
+ result.data = userData;
18916
+ }
18917
+ }
18918
+ if (typeof manualTrigger.getHeadersMap === "function") {
18919
+ const headersMap = manualTrigger.getHeadersMap();
18920
+ if (headersMap && headersMap.getLength() > 0) {
18921
+ const headersObject = {};
18922
+ headersMap.forEach((value, key) => {
18923
+ headersObject[key] = value;
18924
+ });
18925
+ result.headers = headersObject;
18926
+ }
18927
+ } else if (manualTrigger.headers) {
18928
+ if (Array.isArray(manualTrigger.headers)) {
18929
+ const headersObject = {};
18930
+ for (const [key, value] of Object.entries(manualTrigger.headers)) {
18931
+ headersObject[key] = value;
18932
+ }
18933
+ result.headers = headersObject;
18934
+ } else {
18935
+ result.headers = manualTrigger.headers;
18936
+ }
18937
+ }
18938
+ if (typeof manualTrigger.getPathparamsMap === "function") {
18939
+ const pathParamsMap = manualTrigger.getPathparamsMap();
18940
+ if (pathParamsMap && pathParamsMap.getLength() > 0) {
18941
+ const pathParamsObject = {};
18942
+ pathParamsMap.forEach((value, key) => {
18943
+ pathParamsObject[key] = value;
18944
+ });
18945
+ result.pathParams = pathParamsObject;
18946
+ }
18947
+ } else if (manualTrigger.pathparams) {
18948
+ if (Array.isArray(manualTrigger.pathparams)) {
18949
+ const pathParamsObject = {};
18950
+ for (const [key, value] of Object.entries(manualTrigger.pathparams)) {
18951
+ pathParamsObject[key] = value;
18952
+ }
18953
+ result.pathParams = pathParamsObject;
18954
+ } else {
18955
+ result.pathParams = manualTrigger.pathparams;
18956
+ }
18957
+ }
18958
+ if (Object.keys(result).length === 0) {
18959
+ const objData = manualTrigger.toObject?.() || manualTrigger;
18960
+ if (objData && objData.data === void 0) {
18961
+ result.data = null;
18962
+ } else {
18963
+ return { data: objData };
18964
+ }
18965
+ }
18966
+ return result;
18967
+ }
18968
+ return { data: null };
18969
+ }
18558
18970
  // Node outputs - RESTORE MISSING CASES
18559
18971
  case avs_pb20.Execution.Step.OutputDataCase.ETH_TRANSFER:
18560
18972
  return typeof step.getEthTransfer === "function" ? step.getEthTransfer()?.toObject() : step.ethTransfer;
18561
- case avs_pb20.Execution.Step.OutputDataCase.CUSTOM_CODE:
18973
+ case avs_pb20.Execution.Step.OutputDataCase.CUSTOM_CODE: {
18562
18974
  const customCodeOutput = typeof step.getCustomCode === "function" ? step.getCustomCode() : step.customCode;
18563
18975
  if (customCodeOutput) {
18564
18976
  if (typeof customCodeOutput.hasData === "function" && customCodeOutput.hasData()) {
@@ -18572,7 +18984,8 @@ var Step = class _Step {
18572
18984
  }
18573
18985
  }
18574
18986
  return void 0;
18575
- case avs_pb20.Execution.Step.OutputDataCase.REST_API:
18987
+ }
18988
+ case avs_pb20.Execution.Step.OutputDataCase.REST_API: {
18576
18989
  const restApiOutput = typeof step.getRestApi === "function" ? step.getRestApi() : step.restApi;
18577
18990
  if (restApiOutput) {
18578
18991
  if (typeof restApiOutput.hasData === "function" && restApiOutput.hasData()) {
@@ -18586,9 +18999,10 @@ var Step = class _Step {
18586
18999
  }
18587
19000
  }
18588
19001
  return void 0;
19002
+ }
18589
19003
  case avs_pb20.Execution.Step.OutputDataCase.BRANCH:
18590
19004
  return typeof step.getBranch === "function" ? step.getBranch()?.toObject() : step.branch;
18591
- case avs_pb20.Execution.Step.OutputDataCase.LOOP:
19005
+ case avs_pb20.Execution.Step.OutputDataCase.LOOP: {
18592
19006
  const loopOutput = typeof step.getLoop === "function" ? step.getLoop() : step.loop;
18593
19007
  if (loopOutput) {
18594
19008
  if (typeof loopOutput.getData === "function" && loopOutput.getData()) {
@@ -18606,7 +19020,8 @@ var Step = class _Step {
18606
19020
  }
18607
19021
  }
18608
19022
  return void 0;
18609
- case avs_pb20.Execution.Step.OutputDataCase.GRAPHQL:
19023
+ }
19024
+ case avs_pb20.Execution.Step.OutputDataCase.GRAPHQL: {
18610
19025
  const graphqlOutput = typeof step.getGraphql === "function" ? step.getGraphql() : step.graphql;
18611
19026
  if (graphqlOutput) {
18612
19027
  try {
@@ -18616,7 +19031,8 @@ var Step = class _Step {
18616
19031
  }
18617
19032
  }
18618
19033
  return void 0;
18619
- case avs_pb20.Execution.Step.OutputDataCase.CONTRACT_READ:
19034
+ }
19035
+ case avs_pb20.Execution.Step.OutputDataCase.CONTRACT_READ: {
18620
19036
  const contractReadOutput = typeof step.getContractRead === "function" ? step.getContractRead() : step.contractRead;
18621
19037
  if (contractReadOutput) {
18622
19038
  if (typeof contractReadOutput.hasData === "function" && contractReadOutput.hasData()) {
@@ -18656,7 +19072,8 @@ var Step = class _Step {
18656
19072
  return outputObj;
18657
19073
  }
18658
19074
  return void 0;
18659
- case avs_pb20.Execution.Step.OutputDataCase.CONTRACT_WRITE:
19075
+ }
19076
+ case avs_pb20.Execution.Step.OutputDataCase.CONTRACT_WRITE: {
18660
19077
  const contractWriteOutput = typeof step.getContractWrite === "function" ? step.getContractWrite() : step.contractWrite;
18661
19078
  if (contractWriteOutput) {
18662
19079
  if (typeof contractWriteOutput.hasData === "function" && contractWriteOutput.hasData()) {
@@ -18699,7 +19116,8 @@ var Step = class _Step {
18699
19116
  return outputObj;
18700
19117
  }
18701
19118
  return void 0;
18702
- case avs_pb20.Execution.Step.OutputDataCase.FILTER:
19119
+ }
19120
+ case avs_pb20.Execution.Step.OutputDataCase.FILTER: {
18703
19121
  const filterOutput = typeof step.getFilter === "function" ? step.getFilter() : step.filter;
18704
19122
  if (filterOutput) {
18705
19123
  try {
@@ -18709,6 +19127,7 @@ var Step = class _Step {
18709
19127
  }
18710
19128
  }
18711
19129
  return void 0;
19130
+ }
18712
19131
  default:
18713
19132
  console.warn(
18714
19133
  `Unhandled output data type in Step.getOutput: ${step.getOutputDataCase()}`
@@ -19407,7 +19826,22 @@ var Client = class extends BaseClient {
19407
19826
  case import_types20.TriggerType.Manual: {
19408
19827
  const manualData = triggerData;
19409
19828
  const manualOutput = new avs_pb22.ManualTrigger.Output();
19410
- if (manualData.runAt) manualOutput.setRunAt(manualData.runAt);
19829
+ if (manualData.data) {
19830
+ const protobufValue = convertJSValueToProtobuf(manualData.data);
19831
+ manualOutput.setData(protobufValue);
19832
+ }
19833
+ if (manualData.headers) {
19834
+ const headersMap = manualOutput.getHeadersMap();
19835
+ Object.entries(manualData.headers).forEach(([key, value]) => {
19836
+ headersMap.set(key, value);
19837
+ });
19838
+ }
19839
+ if (manualData.pathParams) {
19840
+ const pathParamsMap = manualOutput.getPathparamsMap();
19841
+ Object.entries(manualData.pathParams).forEach(([key, value]) => {
19842
+ pathParamsMap.set(key, value);
19843
+ });
19844
+ }
19411
19845
  request.setManualTrigger(manualOutput);
19412
19846
  break;
19413
19847
  }