@avaprotocol/sdk-js 1.3.3 → 1.3.4-dev.0
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 +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +26 -17
- package/dist/index.mjs +26 -17
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1502,6 +1502,7 @@ declare class Node implements NodeProps {
|
|
|
1502
1502
|
data: NodeData;
|
|
1503
1503
|
constructor(props: NodeProps);
|
|
1504
1504
|
toRequest(): TaskNode;
|
|
1505
|
+
toJson(): Record<string, any>;
|
|
1505
1506
|
}
|
|
1506
1507
|
|
|
1507
1508
|
type EdgeProps = TaskEdge.AsObject;
|
|
@@ -1557,7 +1558,7 @@ declare enum TriggerType {
|
|
|
1557
1558
|
type SmartWallet = SmartWallet$1.AsObject;
|
|
1558
1559
|
declare const ExecutionStatus: typeof ExecutionStatus$1;
|
|
1559
1560
|
|
|
1560
|
-
type TriggerData = FixedTimeCondition.AsObject | CronCondition.AsObject | BlockCondition.AsObject | EventCondition.AsObject
|
|
1561
|
+
type TriggerData = FixedTimeCondition.AsObject | CronCondition.AsObject | BlockCondition.AsObject | EventCondition.AsObject;
|
|
1561
1562
|
type TriggerProps = Omit<TaskTrigger.AsObject, "manual" | "fixedTime" | "cron" | "block" | "event"> & {
|
|
1562
1563
|
type: TriggerType;
|
|
1563
1564
|
data: TriggerData;
|
|
@@ -1573,6 +1574,7 @@ declare class Trigger implements TriggerProps {
|
|
|
1573
1574
|
*/
|
|
1574
1575
|
constructor(props: TriggerProps);
|
|
1575
1576
|
toRequest(): TaskTrigger;
|
|
1577
|
+
toJson(): Record<string, any>;
|
|
1576
1578
|
}
|
|
1577
1579
|
|
|
1578
1580
|
type WorkflowProps = Omit<Task.AsObject, "id" | "owner" | "completedAt" | "status" | "executionsList" | "name" | "trigger" | "nodesList" | "edgesList" | "totalExecution" | "lastRanAt"> & {
|
package/dist/index.d.ts
CHANGED
|
@@ -1502,6 +1502,7 @@ declare class Node implements NodeProps {
|
|
|
1502
1502
|
data: NodeData;
|
|
1503
1503
|
constructor(props: NodeProps);
|
|
1504
1504
|
toRequest(): TaskNode;
|
|
1505
|
+
toJson(): Record<string, any>;
|
|
1505
1506
|
}
|
|
1506
1507
|
|
|
1507
1508
|
type EdgeProps = TaskEdge.AsObject;
|
|
@@ -1557,7 +1558,7 @@ declare enum TriggerType {
|
|
|
1557
1558
|
type SmartWallet = SmartWallet$1.AsObject;
|
|
1558
1559
|
declare const ExecutionStatus: typeof ExecutionStatus$1;
|
|
1559
1560
|
|
|
1560
|
-
type TriggerData = FixedTimeCondition.AsObject | CronCondition.AsObject | BlockCondition.AsObject | EventCondition.AsObject
|
|
1561
|
+
type TriggerData = FixedTimeCondition.AsObject | CronCondition.AsObject | BlockCondition.AsObject | EventCondition.AsObject;
|
|
1561
1562
|
type TriggerProps = Omit<TaskTrigger.AsObject, "manual" | "fixedTime" | "cron" | "block" | "event"> & {
|
|
1562
1563
|
type: TriggerType;
|
|
1563
1564
|
data: TriggerData;
|
|
@@ -1573,6 +1574,7 @@ declare class Trigger implements TriggerProps {
|
|
|
1573
1574
|
*/
|
|
1574
1575
|
constructor(props: TriggerProps);
|
|
1575
1576
|
toRequest(): TaskTrigger;
|
|
1577
|
+
toJson(): Record<string, any>;
|
|
1576
1578
|
}
|
|
1577
1579
|
|
|
1578
1580
|
type WorkflowProps = Omit<Task.AsObject, "id" | "owner" | "completedAt" | "status" | "executionsList" | "name" | "trigger" | "nodesList" | "edgesList" | "totalExecution" | "lastRanAt"> & {
|
package/dist/index.js
CHANGED
|
@@ -6623,7 +6623,7 @@ __export(index_exports, {
|
|
|
6623
6623
|
getKeyRequestMessage: () => getKeyRequestMessage
|
|
6624
6624
|
});
|
|
6625
6625
|
module.exports = __toCommonJS(index_exports);
|
|
6626
|
-
var
|
|
6626
|
+
var import_lodash3 = __toESM(require("lodash"));
|
|
6627
6627
|
var grpc = __toESM(require("@grpc/grpc-js"));
|
|
6628
6628
|
var import_grpc_js = require("@grpc/grpc-js");
|
|
6629
6629
|
|
|
@@ -6645,7 +6645,7 @@ var avs_pb19 = __toESM(require_avs_pb());
|
|
|
6645
6645
|
var import_timestamp_pb = require("google-protobuf/google/protobuf/timestamp_pb");
|
|
6646
6646
|
|
|
6647
6647
|
// src/models/workflow.ts
|
|
6648
|
-
var
|
|
6648
|
+
var import_lodash2 = __toESM(require("lodash"));
|
|
6649
6649
|
var avs_pb15 = __toESM(require_avs_pb());
|
|
6650
6650
|
|
|
6651
6651
|
// src/models/edge.ts
|
|
@@ -6687,6 +6687,14 @@ var Trigger = class {
|
|
|
6687
6687
|
toRequest() {
|
|
6688
6688
|
throw new Error("Method not implemented.");
|
|
6689
6689
|
}
|
|
6690
|
+
toJson() {
|
|
6691
|
+
return {
|
|
6692
|
+
id: this.id,
|
|
6693
|
+
name: this.name,
|
|
6694
|
+
type: this.type,
|
|
6695
|
+
data: this.data
|
|
6696
|
+
};
|
|
6697
|
+
}
|
|
6690
6698
|
};
|
|
6691
6699
|
var interface_default = Trigger;
|
|
6692
6700
|
|
|
@@ -6917,12 +6925,11 @@ var TriggerFactory = class {
|
|
|
6917
6925
|
var factory_default = TriggerFactory;
|
|
6918
6926
|
|
|
6919
6927
|
// src/models/node/factory.ts
|
|
6920
|
-
var
|
|
6928
|
+
var import_lodash = __toESM(require("lodash"));
|
|
6921
6929
|
|
|
6922
6930
|
// src/models/node/interface.ts
|
|
6923
6931
|
var avs_pb7 = __toESM(require_avs_pb());
|
|
6924
6932
|
var import_types6 = require("@avaprotocol/types");
|
|
6925
|
-
var import_lodash = __toESM(require("lodash"));
|
|
6926
6933
|
var Node = class {
|
|
6927
6934
|
constructor(props) {
|
|
6928
6935
|
this.id = props.id;
|
|
@@ -6931,13 +6938,15 @@ var Node = class {
|
|
|
6931
6938
|
this.data = props.data;
|
|
6932
6939
|
}
|
|
6933
6940
|
toRequest() {
|
|
6934
|
-
|
|
6935
|
-
|
|
6936
|
-
|
|
6937
|
-
|
|
6938
|
-
|
|
6939
|
-
|
|
6940
|
-
|
|
6941
|
+
throw new Error("Method not implemented.");
|
|
6942
|
+
}
|
|
6943
|
+
toJson() {
|
|
6944
|
+
return {
|
|
6945
|
+
id: this.id,
|
|
6946
|
+
name: this.name,
|
|
6947
|
+
type: this.type,
|
|
6948
|
+
data: this.data
|
|
6949
|
+
};
|
|
6941
6950
|
}
|
|
6942
6951
|
};
|
|
6943
6952
|
var interface_default2 = Node;
|
|
@@ -7192,7 +7201,7 @@ var NodeFactory = class {
|
|
|
7192
7201
|
}
|
|
7193
7202
|
}
|
|
7194
7203
|
static createNodes(props) {
|
|
7195
|
-
return
|
|
7204
|
+
return import_lodash.default.map(props, (node) => this.create(node));
|
|
7196
7205
|
}
|
|
7197
7206
|
static fromResponse(raw) {
|
|
7198
7207
|
switch (true) {
|
|
@@ -7262,11 +7271,11 @@ var Workflow = class _Workflow {
|
|
|
7262
7271
|
if (!trigger) {
|
|
7263
7272
|
throw new Error("Trigger is undefined in fromResponse()");
|
|
7264
7273
|
}
|
|
7265
|
-
const nodes =
|
|
7274
|
+
const nodes = import_lodash2.default.map(
|
|
7266
7275
|
obj.getNodesList(),
|
|
7267
7276
|
(node) => factory_default2.fromResponse(node)
|
|
7268
7277
|
);
|
|
7269
|
-
const edges =
|
|
7278
|
+
const edges = import_lodash2.default.map(obj.getEdgesList(), (edge) => edge_default.fromResponse(edge));
|
|
7270
7279
|
const workflow = new _Workflow({
|
|
7271
7280
|
id: obj.getId(),
|
|
7272
7281
|
owner: obj.getOwner(),
|
|
@@ -7315,8 +7324,8 @@ var Workflow = class _Workflow {
|
|
|
7315
7324
|
const request = new avs_pb15.CreateTaskReq();
|
|
7316
7325
|
request.setSmartWalletAddress(this.smartWalletAddress);
|
|
7317
7326
|
request.setTrigger(this.trigger.toRequest());
|
|
7318
|
-
|
|
7319
|
-
|
|
7327
|
+
import_lodash2.default.map(this.nodes, (node) => request.addNodes(node.toRequest()));
|
|
7328
|
+
import_lodash2.default.map(this.edges, (edge) => request.addEdges(edge.toRequest()));
|
|
7320
7329
|
request.setStartAt(this.startAt);
|
|
7321
7330
|
request.setExpiredAt(this.expiredAt);
|
|
7322
7331
|
request.setMaxExecution(this.maxExecution);
|
|
@@ -7620,7 +7629,7 @@ var BaseClient = class {
|
|
|
7620
7629
|
* @returns {Promise<TResponse>} - The response from the gRPC call
|
|
7621
7630
|
*/
|
|
7622
7631
|
sendGrpcRequest(method, request, options) {
|
|
7623
|
-
const metadata =
|
|
7632
|
+
const metadata = import_lodash3.default.cloneDeep(this.metadata);
|
|
7624
7633
|
if (options?.authKey) {
|
|
7625
7634
|
metadata.set(AUTH_KEY_HEADER, options.authKey);
|
|
7626
7635
|
} else if (this.authKey) {
|
package/dist/index.mjs
CHANGED
|
@@ -6593,7 +6593,7 @@ var require_avs_grpc_pb = __commonJS({
|
|
|
6593
6593
|
});
|
|
6594
6594
|
|
|
6595
6595
|
// src/index.ts
|
|
6596
|
-
import
|
|
6596
|
+
import _3 from "lodash";
|
|
6597
6597
|
import * as grpc from "@grpc/grpc-js";
|
|
6598
6598
|
import { Metadata } from "@grpc/grpc-js";
|
|
6599
6599
|
|
|
@@ -6616,7 +6616,7 @@ import { Timestamp } from "google-protobuf/google/protobuf/timestamp_pb";
|
|
|
6616
6616
|
|
|
6617
6617
|
// src/models/workflow.ts
|
|
6618
6618
|
var avs_pb15 = __toESM(require_avs_pb());
|
|
6619
|
-
import
|
|
6619
|
+
import _2 from "lodash";
|
|
6620
6620
|
|
|
6621
6621
|
// src/models/edge.ts
|
|
6622
6622
|
var avs_pb = __toESM(require_avs_pb());
|
|
@@ -6657,6 +6657,14 @@ var Trigger = class {
|
|
|
6657
6657
|
toRequest() {
|
|
6658
6658
|
throw new Error("Method not implemented.");
|
|
6659
6659
|
}
|
|
6660
|
+
toJson() {
|
|
6661
|
+
return {
|
|
6662
|
+
id: this.id,
|
|
6663
|
+
name: this.name,
|
|
6664
|
+
type: this.type,
|
|
6665
|
+
data: this.data
|
|
6666
|
+
};
|
|
6667
|
+
}
|
|
6660
6668
|
};
|
|
6661
6669
|
var interface_default = Trigger;
|
|
6662
6670
|
|
|
@@ -6887,12 +6895,11 @@ var TriggerFactory = class {
|
|
|
6887
6895
|
var factory_default = TriggerFactory;
|
|
6888
6896
|
|
|
6889
6897
|
// src/models/node/factory.ts
|
|
6890
|
-
import
|
|
6898
|
+
import _ from "lodash";
|
|
6891
6899
|
|
|
6892
6900
|
// src/models/node/interface.ts
|
|
6893
6901
|
var avs_pb7 = __toESM(require_avs_pb());
|
|
6894
6902
|
import { NodeType } from "@avaprotocol/types";
|
|
6895
|
-
import _ from "lodash";
|
|
6896
6903
|
var Node = class {
|
|
6897
6904
|
constructor(props) {
|
|
6898
6905
|
this.id = props.id;
|
|
@@ -6901,13 +6908,15 @@ var Node = class {
|
|
|
6901
6908
|
this.data = props.data;
|
|
6902
6909
|
}
|
|
6903
6910
|
toRequest() {
|
|
6904
|
-
|
|
6905
|
-
|
|
6906
|
-
|
|
6907
|
-
|
|
6908
|
-
|
|
6909
|
-
|
|
6910
|
-
|
|
6911
|
+
throw new Error("Method not implemented.");
|
|
6912
|
+
}
|
|
6913
|
+
toJson() {
|
|
6914
|
+
return {
|
|
6915
|
+
id: this.id,
|
|
6916
|
+
name: this.name,
|
|
6917
|
+
type: this.type,
|
|
6918
|
+
data: this.data
|
|
6919
|
+
};
|
|
6911
6920
|
}
|
|
6912
6921
|
};
|
|
6913
6922
|
var interface_default2 = Node;
|
|
@@ -7162,7 +7171,7 @@ var NodeFactory = class {
|
|
|
7162
7171
|
}
|
|
7163
7172
|
}
|
|
7164
7173
|
static createNodes(props) {
|
|
7165
|
-
return
|
|
7174
|
+
return _.map(props, (node) => this.create(node));
|
|
7166
7175
|
}
|
|
7167
7176
|
static fromResponse(raw) {
|
|
7168
7177
|
switch (true) {
|
|
@@ -7232,11 +7241,11 @@ var Workflow = class _Workflow {
|
|
|
7232
7241
|
if (!trigger) {
|
|
7233
7242
|
throw new Error("Trigger is undefined in fromResponse()");
|
|
7234
7243
|
}
|
|
7235
|
-
const nodes =
|
|
7244
|
+
const nodes = _2.map(
|
|
7236
7245
|
obj.getNodesList(),
|
|
7237
7246
|
(node) => factory_default2.fromResponse(node)
|
|
7238
7247
|
);
|
|
7239
|
-
const edges =
|
|
7248
|
+
const edges = _2.map(obj.getEdgesList(), (edge) => edge_default.fromResponse(edge));
|
|
7240
7249
|
const workflow = new _Workflow({
|
|
7241
7250
|
id: obj.getId(),
|
|
7242
7251
|
owner: obj.getOwner(),
|
|
@@ -7285,8 +7294,8 @@ var Workflow = class _Workflow {
|
|
|
7285
7294
|
const request = new avs_pb15.CreateTaskReq();
|
|
7286
7295
|
request.setSmartWalletAddress(this.smartWalletAddress);
|
|
7287
7296
|
request.setTrigger(this.trigger.toRequest());
|
|
7288
|
-
|
|
7289
|
-
|
|
7297
|
+
_2.map(this.nodes, (node) => request.addNodes(node.toRequest()));
|
|
7298
|
+
_2.map(this.edges, (edge) => request.addEdges(edge.toRequest()));
|
|
7290
7299
|
request.setStartAt(this.startAt);
|
|
7291
7300
|
request.setExpiredAt(this.expiredAt);
|
|
7292
7301
|
request.setMaxExecution(this.maxExecution);
|
|
@@ -7590,7 +7599,7 @@ var BaseClient = class {
|
|
|
7590
7599
|
* @returns {Promise<TResponse>} - The response from the gRPC call
|
|
7591
7600
|
*/
|
|
7592
7601
|
sendGrpcRequest(method, request, options) {
|
|
7593
|
-
const metadata =
|
|
7602
|
+
const metadata = _3.cloneDeep(this.metadata);
|
|
7594
7603
|
if (options?.authKey) {
|
|
7595
7604
|
metadata.set(AUTH_KEY_HEADER, options.authKey);
|
|
7596
7605
|
} else if (this.authKey) {
|
package/package.json
CHANGED