@apex-pub/convector-adapter-fabric-in-chaincode 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.
|
@@ -1,41 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const convector_core_1 = require("@apex-pub/convector-core");
|
|
6
|
-
class InChaincodeAdapter {
|
|
7
|
-
invoke(controller, name, config = {}, ...args) {
|
|
8
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
9
|
-
return this.rawInvoke(`${controller}_${name}`, config, ...args);
|
|
10
|
-
});
|
|
1
|
+
import { BaseStorage } from '@apex-pub/convector-core';
|
|
2
|
+
export class InChaincodeAdapter {
|
|
3
|
+
async invoke(controller, name, config = {}, ...args) {
|
|
4
|
+
return this.rawInvoke(`${controller}_${name}`, config, ...args);
|
|
11
5
|
}
|
|
12
|
-
rawInvoke(fn, config = {}, ...args) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
6
|
+
async rawInvoke(fn, config = {}, ...args) {
|
|
7
|
+
if (!config.tx) {
|
|
8
|
+
throw new Error('InChaincodeAdapter needs the ChaincodeTx in config');
|
|
9
|
+
}
|
|
10
|
+
if (!config.chaincode) {
|
|
11
|
+
throw new Error('InChaincodeAdapter needs a stub in config');
|
|
12
|
+
}
|
|
13
|
+
const stub = config.tx.stub.getStub();
|
|
14
|
+
let beforeTx = stub.constructor.name === 'ChaincodeMockStub' ? {
|
|
15
|
+
signedProposal: stub.signedProposal,
|
|
16
|
+
txID: stub.txID,
|
|
17
|
+
transientMap: stub.transientMap,
|
|
18
|
+
args: stub.args
|
|
19
|
+
} : {};
|
|
20
|
+
const res = await stub.invokeChaincode(config.chaincode, [fn, ...args], config.channel);
|
|
21
|
+
const storage = BaseStorage.current;
|
|
22
|
+
storage.stubHelper = config.tx.stub;
|
|
23
|
+
Object.assign(stub, beforeTx);
|
|
24
|
+
if (res.status === 500) {
|
|
25
|
+
const rawMessage = res.message.toString();
|
|
26
|
+
throw rawMessage ? JSON.parse(rawMessage) : res;
|
|
27
|
+
}
|
|
28
|
+
const rawResult = res.payload.toString();
|
|
29
|
+
return {
|
|
30
|
+
...res,
|
|
31
|
+
result: rawResult ? JSON.parse(rawResult) : undefined
|
|
32
|
+
};
|
|
38
33
|
}
|
|
39
34
|
}
|
|
40
|
-
exports.InChaincodeAdapter = InChaincodeAdapter;
|
|
41
35
|
//# sourceMappingURL=fabric-in-chaincode.controller-adapter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fabric-in-chaincode.controller-adapter.js","sourceRoot":"","sources":["../../src/fabric-in-chaincode.controller-adapter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fabric-in-chaincode.controller-adapter.js","sourceRoot":"","sources":["../../src/fabric-in-chaincode.controller-adapter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAqB,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAQ1E,MAAM,OAAO,kBAAkB;IAEtB,KAAK,CAAC,MAAM,CAAC,UAAkB,EAAE,IAAY,EAAE,SAAmC,EAAE,EAAE,GAAG,IAAW;QACzG,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,UAAU,IAAI,IAAI,EAAE,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC;IAClE,CAAC;IAEM,KAAK,CAAC,SAAS,CAAC,EAAU,EAAE,SAAmC,EAAE,EAAE,GAAG,IAAW;QACt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AAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS;SACtD,CAAC;IACJ,CAAC;CACF"}
|
package/dist/src/index.js
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./fabric-in-chaincode.controller-adapter"), exports);
|
|
1
|
+
export * from './fabric-in-chaincode.controller-adapter';
|
|
5
2
|
//# sourceMappingURL=index.js.map
|
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,0CAA0C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apex-pub/convector-adapter-fabric-in-chaincode",
|
|
3
|
-
"version": "1.4.1-
|
|
3
|
+
"version": "1.4.1-4-alpha.6064f94c",
|
|
4
4
|
"description": "Controller adapter to inside chaincode transactions to invoke another chaincode",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
"fabric-client": "1.4.20"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@apex-pub/convector-core": "
|
|
49
|
-
"@apex-pub/convector-core-chaincode": "
|
|
50
|
-
"@apex-pub/convector-storage-stub": "
|
|
48
|
+
"@apex-pub/convector-core": "1.4.1-4-alpha.6064f94c",
|
|
49
|
+
"@apex-pub/convector-core-chaincode": "1.4.1-4-alpha.6064f94c",
|
|
50
|
+
"@apex-pub/convector-storage-stub": "1.4.1-4-alpha.6064f94c"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@apex-pub/convector-adapter-mock": "
|
|
53
|
+
"@apex-pub/convector-adapter-mock": "1.4.1-4-alpha.6064f94c"
|
|
54
54
|
}
|
|
55
55
|
}
|