import type { Request } from 'express'; /** * Resolves the "current user" identifier from a request. The returned value * is whatever your auth flow exposes — typically a userId (number, string, * uuid). It will be written into the per-row columns configured on * `mtbREST.withUser(...)` before the CRUD handler runs. * * Returning `undefined` means "no user" — the row's auth columns are left * to whatever sanitizeBody passed through (so `null` for a nullable column, * a request-supplied value for a non-protected column). */ export type UserResolver = (req: Request) => U | Promise | undefined | Promise; export interface UserBindingOptions { /** Body columns set from the resolver on POST. Default: ['user_id', 'created_by']. */ onCreate?: string[]; /** Body columns set from the resolver on PUT/PATCH. Default: ['updated_by']. */ onUpdate?: string[]; } export interface ResolvedUserBinding { resolver: UserResolver; onCreate: ReadonlySet; onUpdate: ReadonlySet; } export declare const DEFAULT_CREATE_COLUMNS: readonly string[]; export declare const DEFAULT_UPDATE_COLUMNS: readonly string[]; export declare function makeUserBinding(resolver: UserResolver, opts?: UserBindingOptions): ResolvedUserBinding; /** * Apply the user binding to a body object, mutating it in place. The resolver * is called once and its value forced into every column in the relevant set, * overriding any client-supplied value (so the client can't impersonate). */ export declare function applyUserBinding(body: Record, binding: ResolvedUserBinding, req: Request, phase: 'create' | 'update'): Promise; //# sourceMappingURL=userResolver.d.ts.map