import { HttpMethod, RootAPIHelper } from '../root-api'; export const publishCollectionModuleDefinition = async (params: { apiKey: string; collectionModuleKey: string; host: string; }) => { const { apiKey, collectionModuleKey, host } = params; const rootApi = new RootAPIHelper({ host, apiKey }); const path = `/cli/collection-modules/${collectionModuleKey}/publish`; const response = await rootApi.send({ path, method: HttpMethod.Post, searchParams: { bumpSandbox: 'true' }, }); if (response.error) { throw new Error(JSON.stringify(response.error.error || response.error)); } return response; };