Skip to content

Core API

Options include storage, clock, namespace, and maxHits.

Checks every rule and records one hit when allowed. Returns ConsumeResult.

Returns the same result shape without changing the record.

Removes one record. Without a key, it removes records visible through storage.keys().

exportRecord(key) / importRecord(key, record)

Section titled “exportRecord(key) / importRecord(key, record)”

Read or overwrite a versioned record for migration and debugging.

interface ConsumeResult {
allowed: boolean
remaining: number
nextAvailableAt?: number
deniedBy?: FatigueRule
}