Core API
createFatigue(options?)
Section titled “createFatigue(options?)”Options include storage, clock, namespace, and maxHits.
tryConsume(key, rules)
Section titled “tryConsume(key, rules)”Checks every rule and records one hit when allowed. Returns ConsumeResult.
peek(key, rules)
Section titled “peek(key, rules)”Returns the same result shape without changing the record.
reset(key?)
Section titled “reset(key?)”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.
ConsumeResult
Section titled “ConsumeResult”interface ConsumeResult { allowed: boolean remaining: number nextAvailableAt?: number deniedBy?: FatigueRule}