import { createLogger } from "@open-mercato/shared/lib/logger";
const logger = createLogger("inbox_ops").child({ component: "execution-auditor" });
const metadata = {
  event: "inbox_ops.action.executed",
  persistent: true,
  id: "inbox_ops:execution-auditor"
};
async function handle(payload, ctx) {
  try {
    const dataEngine = ctx.resolve("dataEngine");
    if (!dataEngine?.audit) return;
    await dataEngine.audit({
      action: "inbox_ops.action.executed",
      resourceKind: `inbox_ops.${payload.actionType}`,
      resourceId: payload.actionId,
      userId: payload.executedByUserId,
      tenantId: payload.tenantId,
      organizationId: payload.organizationId,
      payload: {
        proposalId: payload.proposalId,
        actionType: payload.actionType,
        createdEntityId: payload.createdEntityId,
        createdEntityType: payload.createdEntityType
      }
    });
  } catch (err) {
    logger.error("Failed to write audit log", { err });
    throw err;
  }
}
export {
  handle as default,
  metadata
};
//# sourceMappingURL=executionAuditor.js.map
