/** * Typed error hierarchy for `@guuey/state`. Every operation that * can fail throws a subclass of `GuueyStateError`, so call sites * can `instanceof`-discriminate without parsing message strings. */ export declare class GuueyStateError extends Error { /** Stable, machine-readable error code. */ readonly code: string; constructor(code: string, message: string, options?: { cause?: unknown; }); } /** * The scope is at or above its byte limit. Thrown by `set` and * `increment` when the write would push usage past the cap. * Includes the live `usedBytes` + `limitBytes` so the caller can * surface a meaningful error to the user. */ export declare class QuotaExceededError extends GuueyStateError { readonly usedBytes: number; readonly limitBytes: number; constructor(usedBytes: number, limitBytes: number); } /** * A single value exceeds the per-value cap. Today: 64 KiB. * Large blobs belong in `@guuey/files` (planned), not in KV. */ export declare class ValueTooLargeError extends GuueyStateError { readonly valueBytes: number; readonly limitBytes: number; constructor(valueBytes: number, limitBytes: number); } /** * Key string is too long or contains a forbidden character. Today: * 1 KiB max length; ASCII letters, digits, and `_.:-/` only * (the standard "URL-safe-ish" set). Keeps keys cheap to log + index. */ export declare class InvalidKeyError extends GuueyStateError { readonly key: string; constructor(key: string, reason: string); } /** * TTL is missing, zero, negative, or above the 90-day cap. */ export declare class InvalidTtlError extends GuueyStateError { readonly ttl: unknown; constructor(ttl: unknown, reason: string); } /** * The library was called without a `ScopeContext` — either no * `createGuueyState({ context })` AND no surrounding * `withGuueyContext(...)` block. Common in unit tests that import * `kv` from the barrel without setting up context. */ export declare class MissingContextError extends GuueyStateError { constructor(); } /** * `increment`/`decrement` was called on a key whose stored value is * not a number. Counter ops require number-typed keys; mixing a * counter and a JSON value under one key is a calling-code bug. */ export declare class TypeMismatchError extends GuueyStateError { readonly key: string; readonly actualType: string; constructor(key: string, actualType: string); } /** * A per-call argument is unusable — a `keys()` limit outside * 1..1000, an `mget` batch over 100 keys, a non-integer counter * step, or a value that isn't JSON-serializable (top-level * `undefined`/function/symbol, `BigInt`, circular structure). * Distinct from `InvalidKeyError`/`InvalidTtlError`, which cover the * key and TTL contracts specifically. */ export declare class InvalidArgumentError extends GuueyStateError { constructor(reason: string); } /** * A `ScopeContext` field is unusable — an id that is empty or contains * whitespace/control characters, or a missing `token` when the hosted * binding was explicitly requested. Scope ids are platform-issued * opaque identifiers (Cognito subs, app ids); anything with * whitespace in it is a wiring bug at the call site, and the * storage layer refuses it rather than risking scope ambiguity. */ export declare class InvalidContextError extends GuueyStateError { readonly field: "userId" | "mcpId" | "token"; constructor(field: "userId" | "mcpId" | "token", reason: string); } /** * The KV binding's transport call failed (HTTP 5xx, network blip, * timeout). Includes the underlying cause for diagnostics. The * caller may safely retry idempotent reads. */ export declare class TransportError extends GuueyStateError { constructor(message: string, cause?: unknown); } //# sourceMappingURL=errors.d.ts.map