Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fabric-contract-api

Package Overview
Dependencies
Maintainers
1
Versions
221
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fabric-contract-api - npm Package Compare versions

Comparing version 1.4.0-snapshot.35 to 1.4.0-snapshot.36

lib/annotations/object.js

2

lib/annotations/index.js

@@ -16,2 +16,2 @@ /*

'use strict';
Object.assign(module.exports, require('./transaction'));
Object.assign(module.exports, require('./transaction'), require('./object'));

@@ -44,3 +44,3 @@ /*

utils.appendOrUpdate(transactions, 'transactionId', propertyKey, {
utils.appendOrUpdate(transactions, 'name', propertyKey, {
tag: tag,

@@ -58,3 +58,3 @@ parameters: parameters

utils.appendOrUpdate(transactions, 'transactionId', propertyKey, {
utils.appendOrUpdate(transactions, 'name', propertyKey, {
returns: {

@@ -61,0 +61,0 @@ name: 'success',

@@ -15,3 +15,3 @@ /*

* Overriding of the `beforeTransaction` `afterTransaction` `unknownTransaction` and `createContext` are all optional
* Supplying a namespace within the constructor is also option and will default to ''
* Supplying a name within the constructor is also option and will default to ''
*

@@ -23,11 +23,11 @@ * @memberof fabric-contract-api

/**
* Constructor - supplying a namespace is recommended but is not mandatory.
* Constructor - supplying a name is recommended but is not mandatory.
*
* @param {String} namespace namespace for the logic within this contract
* @param {String} name name for the logic within this contract
*/
constructor(namespace) {
if (namespace && namespace.trim() !== '') {
this.namespace = namespace.trim();
constructor(name) {
if (name && name.trim() !== '') {
this.name = name.trim();
} else {
this.namespace = '';
this.name = '';
}

@@ -92,4 +92,4 @@ }

*/
getNamespace() {
return this.namespace;
getName() {
return this.name;
}

@@ -96,0 +96,0 @@

{
"name": "fabric-contract-api",
"version": "1.4.0-snapshot.35",
"version": "1.4.0-snapshot.36",
"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",

@@ -44,3 +44,3 @@ [![NPM](https://nodei.co/npm/fabric-contract-api.svg?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/fabric-contract-api/)

constructor(){
super('org.mynamespace.updates');
super('UpdateValuesContract');
}

@@ -47,0 +47,0 @@

@@ -46,4 +46,4 @@ "use strict";

const clientIdentity = ctx.clientIdentity;
// test that the namespace returns a string
const ns = this.getNamespace();
// test that the name returns a string
const ns = this.getName();
}

@@ -50,0 +50,0 @@ }

@@ -59,4 +59,4 @@ /*

// test that the namespace returns a string
const ns: string = this.getNamespace();
// test that the name returns a string
const ns: string = this.getName();
}

@@ -63,0 +63,0 @@ }

@@ -69,3 +69,3 @@ /*

const getMetadataStub = sinon.stub(Reflect, 'getMetadata').onFirstCall().returns([{
transactionId: 'someTransaction',
name: 'someTransaction',
tag: ['submitTx'],

@@ -93,7 +93,7 @@ parameters: []

sinon.assert.calledWith(defineMetadataStub, 'fabric:transactions', [{
transactionId: 'someTransaction',
name: 'someTransaction',
tag: ['submitTx'],
parameters: []
}, {
transactionId: 'mockKey',
name: 'mockKey',
tag: ['submitTx'],

@@ -135,3 +135,3 @@ parameters: [

sinon.assert.calledWith(defineMetadataStub, 'fabric:transactions', [{
transactionId: 'mockKey',
name: 'mockKey',
tag: ['submitTx'],

@@ -160,3 +160,3 @@ parameters: []

sinon.assert.calledWith(defineMetadataStub, 'fabric:transactions', [{
transactionId: 'mockKey',
name: 'mockKey',
tag: [],

@@ -179,3 +179,3 @@ parameters: []

const getMetadataStub = sinon.stub(Reflect, 'getMetadata').returns([{
transactionId: 'someTransaction',
name: 'someTransaction',
tag: ['submitTx'],

@@ -192,7 +192,7 @@ parameters: []

sinon.assert.calledWith(defineMetadataStub, 'fabric:transactions', [{
transactionId: 'someTransaction',
name: 'someTransaction',
tag: ['submitTx'],
parameters: []
}, {
transactionId: 'mockKey',
name: 'mockKey',
returns: {

@@ -219,3 +219,3 @@ name: 'success',

sinon.assert.calledWith(defineMetadataStub, 'fabric:transactions', [{
transactionId: 'mockKey',
name: 'mockKey',
returns: {

@@ -222,0 +222,0 @@ name: 'success',

@@ -80,12 +80,12 @@ /*

it ('should create with default namespace', () => {
it ('should create with default name', () => {
const sc0 = new Contract();
expect(sc0.getNamespace()).to.equal('');
expect(sc0.getName()).to.equal('');
// should also create default when the supplied name is empty space
const sc1 = new Contract('');
expect(sc1.getNamespace()).to.equal('');
expect(sc1.getName()).to.equal('');
const sc2 = new Contract(' ');
expect(sc2.getNamespace()).to.equal('');
expect(sc2.getName()).to.equal('');
});

@@ -108,8 +108,8 @@

const sc1 = new Contract('brain.size.planet.smart');
expect(sc1.namespace).to.equal('brain.size.planet.smart');
expect(sc1.getNamespace()).to.equal('brain.size.planet.smart');
expect(sc1.name).to.equal('brain.size.planet.smart');
expect(sc1.getName()).to.equal('brain.size.planet.smart');
const sc2 = new Contract(' somewhat.padded.out ');
expect(sc2.namespace).to.equal('somewhat.padded.out');
expect(sc2.getNamespace()).to.equal('somewhat.padded.out');
expect(sc2.name).to.equal('somewhat.padded.out');
expect(sc2.getName()).to.equal('somewhat.padded.out');
});

@@ -141,5 +141,5 @@

it ('should set the correct namespace', () => {
it ('should set the correct name', () => {
const sc = new SCAlpha();
sc.getNamespace().should.equal('alpha.beta.delta');
sc.getName().should.equal('alpha.beta.delta');
});

@@ -146,0 +146,0 @@

@@ -16,3 +16,3 @@ /*

export class Contract {
constructor(namespace?: string);
constructor(name?: string);

@@ -25,3 +25,3 @@ beforeTransaction(ctx : Context): Promise<void>;

createContext(): Context;
getNamespace(): string;
getName(): string;

@@ -32,2 +32,4 @@ }

export function Returns(returnType?: string): (target: any, propertyKey: string | symbol) => void;
export function Object(type?: string): (target: any) => void;
export function Property(name?: string, type?: string): (target: any, propertyKey: string | symbol) => void;
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc