pond-ts API Reference (core)
    Preparing search index...

    Class LiveView<S>

    Type Parameters

    Implements

    Index

    Constructors

    Properties

    name: string
    schema: S

    Accessors

    Methods

    • Type Parameters

      • const M extends
            | Readonly<
                Record<
                    string,
                    | AggregateReducer
                    | Readonly<
                        {
                            from: ValueColumnsForSchema<S>[number]["name"];
                            kind?: ScalarKind | undefined;
                            using: AggregateFunctionsForKind<
                                Extract<
                                    ValueColumnsForSchema<(...)>[number],
                                    ColumnDef<(...)[(...)], ScalarKind>,
                                >["kind"],
                            >;
                        },
                    >,
                >,
            >
            | {
                readonly [K in string
                | number
                | symbol]: K extends ValueColumnsForSchema<S>[number]["name"]
                    ?
                        | Readonly<
                            {
                                from: ValueColumnsForSchema<S>[number]["name"];
                                kind?: ScalarKind;
                                using: AggregateFunctionsForKind<
                                    Extract<
                                        ValueColumnsForSchema<(...)>[number],
                                        ColumnDef<(...)[(...)], ScalarKind>,
                                    >["kind"],
                                >;
                            },
                        >
                        | AggregateFunctionsForKind<
                            ColumnKindByName<ValueColumnsForSchema<S>, K & string>,
                        >
                    : string extends K
                        ? | AggregateReducer
                        | Readonly<
                            {
                                from: ValueColumnsForSchema<S>[number]["name"];
                                kind?: ScalarKind | undefined;
                                using: AggregateFunctionsForKind<
                                    Extract<(...)[(...)], ColumnDef<(...), (...)>>["kind"],
                                >;
                            },
                        >
                        : Readonly<
                            {
                                from: ValueColumnsForSchema<S>[number]["name"];
                                kind?: ScalarKind;
                                using: AggregateFunctionsForKind<
                                    Extract<
                                        ValueColumnsForSchema<(...)>[number],
                                        ColumnDef<(...)[(...)], ScalarKind>,
                                    >["kind"],
                                >;
                            },
                        >
            }

      Parameters

      Returns LiveAggregation<
          S,
          readonly [
              ColumnDef<"interval", "interval">,
              AggregateColumns<ValueColumnsForSchema<S>, M>,
          ],
      >

    • Example: live.window('1m').count(). Returns the number of events currently in the view's buffer. For windows created via window(duration), this is "events in the last N seconds"; for window(count), it's "events in the last N retained."

      Cheap O(1) accessor that reads this.length directly — same value as view.length. Provided as a method so it composes naturally with LiveView.rate.

      Returns number

    • Type Parameters

      • const Targets extends string

      Parameters

      • spec: {
            [K in string]:
                | "sum"
                | "min"
                | "max"
                | "count"
                | ((acc: number, value: number) => number)
        }

      Returns LiveView<
          readonly [
              S[0],
              ReplaceSmoothedColumn<ValueColumnsForSchema<S>, Targets>,
          ],
      >

    • Example: live.window('1m').eventRate(). Returns events per second over the view's window — count() / windowSeconds.

      Only defined on time-based windows. Throws on count-based windows (window(100)) and on views that weren't created by a .window(duration) call (filter / map / select on a non-windowed source — there's no denominator to use).

      Convenient for metrics-endpoint gauges and React displays ("EVENT RATE 8.0/s"). Pairs with LiveView.count for cases where both numbers are needed.

      Distinct from LiveView.rate, which is the per-column derivative operator (rate-of-change of values). eventRate is per-window-events-per-second; rate(columns) is per-event derivative of the named columns.

      Returns number

    • Example: view.keyColumn().begin. Gathers the time axis into a TimeKeyColumn directly from the view's current events. Time-keyed series only.

      Returns TimeKeyOnly<S>

    • Walk-now partition read. Buckets the view's current events by col and runs fn over each partition's column view, returning a Map keyed by the partition value (normalized to a string, matching TimeSeries.partitionBy(col).toMap(fn)) — but skipping the per-partition TimeSeries construction (gathers only the columns fn reads). Distinct from LiveSeries.partitionBy, which is subscription-oriented (live sub-series); this is a snapshot-style read of the current window.

      Type Parameters

      • Col extends string

      Parameters

      Returns { toMap<R>(fn: (group: LiveColumnGroup<S>) => R): Map<string, R> }

    • Streaming reduce over the view's current buffer. See LiveSeries.reduce for the full surface.

      Type Parameters

      • const M extends
            | Readonly<
                Record<
                    string,
                    | AggregateReducer
                    | Readonly<
                        {
                            from: ValueColumnsForSchema<S>[number]["name"];
                            kind?: ScalarKind | undefined;
                            using: AggregateFunctionsForKind<
                                Extract<
                                    ValueColumnsForSchema<(...)>[number],
                                    ColumnDef<(...)[(...)], ScalarKind>,
                                >["kind"],
                            >;
                        },
                    >,
                >,
            >
            | {
                readonly [K in string
                | number
                | symbol]: K extends ValueColumnsForSchema<S>[number]["name"]
                    ?
                        | Readonly<
                            {
                                from: ValueColumnsForSchema<S>[number]["name"];
                                kind?: ScalarKind;
                                using: AggregateFunctionsForKind<
                                    Extract<
                                        ValueColumnsForSchema<(...)>[number],
                                        ColumnDef<(...)[(...)], ScalarKind>,
                                    >["kind"],
                                >;
                            },
                        >
                        | AggregateFunctionsForKind<
                            ColumnKindByName<ValueColumnsForSchema<S>, K & string>,
                        >
                    : string extends K
                        ? | AggregateReducer
                        | Readonly<
                            {
                                from: ValueColumnsForSchema<S>[number]["name"];
                                kind?: ScalarKind | undefined;
                                using: AggregateFunctionsForKind<
                                    Extract<(...)[(...)], ColumnDef<(...), (...)>>["kind"],
                                >;
                            },
                        >
                        : Readonly<
                            {
                                from: ValueColumnsForSchema<S>[number]["name"];
                                kind?: ScalarKind;
                                using: AggregateFunctionsForKind<
                                    Extract<
                                        ValueColumnsForSchema<(...)>[number],
                                        ColumnDef<(...)[(...)], ScalarKind>,
                                    >["kind"],
                                >;
                            },
                        >
            }

      Parameters

      Returns LiveReduce<S, readonly [S[0], AggregateColumns<ValueColumnsForSchema<S>, M>]>

    • Type Parameters

      • const M extends
            | Readonly<
                Record<
                    string,
                    | AggregateReducer
                    | Readonly<
                        {
                            from: ValueColumnsForSchema<S>[number]["name"];
                            kind?: ScalarKind | undefined;
                            using: AggregateFunctionsForKind<
                                Extract<
                                    ValueColumnsForSchema<(...)>[number],
                                    ColumnDef<(...)[(...)], ScalarKind>,
                                >["kind"],
                            >;
                        },
                    >,
                >,
            >
            | {
                readonly [K in string
                | number
                | symbol]: K extends ValueColumnsForSchema<S>[number]["name"]
                    ?
                        | Readonly<
                            {
                                from: ValueColumnsForSchema<S>[number]["name"];
                                kind?: ScalarKind;
                                using: AggregateFunctionsForKind<
                                    Extract<
                                        ValueColumnsForSchema<(...)>[number],
                                        ColumnDef<(...)[(...)], ScalarKind>,
                                    >["kind"],
                                >;
                            },
                        >
                        | AggregateFunctionsForKind<
                            ColumnKindByName<ValueColumnsForSchema<S>, K & string>,
                        >
                    : string extends K
                        ? | AggregateReducer
                        | Readonly<
                            {
                                from: ValueColumnsForSchema<S>[number]["name"];
                                kind?: ScalarKind | undefined;
                                using: AggregateFunctionsForKind<
                                    Extract<(...)[(...)], ColumnDef<(...), (...)>>["kind"],
                                >;
                            },
                        >
                        : Readonly<
                            {
                                from: ValueColumnsForSchema<S>[number]["name"];
                                kind?: ScalarKind;
                                using: AggregateFunctionsForKind<
                                    Extract<
                                        ValueColumnsForSchema<(...)>[number],
                                        ColumnDef<(...)[(...)], ScalarKind>,
                                    >["kind"],
                                >;
                            },
                        >
            }

      Parameters

      Returns LiveRollingAggregation<
          S,
          readonly [S[0], AggregateColumns<ValueColumnsForSchema<S>, M>],
      >

    • Keyed-form fused multi-window rolling on a LiveView. See LiveSeries.rolling for the full surface — chained-from- a-view behavior is identical to the same call on a top-level LiveSeries.

      Type Parameters

      Parameters

      Returns LiveFusedRolling<S, readonly [S[0], FusedRollingColumns<S, FM>]>

    • Bounded-memory stream sampling on a LiveView. Same semantics as LiveSeries.sample — stride only on the live side in v0.17.0.

      Multi-entity bias trap applies here too: a LiveView derived from a multi-entity source carries the same bias risk. Chain after partitionBy(...) for the safe-by-construction shape; see LiveSeries.sample for the full discussion.

      Parameters

      Returns LiveView<S>