private static async GetJsons()

in src/jsonLoader.ts [63:137]


    private static async GetJsons(repoType: SourceType, updateType: UpdateType, forceMicrosoftMasterSource?: boolean, checkForExistingPullRequest?: boolean): Promise<IndexedFoldersSet> {
        let visualNames: string[] = [];
        let allPromises: any[] = [];

        for (let visualName in data) {
            if (data[visualName]) {
                let folderNames: string[] = [];

                if (checkForExistingPullRequest) {
                    let prExists: boolean = await LocalizationStringsUploader.IsPullRequestExists(JsonLoader.microsoft, 
                        visualName,
                        updateType === UpdateType.CapabilitiesToCv ? "pbicvbot:locUpdateCapabilities" : "pbicvbot:locUpdate");
                    
                    forceMicrosoftMasterSource = !prExists;
                }

                if (repoType === SourceType.Capabilities) {
                    folderNames[0] = JsonLoader.capabilities;
                } else {
                    folderNames[0] = JsonLoader.enUs;
                }                

                folderNames = folderNames.filter(x => x !== "qps-ploc");

                for (let i in folderNames) {
                    let folder = folderNames[i];                    

                    let url: string = JsonLoader.BuildUrl(visualName, repoType, updateType, folder, forceMicrosoftMasterSource);
                    visualNames.push(visualName);

                    allPromises.push(
                        await JsonLoader.GetJsonByUrl(url)
                        .then((response: Promise<Response>) => {
                            console.log("received from " + url + " path");
                            return {
                                visualName: visualName,
                                folderName: folder,
                                response: response
                            }
                        })
                        .catch((rej) => {
                            console.log("Get error url: " + url + ": " + rej);
                        })
                    );
                }
            }
        }

        return Promise.all(allPromises)
            .then((values) => {  
                let allJsons: IndexedFoldersSet = {}; 

                for (let i in values) {
                        let val = values[i];
                        console.log("Visual " + val.visualName + " prepared for parsing");

                        // remove byte order mark from json string. Found in linedotchart
                        let val1 = val.response.toString().replace('\uFEFF', '');
                        
                        if (!allJsons[val.visualName]) {
                            allJsons[val.visualName] = new IndexedObjects();
                        }

                        allJsons[val.visualName][val.folderName] = JSON.parse(val1);
                        
                        console.log("Visual " + val.visualName + " " + val.folderName + " successfully parsed");
                    
                }
                
                return allJsons;
            }).catch((reject) => {
                console.log("Get jsons from github failed: " + reject);
                throw reject;
            });
    }