import type { External } from '@forge/manifest'; import type { RuntimePermissions } from '../types'; /** * Resource types that can be loaded externally */ declare const RESOURCE_TYPES: readonly ["fonts", "styles", "frames", "images", "media", "scripts"]; export type ResourceType = (typeof RESOURCE_TYPES)[number]; /** * Fetch types for external requests */ declare const FETCH_TYPES: readonly ["backend", "client"]; export type FetchType = (typeof FETCH_TYPES)[number]; /** * Required permissions for checking */ export interface PermissionRequirements { scopes?: string[]; external?: { fetch?: { backend?: string[]; client?: string[]; }; fonts?: string[]; styles?: string[]; frames?: string[]; images?: string[]; media?: string[]; scripts?: string[]; }; content?: Record; } /** * Missing permissions information */ export type MissingPermissions = PermissionRequirements; /** * Permission check result */ export interface PermissionCheckResult { granted: boolean; missing: MissingPermissions | null; } /** * Permission utilities for checking runtime permissions */ export interface PermissionUtils { /** * Check if a specific scope is granted */ hasScope: (scope: string) => boolean; /** * Check if fetching from a URL is allowed for the given fetch type * @param type - 'backend' (hostname-only matching) or 'client' (CSP validation with paths) * @param url - The URL to check */ canFetchFrom: (type: FetchType, url: string) => boolean; /** * Check if loading a resource from a URL is allowed * @param type - The resource type (fonts, styles, frames, images, media, scripts) * @param url - The URL to check */ canLoadResource: (type: ResourceType, url: string) => boolean; /** * Get all granted scopes */ getScopes: () => string[]; /** * Get all external permissions */ getExternalPermissions: () => External | undefined; /** * Check if any permissions are granted */ hasAnyPermissions: () => boolean; } /** * Create permission utilities from runtime permissions * @param runtimePermissions - The runtime permissions from context * @returns Permission utilities or null if permissions are not available */ export declare function createPermissionUtils(runtimePermissions: RuntimePermissions | undefined): PermissionUtils | null; /** * Check if required permissions are granted * @param requiredPermissions - The permissions required to check * @param runtimePermissions - The runtime permissions from context (optional, will be fetched from view.getContext() if not provided) * @returns Promise resolving to permission check result with granted status and missing permissions */ export declare function checkPermissions(requiredPermissions: PermissionRequirements, runtimePermissions?: RuntimePermissions | undefined): Promise; export {}; //# sourceMappingURL=permissionsUtil.d.ts.map