How to use the @salesforce/core.Aliases.getDefaultOptions function in @salesforce/core

To help you get started, we’ve selected a few @salesforce/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github forcedotcom / salesforcedx-vscode / packages / salesforcedx-vscode-core / src / orgPicker / orgList.ts View on Github external
const defaultDevHubUsernameorAlias = await this.getDefaultDevHubUsernameorAlias();
    if (defaultDevHubUsernameorAlias) {
      const defaultDevHubUsername =
        (await OrgAuthInfo.getUsername(defaultDevHubUsernameorAlias)) ||
        defaultDevHubUsernameorAlias;

      authInfoObjects = authInfoObjects.filter(
        fileData =>
          isNullOrUndefined(fileData.devHubUsername) ||
          (!isNullOrUndefined(fileData.devHubUsername) &&
            fileData.devHubUsername === defaultDevHubUsername)
      );
    }

    const authUsernames = authInfoObjects.map(file => file.username);
    const aliases = await Aliases.create(Aliases.getDefaultOptions());
    const authList = [];
    for (const username of authUsernames) {
      const alias = await aliases.getKeysByValue(username);
      if (alias.length > 0) {
        authList.push(alias + ' - ' + username);
      } else {
        authList.push(username);
      }
    }
    return authList;
  }