@avaprotocol/sdk-js 1.5.0 → 1.6.2

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 (67) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/grpc_codegen/custom_types.d.ts +45 -0
  3. package/dist/grpc_codegen/custom_types.d.ts.map +1 -0
  4. package/dist/grpc_codegen/custom_types.js +179 -0
  5. package/dist/index.d.ts +100 -61
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +7288 -4601
  8. package/dist/index.mjs +8031 -5346
  9. package/dist/models/execution.d.ts +9 -2
  10. package/dist/models/execution.d.ts.map +1 -1
  11. package/dist/models/execution.js +25 -8
  12. package/dist/models/node/branch.d.ts +1 -1
  13. package/dist/models/node/branch.d.ts.map +1 -1
  14. package/dist/models/node/branch.js +14 -8
  15. package/dist/models/node/contractRead.d.ts.map +1 -1
  16. package/dist/models/node/contractRead.js +7 -3
  17. package/dist/models/node/contractWrite.d.ts +1 -1
  18. package/dist/models/node/contractWrite.d.ts.map +1 -1
  19. package/dist/models/node/contractWrite.js +6 -4
  20. package/dist/models/node/customCode.d.ts +4 -1
  21. package/dist/models/node/customCode.d.ts.map +1 -1
  22. package/dist/models/node/customCode.js +10 -3
  23. package/dist/models/node/ethTransfer.d.ts +1 -1
  24. package/dist/models/node/ethTransfer.d.ts.map +1 -1
  25. package/dist/models/node/ethTransfer.js +5 -3
  26. package/dist/models/node/factory.d.ts +4 -3
  27. package/dist/models/node/factory.d.ts.map +1 -1
  28. package/dist/models/node/factory.js +5 -2
  29. package/dist/models/node/filter.d.ts.map +1 -1
  30. package/dist/models/node/filter.js +6 -2
  31. package/dist/models/node/graphqlQuery.d.ts.map +1 -1
  32. package/dist/models/node/graphqlQuery.js +13 -7
  33. package/dist/models/node/loop.d.ts +13 -0
  34. package/dist/models/node/loop.d.ts.map +1 -0
  35. package/dist/models/node/loop.js +145 -0
  36. package/dist/models/node/restApi.d.ts.map +1 -1
  37. package/dist/models/node/restApi.js +14 -8
  38. package/dist/models/secret.d.ts +6 -7
  39. package/dist/models/secret.d.ts.map +1 -1
  40. package/dist/models/secret.js +7 -1
  41. package/dist/models/trigger/block.d.ts +8 -1
  42. package/dist/models/trigger/block.d.ts.map +1 -1
  43. package/dist/models/trigger/block.js +23 -4
  44. package/dist/models/trigger/cron.d.ts +8 -1
  45. package/dist/models/trigger/cron.d.ts.map +1 -1
  46. package/dist/models/trigger/cron.js +23 -4
  47. package/dist/models/trigger/event.d.ts +8 -1
  48. package/dist/models/trigger/event.d.ts.map +1 -1
  49. package/dist/models/trigger/event.js +41 -28
  50. package/dist/models/trigger/factory.d.ts +8 -10
  51. package/dist/models/trigger/factory.d.ts.map +1 -1
  52. package/dist/models/trigger/factory.js +6 -1
  53. package/dist/models/trigger/fixedTime.d.ts +8 -1
  54. package/dist/models/trigger/fixedTime.d.ts.map +1 -1
  55. package/dist/models/trigger/fixedTime.js +23 -4
  56. package/dist/models/trigger/interface.d.ts +5 -1
  57. package/dist/models/trigger/interface.d.ts.map +1 -1
  58. package/dist/models/trigger/interface.js +4 -0
  59. package/dist/models/trigger/manual.d.ts +13 -0
  60. package/dist/models/trigger/manual.d.ts.map +1 -0
  61. package/dist/models/trigger/manual.js +27 -0
  62. package/dist/models/trigger/reason.d.ts.map +1 -1
  63. package/dist/models/trigger/reason.js +3 -0
  64. package/dist/models/workflow.d.ts +1 -1
  65. package/dist/models/workflow.d.ts.map +1 -1
  66. package/dist/models/workflow.js +3 -4
  67. package/package.json +2 -2
@@ -5,11 +5,17 @@ class Secret {
5
5
  this.secret = props.secret;
6
6
  this.workflowId = props.workflowId;
7
7
  this.orgId = props.orgId;
8
+ this.createdAt = props.createdAt;
9
+ this.updatedAt = props.updatedAt;
10
+ this.createdBy = props.createdBy;
11
+ this.description = props.description;
8
12
  }
9
13
  toRequest() {
10
14
  const request = new avs_pb.CreateOrUpdateSecretReq();
11
15
  request.setName(this.name);
12
- request.setSecret(this.secret);
16
+ if (this.secret) {
17
+ request.setSecret(this.secret);
18
+ }
13
19
  if (this.orgId) {
14
20
  request.setOrgId(this.orgId);
15
21
  }
@@ -1,13 +1,20 @@
1
1
  import * as avs_pb from "@/grpc_codegen/avs_pb";
2
2
  import Trigger, { TriggerProps } from "./interface";
3
- export type BlockTriggerDataType = avs_pb.BlockCondition.AsObject;
3
+ export type BlockTriggerDataType = avs_pb.BlockTrigger.Config.AsObject;
4
4
  export type BlockTriggerProps = TriggerProps & {
5
5
  data: BlockTriggerDataType;
6
6
  };
7
+ export type BlockTriggerOutput = avs_pb.BlockTrigger.Output.AsObject;
7
8
  declare class BlockTrigger extends Trigger {
8
9
  constructor(props: BlockTriggerProps);
9
10
  toRequest(): avs_pb.TaskTrigger;
10
11
  static fromResponse(raw: avs_pb.TaskTrigger): BlockTrigger;
12
+ /**
13
+ * Convert raw data from runNodeWithInputs response to BlockOutput format
14
+ * @param rawData - The raw data from the gRPC response
15
+ * @returns {BlockTriggerOutput | undefined} - The converted data
16
+ */
17
+ getOutput(): BlockTriggerOutput | undefined;
11
18
  }
12
19
  export default BlockTrigger;
13
20
  //# sourceMappingURL=block.d.ts.map
@@ -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,EAAE,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAIpD,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC;AAClE,MAAM,MAAM,iBAAiB,GAAG,YAAY,GAAG;IAAE,IAAI,EAAE,oBAAoB,CAAA;CAAE,CAAC;AAE9E,cAAM,YAAa,SAAQ,OAAO;gBACpB,KAAK,EAAE,iBAAiB;IAIpC,SAAS,IAAI,MAAM,CAAC,WAAW;IAgB/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,YAAY;CAU3D;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,EAAE,EAAiB,YAAY,EAAE,MAAM,aAAa,CAAC;AAInE,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC;AACvE,MAAM,MAAM,iBAAiB,GAAG,YAAY,GAAG;IAAE,IAAI,EAAE,oBAAoB,CAAA;CAAE,CAAC;AAC9E,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC;AAErE,cAAM,YAAa,SAAQ,OAAO;gBACpB,KAAK,EAAE,iBAAiB;IAIpC,SAAS,IAAI,MAAM,CAAC,WAAW;IAmB/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,YAAY;IAuB1D;;;;OAIG;IACH,SAAS,IAAI,kBAAkB,GAAG,SAAS;CAG5C;AAED,eAAe,YAAY,CAAC"}
@@ -12,19 +12,38 @@ class BlockTrigger extends Trigger {
12
12
  if (!this.data) {
13
13
  throw new Error(`Trigger data is missing for ${this.type}`);
14
14
  }
15
- const condition = new avs_pb.BlockCondition();
16
- condition.setInterval(this.data.interval);
17
- request.setBlock(condition);
15
+ const trigger = new avs_pb.BlockTrigger();
16
+ const config = new avs_pb.BlockTrigger.Config();
17
+ config.setInterval(this.data.interval || 0);
18
+ trigger.setConfig(config);
19
+ request.setBlock(trigger);
18
20
  return request;
19
21
  }
20
22
  static fromResponse(raw) {
21
23
  // Convert the raw object to TriggerProps, which should keep name and id
22
24
  const obj = raw.toObject();
25
+ let data = { interval: 0 };
26
+ if (raw.getBlock() && raw.getBlock().hasConfig()) {
27
+ const config = raw.getBlock().getConfig();
28
+ if (config) {
29
+ data = {
30
+ interval: config.getInterval() || 0
31
+ };
32
+ }
33
+ }
23
34
  return new BlockTrigger({
24
35
  ...obj,
25
36
  type: TriggerType.Block,
26
- data: raw.getBlock().toObject(),
37
+ data: data,
27
38
  });
28
39
  }
40
+ /**
41
+ * Convert raw data from runNodeWithInputs response to BlockOutput format
42
+ * @param rawData - The raw data from the gRPC response
43
+ * @returns {BlockTriggerOutput | undefined} - The converted data
44
+ */
45
+ getOutput() {
46
+ return this.output;
47
+ }
29
48
  }
30
49
  export default BlockTrigger;
@@ -1,13 +1,20 @@
1
1
  import * as avs_pb from "@/grpc_codegen/avs_pb";
2
2
  import Trigger, { TriggerProps } from "./interface";
3
- export type CronTriggerDataType = avs_pb.CronCondition.AsObject;
3
+ export type CronTriggerDataType = avs_pb.CronTrigger.Config.AsObject;
4
4
  export type CronTriggerProps = TriggerProps & {
5
5
  data: CronTriggerDataType;
6
6
  };
7
+ export type CronTriggerOutput = avs_pb.CronTrigger.Output.AsObject;
7
8
  declare class CronTrigger extends Trigger {
8
9
  constructor(props: CronTriggerProps);
9
10
  toRequest(): avs_pb.TaskTrigger;
10
11
  static fromResponse(raw: avs_pb.TaskTrigger): CronTrigger;
12
+ /**
13
+ * Convert raw data from runNodeWithInputs response to CronOutput format
14
+ * @param rawData - The raw data from the gRPC response
15
+ * @returns {CronTriggerOutput | undefined} - The converted data
16
+ */
17
+ getOutput(): CronTriggerOutput | undefined;
11
18
  }
12
19
  export default CronTrigger;
13
20
  //# sourceMappingURL=cron.d.ts.map
@@ -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,EAAE,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGpD,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC;AAChE,MAAM,MAAM,gBAAgB,GAAG,YAAY,GAAG;IAAE,IAAI,EAAE,mBAAmB,CAAA;CAAE,CAAC;AAE5E,cAAM,WAAY,SAAQ,OAAO;gBACnB,KAAK,EAAE,gBAAgB;IAInC,SAAS,IAAI,MAAM,CAAC,WAAW;IAgB/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,WAAW;CAU1D;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,EAAE,EAAiB,YAAY,EAAE,MAAM,aAAa,CAAC;AAInE,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC;AACrE,MAAM,MAAM,gBAAgB,GAAG,YAAY,GAAG;IAAE,IAAI,EAAE,mBAAmB,CAAA;CAAE,CAAC;AAC5E,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC;AAEnE,cAAM,WAAY,SAAQ,OAAO;gBACnB,KAAK,EAAE,gBAAgB;IAInC,SAAS,IAAI,MAAM,CAAC,WAAW;IAmB/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,WAAW;IAuBzD;;;;OAIG;IACH,SAAS,IAAI,iBAAiB,GAAG,SAAS;CAG3C;AAED,eAAe,WAAW,CAAC"}
@@ -12,19 +12,38 @@ class CronTrigger extends Trigger {
12
12
  if (!this.data) {
13
13
  throw new Error(`Trigger data is missing for ${this.type}`);
14
14
  }
15
- const condition = new avs_pb.CronCondition();
16
- condition.setScheduleList(this.data.scheduleList);
17
- request.setCron(condition);
15
+ const trigger = new avs_pb.CronTrigger();
16
+ const config = new avs_pb.CronTrigger.Config();
17
+ config.setScheduleList(this.data.scheduleList || []);
18
+ trigger.setConfig(config);
19
+ request.setCron(trigger);
18
20
  return request;
19
21
  }
20
22
  static fromResponse(raw) {
21
23
  // Convert the raw object to TriggerProps, which should keep name and id
22
24
  const obj = raw.toObject();
25
+ let data = { scheduleList: [] };
26
+ if (raw.getCron() && raw.getCron().hasConfig()) {
27
+ const config = raw.getCron().getConfig();
28
+ if (config) {
29
+ data = {
30
+ scheduleList: config.getScheduleList() || []
31
+ };
32
+ }
33
+ }
23
34
  return new CronTrigger({
24
35
  ...obj,
25
36
  type: TriggerType.Cron,
26
- data: raw.getCron().toObject(),
37
+ data: data,
27
38
  });
28
39
  }
40
+ /**
41
+ * Convert raw data from runNodeWithInputs response to CronOutput format
42
+ * @param rawData - The raw data from the gRPC response
43
+ * @returns {CronTriggerOutput | undefined} - The converted data
44
+ */
45
+ getOutput() {
46
+ return this.output;
47
+ }
29
48
  }
30
49
  export default CronTrigger;
@@ -1,13 +1,20 @@
1
1
  import * as avs_pb from "@/grpc_codegen/avs_pb";
2
2
  import Trigger, { TriggerProps } from "./interface";
3
- export type EventTriggerDataType = avs_pb.EventCondition.AsObject;
3
+ export type EventTriggerDataType = avs_pb.EventTrigger.Config.AsObject;
4
4
  export type EventTriggerProps = TriggerProps & {
5
5
  data: EventTriggerDataType;
6
6
  };
7
+ export type EventTriggerOutput = avs_pb.EventTrigger.Output.AsObject;
7
8
  declare class EventTrigger extends Trigger {
8
9
  constructor(props: EventTriggerProps);
9
10
  toRequest(): avs_pb.TaskTrigger;
10
11
  static fromResponse(raw: avs_pb.TaskTrigger): EventTrigger;
12
+ /**
13
+ * Convert raw data from runNodeWithInputs response to EventOutput format
14
+ * @param rawData - The raw data from the gRPC response
15
+ * @returns {EventTriggerOutput | undefined} - The converted data
16
+ */
17
+ getOutput(): EventTriggerOutput | undefined;
11
18
  }
12
19
  export default EventTrigger;
13
20
  //# sourceMappingURL=event.d.ts.map
@@ -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,OAAO,EAAE,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAuBpD,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC;AAElE,MAAM,MAAM,iBAAiB,GAAG,YAAY,GAAG;IAAE,IAAI,EAAE,oBAAoB,CAAA;CAAE,CAAC;AAE9E,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;CA4B3D;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,EAAE,EAAiB,YAAY,EAAE,MAAM,aAAa,CAAC;AAuBnE,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC;AACvE,MAAM,MAAM,iBAAiB,GAAG,YAAY,GAAG;IAAE,IAAI,EAAE,oBAAoB,CAAA;CAAE,CAAC;AAC9E,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC;AAErE,cAAM,YAAa,SAAQ,OAAO;gBACpB,KAAK,EAAE,iBAAiB;IAIpC,SAAS,IAAI,MAAM,CAAC,WAAW;IAwC/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,YAAY;IAiC1D;;;;OAIG;IACH,SAAS,IAAI,kBAAkB,GAAG,SAAS;CAG5C;AAED,eAAe,YAAY,CAAC"}
@@ -13,49 +13,62 @@ class EventTrigger extends Trigger {
13
13
  if (!this.data) {
14
14
  throw new Error(`Trigger data is missing for ${this.type}`);
15
15
  }
16
- const condition = new avs_pb.EventCondition();
17
- const expression = this.data.expression;
18
- const matcherList = this.data.matcherList;
19
- if (_.isUndefined(expression)) {
16
+ const trigger = new avs_pb.EventTrigger();
17
+ const dataConfig = this.data;
18
+ const config = new avs_pb.EventTrigger.Config();
19
+ const expression = dataConfig.expression;
20
+ const matcherList = dataConfig.matcherList;
21
+ if (_.isUndefined(expression) || _.isNull(expression)) {
20
22
  throw new Error(`Expression is undefined for ${this.type}`);
21
23
  }
22
- condition.setExpression(expression);
23
- if (_.isUndefined(matcherList)) {
24
- throw new Error(`Matcher list is undefined for ${this.type}`);
24
+ config.setExpression(expression);
25
+ if (matcherList && matcherList.length > 0) {
26
+ const matchers = matcherList.map((element) => {
27
+ const m = new avs_pb.EventTrigger.Matcher();
28
+ m.setType(element.type);
29
+ m.setValueList(element.valueList || []);
30
+ return m;
31
+ });
32
+ config.setMatcherList(matchers);
25
33
  }
26
- condition.setMatcherList(matcherList.map((element) => {
27
- const m = new avs_pb.EventCondition.Matcher();
28
- m.setType(element["type"]);
29
- m.setValueList(element["valueList"]);
30
- return m;
31
- }));
32
- request.setEvent(condition);
34
+ trigger.setConfig(config);
35
+ request.setEvent(trigger);
33
36
  return request;
34
37
  }
35
38
  static fromResponse(raw) {
36
39
  // Convert the raw object to TriggerProps, which should keep name and id
37
40
  const obj = raw.toObject();
38
- let data = {};
39
- if (raw.getEvent().getExpression()) {
40
- data.expression = raw.getEvent().getExpression();
41
- }
42
- if (raw.getEvent().getMatcherList()) {
43
- data.matcherList = raw
44
- .getEvent()
45
- .getMatcherList()
46
- .map((item) => {
47
- return {
48
- type: item.getType(),
49
- valueList: item.getValueList(),
41
+ let data = { expression: "", matcherList: [] };
42
+ if (raw.getEvent() && raw.getEvent().hasConfig()) {
43
+ const config = raw.getEvent().getConfig();
44
+ if (config) {
45
+ data = {
46
+ expression: config.getExpression(),
47
+ matcherList: []
50
48
  };
51
- });
49
+ if (config.getMatcherList && config.getMatcherList().length > 0) {
50
+ data.matcherList = config.getMatcherList().map((item) => {
51
+ return {
52
+ type: item.getType(),
53
+ valueList: item.getValueList() || [],
54
+ };
55
+ });
56
+ }
57
+ }
52
58
  }
53
- //raw.getEvent()!.toObject() as EventTriggerDataType;
54
59
  return new EventTrigger({
55
60
  ...obj,
56
61
  type: TriggerType.Event,
57
62
  data: data,
58
63
  });
59
64
  }
65
+ /**
66
+ * Convert raw data from runNodeWithInputs response to EventOutput format
67
+ * @param rawData - The raw data from the gRPC response
68
+ * @returns {EventTriggerOutput | undefined} - The converted data
69
+ */
70
+ getOutput() {
71
+ return this.output;
72
+ }
60
73
  }
61
74
  export default EventTrigger;
@@ -1,11 +1,10 @@
1
1
  import * as avs_pb from "@/grpc_codegen/avs_pb";
2
- import BlockTrigger, { BlockTriggerDataType } from "./block";
3
- import { BlockTriggerProps } from "./block";
4
- import CronTrigger, { CronTriggerDataType, CronTriggerProps } from "./cron";
5
- import EventTrigger, { EventTriggerDataType, EventTriggerProps } from "./event";
6
- import FixedTimeTrigger, { FixedTimeTriggerDataType, FixedTimeTriggerProps } from "./fixedTime";
7
- import Trigger from "./interface";
8
- import { TriggerProps } from "./interface";
2
+ import BlockTrigger, { BlockTriggerProps } from "./block";
3
+ import CronTrigger, { CronTriggerProps } from "./cron";
4
+ import EventTrigger, { EventTriggerProps } from "./event";
5
+ import FixedTimeTrigger, { FixedTimeTriggerProps } from "./fixedTime";
6
+ import ManualTrigger, { ManualTriggerProps } from "./manual";
7
+ import Trigger, { TriggerProps } from "./interface";
9
8
  declare class TriggerFactory {
10
9
  /**
11
10
  * Static factory method to create Trigger instances
@@ -21,7 +20,6 @@ declare class TriggerFactory {
21
20
  static fromResponse(raw: avs_pb.TaskTrigger): Trigger;
22
21
  }
23
22
  export default TriggerFactory;
24
- export { Trigger, BlockTrigger, CronTrigger, EventTrigger, FixedTimeTrigger, };
25
- export type { TriggerProps, BlockTriggerProps, CronTriggerProps, EventTriggerProps, FixedTimeTriggerProps, };
26
- export type { BlockTriggerDataType, CronTriggerDataType, EventTriggerDataType, FixedTimeTriggerDataType, };
23
+ export { Trigger, BlockTrigger, CronTrigger, EventTrigger, FixedTimeTrigger, ManualTrigger, };
24
+ export type { TriggerProps, BlockTriggerProps, CronTriggerProps, EventTriggerProps, FixedTimeTriggerProps, ManualTriggerProps, };
27
25
  //# sourceMappingURL=factory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,YAAY,EAAE,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,WAAW,EAAE,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC5E,OAAO,YAAY,EAAE,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAChF,OAAO,gBAAgB,EAAE,EACvB,wBAAwB,EACxB,qBAAqB,EACtB,MAAM,aAAa,CAAC;AACrB,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,cAAM,cAAc;IAClB;;;;OAIG;IACH,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO;IAgB3C;;;;OAIG;IACH,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,OAAO;CActD;AAED,eAAe,cAAc,CAAC;AAG9B,OAAO,EACL,OAAO,EACP,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,gBAAgB,GACjB,CAAC;AAGF,YAAY,EACV,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,GACtB,CAAC;AAGF,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,wBAAwB,GACzB,CAAC"}
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,YAAY,EAAE,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,WAAW,EAAE,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AACvD,OAAO,YAAY,EAAE,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,gBAAgB,EAAE,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,aAAa,EAAE,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC7D,OAAO,OAAO,EAAE,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGpD,cAAM,cAAc;IAClB;;;;OAIG;IACH,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO;IAkB3C;;;;OAIG;IACH,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,OAAO;CAgBtD;AAED,eAAe,cAAc,CAAC;AAG9B,OAAO,EACL,OAAO,EACP,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,aAAa,GACd,CAAC;AAGF,YAAY,EACV,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,GACnB,CAAC"}
@@ -2,6 +2,7 @@ import BlockTrigger from "./block";
2
2
  import CronTrigger from "./cron";
3
3
  import EventTrigger from "./event";
4
4
  import FixedTimeTrigger from "./fixedTime";
5
+ import ManualTrigger from "./manual";
5
6
  import Trigger from "./interface";
6
7
  import { TriggerType } from "@avaprotocol/types";
7
8
  class TriggerFactory {
@@ -20,6 +21,8 @@ class TriggerFactory {
20
21
  return new EventTrigger(props);
21
22
  case TriggerType.FixedTime:
22
23
  return new FixedTimeTrigger(props);
24
+ case TriggerType.Manual:
25
+ return new ManualTrigger(props);
23
26
  }
24
27
  // Add more conditions for other subclasses
25
28
  throw new Error("Unsupported trigger type");
@@ -39,6 +42,8 @@ class TriggerFactory {
39
42
  return BlockTrigger.fromResponse(raw);
40
43
  case !!raw.getEvent():
41
44
  return EventTrigger.fromResponse(raw);
45
+ case !!raw.getManual():
46
+ return ManualTrigger.fromResponse(raw);
42
47
  default:
43
48
  throw new Error("Unknown trigger type");
44
49
  }
@@ -46,4 +51,4 @@ class TriggerFactory {
46
51
  }
47
52
  export default TriggerFactory;
48
53
  // Trigger object definitions
49
- export { Trigger, BlockTrigger, CronTrigger, EventTrigger, FixedTimeTrigger, };
54
+ export { Trigger, BlockTrigger, CronTrigger, EventTrigger, FixedTimeTrigger, ManualTrigger, };
@@ -1,13 +1,20 @@
1
1
  import * as avs_pb from "@/grpc_codegen/avs_pb";
2
2
  import Trigger, { TriggerProps } from "./interface";
3
- export type FixedTimeTriggerDataType = avs_pb.FixedTimeCondition.AsObject;
3
+ export type FixedTimeTriggerDataType = avs_pb.FixedTimeTrigger.Config.AsObject;
4
4
  export type FixedTimeTriggerProps = TriggerProps & {
5
5
  data: FixedTimeTriggerDataType;
6
6
  };
7
+ export type FixedTimeTriggerOutput = avs_pb.FixedTimeTrigger.Output.AsObject;
7
8
  declare class FixedTimeTrigger extends Trigger {
8
9
  constructor(props: FixedTimeTriggerProps);
9
10
  toRequest(): avs_pb.TaskTrigger;
10
11
  static fromResponse(raw: avs_pb.TaskTrigger): FixedTimeTrigger;
12
+ /**
13
+ * Convert raw data from runNodeWithInputs response to FixedTimeOutput format
14
+ * @param rawData - The raw data from the gRPC response
15
+ * @returns {FixedTimeTriggerOutput | undefined} - The converted data
16
+ */
17
+ getOutput(): FixedTimeTriggerOutput | undefined;
11
18
  }
12
19
  export default FixedTimeTrigger;
13
20
  //# sourceMappingURL=fixedTime.d.ts.map
@@ -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,EAAE,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAIpD,MAAM,MAAM,wBAAwB,GAAG,MAAM,CAAC,kBAAkB,CAAC,QAAQ,CAAC;AAC1E,MAAM,MAAM,qBAAqB,GAAG,YAAY,GAAG;IACjD,IAAI,EAAE,wBAAwB,CAAC;CAChC,CAAC;AAEF,cAAM,gBAAiB,SAAQ,OAAO;gBACxB,KAAK,EAAE,qBAAqB;IAIxC,SAAS,IAAI,MAAM,CAAC,WAAW;IAgB/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,gBAAgB;CAU/D;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,EAAE,EAAiB,YAAY,EAAE,MAAM,aAAa,CAAC;AAInE,MAAM,MAAM,wBAAwB,GAAG,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,QAAQ,CAAC;AAC/E,MAAM,MAAM,qBAAqB,GAAG,YAAY,GAAG;IACjD,IAAI,EAAE,wBAAwB,CAAC;CAChC,CAAC;AACF,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,QAAQ,CAAC;AAE7E,cAAM,gBAAiB,SAAQ,OAAO;gBACxB,KAAK,EAAE,qBAAqB;IAIxC,SAAS,IAAI,MAAM,CAAC,WAAW;IAmB/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,gBAAgB;IAuB9D;;;;OAIG;IACH,SAAS,IAAI,sBAAsB,GAAG,SAAS;CAGhD;AAED,eAAe,gBAAgB,CAAC"}
@@ -12,19 +12,38 @@ class FixedTimeTrigger extends Trigger {
12
12
  if (!this.data) {
13
13
  throw new Error(`Trigger data is missing for ${this.type}`);
14
14
  }
15
- const condition = new avs_pb.FixedTimeCondition();
16
- condition.setEpochsList(this.data.epochsList);
17
- request.setFixedTime(condition);
15
+ const trigger = new avs_pb.FixedTimeTrigger();
16
+ const config = new avs_pb.FixedTimeTrigger.Config();
17
+ config.setEpochsList(this.data.epochsList || []);
18
+ trigger.setConfig(config);
19
+ request.setFixedTime(trigger);
18
20
  return request;
19
21
  }
20
22
  static fromResponse(raw) {
21
23
  // Convert the raw object to TriggerProps, which should keep name and id
22
24
  const obj = raw.toObject();
25
+ let data = { epochsList: [] };
26
+ if (raw.getFixedTime() && raw.getFixedTime().hasConfig()) {
27
+ const config = raw.getFixedTime().getConfig();
28
+ if (config) {
29
+ data = {
30
+ epochsList: config.getEpochsList() || []
31
+ };
32
+ }
33
+ }
23
34
  return new FixedTimeTrigger({
24
35
  ...obj,
25
36
  type: TriggerType.FixedTime,
26
- data: raw.getFixedTime().toObject(),
37
+ data: data,
27
38
  });
28
39
  }
40
+ /**
41
+ * Convert raw data from runNodeWithInputs response to FixedTimeOutput format
42
+ * @param rawData - The raw data from the gRPC response
43
+ * @returns {FixedTimeTriggerOutput | undefined} - The converted data
44
+ */
45
+ getOutput() {
46
+ return this.output;
47
+ }
29
48
  }
30
49
  export default FixedTimeTrigger;
@@ -1,21 +1,25 @@
1
1
  import * as avs_pb from "@/grpc_codegen/avs_pb";
2
2
  import { TriggerType } from "@avaprotocol/types";
3
- export type TriggerData = avs_pb.FixedTimeCondition.AsObject | avs_pb.CronCondition.AsObject | avs_pb.BlockCondition.AsObject | avs_pb.EventCondition.AsObject | null;
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 | null;
4
5
  export type TriggerProps = Omit<avs_pb.TaskTrigger.AsObject, "manual" | "fixedTime" | "cron" | "block" | "event"> & {
5
6
  type: TriggerType;
6
7
  data: TriggerData;
8
+ output?: TriggerOutput;
7
9
  };
8
10
  declare class Trigger implements TriggerProps {
9
11
  id: string;
10
12
  name: string;
11
13
  type: TriggerType;
12
14
  data: TriggerData;
15
+ output?: TriggerOutput;
13
16
  /**
14
17
  * Create an instance of Trigger from user inputs
15
18
  * @param props
16
19
  */
17
20
  constructor(props: TriggerProps);
18
21
  toRequest(): avs_pb.TaskTrigger;
22
+ getOutput(): TriggerOutput | undefined;
19
23
  }
20
24
  export default Trigger;
21
25
  //# 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,MAAM,oBAAoB,CAAC;AAEjD,MAAM,MAAM,WAAW,GACnB,MAAM,CAAC,kBAAkB,CAAC,QAAQ,GAClC,MAAM,CAAC,aAAa,CAAC,QAAQ,GAC7B,MAAM,CAAC,cAAc,CAAC,QAAQ,GAC9B,MAAM,CAAC,cAAc,CAAC,QAAQ,GAC9B,IAAI,CAAC;AAET,MAAM,MAAM,YAAY,GAAG,IAAI,CAC7B,MAAM,CAAC,WAAW,CAAC,QAAQ,EAC3B,QAAQ,GAAG,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CACpD,GAAG;IACF,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,WAAW,CAAC;CACnB,CAAC;AAEF,cAAM,OAAQ,YAAW,YAAY;IACnC,EAAE,EAAE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AAC;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;CAGvC;AAED,eAAe,OAAO,CAAC"}
@@ -8,9 +8,13 @@ class Trigger {
8
8
  this.name = props.name;
9
9
  this.type = props.type;
10
10
  this.data = props.data;
11
+ this.output = props.output;
11
12
  }
12
13
  toRequest() {
13
14
  throw new Error("Method not implemented.");
14
15
  }
16
+ getOutput() {
17
+ return this.output;
18
+ }
15
19
  }
16
20
  export default Trigger;
@@ -0,0 +1,13 @@
1
+ import * as avs_pb from "@/grpc_codegen/avs_pb";
2
+ import Trigger, { TriggerProps } from "./interface";
3
+ export type ManualTriggerProps = TriggerProps & {
4
+ data?: Record<string, any> | null;
5
+ };
6
+ declare class ManualTrigger extends Trigger {
7
+ constructor(props: ManualTriggerProps);
8
+ toRequest(): avs_pb.TaskTrigger;
9
+ static fromResponse(raw: avs_pb.TaskTrigger): ManualTrigger;
10
+ getInputVariables(): Record<string, any> | null;
11
+ }
12
+ export default ManualTrigger;
13
+ //# sourceMappingURL=manual.d.ts.map
@@ -0,0 +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,EAAE,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGpD,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG;IAC9C,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAA;CAClC,CAAC;AAEF,cAAM,aAAc,SAAQ,OAAO;gBACrB,KAAK,EAAE,kBAAkB;IAIrC,SAAS,IAAI,MAAM,CAAC,WAAW;IAU/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,aAAa;IAU3D,iBAAiB,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;CAGhD;AAED,eAAe,aAAa,CAAC"}
@@ -0,0 +1,27 @@
1
+ import * as avs_pb from "@/grpc_codegen/avs_pb";
2
+ import Trigger from "./interface";
3
+ import { TriggerType } from "@avaprotocol/types";
4
+ class ManualTrigger extends Trigger {
5
+ constructor(props) {
6
+ super({ ...props, type: TriggerType.Manual, data: props.data || null });
7
+ }
8
+ toRequest() {
9
+ const trigger = new avs_pb.TaskTrigger();
10
+ trigger.setId(this.id);
11
+ trigger.setName(this.name);
12
+ trigger.setManual(true);
13
+ return trigger;
14
+ }
15
+ static fromResponse(raw) {
16
+ const obj = raw.toObject();
17
+ return new ManualTrigger({
18
+ ...obj,
19
+ type: TriggerType.Manual,
20
+ data: null, // Manual triggers don't have data in the protobuf response
21
+ });
22
+ }
23
+ getInputVariables() {
24
+ return this.data;
25
+ }
26
+ }
27
+ export default ManualTrigger;
@@ -1 +1 @@
1
- {"version":3,"file":"reason.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/reason.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGjD,MAAM,MAAM,kBAAkB,GAC1B;IAAE,IAAI,EAAE,WAAW,CAAC,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC9C;IAAE,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACzC;IAAE,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GAChD;IACE,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,C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CAAC,KAAK,CAAA;CAAE,CAAC;AAoBhC,cAAM,aAAa;IACjB,IAAI,EAAE,WAAW,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;gBAEJ,KAAK,EAAE,kBAAkB;IAyBrC,MAAM,CAAC,YAAY,CACjB,IAAI,EAAE,MAAM,CAAC,aAAa,GAAG,SAAS,GACrC,aAAa,GAAG,SAAS;IAc5B,SAAS,IAAI,MAAM,CAAC,aAAa;CA8ClC;AAED,eAAe,aAAa,CAAC"}
@@ -29,6 +29,9 @@ class TriggerReason {
29
29
  this.logIndex = props.logIndex;
30
30
  this.txHash = props.txHash;
31
31
  break;
32
+ case TriggerType.Manual:
33
+ case TriggerType.Unset:
34
+ break;
32
35
  default:
33
36
  throw new Error("Unsupported trigger type");
34
37
  }
@@ -47,7 +47,7 @@ declare class Workflow implements WorkflowProps {
47
47
  * Create an instance of Workflow with only selected fields
48
48
  * @param obj
49
49
  */
50
- static fromListResponse(obj: avs_pb.ListTasksResp.Item): Workflow;
50
+ static fromListResponse(obj: avs_pb.Task): Workflow;
51
51
  toRequest(): avs_pb.CreateTaskReq;
52
52
  }
53
53
  export default Workflow;
@@ -1 +1 @@
1
- {"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../src/models/workflow.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAEhD,OAAO,IAAI,MAAM,kBAAkB,CAAC;AACpC,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAG1C,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,CAAC,UAAU,GACxB,c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,EAAE,CAAC;IACd,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IAGrB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;gBACS,KAAK,EAAE,aAAa;IAuBhC;;;;OAIG;IACH,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,GAAG,QAAQ;IAkC/C;;;OAGG;IACH,MAAM,CAAC,gBAAgB,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,GAAG,QAAQ;IAyBnD,SAAS,IAAI,MAAM,CAAC,aAAa;CAsBlC;AAED,eAAe,QAAQ,CAAC"}
@@ -80,7 +80,6 @@ class Workflow {
80
80
  if (!trigger) {
81
81
  throw new Error("Trigger is undefined in fromListResponse()");
82
82
  }
83
- const executionCount = obj.getExecutionCount ? obj.getExecutionCount() : obj.executionCount;
84
83
  return new Workflow({
85
84
  id: obj.getId(),
86
85
  owner: obj.getOwner(),
@@ -89,9 +88,9 @@ class Workflow {
89
88
  startAt: obj.getStartAt(),
90
89
  expiredAt: obj.getExpiredAt(),
91
90
  maxExecution: obj.getMaxExecution(),
92
- executionCount: executionCount,
93
- nodes: [],
94
- edges: [],
91
+ executionCount: obj.getExecutionCount(),
92
+ nodes: _.map(obj.getNodesList(), (node) => NodeFactory.fromResponse(node)),
93
+ edges: _.map(obj.getEdgesList(), (edge) => Edge.fromResponse(edge)),
95
94
  completedAt: obj.getCompletedAt(),
96
95
  status: convertStatusToString(obj.getStatus()),
97
96
  name: obj.getName(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avaprotocol/sdk-js",
3
- "version": "1.5.0",
3
+ "version": "1.6.2",
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",
@@ -30,7 +30,7 @@
30
30
  "clean": "rm -rf node_modules dist tsconfig.tsbuildinfo"
31
31
  },
32
32
  "dependencies": {
33
- "@avaprotocol/types": "1.0.0",
33
+ "@avaprotocol/types": "1.0.2",
34
34
  "@grpc/grpc-js": "^1.11.3",
35
35
  "@grpc/proto-loader": "^0.7.13",
36
36
  "dotenv": "^16.4.5",