Socket
Socket
Sign inDemoInstall

metro-info

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metro-info - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

17

CHANGELOG.md

@@ -8,2 +8,14 @@ # Changelog

## [1.0.4] - 2019-03-26
### Added
- Added `node-fetch`.
### Removed
- Removed `@types/request-promise-native`.
- Removed `request` in favour of `fetch` to improve compatibility.
- Removed `request-promise-native`.
## [1.0.3] - 2019-03-19

@@ -50,5 +62,6 @@

[unreleased]: https://github.com/Codex-/metro-info/compare/v1.0.2...HEAD
[1.0.2]: https://github.com/Codex-/metro-info/compare/v1.0.2...v1.0.3
[unreleased]: https://github.com/Codex-/metro-info/compare/v1.0.4...HEAD
[1.0.4]: https://github.com/Codex-/metro-info/compare/v1.0.3...v1.0.4
[1.0.3]: https://github.com/Codex-/metro-info/compare/v1.0.2...v1.0.3
[1.0.2]: https://github.com/Codex-/metro-info/compare/v1.0.1...v1.0.2
[1.0.1]: https://github.com/Codex-/metro-info/compare/v1.0.0...v1.0.1
export * from './alert.model';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=alert.js.map
import { ElementCompact } from 'xml-js';
import { Alert } from './alert.model';
export declare function mapToAlert(alertJson: ElementCompact): Alert;

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ export interface Alert {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=alert.model.js.map
import { ElementCompact } from 'xml-js';
export declare function fetchXmlAsJson(uri: string): Promise<ElementCompact>;

14

dist/api.js

@@ -38,13 +38,19 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
var request = require("request-promise-native");
var xml_js_1 = require("xml-js");
if (typeof global.fetch === 'undefined') {
global.fetch = require('node-fetch');
}
var fetch = global.fetch;
function fetchXmlAsJson(uri) {
return __awaiter(this, void 0, void 0, function () {
var apiResponse;
var apiResponse, apiText;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4, request(uri).promise()];
case 0: return [4, fetch(uri)];
case 1:
apiResponse = _a.sent();
return [2, xml_js_1.xml2js(apiResponse, {
return [4, apiResponse.text()];
case 2:
apiText = _a.sent();
return [2, xml_js_1.xml2js(apiText, {
attributesKey: '$',

@@ -51,0 +57,0 @@ compact: true,

export declare const API_URL: string;
export declare const API_TIMES = "JPRoutePositionET2";
export declare const API_LOCATIONS = "JPPlatform";

@@ -0,0 +0,0 @@ "use strict";

export * from './content.model';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=content.js.map
import { ElementCompact } from 'xml-js';
import { Content } from './content.model';
export declare function mapToContent(contentJson: ElementCompact): Content;

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ export interface Content {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=content.model.js.map

@@ -0,0 +0,0 @@ export declare enum Direction {

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ export * from './alert/alert';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ export interface PlatformHeader {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=platform.header.model.js.map
import { ElementCompact } from 'xml-js';
export declare function fetchPlatformLocationsAsJson(): Promise<ElementCompact>;
import { PlatformLocations } from './platform.locations.model';
export declare function getPlatformLocations(): Promise<PlatformLocations>;
import { ElementCompact } from 'xml-js';
import { PlatformLocations } from './platform.locations.model';
export declare function mapToPlatformLocations(locationJson: ElementCompact): PlatformLocations;

@@ -0,0 +0,0 @@ import { Content } from '../../content/content.model';

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=platform.locations.model.js.map

@@ -0,0 +0,0 @@ export * from './locations/platform.locations.getter';

@@ -0,0 +0,0 @@ "use strict";

import { ElementCompact } from 'xml-js';
export declare function fetchPlatformTimesAsJson(platformNumber: number): Promise<ElementCompact>;

@@ -0,0 +0,0 @@ "use strict";

import { PlatformTimes } from './platform.times.model';
export declare function getPlatformTimes(platformNumber: number): Promise<PlatformTimes>;

@@ -0,0 +0,0 @@ "use strict";

import { ElementCompact } from 'xml-js';
import { PlatformTimes } from './platform.times.model';
export declare function mapToPlatformTimes(positionJson: ElementCompact): PlatformTimes;

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { Alert } from '../../alert/alert.model';

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=platform.times.model.js.map
export * from './point.model';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=point.js.map
import { ElementCompact } from 'xml-js';
import { Point } from './point.model';
export declare function mapToPoint(pointJson: ElementCompact): Point;

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ export interface Point {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=point.model.js.map
export declare function propertyToArray(property: any): any[];

@@ -0,0 +0,0 @@ "use strict";

{
"name": "metro-info",
"version": "1.0.3",
"version": "1.0.4",
"description": "Christchurch (Unofficial) MetroInfo API NodeJS library",

@@ -45,9 +45,8 @@ "main": "dist/index.js",

"dependencies": {
"@types/jest": "^24.0.11",
"@types/request-promise-native": "^1.0.15",
"request": "^2.88.0",
"request-promise-native": "^1.0.7",
"node-fetch": "^2.3.0",
"xml-js": "^1.6.11"
},
"devDependencies": {
"@types/jest": "^24.0.11",
"@types/node-fetch": "^2.1.7",
"coveralls": "*",

@@ -54,0 +53,0 @@ "husky": "^1.3.1",

@@ -37,2 +37,6 @@ # metro-info

## Compatibility
`metro-info` will opt to use a globally provided `fetch` method if one exists, before falling back to using `node-fetch`. This allows compatibility with with any frameworks that implement `fetch`, such as: NativeScript, React Native, and most browsers.
## Models

@@ -39,0 +43,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc