/** * Permission guard for Service API Keys. * * Checks whether an API key's permission set allows a specific operation * on a specific collection. Used by the REST API generator middleware to * enforce fine-grained access control. * * @module */ import type { ApiKeyPermission } from "./api-key-types"; /** Operations that map to HTTP methods. */ export type ApiKeyOperation = "read" | "write" | "delete"; /** * Map an HTTP method string to an `ApiKeyOperation`. * * - `GET`, `HEAD`, `OPTIONS` → `"read"` * - `POST`, `PUT`, `PATCH` → `"write"` * - `DELETE` → `"delete"` */ export declare function httpMethodToOperation(method: string): ApiKeyOperation; /** * Check whether the given permissions array allows `operation` on `collection`. * * Supports the `"*"` wildcard for the collection field, which matches any * collection. Returns `true` if at least one permission entry grants access. * * @param permissions - The API key's permission entries. * @param collection - The target collection slug. * @param operation - The requested operation. * @returns `true` if the operation is permitted. */ export declare function isOperationAllowed(permissions: ApiKeyPermission[], collection: string, operation: ApiKeyOperation): boolean;