import { normalizeDiscoveryConfig } from "../discovery/path-policy.mjs";

export function normalizeRepoDiscoveryConfig(value) {
  return normalizeDiscoveryConfig(value, { allowRoots: true });
}

export function normalizeServiceDiscoveryConfig(value, serviceName) {
  try {
    return normalizeDiscoveryConfig(value, { allowRoots: true });
  } catch (error) {
    throw new Error(`Service "${serviceName}" has invalid discovery config: ${error.message}`);
  }
}
