import { Annotation, Permission, PermissionCoerced, Target } from "./index-CLa7bsge.mjs"; import OpenAPIBackend from "openapi-backend"; import { OpenAPIV3 } from "openapi-types"; //#region src/annotations/annotations.d.ts type DeferencedOpenAPIParameter = Omit & { schema: OpenAPIV3.SchemaObject; }; interface Preset { permissions: PermissionCoerced[]; uri: string; serverUrl: string; apiInfo: OpenAPIV3.InfoObject; path: string; params: Record; query: Record; operation: { summary?: string; description?: string; tags?: string[]; parameters: DeferencedOpenAPIParameter[]; }; } /** * Processes annotations and validates against a list of permissions (intended * to be the on-chain permissions). * * This function: * 1. Resolves each annotation (uri and schema) into a permission preset * 2. Validates each preset against the input list (must be strict subset) * 3. Discards invalid presets * 4. Returns validated presets plus remaining permissions not covered by presets * * @param {readonly Permission[]} permissions - List of permissions to validate against * @param {readonly Annotation[]} annotations - Annotations to resolve and validate * @param {Object} [options] - Optional functions for fetching resources * @param {Function} [options.fetchPermissions] - Fetch permissions from URL * @param {Function} [options.fetchSchema] - Fetch schema from URL * * @returns {Promise<{ presets: Preset[], permissions: Permission[] }>} * - `presets`: Valid presets (strict subsets of input permissions) * - `permissions`: Input permissions not covered by any preset */ declare const processAnnotations: (targets: readonly Target[], annotations: readonly Annotation[], options?: { fetchPermissions?: (url: string) => Promise; fetchSchema?: (url: string) => Promise; }) => Promise<{ presets: Preset[]; permissions: PermissionCoerced[]; }>; //#endregion export { type Preset, processAnnotations }; //# sourceMappingURL=annotations.d.mts.map