@apex-pub/convector-adapter-fabric-in-chaincode 1.4.1-4-alpha.8d3ff686 → 1.4.1-4-alpha.4ece38f3

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,35 +1,41 @@
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);
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
+ });
5
11
  }
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
- };
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
+ });
33
38
  }
34
39
  }
40
+ exports.InChaincodeAdapter = InChaincodeAdapter;
35
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":"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;QACtF,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE;YACd,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;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}
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,CAAC,2CAA2C,CAAC,CAAC;aAC9D;YAED,MAAM,IAAI,GAAG,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAEtC,IAAI,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,KAAK,mBAAmB,CAAC,CAAC,CAAC;gBAC7D,cAAc,EAAG,IAAY,CAAC,cAAc;gBAC5C,IAAI,EAAG,IAAY,CAAC,IAAI;gBACxB,YAAY,EAAG,IAAY,CAAC,YAAY;gBACxC,IAAI,EAAG,IAAY,CAAC,IAAI;aACzB,CAAC,CAAC,CAAC,EAAE,CAAC;YACP,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;YACxF,MAAM,OAAO,GAAG,4BAAW,CAAC,OAAsB,CAAC;YAInD,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC;YACpC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;YAE9B,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE;gBACtB,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;gBAC1C,MAAM,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;aACjD;YAED,MAAM,SAAS,GAAG,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;YAEzC,uCACK,GAAG,KACN,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,IACrD;QACJ,CAAC;KAAA;CACF;AA3CD,gDA2CC"}
package/dist/src/index.js CHANGED
@@ -1,2 +1,5 @@
1
- export * from './fabric-in-chaincode.controller-adapter';
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);
2
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0CAA0C,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,mFAAyD"}
package/package.json CHANGED
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "name": "@apex-pub/convector-adapter-fabric-in-chaincode",
3
- "version": "1.4.1-4-alpha.8d3ff686",
3
+ "version": "1.4.1-4-alpha.4ece38f3",
4
4
  "description": "Controller adapter to inside chaincode transactions to invoke another chaincode",
5
5
  "license": "Apache-2.0",
6
- "type": "module",
7
6
  "repository": {
8
7
  "type": "git",
9
8
  "url": "https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-adapter-fabric"
@@ -46,11 +45,11 @@
46
45
  "fabric-client": "1.4.20"
47
46
  },
48
47
  "dependencies": {
49
- "@apex-pub/convector-core": "1.4.1-4-alpha.8d3ff686",
50
- "@apex-pub/convector-core-chaincode": "1.4.1-4-alpha.8d3ff686",
51
- "@apex-pub/convector-storage-stub": "1.4.1-4-alpha.8d3ff686"
48
+ "@apex-pub/convector-core": "1.4.1-4-alpha.4ece38f3",
49
+ "@apex-pub/convector-core-chaincode": "1.4.1-4-alpha.4ece38f3",
50
+ "@apex-pub/convector-storage-stub": "1.4.1-4-alpha.4ece38f3"
52
51
  },
53
52
  "devDependencies": {
54
- "@apex-pub/convector-adapter-mock": "1.4.1-4-alpha.8d3ff686"
53
+ "@apex-pub/convector-adapter-mock": "1.4.1-4-alpha.4ece38f3"
55
54
  }
56
55
  }