@apex-pub/convector-storage-stub 1.4.0 → 1.4.1-1.4.1-node20.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/src/index.js +1 -1
- package/dist/src/stub-storage.d.ts +1 -1
- package/dist/src/stub-storage.js +38 -70
- package/dist/src/stub-storage.js.map +1 -1
- package/package.json +5 -14
package/dist/src/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChaincodeStub } from 'fabric-shim';
|
|
2
2
|
import { BaseStorage } from '@apex-pub/convector-core';
|
|
3
|
-
import { StubHelper } from '@
|
|
3
|
+
import { StubHelper } from '@apex-pub/fabric-chaincode-utils';
|
|
4
4
|
export declare class StubStorage extends BaseStorage {
|
|
5
5
|
stubHelper: StubHelper;
|
|
6
6
|
constructor(stub: ChaincodeStub);
|
package/dist/src/stub-storage.js
CHANGED
|
@@ -1,80 +1,48 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
fabric_chaincode_utils_1
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return _this;
|
|
3
|
+
exports.StubStorage = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const convector_core_1 = require("@apex-pub/convector-core");
|
|
6
|
+
const fabric_chaincode_utils_1 = require("@apex-pub/fabric-chaincode-utils");
|
|
7
|
+
fabric_chaincode_utils_1.Transform.isObject = data => data !== null && typeof data === 'object';
|
|
8
|
+
class StubStorage extends convector_core_1.BaseStorage {
|
|
9
|
+
constructor(stub) {
|
|
10
|
+
super();
|
|
11
|
+
this.stubHelper = new fabric_chaincode_utils_1.StubHelper(stub);
|
|
13
12
|
}
|
|
14
|
-
|
|
15
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
16
|
-
return
|
|
17
|
-
switch (_a.label) {
|
|
18
|
-
case 0: return [4, this.stubHelper.getQueryResultAsList(query, storageOptions)];
|
|
19
|
-
case 1: return [2, _a.sent()];
|
|
20
|
-
}
|
|
21
|
-
});
|
|
13
|
+
query(query, storageOptions) {
|
|
14
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
return yield this.stubHelper.getQueryResultAsList(query, storageOptions);
|
|
22
16
|
});
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
case 0:
|
|
29
|
-
convector_core_1.InvalidIdError.test(id);
|
|
30
|
-
return [4, this.stubHelper.getStateAsObject(id, storageOptions)];
|
|
31
|
-
case 1: return [2, _a.sent()];
|
|
32
|
-
}
|
|
33
|
-
});
|
|
17
|
+
}
|
|
18
|
+
get(id, storageOptions) {
|
|
19
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
convector_core_1.InvalidIdError.test(id);
|
|
21
|
+
return yield this.stubHelper.getStateAsObject(id, storageOptions);
|
|
34
22
|
});
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
case 0:
|
|
41
|
-
convector_core_1.InvalidIdError.test(id);
|
|
42
|
-
return [4, this.stubHelper.putState(id, JSON.stringify(content), storageOptions)];
|
|
43
|
-
case 1: return [2, _a.sent()];
|
|
44
|
-
}
|
|
45
|
-
});
|
|
23
|
+
}
|
|
24
|
+
set(id, content, storageOptions) {
|
|
25
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
convector_core_1.InvalidIdError.test(id);
|
|
27
|
+
return yield this.stubHelper.putState(id, JSON.stringify(content), storageOptions);
|
|
46
28
|
});
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return [4, this.stubHelper.getStub()
|
|
57
|
-
.deletePrivateData(storageOptions.privateCollection, id)];
|
|
58
|
-
case 1: return [2, _a.sent()];
|
|
59
|
-
case 2: return [4, this.stubHelper.getStub().deleteState(id)];
|
|
60
|
-
case 3: return [2, _a.sent()];
|
|
61
|
-
}
|
|
62
|
-
});
|
|
29
|
+
}
|
|
30
|
+
delete(id, storageOptions = {}) {
|
|
31
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
convector_core_1.InvalidIdError.test(id);
|
|
33
|
+
if (storageOptions.privateCollection) {
|
|
34
|
+
return yield this.stubHelper.getStub()
|
|
35
|
+
.deletePrivateData(storageOptions.privateCollection, id);
|
|
36
|
+
}
|
|
37
|
+
return yield this.stubHelper.getStub().deleteState(id);
|
|
63
38
|
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
case 0:
|
|
70
|
-
convector_core_1.InvalidIdError.test(id);
|
|
71
|
-
return [4, this.stubHelper.getHistoryForKeyAsList(id)];
|
|
72
|
-
case 1: return [2, _a.sent()];
|
|
73
|
-
}
|
|
74
|
-
});
|
|
39
|
+
}
|
|
40
|
+
history(id) {
|
|
41
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
convector_core_1.InvalidIdError.test(id);
|
|
43
|
+
return yield this.stubHelper.getHistoryForKeyAsList(id);
|
|
75
44
|
});
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
}(convector_core_1.BaseStorage));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
79
47
|
exports.StubStorage = StubStorage;
|
|
80
48
|
//# sourceMappingURL=stub-storage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stub-storage.js","sourceRoot":"","sources":["../../src/stub-storage.ts"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CAAC;aAC5D;YAED,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QACzD,CAAC;KAAA;IAEY,OAAO,CAAC,EAAU;;YAC7B,+BAAc,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACxB,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,sBAAsB,CAAC,EAAE,CAAC,CAAC;QAC1D,CAAC;KAAA;CACF;AA1CD,kCA0CC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apex-pub/convector-storage-stub",
|
|
3
|
-
"version": "1.4.0",
|
|
3
|
+
"version": "1.4.1-1.4.1-node20.0",
|
|
4
4
|
"description": "Convector STUB Storage class",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -41,20 +41,11 @@
|
|
|
41
41
|
"docs:serve": "http-server docs"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@apex-pub/convector-core": "^1.4.0",
|
|
45
|
-
"@
|
|
46
|
-
"@
|
|
47
|
-
"tslib": "^1.9.0"
|
|
44
|
+
"@apex-pub/convector-core": "^1.4.1-1.4.1-node20.0",
|
|
45
|
+
"@apex-pub/fabric-chaincode-utils": "^1.4.1-1.4.1-node20.0",
|
|
46
|
+
"@apex-pub/fabric-shim-crypto-types": "^1.4.1-1.4.1-node20.0"
|
|
48
47
|
},
|
|
49
48
|
"devDependencies": {
|
|
50
|
-
"@
|
|
51
|
-
"http-server": "^0.11.1",
|
|
52
|
-
"mocha": "^5.0.3",
|
|
53
|
-
"npm-scripts-watcher": "^1.0.2",
|
|
54
|
-
"rimraf": "^2.6.2",
|
|
55
|
-
"ts-node": "^6.0.3",
|
|
56
|
-
"tslint": "^5.9.1",
|
|
57
|
-
"typedoc": "^0.11.1",
|
|
58
|
-
"typescript": "2.8.3"
|
|
49
|
+
"@apex-pub/fabric-mock-stub": "^1.4.1-1.4.1-node20.0"
|
|
59
50
|
}
|
|
60
51
|
}
|