import type { Constructor } from '../../types'; import { getServiceSchema, type ServiceSchema } from './index'; import type { ServerServiceSchema } from './server.types'; export function getServerServiceSchema(svc: Constructor): ServerServiceSchema | undefined { const schema = getServiceSchema(svc) as ServerServiceSchema; if (!schema) { return; } let base: undefined | ServiceSchema; if (schema.options?.as) { base = getServiceSchema(svc); if (!base) { throw new Error(`Service ${svc} base ${schema.options.as} is invalid`); } } return schema; }