fabric-contract-api
Advanced tools
Comparing version 1.4.0-snapshot.26 to 1.4.0-snapshot.27
@@ -16,22 +16,23 @@ /* | ||
const description = ''; | ||
const contextType = target.createContext().constructor; | ||
const paramTypes = Reflect.getMetadata('design:paramtypes', target, propertyKey) || []; | ||
const parameters = paramTypes.map((paramType, paramIdx) => { | ||
let numRemoved = 0; | ||
const parameters = paramTypes.filter((paramType, paramIdx) => { | ||
const filter = paramType === contextType; | ||
if (filter) { | ||
paramNames.splice(paramIdx - numRemoved++, 1); | ||
} | ||
return !filter; | ||
}).map((paramType, paramIdx) => { | ||
const paramName = paramNames[paramIdx]; | ||
if (typeof paramType === 'function') { | ||
return { | ||
name: paramName, | ||
description, | ||
schema: { | ||
type: paramType.name.toLowerCase() | ||
} | ||
}; | ||
} else { | ||
return { | ||
name: paramName, | ||
description, | ||
schema: { | ||
type: paramType.toString().toLowerCase() | ||
} | ||
}; | ||
} | ||
return { | ||
name: paramName, | ||
description, | ||
schema: { | ||
type: typeof paramType === 'function' ? paramType.name.toLowerCase() : paramType.toString().toLowerCase() | ||
} | ||
}; | ||
}); | ||
@@ -38,0 +39,0 @@ |
{ | ||
"name": "fabric-contract-api", | ||
"version": "1.4.0-snapshot.26", | ||
"version": "1.4.0-snapshot.27", | ||
"tag":"unstable", | ||
@@ -5,0 +5,0 @@ "description": "A node.js implementation of Hyperledger Fabric chaincode shim, to allow endorsing peers and user-provided chaincodes to communicate with each other", |
@@ -24,7 +24,13 @@ /* | ||
const utils = require('../../../lib/annotations/utils'); | ||
const Context = require('../../../lib/context'); | ||
require('reflect-metadata'); | ||
describe('Transaction.js', () => { | ||
class MockContext extends Context {} | ||
const mockTarget = { | ||
mockKey: 'something' | ||
mockKey: 'something', | ||
createContext() { | ||
return new MockContext(); | ||
} | ||
}; | ||
@@ -68,8 +74,11 @@ | ||
}]).onSecondCall().returns([ | ||
MockContext, | ||
mockFunc, | ||
'someType' | ||
MockContext, | ||
'someType', | ||
MockContext, | ||
]); | ||
TransactionAnnotations.__set__('getParams', () => { | ||
return ['param1', 'param2']; | ||
return ['ctx', 'param1', 'ctx2', 'param2', 'ctx3']; | ||
}); | ||
@@ -76,0 +85,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
37248
830