@avaprotocol/sdk-js 1.3.4-dev.0 → 1.3.4-dev.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.
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 = {
@@ -6238,7 +6204,7 @@ var require_avs_pb = __commonJS({
6238
6204
  var require_avs_grpc_pb = __commonJS({
6239
6205
  "../../grpc_codegen/avs_grpc_pb.js"(exports2) {
6240
6206
  "use strict";
6241
- var grpc2 = require("@grpc/grpc-js");
6207
+ var grpc = require("@grpc/grpc-js");
6242
6208
  var avs_pb20 = require_avs_pb();
6243
6209
  var google_protobuf_wrappers_pb = require("google-protobuf/google/protobuf/wrappers_pb.js");
6244
6210
  var google_protobuf_timestamp_pb = require("google-protobuf/google/protobuf/timestamp_pb.js");
@@ -6588,7 +6554,7 @@ var require_avs_grpc_pb = __commonJS({
6588
6554
  responseDeserialize: deserialize_aggregator_UserTriggerTaskResp
6589
6555
  }
6590
6556
  };
6591
- exports2.AggregatorClient = grpc2.makeGenericClientConstructor(AggregatorService);
6557
+ exports2.AggregatorClient = grpc.makeGenericClientConstructor(AggregatorService);
6592
6558
  }
6593
6559
  });
6594
6560
 
@@ -6624,7 +6590,6 @@ __export(index_exports, {
6624
6590
  });
6625
6591
  module.exports = __toCommonJS(index_exports);
6626
6592
  var import_lodash3 = __toESM(require("lodash"));
6627
- var grpc = __toESM(require("@grpc/grpc-js"));
6628
6593
  var import_grpc_js = require("@grpc/grpc-js");
6629
6594
 
6630
6595
  // src/auth.ts
@@ -6666,6 +6631,13 @@ var Edge = class _Edge {
6666
6631
  edge.setTarget(this.target);
6667
6632
  return edge;
6668
6633
  }
6634
+ toJson() {
6635
+ return {
6636
+ id: this.id,
6637
+ source: this.source,
6638
+ target: this.target
6639
+ };
6640
+ }
6669
6641
  };
6670
6642
  var edge_default = Edge;
6671
6643
 
@@ -6804,43 +6776,17 @@ var EventTrigger = class _EventTrigger extends interface_default {
6804
6776
  throw new Error(`Trigger data is missing for ${this.type}`);
6805
6777
  }
6806
6778
  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
- }
6779
+ condition.setExpression(this.data.expression);
6821
6780
  request.setEvent(condition);
6822
- console.log("EventTrigger.toRequest.request:", request.toObject());
6823
6781
  return request;
6824
6782
  }
6825
6783
  static fromResponse(raw) {
6826
6784
  const obj = raw.toObject();
6827
6785
  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
6786
  return new _EventTrigger({
6841
6787
  ...obj,
6842
6788
  type: "event" /* Event */,
6843
- data
6789
+ data: raw.getEvent().toObject()
6844
6790
  });
6845
6791
  }
6846
6792
  };
@@ -7518,7 +7464,7 @@ var BaseClient = class {
7518
7464
  this.endpoint = opts.endpoint;
7519
7465
  this.rpcClient = new import_avs_grpc_pb.AggregatorClient(
7520
7466
  this.endpoint,
7521
- grpc.credentials.createInsecure()
7467
+ import_grpc_js.credentials.createInsecure()
7522
7468
  );
7523
7469
  this.factoryAddress = opts.factoryAddress;
7524
7470
  this.metadata = new import_grpc_js.Metadata();
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 = {
@@ -6238,7 +6204,7 @@ var require_avs_pb = __commonJS({
6238
6204
  var require_avs_grpc_pb = __commonJS({
6239
6205
  "../../grpc_codegen/avs_grpc_pb.js"(exports) {
6240
6206
  "use strict";
6241
- var grpc2 = __require("@grpc/grpc-js");
6207
+ var grpc = __require("@grpc/grpc-js");
6242
6208
  var avs_pb20 = require_avs_pb();
6243
6209
  var google_protobuf_wrappers_pb = __require("google-protobuf/google/protobuf/wrappers_pb.js");
6244
6210
  var google_protobuf_timestamp_pb = __require("google-protobuf/google/protobuf/timestamp_pb.js");
@@ -6588,14 +6554,13 @@ var require_avs_grpc_pb = __commonJS({
6588
6554
  responseDeserialize: deserialize_aggregator_UserTriggerTaskResp
6589
6555
  }
6590
6556
  };
6591
- exports.AggregatorClient = grpc2.makeGenericClientConstructor(AggregatorService);
6557
+ exports.AggregatorClient = grpc.makeGenericClientConstructor(AggregatorService);
6592
6558
  }
6593
6559
  });
6594
6560
 
6595
6561
  // src/index.ts
6596
6562
  import _3 from "lodash";
6597
- import * as grpc from "@grpc/grpc-js";
6598
- import { Metadata } from "@grpc/grpc-js";
6563
+ import { credentials, Metadata } from "@grpc/grpc-js";
6599
6564
 
6600
6565
  // src/auth.ts
6601
6566
  var getKeyRequestMessage = (chainId, address, issuedAt, expiredAt) => {
@@ -6636,6 +6601,13 @@ var Edge = class _Edge {
6636
6601
  edge.setTarget(this.target);
6637
6602
  return edge;
6638
6603
  }
6604
+ toJson() {
6605
+ return {
6606
+ id: this.id,
6607
+ source: this.source,
6608
+ target: this.target
6609
+ };
6610
+ }
6639
6611
  };
6640
6612
  var edge_default = Edge;
6641
6613
 
@@ -6774,43 +6746,17 @@ var EventTrigger = class _EventTrigger extends interface_default {
6774
6746
  throw new Error(`Trigger data is missing for ${this.type}`);
6775
6747
  }
6776
6748
  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
- }
6749
+ condition.setExpression(this.data.expression);
6791
6750
  request.setEvent(condition);
6792
- console.log("EventTrigger.toRequest.request:", request.toObject());
6793
6751
  return request;
6794
6752
  }
6795
6753
  static fromResponse(raw) {
6796
6754
  const obj = raw.toObject();
6797
6755
  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
6756
  return new _EventTrigger({
6811
6757
  ...obj,
6812
6758
  type: "event" /* Event */,
6813
- data
6759
+ data: raw.getEvent().toObject()
6814
6760
  });
6815
6761
  }
6816
6762
  };
@@ -7488,7 +7434,7 @@ var BaseClient = class {
7488
7434
  this.endpoint = opts.endpoint;
7489
7435
  this.rpcClient = new import_avs_grpc_pb.AggregatorClient(
7490
7436
  this.endpoint,
7491
- grpc.credentials.createInsecure()
7437
+ credentials.createInsecure()
7492
7438
  );
7493
7439
  this.factoryAddress = opts.factoryAddress;
7494
7440
  this.metadata = new Metadata();
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.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",