@apex-pub/convector-storage-stub 1.4.1-2.0 → 1.4.1-4-alpha.6064f94c
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 -4
- package/dist/src/index.js.map +1 -1
- package/dist/src/stub-storage.js +23 -38
- package/dist/src/stub-storage.js.map +1 -1
- package/package.json +5 -5
package/dist/src/index.js
CHANGED
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
|
package/dist/src/stub-storage.js
CHANGED
|
@@ -1,48 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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 {
|
|
1
|
+
import { BaseStorage, InvalidIdError } from '@apex-pub/convector-core';
|
|
2
|
+
import { StubHelper, Transform } from '@apex-pub/fabric-chaincode-utils';
|
|
3
|
+
Transform.isObject = data => data !== null && typeof data === 'object';
|
|
4
|
+
export class StubStorage extends BaseStorage {
|
|
9
5
|
constructor(stub) {
|
|
10
6
|
super();
|
|
11
|
-
this.stubHelper = new
|
|
7
|
+
this.stubHelper = new StubHelper(stub);
|
|
12
8
|
}
|
|
13
|
-
query(query, storageOptions) {
|
|
14
|
-
return
|
|
15
|
-
return yield this.stubHelper.getQueryResultAsList(query, storageOptions);
|
|
16
|
-
});
|
|
9
|
+
async query(query, storageOptions) {
|
|
10
|
+
return await this.stubHelper.getQueryResultAsList(query, storageOptions);
|
|
17
11
|
}
|
|
18
|
-
get(id, storageOptions) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return yield this.stubHelper.getStateAsObject(id, storageOptions);
|
|
22
|
-
});
|
|
12
|
+
async get(id, storageOptions) {
|
|
13
|
+
InvalidIdError.test(id);
|
|
14
|
+
return await this.stubHelper.getStateAsObject(id, storageOptions);
|
|
23
15
|
}
|
|
24
|
-
set(id, content, storageOptions) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return yield this.stubHelper.putState(id, JSON.stringify(content), storageOptions);
|
|
28
|
-
});
|
|
16
|
+
async set(id, content, storageOptions) {
|
|
17
|
+
InvalidIdError.test(id);
|
|
18
|
+
return await this.stubHelper.putState(id, JSON.stringify(content), storageOptions);
|
|
29
19
|
}
|
|
30
|
-
delete(id, storageOptions = {}) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return yield this.stubHelper.getStub().deleteState(id);
|
|
38
|
-
});
|
|
20
|
+
async delete(id, storageOptions = {}) {
|
|
21
|
+
InvalidIdError.test(id);
|
|
22
|
+
if (storageOptions.privateCollection) {
|
|
23
|
+
return await this.stubHelper.getStub()
|
|
24
|
+
.deletePrivateData(storageOptions.privateCollection, id);
|
|
25
|
+
}
|
|
26
|
+
return await this.stubHelper.getStub().deleteState(id);
|
|
39
27
|
}
|
|
40
|
-
history(id) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return yield this.stubHelper.getHistoryForKeyAsList(id);
|
|
44
|
-
});
|
|
28
|
+
async history(id) {
|
|
29
|
+
InvalidIdError.test(id);
|
|
30
|
+
return await this.stubHelper.getHistoryForKeyAsList(id);
|
|
45
31
|
}
|
|
46
32
|
}
|
|
47
|
-
exports.StubStorage = StubStorage;
|
|
48
33
|
//# 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,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAIzE,SAAS,CAAC,QAAQ,GAAG,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,CAAC;AAEvE,MAAM,OAAO,WAAY,SAAQ,WAAW;IAG1C,YAAY,IAAmB;QAC7B,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,UAAU,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;IAEM,KAAK,CAAC,KAAK,CAAC,KAAU,EAAE,cAAoB;QACjD,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,oBAAoB,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;IAC3E,CAAC;IAMM,KAAK,CAAC,GAAG,CAAC,EAAU,EAAE,cAAoB;QAC/C,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACxB,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,EAAE,cAAc,CAAC,CAAC;IACpE,CAAC;IAEM,KAAK,CAAC,GAAG,CAAC,EAAU,EAAE,OAAY,EAAE,cAAoB;QAC7D,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACxB,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,cAAc,CAAC,CAAC;IACrF,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,iBAAsB,EAAE;QACtD,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAExB,IAAI,cAAc,CAAC,iBAAiB,EAAE;YACpC,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE;iBACnC,iBAAiB,CAAC,cAAc,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;SAC5D;QAED,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IACzD,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,EAAU;QAC7B,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACxB,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,sBAAsB,CAAC,EAAE,CAAC,CAAC;IAC1D,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apex-pub/convector-storage-stub",
|
|
3
|
-
"version": "1.4.1-
|
|
3
|
+
"version": "1.4.1-4-alpha.6064f94c",
|
|
4
4
|
"description": "Convector STUB Storage class",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
"docs:serve": "http-server docs"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@apex-pub/convector-core": "
|
|
45
|
-
"@apex-pub/fabric-chaincode-utils": "
|
|
46
|
-
"@apex-pub/fabric-shim-crypto-types": "
|
|
44
|
+
"@apex-pub/convector-core": "1.4.1-4-alpha.6064f94c",
|
|
45
|
+
"@apex-pub/fabric-chaincode-utils": "1.4.1-4-alpha.6064f94c",
|
|
46
|
+
"@apex-pub/fabric-shim-crypto-types": "1.4.1-4-alpha.6064f94c"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@apex-pub/fabric-mock-stub": "
|
|
49
|
+
"@apex-pub/fabric-mock-stub": "1.4.1-4-alpha.6064f94c"
|
|
50
50
|
}
|
|
51
51
|
}
|