Comparing version 2.3.5 to 2.4.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const Observable_1 = require("rxjs/Observable"); | ||
var Observable_1 = require("rxjs/Observable"); | ||
require("rxjs/add/observable/fromPromise"); | ||
@@ -9,7 +9,7 @@ require("rxjs/add/observable/of"); | ||
require("rxjs/add/operator/map"); | ||
const axios_1 = require("axios"); | ||
const sources_client_1 = require("./sources-client"); | ||
const locations_client_1 = require("./locations-client"); | ||
const internal_utils_1 = require("../internal-utils"); | ||
class CotClient { | ||
var axios_1 = require("axios"); | ||
var sources_client_1 = require("./sources-client"); | ||
var locations_client_1 = require("./locations-client"); | ||
var internal_utils_1 = require("../internal-utils"); | ||
var CotClient = (function () { | ||
/** | ||
@@ -19,3 +19,3 @@ * Creates a new CotClient | ||
*/ | ||
constructor(host) { | ||
function CotClient(host) { | ||
if (host.endsWith('/')) { | ||
@@ -30,6 +30,6 @@ host = host.substr(0, host.length - 1); | ||
*/ | ||
getTypes() { | ||
let url = this.host + '/types'; | ||
return Observable_1.Observable.fromPromise(axios_1.default.get(url)).map(res => res.data); | ||
} | ||
CotClient.prototype.getTypes = function () { | ||
var url = this.host + '/types'; | ||
return Observable_1.Observable.fromPromise(axios_1.default.get(url)).map(function (res) { return res.data; }); | ||
}; | ||
/** | ||
@@ -40,6 +40,6 @@ * Returns the metadata of a type as a Type object. | ||
*/ | ||
getType(typeId) { | ||
let url = this.host + '/types/' + typeId; | ||
return Observable_1.Observable.fromPromise(axios_1.default.get(url)).map(res => res.data); | ||
} | ||
CotClient.prototype.getType = function (typeId) { | ||
var url = this.host + '/types/' + typeId; | ||
return Observable_1.Observable.fromPromise(axios_1.default.get(url)).map(function (res) { return res.data; }); | ||
}; | ||
/** | ||
@@ -50,6 +50,6 @@ * Returns all sources that belong to a given Type. | ||
*/ | ||
getSourcesOf(typeId) { | ||
let url = this.host + '/types/' + typeId + '/sources'; | ||
return Observable_1.Observable.fromPromise(axios_1.default.get(url)).map(res => res.data); | ||
} | ||
CotClient.prototype.getSourcesOf = function (typeId) { | ||
var url = this.host + '/types/' + typeId + '/sources'; | ||
return Observable_1.Observable.fromPromise(axios_1.default.get(url)).map(function (res) { return res.data; }); | ||
}; | ||
/** | ||
@@ -59,6 +59,6 @@ * Returns all available sources as an array of Source objects | ||
*/ | ||
getSources() { | ||
let url = this.host + '/sources'; | ||
return Observable_1.Observable.fromPromise(axios_1.default.get(url)).map(res => res.data); | ||
} | ||
CotClient.prototype.getSources = function () { | ||
var url = this.host + '/sources'; | ||
return Observable_1.Observable.fromPromise(axios_1.default.get(url)).map(function (res) { return res.data; }); | ||
}; | ||
/** | ||
@@ -69,6 +69,6 @@ * Returns the metadata of a source as a Source object. | ||
*/ | ||
getSource(sourceId) { | ||
let url = this.host + '/sources/' + sourceId; | ||
return Observable_1.Observable.fromPromise(axios_1.default.get(url)).map(res => res.data); | ||
} | ||
CotClient.prototype.getSource = function (sourceId) { | ||
var url = this.host + '/sources/' + sourceId; | ||
return Observable_1.Observable.fromPromise(axios_1.default.get(url)).map(function (res) { return res.data; }); | ||
}; | ||
/** | ||
@@ -81,12 +81,13 @@ * Continuously poll for the latest data of a *Source*, each **period** at a time. | ||
*/ | ||
pollData(sourceId, period, from) { | ||
let query = ''; | ||
CotClient.prototype.pollData = function (sourceId, period, from) { | ||
var _this = this; | ||
var query = ''; | ||
if (from) { | ||
query += '?from=' + from; | ||
} | ||
let url = this.host + '/sources/' + sourceId + '/events' + query; | ||
var url = this.host + '/sources/' + sourceId + '/events' + query; | ||
return internal_utils_1.InternalUtils.getAsTemporalPage(url).delay(period) | ||
.expand(tpage => internal_utils_1.InternalUtils.getAsTemporalPage(this.host + tpage.link.next).delay(period)) | ||
.takeWhile(tpage => !!tpage.link.next); | ||
} | ||
.expand(function (tpage) { return internal_utils_1.InternalUtils.getAsTemporalPage(_this.host + tpage.link.next).delay(period); }) | ||
.takeWhile(function (tpage) { return !!tpage.link.next; }); | ||
}; | ||
/** | ||
@@ -99,9 +100,9 @@ * Return a complete interval TemporalPageData, per TemporalPage | ||
*/ | ||
getDataInterval(sourceId, from, to) { | ||
let query = '?from=' + from + '&to=' + to; | ||
let url = this.host + '/sources/' + sourceId + '/events' + query; | ||
CotClient.prototype.getDataInterval = function (sourceId, from, to) { | ||
var query = '?from=' + from + '&to=' + to; | ||
var url = this.host + '/sources/' + sourceId + '/events' + query; | ||
return internal_utils_1.InternalUtils.getCompleteInterval(url) | ||
.filter(page => Object.keys(page.data).length > 0) | ||
.map(page => page.data); | ||
} | ||
.filter(function (page) { return Object.keys(page.data).length > 0; }) | ||
.map(function (page) { return page.data; }); | ||
}; | ||
/** | ||
@@ -115,12 +116,13 @@ * Continuously poll for data in a location, each **period** at a time. | ||
*/ | ||
pollDataIn(geohash, typeId, period, from) { | ||
let query = ''; | ||
CotClient.prototype.pollDataIn = function (geohash, typeId, period, from) { | ||
var _this = this; | ||
var query = ''; | ||
if (from) { | ||
query += '?from=' + from; | ||
} | ||
let url = this.host + '/locations/' + geohash + '/' + typeId + '/events' + query; | ||
var url = this.host + '/locations/' + geohash + '/' + typeId + '/events' + query; | ||
return internal_utils_1.InternalUtils.getAsTemporalPage(url).delay(period) | ||
.expand(tpage => internal_utils_1.InternalUtils.getAsTemporalPage(this.host + tpage.link.next).delay(period)) | ||
.takeWhile(tpage => !!tpage.link.next); | ||
} | ||
.expand(function (tpage) { return internal_utils_1.InternalUtils.getAsTemporalPage(_this.host + tpage.link.next).delay(period); }) | ||
.takeWhile(function (tpage) { return !!tpage.link.next; }); | ||
}; | ||
/** | ||
@@ -135,9 +137,9 @@ * Return a complete interval TemporalPageData, per TemporalPage, for the | ||
*/ | ||
getDataIntervalIn(geohash, typeId, from, to) { | ||
let query = '?from=' + from + '&to=' + to; | ||
let url = this.host + '/locations/' + geohash + '/' + typeId + '/events' + query; | ||
CotClient.prototype.getDataIntervalIn = function (geohash, typeId, from, to) { | ||
var query = '?from=' + from + '&to=' + to; | ||
var url = this.host + '/locations/' + geohash + '/' + typeId + '/events' + query; | ||
return internal_utils_1.InternalUtils.getCompleteInterval(url) | ||
.filter(page => Object.keys(page.data).length > 0) | ||
.map(page => page.data); | ||
} | ||
.filter(function (page) { return Object.keys(page.data).length > 0; }) | ||
.map(function (page) { return page.data; }); | ||
}; | ||
/* Client creation methods */ | ||
@@ -150,5 +152,9 @@ /** | ||
*/ | ||
createSourcesClient(...sourceIds) { | ||
return new sources_client_1.SourcesClient(this.host, ...sourceIds); | ||
} | ||
CotClient.prototype.createSourcesClient = function () { | ||
var sourceIds = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
sourceIds[_i] = arguments[_i]; | ||
} | ||
return new (sources_client_1.SourcesClient.bind.apply(sources_client_1.SourcesClient, [void 0, this.host].concat(sourceIds)))(); | ||
}; | ||
/** | ||
@@ -160,7 +166,12 @@ * Convenience method to construct a new LocationsClient object, | ||
*/ | ||
createLocationsClient(...geohashes) { | ||
return new locations_client_1.LocationsClient(this.host, ...geohashes); | ||
} | ||
} | ||
CotClient.prototype.createLocationsClient = function () { | ||
var geohashes = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
geohashes[_i] = arguments[_i]; | ||
} | ||
return new (locations_client_1.LocationsClient.bind.apply(locations_client_1.LocationsClient, [void 0, this.host].concat(geohashes)))(); | ||
}; | ||
return CotClient; | ||
}()); | ||
exports.CotClient = CotClient; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY290LWNsaWVudC5qcyIsInNvdXJjZVJvb3QiOiJDOi9Vc2Vycy90ZHVwb250L1dvcmtzcGFjZXMvY290LWxpYi9saWIvIiwic291cmNlcyI6WyJjbGllbnRzL2NvdC1jbGllbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxnREFBNkM7QUFDN0MsMkNBQXlDO0FBQ3pDLGtDQUFnQztBQUNoQyxtQ0FBaUM7QUFDakMsbUNBQWlDO0FBQ2pDLGlDQUErQjtBQUMvQixpQ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3hDLE1BQU0sTUFBSyxrQ0FBZSxZQUFmLGtDQUFlLFdBQUMsSUFBSSxDQUFDLElBQUksU0FBSyxTQUFTLE1BQUU7SUFDeEQsQ0FBQztJQUNMLGdCQUFDO0FBQUQsQ0FBQyxBQXhKRCxJQXdKQztBQXhKWSw4QkFBUyJ9 |
"use strict"; | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const cot_client_1 = require("./cot-client"); | ||
const internal_utils_1 = require("../internal-utils"); | ||
class DebugClient extends cot_client_1.CotClient { | ||
constructor(host) { | ||
super(host); | ||
var cot_client_1 = require("./cot-client"); | ||
var internal_utils_1 = require("../internal-utils"); | ||
var DebugClient = (function (_super) { | ||
__extends(DebugClient, _super); | ||
function DebugClient(host) { | ||
return _super.call(this, host) || this; | ||
} | ||
@@ -14,10 +25,10 @@ /** | ||
*/ | ||
getTemporalPage(sourceId, from) { | ||
let query = ''; | ||
DebugClient.prototype.getTemporalPage = function (sourceId, from) { | ||
var query = ''; | ||
if (from) { | ||
query += '?from=' + from; | ||
} | ||
let url = this.host + '/sources/' + sourceId + '/events' + query; | ||
var url = this.host + '/sources/' + sourceId + '/events' + query; | ||
return internal_utils_1.InternalUtils.getAsTemporalPage(url); | ||
} | ||
}; | ||
/** | ||
@@ -29,10 +40,10 @@ * Returns only a single TemporalPage for the request. | ||
*/ | ||
getTemporalPageIn(geohash, typeId, from) { | ||
let query = ''; | ||
DebugClient.prototype.getTemporalPageIn = function (geohash, typeId, from) { | ||
var query = ''; | ||
if (from) { | ||
query += '?from=' + from; | ||
} | ||
let url = this.host + '/locations/' + geohash + '/' + typeId + '/events' + query; | ||
var url = this.host + '/locations/' + geohash + '/' + typeId + '/events' + query; | ||
return internal_utils_1.InternalUtils.getAsTemporalPage(url); | ||
} | ||
}; | ||
/** | ||
@@ -42,5 +53,5 @@ * Tries to parse a request from a complete url to a TemporalPage | ||
*/ | ||
getTemporalPageForUrl(url) { | ||
DebugClient.prototype.getTemporalPageForUrl = function (url) { | ||
return internal_utils_1.InternalUtils.getAsTemporalPage(url); | ||
} | ||
}; | ||
/** | ||
@@ -50,8 +61,9 @@ * Attches the given link to the host and returns it as a TemporalPage | ||
*/ | ||
getLink(link) { | ||
let url = this.host + link; | ||
DebugClient.prototype.getLink = function (link) { | ||
var url = this.host + link; | ||
return internal_utils_1.InternalUtils.getAsTemporalPage(url); | ||
} | ||
} | ||
}; | ||
return DebugClient; | ||
}(cot_client_1.CotClient)); | ||
exports.DebugClient = DebugClient; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVidWctY2xpZW50LmpzIiwic291cmNlUm9vdCI6IkM6L1VzZXJzL3RkdXBvbnQvV29ya3NwYWNlcy9jb3QtbGliL2xpYi8iLCJzb3VyY2VzIjpbImNsaWVudHMvZGVidWctY2xpZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBRUEsNkNBQXlDO0FBQ3pDLHNEQUE0RDtBQUc1RCxpQkFBeUIsU0FBUSxzQkFBUztJQUV0QyxZQUFZLElBQVk7UUFDcEIsS0FBSyxDQUFDLElBQUksQ0FBQyxDQUFDO0lBQ2hCLENBQUM7SUFFRDs7OztPQUlHO0lBQ0gsZUFBZSxDQUFDLFFBQWdCLEVBQUUsSUFBYTtRQUMzQyxJQUFJLEtBQUssR0FBRyxFQUFFLENBQUM7UUFDZixFQUFFLENBQUMsQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDO1lBQ1AsS0FBSyxJQUFJLFFBQVEsR0FB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csYUFBYSxHQUFHLE9BQU8sR0FBRyxHQUFHLEdBQUMsTUFBTSxHQUFDLFNBQVMsR0FBRyxLQUFLLENBQUM7UUFDN0UsTUFBTSxDQUFDLDhCQUFNLENBQUMsaUJBQWlCLENBQUMsR0FBRyxDQUFDLENBQUM7SUFDekMsQ0FBQztJQUVEOzs7T0FHRztJQUNILDJDQUFxQixHQUFyQixVQUFzQixHQUFXO1FBQzdCLE1BQU0sQ0FBQyw4QkFBTSxDQUFDLGlCQUFpQixDQUFDLEdBQUcsQ0FBQyxDQUFDO0lBQ3pDLENBQUM7SUFFRDs7O09BR0c7SUFDSCw2QkFBTyxHQUFQLFVBQVEsSUFBWTtRQUNoQixJQUFJLEdBQUcsR0FBRyxJQUFJLENBQUMsSUFBSSxHQUFHLElBQUksQ0FBQztRQUMzQixNQUFNLENBQUMsOEJBQU0sQ0FBQyxpQkFBaUIsQ0FBQyxHQUFHLENBQUMsQ0FBQztJQUN6QyxDQUFDO0lBQ0wsa0JBQUM7QUFBRCxDQUFDLEFBbkRELENBQWlDLHNCQUFTLEdBbUR6QztBQW5EWSxrQ0FBVyJ9 |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const Observable_1 = require("rxjs/Observable"); | ||
var Observable_1 = require("rxjs/Observable"); | ||
require("rxjs/add/observable/fromPromise"); | ||
@@ -12,4 +12,4 @@ require("rxjs/add/observable/merge"); | ||
require("rxjs/add/operator/switchMap"); | ||
const internal_utils_1 = require("../internal-utils"); | ||
class LocationsClient { | ||
var internal_utils_1 = require("../internal-utils"); | ||
var LocationsClient = (function () { | ||
/** | ||
@@ -21,3 +21,7 @@ * Creates a new LocationsClient, it holds all the geohashes to fire simeltaneous requests to. | ||
*/ | ||
constructor(host, ...geohashes) { | ||
function LocationsClient(host) { | ||
var geohashes = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
geohashes[_i - 1] = arguments[_i]; | ||
} | ||
this.host = host; | ||
@@ -32,13 +36,14 @@ this.geohashes = geohashes; | ||
*/ | ||
pollData(typeId, period, from) { | ||
let query = ''; | ||
LocationsClient.prototype.pollData = function (typeId, period, from) { | ||
var _this = this; | ||
var query = ''; | ||
if (from) { | ||
query += '?from=' + from; | ||
} | ||
let urls = this.geohashes.map(hash => this.host + '/locations/' + hash + '/' + typeId + '/events' + query); | ||
var urls = this.geohashes.map(function (hash) { return _this.host + '/locations/' + hash + '/' + typeId + '/events' + query; }); | ||
return Observable_1.Observable | ||
.merge(...urls.map(url => internal_utils_1.InternalUtils.getAsTemporalPage(url).delay(period) | ||
.expand(tpage => internal_utils_1.InternalUtils.getAsTemporalPage(this.host + tpage.link.next).delay(period)) | ||
.takeWhile(tpage => !!tpage.link.next))); | ||
} | ||
.merge.apply(Observable_1.Observable, urls.map(function (url) { return internal_utils_1.InternalUtils.getAsTemporalPage(url).delay(period) | ||
.expand(function (tpage) { return internal_utils_1.InternalUtils.getAsTemporalPage(_this.host + tpage.link.next).delay(period); }) | ||
.takeWhile(function (tpage) { return !!tpage.link.next; }); })); | ||
}; | ||
/** | ||
@@ -51,12 +56,13 @@ * Returns data within the assigned areas as a single array of TemporalPageData objects. | ||
*/ | ||
getDataInterval(typeId, from, to) { | ||
let query = '?from=' + from + '&to=' + to; | ||
let urls = this.geohashes.map(hash => this.host + '/locations/' + hash + '/' + typeId + '/events' + query); | ||
LocationsClient.prototype.getDataInterval = function (typeId, from, to) { | ||
var _this = this; | ||
var query = '?from=' + from + '&to=' + to; | ||
var urls = this.geohashes.map(function (hash) { return _this.host + '/locations/' + hash + '/' + typeId + '/events' + query; }); | ||
return Observable_1.Observable | ||
.merge(...urls.map(url => internal_utils_1.InternalUtils.getCompleteInterval(url))) | ||
.filter(page => Object.keys(page.data).length > 0) | ||
.map(page => page.data); | ||
} | ||
} | ||
.merge.apply(Observable_1.Observable, urls.map(function (url) { return internal_utils_1.InternalUtils.getCompleteInterval(url); })).filter(function (page) { return Object.keys(page.data).length > 0; }) | ||
.map(function (page) { return page.data; }); | ||
}; | ||
return LocationsClient; | ||
}()); | ||
exports.LocationsClient = LocationsClient; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9jYXRpb25zLWNsaWVudC5qcyIsInNvdXJjZVJvb3QiOiJDOi9Vc2Vycy90ZHVwb250L1dvcmtzcGFjZXMvY290LWxpYi9saWIvIiwic291cmNlcyI6WyJjbGllbnRzL2xvY2F0aW9ucy1jbGllbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxnREFBNkM7QUFDN0MsMkNBQXlDO0FBQ3pDLHFDQUFtQztBQUNuQyxrQ0FBZ0M7QUFDaEMsbUNBQWlDO0FBQ2pDLG9DQUFrQztBQUNsQyxpQ0FBK0I7QUFDL0Isd0NBQXNDO0FBQ3RDLHVDQUFxQztBQUlyQyxzREFBNEQ7QUFJNUQ7SUFJSTs7Ozs7T0FLRztJQUNILFlBQVksSUFBWSxFQUFFLEdBQUcsU0FBbUI7UUFDNUMsSUFBSSxDQUFDLElBQUksR0FBRyxJQUFJLENBQUM7UUFDakIsSUFBSSxDQUFDLFNBQVMsR0FBRyxTQUFTLENBQUM7SUFDL0IsQ0FBQztJQUVEOzs7OztPQUtHO0lBQ0gsUUFBUSxDQUFDLE1BQWMsRUFBRSxNQUFjLEVBQUUsSUFBYTtRQUNsRCxJQUFJLEtBQUssR0FBRyxFQUFFLENBQUM7UUFDZixFQUFFLENBQUMsQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDO1lBQ1AsS0FBSyxJQUFJLFFBQVEsR0FBRyxJQUFJLENBQUM7UUFDN0IsQ0FBQztRQUNELElBQUksSUFBSSxHQUFHLElBQUksQ0FBQyxTQUFTLENBQUMsR0FBRyxDQUFDLElBQUksSUFBSSxJQUFJLENBQUMsSUFBSSxHQUFHLGFBQWEsR0FBRyxJQUFJLEdBQUcsR0FBRyxHQUFHLE1BQU0sR0FBRyxTQUFTLEdBQUMsS0FBSyxDQUFDLEN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JLElBQUksT0FBQSxLQUFJLENBQUMsSUFBSSxHQUFHLGFBQWEsR0FBRyxJQUFJLEdBQUcsR0FBRyxHQUFHLE1BQU0sR0FBRyxTQUFTLEdBQUcsS0FBSyxFQUFuRSxDQUFtRSxDQUFDLENBQUM7UUFDM0csTUFBTSxDQUFDLHVCQUFVO2FBQ1osS0FBSyxPQURILHVCQUFVLEVBQ0gsSUFBSSxDQUFDLEdBQUcsQ0FBQyxVQUFBLEdBQUcsSUFBSSxPQUFBLDhCQUFNLENBQUMsbUJBQW1CLENBQUMsR0FBRyxDQUFDLEVBQS9CLENBQStCLENBQUMsRUFDekQsTUFBTSxDQUFDLFVBQUEsSUFBSSxJQUFJLE9BQUEsTUFBTSxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLENBQUMsTUFBTSxHQUFHLENBQUMsRUFBakMsQ0FBaUMsQ0FBQzthQUNqRCxHQUFHLENBQUMsVUFBQSxJQUFJLElBQUksT0FBQSxJQUFJLENBQUMsSUFBSSxFQUFULENBQVMsQ0FBQyxDQUFDO0lBQ2hDLENBQUM7SUFFTCxzQkFBQztBQUFELENBQUMsQUFuREQsSUFtREM7QUFuRFksMENBQWUifQ== |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const Observable_1 = require("rxjs/Observable"); | ||
var Observable_1 = require("rxjs/Observable"); | ||
require("rxjs/add/observable/fromPromise"); | ||
@@ -12,4 +12,4 @@ require("rxjs/add/observable/merge"); | ||
require("rxjs/add/operator/switchMap"); | ||
const internal_utils_1 = require("../internal-utils"); | ||
class SourcesClient { | ||
var internal_utils_1 = require("../internal-utils"); | ||
var SourcesClient = (function () { | ||
/** | ||
@@ -21,3 +21,7 @@ * Creates a new SourcesClient, it holds all the sourceIds to fire simeltaneous requests to. | ||
*/ | ||
constructor(host, ...sourceIds) { | ||
function SourcesClient(host) { | ||
var sourceIds = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
sourceIds[_i - 1] = arguments[_i]; | ||
} | ||
this.host = host; | ||
@@ -32,13 +36,14 @@ this.sourceIds = sourceIds; | ||
*/ | ||
pollData(period, from) { | ||
let query = ''; | ||
SourcesClient.prototype.pollData = function (period, from) { | ||
var _this = this; | ||
var query = ''; | ||
if (from) { | ||
query += '?from=' + from; | ||
} | ||
let urls = this.sourceIds.map(id => this.host + '/sources/' + id + '/events' + query); | ||
var urls = this.sourceIds.map(function (id) { return _this.host + '/sources/' + id + '/events' + query; }); | ||
return Observable_1.Observable | ||
.merge(...urls.map(url => internal_utils_1.InternalUtils.getAsTemporalPage(url).delay(period) | ||
.expand(tpage => internal_utils_1.InternalUtils.getAsTemporalPage(this.host + tpage.link.next).delay(period)) | ||
.takeWhile(tpage => !!tpage.link.next))); | ||
} | ||
.merge.apply(Observable_1.Observable, urls.map(function (url) { return internal_utils_1.InternalUtils.getAsTemporalPage(url).delay(period) | ||
.expand(function (tpage) { return internal_utils_1.InternalUtils.getAsTemporalPage(_this.host + tpage.link.next).delay(period); }) | ||
.takeWhile(function (tpage) { return !!tpage.link.next; }); })); | ||
}; | ||
/** | ||
@@ -50,12 +55,13 @@ * Returns data as a single array of TemporalPageData objects. | ||
*/ | ||
getDataInterval(from, to) { | ||
let query = '?from=' + from + '&to=' + to; | ||
let urls = this.sourceIds.map(id => this.host + '/sources/' + id + '/events' + query); | ||
SourcesClient.prototype.getDataInterval = function (from, to) { | ||
var _this = this; | ||
var query = '?from=' + from + '&to=' + to; | ||
var urls = this.sourceIds.map(function (id) { return _this.host + '/sources/' + id + '/events' + query; }); | ||
return Observable_1.Observable | ||
.merge(...urls.map(url => internal_utils_1.InternalUtils.getCompleteInterval(url))) | ||
.filter(page => Object.keys(page.data).length > 0) | ||
.map(page => page.data); | ||
} | ||
} | ||
.merge.apply(Observable_1.Observable, urls.map(function (url) { return internal_utils_1.InternalUtils.getCompleteInterval(url); })).filter(function (page) { return Object.keys(page.data).length > 0; }) | ||
.map(function (page) { return page.data; }); | ||
}; | ||
return SourcesClient; | ||
}()); | ||
exports.SourcesClient = SourcesClient; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic291cmNlcy1jbGllbnQuanMiLCJzb3VyY2VSb290IjoiQzovVXNlcnMvdGR1cG9udC9Xb3Jrc3BhY2VzL2NvdC1saWIvbGliLyIsInNvdXJjZXMiOlsiY2xpZW50cy9zb3VyY2VzLWNsaWVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLGdEQUE2QztBQUM3QywyQ0FBeUM7QUFDekMscUNBQW1DO0FBQ25DLGtDQUFnQztBQUNoQyxtQ0FBaUM7QUFDakMsb0NBQWtDO0FBQ2xDLGlDQUErQjtBQUMvQix3Q0FBc0M7QUFDdEMsdUNBQXFDO0FBSXJDLHNEQUE0RDtBQUk1RDtJQUlJOzs7OztPQUtHO0lBQ0gsWUFBWSxJQUFZLEVBQUUsR0FBRyxTQUFtQjtRQUM1QyxJQUFJLENBQUMsSUFBSSxHQUFHLElBQUksQ0FBQztRQUNqQixJQUFJLENBQUMsU0FBUyxHQUFHLFNBQVMsQ0FBQztJQUMvQixDQUFDO0lBRUQ7Ozs7O09BS0c7SUFDSCxRQUFRLENBQUMsTUFBYyxFQUFFLElBQWE7UUFDbEMsSUFBSSxLQUFLLEdBQUcsRUFBRSxDQUFDO1FBQ2YsRUFBRSxDQUFDLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQztZQUNQLEtBQUssSUFBSSxRQUFRLEdBQUcsSUFBSSxDQUFDO1FBQzdCLENBQUM7UUFDRCxJQUFJLElBQUksR0FBRyxJQUFJLENBQUMsU0FBUyxDQUFDLEdBQUcsQ0FBQyxFQUFFLElBQUksSUFBSSxDQUFDLElBQUksR0FBRyxXQUFXLEdBQUcsRUFBRSxHQUFHLFNBQVMsR0FBRyxLQUFLLENBQUMsQ0FBQztRQUN0RixNQUFNLENBQUMsdUJBQVU7YUFDWixLQUFLLENBQ04sR0FBRyxJ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ElBQUksQ0FBQyxHQUFHLENBQUMsVUFBQSxHQUFHLElBQUksT0FBQSw4QkFBTSxDQUFDLG1CQUFtQixDQUFDLEdBQUcsQ0FBQyxFQUEvQixDQUErQixDQUFDLEVBQ3pELE1BQU0sQ0FBQyxVQUFBLElBQUksSUFBSSxPQUFBLE1BQU0sQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxDQUFDLE1BQU0sR0FBRyxDQUFDLEVBQWpDLENBQWlDLENBQUM7YUFDakQsR0FBRyxDQUFDLFVBQUEsSUFBSSxJQUFJLE9BQUEsSUFBSSxDQUFDLElBQUksRUFBVCxDQUFTLENBQUMsQ0FBQztJQUNoQyxDQUFDO0lBRUwsb0JBQUM7QUFBRCxDQUFDLEFBbERELElBa0RDO0FBbERZLHNDQUFhIn0= |
@@ -1,8 +0,8 @@ | ||
export * from './clients/cot-client'; | ||
export * from './clients/debug-client'; | ||
export * from './clients/sources-client'; | ||
export * from './clients/locations-client'; | ||
export * from './types/source'; | ||
export * from './types/type'; | ||
export * from './types/temporal-page'; | ||
export { CotClient } from './clients/cot-client'; | ||
export { DebugClient } from './clients/debug-client'; | ||
export { SourcesClient } from './clients/sources-client'; | ||
export { LocationsClient } from './clients/locations-client'; | ||
export { Source } from './types/source'; | ||
export { Type } from './types/type'; | ||
export { TemporalPage, TemporalPageData, TemporalPageLink } from './types/temporal-page'; | ||
export { Util } from './util'; |
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./clients/cot-client")); | ||
__export(require("./clients/debug-client")); | ||
__export(require("./clients/sources-client")); | ||
__export(require("./clients/locations-client")); | ||
var cot_client_1 = require("./clients/cot-client"); | ||
exports.CotClient = cot_client_1.CotClient; | ||
var debug_client_1 = require("./clients/debug-client"); | ||
exports.DebugClient = debug_client_1.DebugClient; | ||
var sources_client_1 = require("./clients/sources-client"); | ||
exports.SourcesClient = sources_client_1.SourcesClient; | ||
var locations_client_1 = require("./clients/locations-client"); | ||
exports.LocationsClient = locations_client_1.LocationsClient; | ||
var util_1 = require("./util"); | ||
exports.Util = util_1.Util; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiQzovVXNlcnMvdGR1cG9udC9Xb3Jrc3BhY2VzL2NvdC1saWIvbGliLyIsInNvdXJjZXMiOlsiaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSwwQ0FBcUM7QUFDckMsNENBQXVDO0FBQ3ZDLDhDQUF5QztBQUN6QyxnREFBMkM7QUFJM0MsK0JBQStCO0FBQXRCLHNCQUFBLElBQUksQ0FBQSJ9 | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiQzovVXNlcnMvdGR1cG9udC9Xb3Jrc3BhY2VzL2NvdC1saWIvbGliLyIsInNvdXJjZXMiOlsiaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxtREFBaUQ7QUFBeEMsaUNBQUEsU0FBUyxDQUFBO0FBQ2xCLHVEQUFxRDtBQUE1QyxxQ0FBQSxXQUFXLENBQUE7QUFDcEIsMkRBQXlEO0FBQWhELHlDQUFBLGFBQWEsQ0FBQTtBQUN0QiwrREFBNkQ7QUFBcEQsNkNBQUEsZUFBZSxDQUFBO0FBSXhCLCtCQUE4QjtBQUFyQixzQkFBQSxJQUFJLENBQUEifQ== |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const axios_1 = require("axios"); | ||
const Observable_1 = require("rxjs/Observable"); | ||
var axios_1 = require("axios"); | ||
var Observable_1 = require("rxjs/Observable"); | ||
require("rxjs/add/operator/do"); | ||
require("rxjs/add/operator/expand"); | ||
require("rxjs/add/operator/takeWhile"); | ||
class InternalUtils { | ||
var InternalUtils = (function () { | ||
function InternalUtils() { | ||
} | ||
/** | ||
@@ -15,3 +17,3 @@ * Mapping function that takes a response and maps it to a *TemporalPage*. | ||
*/ | ||
static mapToTemporalPage(response) { | ||
InternalUtils.mapToTemporalPage = function (response) { | ||
if (response.headers.link) { | ||
@@ -26,3 +28,3 @@ return { | ||
} | ||
} | ||
}; | ||
/** | ||
@@ -33,18 +35,18 @@ * Parses the value of the link header, to make a *TemporalPageLink* object of the relevant information in there. | ||
*/ | ||
static parseLinkHeader(value) { | ||
let links = {}; | ||
value.split(',').forEach(line => { | ||
let parts = line.split(';'); | ||
let uri = parts[0].trim().slice(1, -1); | ||
let amount = parts.length; | ||
InternalUtils.parseLinkHeader = function (value) { | ||
var links = {}; | ||
value.split(',').forEach(function (line) { | ||
var parts = line.split(';'); | ||
var uri = parts[0].trim().slice(1, -1); | ||
var amount = parts.length; | ||
if (amount > 1) { | ||
for (let i = 1; i < amount; i++) { | ||
let part = parts[i].split('='); | ||
let key = part[0]; | ||
let value = part[1]; | ||
for (var i = 1; i < amount; i++) { | ||
var part = parts[i].split('='); | ||
var key = part[0]; | ||
var value_1 = part[1]; | ||
if ('rel' === key.trim()) { | ||
links[value.trim().slice(1, -1)] = uri; | ||
links[value_1.trim().slice(1, -1)] = uri; | ||
} | ||
else { | ||
console.log(key.trim() + ' => ' + value.trim()); | ||
console.log(key.trim() + ' => ' + value_1.trim()); | ||
} | ||
@@ -55,3 +57,3 @@ } | ||
return links; | ||
} | ||
}; | ||
/** | ||
@@ -61,5 +63,5 @@ * Perform a GET request to the url and map the result to a TemporalPage object. | ||
*/ | ||
static getAsTemporalPage(url) { | ||
return Observable_1.Observable.fromPromise(axios_1.default.get(url)).map(resp => InternalUtils.mapToTemporalPage(resp)); | ||
} | ||
InternalUtils.getAsTemporalPage = function (url) { | ||
return Observable_1.Observable.fromPromise(axios_1.default.get(url)).map(function (resp) { return InternalUtils.mapToTemporalPage(resp); }); | ||
}; | ||
/** | ||
@@ -70,13 +72,14 @@ * Recursively follows links to get the complete interval as specified in the url | ||
*/ | ||
static getCompleteInterval(url) { | ||
InternalUtils.getCompleteInterval = function (url) { | ||
var _this = this; | ||
if (url.indexOf('from=') < 0 || url.indexOf('to=') < 0) { | ||
throw new Error('The url should contain a from and to query parameter for this method to work.'); | ||
} | ||
let last = ''; | ||
let host = new URL(url).origin; | ||
var last = ''; | ||
var host = new URL(url).origin; | ||
return this.getAsTemporalPage(url) | ||
.do(tpage => last = tpage.link['last']) | ||
.expand(res => this.expandTest(res, host, last)) | ||
.takeWhile(tpage => !!tpage.link['next'] && (tpage.link['self'] !== last)); | ||
} | ||
.do(function (tpage) { return last = tpage.link['last']; }) | ||
.expand(function (res) { return _this.expandTest(res, host, last); }) | ||
.takeWhile(function (tpage) { return !!tpage.link['next'] && (tpage.link['self'] !== last); }); | ||
}; | ||
/** | ||
@@ -87,3 +90,3 @@ * The test that picks how to expand the initial result of a query. | ||
*/ | ||
static expandTest(tpage, host, last) { | ||
InternalUtils.expandTest = function (tpage, host, last) { | ||
if (tpage.link['next'] == last.split('?')[0]) { | ||
@@ -95,5 +98,6 @@ return this.getAsTemporalPage(host + last); | ||
} | ||
} | ||
} | ||
}; | ||
return InternalUtils; | ||
}()); | ||
exports.InternalUtils = InternalUtils; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZXJuYWwtdXRpbHMuanMiLCJzb3VyY2VSb290IjoiQzovVXNlcnMvdGR1cG9udC9Xb3Jrc3BhY2VzL2NvdC1saWIvbGliLyIsInNvdXJjZXMiOlsiaW50ZXJuYWwtdXRpbHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxpQ0FBMEI7QUFFMUIsZ0RBQTZDO0FBQzdDLGdDQUE4QjtBQUM5QixvQ0FBa0M7QUFDbEMsdUNBQXFDO0FBS3JDO0lBQ0k7Ozs7O09BS0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sQ0FBQyxBQXZGRCxJQXVGQztBQXZGWSxzQ0FBYSJ9 |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const ngeohash = require("ngeohash"); | ||
var ngeohash = require("ngeohash"); | ||
/** | ||
* Util class with utility methods. This class is to be used as a static class | ||
*/ | ||
class Util { | ||
var Util = (function () { | ||
function Util() { | ||
} | ||
/** | ||
@@ -18,5 +20,5 @@ * Returns the unix (UTC) timestamp for the given date parameters. The arguments are considered to be in UTC time. | ||
*/ | ||
static timestampOf(year, month, day, hours, minutes, seconds, milliseconds) { | ||
Util.timestampOf = function (year, month, day, hours, minutes, seconds, milliseconds) { | ||
return new Date(year, month + 1, day, hours, minutes, seconds, milliseconds).getTime(); | ||
} | ||
}; | ||
/** | ||
@@ -32,5 +34,5 @@ * This utility method will subscribe to an *Observable\<TemporalPageData>* and | ||
*/ | ||
static collectOne(observable, callback, error) { | ||
let data; | ||
observable.subscribe(next => { | ||
Util.collectOne = function (observable, callback, error) { | ||
var data; | ||
observable.subscribe(function (next) { | ||
if (!data) { | ||
@@ -40,5 +42,6 @@ data = next; | ||
else { | ||
data.values.push(...next.values); | ||
(_a = data.values).push.apply(_a, next.values); | ||
} | ||
}, err => { | ||
var _a; | ||
}, function (err) { | ||
if (error) { | ||
@@ -50,4 +53,4 @@ error(err); | ||
} | ||
}, () => callback(data)); | ||
} | ||
}, function () { return callback(data); }); | ||
}; | ||
/** | ||
@@ -66,6 +69,6 @@ * This utility method will subscribe to an *Observable\<TemporalPageData>* and collect the results | ||
*/ | ||
static collectMany(observable, callback, error) { | ||
let data; | ||
observable.subscribe(next => { | ||
let key = next.name; | ||
Util.collectMany = function (observable, callback, error) { | ||
var data; | ||
observable.subscribe(function (next) { | ||
var key = next.name; | ||
if (!data) { | ||
@@ -75,5 +78,5 @@ data = [next]; | ||
else { | ||
let item = data.find(it => it.name === key); | ||
var item = data.find(function (it) { return it.name === key; }); | ||
if (item) { | ||
item.values.push(...next.values); | ||
(_a = item.values).push.apply(_a, next.values); | ||
} | ||
@@ -84,3 +87,4 @@ else { | ||
} | ||
}, err => { | ||
var _a; | ||
}, function (err) { | ||
if (error) { | ||
@@ -92,4 +96,4 @@ error(err); | ||
} | ||
}, () => callback(data)); | ||
} | ||
}, function () { return callback(data); }); | ||
}; | ||
/* Geohash utils */ | ||
@@ -102,8 +106,8 @@ /** | ||
*/ | ||
static encodeAsGeohash(lat, lng, precision) { | ||
let prec = precision ? precision : 9; | ||
Util.encodeAsGeohash = function (lat, lng, precision) { | ||
var prec = precision ? precision : 9; | ||
prec = Math.max(prec, 6); | ||
prec = Math.min(prec, 9); | ||
return ngeohash.encode(lat, lng, prec); | ||
} | ||
}; | ||
/** | ||
@@ -113,7 +117,8 @@ * Decode a given geohash as a latitude-longitude point. | ||
*/ | ||
static decodeFromGoehash(geohash) { | ||
Util.decodeFromGoehash = function (geohash) { | ||
return ngeohash.decode(geohash); | ||
} | ||
} | ||
}; | ||
return Util; | ||
}()); | ||
exports.Util = Util; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbC5qcyIsInNvdXJjZVJvb3QiOiJDOi9Vc2Vycy90ZHVwb250L1dvcmtzcGFjZXMvY290LWxpYi9saWIvIiwic291cmNlcyI6WyJ1dGlsLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBRUEscUNBQXFDO0FBRXJDOztHQUVHO0FBQ0g7SUFFSTs7Ozs7Ozs7O09BU0c7SUFDSCxNQUFNLENBQUMsV0FBVyxDQUFDLElBQVksRUFBRSxLQUFhLEVBQUUsR0FBWSxFQUFFLEtBQWMsRUFBRSxPQUFnQixFQUFFLE9BQWdCLEVBQUUsWUFBcUI7UUFDbkksTUFBTSxDQUFDLElBQUksSUFBSSxDQUFDLElBQUksRUFBRSxLQUFLLEdBQUcsQ0FBQyxFQUFFLEdBQUcsRUFBRSxLQUFLLEVBQUUsT0FBTyxFQUFFLE9BQU8sRUFBRSxZ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yxJQUFJLENBQUMsR0FBRyxDQUFDLElBQUksRUFBRSxDQUFDLENBQUMsQ0FBQztRQUN6QixNQUFNLENBQUMsUUFBUSxDQUFDLE1BQU0sQ0FBQyxHQUFHLEVBQUUsR0FBRyxFQUFFLElBQUksQ0FBQyxDQUFDO0lBQzNDLENBQUM7SUFFRDs7O09BR0c7SUFDSSxzQkFBaUIsR0FBeEIsVUFBeUIsT0FBZTtRQUNwQyxNQUFNLENBQUMsUUFBUSxDQUFDLE1BQU0sQ0FBQyxPQUFPLENBQUMsQ0FBQztJQUNwQyxDQUFDO0lBRUwsV0FBQztBQUFELENBQUMsQUFuSEQsSUFtSEM7QUFuSFksb0JBQUkifQ== |
{ | ||
"name": "cot-lib", | ||
"version": "2.3.5", | ||
"version": "2.4.0", | ||
"description": "Easily consume the City of Things platform data", | ||
@@ -8,6 +8,4 @@ "main": "dist/index.js", | ||
"scripts": { | ||
"prepublish": "npm run tsc", | ||
"test": "mocha", | ||
"test:cov": "nyc mocha", | ||
"coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov", | ||
"clean": "rimraf dist/*", | ||
"prepublish": "npm run clean && npm run tsc", | ||
"tsc": "tsc" | ||
@@ -28,3 +26,2 @@ }, | ||
"dependencies": { | ||
"@types/node": "^7.0.12", | ||
"axios": "^0.16.0", | ||
@@ -35,8 +32,4 @@ "ngeohash": "^0.6.0", | ||
"devDependencies": { | ||
"@types/mocha": "^2.2.40", | ||
"@types/ngeohash": "^0.6.1", | ||
"@types/node": "^7.0.12", | ||
"codecov": "^2.1.0", | ||
"mocha": "^3.2.0", | ||
"nyc": "^10.2.0", | ||
"ts-node": "^3.0.2", | ||
@@ -43,0 +36,0 @@ "typescript": "^2.2.2" |
{ | ||
"compilerOptions": { | ||
"target": "ES6", | ||
"target": "es5", | ||
"lib": ["es6", "dom"], | ||
"module": "commonjs", | ||
@@ -5,0 +6,0 @@ "noEmitOnError": true, |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
3
4
86263
24
922
1
- Removed@types/node@^7.0.12
- Removed@types/node@7.10.14(transitive)