import { createLogger } from "../logger/index.js";
import { resolveCrudMutationGuardService } from "./mutation-guard-service.js";
const logger = createLogger("shared").child({ component: "crud" });
async function validateCrudMutationGuard(container, input) {
  const service = resolveCrudMutationGuardService(container);
  if (!service) return null;
  return service.validateMutation(input);
}
async function runCrudMutationGuardAfterSuccess(container, input) {
  const service = resolveCrudMutationGuardService(container);
  if (!service) return;
  try {
    await service.afterMutationSuccess(input);
  } catch (error) {
    logger.error("Mutation guard after-success hook failed", {
      resourceKind: input.resourceKind,
      resourceId: input.resourceId,
      operation: input.operation,
      requestMethod: input.requestMethod,
      err: error
    });
  }
}
export {
  runCrudMutationGuardAfterSuccess,
  validateCrudMutationGuard
};
//# sourceMappingURL=mutation-guard.js.map
