Skip to main content
Home
Works with
This package works with Node.js, DenoIt is unknown whether this package works with Cloudflare Workers, Bun
It is unknown whether this package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
It is unknown whether this package works with Bun
JSR Score100%
License
AGPL-3.0-only
Downloads1/wk
Publisheda week ago (0.5.0)

PostgreSQL-based repository for BotKit

Classes

c
PostgresRepository(options: PostgresRepositoryOptions)

A repository for storing bot data using PostgreSQL.

  • addFollowee(
    identifier: string,
    followeeId: URL,
    follow: Follow
    ): Promise<void>
    No documentation available
  • addFollower(
    identifier: string,
    followId: URL,
    follower: Actor
    ): Promise<void>
    No documentation available
  • addMessage(
    identifier: string,
    id: Uuid,
    activity: Create | Announce
    ): Promise<void>
    No documentation available
  • addQuoteAuthorization(
    identifier: string,
    id: Uuid,
    authorization: QuoteAuthorization
    ): Promise<void>
    No documentation available
  • addQuoteAuthorizationReference(
    identifier: string,
    authorization: URL,
    messageId: Uuid,
    attribution?: URL
    ): Promise<void>
    No documentation available
  • addSentFollow(
    identifier: string,
    id: Uuid,
    follow: Follow
    ): Promise<void>
    No documentation available
  • cleanupFollower(
    sql: Queryable,
    identifier: string,
    followerId: string
    ): Promise<boolean>
    No documentation available
  • close(): Promise<void>

    Closes the underlying PostgreSQL connection pool if owned by the repository.

  • countFollowers(identifier: string): Promise<number>
    No documentation available
  • countMessages(identifier: string): Promise<number>
    No documentation available
  • countVoters(
    identifier: string,
    messageId: Uuid
    ): Promise<number>
    No documentation available
  • countVotes(
    identifier: string,
    messageId: Uuid
    ): Promise<Readonly<Record<string, number>>>
    No documentation available
  • ensureReady(): Promise<void>
    No documentation available
  • findFollowedBots(followeeId: URL): AsyncIterable<string>
    No documentation available
  • findQuoteAuthorization(
    identifier: string,
    interactingObject: URL
    ): Promise<QuoteAuthorization | undefined>
    No documentation available
  • findQuoteAuthorizationReference(
    identifier: string,
    authorization: URL
    ): Promise<Uuid | undefined>
    No documentation available
  • findQuoteAuthorizationReferenceAttribution(
    identifier: string,
    authorization: URL
    ): Promise<URL | undefined>
    No documentation available
  • findQuoteAuthorizationReferenceIdentifiers(authorization: URL): AsyncIterable<string>
    No documentation available
  • forIdentifier(identifier: string): ActorScopedRepository
    No documentation available
  • getFollowee(
    identifier: string,
    followeeId: URL
    ): Promise<Follow | undefined>
    No documentation available
  • getFollowers(
    identifier: string,
    options?: RepositoryGetFollowersOptions
    ): AsyncIterable<Actor>
    No documentation available
  • getKeyPairs(identifier: string): Promise<CryptoKeyPair[] | undefined>
    No documentation available
  • getMessage(
    identifier: string,
    id: Uuid
    ): Promise<Create | Announce | undefined>
    No documentation available
  • getMessages(
    identifier: string,
    options?: RepositoryGetMessagesOptions
    ): AsyncIterable<Create | Announce>
    No documentation available
  • getQuoteAuthorization(
    identifier: string,
    id: Uuid
    ): Promise<QuoteAuthorization | undefined>
    No documentation available
  • getSentFollow(
    identifier: string,
    id: Uuid
    ): Promise<Follow | undefined>
    No documentation available
  • hasFollower(
    identifier: string,
    followerId: URL
    ): Promise<boolean>
    No documentation available
  • lockFollowRequest(
    sql: Queryable,
    identifier: string,
    followId: URL
    ): Promise<void>
    No documentation available
  • lockFollower(
    sql: Queryable,
    identifier: string,
    followerId: string
    ): Promise<void>
    No documentation available
  • lockFollowers(
    sql: Queryable,
    identifier: string,
    followerIds: readonly string[]
    ): Promise<void>
    No documentation available
  • migrate(identifier: string): Promise<void>

    Migrates data stored by @fedify/botkit-postgres 0.4, which was not scoped by bot actor identifiers, so that it belongs to the given identifier. Rows carried over from a legacy schema have the empty-string bot ID; this method assigns them to the identifier in a single transaction. It only acts when the schema was actually upgraded from a legacy layout, so data legitimately stored under an empty-string identifier is never touched, and calling it again is a no-op.

  • ownsSql: boolean
    No documentation available
  • prepare: boolean
    No documentation available
  • query<TRow extends object>(
    sql: Queryable,
    query: string,
    parameters?: readonly QueryParameter[]
    ): Promise<readonly TRow[]>
    No documentation available
  • ready: Promise<void>
    No documentation available
  • removeFollowee(
    identifier: string,
    followeeId: URL
    ): Promise<Follow | undefined>
    No documentation available
  • removeFollower(
    identifier: string,
    followId: URL,
    followerId: URL
    ): Promise<Actor | undefined>
    No documentation available
  • removeMessage(
    identifier: string,
    id: Uuid
    ): Promise<Create | Announce | undefined>
    No documentation available
  • removeQuoteAuthorization(
    identifier: string,
    id: Uuid
    ): Promise<QuoteAuthorization | undefined>
    No documentation available
  • removeQuoteAuthorizationReference(
    identifier: string,
    authorization: URL
    ): Promise<void>
    No documentation available
  • removeSentFollow(
    identifier: string,
    id: Uuid
    ): Promise<Follow | undefined>
    No documentation available
  • schema: string
    No documentation available
  • setKeyPairs(
    identifier: string,
    keyPairs: CryptoKeyPair[]
    ): Promise<void>
    No documentation available
  • sql: postgres.Sql
    No documentation available
  • table(name: string): string
    No documentation available
  • updateMessage(
    identifier: string,
    id: Uuid,
    updater: (existing: Create | Announce) =>
    Create
    | Announce
    | undefined
    | Promise<Create | Announce | undefined>
    ): Promise<boolean>
    No documentation available
  • vote(
    identifier: string,
    messageId: Uuid,
    voterId: URL,
    option: string
    ): Promise<void>
    No documentation available

Functions

f
initializePostgresRepositorySchema(
sql: TransactionalQueryable,
schema?: string,
prepare?: boolean
): Promise<void>

Initializes the PostgreSQL schema used by BotKit repositories.

Interfaces

Type Aliases

T
PostgresRepositoryOptions =
PostgresRepositoryOptionsWithClient
| PostgresRepositoryOptionsWithUrl

Options for creating a PostgreSQL repository.

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@fedify/botkit-postgres

Import symbol

import * as mod from "@fedify/botkit-postgres";
or

Import directly with a jsr specifier

import * as mod from "jsr:@fedify/botkit-postgres";