/** * The plugin's storage layout, in one place. * * Replaces the scattered `chargeKey` / `userChargesIndexKey` / * `idempotencyKey` / `payoutKey` / `payoutsIndexKey` helpers that used * to live in `handlers.ts`, `refund.ts`, `payouts.ts`. Every storage * operation in the plugin goes through one of these handles. * * Built once at plugin construction (in `plugin.ts`) and threaded * through every concern that needs it. */ import type { Storage } from "@gramio/storage"; import { botIndex, botRecord, botSentinel } from "../storage.js"; import type { ChargeRecord, PayoutRecord } from "./types.js"; export type PaymentsStores = { /** `pay:charge:` — authoritative per-charge record. */ readonly charges: ReturnType>; /** `pay:idem:` — fulfillment idempotency sentinel. */ readonly idempotency: ReturnType; /** * `pay:user::charges` — newest-first capped chargeIds. * Consumed by `/refunds` listing, menu history (v2), the gestor * export (`exportPayoutsForUsers`), and `admin.listCharges`. * Factory because the key is per-user. */ readonly userCharges: (userId: number) => ReturnType; /** `pay:payout:` — Fragment payout record. */ readonly payouts: ReturnType>; /** `pay:payouts:index` — newest-first batchIds for export. */ readonly payoutsIndex: ReturnType; }; /** * Construct the plugin's storage handles. Called once at plugin * construction; the result is passed into every concern that reads or * writes plugin state. * * Schemas are wired in — every `.get()` on `charges` / `payouts` runs * the corresponding zod schema's `.parse()` and throws a clear * `SourcedError({ source: 'storage', operation: 'validate' })` on a * corrupted record (instead of NaN-ing downstream when the consumer * reads a now-missing field). `idempotency` is a presence-only sentinel * so no schema applies; `*Index` stores `string[]` so likewise. */ export declare const buildStores: (storage: Storage) => PaymentsStores; //# sourceMappingURL=stores.d.ts.map