metro-info
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -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"; |
export {}; |
@@ -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>; |
@@ -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>; |
@@ -0,0 +0,0 @@ "use strict"; |
import { PlatformLocations } from './platform.locations.model'; | ||
export declare function getPlatformLocations(): Promise<PlatformLocations>; |
@@ -0,0 +0,0 @@ "use strict"; |
import { ElementCompact } from 'xml-js'; | ||
import { PlatformLocations } from './platform.locations.model'; | ||
export declare function mapToPlatformLocations(locationJson: ElementCompact): PlatformLocations; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44582
2
579
53
13
1
+ Addednode-fetch@^2.3.0
+ Addednode-fetch@2.7.0(transitive)
+ Addedtr46@0.0.3(transitive)
+ Addedwebidl-conversions@3.0.1(transitive)
+ Addedwhatwg-url@5.0.0(transitive)
- Removed@types/jest@^24.0.11
- Removedrequest@^2.88.0
- Removedrequest-promise-native@^1.0.7
- Removed@jest/types@24.9.0(transitive)
- Removed@types/caseless@0.12.5(transitive)
- Removed@types/istanbul-lib-coverage@2.0.6(transitive)
- Removed@types/istanbul-lib-report@3.0.3(transitive)
- Removed@types/istanbul-reports@1.1.2(transitive)
- Removed@types/jest@24.9.1(transitive)
- Removed@types/node@22.7.3(transitive)
- Removed@types/request@2.48.12(transitive)
- Removed@types/request-promise-native@1.0.21(transitive)
- Removed@types/tough-cookie@4.0.5(transitive)
- Removed@types/yargs@13.0.12(transitive)
- Removed@types/yargs-parser@21.0.3(transitive)
- Removedajv@6.12.6(transitive)
- Removedansi-regex@4.1.1(transitive)
- Removedansi-styles@3.2.1(transitive)
- Removedasn1@0.2.6(transitive)
- Removedassert-plus@1.0.0(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedaws-sign2@0.7.0(transitive)
- Removedaws4@1.13.2(transitive)
- Removedbcrypt-pbkdf@1.0.2(transitive)
- Removedcaseless@0.12.0(transitive)
- Removedchalk@2.4.2(transitive)
- Removedcolor-convert@1.9.3(transitive)
- Removedcolor-name@1.1.3(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removedcore-util-is@1.0.2(transitive)
- Removeddashdash@1.14.1(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removeddiff-sequences@24.9.0(transitive)
- Removedecc-jsbn@0.1.2(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedextend@3.0.2(transitive)
- Removedextsprintf@1.3.0(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedfast-json-stable-stringify@2.1.0(transitive)
- Removedforever-agent@0.6.1(transitive)
- Removedform-data@2.3.32.5.1(transitive)
- Removedgetpass@0.1.7(transitive)
- Removedhar-schema@2.0.0(transitive)
- Removedhar-validator@5.1.5(transitive)
- Removedhas-flag@3.0.0(transitive)
- Removedhttp-signature@1.2.0(transitive)
- Removedis-typedarray@1.0.0(transitive)
- Removedisstream@0.1.2(transitive)
- Removedjest-diff@24.9.0(transitive)
- Removedjest-get-type@24.9.0(transitive)
- Removedjsbn@0.1.1(transitive)
- Removedjson-schema@0.4.0(transitive)
- Removedjson-schema-traverse@0.4.1(transitive)
- Removedjson-stringify-safe@5.0.1(transitive)
- Removedjsprim@1.4.2(transitive)
- Removedlodash@4.17.21(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removedoauth-sign@0.9.0(transitive)
- Removedperformance-now@2.1.0(transitive)
- Removedpretty-format@24.9.0(transitive)
- Removedpsl@1.9.0(transitive)
- Removedpunycode@2.3.1(transitive)
- Removedqs@6.5.3(transitive)
- Removedreact-is@16.13.1(transitive)
- Removedrequest@2.88.2(transitive)
- Removedrequest-promise-core@1.1.4(transitive)
- Removedrequest-promise-native@1.0.9(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsshpk@1.18.0(transitive)
- Removedstealthy-require@1.1.1(transitive)
- Removedsupports-color@5.5.0(transitive)
- Removedtough-cookie@2.5.0(transitive)
- Removedtunnel-agent@0.6.0(transitive)
- Removedtweetnacl@0.14.5(transitive)
- Removedundici-types@6.19.8(transitive)
- Removeduri-js@4.4.1(transitive)
- Removeduuid@3.4.0(transitive)
- Removedverror@1.10.0(transitive)