{"version":3,"file":"loadLocaleIDs.cjs","names":["prismic"],"sources":["../../src/cli/loadLocaleIDs.ts"],"sourcesContent":["import * as prismic from \"@prismicio/client\";\nimport fetch from \"node-fetch\";\n\ntype LoadLocalesConfig =\n\t| {\n\t\t\tlocaleIDs?: string[];\n\t  }\n\t| {\n\t\t\tlocaleIDs?: string[];\n\t\t\trepositoryName: string;\n\t\t\taccessToken: string;\n\t\t\tfetchFromRepository?: boolean;\n\t  };\n\nexport const loadLocaleIDs = async (config: LoadLocalesConfig): Promise<string[]> => {\n\tconst localeIDs = new Set<string>(config.localeIDs || []);\n\n\tif (\"repositoryName\" in config && config.fetchFromRepository) {\n\t\tconst client = prismic.createClient(config.repositoryName, {\n\t\t\taccessToken: config.accessToken,\n\t\t\tfetch,\n\t\t});\n\n\t\tconst repository = await client.getRepository();\n\n\t\tfor (const language of repository.languages) {\n\t\t\tlocaleIDs.add(language.id);\n\t\t}\n\t}\n\n\treturn [...localeIDs];\n};\n"],"mappings":";;;;;;AAcA,MAAa,gBAAgB,OAAO,WAAiD;CACpF,MAAM,YAAY,IAAI,IAAY,OAAO,aAAa,EAAE,CAAC;AAEzD,KAAI,oBAAoB,UAAU,OAAO,qBAAqB;EAM7D,MAAM,aAAa,MALJA,kBAAQ,aAAa,OAAO,gBAAgB;GAC1D,aAAa,OAAO;GACpB,OAAA,WAAA;GACA,CAAC,CAE8B,eAAe;AAE/C,OAAK,MAAM,YAAY,WAAW,UACjC,WAAU,IAAI,SAAS,GAAG;;AAI5B,QAAO,CAAC,GAAG,UAAU"}