Skip to main content
Home
Works with
This package works with Node.js, Deno
This package works with Node.js
This package works with Deno
JSR Score100%
License
AGPL-3.0-only
Downloads1/wk
Publisheda week ago (0.5.0)

SQLite repository for BotKit

Classes

c
SqliteRepository(options?: SqliteRepositoryOptions)

A repository for storing bot data using SQLite.

  • addFollowee(
    identifier: string,
    followeeId: URL,
    follow: Follow
    ): Promise<void>
    No documentation available
  • addFollower(
    identifier: string,
    followRequestId: 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(
    identifier: string,
    followerId: string
    ): boolean
    No documentation available
  • close(): void

    Closes the database connection.

  • 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
  • db: DatabaseSync
    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
  • hasBotIdColumn(table: string): boolean
    No documentation available
  • hasColumn(
    table: string,
    column: string
    ): boolean
    No documentation available
  • hasFollower(
    identifier: string,
    followerId: URL
    ): Promise<boolean>
    No documentation available
  • No documentation available
  • migrate(identifier: string): Promise<void>

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

  • Rebuilds tables created by @fedify/botkit-sqlite 0.4 or earlier, which had no bot_id column, into the bot-scoped schema. Existing rows get the empty-string bot ID; use SqliteRepository.migrate to assign them to a bot actor identifier.

  • removeFollowee(
    identifier: string,
    followeeId: URL
    ): Promise<Follow | undefined>
    No documentation available
  • removeFollower(
    identifier: string,
    followRequestId: URL,
    actorId: 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
  • setKeyPairs(
    identifier: string,
    keyPairs: CryptoKeyPair[]
    ): Promise<void>
    No documentation available
  • tableExists(table: string): boolean
    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

Interfaces

I

Options for creating a SQLite repository.

  • path: string

    The path to the SQLite database file. If not provided, an in-memory database will be used.

  • wal: boolean

    Whether to enable Write-Ahead Logging (WAL) mode.

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-sqlite

Import symbol

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

Import directly with a jsr specifier

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