Type Alias StreamAPI

StreamAPI: {
    add(
        cfg: WithRequired<Partial<StreamConfig>, "name">,
    ): Promise<StreamInfo>;
    delete(stream: string): Promise<boolean>;
    deleteMessage(
        stream: string,
        seq: number,
        erase?: boolean,
    ): Promise<boolean>;
    find(subject: string): Promise<string>;
    get(name: string): Promise<Stream>;
    getMessage(stream: string, query: MsgRequest): Promise<StoredMsg>;
    info(
        stream: string,
        opts?: Partial<StreamInfoRequestOptions>,
    ): Promise<StreamInfo>;
    list(subject?: string): Lister<StreamInfo>;
    names(subject?: string): Lister<string>;
    purge(stream: string, opts?: PurgeOpts): Promise<PurgeResponse>;
    update(name: string, cfg: Partial<StreamUpdateConfig>): Promise<StreamInfo>;
}

Type declaration

  • add:function
    • Adds a new stream with the specified stream configuration.

      Parameters

      Returns Promise<StreamInfo>

  • delete:function
    • Deletes the specified stream

      Parameters

      • stream: string

      Returns Promise<boolean>

  • deleteMessage:function
    • Deletes the specified message sequence from the stream

      Parameters

      • stream: string
      • seq: number
      • Optionalerase: boolean

        erase the message - by default true

      Returns Promise<boolean>

  • find:function
    • Find the stream that stores the specified subject.

      Parameters

      • subject: string

      Returns Promise<string>

  • get:function
    • Returns a Stream object

      Parameters

      • name: string

      Returns Promise<Stream>

  • getMessage:function
    • Retrieves the message matching the specified query. Messages can be retrieved by sequence number or by last sequence matching a subject.

      Parameters

      Returns Promise<StoredMsg>

  • info:function
  • list:function
    • Lists all streams stored by JetStream

      Parameters

      • Optionalsubject: string

        only return streams that include the specified subject

      Returns Lister<StreamInfo>

  • names:function
    • Return a Lister of stream names

      Parameters

      • Optionalsubject: string

        if specified, the results are filtered to streams that contain the subject (can be wildcarded)

      Returns Lister<string>

  • purge:function
    • Purges messages from a stream that match the specified purge options.

      Parameters

      Returns Promise<PurgeResponse>

  • update:function