@suluk/credits - v0.1.0
    Preparing search index...

    Function listTransactions

    @suluk/credits — a metered credit ledger (C046, extracted verbatim). The package OWNS the schema (credit_transaction

    • the credit_amount/credit_key sidecars); the app injects a Drizzle handle (D1 in prod, bun:sqlite in tests). The money-correctness core: the ATOMIC debitIfCovers (a conditional INSERT that can't drive the ledger negative under concurrency) + the idempotent debitOnceIfCovers (the partial-refund double-spend guard) + per-key spend + the activity-log query. App-specific payment-alert kinds + the user-table count stay in the app.
    • The user's recent ledger rows (grants + debits) with the cash that moved, newest first — the "recent transactions" + the activity log. limit is generous (effectively "all" for a normal account).

      Parameters

      • db: CreditsDB
      • userId: string
      • limit: number = 250

      Returns Promise<LedgerEntry[]>