Comparing version 3.0.0 to 3.0.1
@@ -1,2 +0,7 @@ | ||
export {}; | ||
import { Train, StationMeta, TrainResponse, StationResponse } from "./types"; | ||
declare const fetchTrain: (trainId: string) => Promise<Train>; | ||
declare const fetchAllTrains: () => Promise<TrainResponse>; | ||
declare const fetchStation: (stationId: string) => Promise<StationMeta>; | ||
declare const fetchAllStations: () => Promise<StationResponse>; | ||
export { fetchTrain, fetchAllTrains, fetchStation, fetchAllStations }; | ||
//# sourceMappingURL=index.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.fetchAllStations = exports.fetchStation = exports.fetchAllTrains = exports.fetchTrain = void 0; | ||
const node_fetch_1 = require("node-fetch"); | ||
const fetchTrain = async (trainId) => { | ||
const res = await (0, node_fetch_1.default)(`https://api-v3.amtraker.com/v3/trains/${trainId}`); | ||
const data = await res.json(); | ||
return data; | ||
}; | ||
exports.fetchTrain = fetchTrain; | ||
const fetchAllTrains = async () => { | ||
@@ -9,2 +16,15 @@ const res = await (0, node_fetch_1.default)("https://api-v3.amtraker.com/v3/trains"); | ||
}; | ||
exports.fetchAllTrains = fetchAllTrains; | ||
const fetchStation = async (stationId) => { | ||
const res = await (0, node_fetch_1.default)(`https://api-v3.amtraker.com/v3/stations/${stationId}`); | ||
const data = await res.json(); | ||
return data; | ||
}; | ||
exports.fetchStation = fetchStation; | ||
const fetchAllStations = async () => { | ||
const res = await (0, node_fetch_1.default)("https://api-v3.amtraker.com/v3/stations"); | ||
const data = await res.json(); | ||
return data; | ||
}; | ||
exports.fetchAllStations = fetchAllStations; | ||
//# sourceMappingURL=index.js.map |
@@ -79,2 +79,7 @@ export interface Train { | ||
} | ||
export interface StaleData { | ||
avgLastUpdate: number; | ||
activeTrains: number; | ||
stale: boolean; | ||
} | ||
//# sourceMappingURL=types.d.ts.map |
{ | ||
"name": "amtrak", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "A simple and easy way to parse data from Amtrak's train tracking API.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
56589
318
0