import { Operation } from '@orbit/data';
import { InitializedRecord, RecordIdentity } from './record';
/**
 * Add record operation.
 */
export interface AddRecordOperation extends Operation {
    op: 'addRecord';
    record: InitializedRecord;
}
/**
 * Update record operation.
 */
export interface UpdateRecordOperation extends Operation {
    op: 'updateRecord';
    record: InitializedRecord;
}
/**
 * Remove record operation.
 */
export interface RemoveRecordOperation extends Operation {
    op: 'removeRecord';
    record: RecordIdentity;
}
/**
 * Replace key operation.
 */
export interface ReplaceKeyOperation extends Operation {
    op: 'replaceKey';
    record: RecordIdentity;
    key: string;
    value: string;
}
/**
 * Replace attribute operation.
 */
export interface ReplaceAttributeOperation extends Operation {
    op: 'replaceAttribute';
    record: RecordIdentity;
    attribute: string;
    value: unknown;
}
/**
 * Add to has-many relationship operation.
 */
export interface AddToRelatedRecordsOperation extends Operation {
    op: 'addToRelatedRecords';
    record: RecordIdentity;
    relationship: string;
    relatedRecord: RecordIdentity;
}
/**
 * Remove from has-many relationship operation.
 */
export interface RemoveFromRelatedRecordsOperation extends Operation {
    op: 'removeFromRelatedRecords';
    record: RecordIdentity;
    relationship: string;
    relatedRecord: RecordIdentity;
}
/**
 * Replace has-many relationship operation.
 */
export interface ReplaceRelatedRecordsOperation extends Operation {
    op: 'replaceRelatedRecords';
    record: RecordIdentity;
    relationship: string;
    relatedRecords: RecordIdentity[];
}
/**
 * Replace has-one relationship operation.
 */
export interface ReplaceRelatedRecordOperation extends Operation {
    op: 'replaceRelatedRecord';
    record: RecordIdentity;
    relationship: string;
    relatedRecord: RecordIdentity | null;
}
/**
 * Union of all record-related operations.
 */
export declare type RecordOperation = AddRecordOperation | UpdateRecordOperation | RemoveRecordOperation | ReplaceKeyOperation | ReplaceAttributeOperation | AddToRelatedRecordsOperation | RemoveFromRelatedRecordsOperation | ReplaceRelatedRecordsOperation | ReplaceRelatedRecordOperation;
export declare type AddRecordOperationResult = InitializedRecord;
export declare type UpdateRecordOperationResult = undefined;
export declare type RemoveRecordOperationResult = undefined;
export declare type ReplaceKeyOperationResult = undefined;
export declare type ReplaceAttributeOperationResult = undefined;
export declare type AddToRelatedRecordsOperationResult = undefined;
export declare type RemoveFromRelatedRecordsOperationResult = undefined;
export declare type ReplaceRelatedRecordsOperationResult = undefined;
export declare type ReplaceRelatedRecordOperationResult = undefined;
export declare type RecordOperationResult<T = InitializedRecord> = T | undefined;
/**
 * Coalesces operations into a minimal set of equivalent operations.
 *
 * This method respects the order of the operations array and does not allow
 * reordering of operations that affect relationships.
 */
export declare function coalesceRecordOperations(operations: RecordOperation[]): RecordOperation[];
/**
 * Determine the differences between a record and its updated version in terms
 * of a set of operations.
 */
export declare function recordDiffs(record: InitializedRecord, updatedRecord: InitializedRecord): RecordOperation[];
/**
 * Returns the deduped identities of all the records directly referenced by an
 * array of operations.
 */
export declare function recordsReferencedByOperations(operations: RecordOperation[]): RecordIdentity[];
