@avaprotocol/sdk-js 1.3.3 → 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 +5 -13
- package/dist/index.d.ts +5 -13
- package/dist/index.js +40 -84
- package/dist/index.mjs +40 -84
- package/package.json +1 -1
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
|
|
|
@@ -1502,6 +1497,7 @@ declare class Node implements NodeProps {
|
|
|
1502
1497
|
data: NodeData;
|
|
1503
1498
|
constructor(props: NodeProps);
|
|
1504
1499
|
toRequest(): TaskNode;
|
|
1500
|
+
toJson(): Record<string, any>;
|
|
1505
1501
|
}
|
|
1506
1502
|
|
|
1507
1503
|
type EdgeProps = TaskEdge.AsObject;
|
|
@@ -1512,6 +1508,7 @@ declare class Edge implements EdgeProps {
|
|
|
1512
1508
|
constructor(edge: EdgeProps);
|
|
1513
1509
|
static fromResponse(edge: TaskEdge): Edge;
|
|
1514
1510
|
toRequest(): TaskEdge;
|
|
1511
|
+
toJson(): Record<string, any>;
|
|
1515
1512
|
}
|
|
1516
1513
|
|
|
1517
1514
|
type Environment = "production" | "development" | "staging";
|
|
@@ -1557,7 +1554,7 @@ declare enum TriggerType {
|
|
|
1557
1554
|
type SmartWallet = SmartWallet$1.AsObject;
|
|
1558
1555
|
declare const ExecutionStatus: typeof ExecutionStatus$1;
|
|
1559
1556
|
|
|
1560
|
-
type TriggerData = FixedTimeCondition.AsObject | CronCondition.AsObject | BlockCondition.AsObject | EventCondition.AsObject
|
|
1557
|
+
type TriggerData = FixedTimeCondition.AsObject | CronCondition.AsObject | BlockCondition.AsObject | EventCondition.AsObject;
|
|
1561
1558
|
type TriggerProps = Omit<TaskTrigger.AsObject, "manual" | "fixedTime" | "cron" | "block" | "event"> & {
|
|
1562
1559
|
type: TriggerType;
|
|
1563
1560
|
data: TriggerData;
|
|
@@ -1573,6 +1570,7 @@ declare class Trigger implements TriggerProps {
|
|
|
1573
1570
|
*/
|
|
1574
1571
|
constructor(props: TriggerProps);
|
|
1575
1572
|
toRequest(): TaskTrigger;
|
|
1573
|
+
toJson(): Record<string, any>;
|
|
1576
1574
|
}
|
|
1577
1575
|
|
|
1578
1576
|
type WorkflowProps = Omit<Task.AsObject, "id" | "owner" | "completedAt" | "status" | "executionsList" | "name" | "trigger" | "nodesList" | "edgesList" | "totalExecution" | "lastRanAt"> & {
|
|
@@ -1780,13 +1778,7 @@ declare class CronTrigger extends Trigger {
|
|
|
1780
1778
|
static fromResponse(raw: TaskTrigger): CronTrigger;
|
|
1781
1779
|
}
|
|
1782
1780
|
|
|
1783
|
-
|
|
1784
|
-
type: string;
|
|
1785
|
-
value: string[];
|
|
1786
|
-
}
|
|
1787
|
-
type EventTriggerDataType = EventCondition.AsObject & {
|
|
1788
|
-
matcher?: EventMatcher[];
|
|
1789
|
-
};
|
|
1781
|
+
type EventTriggerDataType = Pick<EventCondition.AsObject, "expression">;
|
|
1790
1782
|
type EventTriggerProps = TriggerProps & {
|
|
1791
1783
|
data: EventTriggerDataType;
|
|
1792
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
|
|
|
@@ -1502,6 +1497,7 @@ declare class Node implements NodeProps {
|
|
|
1502
1497
|
data: NodeData;
|
|
1503
1498
|
constructor(props: NodeProps);
|
|
1504
1499
|
toRequest(): TaskNode;
|
|
1500
|
+
toJson(): Record<string, any>;
|
|
1505
1501
|
}
|
|
1506
1502
|
|
|
1507
1503
|
type EdgeProps = TaskEdge.AsObject;
|
|
@@ -1512,6 +1508,7 @@ declare class Edge implements EdgeProps {
|
|
|
1512
1508
|
constructor(edge: EdgeProps);
|
|
1513
1509
|
static fromResponse(edge: TaskEdge): Edge;
|
|
1514
1510
|
toRequest(): TaskEdge;
|
|
1511
|
+
toJson(): Record<string, any>;
|
|
1515
1512
|
}
|
|
1516
1513
|
|
|
1517
1514
|
type Environment = "production" | "development" | "staging";
|
|
@@ -1557,7 +1554,7 @@ declare enum TriggerType {
|
|
|
1557
1554
|
type SmartWallet = SmartWallet$1.AsObject;
|
|
1558
1555
|
declare const ExecutionStatus: typeof ExecutionStatus$1;
|
|
1559
1556
|
|
|
1560
|
-
type TriggerData = FixedTimeCondition.AsObject | CronCondition.AsObject | BlockCondition.AsObject | EventCondition.AsObject
|
|
1557
|
+
type TriggerData = FixedTimeCondition.AsObject | CronCondition.AsObject | BlockCondition.AsObject | EventCondition.AsObject;
|
|
1561
1558
|
type TriggerProps = Omit<TaskTrigger.AsObject, "manual" | "fixedTime" | "cron" | "block" | "event"> & {
|
|
1562
1559
|
type: TriggerType;
|
|
1563
1560
|
data: TriggerData;
|
|
@@ -1573,6 +1570,7 @@ declare class Trigger implements TriggerProps {
|
|
|
1573
1570
|
*/
|
|
1574
1571
|
constructor(props: TriggerProps);
|
|
1575
1572
|
toRequest(): TaskTrigger;
|
|
1573
|
+
toJson(): Record<string, any>;
|
|
1576
1574
|
}
|
|
1577
1575
|
|
|
1578
1576
|
type WorkflowProps = Omit<Task.AsObject, "id" | "owner" | "completedAt" | "status" | "executionsList" | "name" | "trigger" | "nodesList" | "edgesList" | "totalExecution" | "lastRanAt"> & {
|
|
@@ -1780,13 +1778,7 @@ declare class CronTrigger extends Trigger {
|
|
|
1780
1778
|
static fromResponse(raw: TaskTrigger): CronTrigger;
|
|
1781
1779
|
}
|
|
1782
1780
|
|
|
1783
|
-
|
|
1784
|
-
type: string;
|
|
1785
|
-
value: string[];
|
|
1786
|
-
}
|
|
1787
|
-
type EventTriggerDataType = EventCondition.AsObject & {
|
|
1788
|
-
matcher?: EventMatcher[];
|
|
1789
|
-
};
|
|
1781
|
+
type EventTriggerDataType = Pick<EventCondition.AsObject, "expression">;
|
|
1790
1782
|
type EventTriggerProps = TriggerProps & {
|
|
1791
1783
|
data: EventTriggerDataType;
|
|
1792
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,
|
|
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
|
-
|
|
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
|
-
|
|
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,
|
|
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,
|
|
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 = {
|
|
@@ -6623,7 +6589,7 @@ __export(index_exports, {
|
|
|
6623
6589
|
getKeyRequestMessage: () => getKeyRequestMessage
|
|
6624
6590
|
});
|
|
6625
6591
|
module.exports = __toCommonJS(index_exports);
|
|
6626
|
-
var
|
|
6592
|
+
var import_lodash3 = __toESM(require("lodash"));
|
|
6627
6593
|
var grpc = __toESM(require("@grpc/grpc-js"));
|
|
6628
6594
|
var import_grpc_js = require("@grpc/grpc-js");
|
|
6629
6595
|
|
|
@@ -6645,7 +6611,7 @@ var avs_pb19 = __toESM(require_avs_pb());
|
|
|
6645
6611
|
var import_timestamp_pb = require("google-protobuf/google/protobuf/timestamp_pb");
|
|
6646
6612
|
|
|
6647
6613
|
// src/models/workflow.ts
|
|
6648
|
-
var
|
|
6614
|
+
var import_lodash2 = __toESM(require("lodash"));
|
|
6649
6615
|
var avs_pb15 = __toESM(require_avs_pb());
|
|
6650
6616
|
|
|
6651
6617
|
// src/models/edge.ts
|
|
@@ -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
|
|
|
@@ -6687,6 +6660,14 @@ var Trigger = class {
|
|
|
6687
6660
|
toRequest() {
|
|
6688
6661
|
throw new Error("Method not implemented.");
|
|
6689
6662
|
}
|
|
6663
|
+
toJson() {
|
|
6664
|
+
return {
|
|
6665
|
+
id: this.id,
|
|
6666
|
+
name: this.name,
|
|
6667
|
+
type: this.type,
|
|
6668
|
+
data: this.data
|
|
6669
|
+
};
|
|
6670
|
+
}
|
|
6690
6671
|
};
|
|
6691
6672
|
var interface_default = Trigger;
|
|
6692
6673
|
|
|
@@ -6796,43 +6777,17 @@ var EventTrigger = class _EventTrigger extends interface_default {
|
|
|
6796
6777
|
throw new Error(`Trigger data is missing for ${this.type}`);
|
|
6797
6778
|
}
|
|
6798
6779
|
const condition = new avs_pb5.EventCondition();
|
|
6799
|
-
|
|
6800
|
-
const matcher = this.data.matcher;
|
|
6801
|
-
if (expression && expression != "") {
|
|
6802
|
-
condition.setExpression(expression);
|
|
6803
|
-
}
|
|
6804
|
-
if (matcher && matcher.length >= 1) {
|
|
6805
|
-
console.log("hit here", matcher);
|
|
6806
|
-
condition.setMatcherList(matcher.map((element) => {
|
|
6807
|
-
const m = new avs_pb5.EventCondition.Matcher();
|
|
6808
|
-
m.setType(element["type"]);
|
|
6809
|
-
m.setValueList(element["value"]);
|
|
6810
|
-
return m;
|
|
6811
|
-
}));
|
|
6812
|
-
}
|
|
6780
|
+
condition.setExpression(this.data.expression);
|
|
6813
6781
|
request.setEvent(condition);
|
|
6814
|
-
console.log("EventTrigger.toRequest.request:", request.toObject());
|
|
6815
6782
|
return request;
|
|
6816
6783
|
}
|
|
6817
6784
|
static fromResponse(raw) {
|
|
6818
6785
|
const obj = raw.toObject();
|
|
6819
6786
|
console.log("EventTrigger.fromResponse.obj:", obj);
|
|
6820
|
-
let data = {};
|
|
6821
|
-
if (raw.getEvent().getExpression()) {
|
|
6822
|
-
data.expression = raw.getEvent().getExpression();
|
|
6823
|
-
}
|
|
6824
|
-
if (raw.getEvent().getMatcherList()) {
|
|
6825
|
-
data.matcher = raw.getEvent().getMatcherList().map((item) => {
|
|
6826
|
-
return {
|
|
6827
|
-
type: item.getType(),
|
|
6828
|
-
value: item.getValueList()
|
|
6829
|
-
};
|
|
6830
|
-
});
|
|
6831
|
-
}
|
|
6832
6787
|
return new _EventTrigger({
|
|
6833
6788
|
...obj,
|
|
6834
6789
|
type: "event" /* Event */,
|
|
6835
|
-
data
|
|
6790
|
+
data: raw.getEvent().toObject()
|
|
6836
6791
|
});
|
|
6837
6792
|
}
|
|
6838
6793
|
};
|
|
@@ -6917,12 +6872,11 @@ var TriggerFactory = class {
|
|
|
6917
6872
|
var factory_default = TriggerFactory;
|
|
6918
6873
|
|
|
6919
6874
|
// src/models/node/factory.ts
|
|
6920
|
-
var
|
|
6875
|
+
var import_lodash = __toESM(require("lodash"));
|
|
6921
6876
|
|
|
6922
6877
|
// src/models/node/interface.ts
|
|
6923
6878
|
var avs_pb7 = __toESM(require_avs_pb());
|
|
6924
6879
|
var import_types6 = require("@avaprotocol/types");
|
|
6925
|
-
var import_lodash = __toESM(require("lodash"));
|
|
6926
6880
|
var Node = class {
|
|
6927
6881
|
constructor(props) {
|
|
6928
6882
|
this.id = props.id;
|
|
@@ -6931,13 +6885,15 @@ var Node = class {
|
|
|
6931
6885
|
this.data = props.data;
|
|
6932
6886
|
}
|
|
6933
6887
|
toRequest() {
|
|
6934
|
-
|
|
6935
|
-
|
|
6936
|
-
|
|
6937
|
-
|
|
6938
|
-
|
|
6939
|
-
|
|
6940
|
-
|
|
6888
|
+
throw new Error("Method not implemented.");
|
|
6889
|
+
}
|
|
6890
|
+
toJson() {
|
|
6891
|
+
return {
|
|
6892
|
+
id: this.id,
|
|
6893
|
+
name: this.name,
|
|
6894
|
+
type: this.type,
|
|
6895
|
+
data: this.data
|
|
6896
|
+
};
|
|
6941
6897
|
}
|
|
6942
6898
|
};
|
|
6943
6899
|
var interface_default2 = Node;
|
|
@@ -7192,7 +7148,7 @@ var NodeFactory = class {
|
|
|
7192
7148
|
}
|
|
7193
7149
|
}
|
|
7194
7150
|
static createNodes(props) {
|
|
7195
|
-
return
|
|
7151
|
+
return import_lodash.default.map(props, (node) => this.create(node));
|
|
7196
7152
|
}
|
|
7197
7153
|
static fromResponse(raw) {
|
|
7198
7154
|
switch (true) {
|
|
@@ -7262,11 +7218,11 @@ var Workflow = class _Workflow {
|
|
|
7262
7218
|
if (!trigger) {
|
|
7263
7219
|
throw new Error("Trigger is undefined in fromResponse()");
|
|
7264
7220
|
}
|
|
7265
|
-
const nodes =
|
|
7221
|
+
const nodes = import_lodash2.default.map(
|
|
7266
7222
|
obj.getNodesList(),
|
|
7267
7223
|
(node) => factory_default2.fromResponse(node)
|
|
7268
7224
|
);
|
|
7269
|
-
const edges =
|
|
7225
|
+
const edges = import_lodash2.default.map(obj.getEdgesList(), (edge) => edge_default.fromResponse(edge));
|
|
7270
7226
|
const workflow = new _Workflow({
|
|
7271
7227
|
id: obj.getId(),
|
|
7272
7228
|
owner: obj.getOwner(),
|
|
@@ -7315,8 +7271,8 @@ var Workflow = class _Workflow {
|
|
|
7315
7271
|
const request = new avs_pb15.CreateTaskReq();
|
|
7316
7272
|
request.setSmartWalletAddress(this.smartWalletAddress);
|
|
7317
7273
|
request.setTrigger(this.trigger.toRequest());
|
|
7318
|
-
|
|
7319
|
-
|
|
7274
|
+
import_lodash2.default.map(this.nodes, (node) => request.addNodes(node.toRequest()));
|
|
7275
|
+
import_lodash2.default.map(this.edges, (edge) => request.addEdges(edge.toRequest()));
|
|
7320
7276
|
request.setStartAt(this.startAt);
|
|
7321
7277
|
request.setExpiredAt(this.expiredAt);
|
|
7322
7278
|
request.setMaxExecution(this.maxExecution);
|
|
@@ -7620,7 +7576,7 @@ var BaseClient = class {
|
|
|
7620
7576
|
* @returns {Promise<TResponse>} - The response from the gRPC call
|
|
7621
7577
|
*/
|
|
7622
7578
|
sendGrpcRequest(method, request, options) {
|
|
7623
|
-
const metadata =
|
|
7579
|
+
const metadata = import_lodash3.default.cloneDeep(this.metadata);
|
|
7624
7580
|
if (options?.authKey) {
|
|
7625
7581
|
metadata.set(AUTH_KEY_HEADER, options.authKey);
|
|
7626
7582
|
} else if (this.authKey) {
|
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,
|
|
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
|
-
|
|
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
|
-
|
|
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,
|
|
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,
|
|
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 = {
|
|
@@ -6593,7 +6559,7 @@ var require_avs_grpc_pb = __commonJS({
|
|
|
6593
6559
|
});
|
|
6594
6560
|
|
|
6595
6561
|
// src/index.ts
|
|
6596
|
-
import
|
|
6562
|
+
import _3 from "lodash";
|
|
6597
6563
|
import * as grpc from "@grpc/grpc-js";
|
|
6598
6564
|
import { Metadata } from "@grpc/grpc-js";
|
|
6599
6565
|
|
|
@@ -6616,7 +6582,7 @@ import { Timestamp } from "google-protobuf/google/protobuf/timestamp_pb";
|
|
|
6616
6582
|
|
|
6617
6583
|
// src/models/workflow.ts
|
|
6618
6584
|
var avs_pb15 = __toESM(require_avs_pb());
|
|
6619
|
-
import
|
|
6585
|
+
import _2 from "lodash";
|
|
6620
6586
|
|
|
6621
6587
|
// src/models/edge.ts
|
|
6622
6588
|
var avs_pb = __toESM(require_avs_pb());
|
|
@@ -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
|
|
|
@@ -6657,6 +6630,14 @@ var Trigger = class {
|
|
|
6657
6630
|
toRequest() {
|
|
6658
6631
|
throw new Error("Method not implemented.");
|
|
6659
6632
|
}
|
|
6633
|
+
toJson() {
|
|
6634
|
+
return {
|
|
6635
|
+
id: this.id,
|
|
6636
|
+
name: this.name,
|
|
6637
|
+
type: this.type,
|
|
6638
|
+
data: this.data
|
|
6639
|
+
};
|
|
6640
|
+
}
|
|
6660
6641
|
};
|
|
6661
6642
|
var interface_default = Trigger;
|
|
6662
6643
|
|
|
@@ -6766,43 +6747,17 @@ var EventTrigger = class _EventTrigger extends interface_default {
|
|
|
6766
6747
|
throw new Error(`Trigger data is missing for ${this.type}`);
|
|
6767
6748
|
}
|
|
6768
6749
|
const condition = new avs_pb5.EventCondition();
|
|
6769
|
-
|
|
6770
|
-
const matcher = this.data.matcher;
|
|
6771
|
-
if (expression && expression != "") {
|
|
6772
|
-
condition.setExpression(expression);
|
|
6773
|
-
}
|
|
6774
|
-
if (matcher && matcher.length >= 1) {
|
|
6775
|
-
console.log("hit here", matcher);
|
|
6776
|
-
condition.setMatcherList(matcher.map((element) => {
|
|
6777
|
-
const m = new avs_pb5.EventCondition.Matcher();
|
|
6778
|
-
m.setType(element["type"]);
|
|
6779
|
-
m.setValueList(element["value"]);
|
|
6780
|
-
return m;
|
|
6781
|
-
}));
|
|
6782
|
-
}
|
|
6750
|
+
condition.setExpression(this.data.expression);
|
|
6783
6751
|
request.setEvent(condition);
|
|
6784
|
-
console.log("EventTrigger.toRequest.request:", request.toObject());
|
|
6785
6752
|
return request;
|
|
6786
6753
|
}
|
|
6787
6754
|
static fromResponse(raw) {
|
|
6788
6755
|
const obj = raw.toObject();
|
|
6789
6756
|
console.log("EventTrigger.fromResponse.obj:", obj);
|
|
6790
|
-
let data = {};
|
|
6791
|
-
if (raw.getEvent().getExpression()) {
|
|
6792
|
-
data.expression = raw.getEvent().getExpression();
|
|
6793
|
-
}
|
|
6794
|
-
if (raw.getEvent().getMatcherList()) {
|
|
6795
|
-
data.matcher = raw.getEvent().getMatcherList().map((item) => {
|
|
6796
|
-
return {
|
|
6797
|
-
type: item.getType(),
|
|
6798
|
-
value: item.getValueList()
|
|
6799
|
-
};
|
|
6800
|
-
});
|
|
6801
|
-
}
|
|
6802
6757
|
return new _EventTrigger({
|
|
6803
6758
|
...obj,
|
|
6804
6759
|
type: "event" /* Event */,
|
|
6805
|
-
data
|
|
6760
|
+
data: raw.getEvent().toObject()
|
|
6806
6761
|
});
|
|
6807
6762
|
}
|
|
6808
6763
|
};
|
|
@@ -6887,12 +6842,11 @@ var TriggerFactory = class {
|
|
|
6887
6842
|
var factory_default = TriggerFactory;
|
|
6888
6843
|
|
|
6889
6844
|
// src/models/node/factory.ts
|
|
6890
|
-
import
|
|
6845
|
+
import _ from "lodash";
|
|
6891
6846
|
|
|
6892
6847
|
// src/models/node/interface.ts
|
|
6893
6848
|
var avs_pb7 = __toESM(require_avs_pb());
|
|
6894
6849
|
import { NodeType } from "@avaprotocol/types";
|
|
6895
|
-
import _ from "lodash";
|
|
6896
6850
|
var Node = class {
|
|
6897
6851
|
constructor(props) {
|
|
6898
6852
|
this.id = props.id;
|
|
@@ -6901,13 +6855,15 @@ var Node = class {
|
|
|
6901
6855
|
this.data = props.data;
|
|
6902
6856
|
}
|
|
6903
6857
|
toRequest() {
|
|
6904
|
-
|
|
6905
|
-
|
|
6906
|
-
|
|
6907
|
-
|
|
6908
|
-
|
|
6909
|
-
|
|
6910
|
-
|
|
6858
|
+
throw new Error("Method not implemented.");
|
|
6859
|
+
}
|
|
6860
|
+
toJson() {
|
|
6861
|
+
return {
|
|
6862
|
+
id: this.id,
|
|
6863
|
+
name: this.name,
|
|
6864
|
+
type: this.type,
|
|
6865
|
+
data: this.data
|
|
6866
|
+
};
|
|
6911
6867
|
}
|
|
6912
6868
|
};
|
|
6913
6869
|
var interface_default2 = Node;
|
|
@@ -7162,7 +7118,7 @@ var NodeFactory = class {
|
|
|
7162
7118
|
}
|
|
7163
7119
|
}
|
|
7164
7120
|
static createNodes(props) {
|
|
7165
|
-
return
|
|
7121
|
+
return _.map(props, (node) => this.create(node));
|
|
7166
7122
|
}
|
|
7167
7123
|
static fromResponse(raw) {
|
|
7168
7124
|
switch (true) {
|
|
@@ -7232,11 +7188,11 @@ var Workflow = class _Workflow {
|
|
|
7232
7188
|
if (!trigger) {
|
|
7233
7189
|
throw new Error("Trigger is undefined in fromResponse()");
|
|
7234
7190
|
}
|
|
7235
|
-
const nodes =
|
|
7191
|
+
const nodes = _2.map(
|
|
7236
7192
|
obj.getNodesList(),
|
|
7237
7193
|
(node) => factory_default2.fromResponse(node)
|
|
7238
7194
|
);
|
|
7239
|
-
const edges =
|
|
7195
|
+
const edges = _2.map(obj.getEdgesList(), (edge) => edge_default.fromResponse(edge));
|
|
7240
7196
|
const workflow = new _Workflow({
|
|
7241
7197
|
id: obj.getId(),
|
|
7242
7198
|
owner: obj.getOwner(),
|
|
@@ -7285,8 +7241,8 @@ var Workflow = class _Workflow {
|
|
|
7285
7241
|
const request = new avs_pb15.CreateTaskReq();
|
|
7286
7242
|
request.setSmartWalletAddress(this.smartWalletAddress);
|
|
7287
7243
|
request.setTrigger(this.trigger.toRequest());
|
|
7288
|
-
|
|
7289
|
-
|
|
7244
|
+
_2.map(this.nodes, (node) => request.addNodes(node.toRequest()));
|
|
7245
|
+
_2.map(this.edges, (edge) => request.addEdges(edge.toRequest()));
|
|
7290
7246
|
request.setStartAt(this.startAt);
|
|
7291
7247
|
request.setExpiredAt(this.expiredAt);
|
|
7292
7248
|
request.setMaxExecution(this.maxExecution);
|
|
@@ -7590,7 +7546,7 @@ var BaseClient = class {
|
|
|
7590
7546
|
* @returns {Promise<TResponse>} - The response from the gRPC call
|
|
7591
7547
|
*/
|
|
7592
7548
|
sendGrpcRequest(method, request, options) {
|
|
7593
|
-
const metadata =
|
|
7549
|
+
const metadata = _3.cloneDeep(this.metadata);
|
|
7594
7550
|
if (options?.authKey) {
|
|
7595
7551
|
metadata.set(AUTH_KEY_HEADER, options.authKey);
|
|
7596
7552
|
} else if (this.authKey) {
|
package/package.json
CHANGED