/** * @pwngh/economy-lab * * Copyright (c) Preston Neal * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */ import type { Amount } from '../money.js'; import type { WorkerCtx } from '../contract.js'; import type { CallOptions, Store } from '../ports.js'; /** * Result of one promo-expiry sweep. * - `reversed`: unspent part moved back to `SYSTEM.PROMO_FLOAT` (0 if fully spent); grant flagged * so later sweeps skip it. * - `failed`: threw; the whole transaction rolled back, so the grant stays eligible for retry. */ export type PromoExpirySummary = { reversed: ReadonlyArray<{ id: string; amount: Amount; }>; failed: ReadonlyArray<{ id: string; code: string; }>; }; /** * Claw back the unspent part of every expired promo grant. Per grant, take back * min(grant amount, balance) read fresh, so two grants for the same user can't over-claw. * * Each grant runs in its own transaction: the money movement and the "mark reversed" write * commit or roll back together, so a failed grant stays eligible for retry. * * @see {@link https://economy-lab-docs.pages.dev/economy/reference/background-worker/ Background * worker} for how scheduled sweeps reverse expired promo grants. */ export declare function sweepExpiredPromos(store: Store, ctx: WorkerCtx, input: { now: number; limit: number; }, options?: CallOptions): Promise;