prorm API Reference
    Preparing search index...

    Class InfluxDBStore

    InfluxDBStore wraps @influxdata/influxdb-client's InfluxDB client and exposes InfluxDB's write API (point/line-protocol writes, buffered with explicit flush/close) and query API (Flux, streamed row-by-row) as a typed, promise/async-iterable-based API.

    Implements

    Index
    name: "influxdb" = 'influxdb'

    The name of the store (e.g. 'mongodb', 'redis', 'dynamodb')

    library: "@influxdata/influxdb-client" = '@influxdata/influxdb-client'

    The client library being used

    • Creates the underlying InfluxDB client and verifies the url/token/org combination by issuing a trivial Flux query (buckets() |> limit(n:1)). InfluxDB's HTTP client has no persistent socket to "connect", so this is the closest equivalent to the connect-time failure surfaced by socket-based stores (bad host, refused connection, invalid token/org).

      Returns Promise<void>

    • Flushes and closes every write API opened by this store (so no buffered point is silently dropped), then drops the client.

      Returns Promise<void>

    • Returns the memoized WriteApi for the given (org, bucket, precision), creating it on first use. Returned instances buffer writes - see the write-buffering note in this file's header comment.

      Parameters

      Returns WriteApi

    • Flushes the write API for the given scope, sending any buffered points/lines to the server immediately. Resolves once the flush completes (or immediately if nothing was ever written for that scope).

      Parameters

      Returns Promise<void>

    • Flushes every write API this store has opened, across all buckets/orgs/precisions.

      Returns Promise<void>

    • Streams a Flux query's result rows, already converted to plain objects via each row's table metadata (equivalent to tableMeta.toObject(row.values)). Suitable for for-await loops over large result sets without buffering everything in memory.

      Parameters

      Returns AsyncIterable<QueryRow>

    • Streams a Flux query's raw Rows (values + table metadata), without the toObject conversion query() applies.

      Parameters

      Returns AsyncIterable<Row>

    • Executes a Flux query and collects every result row into an array via the returned Promise. Use with caution on large result sets - the whole result is buffered in memory. Prefer query()/queryRows() for streaming.

      Type Parameters

      Parameters

      • fluxQuery: string | ParameterizedQuery
      • OptionalrowMapper: (values: string[], tableMeta: FluxTableMetaData) => T | undefined
      • scope: QueryScopeOptions = {}

      Returns Promise<T[]>

    • Executes a Flux query and returns the full annotated-CSV response as a string.

      Parameters

      Returns Promise<string>

    • ORM create: model one record as a line-protocol point per schema (tags vs fields vs timestamp) and write it. Buffered - this method flushes so the point is durable before it resolves.

      Parameters

      • schema: InfluxMeasurementSchema
      • record: Record<string, unknown>

      Returns Promise<Record<string, unknown>>

    • ORM bulkCreate: write many records as points, then flush.

      Parameters

      • schema: InfluxMeasurementSchema
      • records: Record<string, unknown>[]

      Returns Promise<Record<string, unknown>[]>

    • ORM findAll. Generates Flux from measurement/where/order/range; where predicates are pushed into Flux when expressible, otherwise the rows are collected and filtered in memory with the shared matcher. limit/offset are applied to the (sorted) result.

      Type Parameters

      Parameters

      • options: InfluxFindOptions

      Returns Promise<T[]>

    • ORM findOne: the first row matching where (respecting order).

      Type Parameters

      Parameters

      • options: InfluxFindOptions

      Returns Promise<T | null>

    • ORM count: number of points/rows matching the query.

      Parameters

      • options: InfluxFindOptions

      Returns Promise<number>

    • Aggregate (and optionally downsample) a field. Generates Flux using either a bare aggregate (mean(), sum(), ...) or aggregateWindow(every, fn) when window is set, grouping by groupBy tags first. Returns the result rows so callers never hand-write Flux for standard aggregates.

      Type Parameters

      Parameters

      • options: InfluxAggregateOptions

      Returns Promise<T[]>

    • ORM update is unsupported: InfluxDB points are immutable, so there is no safe in-place row update to emulate. Write a new point (create) with the corrected values instead, or delete + rewrite via destroy. Throws a typed capability error rather than silently doing nothing.

      Returns Promise<never>

    • ORM destroy: delete points from measurement within a time range, optionally narrowed by an equality predicate on tags. Uses InfluxDB's delete API (from the optional @influxdata/influxdb-client-apis package, required lazily). where supports only equality on tags/_measurement/ _field - the delete API's predicate grammar - and throws a typed error for anything else, since a Flux-style filter cannot be emulated safely here.

      Parameters

      • options: {
            measurement: string;
            bucket?: string;
            where?: WhereClause;
            range?: InfluxTimeRange;
        }

      Returns Promise<void>