import type { AnyDb } from './dialect.js'; import type { RealtimeFacade } from './realtime/facade.js'; import { type AccessUser, type ResolvedAccess } from './access.js'; import { BunderstackError, type ErrorCodeValue } from './errors.js'; import { type IdempotencyConfig } from './idempotency.js'; import { type ListParamsInput, type ListResult } from './list-query.js'; export interface CrudExecutionContext { request: Request; user: AccessUser | null; session: { activeOrganizationId: string | null; }; } export declare class CrudOperationError extends BunderstackError { readonly legacyCode: ErrorCodeValue; constructor(status: number, legacyCode: ErrorCodeValue, message: string, details?: unknown); } export type CrudOperationsDeps = Record> = { schema: TSchema; db: AnyDb; access: ResolvedAccess; idempotency?: boolean | IdempotencyConfig; realtime?: RealtimeFacade; }; export type CreateResult = { type: 'created'; status: 201; record: Record; } | { type: 'replay'; status: number; body: string; record: Record; }; export declare function createCrudOperations = Record>(deps: CrudOperationsDeps): { list(tableName: string, params: ListParamsInput | undefined, ctx: CrudExecutionContext): Promise>>; get(tableName: string, rawId: string | number, ctx: CrudExecutionContext): Promise>; create(tableName: string, body: unknown, rawBody: string | undefined, idempotencyKey: string | undefined, ctx: CrudExecutionContext): Promise; update(tableName: string, rawId: string | number, body: unknown, ctx: CrudExecutionContext): Promise>; delete(tableName: string, rawId: string | number, ctx: CrudExecutionContext): Promise; }; export type CrudOperations = ReturnType; //# sourceMappingURL=crud-operations.d.ts.map