@avaprotocol/sdk-js 2.3.13-de.0 → 2.3.13-dev.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.
Files changed (41) hide show
  1. package/dist/index.js +1103 -401
  2. package/dist/index.mjs +1107 -405
  3. package/dist/models/node/branch.d.ts.map +1 -1
  4. package/dist/models/node/branch.js +12 -3
  5. package/dist/models/node/contractRead.d.ts.map +1 -1
  6. package/dist/models/node/contractRead.js +12 -3
  7. package/dist/models/node/contractWrite.d.ts.map +1 -1
  8. package/dist/models/node/contractWrite.js +12 -3
  9. package/dist/models/node/customCode.d.ts.map +1 -1
  10. package/dist/models/node/customCode.js +12 -4
  11. package/dist/models/node/ethTransfer.d.ts.map +1 -1
  12. package/dist/models/node/ethTransfer.js +12 -3
  13. package/dist/models/node/filter.d.ts.map +1 -1
  14. package/dist/models/node/filter.js +12 -3
  15. package/dist/models/node/graphqlQuery.d.ts.map +1 -1
  16. package/dist/models/node/graphqlQuery.js +12 -3
  17. package/dist/models/node/interface.d.ts +3 -2
  18. package/dist/models/node/interface.d.ts.map +1 -1
  19. package/dist/models/node/interface.js +17 -2
  20. package/dist/models/node/loop.d.ts.map +1 -1
  21. package/dist/models/node/loop.js +9 -0
  22. package/dist/models/node/restApi.d.ts.map +1 -1
  23. package/dist/models/node/restApi.js +15 -1
  24. package/dist/models/step.d.ts +1 -0
  25. package/dist/models/step.d.ts.map +1 -1
  26. package/dist/models/step.js +308 -206
  27. package/dist/models/trigger/block.d.ts.map +1 -1
  28. package/dist/models/trigger/block.js +13 -0
  29. package/dist/models/trigger/cron.d.ts.map +1 -1
  30. package/dist/models/trigger/cron.js +20 -0
  31. package/dist/models/trigger/event.d.ts.map +1 -1
  32. package/dist/models/trigger/fixedTime.d.ts.map +1 -1
  33. package/dist/models/trigger/interface.d.ts +4 -5
  34. package/dist/models/trigger/interface.d.ts.map +1 -1
  35. package/dist/models/trigger/interface.js +4 -2
  36. package/dist/models/trigger/manual.d.ts.map +1 -1
  37. package/dist/models/trigger/manual.js +13 -0
  38. package/dist/utils.d.ts +20 -0
  39. package/dist/utils.d.ts.map +1 -1
  40. package/dist/utils.js +52 -0
  41. package/package.json +2 -2
@@ -1,4 +1,5 @@
1
1
  import * as avs_pb from "@/grpc_codegen/avs_pb";
2
+ import * as google_protobuf_struct_pb from "google-protobuf/google/protobuf/struct_pb";
2
3
  import Trigger from "./interface";
3
4
  import { TriggerType } from "@avaprotocol/types";
4
5
  class CronTrigger extends Trigger {
@@ -26,6 +27,16 @@ class CronTrigger extends Trigger {
26
27
  const config = new avs_pb.CronTrigger.Config();
27
28
  config.setSchedulesList(cronData.schedules);
28
29
  trigger.setConfig(config);
30
+ // ✨ NEW: Set input data if provided
31
+ if (this.input) {
32
+ try {
33
+ const inputValue = google_protobuf_struct_pb.Value.fromJavaScript(this.input);
34
+ trigger.setInput(inputValue);
35
+ }
36
+ catch (error) {
37
+ throw new Error(`Failed to convert input data to protobuf.Value: ${error}`);
38
+ }
39
+ }
29
40
  request.setCron(trigger);
30
41
  return request;
31
42
  }
@@ -41,10 +52,19 @@ class CronTrigger extends Trigger {
41
52
  };
42
53
  }
43
54
  }
55
+ // ✨ NEW: Extract input data if present
56
+ let input;
57
+ if (raw.getCron() && raw.getCron().hasInput()) {
58
+ const inputValue = raw.getCron().getInput();
59
+ if (inputValue) {
60
+ input = inputValue.toObject();
61
+ }
62
+ }
44
63
  return new CronTrigger({
45
64
  ...obj,
46
65
  type: TriggerType.Cron,
47
66
  data: data,
67
+ input: input, // ✨ NEW: Include input data
48
68
  });
49
69
  }
50
70
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/event.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,OAA0B,MAAM,aAAa,CAAC;AACrD,OAAO,EAGL,kBAAkB,EAClB,iBAAiB,EAElB,MAAM,oBAAoB,CAAC;AA6C5B,cAAM,YAAa,SAAQ,OAAO;gBACpB,KAAK,EAAE,iBAAiB;IAIpC,SAAS,IAAI,MAAM,CAAC,WAAW;IA4D/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,YAAY;IAuD1D;;;;OAIG;IACH,SAAS,IAAI,kBAAkB,GAAG,SAAS;IAI3C;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,GAAG;CAW9D;AAED,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/event.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,EAGL,kBAAkB,EAClB,iBAAiB,EAGlB,MAAM,oBAAoB,CAAC;AA8C5B,cAAM,YAAa,SAAQ,OAAO;gBACpB,KAAK,EAAE,iBAAiB;IAIpC,SAAS,IAAI,MAAM,CAAC,WAAW;IA4D/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,YAAY;IAuD1D;;;;OAIG;IACH,SAAS,IAAI,kBAAkB,GAAG,SAAS;IAI3C;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,GAAG;CAW9D;AAED,eAAe,YAAY,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"fixedTime.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/fixedTime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,OAA0B,MAAM,aAAa,CAAC;AACrD,OAAO,EAAyC,sBAAsB,EAAE,qBAAqB,EAAgB,MAAM,oBAAoB,CAAC;AAKxI,cAAM,gBAAiB,SAAQ,OAAO;gBACxB,KAAK,EAAE,qBAAqB;IAIxC,SAAS,IAAI,MAAM,CAAC,WAAW;IAoB/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,gBAAgB;IAuB9D;;;;OAIG;IACH,SAAS,IAAI,sBAAsB,GAAG,SAAS;IAI/C;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,GAAG;CAW9D;AAED,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"fixedTime.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/fixedTime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,EAAyC,sBAAsB,EAAE,qBAAqB,EAA+B,MAAM,oBAAoB,CAAC;AAMvJ,cAAM,gBAAiB,SAAQ,OAAO;gBACxB,KAAK,EAAE,qBAAqB;IAIxC,SAAS,IAAI,MAAM,CAAC,WAAW;IAoB/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,gBAAgB;IAuB9D;;;;OAIG;IACH,SAAS,IAAI,sBAAsB,GAAG,SAAS;IAI/C;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,GAAG;CAW9D;AAED,eAAe,gBAAgB,CAAC"}
@@ -1,13 +1,13 @@
1
1
  import * as avs_pb from "@/grpc_codegen/avs_pb";
2
- import { TriggerType, TriggerProps } from "@avaprotocol/types";
3
- export type TriggerData = avs_pb.FixedTimeTrigger.AsObject | avs_pb.CronTrigger.AsObject | avs_pb.BlockTrigger.AsObject | avs_pb.EventTrigger.AsObject | Record<string, any> | null;
4
- export type TriggerOutput = avs_pb.FixedTimeTrigger.Output.AsObject | avs_pb.CronTrigger.Output.AsObject | avs_pb.BlockTrigger.Output.AsObject | avs_pb.EventTrigger.Output.AsObject | avs_pb.ManualTrigger.Output.AsObject | null;
5
- declare class Trigger implements TriggerProps {
2
+ import * as google_protobuf_struct_pb from "google-protobuf/google/protobuf/struct_pb";
3
+ import { TriggerType, TriggerProps, TriggerData, TriggerOutput } from "@avaprotocol/types";
4
+ export default abstract class Trigger implements TriggerProps {
6
5
  id: string;
7
6
  name: string;
8
7
  type: TriggerType;
9
8
  data: TriggerData;
10
9
  output?: TriggerOutput;
10
+ input?: google_protobuf_struct_pb.Value.AsObject | Record<string, any>;
11
11
  /**
12
12
  * Create an instance of Trigger from user inputs
13
13
  * @param props
@@ -17,5 +17,4 @@ declare class Trigger implements TriggerProps {
17
17
  getOutput(): TriggerOutput | undefined;
18
18
  toJson(): TriggerProps;
19
19
  }
20
- export default Trigger;
21
20
  //# sourceMappingURL=interface.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAE/D,MAAM,MAAM,WAAW,GACnB,MAAM,CAAC,gBAAgB,CAAC,QAAQ,GAChC,MAAM,CAAC,WAAW,CAAC,QAAQ,GAC3B,MAAM,CAAC,YAAY,CAAC,QAAQ,GAC5B,MAAM,CAAC,YAAY,CAAC,QAAQ,GAC5B,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACnB,IAAI,CAAC;AAET,MAAM,MAAM,aAAa,GACrB,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,QAAQ,GACvC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,QAAQ,GAClC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,GACnC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,GACnC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ,GACpC,IAAI,CAAC;AAIT,cAAM,OAAQ,YAAW,YAAY;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,WAAW,CAAC;IAClB,MAAM,CAAC,EAAE,aAAa,CAAC;IAEvB;;;OAGG;gBACS,KAAK,EAAE,YAAY;IAQ/B,SAAS,IAAI,MAAM,CAAC,WAAW;IAI/B,SAAS,IAAI,aAAa,GAAG,SAAS;IAItC,MAAM,IAAI,YAAY;CASvB;AAED,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,KAAK,yBAAyB,MAAM,2CAA2C,CAAC;AACvF,OAAO,EACL,WAAW,EAGX,YAAY,EACZ,WAAW,EACX,aAAa,EACd,MAAM,oBAAoB,CAAC;AAI5B,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,OAAQ,YAAW,YAAY;IAC3D,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,WAAW,CAAC;IAClB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,KAAK,CAAC,EAAE,yBAAyB,CAAC,KAAK,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAEvE;;;OAGG;gBACS,KAAK,EAAE,YAAY;IAS/B,SAAS,IAAI,MAAM,CAAC,WAAW;IAI/B,SAAS,IAAI,aAAa,GAAG,SAAS;IAItC,MAAM,IAAI,YAAY;CAUvB"}
@@ -1,4 +1,5 @@
1
- class Trigger {
1
+ import { extractInputFromProtobuf } from "../../utils";
2
+ export default class Trigger {
2
3
  /**
3
4
  * Create an instance of Trigger from user inputs
4
5
  * @param props
@@ -9,6 +10,7 @@ class Trigger {
9
10
  this.type = props.type;
10
11
  this.data = props.data;
11
12
  this.output = props.output;
13
+ this.input = props.input ? extractInputFromProtobuf(props.input) : undefined;
12
14
  }
13
15
  toRequest() {
14
16
  throw new Error("Method not implemented.");
@@ -23,7 +25,7 @@ class Trigger {
23
25
  type: this.type,
24
26
  data: this.data,
25
27
  output: this.output,
28
+ input: this.input,
26
29
  };
27
30
  }
28
31
  }
29
- export default Trigger;
@@ -1 +1 @@
1
- {"version":3,"file":"manual.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/manual.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,EAAe,mBAAmB,EAAE,kBAAkB,EAAgB,MAAM,oBAAoB,CAAC;AAIxG,cAAM,aAAc,SAAQ,OAAO;gBACrB,KAAK,EAAE,kBAAkB;IAIrC,SAAS,IAAI,MAAM,CAAC,WAAW;IAW/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,aAAa;IAU3D,iBAAiB,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;IAI/C;;;;OAIG;IACH,SAAS,IAAI,mBAAmB,GAAG,SAAS;IAI5C;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,GAAG;CAI9D;AAED,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"manual.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/manual.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,OAAO,MAAM,aAAa,CAAC;AAElC,OAAO,EAAe,mBAAmB,EAAE,kBAAkB,EAAgB,MAAM,oBAAoB,CAAC;AAIxG,cAAM,aAAc,SAAQ,OAAO;gBACrB,KAAK,EAAE,kBAAkB;IAIrC,SAAS,IAAI,MAAM,CAAC,WAAW;IAkB/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,aAAa;IAiB3D,iBAAiB,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;IAI/C;;;;OAIG;IACH,SAAS,IAAI,mBAAmB,GAAG,SAAS;IAI5C;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,GAAG;CAI9D;AAED,eAAe,aAAa,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import * as avs_pb from "@/grpc_codegen/avs_pb";
2
2
  import Trigger from "./interface";
3
+ import { convertInputToProtobuf, extractInputFromProtobuf } from "../../utils";
3
4
  import { TriggerType } from "@avaprotocol/types";
4
5
  class ManualTrigger extends Trigger {
5
6
  constructor(props) {
@@ -11,14 +12,26 @@ class ManualTrigger extends Trigger {
11
12
  trigger.setName(this.name);
12
13
  trigger.setType(avs_pb.TriggerType.TRIGGER_TYPE_MANUAL);
13
14
  trigger.setManual(true);
15
+ // Convert input field to protobuf format and set on top-level TaskTrigger
16
+ // Manual triggers use the top-level input field since they don't have nested structure
17
+ const inputValue = convertInputToProtobuf(this.input);
18
+ if (inputValue) {
19
+ trigger.setInput(inputValue);
20
+ }
14
21
  return trigger;
15
22
  }
16
23
  static fromResponse(raw) {
17
24
  const obj = raw.toObject();
25
+ // Extract input from top-level TaskTrigger input field for manual triggers
26
+ let input = undefined;
27
+ if (raw.hasInput()) {
28
+ input = extractInputFromProtobuf(raw.getInput());
29
+ }
18
30
  return new ManualTrigger({
19
31
  ...obj,
20
32
  type: TriggerType.Manual,
21
33
  data: null, // Manual triggers don't have data in the protobuf response
34
+ input: input,
22
35
  });
23
36
  }
24
37
  getInputVariables() {
package/dist/utils.d.ts CHANGED
@@ -57,4 +57,24 @@ export declare function convertProtobufNodeTypeToSdk(protobufType: string): stri
57
57
  * @returns The SDK type string (e.g., "manualTrigger" or "customCode")
58
58
  */
59
59
  export declare function convertProtobufStepTypeToSdk(protobufType: string): string;
60
+ /**
61
+ * Convert input field from JavaScript object to protobuf Value format
62
+ *
63
+ * Pure utility function for converting trigger/node input data to protobuf format.
64
+ * Can be used by both triggers and nodes.
65
+ *
66
+ * @param input - JavaScript object with input data, or undefined
67
+ * @returns protobuf Value or undefined if no input
68
+ */
69
+ export declare function convertInputToProtobuf(input?: Record<string, any>): ProtobufValue | undefined;
70
+ /**
71
+ * Extract input field from protobuf Value format to JavaScript object
72
+ *
73
+ * Pure utility function for extracting trigger/node input data from protobuf format.
74
+ * Can be used by both triggers and nodes.
75
+ *
76
+ * @param inputValue - protobuf Value from response, plain JavaScript object, or undefined
77
+ * @returns JavaScript object or undefined
78
+ */
79
+ export declare function extractInputFromProtobuf(inputValue?: ProtobufValue | Record<string, any>): Record<string, any> | undefined;
60
80
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,IAAI,aAAa,EAGvB,MAAM,2CAA2C,CAAC;AAGnD;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,CAAC,EAAE,aAAa,GAAG,GAAG,CAiCnE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,GAAG,GAAG,GAAG,CAkDxD;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,GAAG,GAAG,aAAa,CA6BlE;AAED;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAkB5E;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CA0BzE;AAED;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CASzE"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,IAAI,aAAa,EAGvB,MAAM,2CAA2C,CAAC;AAGnD;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,CAAC,EAAE,aAAa,GAAG,GAAG,CAiCnE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,GAAG,GAAG,GAAG,CAkDxD;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,GAAG,GAAG,aAAa,CA6BlE;AAED;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAkB5E;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CA0BzE;AAED;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CASzE;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,aAAa,GAAG,SAAS,CAK7F;AAED;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,UAAU,CAAC,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CA6B1H"}
package/dist/utils.js CHANGED
@@ -228,3 +228,55 @@ export function convertProtobufStepTypeToSdk(protobufType) {
228
228
  return protobufType; // fallback to raw value
229
229
  }
230
230
  }
231
+ /**
232
+ * Convert input field from JavaScript object to protobuf Value format
233
+ *
234
+ * Pure utility function for converting trigger/node input data to protobuf format.
235
+ * Can be used by both triggers and nodes.
236
+ *
237
+ * @param input - JavaScript object with input data, or undefined
238
+ * @returns protobuf Value or undefined if no input
239
+ */
240
+ export function convertInputToProtobuf(input) {
241
+ if (!input) {
242
+ return undefined;
243
+ }
244
+ return ProtobufValue.fromJavaScript(input);
245
+ }
246
+ /**
247
+ * Extract input field from protobuf Value format to JavaScript object
248
+ *
249
+ * Pure utility function for extracting trigger/node input data from protobuf format.
250
+ * Can be used by both triggers and nodes.
251
+ *
252
+ * @param inputValue - protobuf Value from response, plain JavaScript object, or undefined
253
+ * @returns JavaScript object or undefined
254
+ */
255
+ export function extractInputFromProtobuf(inputValue) {
256
+ if (!inputValue) {
257
+ return undefined;
258
+ }
259
+ // Check if it's already a plain JavaScript object
260
+ if (typeof inputValue === 'object' && !inputValue.toJavaScript) {
261
+ // It's a plain JavaScript object, return as-is
262
+ if (!Array.isArray(inputValue)) {
263
+ return inputValue;
264
+ }
265
+ return undefined;
266
+ }
267
+ // It's a protobuf Value object, convert it
268
+ try {
269
+ const protobufValue = inputValue;
270
+ const inputJavaScript = protobufValue.toJavaScript();
271
+ if (inputJavaScript && typeof inputJavaScript === 'object' && !Array.isArray(inputJavaScript)) {
272
+ return inputJavaScript;
273
+ }
274
+ }
275
+ catch (error) {
276
+ // If conversion fails, try to return the object as-is if it looks like a valid input object
277
+ if (typeof inputValue === 'object' && !Array.isArray(inputValue)) {
278
+ return inputValue;
279
+ }
280
+ }
281
+ return undefined;
282
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avaprotocol/sdk-js",
3
- "version": "2.3.13-de.0",
3
+ "version": "2.3.13-dev.1",
4
4
  "description": "A JavaScript/TypeScript SDK designed to simplify integration with Ava Protocol's AVS",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -31,7 +31,7 @@
31
31
  "prepare": "node ../../scripts/prepare-package.js"
32
32
  },
33
33
  "dependencies": {
34
- "@avaprotocol/types": "^2.2.9",
34
+ "@avaprotocol/types": "^2.2.10",
35
35
  "@grpc/grpc-js": "^1.11.3",
36
36
  "@grpc/proto-loader": "^0.7.13",
37
37
  "dotenv": "^16.4.5",