import type { BlokkliAdapter } from '#blokkli/editor/adapter'; import type { BlockPermission } from '../types/definitions.js'; import type { UserPermissions } from '../types/permissions.js'; import type { BlocksProvider } from './blocks.js'; export type PermissionsProvider = { hasPermission: (permission: UserPermissions) => boolean; checkBlockBundlePermission: (bundle: string, operation: BlockPermission) => boolean; filterDeniedBundles: (bundles: string[], operation: BlockPermission) => string[]; /** * Check if a block has any ancestor whose bundle lacks 'edit' permission. * * When an ancestor is restricted, all descendants are considered restricted * too — the user cannot add, edit, or delete blocks inside a restricted * parent. */ blockHasRestrictedAncestor: (uuid: string) => boolean; /** * Get the nearest ancestor block that restricts editing. * * Walks up the parent chain and returns the UUID of the first ancestor * whose bundle lacks 'edit' permission, or undefined if no ancestor is * restricted. */ getRestrictedAncestor: (uuid: string) => string | undefined; getBlockBundlePermissions: (bundle: string) => BlockPermission[]; }; export default function (adapter: BlokkliAdapter, blocks: BlocksProvider): Promise;