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

@requestnetwork/data-access

Package Overview
Dependencies
Maintainers
4
Versions
697
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@requestnetwork/data-access - npm Package Compare versions

Comparing version 0.8.1-next.1217 to 0.8.1-next.1218

dist/ignored-location.d.ts

12

dist/data-access.d.ts
import { DataAccessTypes, LogTypes, StorageTypes } from '@requestnetwork/types';
import IgnoredLocationIndex from './ignored-location';
/**

@@ -19,2 +20,6 @@ * Options for the DataAccess initialization

synchronizationIntervalTime?: number;
/**
* Index of the ignored location with the reason
*/
ignoredLocationIndex?: IgnoredLocationIndex;
}

@@ -28,2 +33,3 @@ /**

private storage;
private ignoredLocationIndex;
private synchronizationTimer;

@@ -101,2 +107,8 @@ private lastSyncStorageTimestamp;

/**
* Gets information of the data indexed
*
* @param detailed if true get the list of the files hashes
*/
_getStatus(detailed?: boolean): Promise<any>;
/**
* Check the format of the data, extract the topics from it and push location indexed with the topics

@@ -103,0 +115,0 @@ *

@@ -18,2 +18,3 @@ "use strict";

const block_1 = require("./block");
const ignored_location_1 = require("./ignored-location");
const interval_timer_1 = require("./interval-timer");

@@ -37,2 +38,3 @@ const transaction_index_1 = require("./transaction-index");

const defaultOptions = {
ignoredLocationIndex: new ignored_location_1.default(),
logger: new utils_1.default.SimpleLogger(),

@@ -47,2 +49,3 @@ synchronizationIntervalTime: DEFAULT_INTERVAL_TIME,

this.transactionIndex = options.transactionIndex;
this.ignoredLocationIndex = options.ignoredLocationIndex;
this.logger = options.logger;

@@ -301,2 +304,31 @@ }

/**
* Gets information of the data indexed
*
* @param detailed if true get the list of the files hashes
*/
_getStatus(detailed = false) {
return __awaiter(this, void 0, void 0, function* () {
this.checkInitialized();
// last transaction timestamp retrieved
const lastLocationTimestamp = yield this.transactionIndex.getLastTransactionTimestamp();
const listIndexedLocation = yield this.transactionIndex.getIndexedLocations();
const listIgnoredLocationIndex = yield this.ignoredLocationIndex.getIgnoredLocations();
const synchronizationConfig = this.synchronizationTimer.getConfig();
return {
filesIgnored: {
count: Object.keys(listIgnoredLocationIndex).length,
list: detailed ? listIgnoredLocationIndex : undefined,
},
filesRetrieved: {
count: listIndexedLocation.length,
lastTimestamp: lastLocationTimestamp,
list: detailed ? listIndexedLocation : undefined,
},
lastSynchronizationTimestamp: this.lastSyncStorageTimestamp,
storage: yield this.storage._getStatus(detailed),
synchronizationConfig,
};
});
}
/**
* Check the format of the data, extract the topics from it and push location indexed with the topics

@@ -329,2 +361,4 @@ *

parsingErrorCount++;
// Index ignored Location
yield this.ignoredLocationIndex.pushReasonByLocation(entry.id, e.message);
this.logger.debug(`Error: can't parse content of the dataId (${entry.id}): ${e}`, [

@@ -331,0 +365,0 @@ 'synchronization',

@@ -29,3 +29,9 @@ import { LogTypes } from '@requestnetwork/types';

stop(): any;
/**
* Gets current configuration
*
* @return the current configuration attributes
*/
getConfig(): any;
}
//# sourceMappingURL=interval-timer.d.ts.map

@@ -77,4 +77,15 @@ "use strict";

}
/**
* Gets current configuration
*
* @return the current configuration attributes
*/
getConfig() {
return {
intervalTime: this.intervalTime,
successiveFailureThreshold: this.successiveFailureThreshold,
};
}
}
exports.default = IntervalTimer;
//# sourceMappingURL=interval-timer.js.map

14

dist/transaction-index/transaction-index.d.ts

@@ -9,5 +9,6 @@ import { DataAccessTypes } from '@requestnetwork/types';

private timestampByLocation;
private indexedLocation;
/**
* Constructor of TransactionIndex
* @param store a Keyv store to persist the index to
* @param store a Keyv store to persist the index
*/

@@ -62,3 +63,14 @@ constructor(store?: Keyv.Store<any>);

getChannelIdsForMultipleTopics(topics: string[], timestampBoundaries?: DataAccessTypes.ITimestampBoundaries | undefined): Promise<string[]>;
/**
* the list of indexed locations
*/
getIndexedLocations(): Promise<string[]>;
/**
* Update the list of data ids stored
*
* @param dataId data id to add to the list
* @returns
*/
private updateIndexedLocation;
}
//# sourceMappingURL=transaction-index.d.ts.map

@@ -13,2 +13,3 @@ "use strict";

const Bluebird = require("bluebird");
const Keyv = require("keyv");
const location_by_topic_1 = require("./location-by-topic");

@@ -22,3 +23,3 @@ const timestamp_by_location_1 = require("./timestamp-by-location");

* Constructor of TransactionIndex
* @param store a Keyv store to persist the index to
* @param store a Keyv store to persist the index
*/

@@ -28,2 +29,6 @@ constructor(store) {

this.locationByTopic = new location_by_topic_1.default(store);
this.indexedLocation = new Keyv({
namespace: 'indexedLocation',
store,
});
}

@@ -56,2 +61,3 @@ // tslint:disable-next-line: no-empty

yield this.timestampByLocation.pushTimestampByLocation(dataId, timestamp);
yield this.updateIndexedLocation(dataId);
});

@@ -180,4 +186,32 @@ }

}
/**
* the list of indexed locations
*/
getIndexedLocations() {
return __awaiter(this, void 0, void 0, function* () {
const listDataIds = yield this.indexedLocation.get('list');
return listDataIds || [];
});
}
/**
* Update the list of data ids stored
*
* @param dataId data id to add to the list
* @returns
*/
updateIndexedLocation(dataId) {
return __awaiter(this, void 0, void 0, function* () {
let listDataIds = yield this.indexedLocation.get('list');
if (!listDataIds) {
listDataIds = [];
}
// push it if not already done
if (!listDataIds.includes(dataId)) {
listDataIds.push(dataId);
yield this.indexedLocation.set('list', listDataIds);
}
});
}
}
exports.default = TransactionIndex;
//# sourceMappingURL=transaction-index.js.map

10

package.json
{
"name": "@requestnetwork/data-access",
"version": "0.8.1-next.1217+2927625e",
"version": "0.8.1-next.1218+1d9c239f",
"publishConfig": {

@@ -43,5 +43,5 @@ "access": "public"

"dependencies": {
"@requestnetwork/multi-format": "0.2.8-next.1217+2927625e",
"@requestnetwork/types": "0.14.1-next.1217+2927625e",
"@requestnetwork/utils": "0.13.1-next.1217+2927625e",
"@requestnetwork/multi-format": "0.2.8-next.1218+1d9c239f",
"@requestnetwork/types": "0.14.1-next.1218+1d9c239f",
"@requestnetwork/utils": "0.13.1-next.1218+1d9c239f",
"bluebird": "3.5.5",

@@ -81,3 +81,3 @@ "keyv": "3.1.0"

},
"gitHead": "2927625ecf8e5b1667b1720a0555a51fef1242fd"
"gitHead": "1d9c239f5de5143cd54c3470b42786eff17748f6"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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