import type { IncrementOptions } from './types'; /** * Whether a thrown value carries a `message` that can be read as a string. * * The string check is the point: callers use this as a licence to touch `error.message`, so accepting * `{ message: 42 }` would let `error.message.includes(...)` raise a second `TypeError` that masks the * original failure entirely. * * @public */ export declare function isErrorWithMessage(error: unknown): error is Error; /** * Validates and normalizes {@link IncrementOptions}, applying the default amount of `1`. Shared by * every `ICacheStorageComponent` implementation so they reject the same inputs identically. * * @throws {TypeError} When `amount` is not a safe integer or `ttlInSeconds` is not greater than zero. * @public */ export declare function assertValidIncrementOptions(options?: IncrementOptions): { amount: number; ttlInSeconds: number | undefined; }; /** * Asserts that the result of an increment is still exactly representable. * * `Number.MAX_SAFE_INTEGER + 1` is a `number` like any other, so without this a counter that ran past * the range silently returns an imprecise value — and the *next* increment fails * {@link assertIntegerCounter} with a message about the stored value not being a counter, which points * at the wrong thing. A counter that cannot be reported exactly is an error, not a rounded answer. * * @throws {RangeError} When the value is outside the exactly-representable integer range. * @public */ export declare function assertCounterWithinSafeRange(value: number): void; /** * Asserts that a value already stored under a counter key can actually be incremented. Shared by * every `ICacheStorageComponent` implementation so a poisoned key fails the same way on each. * * `Number.isSafeInteger` rather than `typeof value === 'number'`: `NaN`, `±Infinity` and fractional * values are all numbers, and incrementing them yields a counter that silently never crosses a * threshold again — `NaN + 1` is `NaN`, so a limiter built on it fails open forever for that key. * * The key is deliberately absent from the message: it can carry a client IP or a wallet address, and * this error reaches logs through callers that catch it. The caller already knows the key it passed. * * @throws {TypeError} When the stored value is not a safe integer. * @public */ export declare function assertIntegerCounter(value: unknown): asserts value is number;