@avaprotocol/sdk-js 1.3.4-dev.0 → 1.3.4-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.
package/dist/index.d.mts CHANGED
@@ -97,10 +97,6 @@ declare namespace BlockCondition {
97
97
  }
98
98
 
99
99
  declare class EventCondition extends jspb.Message {
100
- clearMatcherList(): void;
101
- getMatcherList(): Array<EventCondition.Matcher>;
102
- setMatcherList(value: Array<EventCondition.Matcher>): EventCondition;
103
- addMatcher(value?: EventCondition.Matcher, index?: number): EventCondition.Matcher;
104
100
  getExpression(): string;
105
101
  setExpression(value: string): EventCondition;
106
102
 
@@ -116,7 +112,6 @@ declare class EventCondition extends jspb.Message {
116
112
 
117
113
  declare namespace EventCondition {
118
114
  export type AsObject = {
119
- matcherList: Array<EventCondition.Matcher.AsObject>,
120
115
  expression: string,
121
116
  }
122
117
 
@@ -1513,6 +1508,7 @@ declare class Edge implements EdgeProps {
1513
1508
  constructor(edge: EdgeProps);
1514
1509
  static fromResponse(edge: TaskEdge): Edge;
1515
1510
  toRequest(): TaskEdge;
1511
+ toJson(): Record<string, any>;
1516
1512
  }
1517
1513
 
1518
1514
  type Environment = "production" | "development" | "staging";
@@ -1782,13 +1778,7 @@ declare class CronTrigger extends Trigger {
1782
1778
  static fromResponse(raw: TaskTrigger): CronTrigger;
1783
1779
  }
1784
1780
 
1785
- interface EventMatcher {
1786
- type: string;
1787
- value: string[];
1788
- }
1789
- type EventTriggerDataType = EventCondition.AsObject & {
1790
- matcher?: EventMatcher[];
1791
- };
1781
+ type EventTriggerDataType = Pick<EventCondition.AsObject, "expression">;
1792
1782
  type EventTriggerProps = TriggerProps & {
1793
1783
  data: EventTriggerDataType;
1794
1784
  };
package/dist/index.d.ts CHANGED
@@ -97,10 +97,6 @@ declare namespace BlockCondition {
97
97
  }
98
98
 
99
99
  declare class EventCondition extends jspb.Message {
100
- clearMatcherList(): void;
101
- getMatcherList(): Array<EventCondition.Matcher>;
102
- setMatcherList(value: Array<EventCondition.Matcher>): EventCondition;
103
- addMatcher(value?: EventCondition.Matcher, index?: number): EventCondition.Matcher;
104
100
  getExpression(): string;
105
101
  setExpression(value: string): EventCondition;
106
102
 
@@ -116,7 +112,6 @@ declare class EventCondition extends jspb.Message {
116
112
 
117
113
  declare namespace EventCondition {
118
114
  export type AsObject = {
119
- matcherList: Array<EventCondition.Matcher.AsObject>,
120
115
  expression: string,
121
116
  }
122
117
 
@@ -1513,6 +1508,7 @@ declare class Edge implements EdgeProps {
1513
1508
  constructor(edge: EdgeProps);
1514
1509
  static fromResponse(edge: TaskEdge): Edge;
1515
1510
  toRequest(): TaskEdge;
1511
+ toJson(): Record<string, any>;
1516
1512
  }
1517
1513
 
1518
1514
  type Environment = "production" | "development" | "staging";
@@ -1782,13 +1778,7 @@ declare class CronTrigger extends Trigger {
1782
1778
  static fromResponse(raw: TaskTrigger): CronTrigger;
1783
1779
  }
1784
1780
 
1785
- interface EventMatcher {
1786
- type: string;
1787
- value: string[];
1788
- }
1789
- type EventTriggerDataType = EventCondition.AsObject & {
1790
- matcher?: EventMatcher[];
1791
- };
1781
+ type EventTriggerDataType = Pick<EventCondition.AsObject, "expression">;
1792
1782
  type EventTriggerProps = TriggerProps & {
1793
1783
  data: EventTriggerDataType;
1794
1784
  };
package/dist/index.js CHANGED
@@ -135,7 +135,7 @@ var require_avs_pb = __commonJS({
135
135
  proto.aggregator.BlockCondition.displayName = "proto.aggregator.BlockCondition";
136
136
  }
137
137
  proto.aggregator.EventCondition = function(opt_data) {
138
- jspb.Message.initialize(this, opt_data, 0, -1, proto.aggregator.EventCondition.repeatedFields_, null);
138
+ jspb.Message.initialize(this, opt_data, 0, -1, null, null);
139
139
  };
140
140
  goog.inherits(proto.aggregator.EventCondition, jspb.Message);
141
141
  if (goog.DEBUG && !COMPILED) {
@@ -679,19 +679,13 @@ var require_avs_pb = __commonJS({
679
679
  proto.aggregator.BlockCondition.prototype.setInterval = function(value) {
680
680
  return jspb.Message.setProto3IntField(this, 1, value);
681
681
  };
682
- proto.aggregator.EventCondition.repeatedFields_ = [1];
683
682
  if (jspb.Message.GENERATE_TO_OBJECT) {
684
683
  proto.aggregator.EventCondition.prototype.toObject = function(opt_includeInstance) {
685
684
  return proto.aggregator.EventCondition.toObject(opt_includeInstance, this);
686
685
  };
687
686
  proto.aggregator.EventCondition.toObject = function(includeInstance, msg) {
688
687
  var f, obj = {
689
- matcherList: jspb.Message.toObjectList(
690
- msg.getMatcherList(),
691
- proto.aggregator.EventCondition.Matcher.toObject,
692
- includeInstance
693
- ),
694
- expression: jspb.Message.getFieldWithDefault(msg, 2, "")
688
+ expression: jspb.Message.getFieldWithDefault(msg, 1, "")
695
689
  };
696
690
  if (includeInstance) {
697
691
  obj.$jspbMessageInstance = msg;
@@ -712,11 +706,6 @@ var require_avs_pb = __commonJS({
712
706
  var field = reader.getFieldNumber();
713
707
  switch (field) {
714
708
  case 1:
715
- var value = new proto.aggregator.EventCondition.Matcher();
716
- reader.readMessage(value, proto.aggregator.EventCondition.Matcher.deserializeBinaryFromReader);
717
- msg.addMatcher(value);
718
- break;
719
- case 2:
720
709
  var value = (
721
710
  /** @type {string} */
722
711
  reader.readString()
@@ -737,18 +726,10 @@ var require_avs_pb = __commonJS({
737
726
  };
738
727
  proto.aggregator.EventCondition.serializeBinaryToWriter = function(message, writer) {
739
728
  var f = void 0;
740
- f = message.getMatcherList();
741
- if (f.length > 0) {
742
- writer.writeRepeatedMessage(
743
- 1,
744
- f,
745
- proto.aggregator.EventCondition.Matcher.serializeBinaryToWriter
746
- );
747
- }
748
729
  f = message.getExpression();
749
730
  if (f.length > 0) {
750
731
  writer.writeString(
751
- 2,
732
+ 1,
752
733
  f
753
734
  );
754
735
  }
@@ -848,29 +829,14 @@ var require_avs_pb = __commonJS({
848
829
  proto.aggregator.EventCondition.Matcher.prototype.clearValueList = function() {
849
830
  return this.setValueList([]);
850
831
  };
851
- proto.aggregator.EventCondition.prototype.getMatcherList = function() {
852
- return (
853
- /** @type{!Array<!proto.aggregator.EventCondition.Matcher>} */
854
- jspb.Message.getRepeatedWrapperField(this, proto.aggregator.EventCondition.Matcher, 1)
855
- );
856
- };
857
- proto.aggregator.EventCondition.prototype.setMatcherList = function(value) {
858
- return jspb.Message.setRepeatedWrapperField(this, 1, value);
859
- };
860
- proto.aggregator.EventCondition.prototype.addMatcher = function(opt_value, opt_index) {
861
- return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.aggregator.EventCondition.Matcher, opt_index);
862
- };
863
- proto.aggregator.EventCondition.prototype.clearMatcherList = function() {
864
- return this.setMatcherList([]);
865
- };
866
832
  proto.aggregator.EventCondition.prototype.getExpression = function() {
867
833
  return (
868
834
  /** @type {string} */
869
- jspb.Message.getFieldWithDefault(this, 2, "")
835
+ jspb.Message.getFieldWithDefault(this, 1, "")
870
836
  );
871
837
  };
872
838
  proto.aggregator.EventCondition.prototype.setExpression = function(value) {
873
- return jspb.Message.setProto3StringField(this, 2, value);
839
+ return jspb.Message.setProto3StringField(this, 1, value);
874
840
  };
875
841
  proto.aggregator.TaskTrigger.oneofGroups_ = [[2, 3, 4, 5, 6]];
876
842
  proto.aggregator.TaskTrigger.TriggerTypeCase = {
@@ -6666,6 +6632,13 @@ var Edge = class _Edge {
6666
6632
  edge.setTarget(this.target);
6667
6633
  return edge;
6668
6634
  }
6635
+ toJson() {
6636
+ return {
6637
+ id: this.id,
6638
+ source: this.source,
6639
+ target: this.target
6640
+ };
6641
+ }
6669
6642
  };
6670
6643
  var edge_default = Edge;
6671
6644
 
@@ -6804,43 +6777,17 @@ var EventTrigger = class _EventTrigger extends interface_default {
6804
6777
  throw new Error(`Trigger data is missing for ${this.type}`);
6805
6778
  }
6806
6779
  const condition = new avs_pb5.EventCondition();
6807
- const expression = this.data.expression;
6808
- const matcher = this.data.matcher;
6809
- if (expression && expression != "") {
6810
- condition.setExpression(expression);
6811
- }
6812
- if (matcher && matcher.length >= 1) {
6813
- console.log("hit here", matcher);
6814
- condition.setMatcherList(matcher.map((element) => {
6815
- const m = new avs_pb5.EventCondition.Matcher();
6816
- m.setType(element["type"]);
6817
- m.setValueList(element["value"]);
6818
- return m;
6819
- }));
6820
- }
6780
+ condition.setExpression(this.data.expression);
6821
6781
  request.setEvent(condition);
6822
- console.log("EventTrigger.toRequest.request:", request.toObject());
6823
6782
  return request;
6824
6783
  }
6825
6784
  static fromResponse(raw) {
6826
6785
  const obj = raw.toObject();
6827
6786
  console.log("EventTrigger.fromResponse.obj:", obj);
6828
- let data = {};
6829
- if (raw.getEvent().getExpression()) {
6830
- data.expression = raw.getEvent().getExpression();
6831
- }
6832
- if (raw.getEvent().getMatcherList()) {
6833
- data.matcher = raw.getEvent().getMatcherList().map((item) => {
6834
- return {
6835
- type: item.getType(),
6836
- value: item.getValueList()
6837
- };
6838
- });
6839
- }
6840
6787
  return new _EventTrigger({
6841
6788
  ...obj,
6842
6789
  type: "event" /* Event */,
6843
- data
6790
+ data: raw.getEvent().toObject()
6844
6791
  });
6845
6792
  }
6846
6793
  };
package/dist/index.mjs CHANGED
@@ -135,7 +135,7 @@ var require_avs_pb = __commonJS({
135
135
  proto.aggregator.BlockCondition.displayName = "proto.aggregator.BlockCondition";
136
136
  }
137
137
  proto.aggregator.EventCondition = function(opt_data) {
138
- jspb.Message.initialize(this, opt_data, 0, -1, proto.aggregator.EventCondition.repeatedFields_, null);
138
+ jspb.Message.initialize(this, opt_data, 0, -1, null, null);
139
139
  };
140
140
  goog.inherits(proto.aggregator.EventCondition, jspb.Message);
141
141
  if (goog.DEBUG && !COMPILED) {
@@ -679,19 +679,13 @@ var require_avs_pb = __commonJS({
679
679
  proto.aggregator.BlockCondition.prototype.setInterval = function(value) {
680
680
  return jspb.Message.setProto3IntField(this, 1, value);
681
681
  };
682
- proto.aggregator.EventCondition.repeatedFields_ = [1];
683
682
  if (jspb.Message.GENERATE_TO_OBJECT) {
684
683
  proto.aggregator.EventCondition.prototype.toObject = function(opt_includeInstance) {
685
684
  return proto.aggregator.EventCondition.toObject(opt_includeInstance, this);
686
685
  };
687
686
  proto.aggregator.EventCondition.toObject = function(includeInstance, msg) {
688
687
  var f, obj = {
689
- matcherList: jspb.Message.toObjectList(
690
- msg.getMatcherList(),
691
- proto.aggregator.EventCondition.Matcher.toObject,
692
- includeInstance
693
- ),
694
- expression: jspb.Message.getFieldWithDefault(msg, 2, "")
688
+ expression: jspb.Message.getFieldWithDefault(msg, 1, "")
695
689
  };
696
690
  if (includeInstance) {
697
691
  obj.$jspbMessageInstance = msg;
@@ -712,11 +706,6 @@ var require_avs_pb = __commonJS({
712
706
  var field = reader.getFieldNumber();
713
707
  switch (field) {
714
708
  case 1:
715
- var value = new proto.aggregator.EventCondition.Matcher();
716
- reader.readMessage(value, proto.aggregator.EventCondition.Matcher.deserializeBinaryFromReader);
717
- msg.addMatcher(value);
718
- break;
719
- case 2:
720
709
  var value = (
721
710
  /** @type {string} */
722
711
  reader.readString()
@@ -737,18 +726,10 @@ var require_avs_pb = __commonJS({
737
726
  };
738
727
  proto.aggregator.EventCondition.serializeBinaryToWriter = function(message, writer) {
739
728
  var f = void 0;
740
- f = message.getMatcherList();
741
- if (f.length > 0) {
742
- writer.writeRepeatedMessage(
743
- 1,
744
- f,
745
- proto.aggregator.EventCondition.Matcher.serializeBinaryToWriter
746
- );
747
- }
748
729
  f = message.getExpression();
749
730
  if (f.length > 0) {
750
731
  writer.writeString(
751
- 2,
732
+ 1,
752
733
  f
753
734
  );
754
735
  }
@@ -848,29 +829,14 @@ var require_avs_pb = __commonJS({
848
829
  proto.aggregator.EventCondition.Matcher.prototype.clearValueList = function() {
849
830
  return this.setValueList([]);
850
831
  };
851
- proto.aggregator.EventCondition.prototype.getMatcherList = function() {
852
- return (
853
- /** @type{!Array<!proto.aggregator.EventCondition.Matcher>} */
854
- jspb.Message.getRepeatedWrapperField(this, proto.aggregator.EventCondition.Matcher, 1)
855
- );
856
- };
857
- proto.aggregator.EventCondition.prototype.setMatcherList = function(value) {
858
- return jspb.Message.setRepeatedWrapperField(this, 1, value);
859
- };
860
- proto.aggregator.EventCondition.prototype.addMatcher = function(opt_value, opt_index) {
861
- return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.aggregator.EventCondition.Matcher, opt_index);
862
- };
863
- proto.aggregator.EventCondition.prototype.clearMatcherList = function() {
864
- return this.setMatcherList([]);
865
- };
866
832
  proto.aggregator.EventCondition.prototype.getExpression = function() {
867
833
  return (
868
834
  /** @type {string} */
869
- jspb.Message.getFieldWithDefault(this, 2, "")
835
+ jspb.Message.getFieldWithDefault(this, 1, "")
870
836
  );
871
837
  };
872
838
  proto.aggregator.EventCondition.prototype.setExpression = function(value) {
873
- return jspb.Message.setProto3StringField(this, 2, value);
839
+ return jspb.Message.setProto3StringField(this, 1, value);
874
840
  };
875
841
  proto.aggregator.TaskTrigger.oneofGroups_ = [[2, 3, 4, 5, 6]];
876
842
  proto.aggregator.TaskTrigger.TriggerTypeCase = {
@@ -6636,6 +6602,13 @@ var Edge = class _Edge {
6636
6602
  edge.setTarget(this.target);
6637
6603
  return edge;
6638
6604
  }
6605
+ toJson() {
6606
+ return {
6607
+ id: this.id,
6608
+ source: this.source,
6609
+ target: this.target
6610
+ };
6611
+ }
6639
6612
  };
6640
6613
  var edge_default = Edge;
6641
6614
 
@@ -6774,43 +6747,17 @@ var EventTrigger = class _EventTrigger extends interface_default {
6774
6747
  throw new Error(`Trigger data is missing for ${this.type}`);
6775
6748
  }
6776
6749
  const condition = new avs_pb5.EventCondition();
6777
- const expression = this.data.expression;
6778
- const matcher = this.data.matcher;
6779
- if (expression && expression != "") {
6780
- condition.setExpression(expression);
6781
- }
6782
- if (matcher && matcher.length >= 1) {
6783
- console.log("hit here", matcher);
6784
- condition.setMatcherList(matcher.map((element) => {
6785
- const m = new avs_pb5.EventCondition.Matcher();
6786
- m.setType(element["type"]);
6787
- m.setValueList(element["value"]);
6788
- return m;
6789
- }));
6790
- }
6750
+ condition.setExpression(this.data.expression);
6791
6751
  request.setEvent(condition);
6792
- console.log("EventTrigger.toRequest.request:", request.toObject());
6793
6752
  return request;
6794
6753
  }
6795
6754
  static fromResponse(raw) {
6796
6755
  const obj = raw.toObject();
6797
6756
  console.log("EventTrigger.fromResponse.obj:", obj);
6798
- let data = {};
6799
- if (raw.getEvent().getExpression()) {
6800
- data.expression = raw.getEvent().getExpression();
6801
- }
6802
- if (raw.getEvent().getMatcherList()) {
6803
- data.matcher = raw.getEvent().getMatcherList().map((item) => {
6804
- return {
6805
- type: item.getType(),
6806
- value: item.getValueList()
6807
- };
6808
- });
6809
- }
6810
6757
  return new _EventTrigger({
6811
6758
  ...obj,
6812
6759
  type: "event" /* Event */,
6813
- data
6760
+ data: raw.getEvent().toObject()
6814
6761
  });
6815
6762
  }
6816
6763
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avaprotocol/sdk-js",
3
- "version": "1.3.4-dev.0",
3
+ "version": "1.3.4-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",