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

@flow-js/tridot

v1.6.0

Published

Collection of tools to interact with Tridot

Downloads

342

Readme

@flow-js/tridot

An unofficial JavaScript client for the Tridot athlete API.

Note This is not affiliated with or endorsed by Tridot. The library calls the same endpoints used by the Tridot web app and may break at any time.

For a runnable end-to-end example (login, walk two weeks of training, and export each session as a .fit file plus its raw JSON), see examples/example.js.

Install

npm install @flow-js/tridot

Requires Node.js 18+ (uses the global fetch).

Quick start

import { createClient, login } from '@flow-js/tridot';

const profile = await login('[email protected]', 'my-password');

const tridot = createClient({
  token: profile.authToken,
  athleteId: profile.athleteId,
});

const day = await tridot.dayDetails('2026-07-30');
console.log(day);

API

login(email, password, options?)

Authenticates against Tridot and returns the response body, including authToken and the athlete profile.

const profile = await login('[email protected]', 'pw');
profile.authToken; // string
profile.athleteId; // number

options is forwarded to the underlying request (e.g. fetchImpl, baseUrl).

createClient({ token, athleteId, baseUrl?, fetchImpl? })

Creates a client bound to one athlete + auth token.

| Option | Required | Description | | ------------ | -------- | -------------------------------------------------------------------- | | token | yes | Bearer token returned by login() | | athleteId | yes | Athlete (member) id | | baseUrl | no | Override the API base URL (default https://api.tridot.com) | | fetchImpl | no | Custom fetch implementation (e.g. for tests or older Node versions) |

The returned client exposes:

client.dayDetails(date)

Fetches the schedule for a single day. date is YYYY-MM-DD.

const day = await tridot.dayDetails('2026-07-30');

client.createSession(session)

Creates a strength/custom session on the athlete's calendar.

const created = await tridot.createSession({
  name: 'Push day',
  date: '04/28/2026',
  time: '6:00 AM',
  phaseId: 1234567,         // required
  durationSeconds: 3600,    // optional, default 3600
  sessionType: 'strength',  // optional, default 'strength'
  location: 'Home',         // optional
  sessionDetail: {
    warmUp: '10 min easy bike',
    mainSet: '5x5 squats @ 80%',
    coolDown: 'Stretching',
  },
});

Required fields: name, date, time, phaseId. All other fields fall back to sensible defaults (see src/payloads.js).

client.updateSessionTime(sessionId, time)

Updates the start time of an existing session.

await tridot.updateSessionTime(created.sessionId, '7:00 AM');

client.pushWorkout(sessionId, vendorName, location)

Pushes a session to a connected third-party vendor (e.g. Garmin Connect).

await tridot.pushWorkout(created.sessionId, 'GARMIN', {
  latitude: 51.90891345474881,
  longitude: 4.487193278384377,
  name: 'HOME',
});

location is required and must be { latitude, longitude, name }.

client.exportWorkout(sessionId, options?)

Downloads an exported workout file for a session (the same export the Tridot web app produces). Resolves to a BinaryResponse:

const workout = await tridot.exportWorkout(session.sessionId, {
  fileType: 'FIT',   // 'FIT' | 'MRC' | 'ZWO' | 'ERG', default 'FIT'
  metric: 'PACE',    // 'POWER' | 'HR' | 'PACE',       default 'PACE'
});

await writeFile('workout.fit', Buffer.from(workout.arrayBuffer));

options (all optional):

| Field | Default | Description | | ------------------------- | -------- | ------------------------------------------------ | | fileType | 'FIT' | One of 'FIT', 'MRC', 'ZWO', 'ERG' | | metric | 'PACE' | Intensity metric: 'POWER', 'HR', 'PACE' | | extraTimeBeforeWarmUp | 0 | Seconds prepended to the warm-up | | extraTimeBeforeMainSet | 0 | Seconds inserted between warm-up and main set | | extraTimeAfterMainSet | 0 | Seconds appended to the main set | | exportHrForLowIntensity | true | Include HR targets for low-intensity intervals |

The returned object is { arrayBuffer, contentType, contentDisposition }.

Lower-level building blocks

The library also exports a handful of primitives in case you need to call endpoints directly:

import { request, TridotHttpError, buildSessionPayload } from '@flow-js/tridot';
  • request(path, options) — thin wrapper around fetch that handles the Tridot-specific headers, base URL, and JSON parsing.
  • TridotHttpError — thrown for any non-2xx response. Has status, statusText, url, and parsed body.
  • buildSessionPayload(args) — constructs the full session-creation payload (with all six empty zones, etc.) without sending it.

License

ISC