@avaprotocol/sdk-js 2.7.1 → 2.7.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/CHANGELOG.md +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +251 -264
- package/dist/index.mjs +242 -255
- package/dist/models/execution.d.ts +2 -2
- package/dist/models/execution.d.ts.map +1 -1
- package/dist/models/execution.js +23 -3
- package/package.json +2 -2
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
2
|
-
import { ExecutionProps } from "@avaprotocol/types";
|
|
2
|
+
import { ExecutionProps, ExecutionStatus } from "@avaprotocol/types";
|
|
3
3
|
import Step from "./step";
|
|
4
4
|
declare class Execution implements ExecutionProps {
|
|
5
5
|
id: string;
|
|
6
6
|
startAt: number;
|
|
7
7
|
endAt: number;
|
|
8
|
-
|
|
8
|
+
status: ExecutionStatus;
|
|
9
9
|
error: string;
|
|
10
10
|
index: number;
|
|
11
11
|
steps: Step[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution.d.ts","sourceRoot":"","sources":["../../src/models/execution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAqC,cAAc,EAAa,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"execution.d.ts","sourceRoot":"","sources":["../../src/models/execution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAqC,cAAc,EAAa,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACnH,OAAO,IAAI,MAAM,QAAQ,CAAC;AAuB1B,cAAM,SAAU,YAAW,cAAc;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,eAAe,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,IAAI,EAAE,CAAC;gBAEF,KAAK,EAAE,cAAc;IAWjC;;;OAGG;IACH,MAAM,IAAI,cAAc;IAYxB,MAAM,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,SAAS,GAAG,SAAS;CAe5D;AAED,eAAe,SAAS,CAAC"}
|
package/dist/models/execution.js
CHANGED
|
@@ -1,10 +1,30 @@
|
|
|
1
|
+
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
2
|
+
import { ExecutionStatus } from "@avaprotocol/types";
|
|
1
3
|
import Step from "./step";
|
|
4
|
+
/**
|
|
5
|
+
* Convert protobuf ExecutionStatus to types ExecutionStatus
|
|
6
|
+
*/
|
|
7
|
+
function convertProtobufExecutionStatusToTypes(protobufStatus) {
|
|
8
|
+
switch (protobufStatus) {
|
|
9
|
+
case avs_pb.ExecutionStatus.EXECUTION_STATUS_PENDING:
|
|
10
|
+
return ExecutionStatus.Pending;
|
|
11
|
+
case avs_pb.ExecutionStatus.EXECUTION_STATUS_SUCCESS:
|
|
12
|
+
return ExecutionStatus.Success;
|
|
13
|
+
case avs_pb.ExecutionStatus.EXECUTION_STATUS_FAILED:
|
|
14
|
+
return ExecutionStatus.Failed;
|
|
15
|
+
case avs_pb.ExecutionStatus.EXECUTION_STATUS_PARTIAL_SUCCESS:
|
|
16
|
+
return ExecutionStatus.PartialSuccess;
|
|
17
|
+
case avs_pb.ExecutionStatus.EXECUTION_STATUS_UNSPECIFIED:
|
|
18
|
+
default:
|
|
19
|
+
return ExecutionStatus.Unspecified;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
2
22
|
class Execution {
|
|
3
23
|
constructor(props) {
|
|
4
24
|
this.id = props.id;
|
|
5
25
|
this.startAt = props.startAt;
|
|
6
26
|
this.endAt = props.endAt;
|
|
7
|
-
this.
|
|
27
|
+
this.status = props.status;
|
|
8
28
|
this.error = props.error;
|
|
9
29
|
this.index = props.index;
|
|
10
30
|
this.steps = props.steps.map(s => new Step(s));
|
|
@@ -18,7 +38,7 @@ class Execution {
|
|
|
18
38
|
id: this.id,
|
|
19
39
|
startAt: this.startAt,
|
|
20
40
|
endAt: this.endAt,
|
|
21
|
-
|
|
41
|
+
status: this.status,
|
|
22
42
|
error: this.error,
|
|
23
43
|
index: this.index,
|
|
24
44
|
steps: this.steps.map(step => step.toJson()),
|
|
@@ -29,7 +49,7 @@ class Execution {
|
|
|
29
49
|
id: execution.getId(),
|
|
30
50
|
startAt: execution.getStartAt(),
|
|
31
51
|
endAt: execution.getEndAt(),
|
|
32
|
-
|
|
52
|
+
status: convertProtobufExecutionStatusToTypes(execution.getStatus()),
|
|
33
53
|
error: execution.getError(),
|
|
34
54
|
index: execution.getIndex(),
|
|
35
55
|
steps: execution
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@avaprotocol/sdk-js",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.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",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"prepare": "node ../../scripts/prepare-package.js"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@avaprotocol/types": "^2.5.
|
|
34
|
+
"@avaprotocol/types": "^2.5.2",
|
|
35
35
|
"@grpc/grpc-js": "^1.11.3",
|
|
36
36
|
"@grpc/proto-loader": "^0.7.13",
|
|
37
37
|
"dotenv": "^16.4.5",
|