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