import { surfaceRecordConflict } from "@open-mercato/ui/backend/conflicts";
function rowOptimisticVersion(row) {
  const value = row?.updatedAt;
  return typeof value === "string" && value.length ? value : void 0;
}
function readRowUpdatedAt(source) {
  if (!source || typeof source !== "object") return null;
  const record = source;
  const snake = record.updated_at;
  if (typeof snake === "string" && snake.length) return snake;
  const camel = record.updatedAt;
  if (typeof camel === "string" && camel.length) return camel;
  return null;
}
function handleSectionMutationError(err, t, refresh) {
  if (surfaceRecordConflict(err, t, { onRefresh: refresh })) {
    refresh();
    return true;
  }
  return false;
}
export {
  handleSectionMutationError,
  readRowUpdatedAt,
  rowOptimisticVersion
};
//# sourceMappingURL=optimisticLock.js.map
