@apex-pub/convector-adapter-fabric-in-chaincode 1.4.0 → 1.4.1-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.
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { ChaincodeTx } from '@apex-pub/convector-core-chaincode';
|
|
3
2
|
import { ControllerAdapter } from '@apex-pub/convector-core';
|
|
4
3
|
export interface InChaincodeAdapterConfig {
|
|
@@ -11,12 +10,12 @@ export declare class InChaincodeAdapter implements ControllerAdapter {
|
|
|
11
10
|
result: any;
|
|
12
11
|
status: number;
|
|
13
12
|
message: string;
|
|
14
|
-
payload:
|
|
13
|
+
payload: Uint8Array;
|
|
15
14
|
}>;
|
|
16
15
|
rawInvoke(fn: string, config?: InChaincodeAdapterConfig, ...args: any[]): Promise<{
|
|
17
16
|
result: any;
|
|
18
17
|
status: number;
|
|
19
18
|
message: string;
|
|
20
|
-
payload:
|
|
19
|
+
payload: Uint8Array;
|
|
21
20
|
}>;
|
|
22
21
|
}
|
|
@@ -1,63 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var args = [];
|
|
11
|
-
for (var _i = 3; _i < arguments.length; _i++) {
|
|
12
|
-
args[_i - 3] = arguments[_i];
|
|
13
|
-
}
|
|
14
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
15
|
-
return tslib_1.__generator(this, function (_a) {
|
|
16
|
-
return [2, this.rawInvoke.apply(this, [controller + "_" + name, config].concat(args))];
|
|
17
|
-
});
|
|
3
|
+
exports.InChaincodeAdapter = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
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);
|
|
18
10
|
});
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
case 1:
|
|
46
|
-
res = _a.sent();
|
|
47
|
-
storage = convector_core_1.BaseStorage.current;
|
|
48
|
-
storage.stubHelper = config.tx.stub;
|
|
49
|
-
Object.assign(stub, beforeTx);
|
|
50
|
-
if (res.status === 500) {
|
|
51
|
-
rawMessage = res.message.toString();
|
|
52
|
-
throw rawMessage ? JSON.parse(rawMessage) : res;
|
|
53
|
-
}
|
|
54
|
-
rawResult = res.payload.toString('utf8');
|
|
55
|
-
return [2, tslib_1.__assign({}, res, { result: rawResult ? JSON.parse(rawResult) : undefined })];
|
|
56
|
-
}
|
|
57
|
-
});
|
|
11
|
+
}
|
|
12
|
+
rawInvoke(fn, config = {}, ...args) {
|
|
13
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
14
|
+
if (!config.tx) {
|
|
15
|
+
throw new Error('InChaincodeAdapter needs the ChaincodeTx in config');
|
|
16
|
+
}
|
|
17
|
+
if (!config.chaincode) {
|
|
18
|
+
throw new Error('InChaincodeAdapter needs a stub in config');
|
|
19
|
+
}
|
|
20
|
+
const stub = config.tx.stub.getStub();
|
|
21
|
+
let beforeTx = stub.constructor.name === 'ChaincodeMockStub' ? {
|
|
22
|
+
signedProposal: stub.signedProposal,
|
|
23
|
+
txID: stub.txID,
|
|
24
|
+
transientMap: stub.transientMap,
|
|
25
|
+
args: stub.args
|
|
26
|
+
} : {};
|
|
27
|
+
const res = yield stub.invokeChaincode(config.chaincode, [fn, ...args], config.channel);
|
|
28
|
+
const storage = convector_core_1.BaseStorage.current;
|
|
29
|
+
storage.stubHelper = config.tx.stub;
|
|
30
|
+
Object.assign(stub, beforeTx);
|
|
31
|
+
if (res.status === 500) {
|
|
32
|
+
const rawMessage = res.message.toString();
|
|
33
|
+
throw rawMessage ? JSON.parse(rawMessage) : res;
|
|
34
|
+
}
|
|
35
|
+
const rawResult = res.payload.toString();
|
|
36
|
+
return Object.assign(Object.assign({}, res), { result: rawResult ? JSON.parse(rawResult) : undefined });
|
|
58
37
|
});
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
}());
|
|
38
|
+
}
|
|
39
|
+
}
|
|
62
40
|
exports.InChaincodeAdapter = InChaincodeAdapter;
|
|
63
41
|
//# 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,6DAA0E;AAQ1E,MAAa,kBAAkB;IAEhB,MAAM,CAAC,UAAkB,EAAE,IAAY,EAAE,SAAmC,EAAE,EAAE,GAAG,IAAW;;YACzG,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,UAAU,IAAI,IAAI,EAAE,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC;QAClE,CAAC;KAAA;IAEY,SAAS,CAAC,EAAU,EAAE,SAAmC,EAAE,EAAE,GAAG,IAAW;;YACtF,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE;gBACd,MA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CAAC,SAAS,IACrD;QACJ,CAAC;KAAA;CACF;AA3CD,gDA2CC"}
|
package/dist/src/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./fabric-in-chaincode.controller-adapter"), exports);
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apex-pub/convector-adapter-fabric-in-chaincode",
|
|
3
|
-
"version": "1.4.0",
|
|
3
|
+
"version": "1.4.1-0",
|
|
4
4
|
"description": "Controller adapter to inside chaincode transactions to invoke another chaincode",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -41,24 +41,15 @@
|
|
|
41
41
|
"docs:serve": "http-server docs"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"fabric-ca-client": "
|
|
45
|
-
"fabric-client": "
|
|
44
|
+
"fabric-ca-client": "1.4.20",
|
|
45
|
+
"fabric-client": "1.4.20"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@apex-pub/convector-core": "^1.4.0",
|
|
49
|
-
"@apex-pub/convector-core-chaincode": "^1.4.0",
|
|
50
|
-
"@apex-pub/convector-storage-stub": "^1.4.0"
|
|
51
|
-
"tslib": "^1.9.0"
|
|
48
|
+
"@apex-pub/convector-core": "^1.4.1-0",
|
|
49
|
+
"@apex-pub/convector-core-chaincode": "^1.4.1-0",
|
|
50
|
+
"@apex-pub/convector-storage-stub": "^1.4.1-0"
|
|
52
51
|
},
|
|
53
52
|
"devDependencies": {
|
|
54
|
-
"@apex-pub/convector-adapter-mock": "^1.4.0"
|
|
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"
|
|
53
|
+
"@apex-pub/convector-adapter-mock": "^1.4.1-0"
|
|
63
54
|
}
|
|
64
55
|
}
|