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

askro

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

askro - npm Package Compare versions

Comparing version 0.1.2 to 0.1.4

README.md

7

lib/config.js

@@ -19,3 +19,4 @@ 'use strict';

* buildSensorMeasurementsParametrizedUrl: (Function|string|_.TemplateExecutor|any),
* userAgent: string
* userAgent: string,
* concurrent: number
* }}

@@ -37,3 +38,5 @@ */

'id=<%= sensorId %>&terr_id=<%= territoryId %>&from=<%= startDate %>&to=<%= endDate %>&detail=<%= threshold %>'),
userAgent: 'OpenData Node.js Robot'
userAgent: 'OpenData Node.js Robot',
// how much connection launch in parallel
concurrent: 4
};

@@ -125,5 +125,5 @@ 'use strict';

if (_.isUndefined(territories) ||
_.isUndefined(sensors) ||
_.isUndefined(objectsList) ||
_.isUndefined(helpContents)) {
_.isUndefined(sensors) ||
_.isUndefined(objectsList) ||
_.isUndefined(helpContents)) {

@@ -186,2 +186,5 @@ throw new Error('Malformed data');

// run promises in series, but work with result as with a parallel. Something like Async.mapSeries
var current = Promise.resolve();
return promise.

@@ -191,3 +194,8 @@ then(function () {

all(_.map(this.territories, function startToFetchDataForTerritory(territory) {
return territory.fetchSeriesOfMeasurements(timeInterval, endDate);
current = current.
then(function launchTerritoryDataLoad() {
return territory.fetchSeriesOfMeasurements(timeInterval, endDate);
});
return current;
}));

@@ -194,0 +202,0 @@ }.bind(this)).

@@ -77,4 +77,4 @@ 'use strict';

if (endDate && timeInterval) {
startDate = _.isDate(timeInterval) ? timeInterval.getTime() / 1000 : timeInterval;
endDate = _.isDate(endDate) ? endDate.getTime() / 1000 : endDate;
startDate = _.isDate(timeInterval) ? this.__prepareTime(timeInterval.getTime()) : timeInterval;
endDate = _.isDate(endDate) ? this.__prepareTime(endDate.getTime()) : endDate;

@@ -91,3 +91,3 @@ // just to be more concise

// service won't send you hourly data
if (timeDiff >= config.FIVE_DAYS_IN_MILLISECONDS / 1000) {
if (timeDiff >= this.__prepareTime(config.FIVE_DAYS_IN_MILLISECONDS)) {
threshold = 'd';

@@ -97,3 +97,3 @@ }

// service won't send you daily data
if (timeDiff >= config.NINETY_DAYS_IN_MILLISECONDS / 1000) {
if (timeDiff >= this.__prepareTime(config.NINETY_DAYS_IN_MILLISECONDS)) {
threshold = 'm';

@@ -263,2 +263,12 @@ }

return true;
},
/**
* Divide Unix epoch milliseconds by 1000 - required by data provider
* @param {number} time Milliseconds from Unix epoch start
* @return {number}
* @private
*/
__prepareTime: function (time) {
return time / 1000;
}

@@ -265,0 +275,0 @@ };

'use strict';
var _ = require('lodash');
var Promise = require('bluebird');
var Sensor = require('./sensor');
var config = require('./config');
var ValidationError = require('./errors').ValidationError;
var Promise = require('bluebird');
/**

@@ -71,6 +70,25 @@ * @class

fetchSeriesOfMeasurements: function (timeInterval, endDate) {
var queued = [];
var parallel = config.concurrent;
// Control concurrency level. Borrowed from http://promise-nuggets.github.io/articles/16-map-limit.html
var sensorMeasurementsPromises = _.map(this.sensors, function startToFetchDataForSensor(sensor) {
// How many items must download before fetching the next?
// The queued, minus those running in parallel, plus one of
// the parallel slots.
var mustComplete = Math.max(0, queued.length - parallel + 1);
// when enough items are complete, queue another request for an item
var download = Promise.some(queued, mustComplete).
then(function launchSensorDataLoad() {
return sensor.fetchSeriesOfMeasurements(timeInterval, endDate);
});
queued.push(download);
return download;
});
// synonym to Async.mapSeries
return Promise.
all(_.map(this.sensors, function startToFetchDataForSensor(sensor) {
return sensor.fetchSeriesOfMeasurements(timeInterval, endDate);
})).
all(sensorMeasurementsPromises).
then(function () {

@@ -77,0 +95,0 @@ return this;

{
"name": "askro",
"version": "0.1.2",
"description": "Automate scraping RosAtom radiation level statistics",
"version": "0.1.4",
"description": "This tool allow you to parse, collect and traverse through the radiation monitoring data provided by ROSATOM SARMS(Sectoral Automated Radiation Monitoring System).",
"main": "index.js",

@@ -6,0 +6,0 @@ "scripts": {

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