@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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
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);
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
- 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 });
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":";;;;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,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;aACvE;YAED,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;gBACrB,MAAM,IAAI,KAAK,C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C,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAE9B,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE;YACtB,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;YAC1C,MAAM,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;SACjD;QAED,MAAM,SAAS,GAAG,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;QAEzC,OAAO;YACL,GAAG,GAAG;YACN,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,IAAI,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
- "use strict";
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
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,mFAAyD"}
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-2.0",
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": "^1.4.1-2.0",
49
- "@apex-pub/convector-core-chaincode": "^1.4.1-2.0",
50
- "@apex-pub/convector-storage-stub": "^1.4.1-2.0"
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": "^1.4.1-2.0"
53
+ "@apex-pub/convector-adapter-mock": "1.4.1-4-alpha.6064f94c"
54
54
  }
55
55
  }