Close the database connection.
Count state items in a collection.
Delete a state item from a collection.
Delete a state value by namespace and key.
Claim and retrieve items from a queue for processing. Returns array of queue items with id and payload.
Queue name
Optionalcount: numberNumber of items to dequeue (default 1)
Mark a queue item as successfully completed.
Add an item to a queue with optional priority and max attempts. Returns the queue item ID, or -1 if skipped due to deduplication.
Optionaloptions: { maxAttempts?: number; priority?: number }Mark a queue item as failed with optional error message. Retries if under max_attempts, else dead-letters.
Optionalerror: stringRetrieve a state item value from a collection. Returns null if not found.
Retrieve a state value by namespace and key. Returns null if not found or expired.
Check if a state item exists in a collection.
Delete oldest items keeping only keepCount newest (by updated_at). Returns number deleted.
Set or update a state item in a collection. Value is optional (for existence-only tracking). Auto-creates parent state row if needed.
Optionalvalue: stringSet or update a state value with optional TTL (e.g., '30d', '24h', '60m').
Optionaloptions: { ttl?: string }
Client interface for job scripts to interact with runner state and queues.