import type { ActionRunContext } from "../action.js"; export interface AppRolesDescriptor { appId: string; roles: readonly R[]; defaultRole?: R; roleLabels?: Partial>; permissions?: Partial>; permissionLabels?: Partial>; label?: string; } export type AppRoleLookup = { status: "assigned"; roles: R[]; orgId: string; orgRole?: string; } | { status: "unassigned"; orgId: string; orgRole?: string; hasAssignments?: boolean; } | { status: "not-a-member"; orgId: string; } | { status: "no-identity"; } | { status: "no-org"; }; export interface AppRoleCaller { userEmail?: string | null; orgId?: string | null; } export interface AppPermissionPolicy { unassignedRole?: R; allowOrgAdmins?: boolean; } export interface AppAuthorizationContext { appId: string; roles: string[]; permissions: Record; } export interface AppRoles { descriptor: AppRolesDescriptor; appId: string; roles: readonly R[]; resolve: (caller?: AppRoleCaller) => Promise>; assertAny: (allowed: readonly R[], caller?: AppRoleCaller) => Promise; requireAny: (...allowed: R[]) => (args: unknown, ctx?: ActionRunContext) => Promise; requirePermission: (...permissions: P[]) => (args: unknown, ctx?: ActionRunContext) => Promise; assertPermission: (permissions: readonly P[], caller?: AppRoleCaller) => Promise; } export declare function getRegisteredAppRoles(appId: string): AppRolesDescriptor | undefined; export declare function listRegisteredAppRoles(): AppRolesDescriptor[]; export declare function defineAppRoles(descriptor: AppRolesDescriptor, permissionPolicy?: AppPermissionPolicy): AppRoles; export declare function resolveAppRole(descriptor: AppRolesDescriptor, caller?: AppRoleCaller): Promise>; export interface AppMemberRoleRow { email: string; roles: string[]; } export declare function listAppMemberRoles(appId: string, orgId: string): Promise; export declare function setAppMemberRoles(opts: { appId: string; orgId: string; email: string; roles: readonly string[]; updatedBy: string; }): Promise; /** @deprecated Use setAppMemberRoles instead. */ export declare function setAppMemberRole(opts: { appId: string; orgId: string; email: string; role: string | null; updatedBy: string; }): Promise; export declare function getAppPermissionOverrides(appId: string, orgId: string): Promise>; export declare function resolveAppAuthorizationContext(appId: string, caller: AppRoleCaller): Promise; export declare function setAppPermissionRoles(opts: { appId: string; orgId: string; permission: string; roles: readonly string[] | null; updatedBy: string; }): Promise; export declare function applyInvitationAppRoles(opts: { appRolesJson: string | null; orgId: string; email: string; updatedBy: string; }): Promise;