import { n as IamPrimitives, t as AccessControl } from "../../access-control-CxeWQI64.js"; import { t as IamAdapter } from "../../adapter-DeNTUcdv.js"; import { t as IamRequest } from "../../request-BouexCSW.js"; //#region src/adapters/memory/index.d.ts declare namespace IamMemory { /** * Describes initial seed data for {@link IamMemoryAdapter}. * * @template TAction - Constrains valid action strings. * @template TResource - Constrains valid resource strings. * @template TRole - Constrains valid role strings. * @template TScope - Constrains valid scope strings. */ interface IInit { /** Seeds the adapter with these policies on construction. */ policies?: AccessControl.IPolicy[]; /** Seeds the adapter with these roles on construction. */ roles?: AccessControl.IRole[]; /** Maps subject IDs to their initial unscoped roles. */ assignments?: Record; /** Maps subject IDs to their initial attribute bag. */ attributes?: Record; } } /** * In-memory {@link IamAdapter.IAdapter} backed by `Map` storage; tests + prototypes only. * * @template TAction - Constrains valid action strings. * @template TResource - Constrains valid resource strings. * @template TRole - Constrains valid role strings. * @template TScope - Constrains valid scope strings. */ declare class IamMemoryAdapter implements IamAdapter.IAdapter { private _policies; private _roles; private _assignments; private _attributes; /** * Creates a new in-memory adapter, optionally seeded with initial data. * * @param init - Provides optional seed policies, roles, assignments, and attributes. */ constructor(init?: IamMemory.IInit); /** * Lists every stored policy. * * @param _opts - Ignored read options accepted for interface compatibility. * @returns All policies currently held in memory. */ 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>; /** * Stores or overwrites a policy keyed by its ID. * * @param p - Provides the policy to persist. * @returns Resolves once the write completes. */ savePolicy(p: AccessControl.IPolicy): Promise; /** * Removes a policy by ID. * * @param id - Identifies the policy to delete. * @returns Resolves once the entry is removed (no-op when absent). */ deletePolicy(id: string): Promise; /** * Lists every stored role. * * @param _opts - Ignored read options accepted for interface compatibility. * @returns All roles currently held in memory. */ 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>; /** * Stores or overwrites a role keyed by its ID. * * @param r - Provides the role to persist. * @returns Resolves once the write completes. */ saveRole(r: AccessControl.IRole): Promise; /** * Removes a role by ID. * * @param id - Identifies the role to delete. * @returns Resolves once the entry is removed (no-op when absent). */ deleteRole(id: string): Promise; /** * Lists unscoped (global) roles assigned to a subject. * * @param id - Identifies the subject whose global roles are read. * @param _opts - Ignored read options accepted for interface compatibility. * @returns Deduplicated array of role IDs without any scope binding. */ getSubjectRoles(id: string, _opts?: IamAdapter.IReadOptions): Promise; /** * Lists the scoped role assignments for a subject. * * @param id - 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(id: string, _opts?: IamAdapter.IReadOptions): Promise[]>; /** * Grants a role to a subject, optionally restricted to a scope. * * Duplicate `(role, scope)` pairs are silently ignored. * * @param id - Identifies the subject receiving the role. * @param roleId - Specifies the role being granted. * @param scope - Optional scope binding the assignment. * @returns Resolves once the assignment is recorded. */ assignRole(id: string, roleId: TRole, scope?: TScope): Promise; /** * Removes a role assignment from a subject. * * @param id - Identifies the subject losing the role. * @param roleId - Specifies the role being revoked. * @param scope - Optional scope to match; omit to revoke unscoped only. * @returns Resolves once the assignment is removed. */ revokeRole(id: string, roleId: TRole, scope?: TScope): Promise; /** * Fetches the attribute bag stored for a subject. * * @param id - 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(id: string, _opts?: IamAdapter.IReadOptions): Promise; /** * Shallow-merges new attributes into the subject's existing bag. * * @param id - Identifies the subject whose attributes are written. * @param attrs - Provides the partial attribute patch to merge in. * @returns Resolves once the merge completes. */ setSubjectAttributes(id: string, attrs: IamPrimitives.Attributes): Promise; } //#endregion export { IamMemory, IamMemoryAdapter }; //# sourceMappingURL=index.d.ts.map