@simrail-sdk/core
v0.1.1
Published
SimRail Core SDK
Downloads
2
Readme
SimRail Core SDK
This is the Core SDK (community edition) for interacting with the SimRail APIs.
This Core SDK module builds on top of an API module (like @simrail-sdk/api) to provide:
- A more developer-friendly API to prototype with. (where an API module is just about interfacing with SimRail's remote APIs)
- Live updates on specific resources. (servers, stations, trains)
- Event subcriptions on resources.
- Caching of remote API responses.
If you are looking for the SDK module extending on data provided by SimRail's remote APIs, ~~check out~~ wait for the regular SDK module (@simrail-sdk/sdk).
This module requires the use of an API module to be able to extend it. By default
this module will use @simrail-sdk/api. To provide another API module
or a custom one, check out the example Providing a (custom) API or Core API class below.
Content index
[About this module][about-this-module]
[Module dependencies][module-dependencies]
[Module package dependencies][module-package-dependencies]
[Internal module dependencies][internal-module-dependencies]
[Module code statistics][module-code-statistics]
Usage details
Installation
Using NPM:
$ npm i @simrail-sdk/core
or
$ npm i github:simrail-sdk/core#VERSION
Where VERSION specifies the version to install.
Examples
Simple SDK usage
import Sdk from "@simrail-sdk/core";
const sdk = new Sdk({
api: {
endpoints: {
liveData: "https://panel.simrail.eu:8084",
timetable: "https://api1.aws.simrail.eu:8082/api",
},
},
});
//
// Servers
//
// Retrieve a map of Server instances.
const servers = await sdk.servers();
// Retrieve a single Server instance.
const serverCode: Sdk.Server.Code = "en1";
let en1 = servers[serverCode];
// -- or --
en1 = await sdk.server(serverCode);
// Access server data
const isActive = en1.isActive;
const region = en1.region;
// ...
// Update live data (specified in Server.LiveData)
await en1.update();
//
// Stations
//
// Retrieve a map of Station instances.
let stations = await en1.stations();
// -- or --
stations = await sdk.stations(serverCode);
// Retrieve a single Station instance.
const stationCode: Sdk.Station.Code = "KO";
let katowice = stations[stationCode];
// -- or --
katowice = await en1.station(stationCode);
// -- or --
katowice = await sdk.station(serverCode, stationCode);
// Access station data
const difficultyLevel = katowice.difficultyLevel;
const dispatchers = katowice.dispatchers;
...
// Update live data (specified in Station.LiveData)
await katowice.update();
//
// Trains
//
// Retrieve a list of active train numbers.
const activeTrains = await en1.activeTrainNumbers();
// Retrieve a single Train instance.
const trainNumber: Sdk.Train.Number = "4144";
let t4144 = await en1.train(trainNumber);
// -- or --
t4144 = await sdk.train(serverCode, trainNumber);
// Access train data
const arrivesAt = t4144.destination.arrivesAt;
const length = t4144.length;
...
// Access live data
const coords = [t4144.liveData.longitude, t4144.liveData.latitude];
const speed = t4144.liveData.speed;
...Automatic updates and events
import Sdk from "@simrail-sdk/core";
const sdk = new Sdk(...);
const train = await sdk.train("en1", "4144");
//
// Train live data
//
const liveData = train.liveData;
let liveDataSubscription;
if (liveData.available === true) {
// Subscribe to live data events.
liveDataSubscription = liveData.events.subscribe((event) => {
// Filter events by type.
switch (event.type) {
case Sdk.Train.LiveData.Event.Type.AvailableChanged:
console.log(`Value of "LiveData.available" changed to "${event.available}"!`); break;
case Sdk.Train.LiveData.Event.Type.DataUpdated:
console.log(`Value of "LiveData.data" changed to "${JSON.stringify(event.data)}"!`); break;
case Sdk.Train.LiveData.Event.Type.InPlayableAreaChanged:
console.log(`Value of "LiveData.inPlayableArea" changed to "${event.inPlayableArea}"!`); break;
}
});
// Specify the update interval and start auto updates.
liveData.autoUpdateInterval = 10000;
liveData.autoUpdate = true;
}
// When done, cancel the subscription
liveDataSubscription?.unsubscribe();
//
// Train timetables
//
// Subscribe to timetable events.
const timetableSubscription = train.timetable.events.subscribe((event) => {
switch (event.type) {
case Sdk.Train.Timetable.Event.Type.CurrentChanged:
console.log(`Value of "Timetable.current" changed! Next train stop: ${event.current.name}`);
}
});
// Enable live data for some events to be emited.
train.liveData.autoUpdate = true;
// And clean up
timetableSubscription.unsubscribe();TypeScript strict type checking
To enable strict type checking when using TypeScript, install a
Core Setup module like @simrail-sdk/core-setup-pl.
import Sdk from "@simrail-sdk/core";
import { Server, Station, Types } from "@simrail-sdk/core-setup-pl";
// Inject `Types` into the `Sdk` instance to enable strict type checking.
const sdk = new Sdk<Types>(...);
const en1 = sdk.server(Server.Code.EN1);
const en2 = sdk.server("en2");
const będzin = sdk.station("en1", Station.Code.B);
const düsseldorf = sdk.station("en1", "Dü"); // <-- Fails because Düsseldorf doesn't exist.
const katowice = sdk.station("en1", "KO");
const train4144 = sdk.train("en1", "4144");
const train4145 = sdk.train("en1", "4145"); // <-- Fails because 4145 doesn't exist.
// Obtaining a list of server/station codes:
const serverCodes = Object.values(Server.Code);
const stationCodes = Object.values(Station.Code);Working with result caching
import Sdk from "@simrail-sdk/core";
// Cache configuration can be specified at SDK class construction.
const sdk = new Sdk({
api: {
/** Specifies a config for requests to the timetable endpoint. */
timetable: {
cache: {
/**
* Specifies if caching is enabled.
* @default true
*/
enabled: true,
/**
* Specifies for how long a timetable record is cached in seconds.
* This value also specifies the update interval for auto updates.
* @default 1440
*/
retention: 1440,
/**
* Specifies if only one timetable record should be cached.
*
* When set to:
* - `true` only the last timetable record will be cached.
* - `false` a timetable record will be cached for
* each server that was queried for a timetable.
* Use this when you are actively querying multiple servers.
*
* @default true
*/
singleRecordOnly: true,
},
},
/** Specifies a config for requests to the live data endpoint. */
liveData: {
cache: {
// Values displayed are the defaults.
activeServers: { enabled: true, retention: 30 },
activeStations: { enabled: true, retention: 30 },
activeTrains: { enabled: true, retention: 5 },
},
},
...
},
});
// If you need to, flush cached data.
sdk.api.flushCache();
// Or
sdk.api.flushActiveServerCache();
sdk.api.flushActiveStationCache();
sdk.api.flushActiveTrainCache();
sdk.api.flushTimetableCache();
Providing a (custom) API or Core API class
import CoreApi from "@simrail-sdk/api-core-node";
import Api from "@simrail-sdk/api";
import Sdk from "@simrail-sdk/core";
// By default the SDK will use the API class from package `@simrail-sdk/api`.
// To provide another API class or a custom one, just include the instance in the SDK config.
const api = new Api(...);
const sdk = new Sdk({ api }); // <-- Inject API here
// Or alternatively, to provide a different *Core API* class, include this in the API config.
const coreApi = new CoreApi(...);
const api = new Api({ core: coreApi }); // <-- Inject Core API here
const sdk = new Sdk({ api: api }); // <-- Inject API here
API reference
NOTE: The API reference section doesn't account for namespaces, this unfortunately means the documentation below is not entirely complete. Please investigate the TypeScript definition files for the full API.
[
property LiveData.autoUpdate][api-reference-train/liveData/index.ts~LiveData.autoUpdate][
property LiveData.autoUpdateInterval][api-reference-train/liveData/index.ts~LiveData.autoUpdateInterval][
property LiveData.available][api-reference-train/liveData/index.ts~LiveData.available][
property LiveData.data][api-reference-train/liveData/index.ts~LiveData.data][
property LiveData.driver][api-reference-train/liveData/index.ts~LiveData.driver][
property LiveData.inPlayableArea][api-reference-train/liveData/index.ts~LiveData.inPlayableArea][
property LiveData.lastAvailableCheck][api-reference-train/liveData/index.ts~LiveData.lastAvailableCheck][
property LiveData.latitude][api-reference-train/liveData/index.ts~LiveData.latitude][
property LiveData.longitude][api-reference-train/liveData/index.ts~LiveData.longitude][
property LiveData.signal][api-reference-train/liveData/index.ts~LiveData.signal][
property LiveData.speed][api-reference-train/liveData/index.ts~LiveData.speed][
property LiveData.timestamp][api-reference-train/liveData/index.ts~LiveData.timestamp][
property LiveData.timetableIndex][api-reference-train/liveData/index.ts~LiveData.timetableIndex][
property LiveData.vehicles][api-reference-train/liveData/index.ts~LiveData.vehicles][
method LiveData.destroy()][api-reference-train/liveData/index.ts~LiveData.destroy0][
method LiveData.start(autoUpdateInterval)][api-reference-train/liveData/index.ts~LiveData.start0][
method LiveData.stop()][api-reference-train/liveData/index.ts~LiveData.stop0][
method LiveData.update()][api-reference-train/liveData/index.ts~LiveData.update0]
[
class Sdk][api-reference-index.ts~Sdk][
new Sdk.constructor(config)][api-reference-index.ts~Sdk.constructor0][
property Sdk.api][api-reference-index.ts~Sdk.api][
method Sdk.server(serverCode)][api-reference-index.ts~Sdk.server0][
method Sdk.servers()][api-reference-index.ts~Sdk.servers0][
method Sdk.station(serverCode, stationCode)][api-reference-index.ts~Sdk.station0][
method Sdk.stations(serverCode)][api-reference-index.ts~Sdk.stations0][
method Sdk.train(serverCode, trainNumber)][api-reference-index.ts~Sdk.train0]
[
class Server][api-reference-server/index.ts~Server][
new Server.constructor(config, callback)][api-reference-server/index.ts~Server.constructor0][
property Server.code][api-reference-server/index.ts~Server.code][
property Server.id][api-reference-server/index.ts~Server.id][
property Server.name][api-reference-server/index.ts~Server.name][
property Server.region][api-reference-server/index.ts~Server.region][
property Server.sdk][api-reference-server/index.ts~Server.sdk][
property Server.data][api-reference-server/index.ts~Server.data][
property Server.isActive][api-reference-server/index.ts~Server.isActive][
method Server.activeTrainNumbers()][api-reference-server/index.ts~Server.activeTrainNumbers0][
method Server.station(stationCode)][api-reference-server/index.ts~Server.station0][
method Server.stations()][api-reference-server/index.ts~Server.stations0][
method Server.toJson()][api-reference-server/index.ts~Server.toJson0][
method Server.train(number)][api-reference-server/index.ts~Server.train0][
method Server.update()][api-reference-server/index.ts~Server.update0]
[
class Station][api-reference-station/index.ts~Station][
new Station.constructor(config, callback)][api-reference-station/index.ts~Station.constructor0][
property Station.code][api-reference-station/index.ts~Station.code][
property Station.difficultyLevel][api-reference-station/index.ts~Station.difficultyLevel][
property Station.id][api-reference-station/index.ts~Station.id][
property Station.images][api-reference-station/index.ts~Station.images][
property Station.latitude][api-reference-station/index.ts~Station.latitude][
property Station.longitude][api-reference-station/index.ts~Station.longitude][
property Station.name][api-reference-station/index.ts~Station.name][
property Station.prefix][api-reference-station/index.ts~Station.prefix][
property Station.sdk][api-reference-station/index.ts~Station.sdk][
property Station.serverCode][api-reference-station/index.ts~Station.serverCode][
property Station.data][api-reference-station/index.ts~Station.data][
property Station.dispatchers][api-reference-station/index.ts~Station.dispatchers][
method Station.server()][api-reference-station/index.ts~Station.server0][
method Station.switchServer(serverCode)][api-reference-station/index.ts~Station.switchServer0][
method Station.toJson()][api-reference-station/index.ts~Station.toJson0][
method Station.update()][api-reference-station/index.ts~Station.update0]
[
class Timetable][api-reference-train/timetable/index.ts~Timetable][
new Timetable.constructor(config, callback)][api-reference-train/timetable/index.ts~Timetable.constructor0][
property Timetable.events][api-reference-train/timetable/index.ts~Timetable.events][
property Timetable.sdk][api-reference-train/timetable/index.ts~Timetable.sdk][
property Timetable.train][api-reference-train/timetable/index.ts~Timetable.train][
property Timetable.current][api-reference-train/timetable/index.ts~Timetable.current][
property Timetable.currentIndex][api-reference-train/timetable/index.ts~Timetable.currentIndex][
property Timetable.entries][api-reference-train/timetable/index.ts~Timetable.entries][
property Timetable.history][api-reference-train/timetable/index.ts~Timetable.history][
property Timetable.size][api-reference-train/timetable/index.ts~Timetable.size][
property Timetable.upcoming][api-reference-train/timetable/index.ts~Timetable.upcoming][
method Timetable.destroy()][api-reference-train/timetable/index.ts~Timetable.destroy0][
method Timetable.entry(index)][api-reference-train/timetable/index.ts~Timetable.entry0][
method Timetable.update()][api-reference-train/timetable/index.ts~Timetable.update0]
[
class Train][api-reference-train/index.ts~Train][
new Train.constructor(config, callback)][api-reference-train/index.ts~Train.constructor0][
property Train.continuesAs][api-reference-train/index.ts~Train.continuesAs][
property Train.destination][api-reference-train/index.ts~Train.destination][
property Train.id][api-reference-train/index.ts~Train.id][
property Train.intNumber][api-reference-train/index.ts~Train.intNumber][
property Train.length][api-reference-train/index.ts~Train.length][
property Train.locoType][api-reference-train/index.ts~Train.locoType][
property Train.name][api-reference-train/index.ts~Train.name][
property Train.number][api-reference-train/index.ts~Train.number][
property Train.origin][api-reference-train/index.ts~Train.origin][
property Train.sdk][api-reference-train/index.ts~Train.sdk][
property Train.serverCode][api-reference-train/index.ts~Train.serverCode][
property Train.weight][api-reference-train/index.ts~Train.weight][
property Train.data][api-reference-train/index.ts~Train.data][
property Train.liveData][api-reference-train/index.ts~Train.liveData][
property Train.timetable][api-reference-train/index.ts~Train.timetable][
method Train.destroy()][api-reference-train/index.ts~Train.destroy0][
method Train.server()][api-reference-train/index.ts~Train.server0][
method Train.switchServer(serverCode)][api-reference-train/index.ts~Train.switchServer0][
method Train.toJson()][api-reference-train/index.ts~Train.toJson0][
method Train.update()][api-reference-train/index.ts~Train.update0]
[
const DEFAULT_ACTIVE_SERVER_RETENTION][api-reference-node_modules/@simrail-sdk/api/index.d.ts~DEFAULT_ACTIVE_SERVER_RETENTION][
const DEFAULT_ACTIVE_STATION_RETENTION][api-reference-node_modules/@simrail-sdk/api/index.d.ts~DEFAULT_ACTIVE_STATION_RETENTION][
const DEFAULT_ACTIVE_TRAIN_RETENTION][api-reference-node_modules/@simrail-sdk/api/index.d.ts~DEFAULT_ACTIVE_TRAIN_RETENTION][
const DEFAULT_TIMETABLE_RETENTION][api-reference-node_modules/@simrail-sdk/api/index.d.ts~DEFAULT_TIMETABLE_RETENTION][
const DEFAULT_UPDATE_INTERVAL][api-reference-train/liveData/index.ts~DEFAULT_UPDATE_INTERVAL][
const VERSION][api-reference-index.ts~VERSION][
const VMAX][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~VMAX][
const VMAX_VALUE][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~VMAX_VALUE][
enum Type][api-reference-train/timetable/index.ts~Type]- [
member Type.CurrentChanged][api-reference-train/timetable/index.ts~Type.CurrentChanged]
- [
[
function exception(code, message)][api-reference-common/index.ts~exception0][
function get(config)][api-reference-train/timetable/index.ts~get0][
interface ActiveServersUpdated][api-reference-node_modules/@simrail-sdk/api/index.d.ts~ActiveServersUpdated]- [
property ActiveServersUpdated.activeServers][api-reference-node_modules/@simrail-sdk/api/index.d.ts~ActiveServersUpdated.activeServers]
- [
[
interface ActiveStationsUpdated][api-reference-node_modules/@simrail-sdk/api/index.d.ts~ActiveStationsUpdated]- [
property ActiveStationsUpdated.activeStations][api-reference-node_modules/@simrail-sdk/api/index.d.ts~ActiveStationsUpdated.activeStations]
- [
[
interface ActiveTrainsUpdated][api-reference-node_modules/@simrail-sdk/api/index.d.ts~ActiveTrainsUpdated]- [
property ActiveTrainsUpdated.activeTrains][api-reference-node_modules/@simrail-sdk/api/index.d.ts~ActiveTrainsUpdated.activeTrains]
- [
[
interface AutoUpdateChanged][api-reference-train/liveData/index.ts~AutoUpdateChanged][
property AutoUpdateChanged.autoUpdate][api-reference-train/liveData/index.ts~AutoUpdateChanged.autoUpdate][
property AutoUpdateChanged.autoUpdateInterval][api-reference-train/liveData/index.ts~AutoUpdateChanged.autoUpdateInterval]
[
interface AutoUpdateIntervalChanged][api-reference-train/liveData/index.ts~AutoUpdateIntervalChanged][
property AutoUpdateIntervalChanged.autoUpdate][api-reference-train/liveData/index.ts~AutoUpdateIntervalChanged.autoUpdate][
property AutoUpdateIntervalChanged.autoUpdateInterval][api-reference-train/liveData/index.ts~AutoUpdateIntervalChanged.autoUpdateInterval]
[
interface AvailableChanged][api-reference-train/liveData/index.ts~AvailableChanged]- [
property AvailableChanged.available][api-reference-train/liveData/index.ts~AvailableChanged.available]
- [
[
interface Base][api-reference-train/timetable/index.ts~Base][
property Base.timetable][api-reference-train/timetable/index.ts~Base.timetable][
property Base.type][api-reference-train/timetable/index.ts~Base.type]
[
interface Bot][api-reference-train/liveData/index.ts~Bot][
interface Cache][api-reference-node_modules/@simrail-sdk/api/index.d.ts~Cache][
property Cache.activeServers][api-reference-node_modules/@simrail-sdk/api/index.d.ts~Cache.activeServers][
property Cache.activeStations][api-reference-node_modules/@simrail-sdk/api/index.d.ts~Cache.activeStations][
property Cache.activeTrains][api-reference-node_modules/@simrail-sdk/api/index.d.ts~Cache.activeTrains]
[
interface Config][api-reference-train/timetable/index.ts~Config][
property Config.data][api-reference-train/timetable/index.ts~Config.data][
property Config.sdk][api-reference-train/timetable/index.ts~Config.sdk][
property Config.train][api-reference-train/timetable/index.ts~Config.train]
[
interface CurrentChanged][api-reference-train/timetable/index.ts~CurrentChanged]- [
property CurrentChanged.current][api-reference-train/timetable/index.ts~CurrentChanged.current]
- [
[
interface Data][api-reference-train/timetable/entry/index.ts~Data][
property Data.arrivesAt][api-reference-train/timetable/entry/index.ts~Data.arrivesAt][
property Data.departsAt][api-reference-train/timetable/entry/index.ts~Data.departsAt][
property Data.first][api-reference-train/timetable/entry/index.ts~Data.first][
property Data.index][api-reference-train/timetable/entry/index.ts~Data.index][
property Data.kilometrage][api-reference-train/timetable/entry/index.ts~Data.kilometrage][
property Data.last][api-reference-train/timetable/entry/index.ts~Data.last][
property Data.line][api-reference-train/timetable/entry/index.ts~Data.line][
property Data.localTrack][api-reference-train/timetable/entry/index.ts~Data.localTrack][
property Data.maxSpeed][api-reference-train/timetable/entry/index.ts~Data.maxSpeed][
property Data.name][api-reference-train/timetable/entry/index.ts~Data.name][
property Data.platform][api-reference-train/timetable/entry/index.ts~Data.platform][
property Data.pointId][api-reference-train/timetable/entry/index.ts~Data.pointId][
property Data.radioChannels][api-reference-train/timetable/entry/index.ts~Data.radioChannels][
property Data.stationCategory][api-reference-train/timetable/entry/index.ts~Data.stationCategory][
property Data.supervisedBy][api-reference-train/timetable/entry/index.ts~Data.supervisedBy][
property Data.trainType][api-reference-train/timetable/entry/index.ts~Data.trainType][
property Data.type][api-reference-train/timetable/entry/index.ts~Data.type]
[
interface DataUpdated][api-reference-train/liveData/index.ts~DataUpdated]- [
property DataUpdated.data][api-reference-train/liveData/index.ts~DataUpdated.data]
- [
[
interface Destination][api-reference-train/index.ts~Destination]- [
property Destination.arrivesAt][api-reference-train/index.ts~Destination.arrivesAt]
- [
[
interface Disabled][api-reference-node_modules/@simrail-sdk/api/index.d.ts~Disabled][
interface DispatchedBy][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~DispatchedBy][
property DispatchedBy.ServerCode][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~DispatchedBy.ServerCode][
property DispatchedBy.SteamId][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~DispatchedBy.SteamId]
[
interface Dispatcher][api-reference-station/index.ts~Dispatcher]- [
property Dispatcher.steamId][api-reference-station/index.ts~Dispatcher.steamId]
- [
[
interface Enabled][api-reference-node_modules/@simrail-sdk/api/index.d.ts~Enabled][
property Enabled.retention][api-reference-node_modules/@simrail-sdk/api/index.d.ts~Enabled.retention][
property Enabled.singleRecordOnly][api-reference-node_modules/@simrail-sdk/api/index.d.ts~Enabled.singleRecordOnly]
[
interface Endpoints][api-reference-node_modules/@simrail-sdk/api-core-node/index.d.ts~Endpoints][
property Endpoints.liveData][api-reference-node_modules/@simrail-sdk/api-core-node/index.d.ts~Endpoints.liveData][
property Endpoints.timetable][api-reference-node_modules/@simrail-sdk/api-core-node/index.d.ts~Endpoints.timetable]
[
interface Error][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Error][
interface Images][api-reference-station/index.ts~Images][
property Images.primary][api-reference-station/index.ts~Images.primary][
property Images.secondary][api-reference-station/index.ts~Images.secondary]
[
interface InPlayableAreaChanged][api-reference-train/liveData/index.ts~InPlayableAreaChanged]- [
property InPlayableAreaChanged.inPlayableArea][api-reference-train/liveData/index.ts~InPlayableAreaChanged.inPlayableArea]
- [
[
interface LiveData][api-reference-station/index.ts~LiveData]- [
property LiveData.dispatchers][api-reference-station/index.ts~LiveData.dispatchers]
- [
[
interface Origin][api-reference-train/index.ts~Origin]- [
property Origin.departsAt][api-reference-train/index.ts~Origin.departsAt]
- [
[
interface OriginDestinationBase][api-reference-train/index.d.ts~OriginDestinationBase]- [
property OriginDestinationBase.stationName][api-reference-train/index.d.ts~OriginDestinationBase.stationName]
- [
[
interface Raw][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~Raw][
property Raw.arrivalTime][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~Raw.arrivalTime][
property Raw.mileage][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~Raw.mileage][
property Raw.platform][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~Raw.platform][
property Raw.radioChanels][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~Raw.radioChanels][
property Raw.stationCategory][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~Raw.stationCategory][
property Raw.stopType][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~Raw.stopType][
property Raw.supervisedBy][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~Raw.supervisedBy][
property Raw.track][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~Raw.track]
[
interface Regular][api-reference-node_modules/@simrail-sdk/api/index.d.ts~Regular][
interface Server][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Server][
property Server.id][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Server.id][
property Server.isActive][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Server.isActive][
property Server.serverCode][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Server.serverCode][
property Server.serverName][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Server.serverName][
property Server.serverRegion][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Server.serverRegion]
[
interface Signal][api-reference-train/liveData/index.ts~Signal][
property Signal.data][api-reference-train/liveData/index.ts~Signal.data][
property Signal.distance][api-reference-train/liveData/index.ts~Signal.distance][
property Signal.id][api-reference-train/liveData/index.ts~Signal.id][
property Signal.speed][api-reference-train/liveData/index.ts~Signal.speed]
[
interface Station][api-reference-node_modules/@simrail-sdk/api/index.d.ts~Station]- [
property Station.code][api-reference-node_modules/@simrail-sdk/api/index.d.ts~Station.code]
- [
[
interface Successful][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Successful][
property Successful.count][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Successful.count][
property Successful.data][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Successful.data][
property Successful.description][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Successful.description]
[
interface Timetable][api-reference-node_modules/@simrail-sdk/api/index.d.ts~Timetable]- [
property Timetable.cache][api-reference-node_modules/@simrail-sdk/api/index.d.ts~Timetable.cache]
- [
[
interface TimetableIndexChanged][api-reference-train/liveData/index.ts~TimetableIndexChanged]- [
property TimetableIndexChanged.timetableIndex][api-reference-train/liveData/index.ts~TimetableIndexChanged.timetableIndex]
- [
[
interface TimetableUpdated][api-reference-node_modules/@simrail-sdk/api/index.d.ts~TimetableUpdated]- [
property TimetableUpdated.timetable][api-reference-node_modules/@simrail-sdk/api/index.d.ts~TimetableUpdated.timetable]
- [
[
interface Train][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Train][
property Train.endStation][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Train.endStation][
property Train.id][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Train.id][
property Train.runId][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Train.runId][
property Train.serverCode][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Train.serverCode][
property Train.startStation][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Train.startStation][
property Train.trainData][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Train.trainData][
property Train.trainName][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Train.trainName][
property Train.trainNoLocal][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Train.trainNoLocal][
property Train.type][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Train.type][
property Train.vehicles][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Train.vehicles]
[
interface TrainData][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~TrainData][
property TrainData.controlledBySteamId][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~TrainData.controlledBySteamId][
property TrainData.distanceToSignalInFront][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~TrainData.distanceToSignalInFront][
property TrainData.inBorderStationArea][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~TrainData.inBorderStationArea][
property TrainData.latitude][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~TrainData.latitude][
property TrainData.longitude][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~TrainData.longitude][
property TrainData.signalInFront][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~TrainData.signalInFront][
property TrainData.signalInFrontSpeed][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~TrainData.signalInFrontSpeed][
property TrainData.vdDelayedTimetableIndex][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~TrainData.vdDelayedTimetableIndex][
property TrainData.velocity][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~TrainData.velocity]
[
interface Types][api-reference-train/timetable/entry/index.ts~Types][
interface User][api-reference-train/liveData/index.ts~User]- [
property User.steamId][api-reference-train/liveData/index.ts~User.steamId]
- [
[
interface WithCore][api-reference-node_modules/@simrail-sdk/api/index.d.ts~WithCore]- [
property WithCore.core][api-reference-node_modules/@simrail-sdk/api/index.d.ts~WithCore.core]
- [
[
type ActiveServers][api-reference-node_modules/@simrail-sdk/api/index.d.ts~ActiveServers][
type ActiveStations][api-reference-node_modules/@simrail-sdk/api/index.d.ts~ActiveStations][
type ActiveTrains][api-reference-node_modules/@simrail-sdk/api/index.d.ts~ActiveTrains][
type ApiResponse][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~ApiResponse][
type ArrivalTime][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~ArrivalTime][
type AutoUpdate][api-reference-train/liveData/index.ts~AutoUpdate][
type AutoUpdateInterval][api-reference-train/liveData/index.ts~AutoUpdateInterval][
type AutoUpdateServer][api-reference-node_modules/@simrail-sdk/api/index.d.ts~AutoUpdateServer][
type Available][api-reference-train/liveData/index.ts~Available][
type Cache][api-reference-node_modules/@simrail-sdk/api/index.d.ts~Cache][
type Callback][api-reference-train/timetable/index.ts~Callback][
type Code][api-reference-node_modules/@simrail-sdk/api/index.d.ts~Code][
type Config][api-reference-node_modules/@simrail-sdk/api/index.d.ts~Config][
type ContinuesAs][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~ContinuesAs][
type ControlledBySteamId][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~ControlledBySteamId][
type Count][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Count][
type DepartureTime][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~DepartureTime][
type Description][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Description][
type DifficultyLevel][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~DifficultyLevel][
type DisplayedTrainNumber][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~DisplayedTrainNumber][
type DistanceToSignalInFront][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~DistanceToSignalInFront][
type Driver][api-reference-train/liveData/index.ts~Driver][
type Emitter][api-reference-train/timetable/index.ts~Emitter][
type EndsAt][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~EndsAt][
type EndStation][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~EndStation][
type Event][api-reference-train/timetable/index.ts~Event][
type First][api-reference-train/timetable/entry/index.ts~First][
type GetUpdateDataFunction][api-reference-train/liveData/index.ts~GetUpdateDataFunction][
type Id][api-reference-train/liveData/index.ts~Id][
type ImageUrl][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~ImageUrl][
type InBorderStationArea][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~InBorderStationArea][
type Index][api-reference-train/timetable/entry/index.ts~Index][
type IsActive][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~IsActive][
type Kilometrage][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~Kilometrage][
type Last][api-reference-train/timetable/entry/index.ts~Last][
type LastAvailableCheck][api-reference-train/liveData/index.ts~LastAvailableCheck][
type Latititude][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Latititude][
type Latititute][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Latititute][
type Latitude][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Latitude][
type Line][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~Line][
type List][api-reference-train/timetable/entry/index.ts~List][
type LocoType][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~LocoType][
type Longitude][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Longitude][
type Longitute][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Longitute][
type Map][api-reference-station/index.ts~Map][
type MaxSpeed][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~MaxSpeed][
type Mileage][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~Mileage][
type Mutable][api-reference-common/index.ts~Mutable][
type Name][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Name][
type NameForPerson][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~NameForPerson][
type NameOfPoint][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~NameOfPoint][
type NoCache][api-reference-node_modules/@simrail-sdk/api/index.d.ts~NoCache][
type Number][api-reference-train/index.ts~Number][
type Platform][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~Platform][
type PointId][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~PointId][
type Prefix][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Prefix][
type RadioChannel][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~RadioChannel][
type RadioChannels][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~RadioChannels][
type Result][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Result][
type Retention][api-reference-node_modules/@simrail-sdk/api/index.d.ts~Retention][
type RunId][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~RunId][
type ServerCode][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~ServerCode][
type ServerName][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~ServerName][
type ServerRegion][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~ServerRegion][
type SignalInFront][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~SignalInFront][
type SignalInFrontSpeed][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~SignalInFrontSpeed][
type SingleRecordOnly][api-reference-node_modules/@simrail-sdk/api/index.d.ts~SingleRecordOnly][
type Size][api-reference-train/timetable/index.ts~Size][
type StartsAt][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~StartsAt][
type StartStation][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~StartStation][
type StationCategory][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~StationCategory][
type SteamId][api-reference-station/index.ts~SteamId][
type StopType][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~StopType][
type SupervisedBy][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~SupervisedBy][
type Time][api-reference-train/index.ts~Time][
type Timestamp][api-reference-train/liveData/index.ts~Timestamp][
type Track][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~Track][
type TrainLength][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~TrainLength][
type TrainName][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~TrainName][
type TrainNoInternational][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~TrainNoInternational][
type TrainNoLocal][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~TrainNoLocal][
type TrainType][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~TrainType][
type TrainWeight][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~TrainWeight][
type Type][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Type][
type UpdateDataFunction][api-reference-train/liveData/index.ts~UpdateDataFunction][
type Url][api-reference-node_modules/@simrail-sdk/api-core-node/index.d.ts~Url][
type VdDelayedTimetableIndex][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~VdDelayedTimetableIndex][
type Vehicle][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Vehicle][
type Vehicles][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Vehicles][
type Velocity][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Velocity][
type Version][api-reference-node_modules/@simrail-sdk/api/index.d.ts~Version]
class Entry ↑
Implements: [Data][api-reference-train/timetable/entry/index.ts~Data]
| Type params: | Extends | Optional | Default |
| ------------ | --------- | ---------- | --------- |
| Types | [Entry.Types][api-reference-train/timetable/entry/index.ts~Types] | No | N/A |
| EntryType | [Entry.Type][api-reference-train/timetable/entry/index.ts~Type] | Yes | [Entry.Type][api-reference-train/timetable/entry/index.ts~Type] |
Since: 0.1.0
Definition: train/timetable/entry/index.ts:23
new Entry.constructor(config) ↑
| Type params: | Extends | Optional | Default |
| ------------ | --------- | ---------- | --------- |
| Types | [Types][api-reference-train/timetable/entry/index.ts~Types]<Types> | No | N/A |
| EntryType | [Type][api-reference-train/timetable/entry/index.ts~Type] | Yes | [Type][api-reference-train/timetable/entry/index.ts~Type] |
| Arguments: | Type |
| ---------- | ------ |
| config | [Config][api-reference-train/timetable/entry/index.ts~Config]<Types | EntryType> |
Returns: Entry<Types | EntryType>
Since: 0.1.0
Definition: train/timetable/entry/index.ts:97
property Entry.data ↑
read-only
Type: [Data][api-reference-train/timetable/entry/index.ts~Data]<EntryType>
Since: 0.1.0
Definition: train/timetable/entry/index.ts:27
property Entry.timetable ↑
read-only
Type: [Timetable][api-reference-train/timetable/index.ts~Timetable]<Types>
Since: 0.1.0
Definition: train/timetable/entry/index.ts:25
property Entry.arrivesAt ↑
read-only
Since: 0.1.0
Definition: train/timetable/entry/index.ts:29
property Entry.departsAt ↑
read-only
Since: 0.1.0
Definition: train/timetable/entry/index.ts:33
property Entry.first ↑
read-only
Since: 0.1.0
Definition: train/timetable/entry/index.ts:37
property Entry.index ↑
read-only
Since: 0.1.0
Definition: train/timetable/entry/index.ts:41
property Entry.kilometrage ↑
read-only
Since: 0.1.0
Definition: train/timetable/entry/index.ts:45
property Entry.last ↑
read-only
Since: 0.1.0
Definition: train/timetable/entry/index.ts:49
property Entry.line ↑
read-only
Since: 0.1.0
Definition: train/timetable/entry/index.ts:53
property Entry.localTrack ↑
read-only
Since: 0.1.0
Definition: train/timetable/entry/index.ts:57
property Entry.maxSpeed ↑
read-only
Since: 0.1.0
Definition: train/timetable/entry/index.ts:61
property Entry.name ↑
read-only
Since: 0.1.0
Definition: train/timetable/entry/index.ts:65
property Entry.platform ↑
read-only
Since: 0.1.0
Definition: train/timetable/entry/index.ts:69
property Entry.pointId ↑
read-only
Since: 0.1.0
Definition: train/timetable/entry/index.ts:73
property Entry.radioChannels ↑
read-only
Since: 0.1.0
Definition: train/timetable/entry/index.ts:77
property Entry.stationCategory ↑
read-only
Since: 0.1.0
Definition: train/timetable/entry/index.ts:81
property Entry.supervisedBy ↑
read-only
Since: 0.1.0
Definition: train/timetable/entry/index.ts:85
property Entry.trainType ↑
read-only
Since: 0.1.0
Definition: train/timetable/entry/index.ts:89
property Entry.type ↑
read-only
Since: 0.1.0
Definition: train/timetable/entry/index.ts:93
method Entry.next() ↑
Returns: undefined | Entry<Types | [Type][api-reference-train/timetable/entry/index.ts~Type]>
Since: 0.1.0
Definition: train/timetable/entry/index.ts:102
method Entry.previous() ↑
Returns: undefined | Entry<Types | [Type][api-reference-train/timetable/entry/index.ts~Type]>
Since: 0.1.0
Definition: train/timetable/entry/index.ts:108
class LiveData ↑
Specifies live data of a train.
See LiveData.get() for an awaitable constructor method.
Implements: [Data][api-reference-train/liveData/index.ts~Data]
| Type params: | Extends | Description |
| ------------ | --------- | ------------- |
| Types | [LiveData.Train.Types][api-reference-train/index.ts~Types] | Type information about the LiveData and SDK. |
Since: 0.1.0
Definition: train/liveData/index.ts:36
new LiveData.constructor(config, callback) ↑
| Type params: | Extends |
| ------------ | --------- |
| Types | [Types][api-reference-train/index.ts~Types]<string | string | string | string | Types> |
| Arguments: | Type |
| ---------- | ------ |
| config | [Config][api-reference-train/liveData/index.ts~Config]<Types> |
| callback | [Callback][api-reference-train/liveData/index.ts~Callback]<Types> |
Returns: LiveData<Types>
Since: 0.1.0
Definition: train/liveData/index.ts:214
property LiveData.events ↑
read-only
Specifies a live data event emitter.
Type: [Emitter][api-reference-train/liveData/index.ts~Emitter]<Types>
Since: 0.1.0
Definition: train/liveData/index.ts:39
property LiveData.sdk ↑
read-only
Specifies a reference to the Sdk class instance.
Type: [Sdk][api-reference-index.ts~Sdk]<Types>
Since: 0.1.0
Definition: train/liveData/index.ts:42
property LiveData.train ↑
read-only
Specifies a reference to the Train the live data belongs to.
Type: [Train][api-reference-train/index.ts~Train]<Types>
Since: 0.1.0
Definition: train/liveData/index.ts:45
