npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

trias-js

v0.0.1

Published

TypeScript client for TRIAS 1.2 passenger information endpoints

Downloads

85

Readme

trias-js

TypeScript client for TRIAS 1.2 passenger information endpoints.

This library is built for real TRIAS 1.2 deployments such as EFA/KVV-style endpoints. It provides:

  • typed helpers for LocationInformationRequest and TripRequest
  • generic support for all TRIAS 1.2 service and subscription request families
  • XML request building and XML response parsing
  • structured HTTP and parse errors
  • ESM output built with tsdown
  • tests with vitest

Status

trias-js is currently focused on TRIAS 1.2 only.

This is deliberate. Real deployments often reject newer schema versions even when the documentation or XSD set suggests otherwise.

Install

npm install trias-js

Quick Start

import { TriasClient } from "trias-js";

const client = new TriasClient({
  endpoint: "https://projekte.kvv-efa.de/severtrias/trias",
  requestorRef: "YOUR_REQUESTOR_REF",
  language: "de",
});

const locations = await client.locationInformation({
  locationName: "Karlsruhe Hauptbahnhof",
  types: ["stop"],
  numberOfResults: 5,
});

console.log(locations.results);

Trip Example

import { TriasClient } from "trias-js";

const client = new TriasClient({
  endpoint: "https://projekte.kvv-efa.de/severtrias/trias",
  requestorRef: "YOUR_REQUESTOR_REF",
});

const trips = await client.trip({
  origin: {
    type: "stopPoint",
    ref: "de:08212:90",
    name: "Karlsruhe Hauptbahnhof",
  },
  destination: {
    type: "stopPoint",
    ref: "de:08212:1011",
    name: "KA Marktplatz (Pyramide U)",
  },
  departureTime: "2026-03-20T21:10:00+01:00",
  numberOfResults: 3,
  includeIntermediateStops: true,
});

console.log(trips.trips);

Generic Endpoint Support

Every TRIAS 1.2 request family can be sent through the generic API.

import { TriasClient } from "trias-js";

const client = new TriasClient({
  endpoint: "https://example.com/trias",
  requestorRef: "YOUR_REQUESTOR_REF",
});

const rawResponse = await client.request("StopEventRequest", {
  Location: {
    LocationRef: {
      StopPointRef: "de:08212:90",
      LocationName: {
        Text: "Karlsruhe Hauptbahnhof",
        Language: "de",
      },
    },
    DepArrTime: "2026-03-20T21:10:00+01:00",
  },
});

console.log(rawResponse.parsed);

Supported constants:

  • TRIAS_SERVICE_REQUESTS
  • TRIAS_SUBSCRIPTION_REQUESTS
  • TRIAS_VERSIONS

API

new TriasClient(options)

Options:

  • endpoint: TRIAS HTTP endpoint
  • requestorRef: requestor reference sent as siri:RequestorRef
  • language: optional TRIAS language preference
  • timeoutMs: request timeout, default 15000
  • fetch: optional custom fetch implementation
  • headers: optional extra headers

High-level methods

  • locationInformation(request)
  • trip(request)
  • raw(xml)

Generic methods

  • request(requestName, body)
  • subscribe(requestName, body)
  • requestGeneric({ requestName, body })
  • buildGenericServiceRequest(requestName, body, requestTimestamp?)
  • buildGenericSubscriptionRequest(requestName, body, requestTimestamp?)

Error Handling

The library exposes:

  • TriasError
  • TriasHttpError
  • TriasParseError

TriasHttpError includes the HTTP status code, request XML, and response body.

Development

npm install
npm run check
npm test
npm run build

License

MIT