import type { MaybePromise } from '../../../shared/src/types.ts';
import { CRUD_MUTATION_NAME, type CRUDMutationArg, type CRUDOp } from '../../../zero-protocol/src/push.ts';
import type { TableSchema } from '../../../zero-schema/src/table-schema.ts';
import type { Schema } from '../../../zero-types/src/schema.ts';
import type { CRUDExecutor, TableMutator } from '../../../zql/src/mutate/crud.ts';
import type { IVMSourceBranch } from './ivm-branch.ts';
import type { MutatorDefs, WriteTransaction } from './replicache-types.ts';
export type DBMutator<S extends Schema> = S['enableLegacyMutators'] extends true ? {
    [K in keyof S['tables']]: TableMutator<S['tables'][K]>;
} : {};
export type BatchMutator<S extends Schema> = S['enableLegacyMutators'] extends true ? <R>(body: (m: DBMutator<S>) => MaybePromise<R>) => Promise<R> : undefined;
type ZeroCRUDMutate = {
    [CRUD_MUTATION_NAME]: CRUDMutate;
};
/**
 * This is the zero.mutateBatch function part representing the CRUD operations. If the
 * tables are `issue` and `label`, then this object will have `issue` and
 * `label` properties.
 *
 * @param schema - The schema defining the tables
 * @param repMutate - The replicache mutate object with the CRUD mutation
 * @param mutate - The object to use as the mutate object. Properties for each
 *                 table will be assigned to this object.
 */
export declare function makeCRUDMutateBatch<const S extends Schema>(schema: S, repMutate: ZeroCRUDMutate): BatchMutator<S>;
export declare function addTableCRUDProperties<TSchema extends Schema>(schema: TSchema, mutate: object, repMutate: ZeroCRUDMutate): void;
/**
 * Creates the `{insert, upsert, update, delete}` object for use inside a
 * batch.
 */
export declare function makeBatchCRUDMutate<S extends TableSchema>(tableName: string, schema: Schema, ops: CRUDOp[]): TableMutator<S>;
export type WithCRUD<MD extends MutatorDefs> = MD & {
    [CRUD_MUTATION_NAME]: CRUDMutator;
};
export type CRUDMutate = (crudArg: CRUDMutationArg) => Promise<void>;
export type CRUDMutator = (tx: WriteTransaction, crudArg: CRUDMutationArg) => Promise<void>;
export declare function makeCRUDExecutor(tx: WriteTransaction, schema: Schema, ivmBranch: IVMSourceBranch | undefined): CRUDExecutor;
export declare function makeCRUDMutator(schema: Schema): CRUDMutator;
export {};
//# sourceMappingURL=crud.d.ts.map