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

tfl-api-wrapper

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tfl-api-wrapper - npm Package Compare versions

Comparing version 1.4.1 to 1.5.1

24

dist/index.js

@@ -1,23 +0,23 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
exports.TrackerNet = exports.StopPoint = exports.Road = exports.Occupancy = exports.Mode = exports.Line = exports.Disruptions = exports.Crowding = exports.BikePoint = exports.AirQuality = void 0;
var airQuality_1 = require("./lib/airQuality");
var airQuality_1 = require('./lib/airQuality');
exports.AirQuality = airQuality_1.default;
var bikePoint_1 = require("./lib/bikePoint");
var bikePoint_1 = require('./lib/bikePoint');
exports.BikePoint = bikePoint_1.default;
var crowding_1 = require("./lib/crowding");
var crowding_1 = require('./lib/crowding');
exports.Crowding = crowding_1.default;
var disruptions_1 = require("./lib/disruptions");
var disruptions_1 = require('./lib/disruptions');
exports.Disruptions = disruptions_1.default;
var line_1 = require("./lib/line");
var line_1 = require('./lib/line');
exports.Line = line_1.default;
var mode_1 = require("./lib/mode");
var mode_1 = require('./lib/mode');
exports.Mode = mode_1.default;
var occupancy_1 = require("./lib/occupancy");
var occupancy_1 = require('./lib/occupancy');
exports.Occupancy = occupancy_1.default;
var road_1 = require("./lib/road");
var road_1 = require('./lib/road');
exports.Road = road_1.default;
var stopPoint_1 = require("./lib/stopPoint");
var stopPoint_1 = require('./lib/stopPoint');
exports.StopPoint = stopPoint_1.default;
var trackerNet_1 = require("./lib/trackerNet");
var trackerNet_1 = require('./lib/trackerNet');
exports.TrackerNet = trackerNet_1.default;

@@ -1,19 +0,28 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var tfl_1 = require("./tfl");
'use strict';
var __extends =
(this && this.__extends) ||
(function () {
var extendStatics = function (d, b) {
extendStatics =
Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array &&
function (d, b) {
d.__proto__ = b;
}) ||
function (d, b) {
for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
};
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== 'function' && b !== null) throw new TypeError('Class extends value ' + String(b) + ' is not a constructor or null');
extendStatics(d, b);
function __() {
this.constructor = d;
}
d.prototype = b === null ? Object.create(b) : ((__.prototype = b.prototype), new __());
};
})();
Object.defineProperty(exports, '__esModule', { value: true });
var tfl_1 = require('./tfl');
var Line = /** @class */ (function (_super) {

@@ -29,6 +38,6 @@ __extends(Line, _super);

Line.prototype.getAll = function (year) {
return this.sendRequest("/AccidentStats/" + year, {}, 'GET');
return this.sendRequest('/AccidentStats/' + year, {}, 'GET');
};
return Line;
}(tfl_1.default));
})(tfl_1.default);
exports.default = Line;

@@ -1,19 +0,28 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var tfl_1 = require("./tfl");
'use strict';
var __extends =
(this && this.__extends) ||
(function () {
var extendStatics = function (d, b) {
extendStatics =
Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array &&
function (d, b) {
d.__proto__ = b;
}) ||
function (d, b) {
for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
};
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== 'function' && b !== null) throw new TypeError('Class extends value ' + String(b) + ' is not a constructor or null');
extendStatics(d, b);
function __() {
this.constructor = d;
}
d.prototype = b === null ? Object.create(b) : ((__.prototype = b.prototype), new __());
};
})();
Object.defineProperty(exports, '__esModule', { value: true });
var tfl_1 = require('./tfl');
var AirQuality = /** @class */ (function (_super) {

@@ -29,3 +38,3 @@ __extends(AirQuality, _super);

return AirQuality;
}(tfl_1.default));
})(tfl_1.default);
exports.default = AirQuality;

@@ -1,19 +0,28 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var tfl_1 = require("./tfl");
'use strict';
var __extends =
(this && this.__extends) ||
(function () {
var extendStatics = function (d, b) {
extendStatics =
Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array &&
function (d, b) {
d.__proto__ = b;
}) ||
function (d, b) {
for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
};
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== 'function' && b !== null) throw new TypeError('Class extends value ' + String(b) + ' is not a constructor or null');
extendStatics(d, b);
function __() {
this.constructor = d;
}
d.prototype = b === null ? Object.create(b) : ((__.prototype = b.prototype), new __());
};
})();
Object.defineProperty(exports, '__esModule', { value: true });
var tfl_1 = require('./tfl');
var BikePoint = /** @class */ (function (_super) {

@@ -25,12 +34,12 @@ __extends(BikePoint, _super);

BikePoint.prototype.getAll = function () {
return this.sendRequest("/BikePoint/", {}, 'GET');
return this.sendRequest('/BikePoint/', {}, 'GET');
};
BikePoint.prototype.getByID = function (id) {
return this.sendRequest("/BikePoint/" + id, {}, 'GET');
return this.sendRequest('/BikePoint/' + id, {}, 'GET');
};
BikePoint.prototype.getByName = function (query) {
return this.sendRequest("/BikePoint/Search", { query: query }, 'GET');
return this.sendRequest('/BikePoint/Search', { query: query }, 'GET');
};
return BikePoint;
}(tfl_1.default));
})(tfl_1.default);
exports.default = BikePoint;

@@ -1,19 +0,28 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var tfl_1 = require("./tfl");
'use strict';
var __extends =
(this && this.__extends) ||
(function () {
var extendStatics = function (d, b) {
extendStatics =
Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array &&
function (d, b) {
d.__proto__ = b;
}) ||
function (d, b) {
for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
};
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== 'function' && b !== null) throw new TypeError('Class extends value ' + String(b) + ' is not a constructor or null');
extendStatics(d, b);
function __() {
this.constructor = d;
}
d.prototype = b === null ? Object.create(b) : ((__.prototype = b.prototype), new __());
};
})();
Object.defineProperty(exports, '__esModule', { value: true });
var tfl_1 = require('./tfl');
var Crowding = /** @class */ (function (_super) {

@@ -29,3 +38,3 @@ __extends(Crowding, _super);

Crowding.prototype.getallByNaptan = function (naptanID) {
return this.sendRequest("/Crowding/" + naptanID, {}, 'GET');
return this.sendRequest('/Crowding/' + naptanID, {}, 'GET');
};

@@ -38,6 +47,6 @@ /**

Crowding.prototype.getByNaptanDay = function (naptanID, dayOfTheWeek) {
return this.sendRequest("/Crowding/" + naptanID + "/" + dayOfTheWeek, {}, 'GET');
return this.sendRequest('/Crowding/' + naptanID + '/' + dayOfTheWeek, {}, 'GET');
};
return Crowding;
}(tfl_1.default));
})(tfl_1.default);
exports.default = Crowding;

@@ -1,19 +0,28 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var tfl_1 = require("./tfl");
'use strict';
var __extends =
(this && this.__extends) ||
(function () {
var extendStatics = function (d, b) {
extendStatics =
Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array &&
function (d, b) {
d.__proto__ = b;
}) ||
function (d, b) {
for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
};
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== 'function' && b !== null) throw new TypeError('Class extends value ' + String(b) + ' is not a constructor or null');
extendStatics(d, b);
function __() {
this.constructor = d;
}
d.prototype = b === null ? Object.create(b) : ((__.prototype = b.prototype), new __());
};
})();
Object.defineProperty(exports, '__esModule', { value: true });
var tfl_1 = require('./tfl');
var Disruptions = /** @class */ (function (_super) {

@@ -28,6 +37,6 @@ __extends(Disruptions, _super);

Disruptions.prototype.getAllLifts = function () {
return this.sendRequest("/Disruptions/Lifts", {}, 'GET');
return this.sendRequest('/Disruptions/Lifts', {}, 'GET');
};
return Disruptions;
}(tfl_1.default));
})(tfl_1.default);
exports.default = Disruptions;

@@ -1,2 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });

@@ -1,2 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });

@@ -1,2 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });

@@ -1,2 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });

@@ -1,2 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });

@@ -1,2 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });

@@ -1,1 +0,1 @@

"use strict";
'use strict';

@@ -1,2 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });

@@ -1,2 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });

@@ -1,2 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });

@@ -1,19 +0,28 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var tfl_1 = require("./tfl");
'use strict';
var __extends =
(this && this.__extends) ||
(function () {
var extendStatics = function (d, b) {
extendStatics =
Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array &&
function (d, b) {
d.__proto__ = b;
}) ||
function (d, b) {
for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
};
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== 'function' && b !== null) throw new TypeError('Class extends value ' + String(b) + ' is not a constructor or null');
extendStatics(d, b);
function __() {
this.constructor = d;
}
d.prototype = b === null ? Object.create(b) : ((__.prototype = b.prototype), new __());
};
})();
Object.defineProperty(exports, '__esModule', { value: true });
var tfl_1 = require('./tfl');
var Line = /** @class */ (function (_super) {

@@ -42,7 +51,7 @@ __extends(Line, _super);

Line.prototype.getAllStopPoints = function (line) {
return this.sendRequest("/Line/" + line + "/StopPoints", {}, 'GET');
return this.sendRequest('/Line/' + line + '/StopPoints', {}, 'GET');
};
/** Gets all lines that serve the given modes. */
Line.prototype.getAllFromMode = function (modes) {
return this.sendRequest("/Line/Mode/" + tfl_1.default.arrayToCSV(modes), {}, 'GET');
return this.sendRequest('/Line/Mode/' + tfl_1.default.arrayToCSV(modes), {}, 'GET');
};

@@ -57,9 +66,14 @@ /**

Line.prototype.getStatusByLine = function (lines, detail, startDate, endDate) {
if (detail === void 0) { detail = false; }
if (detail === void 0) {
detail = false;
}
if (!startDate || !endDate) {
return this.sendRequest("/Line/" + tfl_1.default.arrayToCSV(lines) + "/Status", { detail: detail }, 'GET');
return this.sendRequest('/Line/' + tfl_1.default.arrayToCSV(lines) + '/Status', { detail: detail }, 'GET');
} else {
return this.sendRequest(
'/Line/' + tfl_1.default.arrayToCSV(lines) + '/Status/' + tfl_1.default.convertDate(startDate) + '/to/' + tfl_1.default.convertDate(endDate),
{ detail: detail },
'GET'
);
}
else {
return this.sendRequest("/Line/" + tfl_1.default.arrayToCSV(lines) + "/Status/" + tfl_1.default.convertDate(startDate) + "/to/" + tfl_1.default.convertDate(endDate), { detail: detail }, 'GET');
}
};

@@ -73,15 +87,15 @@ /**

Line.prototype.getStatusByModes = function (modes, detail, severityLevel) {
return this.sendRequest("/Line/Mode/" + tfl_1.default.arrayToCSV(modes) + "/Status", { detail: detail, severityLevel: severityLevel }, 'GET');
return this.sendRequest('/Line/Mode/' + tfl_1.default.arrayToCSV(modes) + '/Status', { detail: detail, severityLevel: severityLevel }, 'GET');
};
/** Gets the timetable for a specified station on the give line with specified destination */
Line.prototype.getTimetableFromTo = function (line, from, to) {
return this.sendRequest("/Line/" + line + "/Timetable/" + from + "/to/" + to, {}, 'GET');
return this.sendRequest('/Line/' + line + '/Timetable/' + from + '/to/' + to, {}, 'GET');
};
/** Gets the inbound timetable for a specified station on the give line */
Line.prototype.getTimetableFromStationIn = function (line, NaPTANID) {
return this.sendRequest("/Line/" + line + "/Timetable/" + NaPTANID, { direction: 'inbound' }, 'GET');
return this.sendRequest('/Line/' + line + '/Timetable/' + NaPTANID, { direction: 'inbound' }, 'GET');
};
/** Gets the outbound timetable for a specified station on the give line */
Line.prototype.getTimetableFromStationOut = function (line, NaPTANID) {
return this.sendRequest("/Line/" + line + "/Timetable/" + NaPTANID, {}, 'GET');
return this.sendRequest('/Line/' + line + '/Timetable/' + NaPTANID, {}, 'GET');
};

@@ -95,4 +109,6 @@ /** Get the list of arrival predictions for given line ids based at the given stop

Line.prototype.getArrivalsByNaptan = function (ids, NaptanID, direction, destinationStationId) {
if (direction === void 0) { direction = 'all'; }
return this.sendRequest("/Line/" + tfl_1.default.arrayToCSV(ids) + "/Arrivals/" + NaptanID, { direction: direction, destinationStationId: destinationStationId }, 'GET');
if (direction === void 0) {
direction = 'all';
}
return this.sendRequest('/Line/' + tfl_1.default.arrayToCSV(ids) + '/Arrivals/' + NaptanID, { direction: direction, destinationStationId: destinationStationId }, 'GET');
};

@@ -104,3 +120,3 @@ /**

Line.prototype.getDistruptionsByID = function (ids) {
return this.sendRequest("/Line/" + tfl_1.default.arrayToCSV(ids) + "/Disruption", {}, 'GET');
return this.sendRequest('/Line/' + tfl_1.default.arrayToCSV(ids) + '/Disruption', {}, 'GET');
};

@@ -114,3 +130,3 @@ /**

Line.prototype.searchByString = function (query, modes, serviceTypes) {
return this.sendRequest("/Line/" + query + "/Disruption", { modes: modes, serviceTypes: serviceTypes }, 'GET');
return this.sendRequest('/Line/' + query + '/Disruption', { modes: modes, serviceTypes: serviceTypes }, 'GET');
};

@@ -122,6 +138,6 @@ /**

Line.prototype.getAllValidRoutes = function (serviceTypes) {
return this.sendRequest("/Line/Route", { serviceTypes: serviceTypes }, 'GET');
return this.sendRequest('/Line/Route', { serviceTypes: serviceTypes }, 'GET');
};
return Line;
}(tfl_1.default));
})(tfl_1.default);
exports.default = Line;

@@ -1,19 +0,28 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var tfl_1 = require("./tfl");
'use strict';
var __extends =
(this && this.__extends) ||
(function () {
var extendStatics = function (d, b) {
extendStatics =
Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array &&
function (d, b) {
d.__proto__ = b;
}) ||
function (d, b) {
for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
};
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== 'function' && b !== null) throw new TypeError('Class extends value ' + String(b) + ' is not a constructor or null');
extendStatics(d, b);
function __() {
this.constructor = d;
}
d.prototype = b === null ? Object.create(b) : ((__.prototype = b.prototype), new __());
};
})();
Object.defineProperty(exports, '__esModule', { value: true });
var tfl_1 = require('./tfl');
var Mode = /** @class */ (function (_super) {

@@ -28,3 +37,3 @@ __extends(Mode, _super);

Mode.prototype.getActiveServiceTypes = function () {
return this.sendRequest("/Mode/ActiveServiceTypes", {}, 'GET');
return this.sendRequest('/Mode/ActiveServiceTypes', {}, 'GET');
};

@@ -37,7 +46,9 @@ /**

Mode.prototype.getArrivalPredictionsAllStops = function (mode, count) {
if (count === void 0) { count = -1; }
return this.sendRequest("/Mode/" + mode + "/Arrivals", { count: count }, 'GET');
if (count === void 0) {
count = -1;
}
return this.sendRequest('/Mode/' + mode + '/Arrivals', { count: count }, 'GET');
};
return Mode;
}(tfl_1.default));
})(tfl_1.default);
exports.default = Mode;

@@ -1,19 +0,28 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var tfl_1 = require("./tfl");
'use strict';
var __extends =
(this && this.__extends) ||
(function () {
var extendStatics = function (d, b) {
extendStatics =
Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array &&
function (d, b) {
d.__proto__ = b;
}) ||
function (d, b) {
for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
};
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== 'function' && b !== null) throw new TypeError('Class extends value ' + String(b) + ' is not a constructor or null');
extendStatics(d, b);
function __() {
this.constructor = d;
}
d.prototype = b === null ? Object.create(b) : ((__.prototype = b.prototype), new __());
};
})();
Object.defineProperty(exports, '__esModule', { value: true });
var tfl_1 = require('./tfl');
var Occupancy = /** @class */ (function (_super) {

@@ -29,3 +38,3 @@ __extends(Occupancy, _super);

Occupancy.prototype.getBikePointByID = function (id) {
return this.sendRequest("/Occupancy/BikePoints/" + id, {}, 'GET');
return this.sendRequest('/Occupancy/BikePoints/' + id, {}, 'GET');
};

@@ -37,3 +46,3 @@ /**

Occupancy.prototype.getCarkParkByID = function (id) {
return this.sendRequest("/Occupancy/ChargeConnector/" + id, {}, 'GET');
return this.sendRequest('/Occupancy/ChargeConnector/' + id, {}, 'GET');
};

@@ -45,3 +54,3 @@ /**

Occupancy.prototype.getChargeConnectorByID = function (id) {
return this.sendRequest("/Occupancy/ChargeConnector/" + id, {}, 'GET');
return this.sendRequest('/Occupancy/ChargeConnector/' + id, {}, 'GET');
};

@@ -52,3 +61,3 @@ /**

Occupancy.prototype.getAllCarParks = function () {
return this.sendRequest("/Occupancy/CarPark", {}, 'GET');
return this.sendRequest('/Occupancy/CarPark', {}, 'GET');
};

@@ -59,6 +68,6 @@ /**

Occupancy.prototype.getAllChargeConnectors = function () {
return this.sendRequest("/Occupancy/ChargeConnector", {}, 'GET');
return this.sendRequest('/Occupancy/ChargeConnector', {}, 'GET');
};
return Occupancy;
}(tfl_1.default));
})(tfl_1.default);
exports.default = Occupancy;

@@ -1,19 +0,28 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var tfl_1 = require("./tfl");
'use strict';
var __extends =
(this && this.__extends) ||
(function () {
var extendStatics = function (d, b) {
extendStatics =
Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array &&
function (d, b) {
d.__proto__ = b;
}) ||
function (d, b) {
for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
};
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== 'function' && b !== null) throw new TypeError('Class extends value ' + String(b) + ' is not a constructor or null');
extendStatics(d, b);
function __() {
this.constructor = d;
}
d.prototype = b === null ? Object.create(b) : ((__.prototype = b.prototype), new __());
};
})();
Object.defineProperty(exports, '__esModule', { value: true });
var tfl_1 = require('./tfl');
var Road = /** @class */ (function (_super) {

@@ -35,3 +44,3 @@ __extends(Road, _super);

Road.prototype.getByID = function (ids) {
return this.sendRequest("/Road/" + tfl_1.default.arrayToCSV(ids), {}, 'GET');
return this.sendRequest('/Road/' + tfl_1.default.arrayToCSV(ids), {}, 'GET');
};

@@ -45,6 +54,10 @@ /**

Road.prototype.getStatusByID = function (ids, startDate, endDate) {
return this.sendRequest("/Road/" + tfl_1.default.arrayToCSV(ids) + "/Status", {
startDate: tfl_1.default.convertDate(startDate),
endDate: tfl_1.default.convertDate(endDate)
}, 'GET');
return this.sendRequest(
'/Road/' + tfl_1.default.arrayToCSV(ids) + '/Status',
{
startDate: tfl_1.default.convertDate(startDate),
endDate: tfl_1.default.convertDate(endDate)
},
'GET'
);
};

@@ -57,6 +70,10 @@ /**

Road.prototype.getAllStreetDisruption = function (startDate, endDate) {
return this.sendRequest("/Road/all/Street/Disruption", {
startDate: tfl_1.default.convertDate(startDate),
endDate: tfl_1.default.convertDate(endDate)
}, 'GET');
return this.sendRequest(
'/Road/all/Street/Disruption',
{
startDate: tfl_1.default.convertDate(startDate),
endDate: tfl_1.default.convertDate(endDate)
},
'GET'
);
};

@@ -71,5 +88,9 @@ /**

Road.prototype.getAllDisruptionsByID = function (ids, stripContent) {
return this.sendRequest("/Road/all/Disruption/" + tfl_1.default.arrayToCSV(ids), {
stripContent: stripContent
}, 'GET');
return this.sendRequest(
'/Road/all/Disruption/' + tfl_1.default.arrayToCSV(ids),
{
stripContent: stripContent
},
'GET'
);
};

@@ -89,3 +110,3 @@ /**

return Road;
}(tfl_1.default));
})(tfl_1.default);
exports.default = Road;

@@ -1,19 +0,28 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var tfl_1 = require("./tfl");
'use strict';
var __extends =
(this && this.__extends) ||
(function () {
var extendStatics = function (d, b) {
extendStatics =
Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array &&
function (d, b) {
d.__proto__ = b;
}) ||
function (d, b) {
for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
};
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== 'function' && b !== null) throw new TypeError('Class extends value ' + String(b) + ' is not a constructor or null');
extendStatics(d, b);
function __() {
this.constructor = d;
}
d.prototype = b === null ? Object.create(b) : ((__.prototype = b.prototype), new __());
};
})();
Object.defineProperty(exports, '__esModule', { value: true });
var tfl_1 = require('./tfl');
var StopPoint = /** @class */ (function (_super) {

@@ -28,3 +37,3 @@ __extends(StopPoint, _super);

StopPoint.prototype.getCategories = function () {
return this.sendRequest("/StopPoint/Meta/Categories", {}, 'GET');
return this.sendRequest('/StopPoint/Meta/Categories', {}, 'GET');
};

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

StopPoint.prototype.getTypes = function () {
return this.sendRequest("/StopPoint/Meta/StopTypes", {}, 'GET');
return this.sendRequest('/StopPoint/Meta/StopTypes', {}, 'GET');
};

@@ -42,3 +51,3 @@ /**

StopPoint.prototype.getModes = function () {
return this.sendRequest("/StopPoint/Meta/Modes", {}, 'GET');
return this.sendRequest('/StopPoint/Meta/Modes', {}, 'GET');
};

@@ -51,3 +60,3 @@ /**

StopPoint.prototype.getByIDs = function (ids, includeCrowdingData) {
return this.sendRequest("/StopPoint/" + tfl_1.default.arrayToCSV(ids), { includeCrowdingData: includeCrowdingData }, 'GET');
return this.sendRequest('/StopPoint/' + tfl_1.default.arrayToCSV(ids), { includeCrowdingData: includeCrowdingData }, 'GET');
};

@@ -59,3 +68,3 @@ /**

StopPoint.prototype.getAllByStopType = function (types) {
return this.sendRequest("/StopPoint/Type/" + tfl_1.default.arrayToCSV(types), {}, 'GET');
return this.sendRequest('/StopPoint/Type/' + tfl_1.default.arrayToCSV(types), {}, 'GET');
};

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

StopPoint.prototype.getServiceTypesByID = function (id, lineIds, modes) {
return this.sendRequest("/StopPoint/ServiceTypes", { id: id, lineIds: lineIds, modes: modes }, 'GET');
return this.sendRequest('/StopPoint/ServiceTypes', { id: id, lineIds: lineIds, modes: modes }, 'GET');
};

@@ -78,3 +87,3 @@ /**

StopPoint.prototype.search = function (name, modes) {
return this.sendRequest("/StopPoint/Search/" + name, {}, 'GET');
return this.sendRequest('/StopPoint/Search/' + name, {}, 'GET');
};

@@ -86,3 +95,3 @@ /**

StopPoint.prototype.getStationArrivals = function (id) {
return this.sendRequest("/StopPoint/" + id + "/Arrivals", {}, 'GET');
return this.sendRequest('/StopPoint/' + id + '/Arrivals', {}, 'GET');
};

@@ -95,3 +104,3 @@ /**

StopPoint.prototype.getArrivalDepartures = function (id, lineIds) {
return this.sendRequest("/StopPoint/" + id + "/ArrivalsDepartures", {}, 'GET');
return this.sendRequest('/StopPoint/' + id + '/ArrivalsDepartures', {}, 'GET');
};

@@ -106,7 +115,11 @@ /**

StopPoint.prototype.getDisruptionsByID = function (ids, getFamily, includeRouteBlockedStops, flattenResponse) {
return this.sendRequest("/StopPoint/" + tfl_1.default.arrayToCSV(ids) + "/Disruption", {
getFamily: getFamily,
includeRouteBlockedStops: includeRouteBlockedStops,
flattenResponse: flattenResponse
}, 'GET');
return this.sendRequest(
'/StopPoint/' + tfl_1.default.arrayToCSV(ids) + '/Disruption',
{
getFamily: getFamily,
includeRouteBlockedStops: includeRouteBlockedStops,
flattenResponse: flattenResponse
},
'GET'
);
};

@@ -119,3 +132,3 @@ /**

StopPoint.prototype.getDisruptionsByMode = function (modes, includeRouteBlockedStops) {
return this.sendRequest("/StopPoint/Mode/" + tfl_1.default.arrayToCSV(modes) + "/Disruption", { includeRouteBlockedStops: includeRouteBlockedStops }, 'GET');
return this.sendRequest('/StopPoint/Mode/' + tfl_1.default.arrayToCSV(modes) + '/Disruption', { includeRouteBlockedStops: includeRouteBlockedStops }, 'GET');
};

@@ -129,4 +142,6 @@ /**

StopPoint.prototype.getReachableStationsByID = function (id, lineID, serviceTypes) {
if (serviceTypes === void 0) { serviceTypes = ['Regular']; }
return this.sendRequest("/StopPoint/" + id + "/CanReachOnLine/" + lineID, { serviceTypes: tfl_1.default.arrayToCSV(serviceTypes) }, 'GET');
if (serviceTypes === void 0) {
serviceTypes = ['Regular'];
}
return this.sendRequest('/StopPoint/' + id + '/CanReachOnLine/' + lineID, { serviceTypes: tfl_1.default.arrayToCSV(serviceTypes) }, 'GET');
};

@@ -139,4 +154,6 @@ /**

StopPoint.prototype.getRouteSectionByID = function (id, serviceTypes) {
if (serviceTypes === void 0) { serviceTypes = ['Regular']; }
return this.sendRequest("/StopPoint/" + id + "/Route", { serviceTypes: tfl_1.default.arrayToCSV(serviceTypes) }, 'GET');
if (serviceTypes === void 0) {
serviceTypes = ['Regular'];
}
return this.sendRequest('/StopPoint/' + id + '/Route', { serviceTypes: tfl_1.default.arrayToCSV(serviceTypes) }, 'GET');
};

@@ -155,4 +172,19 @@ /**

StopPoint.prototype.getInRadius = function (stopTypes, radius, useStopPointHierarchy, modes, categories, returnLines, latitude, longitude) {
if (radius === void 0) { radius = 200; }
return this.sendRequest("/StopPoint", { stopTypes: tfl_1.default.arrayToCSV(stopTypes), radius: radius, useStopPointHierarchy: useStopPointHierarchy, modes: tfl_1.default.arrayToCSV(modes), categories: tfl_1.default.arrayToCSV(categories), returnLines: returnLines, latitude: latitude, longitude: longitude }, 'GET');
if (radius === void 0) {
radius = 200;
}
return this.sendRequest(
'/StopPoint',
{
stopTypes: tfl_1.default.arrayToCSV(stopTypes),
radius: radius,
useStopPointHierarchy: useStopPointHierarchy,
modes: tfl_1.default.arrayToCSV(modes),
categories: tfl_1.default.arrayToCSV(categories),
returnLines: returnLines,
latitude: latitude,
longitude: longitude
},
'GET'
);
};

@@ -165,3 +197,3 @@ /**

StopPoint.prototype.getBySMSCode = function (smsID, output) {
return this.sendRequest("/StopPoint/Sms/" + smsID, { output: output }, 'GET');
return this.sendRequest('/StopPoint/Sms/' + smsID, { output: output }, 'GET');
};

@@ -173,3 +205,3 @@ /**

StopPoint.prototype.getTaxiRanksByID = function (id) {
return this.sendRequest("/StopPoint/" + id + "/TaxiRanks", {}, 'GET');
return this.sendRequest('/StopPoint/' + id + '/TaxiRanks', {}, 'GET');
};

@@ -181,6 +213,6 @@ /**

StopPoint.prototype.getCarParksByID = function (id) {
return this.sendRequest("/StopPoint/" + id + "/CarParks", {}, 'GET');
return this.sendRequest('/StopPoint/' + id + '/CarParks', {}, 'GET');
};
return StopPoint;
}(tfl_1.default));
})(tfl_1.default);
exports.default = StopPoint;

@@ -1,44 +0,125 @@

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
'use strict';
var __awaiter =
(this && this.__awaiter) ||
function (thisArg, _arguments, P, generator) {
function adopt(value) {
return value instanceof P
? value
: new P(function (resolve) {
resolve(value);
});
}
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
var node_fetch_1 = require("node-fetch");
var qs = require("querystring");
var xmlparser = require("fast-xml-parser");
function rejected(value) {
try {
step(generator['throw'](value));
} catch (e) {
reject(e);
}
}
function step(result) {
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
}
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator =
(this && this.__generator) ||
function (thisArg, body) {
var _ = {
label: 0,
sent: function () {
if (t[0] & 1) throw t[1];
return t[1];
},
trys: [],
ops: []
},
f,
y,
t,
g;
return (
(g = { next: verb(0), throw: verb(1), return: verb(2) }),
typeof Symbol === 'function' &&
(g[Symbol.iterator] = function () {
return this;
}),
g
);
function verb(n) {
return function (v) {
return step([n, v]);
};
}
function step(op) {
if (f) throw new TypeError('Generator is already executing.');
while (_)
try {
if (((f = 1), y && (t = op[0] & 2 ? y['return'] : op[0] ? y['throw'] || ((t = y['return']) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)) return t;
if (((y = 0), t)) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0:
case 1:
t = op;
break;
case 4:
_.label++;
return { value: op[1], done: false };
case 5:
_.label++;
y = op[1];
op = [0];
continue;
case 7:
op = _.ops.pop();
_.trys.pop();
continue;
default:
if (!((t = _.trys), (t = t.length > 0 && t[t.length - 1])) && (op[0] === 6 || op[0] === 2)) {
_ = 0;
continue;
}
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
_.label = op[1];
break;
}
if (op[0] === 6 && _.label < t[1]) {
_.label = t[1];
t = op;
break;
}
if (t && _.label < t[2]) {
_.label = t[2];
_.ops.push(op);
break;
}
if (t[2]) _.ops.pop();
_.trys.pop();
continue;
}
op = body.call(thisArg, _);
} catch (e) {
op = [6, e];
y = 0;
} finally {
f = t = 0;
}
if (op[0] & 5) throw op[1];
return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, '__esModule', { value: true });
var axios_1 = require('axios');
var qs = require('querystring');
var xmlparser = require('fast-xml-parser');
// @ts-ignore
var trackernet_xml_retag_1 = require("trackernet-xml-retag");
var trackernet_xml_retag_1 = require('trackernet-xml-retag');
var TfLAPI = /** @class */ (function () {

@@ -55,24 +136,17 @@ function TfLAPI(appKey) {

return __awaiter(this, void 0, void 0, function () {
var FullURL, options, fetchReq;
var FullURL, fetch;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
FullURL = "https://" + this.host + ":" + this.port + uri + "?app_key=" + this.appKey;
options = {
method: method,
headers: {
Accept: 'application/json',
'cache-control': 'no-cache'
}
};
FullURL = 'https://' + this.host + ':' + this.port + uri + '?app_key=' + this.appKey;
// Removed all undefined objects from params
Object.keys(params).forEach(function (key) { return (params[key] === undefined ? delete params[key] : {}); });
Object.keys(params).forEach(function (key) {
return params[key] === undefined ? delete params[key] : {};
});
// If Parameters are passed then stringify them and update the request URL
if (params)
FullURL = FullURL + "&" + qs.stringify(params);
return [4 /*yield*/, node_fetch_1.default(FullURL, options)];
if (params) FullURL = FullURL + '&' + qs.stringify(params);
return [4 /*yield*/, axios_1.default.get(FullURL, { headers: { Accept: 'application/json', 'cache-control': 'no-cache' } })];
case 1:
fetchReq = _a.sent();
return [4 /*yield*/, fetchReq.json()];
case 2: return [2 /*return*/, _a.sent()];
fetch = _a.sent();
return [2 /*return*/, fetch.data];
}

@@ -87,20 +161,11 @@ });

return __awaiter(this, void 0, void 0, function () {
var FullURL, options, xmlData, jsonObj;
var fetch, xmlData, jsonObj;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
FullURL = "http://cloud.tfl.gov.uk/TrackerNet" + uri;
options = {
method: method,
headers: {
Accept: 'application/xml',
'cache-control': 'no-cache'
}
};
return [4 /*yield*/, node_fetch_1.default(FullURL, options)];
case 1: return [4 /*yield*/, (_a.sent()).text()];
case 2:
xmlData = _a.sent();
if (reTag)
xmlData = trackernet_xml_retag_1.retag.trackerNetRetag(xmlData);
return [4 /*yield*/, axios_1.default.get('http://cloud.tfl.gov.uk/TrackerNet' + uri, { headers: { Accept: 'application/xml', 'cache-control': 'no-cache' } })];
case 1:
fetch = _a.sent();
xmlData = fetch.data;
if (reTag) xmlData = trackernet_xml_retag_1.retag.trackerNetRetag(xmlData);
jsonObj = xmlparser.parse(xmlData, {

@@ -120,3 +185,5 @@ attributeNamePrefix: '',

return Object.keys(params)
.map(function (key) { return key + '=' + params[key]; })
.map(function (key) {
return key + '=' + params[key];
})
.join('&');

@@ -143,3 +210,3 @@ };

return TfLAPI;
}());
})();
exports.default = TfLAPI;

@@ -1,56 +0,146 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
'use strict';
var __extends =
(this && this.__extends) ||
(function () {
var extendStatics = function (d, b) {
extendStatics =
Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array &&
function (d, b) {
d.__proto__ = b;
}) ||
function (d, b) {
for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
};
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== 'function' && b !== null) throw new TypeError('Class extends value ' + String(b) + ' is not a constructor or null');
extendStatics(d, b);
function __() {
this.constructor = d;
}
d.prototype = b === null ? Object.create(b) : ((__.prototype = b.prototype), new __());
};
})();
var __awaiter =
(this && this.__awaiter) ||
function (thisArg, _arguments, P, generator) {
function adopt(value) {
return value instanceof P
? value
: new P(function (resolve) {
resolve(value);
});
}
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
}
function rejected(value) {
try {
step(generator['throw'](value));
} catch (e) {
reject(e);
}
}
function step(result) {
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
}
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
var __generator =
(this && this.__generator) ||
function (thisArg, body) {
var _ = {
label: 0,
sent: function () {
if (t[0] & 1) throw t[1];
return t[1];
},
trys: [],
ops: []
},
f,
y,
t,
g;
return (
(g = { next: verb(0), throw: verb(1), return: verb(2) }),
typeof Symbol === 'function' &&
(g[Symbol.iterator] = function () {
return this;
}),
g
);
function verb(n) {
return function (v) {
return step([n, v]);
};
}
function step(op) {
if (f) throw new TypeError('Generator is already executing.');
while (_)
try {
if (((f = 1), y && (t = op[0] & 2 ? y['return'] : op[0] ? y['throw'] || ((t = y['return']) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)) return t;
if (((y = 0), t)) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0:
case 1:
t = op;
break;
case 4:
_.label++;
return { value: op[1], done: false };
case 5:
_.label++;
y = op[1];
op = [0];
continue;
case 7:
op = _.ops.pop();
_.trys.pop();
continue;
default:
if (!((t = _.trys), (t = t.length > 0 && t[t.length - 1])) && (op[0] === 6 || op[0] === 2)) {
_ = 0;
continue;
}
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
_.label = op[1];
break;
}
if (op[0] === 6 && _.label < t[1]) {
_.label = t[1];
t = op;
break;
}
if (t && _.label < t[2]) {
_.label = t[2];
_.ops.push(op);
break;
}
if (t[2]) _.ops.pop();
_.trys.pop();
continue;
}
op = body.call(thisArg, _);
} catch (e) {
op = [6, e];
y = 0;
} finally {
f = t = 0;
}
if (op[0] & 5) throw op[1];
return { value: op[0] ? op[1] : void 0, done: true };
}
};
})();
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
var tfl_1 = require("./tfl");
var humps = require("humps");
Object.defineProperty(exports, '__esModule', { value: true });
var tfl_1 = require('./tfl');
var humps = require('humps');
var TrackerNet = /** @class */ (function (_super) {

@@ -66,6 +156,6 @@ __extends(TrackerNet, _super);

switch (_a.label) {
case 0: return [4 /*yield*/, this.sendRequestTrackerNet("/PredictionSummary/" + line, 'GET', true)];
case 0:
return [4 /*yield*/, this.sendRequestTrackerNet('/PredictionSummary/' + line, 'GET', true)];
case 1:
request = _a.sent();
//@ts-expect-error
request = humps.camelizeKeys(request.ROOT, function (key, convert) {

@@ -91,10 +181,7 @@ return /^[A-Z0-9_]+$/.test(key) ? key.toLowerCase() : convert(key);

case 0:
if (!line)
console.error('You must enter a line code!');
if (!stationCode)
console.error('You must enter a station code!');
return [4 /*yield*/, this.sendRequestTrackerNet("/PredictionDetailed/" + line + "/" + stationCode, 'GET', true)];
if (!line) console.error('You must enter a line code!');
if (!stationCode) console.error('You must enter a station code!');
return [4 /*yield*/, this.sendRequestTrackerNet('/PredictionDetailed/' + line + '/' + stationCode, 'GET', true)];
case 1:
request = _a.sent();
//@ts-expect-error
request = humps.camelizeKeys(request.ROOT, function (key, convert) {

@@ -117,3 +204,5 @@ return /^[A-Z0-9_]+$/.test(key) ? key.toLowerCase() : convert(key);

TrackerNet.prototype.getAllLinesStatus = function (incidentsOnly) {
if (incidentsOnly === void 0) { incidentsOnly = false; }
if (incidentsOnly === void 0) {
incidentsOnly = false;
}
return __awaiter(this, void 0, void 0, function () {

@@ -123,9 +212,13 @@ var request;

switch (_a.label) {
case 0: return [4 /*yield*/, this.sendRequestTrackerNet("/LineStatus" + TrackerNet.incidentsCheck(incidentsOnly), 'GET', false)];
case 0:
return [4 /*yield*/, this.sendRequestTrackerNet('/LineStatus' + TrackerNet.incidentsCheck(incidentsOnly), 'GET', false)];
case 1:
request = _a.sent();
//@ts-expect-error
return [2 /*return*/, humps.camelizeKeys(request.ArrayOfLineStatus.LineStatus, function (key, convert) {
return [
2 /*return*/,
humps.camelizeKeys(request.ArrayOfLineStatus.LineStatus, function (key, convert) {
return /^[A-Z0-9_]+$/.test(key) ? key.toLowerCase() : convert(key);
})];
})
];
}

@@ -140,3 +233,5 @@ });

TrackerNet.prototype.getAllStationStatus = function (incidentsOnly) {
if (incidentsOnly === void 0) { incidentsOnly = false; }
if (incidentsOnly === void 0) {
incidentsOnly = false;
}
return __awaiter(this, void 0, void 0, function () {

@@ -146,9 +241,13 @@ var request;

switch (_a.label) {
case 0: return [4 /*yield*/, this.sendRequestTrackerNet("/StationStatus" + TrackerNet.incidentsCheck(incidentsOnly), 'GET', false)];
case 0:
return [4 /*yield*/, this.sendRequestTrackerNet('/StationStatus' + TrackerNet.incidentsCheck(incidentsOnly), 'GET', false)];
case 1:
request = _a.sent();
//@ts-expect-error
return [2 /*return*/, humps.camelizeKeys(request.ArrayOfStationStatus.StationStatus, function (key, convert) {
return [
2 /*return*/,
humps.camelizeKeys(request.ArrayOfStationStatus.StationStatus, function (key, convert) {
return /^[A-Z0-9_]+$/.test(key) ? key.toLowerCase() : convert(key);
})];
})
];
}

@@ -159,3 +258,3 @@ });

return TrackerNet;
}(tfl_1.default));
})(tfl_1.default);
exports.default = TrackerNet;

@@ -1,3 +0,3 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
exports.default = {

@@ -4,0 +4,0 @@ bakerloo: {

@@ -1,2 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
{
"name": "tfl-api-wrapper",
"version": "1.4.1",
"version": "1.5.1",
"description": "A Node JS wrapper for the Transport for London API",

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

"license": "ISC",
"dependencies": {
"axios": "^0.21.1",
"fast-xml-parser": "^3.19.0",
"humps": "^2.0.1",
"trackernet-xml-retag": "^1.0.7"
},
"devDependencies": {
"@types/axios": "^0.14.0",
"@types/humps": "^2.0.0",
"@types/node-fetch": "^2.5.7",
"prettier": "^2.3.0",

@@ -33,10 +39,4 @@ "tsc-watch": "^4.2.9",

"typedoc-theme-dark": "0.0.5",
"typescript": "^4.1.3"
"typescript": "^4.3.5"
},
"dependencies": {
"fast-xml-parser": "^3.19.0",
"humps": "^2.0.1",
"node-fetch": "^2.6.1",
"trackernet-xml-retag": "^1.0.7"
},
"directories": {

@@ -43,0 +43,0 @@ "lib": "lib"

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