import { createNamespaceService, } from "../service.js";
import { fetchMetadataCatalog } from "./catalog.js";
function describeMetadataQuery(params) {
    if (!params)
        return undefined;
    const query = {};
    if (params.typeNames?.length) {
        query.typeNames = params.typeNames;
    }
    if (params.flags?.length) {
        query.flags = params.flags;
    }
    return Object.keys(query).length > 0 ? query : undefined;
}
export function createMetadataService(http) {
    const base = createNamespaceService(http, "metadata");
    const invoke = base;
    const service = base;
    service.listEntities = () => invoke("ListEntities", undefined, undefined);
    service.describeMetadata = (params) => invoke("DescribeMetadata", undefined, describeMetadataQuery(params));
    service.fetchCatalog = (options) => fetchMetadataCatalog(http, options);
    return service;
}
//# sourceMappingURL=service.js.map