import{logger as o}from"../../../../tools/notifiers/logger.js";import{entityRelationDatabaseSchema as a}from"../../schemas/database-schemas.js";import{validateWithResult as n}from"../../utils/ajv-validator.js";function u(r){if(!r)return null;const t=n(a,{...r});if(!t.success)return o.warn(`Invalid database catalog entity relation, error: ${t.error}`),null;const e=t.data||{};return{id:e.id,organizationId:e.organizationId,projectId:e.projectId,sourceKey:e.sourceKey,targetKey:e.targetKey,sourceVersion:e.sourceVersion??null,sourceRevision:e.sourceRevision??null,targetVersion:e.targetVersion??null,targetRevision:e.targetRevision??null,type:e.sourceToTargetRelation,lastSeenRunId:e.lastSeenRunId??null,createdAt:e.createdAt,updatedAt:e.updatedAt,object:"catalogEntityRelation"}}export{u as createEntityRelationReadModel};
