@apex-pub/convector-storage-stub 1.4.1-4-alpha.808cd029 → 1.5.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/CHANGELOG.md +27 -0
- package/dist/src/index.js +1 -1
- package/dist/src/stub-storage.d.ts +1 -1
- package/dist/src/stub-storage.js +70 -38
- package/dist/src/stub-storage.js.map +1 -1
- package/package.json +18 -5
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
<a name="1.5.0"></a>
|
|
7
|
+
# 1.5.0 (2024-07-29)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* add storageOptions parameter to query method ([91f8eaf](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-storage-stub/commit/91f8eaf))
|
|
13
|
+
* error handlers for testing and chaincode ([ef9bae6](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-storage-stub/commit/ef9bae6))
|
|
14
|
+
* patch theledger library for fabric-chaincode-utils ([ba4ddb0](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-storage-stub/commit/ba4ddb0))
|
|
15
|
+
* replace fabric utils for apex one without caught exception on logs ([06af7c3](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-storage-stub/commit/06af7c3))
|
|
16
|
+
* update access public to the packages (pull request [#27](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-storage-stub/issues/27)) ([f2eebde](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-storage-stub/commit/f2eebde))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
* Add documentation (pull request [#28](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-storage-stub/issues/28)) ([fc8ddbc](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-storage-stub/commit/fc8ddbc))
|
|
22
|
+
* group packages and update package.json's ([3971b44](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-storage-stub/commit/3971b44))
|
|
23
|
+
* in-chaincode adapter with tests ([4b380af](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-storage-stub/commit/4b380af))
|
|
24
|
+
* Preparing versions for stable release (pull request [#25](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-storage-stub/issues/25)) ([1f5a876](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-storage-stub/commit/1f5a876))
|
|
25
|
+
* Production readiness (pull request [#48](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-storage-stub/issues/48)) ([5bb7287](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-storage-stub/commit/5bb7287))
|
|
26
|
+
* Rename logically (pull request [#21](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-storage-stub/issues/21)) ([d1a78ad](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-storage-stub/commit/d1a78ad))
|
|
27
|
+
* transient and private data features ([3fa0442](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-storage-stub/commit/3fa0442))
|
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 '@theledger/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,48 +1,80 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
var convector_core_1 = require("@apex-pub/convector-core");
|
|
5
|
+
var fabric_chaincode_utils_1 = require("@theledger/fabric-chaincode-utils");
|
|
6
|
+
fabric_chaincode_utils_1.Transform.isObject = function (data) { return data !== null && typeof data === 'object'; };
|
|
7
|
+
var StubStorage = (function (_super) {
|
|
8
|
+
tslib_1.__extends(StubStorage, _super);
|
|
9
|
+
function StubStorage(stub) {
|
|
10
|
+
var _this = _super.call(this) || this;
|
|
11
|
+
_this.stubHelper = new fabric_chaincode_utils_1.StubHelper(stub);
|
|
12
|
+
return _this;
|
|
12
13
|
}
|
|
13
|
-
query(query, storageOptions) {
|
|
14
|
-
return tslib_1.__awaiter(this, void 0, void 0, function
|
|
15
|
-
return
|
|
14
|
+
StubStorage.prototype.query = function (query, storageOptions) {
|
|
15
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
16
|
+
return tslib_1.__generator(this, function (_a) {
|
|
17
|
+
switch (_a.label) {
|
|
18
|
+
case 0: return [4, this.stubHelper.getQueryResultAsList(query, storageOptions)];
|
|
19
|
+
case 1: return [2, _a.sent()];
|
|
20
|
+
}
|
|
21
|
+
});
|
|
16
22
|
});
|
|
17
|
-
}
|
|
18
|
-
get(id, storageOptions) {
|
|
19
|
-
return tslib_1.__awaiter(this, void 0, void 0, function
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
};
|
|
24
|
+
StubStorage.prototype.get = function (id, storageOptions) {
|
|
25
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
26
|
+
return tslib_1.__generator(this, function (_a) {
|
|
27
|
+
switch (_a.label) {
|
|
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
|
+
});
|
|
22
34
|
});
|
|
23
|
-
}
|
|
24
|
-
set(id, content, storageOptions) {
|
|
25
|
-
return tslib_1.__awaiter(this, void 0, void 0, function
|
|
26
|
-
|
|
27
|
-
|
|
35
|
+
};
|
|
36
|
+
StubStorage.prototype.set = function (id, content, storageOptions) {
|
|
37
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
38
|
+
return tslib_1.__generator(this, function (_a) {
|
|
39
|
+
switch (_a.label) {
|
|
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
|
+
});
|
|
28
46
|
});
|
|
29
|
-
}
|
|
30
|
-
delete(id, storageOptions
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
47
|
+
};
|
|
48
|
+
StubStorage.prototype.delete = function (id, storageOptions) {
|
|
49
|
+
if (storageOptions === void 0) { storageOptions = {}; }
|
|
50
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
51
|
+
return tslib_1.__generator(this, function (_a) {
|
|
52
|
+
switch (_a.label) {
|
|
53
|
+
case 0:
|
|
54
|
+
convector_core_1.InvalidIdError.test(id);
|
|
55
|
+
if (!storageOptions.privateCollection) return [3, 2];
|
|
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
|
+
});
|
|
38
63
|
});
|
|
39
|
-
}
|
|
40
|
-
history(id) {
|
|
41
|
-
return tslib_1.__awaiter(this, void 0, void 0, function
|
|
42
|
-
|
|
43
|
-
|
|
64
|
+
};
|
|
65
|
+
StubStorage.prototype.history = function (id) {
|
|
66
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
67
|
+
return tslib_1.__generator(this, function (_a) {
|
|
68
|
+
switch (_a.label) {
|
|
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
|
+
});
|
|
44
75
|
});
|
|
45
|
-
}
|
|
46
|
-
|
|
76
|
+
};
|
|
77
|
+
return StubStorage;
|
|
78
|
+
}(convector_core_1.BaseStorage));
|
|
47
79
|
exports.StubStorage = StubStorage;
|
|
48
80
|
//# sourceMappingURL=stub-storage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stub-storage.js","sourceRoot":"","sources":["../../src/stub-storage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stub-storage.js","sourceRoot":"","sources":["../../src/stub-storage.ts"],"names":[],"mappings":";;;AAGA,2DAAuE;AACvE,4EAA0E;AAI1E,kCAAS,CAAC,QAAQ,GAAG,UAAA,IAAI,IAAI,OAAA,IAAI,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAzC,CAAyC,CAAC;AAEvE;IAAiC,uCAAW;IAG1C,qBAAY,IAAmB;QAA/B,YACE,iBAAO,SAGR;QADC,KAAI,CAAC,UAAU,GAAG,IAAI,mCAAU,CAAC,IAAI,CAAC,CAAC;;IACzC,CAAC;IAEY,2BAAK,GAAlB,UAAmB,KAAU,EAAE,cAAoB;;;;4BAC1C,WAAM,IAAI,CAAC,UAAU,CAAC,oBAAoB,CAAC,KAAK,EAAE,cAAc,CAAC,EAAA;4BAAxE,WAAO,S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package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apex-pub/convector-storage-stub",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Convector STUB Storage class",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -41,11 +41,24 @@
|
|
|
41
41
|
"docs:serve": "http-server docs"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@apex-pub/convector-core": "1.
|
|
45
|
-
"@apex-pub/fabric-chaincode-utils": "1.
|
|
46
|
-
"@
|
|
44
|
+
"@apex-pub/convector-core": "^1.5.0",
|
|
45
|
+
"@apex-pub/fabric-chaincode-utils": "^5.1.1",
|
|
46
|
+
"@theledger/fabric-shim-crypto-types": "^1.0.5",
|
|
47
|
+
"tslib": "^1.9.0"
|
|
47
48
|
},
|
|
48
49
|
"devDependencies": {
|
|
49
|
-
"@
|
|
50
|
+
"@theledger/fabric-mock-stub": "^5.0.0",
|
|
51
|
+
"@types/glob": "^7.1.1",
|
|
52
|
+
"@types/google-protobuf": "^3.7.3",
|
|
53
|
+
"@types/minimatch": "3.0.3",
|
|
54
|
+
"@types/node": "^13.13.4",
|
|
55
|
+
"http-server": "^0.11.1",
|
|
56
|
+
"mocha": "^5.0.3",
|
|
57
|
+
"npm-scripts-watcher": "^1.0.2",
|
|
58
|
+
"rimraf": "^2.6.2",
|
|
59
|
+
"ts-node": "^6.0.3",
|
|
60
|
+
"tslint": "^5.9.1",
|
|
61
|
+
"typedoc": "^0.11.1",
|
|
62
|
+
"typescript": "2.8.3"
|
|
50
63
|
}
|
|
51
64
|
}
|