@salesforce/core

  • Version 2.37.0
  • Published
  • 773 kB
  • 18 dependencies
  • BSD-3-Clause license

Install

npm i @salesforce/core
yarn add @salesforce/core
pnpm add @salesforce/core

Overview

Core libraries to interact with SFDX projects, orgs, and APIs.

Index

Variables

Functions

Classes

Interfaces

Enums

Type Aliases

Namespaces

Variables

variable fs

const fs: any;
  • Deprecated

    Use fs/promises instead

variable REQUIRED_FIELDS

const REQUIRED_FIELDS: {
id: string;
username: string;
lastName: string;
alias: string;
timeZoneSidKey: string;
localeSidKey: string;
emailEncodingKey: string;
profileId: string;
languageLocaleKey: string;
email: string;
};
  • A Map of Required Salesforce User fields.

variable sfdc

const sfdc: {
trimTo15: (id?: string | undefined) => Optional<string>;
validateApiVersion: (value: string) => boolean;
validateEmail: (value: string) => boolean;
validateSalesforceId: (value: string) => boolean;
validatePathDoesNotContainInvalidChars: (value: string) => boolean;
findUpperCaseKeys: (
data?: JsonMap | undefined,
sectionBlocklist?: string[]
) => Optional<string>;
matchesAccessToken: (value: string) => boolean;
isInternalUrl: (url: string) => boolean;
};

    variable SFDX_HTTP_HEADERS

    const SFDX_HTTP_HEADERS: { 'content-type': string; 'user-agent': string };

      Functions

      function getJwtAudienceUrl

      getJwtAudienceUrl: (
      options: OAuth2Options & { createdOrgInstance?: string }
      ) => Promise<string>;

        function scratchOrgCreate

        scratchOrgCreate: (
        options: ScratchOrgCreateOptions
        ) => Promise<ScratchOrgCreateResult>;

          Classes

          class Aliases

          class Aliases extends ConfigGroup<ConfigGroup.Options> {}
          • Aliases specify alternate names for groups of properties used by the Salesforce CLI, such as orgs. By default, all aliases are stored under 'orgs', but groups allow aliases to be applied for other commands, settings, and parameters.

            **Note:** All aliases are stored at the global level.

            const aliases = await Aliases.create({});
            aliases.set('myAlias', 'username@company.org');
            await aliases.write();
            // Shorthand to get an alias.
            const username: string = await Aliases.fetch('myAlias');

            https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_cli_usernames_orgs.htm

            Deprecated

            Replaced by GlobalInfo in v3 https://github.com/forcedotcom/sfdx-core/blob/v3/MIGRATING_V2-V3.md#globalinfo

          constructor

          constructor(options: ConfigGroup.Options);
          • Constructor **Do not directly construct instances of this class -- use Aliases.create instead.**

            Parameter options

            The options for the class instance

          method fetch

          static fetch: (key: string, group?: AliasGroup) => Promise<Optional<string>>;
          • Get an alias from a key and group. Shorthand for Alias.create({}).get(key). Returns the promise resolved when the alias is created.

            Parameter key

            The value of the alias to match.

            Parameter group

            The group the alias belongs to. Defaults to Orgs.

          method getDefaultOptions

          static getDefaultOptions: () => ConfigGroup.Options;
          • Get Aliases specific options.

          method getFileName

          static getFileName: () => string;
          • The aliases state file filename.

          method parseAndUpdate

          static parseAndUpdate: (
          aliasKeyAndValues: string[],
          group?: AliasGroup
          ) => Promise<JsonMap>;
          • Updates a group of aliases in a bulk save and returns the new aliases that were saved.

            const aliases = await Aliases.parseAndUpdate(['foo=bar', 'bar=baz'])

            Parameter aliasKeyAndValues

            An array of strings in the format <alias>=<value>. Each element will be saved in the Aliases state file under the group.

            Parameter group

            The group the alias belongs to. Defaults to ORGS.

          method setMethod

          protected setMethod: (
          contents: Dictionary<AnyJson>,
          key: string,
          value?: AnyJson
          ) => void;

            class AuthInfo

            class AuthInfo extends AsyncCreatable<AuthInfo.Options> {}
            • Handles persistence and fetching of user authentication information using JWT, OAuth, or refresh tokens. Sets up the refresh flows that jsForce will use to keep tokens active. An AuthInfo can also be created with an access token, but AuthInfos created with access tokens can't be persisted to disk.

              **See** [Authorization](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_auth.htm)

              **See** [Salesforce DX Usernames and Orgs](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_cli_usernames_orgs.htm)

              // Creating a new authentication file.
              const authInfo = await AuthInfo.create({
              username: myAdminUsername,
              oauth2Options: {
              loginUrl, authCode, clientId, clientSecret
              }
              );
              authInfo.save();
              // Creating an authorization info with an access token.
              const authInfo = await AuthInfo.create({
              username: accessToken
              });
              // Using an existing authentication file.
              const authInfo = await AuthInfo.create({
              username: myAdminUsername
              });
              // Using the AuthInfo
              const connection = await Connection.create({ authInfo });

            constructor

            constructor(options: AuthInfo.Options);
            • Constructor **Do not directly construct instances of this class -- use AuthInfo.create instead.**

              Parameter options

              The options for the class instance

            method clearCache

            static clearCache: (username: string) => boolean;

            method getAuthorizationUrl

            static getAuthorizationUrl: (
            options: OAuth2Options & { scope?: string },
            oauth2?: OAuth2WithVerifier
            ) => string;
            • Get the authorization URL.

              Parameter options

              The options to generate the URL.

            method getConnectionOptions

            getConnectionOptions: () => ConnectionOptions;
            • Get the auth fields (decrypted) needed to make a connection.

            method getDefaultInstanceUrl

            static getDefaultInstanceUrl: () => string;
            • Returns the default instance url

              Returns

              {string}

            method getFields

            getFields: (decrypt?: boolean) => AuthFields;
            • Get the authorization fields.

              Parameter decrypt

              Decrypt the fields.

            method getOrgFrontDoorUrl

            getOrgFrontDoorUrl: () => string;
            • Get the org front door (used for web based oauth flows)

            method getSfdxAuthUrl

            getSfdxAuthUrl: () => string;
            • Get the SFDX Auth URL.

              **See** [SFDX Authorization](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_auth.htm#cli_reference_force_auth)

            method getUsername

            getUsername: () => Optional<string>;
            • Get the username.

            method hasAuthentications

            static hasAuthentications: () => Promise<boolean>;
            • Returns true if one or more authentications are persisted.

            method init

            init: () => Promise<void>;
            • Initializes an instance of the AuthInfo class.

            method isAccessTokenFlow

            isAccessTokenFlow: () => boolean;
            • Returns true if this is using an access token flow.

            method isJwt

            isJwt: () => boolean;
            • Returns true if this is using the JWT flow.

            method isOauth

            isOauth: () => boolean;
            • Returns true if this is using the oauth flow.

            method isRefreshTokenFlow

            isRefreshTokenFlow: () => boolean;
            • Returns true if this is using the refresh token flow.

            method isUsingAccessToken

            isUsingAccessToken: () => boolean;
            • Returns true if this org is using access token auth.

            method listAllAuthFiles

            static listAllAuthFiles: () => Promise<string[]>;

            method listAllAuthorizations

            static listAllAuthorizations: () => Promise<Authorization[]>;
            • Get a list of all authorizations based on auth files stored in the global directory.

              Returns

              {Promise<Authorization[]>}

            method parseSfdxAuthUrl

            static parseSfdxAuthUrl: (
            sfdxAuthUrl: string
            ) => Pick<AuthFields, 'clientId' | 'clientSecret' | 'refreshToken' | 'loginUrl'>;
            • Parse a sfdx auth url, usually obtained by authInfo.getSfdxAuthUrl.

              Parameter sfdxAuthUrl

              Example 1

              await AuthInfo.create(AuthInfo.parseSfdxAuthUrl(sfdxAuthUrl));

            method save

            save: (authData?: AuthFields) => Promise<AuthInfo>;
            • Updates the cache and persists the authentication fields (encrypted).

              Parameter authData

              New data to save.

            method setAlias

            setAlias: (alias: string) => Promise<void>;
            • Sets the provided alias to the username

              Parameter alias

              alias to set

            method setAsDefault

            setAsDefault: (options: {
            defaultUsername?: boolean;
            defaultDevhubUsername?: boolean;
            }) => Promise<void>;
            • Set the defaultusername or the defaultdevhubusername to the alias if it exists otherwise to the username. Method will try to set the local config first but will default to global config if that fails.

              Parameter options

            method update

            update: (authData?: AuthFields, encrypt?: boolean) => AuthInfo;
            • Update the authorization fields, encrypting sensitive fields, but do not persist. For convenience this object is returned.

              Parameter authData

              Authorization fields to update.

              Parameter encrypt

              Encrypt the fields.

            class AuthInfoConfig

            class AuthInfoConfig extends ConfigFile<ConfigFile.Options> {}

            method getOptions

            static getOptions: (username: string) => ConfigFile.Options;
            • Gets the config options for a given org ID.

              Parameter username

              The username for the org.

            class AuthRemover

            class AuthRemover extends AsyncOptionalCreatable {}
            • Handles the removing of authorizations, which includes deleting the auth file in the global .sfdx folder, deleting any configs that are associated with the username/alias, and deleting any aliases associated with the username

              const remover = await AuthRemover.create();
              await remover.removeAuth('example@mycompany.com');

              const remover = await AuthRemover.create();
              await remover.removeAllAuths();

              const remover = await AuthRemover.create();
              const authConfigs = await remover.findAuthConfigs(
              example@mycompany.com
              );
              const usernames = [...authConfigs.keys()];
              for (const username of usernames) {
              await remover.removeAuth(username);
              }

            property authConfigs

            authConfigs: AuthConfigs;

              method findAllAuthConfigs

              findAllAuthConfigs: () => Promise<AuthConfigs>;
              • Finds all authorization files in the global .sfdx folder

                Returns

                {Promise}

              method findAuthConfigs

              findAuthConfigs: (usernameOrAlias?: string) => Promise<AuthConfigs>;
              • Finds authorization files for username/alias in the global .sfdx folder **Throws** *SfdxError{ name: 'NoOrgFound' }* if no username, alias, or defaultusername

                Parameter usernameOrAlias

                username or alias of the auth you want to find, defaults to the configured defaultusername

                Returns

                {Promise}

              method init

              protected init: () => Promise<void>;

                method removeAllAuths

                removeAllAuths: () => Promise<void>;
                • Removes all authentication files and any configs or aliases associated with them

                method removeAuth

                removeAuth: (usernameOrAlias: string) => Promise<void>;
                • Removes the authentication and any configs or aliases associated with it

                  Parameter usernameOrAlias

                  the username or alias that you want to remove

                class BaseConfigStore

                abstract class BaseConfigStore<T extends BaseConfigStore.Options>
                extends AsyncCreatable<T>
                implements ConfigStore {}
                • An abstract class that implements all the config management functions but none of the storage functions.

                  **Note:** To see the interface, look in typescripts autocomplete help or the npm package's ConfigStore.d.ts file.

                constructor

                constructor(options: BaseConfigStore.Options);
                • Constructor.

                  Parameter options

                  The options for the class instance.

                property options

                protected options: BaseConfigStore.Options;

                  method awaitEach

                  awaitEach: (
                  actionFn: (key: string, value: AnyJson) => Promise<void>
                  ) => Promise<void>;
                  • Asynchronously invokes actionFn once for each key-value pair present in the config object.

                    Parameter actionFn

                    The function (key: string, value: ConfigValue) => Promise<void> to be called for each element.

                    Returns

                    {Promise}

                  method clear

                  clear: () => void;
                  • Removes all key/value pairs from the config object.

                  method entries

                  entries: () => ConfigEntry[];
                  • Returns an array of ConfigEntry for each element in the config.

                  method forEach

                  forEach: (actionFn: (key: string, value: AnyJson) => void) => void;
                  • Invokes actionFn once for each key-value pair present in the config object.

                    Parameter actionFn

                    The function (key: string, value: ConfigValue) => void to be called for each element.

                  method get

                  get: (key: string) => Optional<AnyJson>;
                  • Returns the value associated to the key, or undefined if there is none.

                    Parameter key

                    The key.

                  method getContents

                  getContents: () => Dictionary<AnyJson>;
                  • Returns the entire config contents.

                  method getKeysByValue

                  getKeysByValue: (value: AnyJson) => string[];
                  • Returns the list of keys that contain a value.

                    Parameter value

                    The value to filter keys on.

                  method has

                  has: (key: string) => boolean;
                  • Returns a boolean asserting whether a value has been associated to the key in the config object or not.

                    Parameter key

                    The key.

                  method keys

                  keys: () => string[];
                  • Returns an array that contains the keys for each element in the config object.

                  method set

                  set: (key: string, value: AnyJson) => Dictionary<AnyJson>;
                  • Sets the value for the key in the config object.

                    Parameter key

                    The Key.

                    Parameter value

                    The value.

                  method setContents

                  setContents: (contents?: Dictionary<AnyJson>) => void;
                  • Sets the entire config contents.

                    Parameter contents

                    The contents.

                  method setContentsFromObject

                  setContentsFromObject: <U extends object>(obj: U) => void;
                  • Convert an object to a ConfigContents and set it as the config contents.

                    Parameter obj

                    The object.

                  method setMethod

                  protected setMethod: (
                  contents: Dictionary<AnyJson>,
                  key: string,
                  value?: AnyJson
                  ) => void;

                    method toObject

                    toObject: () => JsonMap;

                    method unset

                    unset: (key: string) => boolean;
                    • Returns true if an element in the config object existed and has been removed, or false if the element does not exist. BaseConfigStore.has will return false afterwards.

                      Parameter key

                      The key.

                    method unsetAll

                    unsetAll: (keys: string[]) => boolean;
                    • Returns true if all elements in the config object existed and have been removed, or false if all the elements do not exist (some may have been removed). will return false afterwards.

                      Parameter keys

                      The keys.

                    method values

                    values: () => ConfigValue[];
                    • Returns an array that contains the values for each element in the config object.

                    class CometClient

                    abstract class CometClient extends EventEmitter {}
                    • Comet client interface. The is to allow for mocking the inner streaming Cometd implementation. The Faye implementation is used by default but it could be used to adapt another Cometd impl.

                    method addExtension

                    abstract addExtension: (extension: StreamingExtension) => void;
                    • Add a custom extension to the underlying client.

                      Parameter extension

                      The json function for the extension.

                    method disable

                    abstract disable: (label: string) => void;
                    • Disable polling features.

                      Parameter label

                      Polling feature label.

                    method disconnect

                    abstract disconnect: () => void;
                    • Method to call to disconnect the client from the server.

                    method handshake

                    abstract handshake: (callback: () => void) => void;
                    • handshake with the streaming channel

                      Parameter callback

                      Callback for the handshake when it successfully completes. The handshake should throw errors when errors are encountered.

                    method setHeader

                    abstract setHeader: (name: string, value: string) => void;
                    • Sets an http header name/value.

                      Parameter name

                      The header name.

                      Parameter value

                      The header value.

                    method subscribe

                    abstract subscribe: (
                    channel: string,
                    callback: (message: JsonMap) => void
                    ) => CometSubscription;
                    • Subscribes to Comet topics. Subscribe should perform a handshake if one hasn't been performed yet.

                      Parameter channel

                      The topic to subscribe to.

                      Parameter callback

                      The callback to execute once a message has been received.

                    class Config

                    class Config extends ConfigFile<ConfigFile.Options> {}
                    • The files where sfdx config values are stored for projects and the global space.

                      *Note:* It is not recommended to instantiate this object directly when resolving config values. Instead use ConfigAggregator

                      const localConfig = await Config.create({});
                      localConfig.set('defaultusername', 'username@company.org');
                      await localConfig.write();

                      https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_cli_config_values.htm

                    constructor

                    constructor(options?: ConfigFile.Options);

                      property API_VERSION

                      static readonly API_VERSION: string;
                      • The api version

                      property CUSTOM_ORG_METADATA_TEMPLATES

                      static readonly CUSTOM_ORG_METADATA_TEMPLATES: string;
                      • Custom templates repo or local location.

                      property DEFAULT_DEV_HUB_USERNAME

                      static readonly DEFAULT_DEV_HUB_USERNAME: string;

                      property DEFAULT_USERNAME

                      static readonly DEFAULT_USERNAME: string;

                      property DISABLE_TELEMETRY

                      static readonly DISABLE_TELEMETRY: string;
                      • Disables telemetry reporting

                      property ISV_DEBUGGER_SID

                      static readonly ISV_DEBUGGER_SID: string;
                      • The sid for the debugger configuration.

                      property ISV_DEBUGGER_URL

                      static readonly ISV_DEBUGGER_URL: string;
                      • The url for the debugger configuration.

                      property MAX_QUERY_LIMIT

                      static readonly MAX_QUERY_LIMIT: string;
                      • allows users to override the 10,000 result query limit

                      method addAllowedProperties

                      static addAllowedProperties: (metas: ConfigPropertyMeta[]) => void;
                      • Add an array of allowed config properties.

                        Parameter metas

                        Array of objects to set as the allowed config properties.

                      method clear

                      static clear: () => Promise<void>;
                      • Clear all the configured properties both local and global.

                      method getAllowedProperties

                      static getAllowedProperties: () => ConfigPropertyMeta[];
                      • Returns an array of objects representing the allowed config properties.

                      method getDefaultOptions

                      static getDefaultOptions: (
                      isGlobal?: boolean,
                      filename?: string
                      ) => ConfigFile.Options;
                      • Gets default options.

                        Parameter isGlobal

                        Make the config global.

                        Parameter filename

                        Override the default file. Config.getFileName

                      method getFileName

                      static getFileName: () => string;

                      method init

                      protected init: () => Promise<void>;
                      • Initializer for supported config types.

                      method read

                      read: (force?: boolean) => Promise<ConfigContents>;
                      • Read, assign, and return the config contents.

                      method set

                      set: (key: string, value: AnyJson) => Dictionary<AnyJson>;
                      • Sets a value for a property.

                        **Throws** *SfdxError{ name: 'InvalidConfigValue' }* If the input validator fails.

                        Parameter key

                        The property to set.

                        Parameter value

                        The value of the property.

                      method unset

                      unset: (key: string) => boolean;
                      • Unsets a value for a property.

                        **Throws** *SfdxError{ name: 'UnknownConfigKey' }* If the input validator fails.

                        Parameter key

                        The property to unset.

                      method update

                      static update: (
                      isGlobal: boolean,
                      propertyName: string,
                      value?: AnyJson
                      ) => Promise<ConfigContents>;
                      • The value of a supported config property.

                        Parameter isGlobal

                        True for a global config. False for a local config.

                        Parameter propertyName

                        The name of the property to set.

                        Parameter value

                        The property value.

                      method write

                      write: (newContents?: Dictionary<AnyJson>) => Promise<ConfigContents>;
                      • Writes Config properties taking into account encrypted properties.

                        Parameter newContents

                        The new Config value to persist.

                      method writeSync

                      writeSync: (newContents?: Dictionary<AnyJson>) => Dictionary<AnyJson>;
                      • DO NOT CALL - The config file needs to encrypt values which can only be done asynchronously. Call SfdxConfig.write instead.

                        **Throws** *SfdxError{ name: 'InvalidWrite' }* Always.

                        Parameter newContents

                        Contents to write

                      class ConfigAggregator

                      class ConfigAggregator extends AsyncOptionalCreatable<JsonMap> {}
                      • Aggregate global and local project config files, as well as environment variables for sfdx-config.json. The resolution happens in the following bottom-up order:

                        1. Environment variables (SFDX_LOG_LEVEL) 1. Workspace settings (<workspace-root>/.sfdx/sfdx-config.json) 1. Global settings ($HOME/.sfdx/sfdx-config.json)

                        Use ConfigAggregator.create to instantiate the aggregator.

                        const aggregator = await ConfigAggregator.create();
                        console.log(aggregator.getPropertyValue('defaultusername'));

                      constructor

                      constructor(options?: JsonMap);

                      method create

                      static create: <P, T extends AsyncOptionalCreatable<P>>(
                      this: new (options?: P) => T,
                      options?: P
                      ) => Promise<T>;

                        method getConfig

                        getConfig: () => JsonMap;
                        • Get the resolved config object from the local, global and environment config instances.

                        method getConfigInfo

                        getConfigInfo: () => ConfigInfo[];
                        • Get all resolved config property keys, values, locations, and paths.

                          > console.log(aggregator.getConfigInfo());
                          [
                          { key: 'logLevel', val: 'INFO', location: 'Environment', path: '$SFDX_LOG_LEVEL'}
                          { key: 'defaultusername', val: '<username>', location: 'Local', path: './.sfdx/sfdx-config.json'}
                          ]

                        method getEnvVars

                        getEnvVars: () => Map<string, string>;
                        • Get the config properties that are environment variables.

                        method getGlobalConfig

                        getGlobalConfig: () => Config;
                        • Get the global config instance.

                        method getInfo

                        getInfo: (key: string) => ConfigInfo;
                        • Get a resolved config property.

                          Parameter key

                          The key of the property.

                        method getInstance

                        static getInstance: <P, T extends AsyncOptionalCreatable<P>>(
                        this: new () => T
                        ) => T;
                        • Get the static ConfigAggregator instance. If one doesn't exist, one will be created with the **encrypted** config values. Encrypted config values need to be resolved asynchronously by calling ConfigAggregator.reload

                        method getLocalConfig

                        getLocalConfig: () => Config | undefined;
                        • Get the local project config instance.

                        method getLocation

                        getLocation: (key: string) => Optional<ConfigAggregator.Location>;
                        • Gets a resolved config property location.

                          For example, getLocation('logLevel') will return: 1. Location.GLOBAL if resolved to an environment variable. 1. Location.LOCAL if resolved to local project config. 1. Location.ENVIRONMENT if resolved to the global config.

                          Parameter key

                          The key of the property.

                        method getPath

                        getPath: (key: string) => Optional<string>;
                        • Get a resolved file path or environment variable name of the property.

                          For example, getPath('logLevel') will return: 1. $SFDX_LOG_LEVEL if resolved to an environment variable. 1. ./.sfdx/sfdx-config.json if resolved to the local config. 1. ~/.sfdx/sfdx-config.json if resolved to the global config. 1. undefined, if not resolved.

                          **Note:** that the path returned may be the absolute path instead of relative paths such as ./ and ~/.

                          Parameter key

                          The key of the property.

                        method getPropertyValue

                        getPropertyValue: (key: string) => Optional<AnyJson>;
                        • Get a resolved config property.

                          **Throws** *SfdxError{ name: 'UnknownConfigKey' }* An attempt to get a property that's not supported.

                          Parameter key

                          The key of the property.

                        method getValue

                        static getValue: (key: string) => ConfigInfo;
                        • Get the info for a given key. If the ConfigAggregator was not asynchronously created OR the ConfigAggregator.reload was not called, the config value may be encrypted.

                          Parameter key

                          The config key.

                        method init

                        init: () => Promise<void>;
                        • Initialize this instances async dependencies.

                        method reload

                        reload: () => Promise<ConfigAggregator>;
                        • Re-read all property configurations from disk.

                        class ConfigFile

                        class ConfigFile<T extends ConfigFile.Options> extends BaseConfigStore<T> {}
                        • Represents a json config file used to manage settings and state. Global config files are stored in the home directory hidden state folder (.sfdx) and local config files are stored in the project path, either in the hidden state folder or wherever specified.

                          class MyConfig extends ConfigFile {
                          public static getFileName(): string {
                          return 'myConfigFilename.json';
                          }
                          }
                          const myConfig = await MyConfig.create({
                          isGlobal: true
                          });
                          myConfig.set('mykey', 'myvalue');
                          await myConfig.write();

                        constructor

                        constructor(options: ConfigFile.Options);
                        • Create an instance of a config file without reading the file. Call read or readSync after creating the ConfigFile OR instantiate with ConfigFile.create instead.

                          Parameter options

                          The options for the class instance

                        property hasRead

                        protected hasRead: boolean;

                          property logger

                          protected logger: Logger;

                            property messages

                            protected messages: Messages;

                              method access

                              access: (perm?: number) => Promise<boolean>;

                              method accessSync

                              accessSync: (perm?: number) => boolean;

                              method exists

                              exists: () => Promise<boolean>;
                              • Check to see if the config file exists. Returns true if the config file exists and has access, false otherwise.

                              method existsSync

                              existsSync: () => boolean;
                              • Check to see if the config file exists. Returns true if the config file exists and has access, false otherwise.

                              method getDefaultOptions

                              static getDefaultOptions: (
                              isGlobal?: boolean,
                              filename?: string
                              ) => ConfigFile.Options;
                              • Returns the default options for the config file.

                                Parameter isGlobal

                                If the file should be stored globally or locally.

                                Parameter filename

                                The name of the config file.

                              method getFileName

                              static getFileName: () => string;
                              • Returns the config's filename.

                              method getPath

                              getPath: () => string;
                              • Returns the absolute path to the config file.

                                The first time getPath is called, the path is resolved and becomes immutable. This allows implementers to override options properties, like filePath, on the init method for async creation. If that is required for creation, the config files can not be synchronously created.

                              method init

                              protected init: () => Promise<void>;
                              • Used to initialize asynchronous components.

                                **Throws** *Error{ code: 'ENOENT' }* If the ConfigFile.getFilename file is not found when options.throwOnNotFound is true.

                              method isGlobal

                              isGlobal: () => boolean;
                              • Returns true if this config is using the global path, false otherwise.

                              method read

                              read: (throwOnNotFound?: boolean, force?: boolean) => Promise<ConfigContents>;
                              • Read the config file and set the config contents. Returns the config contents of the config file. As an optimization, files are only read once per process and updated in memory and via write(). To force a read from the filesystem pass force=true. **Throws** *SfdxError{ name: 'UnexpectedJsonFileFormat' }* There was a problem reading or parsing the file.

                                Parameter throwOnNotFound

                                Optionally indicate if a throw should occur on file read.

                                Parameter force

                                Optionally force the file to be read from disk even when already read within the process.

                              method readSync

                              readSync: (throwOnNotFound?: boolean, force?: boolean) => Dictionary<AnyJson>;
                              • Read the config file and set the config contents. Returns the config contents of the config file. As an optimization, files are only read once per process and updated in memory and via write(). To force a read from the filesystem pass force=true. **Throws** *SfdxError{ name: 'UnexpectedJsonFileFormat' }* There was a problem reading or parsing the file.

                                Parameter throwOnNotFound

                                Optionally indicate if a throw should occur on file read.

                                Parameter force

                                Optionally force the file to be read from disk even when already read within the process.

                              method resolveRootFolder

                              static resolveRootFolder: (isGlobal: boolean) => Promise<string>;
                              • Helper used to determine what the local and global folder point to. Returns the file path of the root folder.

                                Parameter isGlobal

                                True if the config should be global. False for local.

                              method resolveRootFolderSync

                              static resolveRootFolderSync: (isGlobal: boolean) => string;
                              • Helper used to determine what the local and global folder point to. Returns the file path of the root folder.

                                Parameter isGlobal

                                True if the config should be global. False for local.

                              method stat

                              stat: () => Promise<fsStats>;
                              • Get the stats of the file. Returns the stats of the file.

                                fs.stat

                              method statSync

                              statSync: () => fsStats;
                              • Get the stats of the file. Returns the stats of the file.

                                fs.stat

                              unlink: () => Promise<void>;

                              method unlinkSync

                              unlinkSync: () => void;

                              method write

                              write: (newContents?: Dictionary<AnyJson>) => Promise<ConfigContents>;
                              • Write the config file with new contents. If no new contents are provided it will write the existing config contents that were set from ConfigFile.read, or an empty file if ConfigFile.read was not called.

                                Parameter newContents

                                The new contents of the file.

                              method writeSync

                              writeSync: (newContents?: Dictionary<AnyJson>) => Dictionary<AnyJson>;
                              • Write the config file with new contents. If no new contents are provided it will write the existing config contents that were set from ConfigFile.read, or an empty file if ConfigFile.read was not called.

                                Parameter newContents

                                The new contents of the file.

                              class ConfigGroup

                              class ConfigGroup<T extends ConfigGroup.Options> extends ConfigFile<T> {}
                              • A config file that stores config values in groups. e.g. to store different config values for different commands, without having manually manipulate the config.

                                **Note:** All config methods are overwritten to use the ConfigGroup.setDefaultGroup.

                                class MyPluginConfig extends ConfigGroup<ConfigGroup.Options> {
                                public static getFileName(): string {
                                return 'myPluginConfigFilename.json';
                                }
                                }
                                const myConfig = await MyPluginConfig.create(ConfigGroup.getOptions('all'));
                                myConfig.setDefaultGroup('myCommand'); // Can be set in your command's init.
                                myConfig.set('mykey', 'myvalue'); // Sets 'myKey' for the 'myCommand' group.
                                myConfig.setInGroup('myKey', 'myvalue', 'all'); // Manually set in another group.
                                await myConfig.write();

                              property defaultGroup

                              protected defaultGroup: string;

                                method clear

                                clear: () => void;
                                • Remove all key value pairs from the default group.

                                method entries

                                entries: () => ConfigEntry[];
                                • Gets an array of key value pairs.

                                method get

                                get: (key: string) => Optional<AnyJson>;
                                • Returns a specified element from ConfigGroup. Returns the associated value.

                                  Parameter key

                                  The key.

                                method getGroup

                                getGroup: (group?: string) => Optional<Dictionary<AnyJson>>;
                                • Get all config contents for a group.

                                  Parameter group

                                  The group.

                                method getInGroup

                                getInGroup: (key: string, group?: string) => Optional<AnyJson>;
                                • Returns the value associated to the key and group, or undefined if there is none.

                                  Parameter key

                                  The key.

                                  Parameter group

                                  The group. Defaults to the default group.

                                method getOptions

                                static getOptions: (
                                defaultGroup: string,
                                filename?: string
                                ) => ConfigGroup.Options;
                                • Get ConfigGroup specific options, such as the default group.

                                  Parameter defaultGroup

                                  The default group to use when creating the config.

                                  Parameter filename

                                  The filename of the config file. Uses the static getFileName by default.

                                method has

                                has: (key: string) => boolean;
                                • Returns a boolean if an element with the specified key exists in the default group.

                                  Parameter key

                                  The key.

                                method init

                                init: () => Promise<void>;
                                • Initialize the asynchronous dependencies.

                                method keys

                                keys: () => string[];
                                • Returns an array of the keys from the default group.

                                method set

                                set: (key: string, value: AnyJson) => Dictionary<AnyJson>;
                                • Add or updates an element with the specified key in the default group.

                                  Parameter key

                                  The key.

                                  Parameter value

                                  The value.

                                method setContentsFromObject

                                setContentsFromObject: <U extends object>(obj: U) => void;
                                • Convert an object to a ConfigContents and set it as the config contents.

                                  Parameter obj

                                  The object.

                                method setDefaultGroup

                                setDefaultGroup: (group: string) => void;
                                • Sets the default group for all BaseConfigStore methods to use. **Throws** *SfdxError{ name: 'MissingGroupName' }* The group parameter is null or undefined.

                                  Parameter group

                                  The group.

                                method setInGroup

                                setInGroup: (
                                key: string,
                                value?: AnyJson,
                                group?: string
                                ) => Dictionary<AnyJson>;
                                • Sets the value for the key and group in the config object.

                                  Parameter key

                                  The key.

                                  Parameter value

                                  The value.

                                  Parameter group

                                  The group. Uses the default group if not specified.

                                method toObject

                                toObject: () => JsonMap;
                                • Convert the config object to a json object.

                                method unset

                                unset: (key: string) => boolean;
                                • Removes an element with the specified key from the default group. Returns true if the item was deleted.

                                  Parameter key

                                  The key.

                                method updateValue

                                updateValue: (key: string, value: AnyJson, group?: string) => Promise<void>;
                                • Set a value on a group. Returns the promise resolved when the value is set.

                                  Parameter key

                                  The key.

                                  Parameter value

                                  The value.

                                  Parameter group

                                  The group.

                                method updateValues

                                updateValues: (
                                newEntries: Dictionary<AnyJson>,
                                group?: string
                                ) => Promise<Dictionary<ConfigValue>>;
                                • Set a group of entries in a bulk save. Returns The new properties that were saved.

                                  Parameter newEntries

                                  An object representing the aliases to set.

                                  Parameter group

                                  The group the property belongs to.

                                method values

                                values: () => ConfigValue[];
                                • Returns an array of the values from the default group.

                                class Connection

                                class Connection extends JSForceConnection {}
                                • Handles connections and requests to Salesforce Orgs.

                                  // Uses latest API version
                                  const connection = await Connection.create({
                                  authInfo: await AuthInfo.create({ username: 'myAdminUsername' })
                                  });
                                  connection.query('SELECT Name from Account');
                                  // Use different API version
                                  connection.setApiVersion("42.0");
                                  connection.query('SELECT Name from Account');

                                constructor

                                constructor(options: Connection.Options);
                                • Constructor **Do not directly construct instances of this class -- use Connection.create instead.**

                                  Parameter options

                                  The options for the class instance.

                                property tooling

                                tooling: Tooling;
                                • Tooling api reference.

                                method autoFetchQuery

                                autoFetchQuery: <T>(
                                soql: string,
                                executeOptions?: ExecuteOptions
                                ) => Promise<QueryResult<T>>;
                                • Executes a query and auto-fetches (i.e., "queryMore") all results. This is especially useful with large query result sizes, such as over 2000 records. The default maximum fetch size is 10,000 records. Modify this via the options argument.

                                  Parameter soql

                                  The SOQL string.

                                  Parameter executeOptions

                                  The query options. NOTE: the autoFetch option will always be true.

                                method baseUrl

                                baseUrl: () => string;
                                • The Force API base url for the instance.

                                method create

                                static create: (
                                this: new (options: Connection.Options) => Connection,
                                options: Connection.Options
                                ) => Promise<Connection>;
                                • Creates an instance of a Connection. Performs additional async initializations.

                                  Parameter options

                                  Constructor options.

                                method deploy

                                deploy: (
                                zipInput: Buffer,
                                options: DeployOptionsWithRest,
                                callback?: Callback<AsyncResult>
                                ) => Promise<DeployResultLocator<AsyncResult>>;
                                • TODO: This should be moved into JSForce V2 once ready this is only a temporary solution to support both REST and SOAP APIs

                                  deploy a zipped buffer from the SDRL with REST or SOAP

                                  Parameter zipInput

                                  data to deploy

                                  Parameter options

                                  JSForce deploy options + a boolean for rest

                                  Parameter callback

                                method deployRecentValidation

                                deployRecentValidation: (
                                options: recentValidationOptions
                                ) => Promise<JsonCollection>;
                                • TODO: This should be moved into JSForce V2 once ready this is only a temporary solution to support both REST and SOAP APIs

                                  Will deploy a recently validated deploy request

                                  Parameter

                                  options.id = the deploy ID that's been validated already from a previous checkOnly deploy request

                                  Parameter

                                  options.rest = a boolean whether or not to use the REST API

                                method getApiVersion

                                getApiVersion: () => string;
                                • Get the API version used for all connection requests.

                                method getAuthInfoFields

                                getAuthInfoFields: () => AuthFields;
                                • Getter for the AuthInfo.

                                method getConnectionOptions

                                getConnectionOptions: () => AuthFields;
                                • Getter for the auth fields.

                                method getUsername

                                getUsername: () => Optional<string>;
                                • Getter for the username of the Salesforce Org.

                                method init

                                init: () => Promise<void>;
                                • Async initializer.

                                method isResolvable

                                isResolvable: () => Promise<boolean>;
                                • Verify that instance has a reachable DNS entry, otherwise will throw error

                                method isUsingAccessToken

                                isUsingAccessToken: () => boolean;
                                • Returns true if this connection is using access token auth.

                                method normalizeUrl

                                normalizeUrl: (url: string) => string;
                                • Normalize a Salesforce url to include a instance information.

                                  Parameter url

                                  Partial url.

                                method refreshAuth

                                refreshAuth: () => Promise<void>;
                                • Executes a get request on the baseUrl to force an auth refresh Useful for the raw methods (request, requestRaw) that use the accessToken directly and don't handle refreshes

                                method request

                                request: <T = JsonCollection>(
                                request: RequestInfo | string,
                                options?: JsonMap
                                ) => Promise<T>;
                                • Send REST API request with given HTTP request info, with connected session information and SFDX headers.

                                  Parameter request

                                  HTTP request object or URL to GET request.

                                  Parameter options

                                  HTTP API request options.

                                method requestRaw

                                requestRaw: (request: RequestInfo) => Promise<JsonMap>;
                                • Send REST API request with given HTTP request info, with connected session information and SFDX headers. This method returns a raw http response which includes a response body and statusCode.

                                  Parameter request

                                  HTTP request object or URL to GET request.

                                method retrieveMaxApiVersion

                                retrieveMaxApiVersion: () => Promise<string>;
                                • Retrieves the highest api version that is supported by the target server instance.

                                method setApiVersion

                                setApiVersion: (version: string) => void;
                                • Set the API version for all connection requests.

                                  **Throws** *SfdxError{ name: 'IncorrectAPIVersion' }* Incorrect API version.

                                  Parameter version

                                  The API version.

                                method singleRecordQuery

                                singleRecordQuery: <T>(
                                soql: string,
                                options?: SingleRecordQueryOptions
                                ) => Promise<T>;
                                • Executes a query using either standard REST or Tooling API, returning a single record. Will throw if either zero records are found OR multiple records are found.

                                  Parameter soql

                                  The SOQL string.

                                  Parameter options

                                  The query options.

                                method useLatestApiVersion

                                useLatestApiVersion: () => Promise<void>;
                                • Use the latest API version available on this.instanceUrl.

                                class DefaultUserFields

                                class DefaultUserFields extends AsyncCreatable<DefaultUserFields.Options> {}
                                • Provides a default set of fields values that can be used to create a user. This is handy for software development purposes.

                                  const connection: Connection = await Connection.create({
                                  authInfo: await AuthInfo.create({ username: 'user@example.com' })
                                  });
                                  const org: Org = await Org.create({ connection });
                                  const options: DefaultUserFields.Options = {
                                  templateUser: org.getUsername()
                                  };
                                  const fields = (await DefaultUserFields.create(options)).getFields();

                                constructor

                                constructor(options: DefaultUserFields.Options);

                                method getFields

                                getFields: () => UserFields;
                                • Get user fields.

                                method init

                                protected init: () => Promise<void>;
                                • Initialize asynchronous components.

                                class DeviceOauthService

                                class DeviceOauthService extends AsyncCreatable<OAuth2Options> {}
                                • Handles device based login flows

                                  Usage:

                                  const oauthConfig = {
                                  loginUrl: this.flags.instanceurl,
                                  clientId: this.flags.clientid,
                                  };
                                  const deviceOauthService = await DeviceOauthService.create(oauthConfig);
                                  const loginData = await deviceOauthService.requestDeviceLogin();
                                  console.log(loginData);
                                  const approval = await deviceOauthService.awaitDeviceApproval(loginData);
                                  const authInfo = await deviceOauthService.authorizeAndSave(approval);

                                constructor

                                constructor(options: OAuth2Options);

                                  property GRANT_TYPE

                                  static GRANT_TYPE: string;

                                    property RESPONSE_TYPE

                                    static RESPONSE_TYPE: string;

                                      property SCOPE

                                      static SCOPE: string;

                                        method authorizeAndSave

                                        authorizeAndSave: (approval: DeviceCodePollingResponse) => Promise<AuthInfo>;
                                        • Creates and saves new AuthInfo

                                          Returns

                                          {Promise}

                                        method awaitDeviceApproval

                                        awaitDeviceApproval: (
                                        loginData: DeviceCodeResponse
                                        ) => Promise<Nullable<DeviceCodePollingResponse>>;
                                        • Polls the server until successful response OR max attempts have been made

                                          Returns

                                          {Promise<Nullable>}

                                        method init

                                        protected init: () => Promise<void>;

                                          method requestDeviceLogin

                                          requestDeviceLogin: () => Promise<DeviceCodeResponse>;
                                          • Begin the authorization flow by requesting the login

                                            Returns

                                            {Promise}

                                          class Global

                                          class Global {}
                                          • Global constants, methods, and configuration.

                                          property DIR

                                          static readonly DIR: string;

                                          property LOG_FILE_PATH

                                          static readonly LOG_FILE_PATH: string;
                                          • The full system path to the global log file.

                                          property STATE_FOLDER

                                          static readonly STATE_FOLDER: string;
                                          • The global folder in which state is stored.

                                          method createDir

                                          static createDir: (dirPath?: string) => Promise<void>;
                                          • Creates a directory within Global.DIR, or Global.DIR itself if the dirPath param is not provided. This is resolved or rejected when the directory creation operation has completed.

                                            Parameter dirPath

                                            The directory path to be created within Global.DIR.

                                          method getEnvironmentMode

                                          static getEnvironmentMode: () => Mode;
                                          • Gets the current mode environment variable as a Mode instance.

                                            console.log(Global.getEnvironmentMode() === Mode.PRODUCTION);

                                          class Lifecycle

                                          class Lifecycle {}
                                          • An asynchronous event listener and emitter that follows the singleton pattern. The singleton pattern allows lifecycle events to be emitted from deep within a library and still be consumed by any other library or tool. It allows other developers to react to certain situations or events in your library without them having to manually call the method themselves.

                                            An example might be transforming metadata before it is deployed to an environment. As long as an event was emitted from the deploy library and you were listening on that event in the same process, you could transform the metadata before the deploy regardless of where in the code that metadata was initiated.

                                            Example 1

                                            // Listen for an event in a plugin hook
                                            Lifecycle.getInstance().on('deploy-metadata', transformMetadata)
                                            // Deep in the deploy code, fire the event for all libraries and plugins to hear.
                                            Lifecycle.getInstance().emit('deploy-metadata', metadataToBeDeployed);
                                            // if you don't need to await anything
                                            use `void Lifecycle.getInstance().emit('deploy-metadata', metadataToBeDeployed)` ;

                                          property telemetryEventName

                                          static readonly telemetryEventName: string;

                                            property warningEventName

                                            static readonly warningEventName: string;

                                              method emit

                                              emit: <T = AnyJson>(eventName: string, data: T) => Promise<void>;
                                              • Emit a given event, causing all callback functions to be run in the order they were registered

                                                Parameter eventName

                                                The name of the event to emit

                                                Parameter data

                                                The argument to be passed to the callback function

                                              method emitTelemetry

                                              emitTelemetry: (data: AnyJson) => Promise<void>;
                                              • Emit a telemetry event, causing all callback functions to be run in the order they were registered

                                                Parameter data

                                                The data to emit

                                              method emitWarning

                                              emitWarning: (warning: string) => Promise<void>;
                                              • Emit a warning event, causing all callback functions to be run in the order they were registered

                                                Parameter data

                                                The warning (string) to emit

                                              method getInstance

                                              static getInstance: () => Lifecycle;
                                              • Retrieve the singleton instance of this class so that all listeners and emitters can interact from any library or tool

                                              method getListeners

                                              getListeners: (eventName: string) => callback[];
                                              • Get an array of listeners (callback functions) for a given event

                                                Parameter eventName

                                                The name of the event to get listeners of

                                              method on

                                              on: <T = AnyJson>(eventName: string, cb: (data: T) => Promise<void>) => void;
                                              • Create a new listener for a given event

                                                Parameter eventName

                                                The name of the event that is being listened for

                                                Parameter cb

                                                The callback function to run when the event is emitted

                                              method onTelemetry

                                              onTelemetry: (cb: (data: Record<string, unknown>) => Promise<void>) => void;
                                              • Create a listener for the telemetry event

                                                Parameter cb

                                                The callback function to run when the event is emitted

                                              method onWarning

                                              onWarning: (cb: (warning: string) => Promise<void>) => void;
                                              • Create a listener for the warning event

                                                Parameter cb

                                                The callback function to run when the event is emitted

                                              method removeAllListeners

                                              removeAllListeners: (eventName: string) => void;
                                              • Remove all listeners for a given event

                                                Parameter eventName

                                                The name of the event to remove listeners of

                                              method staticVersion

                                              static staticVersion: () => string;
                                              • return the package.json version of the sfdx-core library.

                                              method version

                                              version: () => string;
                                              • return the package.json version of the sfdx-core library.

                                              class Logger

                                              class Logger {}
                                              • A logging abstraction powered by Bunyan that provides both a default logger configuration that will log to sfdx.log, and a way to create custom loggers based on the same foundation.

                                                // Gets the root sfdx logger
                                                const logger = await Logger.root();
                                                // Creates a child logger of the root sfdx logger with custom fields applied
                                                const childLogger = await Logger.child('myRootChild', {tag: 'value'});
                                                // Creates a custom logger unaffiliated with the root logger
                                                const myCustomLogger = new Logger('myCustomLogger');
                                                // Creates a child of a custom logger unaffiliated with the root logger with custom fields applied
                                                const myCustomChildLogger = myCustomLogger.child('myCustomChild', {tag: 'value'});

                                                **See** https://github.com/forcedotcom/node-bunyan

                                                **See** https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_dev_cli_log_messages.htm

                                              constructor

                                              constructor(optionsOrName: string | LoggerOptions);
                                              • Constructs a new Logger.

                                                Parameter optionsOrName

                                                A set of LoggerOptions or name to use with the default options.

                                                **Throws** *SfdxError{ name: 'RedundantRootLogger' }* More than one attempt is made to construct the root Logger.

                                              property debugEnabled

                                              debugEnabled: boolean;
                                              • Whether debug is enabled for this Logger.

                                              property DEFAULT_LEVEL

                                              static readonly DEFAULT_LEVEL: number;
                                              • The default LoggerLevel when constructing new Logger instances.

                                              property LEVEL_NAMES

                                              static readonly LEVEL_NAMES: string[];
                                              • A list of all lower case LoggerLevel names.

                                                **See** LoggerLevel

                                              property logRotationCount

                                              readonly logRotationCount: number;
                                              • The number of backup rotated log files to keep. Example: '3' will have the base sfdx.log file, and the past 3 (period) log files. See 'count' docs here: https://github.com/forcedotcom/node-bunyan#stream-type-rotating-file

                                              property logRotationPeriod

                                              readonly logRotationPeriod: string;
                                              • The default rotation period for logs. Example '1d' will rotate logs daily (at midnight). See 'period' docs here: https://github.com/forcedotcom/node-bunyan#stream-type-rotating-file

                                              property ROOT_NAME

                                              static readonly ROOT_NAME: string;
                                              • The name of the root sfdx Logger.

                                              method addField

                                              addField: (name: string, value: FieldValue) => Logger;
                                              • Add a field to all log lines for this logger. For convenience this object is returned.

                                                Parameter name

                                                The name of the field to add.

                                                Parameter value

                                                The value of the field to be logged.

                                              method addFilter

                                              addFilter: (filter: (...args: unknown[]) => unknown) => void;
                                              • Adds a filter to be applied to all logged messages.

                                                Parameter filter

                                                A function with signature (...args: any[]) => any[] that transforms log message arguments.

                                              method addLogFileStream

                                              addLogFileStream: (logFile: string) => Promise<void>;
                                              • Adds a file stream to this logger. Resolved or rejected upon completion of the addition.

                                                Parameter logFile

                                                The path to the log file. If it doesn't exist it will be created.

                                              method addLogFileStreamSync

                                              addLogFileStreamSync: (logFile: string) => void;
                                              • Adds a file stream to this logger. Resolved or rejected upon completion of the addition.

                                                Parameter logFile

                                                The path to the log file. If it doesn't exist it will be created.

                                              method addStream

                                              addStream: (stream: LoggerStream, defaultLevel?: LoggerLevelValue) => void;
                                              • Adds a stream.

                                                Parameter stream

                                                The stream configuration to add.

                                                Parameter defaultLevel

                                                The default level of the stream.

                                              method child

                                              static child: (name: string, fields?: Fields) => Promise<Logger>;
                                              • Create a child of the root logger, inheriting this instance's configuration such as level, streams, etc.

                                                Parameter name

                                                The name of the child logger.

                                                Parameter fields

                                                Additional fields included in all log lines.

                                              • Create a child logger, typically to add a few log record fields. For convenience this object is returned.

                                                Parameter name

                                                The name of the child logger that is emitted w/ log line as log:<name>.

                                                Parameter fields

                                                Additional fields included in all log lines for the child logger.

                                              method childFromRoot

                                              static childFromRoot: (name: string, fields?: Fields) => Logger;
                                              • Create a child of the root logger, inheriting this instance's configuration such as level, streams, etc.

                                                Parameter name

                                                The name of the child logger.

                                                Parameter fields

                                                Additional fields included in all log lines.

                                              method close

                                              close: (fn?: (stream: LoggerStream) => void) => void;
                                              • Close the logger, including any streams, and remove all listeners.

                                                Parameter fn

                                                A function with signature (stream: LoggerStream) => void to call for each stream with the stream as an arg.

                                              method debug

                                              debug: (...args: unknown[]) => Logger;
                                              • Logs at debug level with filtering applied. For convenience this object is returned.

                                                Parameter args

                                                Any number of arguments to be logged.

                                              method debugCallback

                                              debugCallback: (cb: () => unknown[] | string) => void;
                                              • Logs at debug level with filtering applied.

                                                Parameter cb

                                                A callback that returns on array objects to be logged.

                                              method destroyRoot

                                              static destroyRoot: () => void;
                                              • Destroys the root Logger.

                                              method enableDEBUG

                                              enableDEBUG: () => void;
                                              • Enables logging to stdout when the DEBUG environment variable is used. It uses the logger name as the debug name, so you can do DEBUG= to filter the results to your logger.

                                              method error

                                              error: (...args: unknown[]) => Logger;
                                              • Logs at error level with filtering applied. For convenience this object is returned.

                                                Parameter args

                                                Any number of arguments to be logged.

                                              method fatal

                                              fatal: (...args: unknown[]) => Logger;
                                              • Logs at fatal level with filtering applied. For convenience this object is returned.

                                                Parameter args

                                                Any number of arguments to be logged.

                                              method getBufferedRecords

                                              getBufferedRecords: () => LogLine[];
                                              • Gets an array of log line objects. Each element is an object that corresponds to a log line.

                                              method getBunyanLogger

                                              getBunyanLogger: () => any;
                                              • Gets the underlying Bunyan logger.

                                              method getLevel

                                              getLevel: () => LoggerLevelValue;
                                              • Gets the current level of this logger.

                                              method getLevelByName

                                              static getLevelByName: (levelName: string) => LoggerLevelValue;
                                              • Gets a numeric LoggerLevel value by string name.

                                                Parameter levelName

                                                The level name to convert to a LoggerLevel enum value.

                                                **Throws** *SfdxError{ name: 'UnrecognizedLoggerLevelName' }* The level name was not case-insensitively recognized as a valid LoggerLevel value.

                                                See Also

                                              method getName

                                              getName: () => string;
                                              • Gets the name of this logger.

                                              method getRoot

                                              static getRoot: () => Logger;
                                              • Gets the root logger with the default level, file stream, and DEBUG enabled.

                                              method info

                                              info: (...args: unknown[]) => Logger;
                                              • Logs at info level with filtering applied. For convenience this object is returned.

                                                Parameter args

                                                Any number of arguments to be logged.

                                              method readLogContentsAsText

                                              readLogContentsAsText: () => string;
                                              • Reads a text blob of all the log lines contained in memory or the log file.

                                              method root

                                              static root: () => Promise<Logger>;
                                              • Gets the root logger with the default level, file stream, and DEBUG enabled.

                                              method setLevel

                                              setLevel: (level?: LoggerLevelValue) => Logger;
                                              • Set the logging level of all streams for this logger. If a specific level is not provided, this method will attempt to read it from the environment variable SFDX_LOG_LEVEL, and if not found, Logger.DEFAULT_LOG_LEVEL will be used instead. For convenience this object is returned.

                                                Parameter level

                                                The logger level.

                                                **Throws** *SfdxError{ name: 'UnrecognizedLoggerLevelName' }* A value of level read from SFDX_LOG_LEVEL was invalid.

                                                // Sets the level from the environment or default value
                                                logger.setLevel()
                                                // Set the level from the INFO enum
                                                logger.setLevel(LoggerLevel.INFO)
                                                // Sets the level case-insensitively from a string value
                                                logger.setLevel(Logger.getLevelByName('info'))

                                              method shouldLog

                                              shouldLog: (level: LoggerLevelValue) => boolean;
                                              • Compares the requested log level with the current log level. Returns true if the requested log level is greater than or equal to the current log level.

                                                Parameter level

                                                The requested log level to compare against the currently set log level.

                                              method trace

                                              trace: (...args: any[]) => Logger;
                                              • Logs at trace level with filtering applied. For convenience this object is returned.

                                                Parameter args

                                                Any number of arguments to be logged.

                                              method useMemoryLogging

                                              useMemoryLogging: () => Logger;
                                              • Use in-memory logging for this logger instance instead of any parent streams. Useful for testing. For convenience this object is returned.

                                                **WARNING: This cannot be undone for this logger instance.**

                                              method warn

                                              warn: (...args: unknown[]) => Logger;
                                              • Logs at warn level with filtering applied. For convenience this object is returned.

                                                Parameter args

                                                Any number of arguments to be logged.

                                              class Messages

                                              class Messages {}
                                              • The core message framework manages messages and allows them to be accessible by all plugins and consumers of sfdx-core. It is set up to handle localization down the road at no additional effort to the consumer. Messages can be used for anything from user output (like the console), to error messages, to returned data from a method.

                                                Messages are loaded from loader functions. The loader functions will only run when a message is required. This prevents all messages from being loaded into memory at application startup. The functions can load from memory, a file, or a server.

                                                In the beginning of your app or file, add the loader functions to be used later. If using json or js files in a root messages directory (<moduleRoot>/messages), load the entire directory automatically with Messages.importMessagesDirectory. Message files must be in .json or .js that exports a json object with **only** top level key-value pairs. The values support [util.format](https://nodejs.org/api/util.html#util_util_format_format_args) style strings that apply the tokens passed into Message.getMessage

                                                A sample message file.

                                                {
                                                'msgKey': 'A message displayed in the terminal'
                                                }

                                                **Note:** When running unit tests individually, you may see errors that the messages aren't found. This is because index.js isn't loaded when tests run like they are when the package is required. To allow tests to run, import the message directory in each test (it will only do it once) or load the message file the test depends on individually.

                                                // Create loader functions for all files in the messages directory
                                                Messages.importMessagesDirectory(__dirname);
                                                // Now you can use the messages from anywhere in your code or file.
                                                // If using importMessageDirectory, the bundle name is the file name.
                                                const messages : Messages = Messages.loadMessages(packageName, bundleName);
                                                // Messages now contains all the message in the bundleName file.
                                                messages.getMessage('JsonParseError');

                                              constructor

                                              constructor(bundleName: string, locale: string, messages: Map<string, AnyJson>);
                                              • Create a new messages bundle.

                                                **Note:** Use {Messages.loadMessages} unless you are writing your own loader function.

                                                Parameter bundleName

                                                The bundle name.

                                                Parameter locale

                                                The locale.

                                                Parameter messages

                                                The messages. Can not be modified once created.

                                              property bundleName

                                              readonly bundleName: string;
                                              • The bundle name.

                                              property locale

                                              readonly locale: string;
                                              • The locale of the messages in this bundle.

                                              property readFile

                                              static readFile: (filePath: string) => AnyJson;
                                              • Internal readFile. Exposed for unit testing. Do not use util/fs.readFile as messages.js should have no internal dependencies.

                                                Parameter filePath

                                                read file target.

                                              method generateFileLoaderFunction

                                              static generateFileLoaderFunction: (
                                              bundleName: string,
                                              filePath: string
                                              ) => LoaderFunction;
                                              • Generate a file loading function. Use Messages.importMessageFile unless overriding the bundleName is required, then manually pass the loader function to Messages.setLoaderFunction.

                                                Parameter bundleName

                                                The name of the bundle.

                                                Parameter filePath

                                                The messages file path.

                                              method getLocale

                                              static getLocale: () => string;
                                              • Get the locale. This will always return 'en_US' but will return the machine's locale in the future.

                                              method getMessage

                                              getMessage: (key: string, tokens?: Tokens) => string;
                                              • Get a message using a message key and use the tokens as values for tokenization.

                                                Parameter key

                                                The key of the message.

                                                Parameter tokens

                                                The values to substitute in the message.

                                                **See** https://nodejs.org/api/util.html#util_util_format_format_args

                                              method importMessageFile

                                              static importMessageFile: (packageName: string, filePath: string) => void;
                                              • Add a single message file to the list of loading functions using the file name as the bundle name. The loader will only be added if the bundle name is not already taken.

                                                Parameter packageName

                                                The npm package name.

                                                Parameter filePath

                                                The path of the file.

                                              method importMessagesDirectory

                                              static importMessagesDirectory: (
                                              moduleDirectoryPath: string,
                                              truncateToProjectPath?: boolean,
                                              packageName?: string
                                              ) => void;
                                              • Import all json and js files in a messages directory. Use the file name as the bundle key when Messages.loadMessages is called. By default, we're assuming the moduleDirectoryPart is a typescript project and will truncate to root path (where the package.json file is). If your messages directory is in another spot or you are not using typescript, pass in false for truncateToProjectPath.

                                                // e.g. If your message directory is in the project root, you would do:
                                                Messages.importMessagesDirectory(__dirname);

                                                Parameter moduleDirectoryPath

                                                The path to load the messages folder.

                                                Parameter truncateToProjectPath

                                                Will look for the messages directory in the project root (where the package.json file is located). i.e., the module is typescript and the messages folder is in the top level of the module directory.

                                                Parameter packageName

                                                The npm package name. Figured out from the root directory's package.json.

                                              method isCached

                                              static isCached: (packageName: string, bundleName: string) => boolean;
                                              • Check if a bundle already been loaded.

                                                Parameter packageName

                                                The npm package name.

                                                Parameter bundleName

                                                The bundle name.

                                              method loadMessages

                                              static loadMessages: (packageName: string, bundleName: string) => Messages;

                                              method setLoaderFunction

                                              static setLoaderFunction: (
                                              packageName: string,
                                              bundle: string,
                                              loader: LoaderFunction
                                              ) => void;
                                              • Set a custom loader function for a package and bundle that will be called on Messages.loadMessages.

                                                Parameter packageName

                                                The npm package name.

                                                Parameter bundle

                                                The name of the bundle.

                                                Parameter loader

                                                The loader function.

                                              class MyDomainResolver

                                              class MyDomainResolver extends AsyncOptionalCreatable<MyDomainResolver.Options> {}
                                              • A class used to resolve MyDomains. After a ScratchOrg is created it's host name my not be propagated to the Salesforce DNS service. This service is not exclusive to Salesforce My Domain URL and could be used for any hostname.

                                                (async () => {
                                                const options: MyDomainResolver.Options = {
                                                url: new URL('http://mydomain.salesforce.com'),
                                                timeout: Duration.minutes(5),
                                                frequency: Duration.seconds(10)
                                                };
                                                const resolver: MyDomainResolver = await MyDomainResolver.create(options);
                                                const ipAddress: AnyJson = await resolver.resolve();
                                                console.log(`Successfully resolved host: ${options.url} to address: ${ipAddress}`);
                                                })();

                                              constructor

                                              constructor(options?: MyDomainResolver.Options);
                                              • Constructor **Do not directly construct instances of this class -- use MyDomainResolver.create instead.**

                                                Parameter options

                                                The options for the class instance

                                              property DEFAULT_DOMAIN

                                              static DEFAULT_DOMAIN: URL;

                                                method getCnames

                                                getCnames: () => Promise<string[]>;

                                                  method init

                                                  protected init: () => Promise<void>;
                                                  • Used to initialize asynchronous components.

                                                  method resolve

                                                  resolve: () => Promise<string>;
                                                  • Method that performs the dns lookup of the host. If the lookup fails the internal polling client will try again given the optional interval. Returns the resolved ip address.

                                                    If SFDX_DISABLE_DNS_CHECK environment variable is set to true, it will immediately return the host without executing the dns loookup.

                                                  class OAuth2WithVerifier

                                                  class OAuth2WithVerifier extends OAuth2 {}
                                                  • Extend OAuth2 to add code verifier support for the auth code (web auth) flow const oauth2 = new OAuth2WithVerifier({ loginUrl, clientSecret, clientId, redirectUri });

                                                    const authUrl = oauth2.getAuthorizationUrl({ state: 'foo', prompt: 'login', scope: 'api web' }); console.log(authUrl); const authCode = await retrieveCode(); const authInfo = await AuthInfo.create({ oauth2Options: { clientId, clientSecret, loginUrl, authCode }, oauth2}); console.log(access token: ${authInfo.getFields().accessToken});

                                                  constructor

                                                  constructor(options: OAuth2Options);

                                                    property codeVerifier

                                                    readonly codeVerifier: string;

                                                      method getAuthorizationUrl

                                                      getAuthorizationUrl: (params: Record<string, unknown>) => string;
                                                      • Overrides jsforce.OAuth2.getAuthorizationUrl. Get Salesforce OAuth2 authorization page URL to redirect user agent, adding a verification code for added security.

                                                        Parameter params

                                                      method requestToken

                                                      requestToken: (
                                                      code: string,
                                                      callback?: (err: Error, tokenResponse: TokenResponse) => void
                                                      ) => Promise<TokenResponse>;

                                                        class Org

                                                        class Org extends AsyncCreatable<Org.Options> {}
                                                        • Provides a way to manage a locally authenticated Org.

                                                          **See** AuthInfo

                                                          **See** Connection

                                                          **See** Aliases

                                                          **See** Config

                                                          // Email username
                                                          const org1: Org = await Org.create({ aliasOrUsername: 'foo@example.com' });
                                                          // The defaultusername config property
                                                          const org2: Org = await Org.create({});
                                                          // Full Connection
                                                          const org3: Org = await Org.create({
                                                          connection: await Connection.create({
                                                          authInfo: await AuthInfo.create({ username: 'username' })
                                                          })
                                                          });

                                                          **See** https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_cli_usernames_orgs.htm

                                                        constructor

                                                        constructor(options: Org.Options);

                                                        method addUsername

                                                        addUsername: (auth: AuthInfo | string) => Promise<Org>;
                                                        • Adds a username to the user config for this org. For convenience this object is returned.

                                                          const org: Org = await Org.create({
                                                          connection: await Connection.create({
                                                          authInfo: await AuthInfo.create('foo@example.com')
                                                          })
                                                          });
                                                          const userAuth: AuthInfo = await AuthInfo.create({
                                                          username: 'bar@example.com'
                                                          });
                                                          await org.addUsername(userAuth);

                                                          Parameter auth

                                                          The AuthInfo for the username to add.

                                                        method checkScratchOrg

                                                        checkScratchOrg: (
                                                        devHubUsernameOrAlias?: string
                                                        ) => Promise<Partial<AuthFields>>;
                                                        • Check that this org is a scratch org by asking the dev hub if it knows about it.

                                                          **Throws** *SfdxError{ name: 'NotADevHub' }* Not a Dev Hub.

                                                          **Throws** *SfdxError{ name: 'NoResults' }* No results.

                                                          Parameter devHubUsernameOrAlias

                                                          The username or alias of the dev hub org.

                                                        method cleanLocalOrgData

                                                        cleanLocalOrgData: (
                                                        orgDataPath?: string,
                                                        throwWhenRemoveFails?: boolean
                                                        ) => Promise<void>;
                                                        • Clean all data files in the org's data path. Usually /.sfdx/orgs/.

                                                          Parameter orgDataPath

                                                          A relative path other than "orgs/".

                                                          Parameter throwWhenRemoveFails

                                                          Should the remove org operations throw an error on failure?

                                                        method cloneSandbox

                                                        cloneSandbox: (
                                                        sandboxReq: SandboxRequest,
                                                        sandboxName: string,
                                                        options: { wait?: Duration; interval?: Duration }
                                                        ) => Promise<SandboxProcessObject>;
                                                        • Parameter sandboxReq

                                                          SandboxRequest options to create the sandbox with

                                                          Parameter sandboxName

                                                          Parameter options

                                                          Wait: The amount of time to wait before timing out, defaults to 0, Interval: The time interval between polling defaults to 30 seconds

                                                          Returns

                                                          {SandboxProcessObject} the newly created sandbox process object

                                                        method createSandbox

                                                        createSandbox: (
                                                        sandboxReq: SandboxRequest,
                                                        options: { wait?: Duration; interval?: Duration }
                                                        ) => Promise<SandboxProcessObject>;
                                                        • create a sandbox from a production org 'this' needs to be a production org with sandbox licenses available

                                                          Parameter sandboxReq

                                                          SandboxRequest options to create the sandbox with

                                                          Parameter options

                                                          Wait: The amount of time to wait before timing out, Interval: The time interval between polling

                                                        method delete

                                                        delete: () => Promise<void>;
                                                        • Will delete 'this' instance remotely and any files locally

                                                        method deleteFrom

                                                        deleteFrom: (controllingOrg: string | Org) => Promise<void>;
                                                        • Will delete 'this' instance remotely and any files locally

                                                          Parameter controllingOrg

                                                          username or Org that 'this.devhub' or 'this.production' refers to. AKA a DevHub for a scratch org, or a Production Org for a sandbox

                                                        method determineIfDevHubOrg

                                                        determineIfDevHubOrg: (forceServerCheck?: boolean) => Promise<boolean>;
                                                        • Returns true if the org is a Dev Hub.

                                                          Use a cached value. If the cached value is not set, then check access to the ScratchOrgInfo object to determine if the org is a dev hub.

                                                          Parameter forceServerCheck

                                                          Ignore the cached value and go straight to the server which will be required if the org flips on the dev hub after the value is already cached locally.

                                                        method getConfigAggregator

                                                        getConfigAggregator: () => ConfigAggregator;
                                                        • Returns for the config aggregator.

                                                        method getConnection

                                                        getConnection: () => Connection;
                                                        • Returns the JSForce connection for the org.

                                                        method getDefaultOptions

                                                        protected getDefaultOptions: () => Org.Options;
                                                        • **Throws** *SfdxError Throws and unsupported error.

                                                        method getDevHubOrg

                                                        getDevHubOrg: () => Promise<Optional<Org>>;
                                                        • Returns the Org object or null if this org is not affiliated with a Dev Hub (according to the local config).

                                                        method getField

                                                        getField: (key: Org.Fields) => AnyJson;
                                                        • Returns an org field. Returns undefined if the field is not set or invalid.

                                                        method getFields

                                                        getFields: (keys: Org.Fields[]) => JsonMap;
                                                        • Returns a map of requested fields.

                                                        method getOrgId

                                                        getOrgId: () => string;
                                                        • Returns the orgId for this org.

                                                        method getSandboxOrgConfigField

                                                        getSandboxOrgConfigField: (field: SandboxOrgConfig.Fields) => Promise<any>;
                                                        • Returns an org config field. Returns undefined if the field is not set or invalid.

                                                        method getUsername

                                                        getUsername: () => Optional<string>;
                                                        • Returns the admin username used to create the org.

                                                        method init

                                                        protected init: () => Promise<void>;
                                                        • Initialize async components.

                                                        method isDevHubOrg

                                                        isDevHubOrg: () => boolean;
                                                        • Returns true if the org is a Dev Hub.

                                                          **Note** This relies on a cached value in the auth file. If that property is not cached, this method will **always return false even if the org is a dev hub**. If you need accuracy, use the Org.determineIfDevHubOrg method.

                                                        method isSandbox

                                                        isSandbox: () => Promise<boolean>;
                                                        • Check if org is a sandbox org by checking its SandboxOrgConfig.

                                                        method readUserAuthFiles

                                                        readUserAuthFiles: () => Promise<AuthInfo[]>;
                                                        • Reads and returns the content of all user auth files for this org as an array.

                                                        method refreshAuth

                                                        refreshAuth: () => Promise<void>;
                                                        • Refreshes the auth for this org's instance by calling HTTP GET on the baseUrl of the connection object.

                                                        method remove

                                                        remove: (throwWhenRemoveFails?: boolean) => Promise<void>;
                                                        • Removes the scratch org config file at $HOME/.sfdx/[name].json, any project level org files, all user auth files for the org, matching default config settings, and any matching aliases.

                                                          Parameter throwWhenRemoveFails

                                                          Determines if the call should throw an error or fail silently.

                                                        method removeUsername

                                                        removeUsername: (auth: AuthInfo | string) => Promise<Org>;
                                                        • Removes a username from the user config for this object. For convenience this object is returned.

                                                          **Throws** *SfdxError{ name: 'MissingAuthInfo' }* Auth info is missing.

                                                          Parameter auth

                                                          The AuthInfo containing the username to remove.

                                                        method retrieveMaxApiVersion

                                                        retrieveMaxApiVersion: () => Promise<string>;
                                                        • Retrieves the highest api version that is supported by the target server instance. If the apiVersion configured for Sfdx is greater than the one returned in this call an api version mismatch occurs. In the case of the CLI that results in a warning.

                                                        method retrieveOrgUsersConfig

                                                        retrieveOrgUsersConfig: () => Promise<OrgUsersConfig>;

                                                        method sandboxStatus

                                                        sandboxStatus: (
                                                        sandboxname: string,
                                                        options: { wait?: Duration; interval?: Duration }
                                                        ) => Promise<SandboxProcessObject>;
                                                        • Reports sandbox org creation status. If the org is ready, authenticates to the org.

                                                          Parameter string

                                                          the sandbox name

                                                          Parameter options

                                                          Wait: The amount of time to wait before timing out, Interval: The time interval between polling

                                                          Returns

                                                          {SandboxProcessObject} the sandbox process object

                                                        method scratchOrgCreate

                                                        scratchOrgCreate: (
                                                        options: ScratchOrgRequest
                                                        ) => Promise<ScratchOrgCreateResult>;
                                                        • Creates a scratchOrg 'this' needs to be a valid dev-hub

                                                          Parameter ScratchOrgCreateOptions

                                                          Returns

                                                          {ScratchOrgCreateResult}

                                                        method setSandboxOrgConfigField

                                                        setSandboxOrgConfigField: (
                                                        field: SandboxOrgConfig.Fields,
                                                        value: string
                                                        ) => Promise<Org>;
                                                        • Sets the key/value pair in the sandbox config for this org. For convenience this object is returned.

                                                          Parameter The

                                                          key for this value

                                                          Parameter The

                                                          value to save

                                                        class OrgUsersConfig

                                                        class OrgUsersConfig extends ConfigFile<OrgUsersConfig.Options> {}
                                                        • A config file that stores usernames for an org.

                                                        constructor

                                                        constructor(options: OrgUsersConfig.Options);
                                                        • Constructor. **Do not directly construct instances of this class -- use OrgUsersConfig.create instead.**

                                                          Parameter options

                                                          The options for the class instance

                                                        method getOptions

                                                        static getOptions: (orgId: string) => OrgUsersConfig.Options;
                                                        • Gets the config options for a given org ID.

                                                          Parameter orgId

                                                          The orgId. Generally this org would have multiple users configured.

                                                        class PermissionSetAssignment

                                                        class PermissionSetAssignment {}
                                                        • A class for assigning a Salesforce User to one or more permission sets.

                                                        method create

                                                        create: (
                                                        id: string,
                                                        permSetString: string
                                                        ) => Promise<PermissionSetAssignmentFields>;
                                                        • Assigns a user to one or more permission sets.

                                                          Parameter id

                                                          A user id

                                                          Parameter permSetString

                                                          An array of permission set names.

                                                        method init

                                                        static init: (org: Org) => Promise<PermissionSetAssignment>;
                                                        • Creates a new instance of PermissionSetAssignment.

                                                          Parameter org

                                                          The target org for the assignment.

                                                        class PollingClient

                                                        class PollingClient extends AsyncOptionalCreatable<PollingClient.Options> {}
                                                        • This is a polling client that can be used to poll the status of long running tasks. It can be used as a replacement for Streaming when streaming topics are not available or when streaming handshakes are failing. Why wouldn't you want to use this? It can impact Salesforce API usage.

                                                          const options: PollingClient.Options = {
                                                          async poll(): Promise<StatusResult> {
                                                          return Promise.resolve({ completed: true, payload: 'Hello World' });
                                                          },
                                                          frequency: Duration.milliseconds(10),
                                                          timeout: Duration.minutes(1)
                                                          };
                                                          const client = await PollingClient.create(options);
                                                          const pollResult = await client.subscribe();
                                                          console.log(`pollResult: ${pollResult}`);

                                                        constructor

                                                        constructor(options?: PollingClient.Options);
                                                        • Constructor

                                                          Parameter options

                                                          Polling client options

                                                        property logger

                                                        protected logger: Logger;

                                                          method init

                                                          init: () => Promise<void>;
                                                          • Asynchronous initializer.

                                                          method subscribe

                                                          subscribe: <T = AnyJson>() => Promise<T | undefined>;
                                                          • Returns a promise to call the specified polling function using the interval and timeout specified in the polling options.

                                                          class SchemaPrinter

                                                          class SchemaPrinter {}
                                                          • Prints a JSON schema in a human-friendly format.

                                                            import chalk from 'chalk';
                                                            class MyPropertyRenderer extends SchemaPropertyRenderer {
                                                            renderName(name) { return chalk.bold.blue(name); }
                                                            }
                                                            const printer = new SchemaPrinter(logger, schema, new MyPropertyRenderer());
                                                            printer.getLines().forEach(console.log);

                                                          constructor

                                                          constructor(
                                                          logger: Logger,
                                                          schema: JsonMap,
                                                          propertyRenderer?: SchemaPropertyRenderer
                                                          );
                                                          • Constructs a new SchemaPrinter.

                                                            Parameter logger

                                                            The logger to use when emitting the printed schema.

                                                            Parameter schema

                                                            The schema to print.

                                                            Parameter propertyRenderer

                                                            The property renderer.

                                                          method getLine

                                                          getLine: (index: number) => string;
                                                          • Gets a ready-to-display line by index.

                                                            Parameter index

                                                            The line index to get.

                                                          method getLines

                                                          getLines: () => readonly string[];
                                                          • Gets a read-only array of ready-to-display lines.

                                                          method print

                                                          print: () => void;
                                                          • Prints the accumulated set of schema lines as info log lines to the logger.

                                                          class SchemaValidator

                                                          class SchemaValidator {}
                                                          • Loads a JSON schema and performs validations against JSON objects.

                                                          constructor

                                                          constructor(logger: Logger, schemaPath: string);
                                                          • Creates a new SchemaValidator instance given a logger and path to a schema file.

                                                            Parameter logger

                                                            An Logger instance on which to base this class's logger.

                                                            Parameter schemaPath

                                                            The path to the schema file to load and use for validation.

                                                          method load

                                                          load: () => Promise<JsonMap>;
                                                          • Loads a JSON schema from the schemaPath parameter provided at instantiation.

                                                          method loadSync

                                                          loadSync: () => JsonMap;
                                                          • Loads a JSON schema from the schemaPath parameter provided at instantiation.

                                                          method validate

                                                          validate: (json: AnyJson) => Promise<AnyJson>;
                                                          • Performs validation of JSON data against the schema located at the schemaPath value provided at instantiation.

                                                            **Throws** *SfdxError{ name: 'ValidationSchemaFieldErrors' }* If there are known validations errors. **Throws** *SfdxError{ name: 'ValidationSchemaUnknown' }* If there are unknown validations errors.

                                                            Parameter json

                                                            A JSON value to validate against this instance's target schema.

                                                            Returns

                                                            The validated JSON data.

                                                          method validateSync

                                                          validateSync: (json: AnyJson) => AnyJson;
                                                          • Performs validation of JSON data against the schema located at the schemaPath value provided at instantiation.

                                                            **Throws** *SfdxError{ name: 'ValidationSchemaFieldErrors' }* If there are known validations errors. **Throws** *SfdxError{ name: 'ValidationSchemaUnknown' }* If there are unknown validations errors.

                                                            Parameter json

                                                            A JSON value to validate against this instance's target schema.

                                                            Returns

                                                            The validated JSON data.

                                                          class SfdcUrl

                                                          class SfdcUrl extends URL {}

                                                            constructor

                                                            constructor(input: any, base?: any);

                                                              property PRODUCTION

                                                              static readonly PRODUCTION: string;

                                                                property SANDBOX

                                                                static readonly SANDBOX: string;
                                                                • Salesforce URLs

                                                                method checkLightningDomain

                                                                checkLightningDomain: () => Promise<true | never>;
                                                                • Tests whether this url has the lightning domain extension This method that performs the dns lookup of the host. If the lookup fails the internal polling (1 second), client will try again until timeout If SFDX_DOMAIN_RETRY environment variable is set (number) it overrides the default timeout duration (240 seconds)

                                                                  Returns

                                                                  {Promise<true | never>} The resolved ip address or never

                                                                  Throws

                                                                  SfdxError If can't resolve DNS.

                                                                method getJwtAudienceUrl

                                                                getJwtAudienceUrl: (createdOrgInstance?: string) => Promise<string>;
                                                                • Returns the appropiate jwt audience url for this url Use SFDX_AUDIENCE_URL env var to override the audience url

                                                                  Parameter createdOrgInstance

                                                                  The Salesforce instance the org was created on. e.g. cs42 {Promise} The audience url

                                                                method isInternalUrl

                                                                isInternalUrl: () => boolean;
                                                                • Tests whether this url is an internal Salesforce domain

                                                                  Returns

                                                                  {boolean} true if this is a internal domain

                                                                method isLocalUrl

                                                                isLocalUrl: () => boolean;
                                                                • Tests whether this url runs on a local machine

                                                                  Returns

                                                                  {boolean} true if this is a local machine

                                                                method isSalesforceDomain

                                                                isSalesforceDomain: () => boolean;
                                                                • Tests whether this url contains a Salesforce owned domain

                                                                  {boolean} true if this is a salesforce domain

                                                                method isSandboxUrl

                                                                isSandboxUrl: (createdOrgInstance?: string) => boolean;
                                                                • Tests whether this url is a sandbox url

                                                                  Parameter createdOrgInstance

                                                                  The Salesforce instance the org was created on. e.g. cs42

                                                                  Returns

                                                                  {boolean}

                                                                method lookup

                                                                lookup: () => Promise<string>;
                                                                • Method that performs the dns lookup of the host. If the lookup fails the internal polling (1 second), client will try again untill timeout If SFDX_DOMAIN_RETRY environment variable is set (number) it overrides the default timeout duration (240 seconds)

                                                                  Returns

                                                                  the resolved ip address.

                                                                  Throws

                                                                  SfdxError If can't resolve DNS.

                                                                method toLightningDomain

                                                                toLightningDomain: () => string;

                                                                  class SfdxError

                                                                  class SfdxError extends NamedError {}
                                                                  • A generalized sfdx error which also contains an action. The action is used in the CLI to help guide users past the error.

                                                                    To throw an error in a synchronous function you must either pass the error message and actions directly to the constructor, e.g.

                                                                    // To load a message bundle:
                                                                    Messages.importMessagesDirectory(__dirname);
                                                                    this.messages = Messages.loadMessages('myPackageName', 'myBundleName');
                                                                    // Note that __dirname should contain a messages folder.
                                                                    // To throw an error associated with the message from the bundle:
                                                                    throw SfdxError.create('myPackageName', 'myBundleName', 'MyErrorMessageKey', [messageToken1]);
                                                                    // To throw a non-bundle based error:
                                                                    throw new SfdxError(myErrMsg, 'MyErrorName');

                                                                  constructor

                                                                  constructor(
                                                                  message: string,
                                                                  name?: string,
                                                                  actions?: string[],
                                                                  exitCode?: number,
                                                                  cause?: Error
                                                                  );
                                                                  • Create an SfdxError.

                                                                    Parameter message

                                                                    The error message.

                                                                    Parameter name

                                                                    The error name. Defaults to 'SfdxError'.

                                                                    Parameter actions

                                                                    The action message(s).

                                                                    Parameter exitCode

                                                                    The exit code which will be used by SfdxCommand.

                                                                    Parameter cause

                                                                    The underlying error that caused this error to be raised.

                                                                  property actions

                                                                  actions?: string[];
                                                                  • Action messages. Hints to the users regarding what can be done to fix related issues.

                                                                  property code

                                                                  code: any;

                                                                    property commandName

                                                                    commandName?: string;
                                                                    • The related command name for this error.

                                                                    property data

                                                                    data: any;

                                                                      property exitCode

                                                                      exitCode: number;
                                                                      • SfdxCommand can return this process exit code.

                                                                      property message

                                                                      message: string;
                                                                      • The message string. Error.message

                                                                      property name

                                                                      name: any;

                                                                        method create

                                                                        static create: {
                                                                        (
                                                                        packageName: string,
                                                                        bundleName: string,
                                                                        key: string,
                                                                        tokens?: Tokens
                                                                        ): SfdxError;
                                                                        (errorConfig: SfdxErrorConfig): SfdxError;
                                                                        };
                                                                        • Create a new SfdxError.

                                                                          Parameter packageName

                                                                          The message package name used to create the SfdxError.

                                                                          Parameter bundleName

                                                                          The message bundle name used to create the SfdxError.

                                                                          Parameter key

                                                                          The key within the bundle for the message.

                                                                          Parameter tokens

                                                                          The values to use for message tokenization.

                                                                        • Create a new SfdxError.

                                                                          Parameter errorConfig

                                                                          The SfdxErrorConfig object used to create the SfdxError.

                                                                        method setCommandName

                                                                        setCommandName: (commandName: string) => SfdxError;
                                                                        • Sets the name of the command. For convenience this object is returned.

                                                                          Parameter commandName

                                                                          The command name.

                                                                        method setData

                                                                        setData: (data: unknown) => SfdxError;
                                                                        • An additional payload for the error. For convenience this object is returned.

                                                                          Parameter data

                                                                          The payload data.

                                                                        method toObject

                                                                        toObject: () => JsonMap;
                                                                        • Convert an SfdxError state to an object. Returns a plain object representing the state of this error.

                                                                        method wrap

                                                                        static wrap: (err: Error | string) => SfdxError;
                                                                        • Convert an Error to an SfdxError.

                                                                          Parameter err

                                                                          The error to convert.

                                                                        class SfdxErrorConfig

                                                                        class SfdxErrorConfig {}
                                                                        • A class to manage all the keys and tokens for a message bundle to use with SfdxError.

                                                                          SfdxError.create(new SfdxErrorConfig('MyPackage', 'apex', 'runTest').addAction('apexErrorAction1', [className]));

                                                                        constructor

                                                                        constructor(
                                                                        packageName: string,
                                                                        bundleName: string,
                                                                        errorKey: string,
                                                                        errorTokens?: Tokens,
                                                                        actionKey?: string,
                                                                        actionTokens?: Tokens
                                                                        );
                                                                        • Create a new SfdxErrorConfig.

                                                                          Parameter packageName

                                                                          The name of the package.

                                                                          Parameter bundleName

                                                                          The message bundle.

                                                                          Parameter errorKey

                                                                          The error message key.

                                                                          Parameter errorTokens

                                                                          The tokens to use when getting the error message.

                                                                          Parameter actionKey

                                                                          The action message key.

                                                                          Parameter actionTokens

                                                                          The tokens to use when getting the action message(s).

                                                                        property bundleName

                                                                        readonly bundleName: string;
                                                                        • The name of the bundle

                                                                        property errorKey

                                                                        errorKey: string;
                                                                        • The error key

                                                                        property packageName

                                                                        readonly packageName: string;
                                                                        • The name of the package

                                                                        method addAction

                                                                        addAction: (actionKey: string, actionTokens?: Tokens) => SfdxErrorConfig;
                                                                        • Add an error action to assist the user with a resolution. For convenience this object is returned.

                                                                          Parameter actionKey

                                                                          The action key in the message bundle.

                                                                          Parameter actionTokens

                                                                          The action tokens for the string.

                                                                        method getActions

                                                                        getActions: () => Optional<string[]>;
                                                                        • Get the action messages using messages.getMessage. **@throws** If errorMessages.load was not called first.

                                                                        method getError

                                                                        getError: () => string;
                                                                        • Get the error message using messages.getMessage. **Throws** If errorMessages.load was not called first.

                                                                        method load

                                                                        load: () => Messages;
                                                                        • Load the messages using Messages.loadMessages. Returns the loaded messages.

                                                                        method removeActions

                                                                        removeActions: () => SfdxErrorConfig;
                                                                        • Remove all actions from this error config. Useful when reusing SfdxErrorConfig for other error messages within the same bundle. For convenience this object is returned.

                                                                        method setErrorKey

                                                                        setErrorKey: (key: string) => SfdxErrorConfig;
                                                                        • Set the error key.

                                                                          Parameter key

                                                                          The key to set.

                                                                          Returns

                                                                          {SfdxErrorConfig} For convenience this object is returned.

                                                                        method setErrorTokens

                                                                        setErrorTokens: (tokens: Tokens) => SfdxErrorConfig;
                                                                        • Set the error tokens.

                                                                          Parameter tokens

                                                                          The tokens to set. For convenience this object is returned.

                                                                        class SfdxProject

                                                                        class SfdxProject {}
                                                                        • Represents an SFDX project directory. This directory contains a SfdxProjectJson config file as well as a hidden .sfdx folder that contains all the other local project config files.

                                                                          const project = await SfdxProject.resolve();
                                                                          const projectJson = await project.resolveProjectConfig();
                                                                          console.log(projectJson.sfdcLoginUrl);

                                                                        method getActivePackage

                                                                        getActivePackage: () => Nullable<NamedPackageDir>;
                                                                        • Get the currently activated package on the project. This has no implication on sfdx-project.json but is useful for keeping track of package and source specific options in a process.

                                                                        method getDefaultPackage

                                                                        getDefaultPackage: () => NamedPackageDir;
                                                                        • Get the project's default package directory defined in sfdx-project.json using first 'default: true' found. The first entry is returned if no default is specified.

                                                                        method getInstance

                                                                        static getInstance: (path?: string) => SfdxProject;
                                                                        • Get a Project from a given path or from the working directory.

                                                                          Parameter path

                                                                          The path of the project.

                                                                          **Throws** *SfdxError{ name: 'InvalidProjectWorkspace' }* If the current folder is not located in a workspace.

                                                                        method getPackage

                                                                        getPackage: (packageName: string) => Optional<NamedPackageDir>;
                                                                        • Returns the package directory.

                                                                          Parameter packageName

                                                                          Name of the package directory. E.g., 'force-app'

                                                                        method getPackageDirectories

                                                                        getPackageDirectories: () => NamedPackageDir[];
                                                                        • Returns a read-only list of packageDirectories within sfdx-project.json, first reading and validating the file if necessary. i.e. modifying this array will not affect the sfdx-project.json file.

                                                                        method getPackageFromPath

                                                                        getPackageFromPath: (path: string) => Optional<NamedPackageDir>;
                                                                        • Returns the package from a file path.

                                                                          Parameter path

                                                                          A file path. E.g. /Users/jsmith/projects/ebikes-lwc/force-app/apex/my-cls.cls

                                                                        method getPackageNameFromPath

                                                                        getPackageNameFromPath: (path: string) => Optional<string>;
                                                                        • Returns the package name, E.g. 'force-app', from a file path.

                                                                          Parameter path

                                                                          A file path. E.g. /Users/jsmith/projects/ebikes-lwc/force-app/apex/my-cls.cls

                                                                        method getPackagePath

                                                                        getPackagePath: (packageName: string) => Optional<string>;
                                                                        • Returns the absolute path of the package directory ending with the path separator. E.g., /Users/jsmith/projects/ebikes-lwc/force-app/

                                                                          Parameter packageName

                                                                          Name of the package directory. E.g., 'force-app'

                                                                        method getPath

                                                                        getPath: () => string;
                                                                        • Returns the project path.

                                                                        method getSfdxProjectJson

                                                                        getSfdxProjectJson: (isGlobal?: boolean) => SfdxProjectJson;
                                                                        • Get the sfdx-project.json config. The global sfdx-project.json is used for user defaults that are not checked in to the project specific file.

                                                                          *Note:* When reading values from SfdxProjectJson, it is recommended to use SfdxProject.resolveProjectConfig instead.

                                                                          This is the sync method of SfdxProject.resolveSfdxProjectJson

                                                                          Parameter isGlobal

                                                                          True to get the global project file, otherwise the local project config.

                                                                        method getUniquePackageDirectories

                                                                        getUniquePackageDirectories: () => NamedPackageDir[];
                                                                        • Returns a read-only list of packageDirectories within sfdx-project.json, first reading and validating the file if necessary. i.e. modifying this array will not affect the sfdx-project.json file.

                                                                          There can be multiple packages in packageDirectories that point to the same directory. This method only returns one packageDirectory entry per unique directory path. This is useful when doing source operations based on directories but probably not as useful for packaging operations that want to do something for each package entry.

                                                                        method getUniquePackageNames

                                                                        getUniquePackageNames: () => string[];

                                                                        method hasMultiplePackages

                                                                        hasMultiplePackages: () => boolean;
                                                                        • Has multiple package directories (MPD) defined in the project.

                                                                        method hasPackages

                                                                        hasPackages: () => boolean;
                                                                        • Has package directories defined in the project.

                                                                        method resolve

                                                                        static resolve: (path?: string) => Promise<SfdxProject>;
                                                                        • Get a Project from a given path or from the working directory.

                                                                          Parameter path

                                                                          The path of the project.

                                                                          **Throws** *SfdxError{ name: 'InvalidProjectWorkspace' }* If the current folder is not located in a workspace.

                                                                        method resolveProjectConfig

                                                                        resolveProjectConfig: () => Promise<JsonMap>;
                                                                        • The project config is resolved from local and global SfdxProjectJson, ConfigAggregator, and a set of defaults. It is recommended to use this when reading values from SfdxProjectJson.

                                                                          The global SfdxProjectJson is used to allow the user to provide default values they may not want checked into their project's source.

                                                                          Returns

                                                                          A resolved config object that contains a bunch of different properties, including some 3rd party custom properties.

                                                                        method resolveProjectPath

                                                                        static resolveProjectPath: (dir?: string) => Promise<string>;
                                                                        • Performs an upward directory search for an sfdx project file. Returns the absolute path to the project.

                                                                          Parameter dir

                                                                          The directory path to start traversing from.

                                                                          **Throws** *SfdxError{ name: 'InvalidProjectWorkspace' }* If the current folder is not located in a workspace.

                                                                          **See** traverseForFile

                                                                          **See** [process.cwd()](https://nodejs.org/api/process.html#process_process_cwd)

                                                                        method resolveProjectPathSync

                                                                        static resolveProjectPathSync: (dir?: string) => string;
                                                                        • Performs a synchronous upward directory search for an sfdx project file. Returns the absolute path to the project.

                                                                          Parameter dir

                                                                          The directory path to start traversing from.

                                                                          **Throws** *SfdxError{ name: 'InvalidProjectWorkspace' }* If the current folder is not located in a workspace.

                                                                          **See** traverseForFileSync

                                                                          **See** [process.cwd()](https://nodejs.org/api/process.html#process_process_cwd)

                                                                        method retrieveSfdxProjectJson

                                                                        retrieveSfdxProjectJson: (isGlobal?: boolean) => Promise<SfdxProjectJson>;
                                                                        • Get the sfdx-project.json config. The global sfdx-project.json is used for user defaults that are not checked in to the project specific file.

                                                                          *Note:* When reading values from SfdxProjectJson, it is recommended to use SfdxProject.resolveProjectConfig instead.

                                                                          Parameter isGlobal

                                                                          True to get the global project file, otherwise the local project config.

                                                                        method setActivePackage

                                                                        setActivePackage: (packageName: Nullable<string>) => void;
                                                                        • Set the currently activated package on the project. This has no implication on sfdx-project.json but is useful for keeping track of package and source specific options in a process.

                                                                          Parameter pkgName

                                                                          The package name to activate. E.g. 'force-app'

                                                                        class SfdxProjectJson

                                                                        class SfdxProjectJson extends ConfigFile<ConfigFile.Options> {}
                                                                        • The sfdx-project.json config object. This file determines if a folder is a valid sfdx project.

                                                                          *Note:* Any non-standard (not owned by Salesforce) properties stored in sfdx-project.json should be in a top level property that represents your project or plugin.

                                                                          const project = await SfdxProject.resolve();
                                                                          const projectJson = await project.resolveProjectConfig();
                                                                          const myPluginProperties = projectJson.get('myplugin') || {};
                                                                          myPluginProperties.myprop = 'someValue';
                                                                          projectJson.set('myplugin', myPluginProperties);
                                                                          await projectJson.write();

                                                                          **See** [force:project:create](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_ws_create_new.htm)

                                                                        constructor

                                                                        constructor(options: ConfigFile.Options);

                                                                          property BLOCKLIST

                                                                          static BLOCKLIST: string[];

                                                                            method getContents

                                                                            getContents: () => ProjectJson;

                                                                              method getDefaultOptions

                                                                              static getDefaultOptions: (isGlobal?: boolean) => ConfigFile.Options;

                                                                                method getFileName

                                                                                static getFileName: () => string;

                                                                                  method getPackageDirectories

                                                                                  getPackageDirectories: () => Promise<PackageDir[]>;
                                                                                  • Returns the packageDirectories within sfdx-project.json, first reading and validating the file if necessary.

                                                                                  method getPackageDirectoriesSync

                                                                                  getPackageDirectoriesSync: () => NamedPackageDir[];
                                                                                  • Returns a read-only list of packageDirectories within sfdx-project.json, first reading and validating the file if necessary. i.e. modifying this array will not affect the sfdx-project.json file.

                                                                                  method getUniquePackageDirectories

                                                                                  getUniquePackageDirectories: () => NamedPackageDir[];
                                                                                  • Returns a read-only list of packageDirectories within sfdx-project.json, first reading and validating the file if necessary. i.e. modifying this array will not affect the sfdx-project.json file.

                                                                                    There can be multiple packages in packageDirectories that point to the same directory. This method only returns one packageDirectory entry per unique directory path. This is useful when doing source operations based on directories but probably not as useful for packaging operations that want to do something for each package entry.

                                                                                  method getUniquePackageNames

                                                                                  getUniquePackageNames: () => string[];

                                                                                  method hasMultiplePackages

                                                                                  hasMultiplePackages: () => boolean;
                                                                                  • Has multiple package directories (MPD) defined in the project.

                                                                                  method hasPackages

                                                                                  hasPackages: () => boolean;
                                                                                  • Has package directories defined in the project.

                                                                                  method read

                                                                                  read: () => Promise<ConfigContents>;

                                                                                    method readSync

                                                                                    readSync: () => Dictionary<AnyJson>;

                                                                                      method schemaValidate

                                                                                      schemaValidate: () => Promise<void>;
                                                                                      • Validates sfdx-project.json against the schema.

                                                                                        Set the SFDX_PROJECT_JSON_VALIDATION environment variable to true to throw an error when schema validation fails. A warning is logged by default when the file is invalid.

                                                                                        ***See*** [sfdx-project.schema.json] (https://github.com/forcedotcom/schemas/blob/main/sfdx-project.schema.json)

                                                                                      method schemaValidateSync

                                                                                      schemaValidateSync: () => void;
                                                                                      • Validates sfdx-project.json against the schema.

                                                                                        Set the SFDX_PROJECT_JSON_VALIDATION environment variable to true to throw an error when schema validation fails. A warning is logged by default when the file is invalid.

                                                                                        ***See*** [sfdx-project.schema.json] (https://github.com/forcedotcom/schemas/blob/main/sfdx-project.schema.json)

                                                                                      method write

                                                                                      write: (newContents?: Dictionary<AnyJson>) => Promise<ConfigContents>;

                                                                                        method writeSync

                                                                                        writeSync: (newContents?: Dictionary<AnyJson>) => Dictionary<AnyJson>;

                                                                                          class StreamingClient

                                                                                          class StreamingClient extends AsyncOptionalCreatable<StreamingClient.Options> {}
                                                                                          • Api wrapper to support Salesforce streaming. The client contains an internal implementation of a cometd specification.

                                                                                            Salesforce client and timeout information

                                                                                            Streaming API imposes two timeouts, as supported in the Bayeux protocol.

                                                                                            Socket timeout: 110 seconds A client receives events (JSON-formatted HTTP responses) while it waits on a connection. If no events are generated and the client is still waiting, the connection times out after 110 seconds and the server closes the connection. Clients should reconnect before two minutes to avoid the connection timeout.

                                                                                            Reconnect timeout: 40 seconds After receiving the events, a client needs to reconnect to receive the next set of events. If the reconnection doesn't happen within 40 seconds, the server expires the subscription and the connection is closed. If this happens, the client must start again and handshake, subscribe, and connect. Each Streaming API client logs into an instance and maintains a session. When the client handshakes, connects, or subscribes, the session timeout is restarted. A client session times out if the client doesn’t reconnect to the server within 40 seconds after receiving a response (an event, subscribe result, and so on).

                                                                                            Note that these timeouts apply to the Streaming API client session and not the Salesforce authentication session. If the client session times out, the authentication session remains active until the organization-specific timeout policy goes into effect.

                                                                                            const streamProcessor = (message: JsonMap): StatusResult => {
                                                                                            const payload = ensureJsonMap(message.payload);
                                                                                            const id = ensureString(payload.id);
                                                                                            if (payload.status !== 'Active') {
                                                                                            return { completed: false };
                                                                                            }
                                                                                            return {
                                                                                            completed: true,
                                                                                            payload: id
                                                                                            };
                                                                                            };
                                                                                            const org = await Org.create({});
                                                                                            const options = new StreamingClient.DefaultOptions(org, 'MyPushTopics', streamProcessor);
                                                                                            const asyncStatusClient = await StreamingClient.create(options);
                                                                                            await asyncStatusClient.handshake();
                                                                                            const info: RequestInfo = {
                                                                                            method: 'POST',
                                                                                            url: `${org.getField(OrgFields.INSTANCE_URL)}/SomeService`,
                                                                                            headers: { HEADER: 'HEADER_VALUE'},
                                                                                            body: 'My content'
                                                                                            };
                                                                                            await asyncStatusClient.subscribe(async () => {
                                                                                            const connection = await org.getConnection();
                                                                                            // Now that we are subscribed, we can initiate the request that will cause the events to start streaming.
                                                                                            const requestResponse: JsonCollection = await connection.request(info);
                                                                                            const id = ensureJsonMap(requestResponse).id;
                                                                                            console.log(`this.id: ${JSON.stringify(ensureString(id), null, 4)}`);
                                                                                            });

                                                                                          constructor

                                                                                          constructor(options?: StreamingClient.Options);

                                                                                          method handshake

                                                                                          handshake: () => Promise<StreamingClient.ConnectionState>;
                                                                                          • Provides a convenient way to handshake with the server endpoint before trying to subscribe.

                                                                                          method init

                                                                                          init: () => Promise<void>;
                                                                                          • Asynchronous initializer.

                                                                                          method replay

                                                                                          replay: (replayId: number) => void;
                                                                                          • Allows replaying of of Streaming events starting with replayId.

                                                                                            Parameter replayId

                                                                                            The starting message id to replay from.

                                                                                          method subscribe

                                                                                          subscribe: (streamInit?: () => Promise<void>) => Promise<AnyJson | void>;
                                                                                          • Subscribe to streaming events. When the streaming processor that's set in the options completes execution it returns a payload in the StatusResult object. The payload is just echoed here for convenience.

                                                                                            **Throws** *SfdxError{ name: 'StreamingClient.TimeoutErrorType.SUBSCRIBE'}* When the subscribe timeout occurs.

                                                                                            Parameter streamInit

                                                                                            This function should call the platform apis that result in streaming updates on push topics. StatusResult

                                                                                          class User

                                                                                          class User extends AsyncCreatable<User.Options> {}
                                                                                          • A class for creating a User, generating a password for a user, and assigning a user to one or more permission sets. See methods for examples.

                                                                                          constructor

                                                                                          constructor(options: User.Options);

                                                                                          method assignPassword

                                                                                          assignPassword: (info: AuthInfo, password?: SecureBuffer<void>) => Promise<void>;
                                                                                          • Assigns a password to a user. For a user to have the ability to assign their own password, the org needs the following org feature: EnableSetPasswordInApi.

                                                                                            Parameter info

                                                                                            The AuthInfo object for user to assign the password to.

                                                                                            Parameter password

                                                                                            [throwWhenRemoveFails = User.generatePasswordUtf8()] A SecureBuffer containing the new password.

                                                                                          method assignPermissionSets

                                                                                          assignPermissionSets: (id: string, permsetNames: string[]) => Promise<void>;
                                                                                          • Methods to assign one or more permission set names to a user.

                                                                                            Parameter id

                                                                                            The Salesforce id of the user to assign the permission set to.

                                                                                            Parameter permsetNames

                                                                                            An array of permission set names.

                                                                                            const username = 'user@example.com';
                                                                                            const connection: Connection = await Connection.create({
                                                                                            authInfo: await AuthInfo.create({ username })
                                                                                            });
                                                                                            const org = await Org.create({ connection });
                                                                                            const user: User = await User.create({ org });
                                                                                            const fields: UserFields = await user.retrieve(username);
                                                                                            await user.assignPermissionSets(fields.id, ['sfdx', 'approver']);

                                                                                          method createUser

                                                                                          createUser: (fields: UserFields) => Promise<AuthInfo>;
                                                                                          • Method for creating a new User.

                                                                                            By default scratch orgs only allow creating 2 additional users. Work with Salesforce Customer Service to increase user limits.

                                                                                            The Org Preferences required to increase the number of users are: Standard User Licenses Salesforce CRM Content User

                                                                                            Parameter fields

                                                                                            The required fields for creating a user.

                                                                                            const connection: Connection = await Connection.create({
                                                                                            authInfo: await AuthInfo.create({ username: 'user@example.com' })
                                                                                            });
                                                                                            const org = await Org.create({ connection });
                                                                                            const defaultUserFields = await DefaultUserFields.create({ templateUser: 'devhub_user@example.com' });
                                                                                            const user: User = await User.create({ org });
                                                                                            const info: AuthInfo = await user.createUser(defaultUserFields.getFields());

                                                                                          method generatePasswordUtf8

                                                                                          static generatePasswordUtf8: (
                                                                                          passwordCondition?: PasswordConditions
                                                                                          ) => SecureBuffer<void>;
                                                                                          • Generate default password for a user. Returns An encrypted buffer containing a utf8 encoded password.

                                                                                          method init

                                                                                          init: () => Promise<void>;
                                                                                          • Initialize a new instance of a user and return it.

                                                                                          method retrieve

                                                                                          retrieve: (username: string) => Promise<UserFields>;
                                                                                          • Method to retrieve the UserFields for a user.

                                                                                            Parameter username

                                                                                            The username of the user.

                                                                                            const username = 'boris@thecat.com';
                                                                                            const connection: Connection = await Connection.create({
                                                                                            authInfo: await AuthInfo.create({ username })
                                                                                            });
                                                                                            const org = await Org.create({ connection });
                                                                                            const user: User = await User.create({ org });
                                                                                            const fields: UserFields = await user.retrieve(username);

                                                                                          class WebOAuthServer

                                                                                          class WebOAuthServer extends AsyncCreatable<WebOAuthServer.Options> {}
                                                                                          • Handles the creation of a web server for web based login flows.

                                                                                            Usage:

                                                                                            const oauthConfig = {
                                                                                            loginUrl: this.flags.instanceurl,
                                                                                            clientId: this.flags.clientid,
                                                                                            };
                                                                                            const oauthServer = await WebOAuthServer.create({ oauthConfig });
                                                                                            await oauthServer.start();
                                                                                            await open(oauthServer.getAuthorizationUrl(), { wait: false });
                                                                                            const authInfo = await oauthServer.authorizeAndSave();

                                                                                          constructor

                                                                                          constructor(options: WebOAuthServer.Options);

                                                                                            property DEFAULT_PORT

                                                                                            static DEFAULT_PORT: number;

                                                                                              method authorizeAndSave

                                                                                              authorizeAndSave: () => Promise<AuthInfo>;
                                                                                              • Executes the oauth request and creates a new AuthInfo when successful

                                                                                                Returns

                                                                                                {Promise}

                                                                                              method determineOauthPort

                                                                                              static determineOauthPort: () => Promise<number>;
                                                                                              • Returns the configured oauthLocalPort or the WebOAuthServer.DEFAULT_PORT

                                                                                                Returns

                                                                                                {Promise}

                                                                                              method getAuthorizationUrl

                                                                                              getAuthorizationUrl: () => string;
                                                                                              • Returns the authorization url that's used for the login flow

                                                                                                Returns

                                                                                                {string}

                                                                                              method init

                                                                                              protected init: () => Promise<void>;

                                                                                                method start

                                                                                                start: () => Promise<void>;
                                                                                                • Starts the web server

                                                                                                Interfaces

                                                                                                interface AuthFields

                                                                                                interface AuthFields {}
                                                                                                • Fields for authorization, org, and local information.

                                                                                                property accessToken

                                                                                                accessToken?: string;

                                                                                                  property alias

                                                                                                  alias?: string;

                                                                                                    property authCode

                                                                                                    authCode?: string;

                                                                                                      property clientId

                                                                                                      clientId?: string;

                                                                                                        property clientSecret

                                                                                                        clientSecret?: string;

                                                                                                          property created

                                                                                                          created?: string;

                                                                                                            property createdOrgInstance

                                                                                                            createdOrgInstance?: string;

                                                                                                              property devHubUsername

                                                                                                              devHubUsername?: string;

                                                                                                                property expirationDate

                                                                                                                expirationDate?: string;

                                                                                                                  property instanceApiVersion

                                                                                                                  instanceApiVersion?: string;

                                                                                                                    property instanceApiVersionLastRetrieved

                                                                                                                    instanceApiVersionLastRetrieved?: string;

                                                                                                                      property instanceUrl

                                                                                                                      instanceUrl?: string;

                                                                                                                        property isDevHub

                                                                                                                        isDevHub?: boolean;

                                                                                                                          property loginUrl

                                                                                                                          loginUrl?: string;

                                                                                                                            property orgId

                                                                                                                            orgId?: string;

                                                                                                                              property password

                                                                                                                              password?: string;

                                                                                                                                property privateKey