import type { Selectable } from 'kysely'; import type * as Db from '../Db.js'; import type * as db_Schema from '../Schema.js'; /** Columns of the `funding_transfers` table. */ export type Table = db_Schema.FundingTransfer; /** A stored funding transfer. */ export type Record = Selectable; /** * Ownership filter derived from the API-key principal, never from the * request. A `projectId` narrows reads to that project; organization-attributed * keys omit it and see every project in their organization and environment. */ export type Owner = { /** Key environment. */ environment: Record['environment']; /** Owning organization id (`org_…`). */ orgId: string; /** Attributed project id, for project-attributed keys. */ projectId?: string | undefined; }; /** Inserts a transfer row. Callers commit the matching event in the same transaction. */ export declare function insert(db: Db.Db, record: Record): Promise; /** Gets a transfer by id without ownership scoping (domain and reconciler use). */ export declare function get(db: Db.Db, id: string): Promise; /** Lists processing transfers for one provider, oldest first. */ export declare function listProcessing(db: Db.Db, options: listProcessing.Options): Promise; export declare namespace listProcessing { /** Provider filter for one recovery scan. */ type Options = { /** Exclusive lower bound from the prior recovery page. */ cursor?: string | undefined; /** Maximum transfers returned in one recovery page. */ limit: number; /** Funding provider id. */ providerId: string; }; } /** Gets and locks a transfer for one atomic domain mutation. */ export declare function getForUpdate(db: Db.Db, id: string): Promise; /** Gets an owner-visible transfer by id; `undefined` for absent or foreign rows. */ export declare function getOwned(db: Db.Db, owner: Owner, id: string): Promise; /** * Lists an owner's transfers newest-first. Ids embed a timestamp, so lexical * key order is chronological and the cursor is the last returned id. */ export declare function list(db: Db.Db, owner: Owner, options: list.Options): Promise; export declare namespace list { /** Paging and filter options. */ type Options = { /** Exclusive lower bound: the last id of the previous page. */ cursor?: string | undefined; /** Maximum rows to return (fetch one extra to detect a further page). */ limit: number; /** Restricts to one lifecycle status. */ status?: Record['status'] | undefined; }; } /** * Counts an owner's transfers through a capped subquery sharing the list * filter, so the count cannot scan unboundedly. A result above `cap` means * the true count was truncated. */ export declare function count(db: Db.Db, owner: Owner, options: count.Options): Promise; export declare namespace count { /** Count options sharing the list filter. */ type Options = { /** Row ceiling; a result above it signals a truncated count. */ cap: number; /** Restricts to one lifecycle status. */ status?: Record['status'] | undefined; }; } /** * Applies a version-guarded update; `undefined` when the row moved past * `expectedVersion` (or vanished) so the caller retries against fresh state. */ export declare function update(db: Db.Db, options: update.Options): Promise; export declare namespace update { /** Guarded update fields. */ type Options = { /** The version the update was computed against. */ expectedVersion: number; /** Transfer id (`ftr_…`). */ id: string; /** Replacement private provider state; omitted keeps the stored value. */ providerState?: Record['providerState'] | undefined; /** Replacement public snapshot. */ snapshot: Record['snapshot']; /** New lifecycle status. */ status: Record['status']; /** Customer-safe reason, or null to clear. */ statusReason: Record['statusReason']; /** Mutation timestamp (ISO 8601). */ updatedAt: string; /** The incremented version. */ version: number; }; } //# sourceMappingURL=fundingTransfers.d.ts.map