import { n as IamPrimitives, t as AccessControl } from "../../access-control-DVisXdFb.cjs"; import { t as IamAdapter } from "../../adapter-BYGLcz8-.cjs"; import { t as IamRequest } from "../../request-CuQVve_Q.cjs"; //#region src/adapters/prisma/index.d.ts /** IamPrisma adapter integration types. Type-only namespace - zero bundle cost. */ declare namespace IamPrisma { /** Row shape returned by `prisma.accessPolicy` queries. */ interface IPolicyRow { id: string; name: string; description: string | null; version: number; algorithm: string; rules: unknown; targets: unknown | null; } /** Row shape returned by `prisma.accessRole` queries. */ interface IRoleRow { id: string; name: string; description: string | null; permissions: unknown; inherits: string[] | null; scope: string | null; metadata: unknown | null; } /** Row shape returned by `prisma.accessAssignment` queries. */ interface IAssignmentRow { subjectId: string; roleId: string; scope: string | null; } /** Row shape returned by `prisma.accessSubjectAttr` queries. */ interface IAttrRow { subjectId: string; data: unknown; } /** * Generic Prisma client type so we don't require @prisma/client as a hard dep. * Your PrismaClient just needs these models. */ interface ILike { accessPolicy: { findMany: (args?: unknown) => Promise; findUnique: (args: { where: { id: string; }; }) => Promise; upsert: (args: { where: { id: string; }; create: Record; update: Record; }) => Promise; delete: (args: { where: { id: string; }; }) => Promise; }; accessRole: { findMany: (args?: unknown) => Promise; findUnique: (args: { where: { id: string; }; }) => Promise; upsert: (args: { where: { id: string; }; create: Record; update: Record; }) => Promise; delete: (args: { where: { id: string; }; }) => Promise; }; accessAssignment: { findMany: (args: { where: { subjectId: string; scope?: string | null; }; }) => Promise; create: (args: { data: Record; }) => Promise; deleteMany: (args: { where: Record; }) => Promise<{ count: number; }>; }; accessSubjectAttr: { findUnique: (args: { where: { subjectId: string; }; }) => Promise; upsert: (args: { where: { subjectId: string; }; create: Record; update: Record; }) => Promise; }; } } /** * Prisma-backed adapter; expects `accessPolicy`, `accessRole`, `accessAssignment`, `accessSubjectAttr` models. * * @template TAction - Constrains valid action strings. * @template TResource - Constrains valid resource strings. * @template TRole - Constrains valid role strings. * @template TScope - Constrains valid scope strings. * @template TPrisma - Constrains the Prisma client shape. */ declare class IamPrismaAdapter implements IamAdapter.IAdapter { private _prisma; /** * Creates a new Prisma adapter. * * @param prisma - Provides the Prisma client instance with required models. */ constructor(prisma: TPrisma); /** * Lists every policy in the database. * * @param _opts - Ignored read options accepted for interface compatibility. * @returns All policies parsed from `accessPolicy` rows. */ listPolicies(_opts?: IamAdapter.IReadOptions): Promise[]>; /** * Fetches a single policy by ID. * * @param id - Identifies the policy to look up. * @param _opts - Ignored read options accepted for interface compatibility. * @returns The matching policy or `null` when absent. */ getPolicy(id: string, _opts?: IamAdapter.IReadOptions): Promise | null>; /** * Upserts a policy through Prisma. * * @param p - Provides the policy to persist. * @returns Resolves once the upsert completes. */ savePolicy(p: AccessControl.IPolicy): Promise; /** * Removes a policy by ID. * * @param id - Identifies the policy to delete. * @returns Resolves once the delete completes. */ deletePolicy(id: string): Promise; /** * Lists every role in the database. * * @param _opts - Ignored read options accepted for interface compatibility. * @returns All roles parsed from `accessRole` rows. */ listRoles(_opts?: IamAdapter.IReadOptions): Promise[]>; /** * Fetches a single role by ID. * * @param id - Identifies the role to look up. * @param _opts - Ignored read options accepted for interface compatibility. * @returns The matching role or `null` when absent. */ getRole(id: string, _opts?: IamAdapter.IReadOptions): Promise | null>; /** * Upserts a role through Prisma. * * @param r - Provides the role to persist. * @returns Resolves once the upsert completes. */ saveRole(r: AccessControl.IRole): Promise; /** * Removes a role by ID. * * @param id - Identifies the role to delete. * @returns Resolves once the delete completes. */ deleteRole(id: string): Promise; /** * Lists deduplicated role IDs assigned to a subject (scoped or unscoped). * * @param subjectId - Identifies the subject whose roles are read. * @param _opts - Ignored read options accepted for interface compatibility. * @returns Deduplicated array of role IDs. */ getSubjectRoles(subjectId: string, _opts?: IamAdapter.IReadOptions): Promise; /** * Lists scoped role assignments for a subject. * * @param subjectId - Identifies the subject whose scoped roles are read. * @param _opts - Ignored read options accepted for interface compatibility. * @returns Array of `(role, scope)` pairs for scoped assignments only. */ getSubjectScopedRoles(subjectId: string, _opts?: IamAdapter.IReadOptions): Promise[]>; /** * Grants a role to a subject, optionally restricted to a scope. * * @param subjectId - Identifies the subject receiving the role. * @param roleId - Specifies the role being granted. * @param scope - Optional scope binding the assignment. * @returns Resolves once the row is inserted. */ assignRole(subjectId: string, roleId: TRole, scope?: TScope): Promise; /** * Removes role assignments matching the given filters. * * @param subjectId - Identifies the subject losing the role. * @param roleId - Specifies the role being revoked. * @param scope - Optional scope filter to narrow the delete. * @returns Resolves once the delete completes. */ revokeRole(subjectId: string, roleId: TRole, scope?: TScope): Promise; /** * Fetches the attribute bag stored for a subject. * * @param subjectId - Identifies the subject whose attributes are read. * @param _opts - Ignored read options accepted for interface compatibility. * @returns The subject's attributes or `{}` when none are recorded. */ getSubjectAttributes(subjectId: string, _opts?: IamAdapter.IReadOptions): Promise; /** * Shallow-merges new attributes into the subject's existing bag via upsert. * * @param subjectId - Identifies the subject whose attributes are written. * @param attrs - Provides the partial attribute patch to merge in. * @returns Resolves once the upsert completes. */ setSubjectAttributes(subjectId: string, attrs: IamPrimitives.Attributes): Promise; } //#endregion export { IamPrisma, IamPrismaAdapter }; //# sourceMappingURL=index.d.cts.map