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

@thingmate/time-series

v0.1.1

Published

Time series

Readme

npm (scoped) npm NPM npm type definitions

@thingmate/time-series

Abstract data structures and classes for time series data.

📦 Installation

yarn add @thingmate/time-series
# or
npm install @thingmate/time-series --save

📜 Documentation

declare abstract class TimeSeries<GValue> implements AsyncDisposable {
  /**
   * Adds a new entry with a specific time and value to the time series.
   *
   * @param {number} time - The timestamp (in seconds) associated with the value to be added.
   * @param {GValue} value - The value to be added, associated with the specified time.
   * @returns {Promise<void>} A promise that resolves when the entry is successfully added.
   */
  push(time: number, value: GValue): Promise<void>;

  /**
   * Inserts an array of time-series entries into the underlying time series database.
   *
   * @param {readonly TimeSeriesEntry<GValue>[]} entries - An array of time-series entries to be inserted. Each entry contains a timestamp (in seconds) and associated value of type GValue.
   * @returns {Promise<void>} A promise that resolves when the insertion operation is complete.
   */
  abstract insert(entries: readonly TimeSeriesEntry<GValue>[]): Promise<void>;

  /**
   * Selects a subset of time series data based on the provided options.
   *
   * @param {TimeSeriesSelectOptions} [options] - Configuration options to filter and customize the selection of time series data.
   * @returns {Promise<readonly TimeSeriesEntry<GValue>[]>} A promise that resolves to an array of time series entries matching the specified criteria.
   */
  abstract select(options?: TimeSeriesSelectOptions): Promise<readonly TimeSeriesEntry<GValue>[]>;

  /**
   * Deletes a subset of time series data based on the provided options.
   *
   * @param {TimeSeriesDeleteOptions} [options] - Optional parameters that define the criteria for deletion.
   * @returns {Promise<void>} A promise that resolves when the delete operation is completed.
   */
  abstract delete(options?: TimeSeriesDeleteOptions): Promise<void>;

  /**
   * Drops all the data from the time series database.
   *
   * @returns {Promise<void>} A promise that resolves when the drop operation is completed.
   */
  abstract drop(): Promise<void>;

  /**
   * Flushes all pending operations.
   *
   * @returns {Promise<void>} A promise that resolves when all pending operations are completed.
   */
  abstract flush(): Promise<void>;

  /**
   * Implementation of the `AsyncDisposable` interface, that flushes all pending operations when the time series is disposed.
   *
   * @returns {Promise<void>} A promise that resolves once the cleanup process is completed.
   */
  [Symbol.asyncDispose](): Promise<void>;
}
/**
 * Represents a single entry in a time series, containing a timestamp (in seconds) and an associated value.
 */
interface TimeSeriesEntry<GValue> {
  readonly time: number;
  readonly value: GValue;
}

/**
 * This interface is used to define the start and end points of a time range provided to a time series operation.
 * The time is represented as a Unix timestamp in seconds.
 *
 * The `from` value specifies the starting point of the range,
 * while the `to` value specifies the endpoint (included).
 */
interface TimeSeriesTimeRange {
  readonly from: number;
  readonly to: number;
}

/**
 * Represents the available options for selecting a time series.
 *
 * This interface extends partial time range capabilities
 * with additional configuration options for ordering.
 *
 * - `from` (optional, default: `Number.NEGATIVE_INFINITY`): specifies the starting point of the range.
 * - `to` (optional, default: `Number.POSITIVE_INFINITY`): specifies the endpoint (included) of the range.
 * - `asc` (optional, default: `true`): specifies whether the results should be ordered ascending.
 */
interface TimeSeriesSelectOptions extends Partial<TimeSeriesTimeRange> {
  readonly asc?: boolean;
}


/**
 * Represents the available options for deleting a range of data points within a time series.
 *
 * This interface extends partial time range capabilities.
 *
 * - `from` (optional, default: `Number.NEGATIVE_INFINITY`): specifies the starting point of the range.
 * - `to` (optional, default: `Number.POSITIVE_INFINITY`): specifies the endpoint (included) of the range.
 */
interface TimeSeriesDeleteOptions extends Partial<TimeSeriesTimeRange> {}