import { ActualAssignment, AssignmentOperation, AssignmentOutcome, AssignmentUpdate, Kind, ResolvedAddition, TargetName, Username } from '../../core/index.js'; /** The slice of a DML save/delete result we report on. Structurally a jsforce SaveResult. */ export type DmlResult = { success: boolean; errors: { errorCode: string; message: string; }[]; }; /** A DML create record field map. ExpirationDate may be null to clear it. */ export type DmlRecord = Record; /** A DML update record: the id to update, plus the expiration to set (null clears it). */ export type UpdateRecord = { Id: string; ExpirationDate: string | null; }; export type AdditionBatch = { sobject: string; additions: ResolvedAddition[]; records: DmlRecord[]; }; export type UpdateBatch = { sobject: string; updates: AssignmentUpdate[]; records: UpdateRecord[]; }; export type RemovalBatch = { sobject: string; removals: ActualAssignment[]; recordIds: string[]; }; /** What an outcome needs to name the record it reports on. Every DML input carries these. */ type AssignmentRef = { assignee: Username; kind: Kind; target: TargetName; }; /** * One DML call: the assignments it sends, the wire records paired to them by position, and * the call itself. The adapter supplies `send` because the Connection is its business, and * the pairing of a result back to the assignment that produced it is this module's. `send` * takes the rows to carry rather than closing over them, so a lock retry can resend only * the rows the org rejected without re-creating the ones it accepted. */ export type DmlJob = { items: Item[]; records: Row[]; send: (records: Row[]) => Promise; }; /** How a retry pauses between attempts. Injected so a spec can observe it without a timer. */ export type Wait = (milliseconds: number) => Promise; /** * Run every job through the pool and pair each record's result back to the assignment it * came from, by position: the Collections API answers in the order it was sent, which is * what lets a partial success name the records the org rejected rather than just count them. */ export declare function runJobs(jobs: DmlJob[], operation: AssignmentOperation, wait?: Wait): Promise; /** Group additions by sObject and chunk them for the Collections API, keeping each record's source. */ export declare function buildAdditionBatches(additions: ResolvedAddition[]): AdditionBatch[]; /** Group expiration updates by sObject and chunk them, building the Id + ExpirationDate records. */ export declare function buildUpdateBatches(updates: AssignmentUpdate[]): UpdateBatch[]; /** Group removals by sObject and chunk them for the Collections API. */ export declare function buildRemovalBatches(removals: ActualAssignment[]): RemovalBatch[]; export {}; //# sourceMappingURL=dml.d.ts.map