/** * Declarative field-map upsert applier for sync replay mutations. * * Owns the generic mechanics every per-resource replay handler repeats: * present-key filtering, per-field type coercion, unknown-key rejection, the * find-or-create upsert, the delete branch, optional snapshot serialization, * and the domain after-apply tail. Apps declare only the field map and hooks. * @deprecated Prefer resource-routed replay (`SyncEnvelopeReplayService` with `configuration`/`resourceTypeOverrides` and resource `writableAttributes` permit lists) — value casting and validation belong to the record layer. This applier remains for released applyHandlers adopters and will be removed after their migration. */ export default class SyncReplayUpsertApplier { afterApply: ((args: { mappedAttributes: Record>; mutation: ReturnType; context: Record>; record: ReturnType; }) => Promise> | void>) | undefined; fields: Record, label: string) => ReturnType)>; findRecord: ((args: { data: Record>; mutation: ReturnType; context: Record>; }) => Promise>) | undefined; findRecordForDelete: ((args: { mutation: ReturnType; context: Record>; }) => Promise>) | undefined; modelClass: any; restArgs: "error" | "ignore"; serialize: ((args: { mutation: ReturnType; context: Record>; record: ReturnType; }) => Promise>> | Record>) | undefined; /** * Creates a declarative upsert applier. * @param {object} args - Applier configuration. * @param {ReturnType} args.modelClass - Model class receiving the mutations. * @param {Record, label: string) => ReturnType)>} args.fields - Data-key → field-type map: a named type, a {type, column} rename spec, "ignored" for accepted-but-dropped keys, or a custom coercer function. * @param {(args: {data: Record>, mutation: ReturnType, context: Record>}) => Promise>} [args.findRecord] - Custom record resolver. Defaults to findBy({id: mutation.resourceId}). * @param {(args: {mutation: ReturnType, context: Record>}) => Promise>} [args.findRecordForDelete] - Custom delete resolver. Defaults to findRecord. * @param {"error" | "ignore"} [args.restArgs] - Unknown data-key handling. Defaults to "error". * @param {(args: {mappedAttributes: Record>, mutation: ReturnType, context: Record>, record: ReturnType}) => Promise> | void>} [args.afterApply] - Domain tail; its returned object merges into the apply result. * @param {(args: {mutation: ReturnType, context: Record>, record: ReturnType}) => Promise>> | Record>} [args.serialize] - Snapshot serializer; result lands on applyResult.serializedData. */ constructor({ afterApply, fields, findRecord, findRecordForDelete, modelClass, restArgs, serialize }: { modelClass: ReturnType; fields: Record, label: string) => ReturnType)>; findRecord?: (args: { data: Record>; mutation: ReturnType; context: Record>; }) => Promise>; findRecordForDelete?: (args: { mutation: ReturnType; context: Record>; }) => Promise>; restArgs?: "error" | "ignore"; afterApply?: (args: { mappedAttributes: Record>; mutation: ReturnType; context: Record>; record: ReturnType; }) => Promise> | void>; serialize?: (args: { mutation: ReturnType; context: Record>; record: ReturnType; }) => Promise>> | Record>; }); /** * Applies one normalized replay mutation to the declared model. * @param {{actor: ReturnType, context: Record>, existingSync: ReturnType, mutation: ReturnType}} args - Replay apply arguments. * @returns {Promise>>} Apply result with the record, created/deleted flags, optional serializedData, and afterApply extras. */ apply({ context, mutation }: { actor: ReturnType; context: Record>; existingSync: ReturnType; mutation: ReturnType; }): Promise>>; /** * Applies a delete mutation to the declared model. * @param {{context: Record>, mutation: ReturnType}} args - Delete arguments. * @returns {Promise>>} Apply result with the deleted flag. */ applyDelete({ context, mutation }: { context: Record>; mutation: ReturnType; }): Promise>>; /** * Maps present data keys through the declared field types. * @param {Record>} data - Normalized mutation data. * @returns {Record>} Coerced attributes keyed by column name. */ mappedAttributes(data: Record>): Record>; } //# sourceMappingURL=sync-replay-upsert-applier.d.ts.map