@avaprotocol/sdk-js 2.3.0 → 2.3.5
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/CHANGELOG.md +37 -0
- package/dist/index.js +19 -13
- package/dist/index.mjs +25 -16
- package/dist/models/node/customCode.d.ts.map +1 -1
- package/dist/models/node/customCode.js +11 -3
- package/dist/models/node/interface.d.ts +2 -3
- package/dist/models/node/interface.d.ts.map +1 -1
- package/dist/models/trigger/cron.d.ts.map +1 -1
- package/dist/models/trigger/cron.js +3 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# @avaprotocol/sdk-js
|
|
2
2
|
|
|
3
|
+
## 2.3.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b5b1eff: Convert lang of CustomCode to use protobuf value
|
|
8
|
+
- Updated dependencies [b5b1eff]
|
|
9
|
+
- @avaprotocol/types@2.2.5
|
|
10
|
+
|
|
11
|
+
## 2.3.4
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 9c7c1e0: Updated CronTrigger’s scheduleList to schedules
|
|
16
|
+
- Updated dependencies [9c7c1e0]
|
|
17
|
+
- @avaprotocol/types@2.2.4
|
|
18
|
+
|
|
19
|
+
## 2.3.3
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies [38ade5e]
|
|
24
|
+
- @avaprotocol/types@2.2.3
|
|
25
|
+
|
|
26
|
+
## 2.3.2
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- Updated dependencies [2baed44]
|
|
31
|
+
- @avaprotocol/types@2.2.2
|
|
32
|
+
|
|
33
|
+
## 2.3.1
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- Updated dependencies [07c05b4]
|
|
38
|
+
- @avaprotocol/types@2.2.1
|
|
39
|
+
|
|
3
40
|
## 2.3.0
|
|
4
41
|
|
|
5
42
|
### Minor Changes
|
package/dist/index.js
CHANGED
|
@@ -1607,7 +1607,7 @@ var require_avs_pb = __commonJS({
|
|
|
1607
1607
|
};
|
|
1608
1608
|
proto.aggregator.CronTrigger.Config.toObject = function(includeInstance, msg) {
|
|
1609
1609
|
var f, obj = {
|
|
1610
|
-
|
|
1610
|
+
schedulesList: (f = jspb.Message.getRepeatedField(msg, 1)) == null ? void 0 : f
|
|
1611
1611
|
};
|
|
1612
1612
|
if (includeInstance) {
|
|
1613
1613
|
obj.$jspbMessageInstance = msg;
|
|
@@ -1632,7 +1632,7 @@ var require_avs_pb = __commonJS({
|
|
|
1632
1632
|
/** @type {string} */
|
|
1633
1633
|
reader.readString()
|
|
1634
1634
|
);
|
|
1635
|
-
msg.
|
|
1635
|
+
msg.addSchedules(value);
|
|
1636
1636
|
break;
|
|
1637
1637
|
default:
|
|
1638
1638
|
reader.skipField();
|
|
@@ -1648,7 +1648,7 @@ var require_avs_pb = __commonJS({
|
|
|
1648
1648
|
};
|
|
1649
1649
|
proto.aggregator.CronTrigger.Config.serializeBinaryToWriter = function(message, writer) {
|
|
1650
1650
|
var f = void 0;
|
|
1651
|
-
f = message.
|
|
1651
|
+
f = message.getSchedulesList();
|
|
1652
1652
|
if (f.length > 0) {
|
|
1653
1653
|
writer.writeRepeatedString(
|
|
1654
1654
|
1,
|
|
@@ -1656,20 +1656,20 @@ var require_avs_pb = __commonJS({
|
|
|
1656
1656
|
);
|
|
1657
1657
|
}
|
|
1658
1658
|
};
|
|
1659
|
-
proto.aggregator.CronTrigger.Config.prototype.
|
|
1659
|
+
proto.aggregator.CronTrigger.Config.prototype.getSchedulesList = function() {
|
|
1660
1660
|
return (
|
|
1661
1661
|
/** @type {!Array<string>} */
|
|
1662
1662
|
jspb.Message.getRepeatedField(this, 1)
|
|
1663
1663
|
);
|
|
1664
1664
|
};
|
|
1665
|
-
proto.aggregator.CronTrigger.Config.prototype.
|
|
1665
|
+
proto.aggregator.CronTrigger.Config.prototype.setSchedulesList = function(value) {
|
|
1666
1666
|
return jspb.Message.setField(this, 1, value || []);
|
|
1667
1667
|
};
|
|
1668
|
-
proto.aggregator.CronTrigger.Config.prototype.
|
|
1668
|
+
proto.aggregator.CronTrigger.Config.prototype.addSchedules = function(value, opt_index) {
|
|
1669
1669
|
return jspb.Message.addToRepeatedField(this, 1, value, opt_index);
|
|
1670
1670
|
};
|
|
1671
|
-
proto.aggregator.CronTrigger.Config.prototype.
|
|
1672
|
-
return this.
|
|
1671
|
+
proto.aggregator.CronTrigger.Config.prototype.clearSchedulesList = function() {
|
|
1672
|
+
return this.setSchedulesList([]);
|
|
1673
1673
|
};
|
|
1674
1674
|
if (jspb.Message.GENERATE_TO_OBJECT) {
|
|
1675
1675
|
proto.aggregator.CronTrigger.Output.prototype.toObject = function(opt_includeInstance) {
|
|
@@ -16213,19 +16213,19 @@ var CronTrigger2 = class _CronTrigger extends interface_default {
|
|
|
16213
16213
|
}
|
|
16214
16214
|
const trigger = new avs_pb3.CronTrigger();
|
|
16215
16215
|
const config = new avs_pb3.CronTrigger.Config();
|
|
16216
|
-
config.
|
|
16216
|
+
config.setSchedulesList(this.data.schedules || []);
|
|
16217
16217
|
trigger.setConfig(config);
|
|
16218
16218
|
request.setCron(trigger);
|
|
16219
16219
|
return request;
|
|
16220
16220
|
}
|
|
16221
16221
|
static fromResponse(raw) {
|
|
16222
16222
|
const obj = raw.toObject();
|
|
16223
|
-
let data = {
|
|
16223
|
+
let data = { schedules: [] };
|
|
16224
16224
|
if (raw.getCron() && raw.getCron().hasConfig()) {
|
|
16225
16225
|
const config = raw.getCron().getConfig();
|
|
16226
16226
|
if (config) {
|
|
16227
16227
|
data = {
|
|
16228
|
-
|
|
16228
|
+
schedules: config.getSchedulesList() || []
|
|
16229
16229
|
};
|
|
16230
16230
|
}
|
|
16231
16231
|
}
|
|
@@ -16851,10 +16851,15 @@ var CustomCodeNode2 = class _CustomCodeNode extends interface_default2 {
|
|
|
16851
16851
|
}
|
|
16852
16852
|
static fromResponse(raw) {
|
|
16853
16853
|
const obj = raw.toObject();
|
|
16854
|
+
const rawConfig = raw.getCustomCode().getConfig().toObject();
|
|
16855
|
+
const convertedConfig = {
|
|
16856
|
+
lang: import_types10.CustomCodeLangConverter.fromProtobuf(rawConfig.lang),
|
|
16857
|
+
source: rawConfig.source
|
|
16858
|
+
};
|
|
16854
16859
|
return new _CustomCodeNode({
|
|
16855
16860
|
...obj,
|
|
16856
16861
|
type: import_types10.NodeType.CustomCode,
|
|
16857
|
-
data:
|
|
16862
|
+
data: convertedConfig
|
|
16858
16863
|
});
|
|
16859
16864
|
}
|
|
16860
16865
|
toRequest() {
|
|
@@ -16863,7 +16868,8 @@ var CustomCodeNode2 = class _CustomCodeNode extends interface_default2 {
|
|
|
16863
16868
|
request.setName(this.name);
|
|
16864
16869
|
const nodeData = new avs_pb10.CustomCodeNode();
|
|
16865
16870
|
const config = new avs_pb10.CustomCodeNode.Config();
|
|
16866
|
-
|
|
16871
|
+
const langData = this.data.lang;
|
|
16872
|
+
config.setLang(import_types10.CustomCodeLangConverter.toProtobuf(langData));
|
|
16867
16873
|
config.setSource(this.data.source);
|
|
16868
16874
|
nodeData.setConfig(config);
|
|
16869
16875
|
request.setCustomCode(nodeData);
|
package/dist/index.mjs
CHANGED
|
@@ -1607,7 +1607,7 @@ var require_avs_pb = __commonJS({
|
|
|
1607
1607
|
};
|
|
1608
1608
|
proto.aggregator.CronTrigger.Config.toObject = function(includeInstance, msg) {
|
|
1609
1609
|
var f, obj = {
|
|
1610
|
-
|
|
1610
|
+
schedulesList: (f = jspb.Message.getRepeatedField(msg, 1)) == null ? void 0 : f
|
|
1611
1611
|
};
|
|
1612
1612
|
if (includeInstance) {
|
|
1613
1613
|
obj.$jspbMessageInstance = msg;
|
|
@@ -1632,7 +1632,7 @@ var require_avs_pb = __commonJS({
|
|
|
1632
1632
|
/** @type {string} */
|
|
1633
1633
|
reader.readString()
|
|
1634
1634
|
);
|
|
1635
|
-
msg.
|
|
1635
|
+
msg.addSchedules(value);
|
|
1636
1636
|
break;
|
|
1637
1637
|
default:
|
|
1638
1638
|
reader.skipField();
|
|
@@ -1648,7 +1648,7 @@ var require_avs_pb = __commonJS({
|
|
|
1648
1648
|
};
|
|
1649
1649
|
proto.aggregator.CronTrigger.Config.serializeBinaryToWriter = function(message, writer) {
|
|
1650
1650
|
var f = void 0;
|
|
1651
|
-
f = message.
|
|
1651
|
+
f = message.getSchedulesList();
|
|
1652
1652
|
if (f.length > 0) {
|
|
1653
1653
|
writer.writeRepeatedString(
|
|
1654
1654
|
1,
|
|
@@ -1656,20 +1656,20 @@ var require_avs_pb = __commonJS({
|
|
|
1656
1656
|
);
|
|
1657
1657
|
}
|
|
1658
1658
|
};
|
|
1659
|
-
proto.aggregator.CronTrigger.Config.prototype.
|
|
1659
|
+
proto.aggregator.CronTrigger.Config.prototype.getSchedulesList = function() {
|
|
1660
1660
|
return (
|
|
1661
1661
|
/** @type {!Array<string>} */
|
|
1662
1662
|
jspb.Message.getRepeatedField(this, 1)
|
|
1663
1663
|
);
|
|
1664
1664
|
};
|
|
1665
|
-
proto.aggregator.CronTrigger.Config.prototype.
|
|
1665
|
+
proto.aggregator.CronTrigger.Config.prototype.setSchedulesList = function(value) {
|
|
1666
1666
|
return jspb.Message.setField(this, 1, value || []);
|
|
1667
1667
|
};
|
|
1668
|
-
proto.aggregator.CronTrigger.Config.prototype.
|
|
1668
|
+
proto.aggregator.CronTrigger.Config.prototype.addSchedules = function(value, opt_index) {
|
|
1669
1669
|
return jspb.Message.addToRepeatedField(this, 1, value, opt_index);
|
|
1670
1670
|
};
|
|
1671
|
-
proto.aggregator.CronTrigger.Config.prototype.
|
|
1672
|
-
return this.
|
|
1671
|
+
proto.aggregator.CronTrigger.Config.prototype.clearSchedulesList = function() {
|
|
1672
|
+
return this.setSchedulesList([]);
|
|
1673
1673
|
};
|
|
1674
1674
|
if (jspb.Message.GENERATE_TO_OBJECT) {
|
|
1675
1675
|
proto.aggregator.CronTrigger.Output.prototype.toObject = function(opt_includeInstance) {
|
|
@@ -16183,19 +16183,19 @@ var CronTrigger2 = class _CronTrigger extends interface_default {
|
|
|
16183
16183
|
}
|
|
16184
16184
|
const trigger = new avs_pb3.CronTrigger();
|
|
16185
16185
|
const config = new avs_pb3.CronTrigger.Config();
|
|
16186
|
-
config.
|
|
16186
|
+
config.setSchedulesList(this.data.schedules || []);
|
|
16187
16187
|
trigger.setConfig(config);
|
|
16188
16188
|
request.setCron(trigger);
|
|
16189
16189
|
return request;
|
|
16190
16190
|
}
|
|
16191
16191
|
static fromResponse(raw) {
|
|
16192
16192
|
const obj = raw.toObject();
|
|
16193
|
-
let data = {
|
|
16193
|
+
let data = { schedules: [] };
|
|
16194
16194
|
if (raw.getCron() && raw.getCron().hasConfig()) {
|
|
16195
16195
|
const config = raw.getCron().getConfig();
|
|
16196
16196
|
if (config) {
|
|
16197
16197
|
data = {
|
|
16198
|
-
|
|
16198
|
+
schedules: config.getSchedulesList() || []
|
|
16199
16199
|
};
|
|
16200
16200
|
}
|
|
16201
16201
|
}
|
|
@@ -16820,17 +16820,25 @@ var contractWrite_default = ContractWriteNode2;
|
|
|
16820
16820
|
|
|
16821
16821
|
// src/models/node/customCode.ts
|
|
16822
16822
|
var avs_pb10 = __toESM(require_avs_pb());
|
|
16823
|
-
import {
|
|
16823
|
+
import {
|
|
16824
|
+
NodeType as NodeType4,
|
|
16825
|
+
CustomCodeLangConverter
|
|
16826
|
+
} from "@avaprotocol/types";
|
|
16824
16827
|
var CustomCodeNode2 = class _CustomCodeNode extends interface_default2 {
|
|
16825
16828
|
constructor(props) {
|
|
16826
16829
|
super({ ...props, type: NodeType4.CustomCode, data: props.data });
|
|
16827
16830
|
}
|
|
16828
16831
|
static fromResponse(raw) {
|
|
16829
16832
|
const obj = raw.toObject();
|
|
16833
|
+
const rawConfig = raw.getCustomCode().getConfig().toObject();
|
|
16834
|
+
const convertedConfig = {
|
|
16835
|
+
lang: CustomCodeLangConverter.fromProtobuf(rawConfig.lang),
|
|
16836
|
+
source: rawConfig.source
|
|
16837
|
+
};
|
|
16830
16838
|
return new _CustomCodeNode({
|
|
16831
16839
|
...obj,
|
|
16832
16840
|
type: NodeType4.CustomCode,
|
|
16833
|
-
data:
|
|
16841
|
+
data: convertedConfig
|
|
16834
16842
|
});
|
|
16835
16843
|
}
|
|
16836
16844
|
toRequest() {
|
|
@@ -16839,7 +16847,8 @@ var CustomCodeNode2 = class _CustomCodeNode extends interface_default2 {
|
|
|
16839
16847
|
request.setName(this.name);
|
|
16840
16848
|
const nodeData = new avs_pb10.CustomCodeNode();
|
|
16841
16849
|
const config = new avs_pb10.CustomCodeNode.Config();
|
|
16842
|
-
|
|
16850
|
+
const langData = this.data.lang;
|
|
16851
|
+
config.setLang(CustomCodeLangConverter.toProtobuf(langData));
|
|
16843
16852
|
config.setSource(this.data.source);
|
|
16844
16853
|
nodeData.setConfig(config);
|
|
16845
16854
|
request.setCustomCode(nodeData);
|
|
@@ -17280,7 +17289,7 @@ var loop_default = LoopNode2;
|
|
|
17280
17289
|
// src/models/node/factory.ts
|
|
17281
17290
|
import {
|
|
17282
17291
|
NodeType as NodeType12,
|
|
17283
|
-
CustomCodeLangs
|
|
17292
|
+
CustomCodeLangs
|
|
17284
17293
|
} from "@avaprotocol/types";
|
|
17285
17294
|
var NodeFactory = class {
|
|
17286
17295
|
static create(props) {
|
|
@@ -18670,7 +18679,7 @@ export {
|
|
|
18670
18679
|
contractRead_default as ContractReadNode,
|
|
18671
18680
|
contractWrite_default as ContractWriteNode,
|
|
18672
18681
|
cron_default as CronTrigger,
|
|
18673
|
-
|
|
18682
|
+
CustomCodeLangs,
|
|
18674
18683
|
customCode_default as CustomCodeNode,
|
|
18675
18684
|
ethTransfer_default as ETHTransferNode,
|
|
18676
18685
|
edge_default as Edge,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customCode.d.ts","sourceRoot":"","sources":["../../../src/models/node/customCode.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,
|
|
1
|
+
{"version":3,"file":"customCode.d.ts","sourceRoot":"","sources":["../../../src/models/node/customCode.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAIL,mBAAmB,EAEpB,MAAM,oBAAoB,CAAC;AAK5B,cAAM,cAAe,SAAQ,IAAI;gBACnB,KAAK,EAAE,mBAAmB;IAItC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,cAAc;IAkBzD,SAAS,IAAI,MAAM,CAAC,QAAQ;IAsB5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAQrE;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Node from "./interface";
|
|
2
2
|
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
3
|
-
import { NodeType } from "@avaprotocol/types";
|
|
3
|
+
import { NodeType, CustomCodeLangConverter, } from "@avaprotocol/types";
|
|
4
4
|
import { convertProtobufValueToJs } from "../../utils";
|
|
5
5
|
// Required props for constructor: id, name, type and data: { lang: number, source: string }
|
|
6
6
|
class CustomCodeNode extends Node {
|
|
@@ -10,10 +10,16 @@ class CustomCodeNode extends Node {
|
|
|
10
10
|
static fromResponse(raw) {
|
|
11
11
|
// Convert the raw object to CustomCodeNodeProps, which should keep name and id
|
|
12
12
|
const obj = raw.toObject();
|
|
13
|
+
// Get the raw protobuf config and convert to our custom interface
|
|
14
|
+
const rawConfig = raw.getCustomCode().getConfig().toObject();
|
|
15
|
+
const convertedConfig = {
|
|
16
|
+
lang: CustomCodeLangConverter.fromProtobuf(rawConfig.lang),
|
|
17
|
+
source: rawConfig.source
|
|
18
|
+
};
|
|
13
19
|
return new CustomCodeNode({
|
|
14
20
|
...obj,
|
|
15
21
|
type: NodeType.CustomCode,
|
|
16
|
-
data:
|
|
22
|
+
data: convertedConfig,
|
|
17
23
|
});
|
|
18
24
|
}
|
|
19
25
|
toRequest() {
|
|
@@ -22,7 +28,9 @@ class CustomCodeNode extends Node {
|
|
|
22
28
|
request.setName(this.name);
|
|
23
29
|
const nodeData = new avs_pb.CustomCodeNode();
|
|
24
30
|
const config = new avs_pb.CustomCodeNode.Config();
|
|
25
|
-
|
|
31
|
+
// Convert string lang to protobuf enum using the converter
|
|
32
|
+
const langData = this.data.lang;
|
|
33
|
+
config.setLang(CustomCodeLangConverter.toProtobuf(langData));
|
|
26
34
|
config.setSource(this.data.source);
|
|
27
35
|
nodeData.setConfig(config);
|
|
28
36
|
request.setCustomCode(nodeData);
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
2
|
-
import { NodeType, NodeProps } from "@avaprotocol/types";
|
|
2
|
+
import { NodeType, NodeProps, NodeData } from "@avaprotocol/types";
|
|
3
3
|
export declare function covertNodeTypeToString(status: avs_pb.TaskNode.TaskTypeCase): NodeType;
|
|
4
|
-
export type NodeData = avs_pb.ETHTransferNode.AsObject | avs_pb.ContractWriteNode.AsObject | avs_pb.ContractReadNode.AsObject | avs_pb.GraphQLQueryNode.AsObject | avs_pb.RestAPINode.AsObject | avs_pb.BranchNode.AsObject | avs_pb.FilterNode.AsObject | avs_pb.LoopNode.AsObject | avs_pb.CustomCodeNode.AsObject;
|
|
5
4
|
export type ProtobufNodeProps = Omit<avs_pb.TaskNode.AsObject, "ethTransfer" | "contractWrite" | "contractRead" | "graphqlDataQuery" | "restApi" | "branch" | "filter" | "loop" | "customCode"> & {
|
|
6
|
-
data:
|
|
5
|
+
data: any;
|
|
7
6
|
};
|
|
8
7
|
export declare const ProtobufNodePropsUtils: {
|
|
9
8
|
getGoStringType: (props: ProtobufNodeProps) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../src/models/node/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAA0C,SAAS,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../src/models/node/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAA0C,SAAS,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAI3G,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,YAAY,GACnC,QAAQ,CAeV;AAGD,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAClC,MAAM,CAAC,QAAQ,CAAC,QAAQ,EACtB,aAAa,GACb,eAAe,GACf,cAAc,GACd,kBAAkB,GAClB,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,YAAY,CACf,GAAG;IAEF,IAAI,EAAE,GAAG,CAAC;CACX,CAAC;AAGF,eAAO,MAAM,sBAAsB;6BAER,iBAAiB,KAAG,MAAM;qCAKlB,MAAM,aAAa,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAC,KAAG,iBAAiB;CAMxG,CAAC;AAEF,cAAM,IAAK,YAAW,SAAS;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,QAAQ,CAAC;gBAEH,KAAK,EAAE,SAAS;IAO5B,SAAS,IAAI,MAAM,CAAC,QAAQ;CAU7B;AAED,eAAe,IAAI,CAAC"}
|
|
@@ -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,OAA0B,MAAM,aAAa,CAAC;AACrD,OAAO,EAAoC,iBAAiB,EAAE,gBAAgB,EAAgB,MAAM,oBAAoB,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,OAA0B,MAAM,aAAa,CAAC;AACrD,OAAO,EAAoC,iBAAiB,EAAE,gBAAgB,EAAgB,MAAM,oBAAoB,CAAC;AAEzH,cAAM,WAAY,SAAQ,OAAO;gBACnB,KAAK,EAAE,gBAAgB;IAInC,SAAS,IAAI,MAAM,CAAC,WAAW;IAoB/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,WAAW;IAuBzD;;;;OAIG;IACH,SAAS,IAAI,iBAAiB,GAAG,SAAS;IAI1C;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,GAAG;CAW9D;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
2
2
|
import Trigger from "./interface";
|
|
3
3
|
import { TriggerType } from "@avaprotocol/types";
|
|
4
|
-
// Required props for constructor: id, name, type and data: { scheduleList }
|
|
5
4
|
class CronTrigger extends Trigger {
|
|
6
5
|
constructor(props) {
|
|
7
6
|
super({ ...props, type: TriggerType.Cron, data: props.data });
|
|
@@ -16,7 +15,7 @@ class CronTrigger extends Trigger {
|
|
|
16
15
|
}
|
|
17
16
|
const trigger = new avs_pb.CronTrigger();
|
|
18
17
|
const config = new avs_pb.CronTrigger.Config();
|
|
19
|
-
config.
|
|
18
|
+
config.setSchedulesList(this.data.schedules || []);
|
|
20
19
|
trigger.setConfig(config);
|
|
21
20
|
request.setCron(trigger);
|
|
22
21
|
return request;
|
|
@@ -24,12 +23,12 @@ class CronTrigger extends Trigger {
|
|
|
24
23
|
static fromResponse(raw) {
|
|
25
24
|
// Convert the raw object to TriggerProps, which should keep name and id
|
|
26
25
|
const obj = raw.toObject();
|
|
27
|
-
let data = {
|
|
26
|
+
let data = { schedules: [] };
|
|
28
27
|
if (raw.getCron() && raw.getCron().hasConfig()) {
|
|
29
28
|
const config = raw.getCron().getConfig();
|
|
30
29
|
if (config) {
|
|
31
30
|
data = {
|
|
32
|
-
|
|
31
|
+
schedules: config.getSchedulesList() || []
|
|
33
32
|
};
|
|
34
33
|
}
|
|
35
34
|
}
|
package/package.json
CHANGED