@portal-hq/utils 0.3.8 → 1.0.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.
|
@@ -20,6 +20,9 @@ class KeychainAdapter {
|
|
|
20
20
|
storeDkgResult(result, isSim, _progress = () => { }) {
|
|
21
21
|
throw new Error(`[Portal] KeychainAdapter method storeDkgResult(${result}, ${isSim}) cannot be called directly. Please extend KeychainAdapter.`);
|
|
22
22
|
}
|
|
23
|
+
validateOperations() {
|
|
24
|
+
throw new Error(`[Portal] KeychainAdapter method validateOperations() cannot be called directly. Please extend KeychainAdapter.`);
|
|
25
|
+
}
|
|
23
26
|
}
|
|
24
27
|
exports.KeychainAdapter = KeychainAdapter;
|
|
25
28
|
var MpcStatuses;
|
|
@@ -44,5 +47,8 @@ class Storage {
|
|
|
44
47
|
write(privateKey) {
|
|
45
48
|
throw new Error(`[Portal] Storage method write(${privateKey}) cannot be called directly. Please extend Storage.`);
|
|
46
49
|
}
|
|
50
|
+
validateOperations() {
|
|
51
|
+
throw new Error(`[Portal] Storage method validateOperations() cannot be called directly. Please extend Storage.`);
|
|
52
|
+
}
|
|
47
53
|
}
|
|
48
54
|
exports.Storage = Storage;
|
|
@@ -43,6 +43,10 @@ class HttpRequest {
|
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
buildResponse() {
|
|
46
|
+
// If the response is empty, just return an empty object
|
|
47
|
+
if (this.request.status === 204) {
|
|
48
|
+
return {};
|
|
49
|
+
}
|
|
46
50
|
try {
|
|
47
51
|
// Try parsing the response body into a JSON object
|
|
48
52
|
const response = JSON.parse(this.request.response);
|
|
@@ -17,6 +17,9 @@ export class KeychainAdapter {
|
|
|
17
17
|
storeDkgResult(result, isSim, _progress = () => { }) {
|
|
18
18
|
throw new Error(`[Portal] KeychainAdapter method storeDkgResult(${result}, ${isSim}) cannot be called directly. Please extend KeychainAdapter.`);
|
|
19
19
|
}
|
|
20
|
+
validateOperations() {
|
|
21
|
+
throw new Error(`[Portal] KeychainAdapter method validateOperations() cannot be called directly. Please extend KeychainAdapter.`);
|
|
22
|
+
}
|
|
20
23
|
}
|
|
21
24
|
export var MpcStatuses;
|
|
22
25
|
(function (MpcStatuses) {
|
|
@@ -40,4 +43,7 @@ export class Storage {
|
|
|
40
43
|
write(privateKey) {
|
|
41
44
|
throw new Error(`[Portal] Storage method write(${privateKey}) cannot be called directly. Please extend Storage.`);
|
|
42
45
|
}
|
|
46
|
+
validateOperations() {
|
|
47
|
+
throw new Error(`[Portal] Storage method validateOperations() cannot be called directly. Please extend Storage.`);
|
|
48
|
+
}
|
|
43
49
|
}
|
|
@@ -41,6 +41,10 @@ class HttpRequest {
|
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
buildResponse() {
|
|
44
|
+
// If the response is empty, just return an empty object
|
|
45
|
+
if (this.request.status === 204) {
|
|
46
|
+
return {};
|
|
47
|
+
}
|
|
44
48
|
try {
|
|
45
49
|
// Try parsing the response body into a JSON object
|
|
46
50
|
const response = JSON.parse(this.request.response);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@portal-hq/utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"main": "lib/commonjs/index",
|
|
5
5
|
"module": "lib/esm/index",
|
|
6
6
|
"source": "src/index",
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"ts-jest": "^29.0.3",
|
|
27
27
|
"typescript": "^4.8.4"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "eb157f00d5567c5fe28c4f935ea0d1099b7103e5"
|
|
30
30
|
}
|
package/src/definitions/index.ts
CHANGED
|
@@ -44,6 +44,11 @@ export abstract class KeychainAdapter {
|
|
|
44
44
|
`[Portal] KeychainAdapter method storeDkgResult(${result}, ${isSim}) cannot be called directly. Please extend KeychainAdapter.`,
|
|
45
45
|
)
|
|
46
46
|
}
|
|
47
|
+
validateOperations(): Promise<boolean> {
|
|
48
|
+
throw new Error(
|
|
49
|
+
`[Portal] KeychainAdapter method validateOperations() cannot be called directly. Please extend KeychainAdapter.`,
|
|
50
|
+
)
|
|
51
|
+
}
|
|
47
52
|
}
|
|
48
53
|
|
|
49
54
|
export enum MpcStatuses {
|
|
@@ -84,4 +89,10 @@ export abstract class Storage {
|
|
|
84
89
|
`[Portal] Storage method write(${privateKey}) cannot be called directly. Please extend Storage.`,
|
|
85
90
|
)
|
|
86
91
|
}
|
|
92
|
+
|
|
93
|
+
validateOperations(): Promise<boolean> {
|
|
94
|
+
throw new Error(
|
|
95
|
+
`[Portal] Storage method validateOperations() cannot be called directly. Please extend Storage.`,
|
|
96
|
+
)
|
|
97
|
+
}
|
|
87
98
|
}
|
|
@@ -57,6 +57,11 @@ class HttpRequest {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
private buildResponse<T>(): T {
|
|
60
|
+
// If the response is empty, just return an empty object
|
|
61
|
+
if (this.request.status === 204) {
|
|
62
|
+
return {} as T
|
|
63
|
+
}
|
|
64
|
+
|
|
60
65
|
try {
|
|
61
66
|
// Try parsing the response body into a JSON object
|
|
62
67
|
const response = JSON.parse(this.request.response) as T
|