@avaprotocol/sdk-js 2.6.2 → 2.6.4-dev.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 (40) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +185 -260
  4. package/dist/index.mjs +185 -260
  5. package/dist/models/node/filter.d.ts +1 -1
  6. package/dist/models/node/filter.d.ts.map +1 -1
  7. package/dist/models/node/filter.js +5 -14
  8. package/dist/models/trigger/block.d.ts +2 -3
  9. package/dist/models/trigger/block.d.ts.map +1 -1
  10. package/dist/models/trigger/block.js +22 -37
  11. package/dist/models/trigger/cron.d.ts +2 -2
  12. package/dist/models/trigger/cron.d.ts.map +1 -1
  13. package/dist/models/trigger/cron.js +18 -18
  14. package/dist/models/trigger/event.d.ts.map +1 -1
  15. package/dist/models/trigger/event.js +5 -1
  16. package/dist/models/trigger/fixedTime.d.ts +2 -2
  17. package/dist/models/trigger/fixedTime.d.ts.map +1 -1
  18. package/dist/models/trigger/fixedTime.js +10 -10
  19. package/package.json +2 -2
  20. package/dist/auth.d.ts +0 -2
  21. package/dist/auth.d.ts.map +0 -1
  22. package/dist/auth.js +0 -10
  23. package/dist/config.d.ts +0 -9
  24. package/dist/index.d.ts +0 -351
  25. package/dist/models/edge.d.ts +0 -12
  26. package/dist/models/execution.d.ts +0 -20
  27. package/dist/models/node/branch.d.ts +0 -11
  28. package/dist/models/node/contractRead.d.ts +0 -17
  29. package/dist/models/node/contractWrite.d.ts +0 -17
  30. package/dist/models/node/customCode.d.ts +0 -20
  31. package/dist/models/node/ethTransfer.d.ts +0 -20
  32. package/dist/models/node/factory.d.ts +0 -23
  33. package/dist/models/node/graphqlQuery.d.ts +0 -21
  34. package/dist/models/node/interface.d.ts +0 -20
  35. package/dist/models/node/loop.d.ts +0 -15
  36. package/dist/models/node/restApi.d.ts +0 -22
  37. package/dist/models/secret.d.ts +0 -16
  38. package/dist/models/step.d.ts +0 -27
  39. package/dist/models/workflow.d.ts +0 -47
  40. package/dist/utils.d.ts +0 -72
@@ -5,7 +5,7 @@ declare class FilterNode extends Node {
5
5
  constructor(props: FilterNodeProps);
6
6
  static fromResponse(raw: avs_pb.TaskNode): FilterNode;
7
7
  toRequest(): avs_pb.TaskNode;
8
- static fromOutputData(outputData: avs_pb.RunNodeWithInputsResp): any;
8
+ static fromOutputData(outputData: avs_pb.RunNodeWithInputsResp): unknown[];
9
9
  }
10
10
  export default FilterNode;
11
11
  //# sourceMappingURL=filter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../../src/models/node/filter.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAGL,eAAe,EAEhB,MAAM,oBAAoB,CAAC;AAM5B,cAAM,UAAW,SAAQ,IAAI;gBACf,KAAK,EAAE,eAAe;IAIlC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,UAAU;IAWrD,SAAS,IAAI,MAAM,CAAC,QAAQ;IAiB5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CA+CrE;AAED,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../../src/models/node/filter.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAGL,eAAe,EAEhB,MAAM,oBAAoB,CAAC;AAM5B,cAAM,UAAW,SAAQ,IAAI;gBACf,KAAK,EAAE,eAAe;IAIlC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,UAAU;IAWrD,SAAS,IAAI,MAAM,CAAC,QAAQ;IAiB5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,OAAO,EAAE;CAoC3E;AAED,eAAe,UAAU,CAAC"}
@@ -36,18 +36,13 @@ class FilterNode extends Node {
36
36
  if (!anyData) {
37
37
  throw new Error("FilterNode output data.getData() is missing");
38
38
  }
39
- // The data is now directly a Value, not wrapped in Any
39
+ // The data is now directly a Value containing the filtered array
40
40
  const result = anyData.toJavaScript();
41
- // The result contains nested data structure, extract the actual array
42
- if (result &&
43
- typeof result === "object" &&
44
- !Array.isArray(result) &&
45
- result.data &&
46
- result.data.data &&
47
- Array.isArray(result.data.data)) {
48
- return result.data.data;
41
+ // If result is already an array, return it directly (this should be the normal case now)
42
+ if (Array.isArray(result)) {
43
+ return result;
49
44
  }
50
- // If result.data is already an array, return it directly
45
+ // Fallback: if result is an object with data field
51
46
  if (result &&
52
47
  typeof result === "object" &&
53
48
  !Array.isArray(result) &&
@@ -55,10 +50,6 @@ class FilterNode extends Node {
55
50
  Array.isArray(result.data)) {
56
51
  return result.data;
57
52
  }
58
- // If result is already an array, return it directly
59
- if (Array.isArray(result)) {
60
- return result;
61
- }
62
53
  throw new Error("FilterNode output data does not contain expected data structure");
63
54
  }
64
55
  }
@@ -1,13 +1,12 @@
1
1
  import * as avs_pb from "@/grpc_codegen/avs_pb";
2
2
  import Trigger from "./interface";
3
- import { BlockTriggerOutput, BlockTriggerProps } from "@avaprotocol/types";
3
+ import { BlockTriggerProps, BlockTriggerOutput } from "@avaprotocol/types";
4
4
  declare class BlockTrigger extends Trigger {
5
5
  constructor(props: BlockTriggerProps);
6
6
  toRequest(): avs_pb.TaskTrigger;
7
7
  static fromResponse(raw: avs_pb.TaskTrigger): BlockTrigger;
8
8
  /**
9
- * Convert raw data from runNodeWithInputs response to BlockOutput format
10
- * @param rawData - The raw data from the gRPC response
9
+ * Convert the output to the expected format
11
10
  * @returns {BlockTriggerOutput | undefined} - The converted data
12
11
  */
13
12
  getOutput(): BlockTriggerOutput | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/block.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,EAGL,kBAAkB,EAClB,iBAAiB,EAElB,MAAM,oBAAoB,CAAC;AAC5B,cAAM,YAAa,SAAQ,OAAO;gBACpB,KAAK,EAAE,iBAAiB;IAIpC,SAAS,IAAI,MAAM,CAAC,WAAW;IAqC/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,YAAY;IAuB1D;;;;OAIG;IACH,SAAS,IAAI,kBAAkB,GAAG,SAAS;IAI3C;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,GAAG;CAY9D;AAED,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/block.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,EAEL,iBAAiB,EAEjB,kBAAkB,EAEnB,MAAM,oBAAoB,CAAC;AAC5B,cAAM,YAAa,SAAQ,OAAO;gBACpB,KAAK,EAAE,iBAAiB;IAOpC,SAAS,IAAI,MAAM,CAAC,WAAW;IAoB/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,YAAY;IAoB1D;;;OAGG;IACH,SAAS,IAAI,kBAAkB,GAAG,SAAS;IAI3C;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,GAAG;CAY9D;AAED,eAAe,YAAY,CAAC"}
@@ -1,59 +1,44 @@
1
1
  import * as avs_pb from "@/grpc_codegen/avs_pb";
2
2
  import Trigger from "./interface";
3
- import { TriggerType, } from "@avaprotocol/types";
3
+ import { TriggerType } from "@avaprotocol/types";
4
4
  class BlockTrigger extends Trigger {
5
5
  constructor(props) {
6
- super({ ...props, type: TriggerType.Block, data: props.data });
6
+ super({
7
+ ...props,
8
+ type: TriggerType.Block,
9
+ });
7
10
  }
8
11
  toRequest() {
9
- const request = new avs_pb.TaskTrigger();
10
- request.setName(this.name);
11
- request.setId(this.id);
12
- request.setType(avs_pb.TriggerType.TRIGGER_TYPE_BLOCK);
13
- if (!this.data) {
14
- throw new Error(`Trigger data is missing for block`);
15
- }
16
- const blockData = this.data;
17
- // Validate interval exists
18
- if (blockData.interval === null || blockData.interval === undefined) {
19
- throw new Error("Interval is required for block trigger");
20
- }
21
- // Validate that interval is an integer
22
- if (!Number.isInteger(blockData.interval)) {
23
- throw new Error(`BlockTrigger interval must be an integer, got: ${blockData.interval}`);
24
- }
25
- // Validate interval is positive
26
- if (blockData.interval <= 0) {
27
- throw new Error(`Interval must be greater than 0`);
28
- }
29
- const trigger = new avs_pb.BlockTrigger();
12
+ const trigger = new avs_pb.TaskTrigger();
13
+ trigger.setId(this.id);
14
+ trigger.setName(this.name);
15
+ trigger.setType(avs_pb.TriggerType.TRIGGER_TYPE_BLOCK);
16
+ const blockTrigger = new avs_pb.BlockTrigger();
30
17
  const config = new avs_pb.BlockTrigger.Config();
31
- config.setInterval(blockData.interval);
32
- trigger.setConfig(config);
33
- request.setBlock(trigger);
34
- return request;
18
+ const blockData = this.data;
19
+ config.setInterval(blockData.interval || 0);
20
+ blockTrigger.setConfig(config);
21
+ trigger.setBlock(blockTrigger);
22
+ return trigger;
35
23
  }
36
24
  static fromResponse(raw) {
37
- // Convert the raw object to TriggerProps, which should keep name and id
38
25
  const obj = raw.toObject();
39
26
  let data = { interval: 0 };
40
27
  if (raw.getBlock() && raw.getBlock().hasConfig()) {
41
28
  const config = raw.getBlock().getConfig();
42
- if (config) {
43
- data = {
44
- interval: config.getInterval() || 0,
45
- };
46
- }
29
+ data = {
30
+ interval: config.getInterval(),
31
+ };
47
32
  }
48
33
  return new BlockTrigger({
49
- ...obj,
50
- type: TriggerType.Block,
34
+ id: obj.id,
35
+ name: obj.name,
36
+ type: obj.type,
51
37
  data: data,
52
38
  });
53
39
  }
54
40
  /**
55
- * Convert raw data from runNodeWithInputs response to BlockOutput format
56
- * @param rawData - The raw data from the gRPC response
41
+ * Convert the output to the expected format
57
42
  * @returns {BlockTriggerOutput | undefined} - The converted data
58
43
  */
59
44
  getOutput() {
@@ -1,12 +1,12 @@
1
1
  import * as avs_pb from "@/grpc_codegen/avs_pb";
2
2
  import Trigger from "./interface";
3
- import { CronTriggerOutput, CronTriggerProps } from "@avaprotocol/types";
3
+ import { CronTriggerProps, CronTriggerOutput } from "@avaprotocol/types";
4
4
  declare class CronTrigger extends Trigger {
5
5
  constructor(props: CronTriggerProps);
6
6
  toRequest(): avs_pb.TaskTrigger;
7
7
  static fromResponse(raw: avs_pb.TaskTrigger): CronTrigger;
8
8
  /**
9
- * Convert raw data from runTrigger response to CronOutput format
9
+ * Convert raw data from runNodeWithInputs response to CronOutput format
10
10
  * @param rawData - The raw data from the gRPC response
11
11
  * @returns {CronTriggerOutput | undefined} - The converted data
12
12
  */
@@ -1 +1 @@
1
- {"version":3,"file":"cron.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/cron.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,EAGL,iBAAiB,EACjB,gBAAgB,EAEjB,MAAM,oBAAoB,CAAC;AAE5B,cAAM,WAAY,SAAQ,OAAO;gBACnB,KAAK,EAAE,gBAAgB;IAInC,SAAS,IAAI,MAAM,CAAC,WAAW;IAgC/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,WAAW;IAuBzD;;;;OAIG;IACH,SAAS,IAAI,iBAAiB,GAAG,SAAS;IAI1C;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,GAAG;CAY9D;AAED,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"cron.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/cron.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,EAEL,gBAAgB,EAEhB,iBAAiB,EAElB,MAAM,oBAAoB,CAAC;AAE5B,cAAM,WAAY,SAAQ,OAAO;gBACnB,KAAK,EAAE,gBAAgB;IAOnC,SAAS,IAAI,MAAM,CAAC,WAAW;IAiC/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,WAAW;IAmBzD;;;;OAIG;IACH,SAAS,IAAI,iBAAiB,GAAG,SAAS;IAI1C;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,GAAG;CAY9D;AAED,eAAe,WAAW,CAAC"}
@@ -1,45 +1,45 @@
1
1
  import * as avs_pb from "@/grpc_codegen/avs_pb";
2
2
  import Trigger from "./interface";
3
- import { TriggerType, } from "@avaprotocol/types";
3
+ import { TriggerType } from "@avaprotocol/types";
4
4
  class CronTrigger extends Trigger {
5
5
  constructor(props) {
6
- super({ ...props, type: TriggerType.Cron, data: props.data });
6
+ super({
7
+ ...props,
8
+ type: TriggerType.Cron,
9
+ });
7
10
  }
8
11
  toRequest() {
9
12
  const request = new avs_pb.TaskTrigger();
10
- request.setName(this.name);
11
13
  request.setId(this.id);
14
+ request.setName(this.name);
12
15
  request.setType(avs_pb.TriggerType.TRIGGER_TYPE_CRON);
13
16
  if (!this.data) {
14
17
  throw new Error(`Trigger data is missing for ${this.type}`);
15
18
  }
16
19
  const cronData = this.data;
17
20
  // Validate schedules is present and not null/undefined
18
- if (cronData.schedules === null || cronData.schedules === undefined) {
19
- throw new Error("Schedules are required for cron trigger");
21
+ if (!cronData.schedules || !Array.isArray(cronData.schedules)) {
22
+ throw new Error("Schedules array is required for cron trigger");
20
23
  }
21
- // Validate schedules is not empty
22
- if (!Array.isArray(cronData.schedules) || cronData.schedules.length === 0) {
23
- throw new Error("Schedules are required for cron trigger");
24
+ // Validate schedules array is not empty
25
+ if (cronData.schedules.length === 0) {
26
+ throw new Error("At least one schedule is required for cron trigger");
24
27
  }
25
- const trigger = new avs_pb.CronTrigger();
26
28
  const config = new avs_pb.CronTrigger.Config();
27
29
  config.setSchedulesList(cronData.schedules);
28
- trigger.setConfig(config);
29
- request.setCron(trigger);
30
+ const cronTrigger = new avs_pb.CronTrigger();
31
+ cronTrigger.setConfig(config);
32
+ request.setCron(cronTrigger);
30
33
  return request;
31
34
  }
32
35
  static fromResponse(raw) {
33
- // Convert the raw object to TriggerProps, which should keep name and id
34
36
  const obj = raw.toObject();
35
37
  let data = { schedules: [] };
36
38
  if (raw.getCron() && raw.getCron().hasConfig()) {
37
39
  const config = raw.getCron().getConfig();
38
- if (config) {
39
- data = {
40
- schedules: config.getSchedulesList() || [],
41
- };
42
- }
40
+ data = {
41
+ schedules: config.getSchedulesList(),
42
+ };
43
43
  }
44
44
  return new CronTrigger({
45
45
  ...obj,
@@ -48,7 +48,7 @@ class CronTrigger extends Trigger {
48
48
  });
49
49
  }
50
50
  /**
51
- * Convert raw data from runTrigger response to CronOutput format
51
+ * Convert raw data from runNodeWithInputs response to CronOutput format
52
52
  * @param rawData - The raw data from the gRPC response
53
53
  * @returns {CronTriggerOutput | undefined} - The converted data
54
54
  */
@@ -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;AAEhD,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,EAGL,kBAAkB,EAClB,iBAAiB,EAIlB,MAAM,oBAAoB,CAAC;AAkD5B,cAAM,YAAa,SAAQ,OAAO;gBACpB,KAAK,EAAE,iBAAiB;IAIpC,SAAS,IAAI,MAAM,CAAC,WAAW;IAwG/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,YAAY;IAwF1D;;;;OAIG;IACH,SAAS,IAAI,kBAAkB,GAAG,SAAS;IAI3C;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,GAAG;CA0B9D;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;AAEhD,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,EAGL,kBAAkB,EAClB,iBAAiB,EAIlB,MAAM,oBAAoB,CAAC;AAkD5B,cAAM,YAAa,SAAQ,OAAO;gBACpB,KAAK,EAAE,iBAAiB;IAIpC,SAAS,IAAI,MAAM,CAAC,WAAW;IA6G/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,YAAY;IAwF1D;;;;OAIG;IACH,SAAS,IAAI,kBAAkB,GAAG,SAAS;IAI3C;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,GAAG;CA0B9D;AAED,eAAe,YAAY,CAAC"}
@@ -86,8 +86,12 @@ class EventTrigger extends Trigger {
86
86
  if (queryData.maxEventsPerBlock !== undefined) {
87
87
  query.setMaxEventsPerBlock(queryData.maxEventsPerBlock);
88
88
  }
89
- // Set contractAbi if provided
89
+ // Set contractAbi if provided - must be an array like ContractRead
90
90
  if (queryData.contractAbi) {
91
+ // Strictly require array format (no string support)
92
+ if (!Array.isArray(queryData.contractAbi)) {
93
+ throw new Error('contractAbi must be an array of ABI elements');
94
+ }
91
95
  // Convert array to protobuf Value list
92
96
  const abiValueList = queryData.contractAbi.map(item => {
93
97
  const value = new google_protobuf_struct_pb.Value();
@@ -1,12 +1,12 @@
1
1
  import * as avs_pb from "@/grpc_codegen/avs_pb";
2
2
  import Trigger from "./interface";
3
- import { FixedTimeTriggerOutput, FixedTimeTriggerProps } from "@avaprotocol/types";
3
+ import { FixedTimeTriggerProps, FixedTimeTriggerOutput } from "@avaprotocol/types";
4
4
  declare class FixedTimeTrigger extends Trigger {
5
5
  constructor(props: FixedTimeTriggerProps);
6
6
  toRequest(): avs_pb.TaskTrigger;
7
7
  static fromResponse(raw: avs_pb.TaskTrigger): FixedTimeTrigger;
8
8
  /**
9
- * Convert raw data from runTrigger response to FixedTimeOutput format
9
+ * Convert raw data from runNodeWithInputs response to FixedTimeOutput format
10
10
  * @param rawData - The raw data from the gRPC response
11
11
  * @returns {FixedTimeTriggerOutput | undefined} - The converted data
12
12
  */
@@ -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,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,EAGL,sBAAsB,EACtB,qBAAqB,EAGtB,MAAM,oBAAoB,CAAC;AAK5B,cAAM,gBAAiB,SAAQ,OAAO;gBACxB,KAAK,EAAE,qBAAqB;IAIxC,SAAS,IAAI,MAAM,CAAC,WAAW;IAsB/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;CAY9D;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,EAEL,qBAAqB,EAErB,sBAAsB,EAEvB,MAAM,oBAAoB,CAAC;AAI5B,cAAM,gBAAiB,SAAQ,OAAO;gBACxB,KAAK,EAAE,qBAAqB;IAOxC,SAAS,IAAI,MAAM,CAAC,WAAW;IAsB/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,gBAAgB;IAmB9D;;;;OAIG;IACH,SAAS,IAAI,sBAAsB,GAAG,SAAS;IAI/C;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,GAAG;CAY9D;AAED,eAAe,gBAAgB,CAAC"}
@@ -1,15 +1,18 @@
1
1
  import * as avs_pb from "@/grpc_codegen/avs_pb";
2
2
  import Trigger from "./interface";
3
- import { TriggerType, } from "@avaprotocol/types";
3
+ import { TriggerType } from "@avaprotocol/types";
4
4
  // Required props for constructor: id, name, type and data: { epochsList }
5
5
  class FixedTimeTrigger extends Trigger {
6
6
  constructor(props) {
7
- super({ ...props, type: TriggerType.FixedTime, data: props.data });
7
+ super({
8
+ ...props,
9
+ type: TriggerType.FixedTime,
10
+ });
8
11
  }
9
12
  toRequest() {
10
13
  const request = new avs_pb.TaskTrigger();
11
- request.setName(this.name);
12
14
  request.setId(this.id);
15
+ request.setName(this.name);
13
16
  request.setType(avs_pb.TriggerType.TRIGGER_TYPE_FIXED_TIME);
14
17
  if (!this.data) {
15
18
  throw new Error(`Trigger data is missing for ${this.type}`);
@@ -22,16 +25,13 @@ class FixedTimeTrigger extends Trigger {
22
25
  return request;
23
26
  }
24
27
  static fromResponse(raw) {
25
- // Convert the raw object to TriggerProps, which should keep name and id
26
28
  const obj = raw.toObject();
27
29
  let data = { epochsList: [] };
28
30
  if (raw.getFixedTime() && raw.getFixedTime().hasConfig()) {
29
31
  const config = raw.getFixedTime().getConfig();
30
- if (config) {
31
- data = {
32
- epochsList: config.getEpochsList() || [],
33
- };
34
- }
32
+ data = {
33
+ epochsList: config.getEpochsList(),
34
+ };
35
35
  }
36
36
  return new FixedTimeTrigger({
37
37
  ...obj,
@@ -40,7 +40,7 @@ class FixedTimeTrigger extends Trigger {
40
40
  });
41
41
  }
42
42
  /**
43
- * Convert raw data from runTrigger response to FixedTimeOutput format
43
+ * Convert raw data from runNodeWithInputs response to FixedTimeOutput format
44
44
  * @param rawData - The raw data from the gRPC response
45
45
  * @returns {FixedTimeTriggerOutput | undefined} - The converted data
46
46
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avaprotocol/sdk-js",
3
- "version": "2.6.2",
3
+ "version": "2.6.4-dev.0",
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.4.2",
34
+ "@avaprotocol/types": "^2.4.3",
35
35
  "@grpc/grpc-js": "^1.11.3",
36
36
  "@grpc/proto-loader": "^0.7.13",
37
37
  "dotenv": "^16.4.5",
package/dist/auth.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export declare const getKeyRequestMessage: (chainId: number, address: string, issuedAt: Date, expiredAt: Date) => string;
2
- //# sourceMappingURL=auth.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,GAAI,SAAS,MAAM,EAAE,SAAS,MAAM,EAAE,UAAU,IAAI,EAAE,WAAW,IAAI,KAAG,MAUxG,CAAA"}
package/dist/auth.js DELETED
@@ -1,10 +0,0 @@
1
- export const getKeyRequestMessage = (chainId, address, issuedAt, expiredAt) => {
2
- return `Please sign the below text for ownership verification.
3
-
4
- URI: https://app.avaprotocol.org
5
- Chain ID: ${chainId}
6
- Version: 1
7
- Issued At: ${issuedAt.toISOString()}
8
- Expire At: ${expiredAt.toISOString()}
9
- Wallet: ${address}`;
10
- };
package/dist/config.d.ts DELETED
@@ -1,9 +0,0 @@
1
- import { Environment } from "@avaprotocol/types";
2
- export declare const DEFAULT_JWT_EXPIRATION: number;
3
- interface Config {
4
- AVS_RPC_URL: string;
5
- }
6
- declare const configs: Record<Environment, Config>;
7
- export declare function getRpcEndpoint(env: Environment): string;
8
- export { configs };
9
- //# sourceMappingURL=config.d.ts.map