New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@theledger/fabric-mock-stub

Package Overview
Dependencies
Maintainers
3
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@theledger/fabric-mock-stub - npm Package Compare versions

Comparing version 3.0.1 to 3.0.2

5

dist/ChaincodeMockStub.d.ts

@@ -149,4 +149,2 @@ /// <reference types="node" />

getStateByRangeWithPagination(startKey: string, endKey: string, pageSize: number, bookmark?: string): Promise<StateQueryResponse<Iterators.StateQueryIterator>>;
getStateByPartialCompositeKeyWithPagination(objectType: string, attributes: string[], pageSize: number, bookmark?: string): Promise<StateQueryResponse<Iterators.StateQueryIterator>>;
getQueryResultWithPagination(query: string, pageSize: number, bookmark?: string): Promise<StateQueryResponse<Iterators.StateQueryIterator>>;
/**

@@ -167,2 +165,3 @@ *

getQueryResult(query: string): Promise<Iterators.StateQueryIterator>;
getQueryResultWithPagination(query: string, pageSize: number, bookmark?: string): Promise<StateQueryResponse<Iterators.StateQueryIterator>>;
/**

@@ -176,2 +175,3 @@ * Retrieve state by partial keys

getStateByPartialCompositeKey(objectType: string, attributes: string[]): Promise<Iterators.StateQueryIterator>;
getStateByPartialCompositeKeyWithPagination(objectType: string, attributes: string[], pageSize: number, bookmark?: string): Promise<StateQueryResponse<Iterators.StateQueryIterator>>;
createCompositeKey(objectType: string, attributes: string[]): string;

@@ -280,2 +280,3 @@ splitCompositeKey(compositeKey: string): SplitCompositekey;

getPrivateDataByPartialCompositeKey(collection: string, objectType: string, attributes: string[]): Promise<Iterators.StateQueryIterator>;
private paginate;
}

77

dist/ChaincodeMockStub.js

@@ -331,11 +331,20 @@ "use strict";

ChaincodeMockStub.prototype.getStateByRangeWithPagination = function (startKey, endKey, pageSize, bookmark) {
throw new Error('Method not implemented.');
return __awaiter(this, void 0, void 0, function () {
var iterator, err_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, 2, , 3]);
return [4 /*yield*/, this.getStateByRange(startKey, endKey)];
case 1:
iterator = _a.sent();
return [2 /*return*/, Promise.resolve(this.paginate(iterator, pageSize, bookmark))];
case 2:
err_1 = _a.sent();
throw err_1;
case 3: return [2 /*return*/];
}
});
});
};
// tslint:disable-next-line:max-line-length
ChaincodeMockStub.prototype.getStateByPartialCompositeKeyWithPagination = function (objectType, attributes, pageSize, bookmark) {
throw new Error('Method not implemented.');
};
ChaincodeMockStub.prototype.getQueryResultWithPagination = function (query, pageSize, bookmark) {
throw new Error('Method not implemented.');
};
/**

@@ -376,2 +385,22 @@ *

};
// tslint:disable-next-line:max-line-length
ChaincodeMockStub.prototype.getQueryResultWithPagination = function (query, pageSize, bookmark) {
return __awaiter(this, void 0, void 0, function () {
var iterator, err_2;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, 2, , 3]);
return [4 /*yield*/, this.getQueryResult(query)];
case 1:
iterator = _a.sent();
return [2 /*return*/, this.paginate(iterator, pageSize, bookmark)];
case 2:
err_2 = _a.sent();
throw err_2;
case 3: return [2 /*return*/];
}
});
});
};
/**

@@ -388,2 +417,22 @@ * Retrieve state by partial keys

};
// tslint:disable-next-line:max-line-length
ChaincodeMockStub.prototype.getStateByPartialCompositeKeyWithPagination = function (objectType, attributes, pageSize, bookmark) {
return __awaiter(this, void 0, void 0, function () {
var iterator, err_3;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, 2, , 3]);
return [4 /*yield*/, this.getStateByPartialCompositeKey(objectType, attributes)];
case 1:
iterator = _a.sent();
return [2 /*return*/, this.paginate(iterator, pageSize, bookmark)];
case 2:
err_3 = _a.sent();
throw err_3;
case 3: return [2 /*return*/];
}
});
});
};
ChaincodeMockStub.prototype.createCompositeKey = function (objectType, attributes) {

@@ -579,2 +628,14 @@ return CompositeKeys_1.CompositeKeys.createCompositeKey(objectType, attributes);

};
ChaincodeMockStub.prototype.paginate = function (iterator, pageSize, bookmark) {
var items = iterator.response.results;
var start = bookmark ? parseInt(bookmark) * pageSize : 0;
var pagedItems = items.slice(start, start + pageSize);
return {
iterator: new MockStateQueryIterator_1.MockStateQueryIterator(pagedItems, this.txID),
metadata: {
fetched_records_count: items.length,
bookmark: "" + ((start / pageSize) + 1)
}
};
};
return ChaincodeMockStub;

@@ -581,0 +642,0 @@ }());

{
"name": "@theledger/fabric-mock-stub",
"version": "3.0.1",
"version": "3.0.2",
"description": "Mock implementation of the hyperledger fabric-shim package for testing",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

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