import{logger as n}from"../../../../tools/notifiers/logger.js";import{entityDatabaseSchema as s}from"../../schemas/database-schemas.js";import{validateWithResult as d}from"../../utils/ajv-validator.js";import{createBffRelatedEntities as r}from"./create-bff-related-entities.js";function p(e){const{domains:o,owners:i}=e,a=d(s,e);if(!a.success)return n.warn(`Invalid database catalog entity for entity ${e.key}, error: ${a.error}`),null;const t=a.data||{};return{id:t.id,organizationId:t.organization_id,projectId:t.project_id,type:t.type,key:t.key,title:t.title,summary:t.summary??void 0,tags:t.tags?JSON.parse(t.tags):null,metadata:t.metadata?JSON.parse(t.metadata):null,git:t.git?JSON.parse(t.git):null,contact:t.contact?JSON.parse(t.contact):null,links:t.links?JSON.parse(t.links):null,source:t.source,sourceFile:t.source_file??void 0,createdAt:t.created_at,updatedAt:t.updated_at,object:"catalogEntityView",domains:r(o),owners:r(i)}}export{p as createBffEntity};
