@salesforce/core 3.33.1 → 3.33.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,30 +18,7 @@ const sfdc_1 = require("../util/sfdc");
18
18
  const sfdcUrl_1 = require("../util/sfdcUrl");
19
19
  const orgConfigProperties_1 = require("../org/orgConfigProperties");
20
20
  const configFile_1 = require("./configFile");
21
- messages_1.Messages.importMessagesDirectory(__dirname);
22
- const messages = messages_1.Messages.load('@salesforce/core', 'config', [
23
- 'deprecatedConfigKey',
24
- 'invalidApiVersion',
25
- 'invalidBooleanConfigValue',
26
- 'invalidConfigValue',
27
- 'invalidInstanceUrl',
28
- 'invalidIsvDebuggerSid',
29
- 'invalidIsvDebuggerUrl',
30
- 'invalidNumberConfigValue',
31
- 'invalidWrite',
32
- 'unknownConfigKey',
33
- 'defaultUsername',
34
- 'defaultDevHubUsername',
35
- 'isvDebuggerSid',
36
- 'isvDebuggerUrl',
37
- 'apiVersion',
38
- 'disableTelemetry',
39
- 'maxQueryLimit',
40
- 'restDeploy',
41
- 'instanceUrl',
42
- 'disable-telemetry',
43
- 'customOrgMetadataTemplates',
44
- ]);
21
+ const messages = new messages_1.Messages('@salesforce/core', 'config', new Map([["unknownConfigKey", "Unknown config name: %s."], ["deprecatedConfigKey", "Deprecated config name: %s. Please use %s instead."], ["invalidWrite", "The writeSync method is not allowed on SfdxConfig. Use the async write method instead."], ["invalidConfigValue", "Invalid config value: %s."], ["invalidInstanceUrl", "Specify a valid Salesforce instance URL."], ["invalidApiVersion", "Specify a valid Salesforce API version, for example, 42.0."], ["invalidCustomOrgMetadataTemplates", "Specify a valid repository URL or directory for the custom org metadata templates."], ["invalidIsvDebuggerSid", "Specify a valid Debugger SID."], ["invalidIsvDebuggerUrl", "Specify a valid Debugger URL."], ["invalidNumberConfigValue", "Specify a valid positive integer, for example, 150000."], ["invalidBooleanConfigValue", "The config value can only be set to true or false."], ["invalidProjectWorkspace", "This directory does not contain a valid Salesforce DX project."], ["schemaValidationError", "The config file \"%s\" is not schema valid.\nDue to: %s"], ["schemaValidationError.actions", ["Fix the invalid entries at %s."]], ["missingDefaultPath", "In sfdx-project.json, be sure to specify which package directory (path) is the default. Example: `[{ \"path\": \"packageDirectory1\", \"default\": true }, { \"path\": \"packageDirectory2\" }]`"], ["missingPackageDirectory", "The path \"%s\", specified in sfdx-project.json, does not exist. Be sure this directory is included in your project root."], ["invalidPackageDirectory", "The path \"%s\", specified in sfdx-project.json, must be indicated as a relative path to the project root."], ["multipleDefaultPaths", "In sfdx-project.json, indicate only one package directory (path) as the default."], ["singleNonDefaultPackage", "The sfdx-project.json file must include one, and only one, default package directory (path). Because your sfdx-project.json file contains only one package directory, it must be the default. Remove the `\"default\": false` key and try again."], ["target-org", "Username or alias of the org that all commands run against by default. (sf only)"], ["target-dev-hub", "Username or alias of your default Dev Hub org. (sf only)"], ["defaultUsername", "Username or alias of the org that all commands run against by default. (sfdx only)"], ["defaultDevHubUsername", "Username or alias of your default Dev Hub org. (sfdx only)"], ["isvDebuggerSid", "ISV debugger SID (sfdx only)"], ["isvDebuggerUrl", "ISV debugger URL (sfdx only)"], ["org-isv-debugger-sid", "ISV debugger SID."], ["org-isv-debugger-url", "ISV debugger URL."], ["apiVersion", "API version of your project. Default: API version of your Dev Hub org. (sfdx only)"], ["org-api-version", "API version of your project. Default: API version of your Dev Hub org."], ["disableTelemetry", "Disables the collection of usage and user environment information, etc. Default: false. (sfdx only)"], ["disable-telemetry", "Disables the collection of usage and user environment information, etc. Default: false."], ["maxQueryLimit", "Maximum number of Salesforce records returned by a CLI command. Default: 10,000. (sfdx only)"], ["org-max-query-limit", "Maximum number of Salesforce records returned by a CLI command. Default: 10,000."], ["restDeploy", "Whether deployments use the Metadata REST API (true) or SOAP API (false, default value). (sfdx only)"], ["instanceUrl", "URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com. (sfdx only)"], ["org-instance-url", "URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com."], ["customOrgMetadataTemplates", "A valid repository URL or directory for the custom org metadata templates."], ["org-custom-metadata-templates", "A valid repository URL or directory for the custom org metadata templates."], ["invalidId", "The given id %s is not a valid 15 or 18 character Salesforce ID."]]));
45
22
  const SFDX_CONFIG_FILE_NAME = 'sfdx-config.json';
46
23
  const CONFIG_FILE_NAME = 'config.json';
47
24
  var SfConfigProperties;
@@ -12,8 +12,7 @@ const ts_types_1 = require("@salesforce/ts-types");
12
12
  const messages_1 = require("../messages");
13
13
  const envVars_1 = require("./envVars");
14
14
  const config_1 = require("./config");
15
- messages_1.Messages.importMessagesDirectory(__dirname);
16
- const messages = messages_1.Messages.load('@salesforce/core', 'config', ['unknownConfigKey', 'deprecatedConfigKey']);
15
+ const messages = new messages_1.Messages('@salesforce/core', 'config', new Map([["unknownConfigKey", "Unknown config name: %s."], ["deprecatedConfigKey", "Deprecated config name: %s. Please use %s instead."], ["invalidWrite", "The writeSync method is not allowed on SfdxConfig. Use the async write method instead."], ["invalidConfigValue", "Invalid config value: %s."], ["invalidInstanceUrl", "Specify a valid Salesforce instance URL."], ["invalidApiVersion", "Specify a valid Salesforce API version, for example, 42.0."], ["invalidCustomOrgMetadataTemplates", "Specify a valid repository URL or directory for the custom org metadata templates."], ["invalidIsvDebuggerSid", "Specify a valid Debugger SID."], ["invalidIsvDebuggerUrl", "Specify a valid Debugger URL."], ["invalidNumberConfigValue", "Specify a valid positive integer, for example, 150000."], ["invalidBooleanConfigValue", "The config value can only be set to true or false."], ["invalidProjectWorkspace", "This directory does not contain a valid Salesforce DX project."], ["schemaValidationError", "The config file \"%s\" is not schema valid.\nDue to: %s"], ["schemaValidationError.actions", ["Fix the invalid entries at %s."]], ["missingDefaultPath", "In sfdx-project.json, be sure to specify which package directory (path) is the default. Example: `[{ \"path\": \"packageDirectory1\", \"default\": true }, { \"path\": \"packageDirectory2\" }]`"], ["missingPackageDirectory", "The path \"%s\", specified in sfdx-project.json, does not exist. Be sure this directory is included in your project root."], ["invalidPackageDirectory", "The path \"%s\", specified in sfdx-project.json, must be indicated as a relative path to the project root."], ["multipleDefaultPaths", "In sfdx-project.json, indicate only one package directory (path) as the default."], ["singleNonDefaultPackage", "The sfdx-project.json file must include one, and only one, default package directory (path). Because your sfdx-project.json file contains only one package directory, it must be the default. Remove the `\"default\": false` key and try again."], ["target-org", "Username or alias of the org that all commands run against by default. (sf only)"], ["target-dev-hub", "Username or alias of your default Dev Hub org. (sf only)"], ["defaultUsername", "Username or alias of the org that all commands run against by default. (sfdx only)"], ["defaultDevHubUsername", "Username or alias of your default Dev Hub org. (sfdx only)"], ["isvDebuggerSid", "ISV debugger SID (sfdx only)"], ["isvDebuggerUrl", "ISV debugger URL (sfdx only)"], ["org-isv-debugger-sid", "ISV debugger SID."], ["org-isv-debugger-url", "ISV debugger URL."], ["apiVersion", "API version of your project. Default: API version of your Dev Hub org. (sfdx only)"], ["org-api-version", "API version of your project. Default: API version of your Dev Hub org."], ["disableTelemetry", "Disables the collection of usage and user environment information, etc. Default: false. (sfdx only)"], ["disable-telemetry", "Disables the collection of usage and user environment information, etc. Default: false."], ["maxQueryLimit", "Maximum number of Salesforce records returned by a CLI command. Default: 10,000. (sfdx only)"], ["org-max-query-limit", "Maximum number of Salesforce records returned by a CLI command. Default: 10,000."], ["restDeploy", "Whether deployments use the Metadata REST API (true) or SOAP API (false, default value). (sfdx only)"], ["instanceUrl", "URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com. (sfdx only)"], ["org-instance-url", "URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com."], ["customOrgMetadataTemplates", "A valid repository URL or directory for the custom org metadata templates."], ["org-custom-metadata-templates", "A valid repository URL or directory for the custom org metadata templates."], ["invalidId", "The given id %s is not a valid 15 or 18 character Salesforce ID."]]));
17
16
  /**
18
17
  * Aggregate global and local project config files, as well as environment variables for
19
18
  * `config.json`. The resolution happens in the following bottom-up order:
@@ -12,8 +12,7 @@ const change_case_1 = require("change-case");
12
12
  const kit_1 = require("@salesforce/kit");
13
13
  const messages_1 = require("../messages");
14
14
  const global_1 = require("../global");
15
- messages_1.Messages.importMessagesDirectory((0, path_1.join)(__dirname));
16
- const messages = messages_1.Messages.loadMessages('@salesforce/core', 'envVars');
15
+ const messages = new messages_1.Messages('@salesforce/core', 'envVars', new Map([["forceOpenUrl", "Web page that opens in your browser when you connect to an org. For example, to open Lightning Experience, set to \"lightning\"."], ["forceShowSpinner", "Set to true to show a spinner animation on the command line when running asynchronous CLI commands. Default is false."], ["forceSpinnerDelay", "Speed of the spinner in milliseconds. Default is 60."], ["httpProxy", "HTTP URL and port of the proxy server when using Salesforce CLI behind a corporate firewall or web proxy."], ["httpsProxy", "HTTPS URL and port of the proxy server when using Salesforce CLI behind a corporate firewall or web proxy."], ["nodeExtraCaCerts", "Fully qualified path to your self-signed certificate. Will be installed after you run \"sfdx update\"."], ["nodeTlsRejectUnauthorized", "Set to 0 to allow Node.js to use the self-signed certificate in the certificate chain."], ["sfdxAccessToken", "Specifies an access token when using the auth:accesstoken:store command."], ["sfdxApiVersion", "The API version for a specific project or all projects. Default value is the API version of your Dev Hub. Overrides the apiVersion config value."], ["sfdxAudienceUrl", "URL that overrides the aud (audience) field used for JWT authentication so that it matches the expected value of the authorization server URL for the org you\u2019re logging into."], ["sfdxCodeCoverageRequirement", "Code coverage percentages that are displayed in green when you run force:apex:test:\\* with the --codecoverage parameter."], ["sfdxContentType", "Set to JSON so that all CLI commands output results in JSON format."], ["sfdxDefaultdevhubusername", "Username or alias of your default Dev Hub org. Overrides the defaultdevhubusername configuration value."], ["sfdxDefaultusername", "Username or alias of your default org. Overrides the defaultusername configuration value."], ["sfdxDisableAutoupdate", "Set to true to disable the auto-update feature of Salesforce CLI. Default value is false."], ["sfdxAutoupdateDisable", "Set to true to disable the auto-update feature of Salesforce CLI. Default value is false."], ["sfdxDisableSourceMemberPolling", "Set to true to disable polling of your org\u2019s SourceMember object when you run the force:source:push|pull commands. Default value is false."], ["sfdxDisableTelemetry", "Set to true to disable Salesforce CLI from collecting usage information, user environment information, and crash reports. Default value is false. Overrides the disableTelemetry configration variable."], ["sfdxDnsTimeout", "Number of seconds that the force:org:\\* commands wait for a response when checking whether an org is connected. Default value is 3."], ["sfdxDomainRetry", "Time, in seconds, that Salesforce CLI waits for the Lightning Experience custom domain to resolve and become available in a scratch org. Default value is 240."], ["sfdxImprovedCodeCoverage", "Set to true to scope Apex test results to the classes entered during a test run when running force:apex:test:\\*."], ["sfdxInstanceUrl", "URL of the Salesforce instance that is hosting your org. Default value is https://login.salesforce.com. Overrides the instanceUrl configuration value."], ["sfdxJsonToStdout", "Set to true to send messages resulting from failed Salesforce CLI commands to stdout instead of stderr."], ["sfdxDisableLogFile", "Set to true to disable log file writing"], ["sfdxLogLevel", "Level of messages that the CLI writes to the log file. Valid values are trace, debug, info, warn, error, fatal. Default value is warn."], ["sfdxLogRotationCount", "The default rotation period for logs. Example '1d' will rotate logs daily (at midnight)."], ["sfdxLogRotationPeriod", "The number of backup rotated log files to keep. Example: '3' will have the base sf.log file, and the past 3 (period) log files."], ["sfdxMaxQueryLimit", "Maximum number of Salesforce records returned by a CLI command. Default value is 10,000. Overrides the maxQueryLimit configuration value."], ["sfdxMdapiTempDir", "Directory that contains files (in metadata format) when running certain Salesforce CLI commands, such as force:source:\\*."], ["sfdxNpmRegistry", "URL to a private npm server, where all packages that you publish are private."], ["sfdxPrecompileEnable", "Set to true to enable Apex pre-compile before the tests are run with the force:apex:test:run command. Default is false."], ["sfdxProjectAutoupdateDisableForPackageCreate", "Set to true to disable automatic updates to sfdx-project.json when running force:package:create."], ["sfdxProjectAutoupdateDisableForPackageVersionCreate", "Set to true to disable automatic updates to sfdx-project.json when running force:package:version:create."], ["sfdxRestDeploy", "Set to true to make Salesforce CLI use the Metadata REST API for deployments. By default, the CLI uses SOAP."], ["sfdxSourceMemberPollingTimeout", "Number of seconds you want the force:source:push command to keep polling the SourceMember object before the command times out."], ["sfdxUseGenericUnixKeychain", "(Linux and macOS only) Set to true if you want to use the generic UNIX keychain instead of the Linux libsecret library or macOS keychain."], ["sfdxUseProgressBar", "Set to false to disable the progress bar when running force:mdapi:deploy, force:source:deploy, or force:source:push."], ["sfdxLazyLoadModules", "Set to true to enable lazy loading of sfdx modules"], ["sfdxS3Host", "URL to S3 host"], ["sfdxUpdateInstructions", "Text that describes how to update sfdx"], ["sfdxInstaller", "Boolean indicating that the installer is running"], ["sfdxEnv", "Describes if sfdx is in \"demo\" mode"], ["sfTargetOrg", "Username or alias of your default org. Overrides the target-org configuration variable."], ["sfTargetDevHub", "Username or alias of your default Dev Hub org. Overrides the target-dev-hub configuration variable."], ["sfAccessToken", "Specifies an access token when using a login command that uses access tokens."], ["sfOrgApiVersion", "API version for a specific project or all projects. Default value is the API version of your Dev Hub. Overrides the apiVersion configuration variable."], ["sfAudienceUrl", "URL that overrides the aud (audience) field used for JWT authentication so that it matches the expected value of the authorization server URL for the org you\u2019re logging into."], ["sfCodeCoverageRequirement", "Code coverage percentages that are displayed in green when you run the Apex test CLIcommands with the --code-coverage flag."], ["sfContentType", "Set to JSON so that all CLI commands output results in JSON format."], ["sfDisableAutoupdate", "Set to true to disable the auto-update feature of Salesforce CLI. Default value is false."], ["sfAutoupdateDisable", "Set to true to disable the auto-update feature of Salesforce CLI. Default value is false."], ["sfDisableSourceMemberPolling", "Set to true to disable polling of your org\u2019s SourceMember object when you run the commands to push and pull source. Default value is false."], ["sfDisableTelemetry", "Set to true to disable Salesforce CLI from collecting usage information, user environment information, and crash reports. Default value is false. Overrides the disableTelemetry configration variable."], ["sfDnsTimeout", "Number of seconds that the env commands wait for a response when checking whether an org is connected. Default value is 3."], ["sfDomainRetry", "Time, in seconds, that Salesforce CLI waits for the Lightning Experience custom domain to resolve and become available in a scratch org. Default value is 240."], ["sfImprovedCodeCoverage", "Set to true to scope Apex test results to the classes entered during a test run when running the Apex test commands."], ["sfOrgInstanceUrl", "URL of the Salesforce instance that is hosting your org. Default value is https://login.salesforce.com. Overrides the instanceUrl configuration variable."], ["sfJsonToStdout", "Set to true to send messages resulting from failed Salesforce CLI commands to stdout instead of stderr."], ["sfDisableLogFile", "Set to true to disable log file writing"], ["sfLogLevel", "Level of messages that the CLI writes to the log file. Valid values are trace, debug, info, warn, error, fatal. Default value is warn."], ["sfLogRotationCount", "The default rotation period for logs. Example '1d' will rotate logs daily (at midnight)."], ["sfLogRotationPeriod", "The number of backup rotated log files to keep. Example: '3' will have the base sf.log file, and the past 3 (period) log files."], ["sfOrgMaxQueryLimit", "Maximum number of Salesforce records returned by a CLI command. Default value is 10,000. Overrides the maxQueryLimit configuration variable."], ["sfMdapiTempDir", "Directory that contains files (in metadata format) when running certain Salesforce CLI commands."], ["sfNpmRegistry", "URL to a private npm server, where all packages that you publish are private."], ["sfPrecompileEnable", "Set to true to enable Apex pre-compile before the tests are run with the Apex test run command. Default is false."], ["sfProjectAutoupdateDisableForPackageCreate", "Set to true to disable automatic updates to sfdx-project.json when running the package create command."], ["sfProjectAutoupdateDisableForPackageVersionCreate", "Set to true to disable automatic updates to sfdx-project.json when running the package version create command."], ["sfSourceMemberPollingTimeout", "Number of seconds you want the source push command to keep polling the SourceMember object before the command times out."], ["sfUseGenericUnixKeychain", "(Linux and macOS only) Set to true if you want to use the generic UNIX keychain instead of the Linux libsecret library or macOS keychain."], ["sfUseProgressBar", "Set to false to disable the progress bar when running the metadata deploy command."], ["sfLazyLoadModules", "Set to true to enable lazy loading of sf modules"], ["sfS3Host", "URL to S3 host"], ["sfUpdateInstructions", "Text that describes how to update sf"], ["sfInstaller", "Boolean indicating that the installer is running"], ["sfEnv", "Describes if sf is in \"demo\" mode"]]));
17
16
  var EnvironmentVariable;
18
17
  (function (EnvironmentVariable) {
19
18
  EnvironmentVariable["FORCE_OPEN_URL"] = "FORCE_OPEN_URL";
@@ -26,13 +26,7 @@ const AUTH_TAG_LENGTH = 32;
26
26
  const ENCRYPTED_CHARS = /[a-f0-9]/;
27
27
  const KEY_NAME = 'sfdx';
28
28
  const ACCOUNT = 'local';
29
- messages_1.Messages.importMessagesDirectory((0, path_1.join)(__dirname));
30
- const messages = messages_1.Messages.load('@salesforce/core', 'encryption', [
31
- 'keychainPasswordCreationError',
32
- 'invalidEncryptedFormatError',
33
- 'authDecryptError',
34
- 'macKeychainOutOfSync',
35
- ]);
29
+ const messages = new messages_1.Messages('@salesforce/core', 'encryption', new Map([["invalidEncryptedFormatError", "The encrypted data is not properly formatted."], ["invalidEncryptedFormatError.actions", ["If attempting to create a scratch org then re-authorize. Otherwise create a new scratch org."]], ["authDecryptError", "Failed to decipher auth data. reason: %s."], ["unsupportedOperatingSystemError", "Unsupported Operating System: %s"], ["missingCredentialProgramError", "Unable to find required security software: %s"], ["credentialProgramAccessError", "Unable to execute security software: %s"], ["passwordRetryError", "Failed to get the password after %i retries."], ["passwordRequiredError", "A password is required."], ["keyChainServiceRequiredError", "Unable to get or set a keychain value without a service name."], ["keyChainAccountRequiredError", "Unable to get or set a keychain value without an account name."], ["keyChainUserCanceledError", "User canceled authentication."], ["keychainPasswordCreationError", "Failed to create a password in the keychain."], ["genericKeychainServiceError", "The service and account specified in %s do not match the version of the toolbelt."], ["genericKeychainServiceError.actions", ["Check your toolbelt version and re-auth."]], ["genericKeychainInvalidPermsError", "Invalid file permissions for secret file"], ["genericKeychainInvalidPermsError.actions", ["Ensure the file %s has the file permission octal value of %s."]], ["passwordNotFoundError", "Could not find password.\n%s"], ["passwordNotFoundError.actions", ["Ensure a valid password is returned with the following command: [%s]"]], ["setCredentialError", "Command failed with response:\n%s"], ["setCredentialError.actions", ["Determine why this command failed to set an encryption key for user %s: [%s]."]], ["macKeychainOutOfSync", "We\u2019ve encountered an error with the Mac keychain being out of sync with your `sfdx` credentials. To fix the problem, sync your credentials by authenticating into your org again using the auth commands."]]));
36
30
  const makeSecureBuffer = (password) => {
37
31
  const newSb = new secureBuffer_1.SecureBuffer();
38
32
  newSb.consume(Buffer.from((0, ts_types_1.ensure)(password), 'utf8'));
@@ -11,8 +11,7 @@ const kit_1 = require("@salesforce/kit");
11
11
  const logger_1 = require("../logger");
12
12
  const messages_1 = require("../messages");
13
13
  const keyChainImpl_1 = require("./keyChainImpl");
14
- messages_1.Messages.importMessagesDirectory(__dirname);
15
- const messages = messages_1.Messages.load('@salesforce/core', 'encryption', ['unsupportedOperatingSystemError']);
14
+ const messages = new messages_1.Messages('@salesforce/core', 'encryption', new Map([["invalidEncryptedFormatError", "The encrypted data is not properly formatted."], ["invalidEncryptedFormatError.actions", ["If attempting to create a scratch org then re-authorize. Otherwise create a new scratch org."]], ["authDecryptError", "Failed to decipher auth data. reason: %s."], ["unsupportedOperatingSystemError", "Unsupported Operating System: %s"], ["missingCredentialProgramError", "Unable to find required security software: %s"], ["credentialProgramAccessError", "Unable to execute security software: %s"], ["passwordRetryError", "Failed to get the password after %i retries."], ["passwordRequiredError", "A password is required."], ["keyChainServiceRequiredError", "Unable to get or set a keychain value without a service name."], ["keyChainAccountRequiredError", "Unable to get or set a keychain value without an account name."], ["keyChainUserCanceledError", "User canceled authentication."], ["keychainPasswordCreationError", "Failed to create a password in the keychain."], ["genericKeychainServiceError", "The service and account specified in %s do not match the version of the toolbelt."], ["genericKeychainServiceError.actions", ["Check your toolbelt version and re-auth."]], ["genericKeychainInvalidPermsError", "Invalid file permissions for secret file"], ["genericKeychainInvalidPermsError.actions", ["Ensure the file %s has the file permission octal value of %s."]], ["passwordNotFoundError", "Could not find password.\n%s"], ["passwordNotFoundError.actions", ["Ensure a valid password is returned with the following command: [%s]"]], ["setCredentialError", "Command failed with response:\n%s"], ["setCredentialError.actions", ["Determine why this command failed to set an encryption key for user %s: [%s]."]], ["macKeychainOutOfSync", "We\u2019ve encountered an error with the Mac keychain being out of sync with your `sfdx` credentials. To fix the problem, sync your credentials by authenticating into your org again using the auth commands."]]));
16
15
  /**
17
16
  * Gets the os level keychain impl.
18
17
  *
@@ -17,20 +17,7 @@ const ts_types_1 = require("@salesforce/ts-types");
17
17
  const kit_1 = require("@salesforce/kit");
18
18
  const global_1 = require("../global");
19
19
  const messages_1 = require("../messages");
20
- messages_1.Messages.importMessagesDirectory(__dirname);
21
- const messages = messages_1.Messages.load('@salesforce/core', 'encryption', [
22
- 'missingCredentialProgramError',
23
- 'credentialProgramAccessError',
24
- 'keyChainServiceRequiredError',
25
- 'keyChainAccountRequiredError',
26
- 'passwordRetryError',
27
- 'passwordRequiredError',
28
- 'passwordNotFoundError',
29
- 'setCredentialError',
30
- 'keyChainUserCanceledError',
31
- 'genericKeychainServiceError',
32
- 'genericKeychainInvalidPermsError',
33
- ]);
20
+ const messages = new messages_1.Messages('@salesforce/core', 'encryption', new Map([["invalidEncryptedFormatError", "The encrypted data is not properly formatted."], ["invalidEncryptedFormatError.actions", ["If attempting to create a scratch org then re-authorize. Otherwise create a new scratch org."]], ["authDecryptError", "Failed to decipher auth data. reason: %s."], ["unsupportedOperatingSystemError", "Unsupported Operating System: %s"], ["missingCredentialProgramError", "Unable to find required security software: %s"], ["credentialProgramAccessError", "Unable to execute security software: %s"], ["passwordRetryError", "Failed to get the password after %i retries."], ["passwordRequiredError", "A password is required."], ["keyChainServiceRequiredError", "Unable to get or set a keychain value without a service name."], ["keyChainAccountRequiredError", "Unable to get or set a keychain value without an account name."], ["keyChainUserCanceledError", "User canceled authentication."], ["keychainPasswordCreationError", "Failed to create a password in the keychain."], ["genericKeychainServiceError", "The service and account specified in %s do not match the version of the toolbelt."], ["genericKeychainServiceError.actions", ["Check your toolbelt version and re-auth."]], ["genericKeychainInvalidPermsError", "Invalid file permissions for secret file"], ["genericKeychainInvalidPermsError.actions", ["Ensure the file %s has the file permission octal value of %s."]], ["passwordNotFoundError", "Could not find password.\n%s"], ["passwordNotFoundError.actions", ["Ensure a valid password is returned with the following command: [%s]"]], ["setCredentialError", "Command failed with response:\n%s"], ["setCredentialError.actions", ["Determine why this command failed to set an encryption key for user %s: [%s]."]], ["macKeychainOutOfSync", "We\u2019ve encountered an error with the Mac keychain being out of sync with your `sfdx` credentials. To fix the problem, sync your credentials by authenticating into your org again using the auth commands."]]));
34
21
  const GET_PASSWORD_RETRY_COUNT = 3;
35
22
  /**
36
23
  * Helper to reduce an array of cli args down to a presentable string for logging.
@@ -17,8 +17,7 @@ const logger_1 = require("./logger");
17
17
  const org_1 = require("./org");
18
18
  const sfError_1 = require("./sfError");
19
19
  const messages_1 = require("./messages");
20
- messages_1.Messages.importMessagesDirectory(__dirname);
21
- const messages = messages_1.Messages.load('@salesforce/core', 'auth', ['pollingTimeout']);
20
+ const messages = new messages_1.Messages('@salesforce/core', 'auth', new Map([["targetOrgNotSet", "A default user is not set."], ["targetOrgNotSet.actions", ["Run the \"sfdx auth\" commands with --setdefaultusername to connect to an org and set it as your default org.", "Run \"force:org:create\" with --setdefaultusername to create a scratch org and set it as your default org.", "Run \"sfdx config:set defaultusername=<username>\" to set your default username."]], ["portInUse", "Cannot start the OAuth redirect server on port %s."], ["portInUse.actions", ["Kill the process running on port %s or use a custom connected app and update OauthLocalPort in the sfdx-project.json file."]], ["invalidRequestMethod", "Invalid request method: %s"], ["invalidRequestUri", "Invalid request uri: %s"], ["pollingTimeout", "The device authorization request timed out. After executing force:auth:device:login, you must approve access to the device within 10 minutes. This can happen if the URL wasn\u2019t copied into the browser, login was not attempted, or the 2FA process was not completed within 10 minutes. Request authorization again."], ["serverErrorHTMLResponse", "<h1>%s</h1><br />This is most likely <b>not</b> an error with the Salesforce CLI. Please ensure all information is accurate and try again."], ["missingAuthCode", "No authentication code found on login response."]]));
22
21
  async function wait(ms = 1000) {
23
22
  return new Promise((resolve) => {
24
23
  setTimeout(resolve, ms);
@@ -28,7 +27,9 @@ async function makeRequest(options) {
28
27
  const rawResponse = await new transport_1.default().httpRequest(options);
29
28
  const response = (0, kit_1.parseJsonMap)(rawResponse.body);
30
29
  if (response.error) {
31
- const err = new sfError_1.SfError('Request Failed.');
30
+ const errorDescription = typeof response.error_description === 'string' ? response.error_description : '';
31
+ const error = typeof response.error === 'string' ? response.error : 'Unknown';
32
+ const err = new sfError_1.SfError(`Request Failed: ${error} ${errorDescription}`);
32
33
  err.data = Object.assign(response, { status: rawResponse.statusCode });
33
34
  throw err;
34
35
  }
package/lib/exported.js CHANGED
@@ -23,7 +23,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.User = exports.REQUIRED_FIELDS = exports.DefaultUserFields = exports.MyDomainResolver = exports.StreamingClient = exports.CometClient = exports.PollingClient = exports.SfdxError = exports.SfError = exports.SchemaValidator = exports.SchemaPrinter = exports.SfdxProjectJson = exports.SfdxProject = exports.SfProjectJson = exports.SfProject = exports.ORG_CONFIG_ALLOWED_PROPERTIES = exports.OrgConfigProperties = exports.OrgTypes = exports.SandboxEvents = exports.Org = exports.Messages = exports.Logger = exports.LoggerLevel = exports.getJwtAudienceUrl = exports.SfdcUrl = exports.WebOAuthServer = exports.Lifecycle = exports.Global = exports.Mode = exports.SFDX_HTTP_HEADERS = exports.Connection = exports.AuthRemover = exports.AuthInfo = exports.SfdxConfigAggregator = exports.ConfigAggregator = exports.SandboxRequestCache = exports.SF_ALLOWED_PROPERTIES = exports.SFDX_ALLOWED_PROPERTIES = exports.SfConfigProperties = exports.SfdxPropertyKeys = exports.Config = exports.OrgUsersConfig = exports.DeviceOauthService = exports.StateAggregator = exports.EnvVars = exports.SUPPORTED_ENV_VARS = exports.EnvironmentVariable = exports.envVars = exports.TTLConfig = exports.ConfigFile = void 0;
24
24
  exports.ScratchOrgCache = exports.scratchOrgLifecycleStages = exports.scratchOrgLifecycleEventName = exports.scratchOrgResume = exports.scratchOrgCreate = exports.PermissionSetAssignment = void 0;
25
25
  const messages_1 = require("./messages");
26
- messages_1.Messages.importMessagesDirectory(__dirname);
27
26
  var configFile_1 = require("./config/configFile");
28
27
  Object.defineProperty(exports, "ConfigFile", { enumerable: true, get: function () { return configFile_1.ConfigFile; } });
29
28
  var ttlConfig_1 = require("./config/ttlConfig");
package/lib/messages.d.ts CHANGED
@@ -87,7 +87,7 @@ export type StoredMessageMap = Map<string, StoredMessage>;
87
87
  * ```
88
88
  */
89
89
  export declare class Messages<T extends string> {
90
- private messages;
90
+ readonly messages: StoredMessageMap;
91
91
  private static loaders;
92
92
  private static bundles;
93
93
  /**
package/lib/messages.js CHANGED
@@ -14,15 +14,7 @@ const util = require("util");
14
14
  const ts_types_1 = require("@salesforce/ts-types");
15
15
  const kit_1 = require("@salesforce/kit");
16
16
  const sfError_1 = require("./sfError");
17
- class Key {
18
- constructor(packageName, bundleName) {
19
- this.packageName = packageName;
20
- this.bundleName = bundleName;
21
- }
22
- toString() {
23
- return `${this.packageName}:${this.bundleName}`;
24
- }
25
- }
17
+ const getKey = (packageName, bundleName) => `${packageName}:${bundleName}`;
26
18
  const REGEXP_NO_CONTENT = /^\s*$/g;
27
19
  const REGEXP_NO_CONTENT_SECTION = /^#\s*/gm;
28
20
  const REGEXP_MD_IS_LIST_ROW = /^[*-]\s+|^ {2}/;
@@ -184,7 +176,7 @@ class Messages {
184
176
  * @param loader The loader function.
185
177
  */
186
178
  static setLoaderFunction(packageName, bundle, loader) {
187
- this.loaders.set(new Key(packageName, bundle).toString(), loader);
179
+ this.loaders.set(getKey(packageName, bundle), loader);
188
180
  }
189
181
  /**
190
182
  * Generate a file loading function. Use {@link Messages.importMessageFile} unless
@@ -315,24 +307,24 @@ class Messages {
315
307
  * @param bundleName The name of the bundle to load.
316
308
  */
317
309
  static loadMessages(packageName, bundleName) {
318
- const key = new Key(packageName, bundleName);
310
+ const key = getKey(packageName, bundleName);
319
311
  let messages;
320
312
  if (this.isCached(packageName, bundleName)) {
321
- messages = this.bundles.get(key.toString());
313
+ messages = this.bundles.get(key);
322
314
  }
323
- else if (this.loaders.has(key.toString())) {
324
- const loader = this.loaders.get(key.toString());
315
+ else if (this.loaders.has(key)) {
316
+ const loader = this.loaders.get(key);
325
317
  if (loader) {
326
318
  messages = loader(Messages.getLocale());
327
- this.bundles.set(key.toString(), messages);
328
- messages = this.bundles.get(key.toString());
319
+ this.bundles.set(key, messages);
320
+ messages = this.bundles.get(key);
329
321
  }
330
322
  }
331
323
  if (messages) {
332
324
  return messages;
333
325
  }
334
326
  // Don't use messages inside messages
335
- throw new kit_1.NamedError('MissingBundleError', `Missing bundle ${key.toString()} for locale ${Messages.getLocale()}.`);
327
+ throw new kit_1.NamedError('MissingBundleError', `Missing bundle ${key} for locale ${Messages.getLocale()}.`);
336
328
  }
337
329
  /**
338
330
  * Load messages for a given package and bundle. If the bundle is not already cached, use the loader function
@@ -355,17 +347,17 @@ class Messages {
355
347
  * @param keys The message keys that will be used.
356
348
  */
357
349
  static load(packageName, bundleName, keys) {
358
- const key = new Key(packageName, bundleName);
350
+ const key = getKey(packageName, bundleName);
359
351
  let messages;
360
352
  if (this.isCached(packageName, bundleName)) {
361
- messages = this.bundles.get(key.toString());
353
+ messages = this.bundles.get(key);
362
354
  }
363
- else if (this.loaders.has(key.toString())) {
364
- const loader = this.loaders.get(key.toString());
355
+ else if (this.loaders.has(key)) {
356
+ const loader = this.loaders.get(key);
365
357
  if (loader) {
366
358
  messages = loader(Messages.getLocale());
367
- this.bundles.set(key.toString(), messages);
368
- messages = this.bundles.get(key.toString());
359
+ this.bundles.set(key, messages);
360
+ messages = this.bundles.get(key);
369
361
  }
370
362
  }
371
363
  if (messages) {
@@ -380,7 +372,7 @@ class Messages {
380
372
  return messages;
381
373
  }
382
374
  // Don't use messages inside messages
383
- throw new kit_1.NamedError('MissingBundleError', `Missing bundle ${key.toString()} for locale ${Messages.getLocale()}.`);
375
+ throw new kit_1.NamedError('MissingBundleError', `Missing bundle ${key} for locale ${Messages.getLocale()}.`);
384
376
  }
385
377
  /**
386
378
  * Check if a bundle already been loaded.
@@ -389,7 +381,7 @@ class Messages {
389
381
  * @param bundleName The bundle name.
390
382
  */
391
383
  static isCached(packageName, bundleName) {
392
- return this.bundles.has(new Key(packageName, bundleName).toString());
384
+ return this.bundles.has(getKey(packageName, bundleName));
393
385
  }
394
386
  /**
395
387
  * Get a message using a message key and use the tokens as values for tokenization.
@@ -542,12 +534,12 @@ class Messages {
542
534
  return this.getMessageWithMap(childKey, tokens, childMap);
543
535
  }
544
536
  }
545
- if (!map.has(key)) {
537
+ const msg = map.get(key);
538
+ if (!msg) {
546
539
  // Don't use messages inside messages
547
540
  throw new kit_1.NamedError('MissingMessageError', `Missing message ${this.bundleName}:${key} for locale ${Messages.getLocale()}.`);
548
541
  }
549
- const msg = map.get(key);
550
- const messages = ((0, ts_types_1.isArray)(msg) ? msg : [msg]);
542
+ const messages = (0, kit_1.ensureArray)(msg);
551
543
  return messages.map((message) => {
552
544
  (0, ts_types_1.ensureString)(message);
553
545
  return util.format(message, ...tokens);
@@ -28,19 +28,7 @@ const sfdcUrl_1 = require("../util/sfdcUrl");
28
28
  const connection_1 = require("./connection");
29
29
  const orgConfigProperties_1 = require("./orgConfigProperties");
30
30
  const org_1 = require("./org");
31
- messages_1.Messages.importMessagesDirectory(__dirname);
32
- const messages = messages_1.Messages.load('@salesforce/core', 'core', [
33
- 'authInfoCreationError',
34
- 'authInfoOverwriteError',
35
- 'namedOrgNotFound',
36
- 'orgDataNotAvailableError',
37
- 'orgDataNotAvailableError.actions',
38
- 'refreshTokenAuthError',
39
- 'jwtAuthErrors',
40
- 'authCodeUsernameRetrievalError',
41
- 'authCodeExchangeError',
42
- 'missingClientId',
43
- ]);
31
+ const messages = new messages_1.Messages('@salesforce/core', 'core', new Map([["authInfoCreationError", "Must pass a username and/or OAuth options when creating an AuthInfo instance."], ["authInfoOverwriteError", "Cannot create an AuthInfo instance that will overwrite existing auth data."], ["authInfoOverwriteError.actions", ["Create the AuthInfo instance using existing auth data by just passing the username. E.g., `AuthInfo.create({ username: 'my@user.org' });`."]], ["authCodeExchangeError", "Error authenticating with auth code due to: %s"], ["authCodeUsernameRetrievalError", "Could not retrieve the username after successful auth code exchange.\n\nDue to: %s"], ["jwtAuthError", "Error authenticating with JWT config due to: %s"], ["jwtAuthErrors", "Error authenticating with JWT.\nErrors encountered:\n%s"], ["refreshTokenAuthError", "Error authenticating with the refresh token due to: %s"], ["orgDataNotAvailableError", "An attempt to refresh the authentication token failed with a 'Data Not Found Error'. The org identified by username %s does not appear to exist. Likely cause is that the org was deleted by another user or has expired."], ["orgDataNotAvailableError.actions", ["Run `sfdx force:org:list --clean` to remove stale org authentications.", "Use `sfdx force:config:set` to update the defaultusername.", "Use `sfdx force:org:create` to create a new org.", "Use `sfdx auth` to authenticate an existing org."]], ["namedOrgNotFound", "No authorization information found for %s."], ["noAliasesFound", "Nothing to set."], ["invalidFormat", "Setting aliases must be in the format <key>=<value> but found: [%s]."], ["invalidJsonCasing", "All JSON input must have heads down camelcase keys. E.g., `{ sfdcLoginUrl: \"https://login.salesforce.com\" }`\nFound \"%s\" at %s"], ["missingClientId", "Client ID is required for JWT authentication."]]));
44
32
  // parses the id field returned from jsForce oauth2 methods to get
45
33
  // user ID and org ID.
46
34
  function parseIdUrl(idUrl) {
@@ -13,8 +13,7 @@ const logger_1 = require("../logger");
13
13
  const messages_1 = require("../messages");
14
14
  const stateAggregator_1 = require("../stateAggregator");
15
15
  const orgConfigProperties_1 = require("./orgConfigProperties");
16
- messages_1.Messages.importMessagesDirectory(__dirname);
17
- const messages = messages_1.Messages.load('@salesforce/core', 'auth', ['targetOrgNotSet']);
16
+ const messages = new messages_1.Messages('@salesforce/core', 'auth', new Map([["targetOrgNotSet", "A default user is not set."], ["targetOrgNotSet.actions", ["Run the \"sfdx auth\" commands with --setdefaultusername to connect to an org and set it as your default org.", "Run \"force:org:create\" with --setdefaultusername to create a scratch org and set it as your default org.", "Run \"sfdx config:set defaultusername=<username>\" to set your default username."]], ["portInUse", "Cannot start the OAuth redirect server on port %s."], ["portInUse.actions", ["Kill the process running on port %s or use a custom connected app and update OauthLocalPort in the sfdx-project.json file."]], ["invalidRequestMethod", "Invalid request method: %s"], ["invalidRequestUri", "Invalid request uri: %s"], ["pollingTimeout", "The device authorization request timed out. After executing force:auth:device:login, you must approve access to the device within 10 minutes. This can happen if the URL wasn\u2019t copied into the browser, login was not attempted, or the 2FA process was not completed within 10 minutes. Request authorization again."], ["serverErrorHTMLResponse", "<h1>%s</h1><br />This is most likely <b>not</b> an error with the Salesforce CLI. Please ensure all information is accurate and try again."], ["missingAuthCode", "No authentication code found on login response."]]));
18
17
  /**
19
18
  * Handles the removing of authorizations, which includes deleting the auth file
20
19
  * in the global .sfdx folder, deleting any configs that are associated with the username/alias,
@@ -21,13 +21,7 @@ const sfdc_1 = require("../util/sfdc");
21
21
  const messages_1 = require("../messages");
22
22
  const lifecycleEvents_1 = require("../lifecycleEvents");
23
23
  const orgConfigProperties_1 = require("./orgConfigProperties");
24
- messages_1.Messages.importMessagesDirectory(__dirname);
25
- const messages = messages_1.Messages.load('@salesforce/core', 'connection', [
26
- 'incorrectAPIVersionError',
27
- 'domainNotFoundError',
28
- 'noInstanceUrlError',
29
- 'noApiVersionsError',
30
- ]);
24
+ const messages = new messages_1.Messages('@salesforce/core', 'connection', new Map([["incorrectAPIVersionError", "Invalid API version %s. Expecting format \"[1-9][0-9].0\", i.e. 42.0"], ["domainNotFoundError", "The org cannot be found"], ["domainNotFoundError.actions", ["Verify that the org still exists',", "If your org is newly created, wait a minute and run your command again',", "If you deployed or updated the org's My Domain, logout from the CLI and authenticate again\",", "If you are running in a CI environment with a DNS that blocks external IPs, try setting SFDX_DISABLE_DNS_CHECK=true'"]], ["noInstanceUrlError", "Connection has no instanceUrl."], ["noInstanceUrlError.actions", "Make sure the instanceUrl is set in your command or config."], ["noApiVersionsError", "Org failed to respond with its list of API versions. This is usually the result of domain changes like activating MyDomain or Enhanced Domains"], ["noApiVersionsError.actions", "Re-authenticate to the org."]]));
31
25
  const clientId = `sfdx toolbelt:${process.env.SFDX_SET_CLIENT_IDS ?? ''}`;
32
26
  exports.SFDX_HTTP_HEADERS = {
33
27
  'content-type': 'application/json',
package/lib/org/org.js CHANGED
@@ -28,23 +28,7 @@ const connection_1 = require("./connection");
28
28
  const authInfo_1 = require("./authInfo");
29
29
  const scratchOrgCreate_1 = require("./scratchOrgCreate");
30
30
  const orgConfigProperties_1 = require("./orgConfigProperties");
31
- messages_1.Messages.importMessagesDirectory(__dirname);
32
- const messages = messages_1.Messages.load('@salesforce/core', 'org', [
33
- 'deleteOrgHubError',
34
- 'insufficientAccessToDelete',
35
- 'missingAuthUsername',
36
- 'noDevHubFound',
37
- 'notADevHub',
38
- 'noUsernameFound',
39
- 'sandboxDeleteFailed',
40
- 'sandboxInfoCreateFailed',
41
- 'sandboxNotFound',
42
- 'scratchOrgNotFound',
43
- 'AuthInfoOrgIdUndefined',
44
- 'sandboxCreateNotComplete',
45
- 'SandboxProcessNotFoundBySandboxName',
46
- 'MultiSandboxProcessNotFoundBySandboxName',
47
- ]);
31
+ const messages = new messages_1.Messages('@salesforce/core', 'org', new Map([["notADevHub", "The provided dev hub username %s is not a valid dev hub."], ["noUsernameFound", "No username found."], ["noDevHubFound", "Unable to associate this scratch org with a DevHub."], ["deleteOrgHubError", "The Dev Hub org cannot be deleted."], ["insufficientAccessToDelete", "You do not have the appropriate permissions to delete a scratch org. Please contact your Salesforce admin."], ["scratchOrgNotFound", "Attempting to delete an expired or deleted org"], ["sandboxDeleteFailed", "The sandbox org deletion failed with a result of %s."], ["sandboxNotFound", "We can't find a SandboxProcess for the sandbox %s."], ["sandboxInfoCreateFailed", "The sandbox org creation failed with a result of %s."], ["missingAuthUsername", "The sandbox %s does not have an authorized username."], ["orgPollingTimeout", "Sandbox status is %s; timed out waiting for completion."], ["NotFoundOnDevHub", "The scratch org does not belong to the dev hub username %s."], ["AuthInfoOrgIdUndefined", "AuthInfo orgId is undefined."], ["sandboxCreateNotComplete", "The sandbox creation has not completed."], ["SandboxProcessNotFoundBySandboxName", "We can't find a SandboxProcess with the SandboxName %s."], ["MultiSandboxProcessNotFoundBySandboxName", "We found more than one SandboxProcess with the SandboxName %s."]]));
48
32
  var OrgTypes;
49
33
  (function (OrgTypes) {
50
34
  OrgTypes["Scratch"] = "scratch";
@@ -12,23 +12,7 @@ const ts_types_1 = require("@salesforce/ts-types");
12
12
  const messages_1 = require("../messages");
13
13
  const sfdcUrl_1 = require("../util/sfdcUrl");
14
14
  const sfdc_1 = require("../util/sfdc");
15
- messages_1.Messages.importMessagesDirectory((0, path_1.join)(__dirname));
16
- const messages = messages_1.Messages.load('@salesforce/core', 'config', [
17
- 'invalidApiVersion',
18
- 'invalidBooleanConfigValue',
19
- 'invalidInstanceUrl',
20
- 'invalidIsvDebuggerSid',
21
- 'invalidIsvDebuggerUrl',
22
- 'invalidNumberConfigValue',
23
- 'org-api-version',
24
- 'org-instance-url',
25
- 'org-isv-debugger-sid',
26
- 'org-isv-debugger-url',
27
- 'org-max-query-limit',
28
- 'target-dev-hub',
29
- 'target-org',
30
- 'org-custom-metadata-templates',
31
- ]);
15
+ const messages = new messages_1.Messages('@salesforce/core', 'config', new Map([["unknownConfigKey", "Unknown config name: %s."], ["deprecatedConfigKey", "Deprecated config name: %s. Please use %s instead."], ["invalidWrite", "The writeSync method is not allowed on SfdxConfig. Use the async write method instead."], ["invalidConfigValue", "Invalid config value: %s."], ["invalidInstanceUrl", "Specify a valid Salesforce instance URL."], ["invalidApiVersion", "Specify a valid Salesforce API version, for example, 42.0."], ["invalidCustomOrgMetadataTemplates", "Specify a valid repository URL or directory for the custom org metadata templates."], ["invalidIsvDebuggerSid", "Specify a valid Debugger SID."], ["invalidIsvDebuggerUrl", "Specify a valid Debugger URL."], ["invalidNumberConfigValue", "Specify a valid positive integer, for example, 150000."], ["invalidBooleanConfigValue", "The config value can only be set to true or false."], ["invalidProjectWorkspace", "This directory does not contain a valid Salesforce DX project."], ["schemaValidationError", "The config file \"%s\" is not schema valid.\nDue to: %s"], ["schemaValidationError.actions", ["Fix the invalid entries at %s."]], ["missingDefaultPath", "In sfdx-project.json, be sure to specify which package directory (path) is the default. Example: `[{ \"path\": \"packageDirectory1\", \"default\": true }, { \"path\": \"packageDirectory2\" }]`"], ["missingPackageDirectory", "The path \"%s\", specified in sfdx-project.json, does not exist. Be sure this directory is included in your project root."], ["invalidPackageDirectory", "The path \"%s\", specified in sfdx-project.json, must be indicated as a relative path to the project root."], ["multipleDefaultPaths", "In sfdx-project.json, indicate only one package directory (path) as the default."], ["singleNonDefaultPackage", "The sfdx-project.json file must include one, and only one, default package directory (path). Because your sfdx-project.json file contains only one package directory, it must be the default. Remove the `\"default\": false` key and try again."], ["target-org", "Username or alias of the org that all commands run against by default. (sf only)"], ["target-dev-hub", "Username or alias of your default Dev Hub org. (sf only)"], ["defaultUsername", "Username or alias of the org that all commands run against by default. (sfdx only)"], ["defaultDevHubUsername", "Username or alias of your default Dev Hub org. (sfdx only)"], ["isvDebuggerSid", "ISV debugger SID (sfdx only)"], ["isvDebuggerUrl", "ISV debugger URL (sfdx only)"], ["org-isv-debugger-sid", "ISV debugger SID."], ["org-isv-debugger-url", "ISV debugger URL."], ["apiVersion", "API version of your project. Default: API version of your Dev Hub org. (sfdx only)"], ["org-api-version", "API version of your project. Default: API version of your Dev Hub org."], ["disableTelemetry", "Disables the collection of usage and user environment information, etc. Default: false. (sfdx only)"], ["disable-telemetry", "Disables the collection of usage and user environment information, etc. Default: false."], ["maxQueryLimit", "Maximum number of Salesforce records returned by a CLI command. Default: 10,000. (sfdx only)"], ["org-max-query-limit", "Maximum number of Salesforce records returned by a CLI command. Default: 10,000."], ["restDeploy", "Whether deployments use the Metadata REST API (true) or SOAP API (false, default value). (sfdx only)"], ["instanceUrl", "URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com. (sfdx only)"], ["org-instance-url", "URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com."], ["customOrgMetadataTemplates", "A valid repository URL or directory for the custom org metadata templates."], ["org-custom-metadata-templates", "A valid repository URL or directory for the custom org metadata templates."], ["invalidId", "The given id %s is not a valid 15 or 18 character Salesforce ID."]]));
32
16
  var OrgConfigProperties;
33
17
  (function (OrgConfigProperties) {
34
18
  /**
@@ -13,16 +13,7 @@ const ts_types_1 = require("@salesforce/ts-types");
13
13
  const logger_1 = require("../logger");
14
14
  const messages_1 = require("../messages");
15
15
  const sfError_1 = require("../sfError");
16
- messages_1.Messages.importMessagesDirectory(__dirname);
17
- const messages = messages_1.Messages.load('@salesforce/core', 'permissionSetAssignment', [
18
- 'errorsEncounteredCreatingAssignment',
19
- 'orgRequired',
20
- 'userIdRequired',
21
- 'permSetRequired',
22
- 'assignCommandPermissionSetNotFoundForNSError',
23
- 'assignCommandPermissionSetNotFoundError',
24
- 'notSuccessfulButNoErrorsReported',
25
- ]);
16
+ const messages = new messages_1.Messages('@salesforce/core', 'permissionSetAssignment', new Map([["orgRequired", "An Org instance is required."], ["userIdRequired", "A Salesforce id for the user is required."], ["permSetRequired", "The name of a permission set is required."], ["unexpectedType", "An unexpected response was returned from the permission set assignment."], ["assignCommandPermissionSetNotFoundError", "Permission set \"%s\" not found in target org. Do you need to push source?"], ["assignCommandPermissionSetNotFoundForNSError", "Permission set \"%s\" for namespace \"%s\" not found in target org. Do you need to push source or install the package?"], ["errorsEncounteredCreatingAssignment", "Error(s) were reported."], ["notSuccessfulButNoErrorsReported", "The permission set assignment failed but no errors were reported."]]));
26
17
  /**
27
18
  * A class for assigning a Salesforce User to one or more permission sets.
28
19
  */
@@ -23,14 +23,7 @@ const authInfo_1 = require("./authInfo");
23
23
  const scratchOrgLifecycleEvents_1 = require("./scratchOrgLifecycleEvents");
24
24
  const scratchOrgCache_1 = require("./scratchOrgCache");
25
25
  const scratchOrgErrorCodes_1 = require("./scratchOrgErrorCodes");
26
- messages_1.Messages.importMessagesDirectory(__dirname);
27
- const messages = messages_1.Messages.load('@salesforce/core', 'scratchOrgCreate', [
28
- 'DurationDaysValidationMaxError',
29
- 'DurationDaysValidationMinError',
30
- 'RetryNotIntError',
31
- 'DurationDaysNotIntError',
32
- 'CacheMissError',
33
- ]);
26
+ const messages = new messages_1.Messages('@salesforce/core', 'scratchOrgCreate', new Map([["UnsupportedSnapshotOrgCreateOptionsError", "Org snapshots don\u2019t support one or more options you specified: %s."], ["DurationDaysValidationMinError", "Expected 'durationDays' greater than or equal to %s but received %s."], ["DurationDaysValidationMaxError", "Expected 'durationDays' less than or equal to %s but received %s."], ["DurationDaysNotIntError", "Expected 'durationDays' to be an integer number."], ["RetryNotIntError", "Expected 'retry' to be an integer number."], ["CacheMissError", "The ScratchOrgInfoId %s was not found in the cache."]]));
34
27
  exports.DEFAULT_STREAM_TIMEOUT_MINUTES = 6;
35
28
  const validateDuration = (durationDays) => {
36
29
  const min = 1;
@@ -110,6 +103,8 @@ const scratchOrgResume = async (jobId) => {
110
103
  exports.scratchOrgResume = scratchOrgResume;
111
104
  const scratchOrgCreate = async (options) => {
112
105
  const logger = await logger_1.Logger.child('scratchOrgCreate');
106
+ /** epoch milliseconds */
107
+ const startTimestamp = Date.now();
113
108
  logger.debug('scratchOrgCreate');
114
109
  await (0, scratchOrgLifecycleEvents_1.emit)({ stage: 'prepare request' });
115
110
  const { hubOrg, connectedAppConsumerKey, durationDays = 1, nonamespace, noancestors, wait = kit_1.Duration.minutes(exports.DEFAULT_STREAM_TIMEOUT_MINUTES), retry = 0, apiversion, definitionjson, definitionfile, orgConfig, clientSecret = undefined, alias, setDefault = false, tracksSource = true, } = options;
@@ -182,7 +177,9 @@ const scratchOrgCreate = async (options) => {
182
177
  (0, scratchOrgInfoApi_1.resolveUrl)(scratchOrgAuthInfo),
183
178
  (0, scratchOrgInfoApi_1.deploySettings)(scratchOrg, settingsGenerator, apiversion ??
184
179
  configAggregator.getPropertyValue(orgConfigProperties_1.OrgConfigProperties.ORG_API_VERSION) ??
185
- (await scratchOrg.retrieveMaxApiVersion())),
180
+ (await scratchOrg.retrieveMaxApiVersion()),
181
+ // some of our "wait" time has already been used. Calculate how much remains that we can spend on the deployment.
182
+ kit_1.Duration.milliseconds(wait.milliseconds - (Date.now() - startTimestamp))),
186
183
  ]);
187
184
  await scratchOrgAuthInfo.handleAliasAndDefaultSettings({
188
185
  ...{
@@ -13,18 +13,8 @@ const logger_1 = require("../logger");
13
13
  const scratchOrgCache_1 = require("./scratchOrgCache");
14
14
  const scratchOrgLifecycleEvents_1 = require("./scratchOrgLifecycleEvents");
15
15
  const WORKSPACE_CONFIG_FILENAME = 'sfdx-project.json';
16
- messages_1.Messages.importMessagesDirectory(__dirname);
17
- const messages = messages_1.Messages.loadMessages('@salesforce/core', 'scratchOrgErrorCodes');
18
- const namedMessages = messages_1.Messages.load('@salesforce/core', 'scratchOrgErrorCodes', [
19
- 'SignupFailedActionError',
20
- 'SignupFailedUnknownError',
21
- 'SignupFailedError',
22
- 'SignupUnexpectedError',
23
- 'StillInProgressError',
24
- 'action.StillInProgress',
25
- 'ScratchOrgDeletedError',
26
- 'NoScratchOrgInfoError',
27
- ]);
16
+ const messages = new messages_1.Messages('@salesforce/core', 'scratchOrgErrorCodes', new Map([["SignupFailedError", "The request to create a scratch org failed with error code: %s."], ["SignupFailedUnknownError", "An unknown server error occurred. Please try again. If you still see this error, contact Salesforce support for assistance. Include the information from 'sfdx force:data:record:get -s ScratchOrgInfo -i %s -u %s'."], ["SignupFailedActionError", "See https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_scratch_orgs_error_codes.htm for information on error code %s."], ["SignupUnexpectedError", "The request to create a scratch org returned an unexpected status"], ["StillInProgressError", "The scratch org is not ready yet (Status = %s)."], ["action.StillInProgress", "Wait for a few minutes, and then try the <%= config.bin %> <%= command.id %> command again"], ["NoScratchOrgInfoError", "No ScratchOrgInfo object found in the Dev Hub you specified. Check that the ID and the Dev Hub are correct."], ["ScratchOrgDeletedError", "That scratch org has been deleted, so you can't connect to it anymore."], ["INVALID_ID_FIELD", "Provide a valid template ID, in the format 0TTxxxxxxxxxxxx."], ["T-0002", "We couldn\u2019t find a template or snapshot with the ID or name specified in the scratch org definition. If you\u2019re sure the ID is correct, contact Salesforce Support."], ["T-0003", "The template specified in the scratch org definition is unapproved. Contact Salesforce Support to request template approval."], ["T-0004", "The Trialforce Source Organization (TSO) for the template doesn\u2019t exist or has expired."], ["S-1006", "Provide a valid email address in your scratch org definition or your %s file."], ["S-2006", "Provide a valid country code in your scratch org definition or your %s file."], ["S-1017", "Specify a namespace that\u2019s used by a release org associated with your Dev Hub org."], ["S-1018", "Provide a valid My Domain value. This value can\u2019t include double hyphens, end in a hyphen, include restricted words, or be more than 40 characters long."], ["S-1019", "The My Domain value you chose is already in use."], ["S-1026", "Provide a valid namespace value. This value must begin with a letter. It can\u2019t include consecutive underscores, end in an underscore, be more than 15 characters long, or be a restricted or reserved namespace. Only alphanumeric characters and underscores are allowed."], ["S-9999", "A fatal signup error occurred. Please try again. If you still see this error, contact Salesforce Support for assistance."], ["SH-0001", "Can\u2019t create scratch org. Contact the source org admin to add your Dev Hub org ID to Setup > Org Shape. Then try again."], ["SH-0002", "Can\u2019t create scratch org. No org shape exists for the specified sourceOrg. Create an org shape and try again."], ["SH-0003", "Can\u2019t create scratch org from org shape. The org shape version is outdated. Recreate the org shape and try again."], ["C-1007", "The username provided to the org:create command is already in use. Run 'force:org:list --clean' to remove stale org authentications or create the org with a different username."], ["C-1015", "We encountered a problem while registering your My Domain value with the DNS provider. Please try again."], ["C-1016", "We encountered a problem while attempting to configure and approve the Connected App for your org. Verify the Connected App configuration with your Salesforce admin."], ["C-1017", "Provide a valid namespace prefix. This value must begin with a letter. It can\u2019t include consecutive underscores, end in an underscore, be more than 15 characters long, or be a restricted or reserved namespace. Only alphanumeric characters and underscores are allowed."], ["C-1020", "We couldn't find a template with the ID specified in the scratch org definition. If you\u2019re sure the ID is correct, contact Salesforce Support."], ["C-1027", "The template specified in the Scratch Definition isn\u2019t supported. Specify a generic edition (such as Developer or Enterprise), or specify a template ID."], ["C-9999", "A fatal signup error occurred. Please try again. If you still see this error, contact Salesforce Support for assistance"]]));
17
+ const namedMessages = new messages_1.Messages('@salesforce/core', 'scratchOrgErrorCodes', new Map([["SignupFailedError", "The request to create a scratch org failed with error code: %s."], ["SignupFailedUnknownError", "An unknown server error occurred. Please try again. If you still see this error, contact Salesforce support for assistance. Include the information from 'sfdx force:data:record:get -s ScratchOrgInfo -i %s -u %s'."], ["SignupFailedActionError", "See https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_scratch_orgs_error_codes.htm for information on error code %s."], ["SignupUnexpectedError", "The request to create a scratch org returned an unexpected status"], ["StillInProgressError", "The scratch org is not ready yet (Status = %s)."], ["action.StillInProgress", "Wait for a few minutes, and then try the <%= config.bin %> <%= command.id %> command again"], ["NoScratchOrgInfoError", "No ScratchOrgInfo object found in the Dev Hub you specified. Check that the ID and the Dev Hub are correct."], ["ScratchOrgDeletedError", "That scratch org has been deleted, so you can't connect to it anymore."], ["INVALID_ID_FIELD", "Provide a valid template ID, in the format 0TTxxxxxxxxxxxx."], ["T-0002", "We couldn\u2019t find a template or snapshot with the ID or name specified in the scratch org definition. If you\u2019re sure the ID is correct, contact Salesforce Support."], ["T-0003", "The template specified in the scratch org definition is unapproved. Contact Salesforce Support to request template approval."], ["T-0004", "The Trialforce Source Organization (TSO) for the template doesn\u2019t exist or has expired."], ["S-1006", "Provide a valid email address in your scratch org definition or your %s file."], ["S-2006", "Provide a valid country code in your scratch org definition or your %s file."], ["S-1017", "Specify a namespace that\u2019s used by a release org associated with your Dev Hub org."], ["S-1018", "Provide a valid My Domain value. This value can\u2019t include double hyphens, end in a hyphen, include restricted words, or be more than 40 characters long."], ["S-1019", "The My Domain value you chose is already in use."], ["S-1026", "Provide a valid namespace value. This value must begin with a letter. It can\u2019t include consecutive underscores, end in an underscore, be more than 15 characters long, or be a restricted or reserved namespace. Only alphanumeric characters and underscores are allowed."], ["S-9999", "A fatal signup error occurred. Please try again. If you still see this error, contact Salesforce Support for assistance."], ["SH-0001", "Can\u2019t create scratch org. Contact the source org admin to add your Dev Hub org ID to Setup > Org Shape. Then try again."], ["SH-0002", "Can\u2019t create scratch org. No org shape exists for the specified sourceOrg. Create an org shape and try again."], ["SH-0003", "Can\u2019t create scratch org from org shape. The org shape version is outdated. Recreate the org shape and try again."], ["C-1007", "The username provided to the org:create command is already in use. Run 'force:org:list --clean' to remove stale org authentications or create the org with a different username."], ["C-1015", "We encountered a problem while registering your My Domain value with the DNS provider. Please try again."], ["C-1016", "We encountered a problem while attempting to configure and approve the Connected App for your org. Verify the Connected App configuration with your Salesforce admin."], ["C-1017", "Provide a valid namespace prefix. This value must begin with a letter. It can\u2019t include consecutive underscores, end in an underscore, be more than 15 characters long, or be a restricted or reserved namespace. Only alphanumeric characters and underscores are allowed."], ["C-1020", "We couldn't find a template with the ID specified in the scratch org definition. If you\u2019re sure the ID is correct, contact Salesforce Support."], ["C-1027", "The template specified in the Scratch Definition isn\u2019t supported. Specify a generic edition (such as Developer or Enterprise), or specify a template ID."], ["C-9999", "A fatal signup error occurred. Please try again. If you still see this error, contact Salesforce Support for assistance"]]));
28
18
  // getMessage will throw when the code isn't found
29
19
  // and we don't know whether a given code takes arguments or not
30
20
  const optionalErrorCodeMessage = (errorCode, args) => {
@@ -14,12 +14,7 @@ exports.ScratchOrgFeatureDeprecation = void 0;
14
14
  const ts_types_1 = require("@salesforce/ts-types");
15
15
  // Local
16
16
  const messages_1 = require("../messages");
17
- messages_1.Messages.importMessagesDirectory(__dirname);
18
- const messages = messages_1.Messages.load('@salesforce/core', 'scratchOrgFeatureDeprecation', [
19
- 'quantifiedFeatureWithoutQuantityWarning',
20
- 'mappedFeatureWarning',
21
- 'deprecatedFeatureWarning',
22
- ]);
17
+ const messages = new messages_1.Messages('@salesforce/core', 'scratchOrgFeatureDeprecation', new Map([["quantifiedFeatureWithoutQuantityWarning", "The feature %s will be deprecated in a future release. It's been replaced by %s:<value>, which requires you to specify a quantity."], ["mappedFeatureWarning", "The feature %s has been deprecated. It has been replaced with %s in this scratch org create request."], ["deprecatedFeatureWarning", "The feature %s has been deprecated. It has been removed from the list of requested features."]]));
23
18
  const FEATURE_TYPES = {
24
19
  // simpleFeatureMapping holds a set of direct replacement values for features.
25
20
  simpleFeatureMapping: {
@@ -58,7 +58,7 @@ export declare const pollForScratchOrgInfo: (hubOrg: Org, scratchOrgInfoId: stri
58
58
  * @param orgSettings an instance of the SettingsGenerator class
59
59
  * @param apiVersion the api version (used when created the package.xml)
60
60
  */
61
- export declare const deploySettings: (scratchOrg: Org, orgSettings: SettingsGenerator, apiVersion: string) => Promise<void>;
61
+ export declare const deploySettings: (scratchOrg: Org, orgSettings: SettingsGenerator, apiVersion: string, timeout?: Duration) => Promise<void>;
62
62
  /**
63
63
  *
64
64
  * @param scratchOrgAuthInfo an AuthInfo class from the scratch org
@@ -21,9 +21,8 @@ const authInfo_1 = require("./authInfo");
21
21
  const org_1 = require("./org");
22
22
  const scratchOrgErrorCodes_1 = require("./scratchOrgErrorCodes");
23
23
  const scratchOrgLifecycleEvents_1 = require("./scratchOrgLifecycleEvents");
24
- messages_1.Messages.importMessagesDirectory(__dirname);
25
- const messages = messages_1.Messages.loadMessages('@salesforce/core', 'scratchOrgInfoApi');
26
- const errorCodes = messages_1.Messages.load('@salesforce/core', 'scratchOrgErrorCodes', ['C-1007']);
24
+ const messages = new messages_1.Messages('@salesforce/core', 'scratchOrgInfoApi', new Map([["SignupFieldsMissingError", "Required fields are missing for org creation: [%s]"], ["SignupDuplicateSettingsSpecifiedError", "You cannot use 'settings' and `'orgPreferences' in your scratch definition file, please specify one or the other."], ["DeprecatedPrefFormat", "We've deprecated OrgPreferences. Update the scratch org definition file to replace OrgPreferences with their corresponding settings."], ["SourceStatusResetFailureError", "Successfully created org with ID: %s and name: %s. Unfortunately, source tracking isn\u2019t working as expected. If you run force:source:status, the results may be incorrect. Try again by creating another scratch org."], ["hubOrgIsNotDevHub", "Make sure that the org with username %s and ID %s is enabled as a Dev Hub. To enable it, open the org in your browser, navigate to the Dev Hub page in Setup, and click Enable.\nIf you still see this error after enabling the Dev Hub feature, then re-authenticate to the org."]]));
25
+ const errorCodes = new messages_1.Messages('@salesforce/core', 'scratchOrgErrorCodes', new Map([["SignupFailedError", "The request to create a scratch org failed with error code: %s."], ["SignupFailedUnknownError", "An unknown server error occurred. Please try again. If you still see this error, contact Salesforce support for assistance. Include the information from 'sfdx force:data:record:get -s ScratchOrgInfo -i %s -u %s'."], ["SignupFailedActionError", "See https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_scratch_orgs_error_codes.htm for information on error code %s."], ["SignupUnexpectedError", "The request to create a scratch org returned an unexpected status"], ["StillInProgressError", "The scratch org is not ready yet (Status = %s)."], ["action.StillInProgress", "Wait for a few minutes, and then try the <%= config.bin %> <%= command.id %> command again"], ["NoScratchOrgInfoError", "No ScratchOrgInfo object found in the Dev Hub you specified. Check that the ID and the Dev Hub are correct."], ["ScratchOrgDeletedError", "That scratch org has been deleted, so you can't connect to it anymore."], ["INVALID_ID_FIELD", "Provide a valid template ID, in the format 0TTxxxxxxxxxxxx."], ["T-0002", "We couldn\u2019t find a template or snapshot with the ID or name specified in the scratch org definition. If you\u2019re sure the ID is correct, contact Salesforce Support."], ["T-0003", "The template specified in the scratch org definition is unapproved. Contact Salesforce Support to request template approval."], ["T-0004", "The Trialforce Source Organization (TSO) for the template doesn\u2019t exist or has expired."], ["S-1006", "Provide a valid email address in your scratch org definition or your %s file."], ["S-2006", "Provide a valid country code in your scratch org definition or your %s file."], ["S-1017", "Specify a namespace that\u2019s used by a release org associated with your Dev Hub org."], ["S-1018", "Provide a valid My Domain value. This value can\u2019t include double hyphens, end in a hyphen, include restricted words, or be more than 40 characters long."], ["S-1019", "The My Domain value you chose is already in use."], ["S-1026", "Provide a valid namespace value. This value must begin with a letter. It can\u2019t include consecutive underscores, end in an underscore, be more than 15 characters long, or be a restricted or reserved namespace. Only alphanumeric characters and underscores are allowed."], ["S-9999", "A fatal signup error occurred. Please try again. If you still see this error, contact Salesforce Support for assistance."], ["SH-0001", "Can\u2019t create scratch org. Contact the source org admin to add your Dev Hub org ID to Setup > Org Shape. Then try again."], ["SH-0002", "Can\u2019t create scratch org. No org shape exists for the specified sourceOrg. Create an org shape and try again."], ["SH-0003", "Can\u2019t create scratch org from org shape. The org shape version is outdated. Recreate the org shape and try again."], ["C-1007", "The username provided to the org:create command is already in use. Run 'force:org:list --clean' to remove stale org authentications or create the org with a different username."], ["C-1015", "We encountered a problem while registering your My Domain value with the DNS provider. Please try again."], ["C-1016", "We encountered a problem while attempting to configure and approve the Connected App for your org. Verify the Connected App configuration with your Salesforce admin."], ["C-1017", "Provide a valid namespace prefix. This value must begin with a letter. It can\u2019t include consecutive underscores, end in an underscore, be more than 15 characters long, or be a restricted or reserved namespace. Only alphanumeric characters and underscores are allowed."], ["C-1020", "We couldn't find a template with the ID specified in the scratch org definition. If you\u2019re sure the ID is correct, contact Salesforce Support."], ["C-1027", "The template specified in the Scratch Definition isn\u2019t supported. Specify a generic edition (such as Developer or Enterprise), or specify a template ID."], ["C-9999", "A fatal signup error occurred. Please try again. If you still see this error, contact Salesforce Support for assistance"]]));
27
26
  /**
28
27
  * Returns the url to be used to authorize into the new scratch org
29
28
  *
@@ -326,14 +325,14 @@ exports.pollForScratchOrgInfo = pollForScratchOrgInfo;
326
325
  * @param orgSettings an instance of the SettingsGenerator class
327
326
  * @param apiVersion the api version (used when created the package.xml)
328
327
  */
329
- const deploySettings = async (scratchOrg, orgSettings, apiVersion) => {
328
+ const deploySettings = async (scratchOrg, orgSettings, apiVersion, timeout = kit_1.Duration.minutes(10)) => {
330
329
  const logger = await logger_1.Logger.child('scratchOrgInfoApi-deploySettings');
331
330
  if (orgSettings.hasSettings()) {
332
331
  // deploy the settings to the newly created scratch org
333
332
  logger.debug(`deploying scratch org settings with apiVersion ${apiVersion}`);
334
333
  try {
335
334
  await orgSettings.createDeploy();
336
- await orgSettings.deploySettingsViaFolder(scratchOrg, apiVersion);
335
+ await orgSettings.deploySettingsViaFolder(scratchOrg, apiVersion, timeout);
337
336
  // updating the revision num to zero during org:creation if source members are created during org:create.
338
337
  // This only happens for some specific scratch org definition file.
339
338
  await (0, exports.updateRevisionCounterToZero)(scratchOrg);
@@ -16,8 +16,7 @@ const messages_1 = require("../messages");
16
16
  const sfError_1 = require("../sfError");
17
17
  const scratchOrgFeatureDeprecation_1 = require("./scratchOrgFeatureDeprecation");
18
18
  const authInfo_1 = require("./authInfo");
19
- messages_1.Messages.importMessagesDirectory(__dirname);
20
- const messages = messages_1.Messages.loadMessages('@salesforce/core', 'scratchOrgInfoGenerator');
19
+ const messages = new messages_1.Messages('@salesforce/core', 'scratchOrgInfoGenerator', new Map([["Package2AncestorsIdsKeyNotSupportedError", "The package2AncestorIds key is no longer supported in a scratch org definition. Ancestors defined in sfdx-project.json will be included in the scratch org.\","], ["InvalidAncestorVersionFormatError", "The ancestor versionNumber must be in the format major.minor.patch but the value found is %s\","], ["NoMatchingAncestorError", "The ancestor for ancestorVersion %s can't be found. Package ID %s.\","], ["NoMatchingAncestorIdError", "The ancestor for ancestorId [%s] can't be found. Package ID %s.\""], ["AncestorNotReleasedError", "The ancestor package version [%s] specified in the sfdx-project.json file may exist hasn\u2019t been promoted and released. Release the ancestor package version before specifying it as the ancestor in a new package or patch version.\","], ["AncestorIdVersionMismatchError", "The ancestorVersion in sfdx-project.json is not the version expected for the ancestorId you supplied. ancestorVersion %s. ancestorID %s.\""], ["unsupportedSnapshotOrgCreateOptions", "Org snapshots don\u2019t support one or more options you specified: %s"]]));
21
20
  const SNAPSHOT_UNSUPPORTED_OPTIONS = [
22
21
  'features',
23
22
  'orgPreferences',
@@ -1,3 +1,4 @@
1
+ import { Duration } from '@salesforce/kit';
1
2
  import { JsonMap } from '@salesforce/ts-types';
2
3
  import { ScratchOrgInfo, ObjectSetting } from './scratchOrgTypes';
3
4
  import { Org } from './org';
@@ -65,7 +66,7 @@ export default class SettingsGenerator {
65
66
  /**
66
67
  * Deploys the settings to the org.
67
68
  */
68
- deploySettingsViaFolder(scratchOrg: Org, apiVersion: string): Promise<void>;
69
+ deploySettingsViaFolder(scratchOrg: Org, apiVersion: string, timeout?: Duration): Promise<void>;
69
70
  createDeployPackageContents(apiVersion: string): Promise<void>;
70
71
  getShapeDirName(): string;
71
72
  /**
@@ -181,7 +181,7 @@ class SettingsGenerator {
181
181
  /**
182
182
  * Deploys the settings to the org.
183
183
  */
184
- async deploySettingsViaFolder(scratchOrg, apiVersion) {
184
+ async deploySettingsViaFolder(scratchOrg, apiVersion, timeout = kit_1.Duration.minutes(10)) {
185
185
  const username = scratchOrg.getUsername();
186
186
  const logger = await logger_1.Logger.child('deploySettingsViaFolder');
187
187
  await this.createDeployPackageContents(apiVersion);
@@ -215,7 +215,7 @@ class SettingsGenerator {
215
215
  };
216
216
  }
217
217
  },
218
- timeout: kit_1.Duration.minutes(10),
218
+ timeout,
219
219
  frequency: kit_1.Duration.seconds(1),
220
220
  timeoutErrorName: 'DeployingSettingsTimeoutError',
221
221
  };
package/lib/org/user.js CHANGED
@@ -36,16 +36,7 @@ const PASSWORD_COMPLEXITY = {
36
36
  };
37
37
  const scimEndpoint = '/services/scim/v1/Users';
38
38
  const scimHeaders = { 'auto-approve-user': 'true' };
39
- messages_1.Messages.importMessagesDirectory(__dirname);
40
- const messages = messages_1.Messages.load('@salesforce/core', 'user', [
41
- 'invalidHttpResponseCreatingUser',
42
- 'userQueryFailed',
43
- 'missingId',
44
- 'permsetNamesAreRequired',
45
- 'missingFields',
46
- 'lengthOutOfBound',
47
- 'complexityOutOfBound',
48
- ]);
39
+ const messages = new messages_1.Messages('@salesforce/core', 'user', new Map([["orgRequired", "An org instance is required."], ["userQueryFailed", "Failed to query for the user %s."], ["invalidHttpResponseCreatingUser", "An invalid http response code (%s) was received while trying to create a user."], ["missingFields", "The fields parameters is undefined."], ["missingId", "The Salesforce id for the user is required."], ["permsetNamesAreRequired", "The permission set names are missing but required."], ["complexityOutOfBound", "Invalid complexity value. Specify a value between 0 and 5, inclusive."], ["lengthOutOfBound", "Invalid length value. Specify a value between 8 and 1000, inclusive."], ["problemsDescribingTheUserObject", "Problems occurred while attempting to describe the user object."]]));
49
40
  /**
50
41
  * A Map of Required Salesforce User fields.
51
42
  */
package/lib/sfProject.js CHANGED
@@ -19,17 +19,8 @@ const internal_1 = require("./util/internal");
19
19
  const sfError_1 = require("./sfError");
20
20
  const sfdc_1 = require("./util/sfdc");
21
21
  const messages_1 = require("./messages");
22
- messages_1.Messages.importMessagesDirectory(__dirname);
23
- const messages = messages_1.Messages.load('@salesforce/core', 'config', [
24
- 'schemaValidationError',
25
- 'singleNonDefaultPackage',
26
- 'missingDefaultPath',
27
- 'multipleDefaultPaths',
28
- 'invalidPackageDirectory',
29
- 'missingPackageDirectory',
30
- 'invalidId',
31
- ]);
32
- const coreMessages = messages_1.Messages.load('@salesforce/core', 'core', ['invalidJsonCasing']);
22
+ const messages = new messages_1.Messages('@salesforce/core', 'config', new Map([["unknownConfigKey", "Unknown config name: %s."], ["deprecatedConfigKey", "Deprecated config name: %s. Please use %s instead."], ["invalidWrite", "The writeSync method is not allowed on SfdxConfig. Use the async write method instead."], ["invalidConfigValue", "Invalid config value: %s."], ["invalidInstanceUrl", "Specify a valid Salesforce instance URL."], ["invalidApiVersion", "Specify a valid Salesforce API version, for example, 42.0."], ["invalidCustomOrgMetadataTemplates", "Specify a valid repository URL or directory for the custom org metadata templates."], ["invalidIsvDebuggerSid", "Specify a valid Debugger SID."], ["invalidIsvDebuggerUrl", "Specify a valid Debugger URL."], ["invalidNumberConfigValue", "Specify a valid positive integer, for example, 150000."], ["invalidBooleanConfigValue", "The config value can only be set to true or false."], ["invalidProjectWorkspace", "This directory does not contain a valid Salesforce DX project."], ["schemaValidationError", "The config file \"%s\" is not schema valid.\nDue to: %s"], ["schemaValidationError.actions", ["Fix the invalid entries at %s."]], ["missingDefaultPath", "In sfdx-project.json, be sure to specify which package directory (path) is the default. Example: `[{ \"path\": \"packageDirectory1\", \"default\": true }, { \"path\": \"packageDirectory2\" }]`"], ["missingPackageDirectory", "The path \"%s\", specified in sfdx-project.json, does not exist. Be sure this directory is included in your project root."], ["invalidPackageDirectory", "The path \"%s\", specified in sfdx-project.json, must be indicated as a relative path to the project root."], ["multipleDefaultPaths", "In sfdx-project.json, indicate only one package directory (path) as the default."], ["singleNonDefaultPackage", "The sfdx-project.json file must include one, and only one, default package directory (path). Because your sfdx-project.json file contains only one package directory, it must be the default. Remove the `\"default\": false` key and try again."], ["target-org", "Username or alias of the org that all commands run against by default. (sf only)"], ["target-dev-hub", "Username or alias of your default Dev Hub org. (sf only)"], ["defaultUsername", "Username or alias of the org that all commands run against by default. (sfdx only)"], ["defaultDevHubUsername", "Username or alias of your default Dev Hub org. (sfdx only)"], ["isvDebuggerSid", "ISV debugger SID (sfdx only)"], ["isvDebuggerUrl", "ISV debugger URL (sfdx only)"], ["org-isv-debugger-sid", "ISV debugger SID."], ["org-isv-debugger-url", "ISV debugger URL."], ["apiVersion", "API version of your project. Default: API version of your Dev Hub org. (sfdx only)"], ["org-api-version", "API version of your project. Default: API version of your Dev Hub org."], ["disableTelemetry", "Disables the collection of usage and user environment information, etc. Default: false. (sfdx only)"], ["disable-telemetry", "Disables the collection of usage and user environment information, etc. Default: false."], ["maxQueryLimit", "Maximum number of Salesforce records returned by a CLI command. Default: 10,000. (sfdx only)"], ["org-max-query-limit", "Maximum number of Salesforce records returned by a CLI command. Default: 10,000."], ["restDeploy", "Whether deployments use the Metadata REST API (true) or SOAP API (false, default value). (sfdx only)"], ["instanceUrl", "URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com. (sfdx only)"], ["org-instance-url", "URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com."], ["customOrgMetadataTemplates", "A valid repository URL or directory for the custom org metadata templates."], ["org-custom-metadata-templates", "A valid repository URL or directory for the custom org metadata templates."], ["invalidId", "The given id %s is not a valid 15 or 18 character Salesforce ID."]]));
23
+ const coreMessages = new messages_1.Messages('@salesforce/core', 'core', new Map([["authInfoCreationError", "Must pass a username and/or OAuth options when creating an AuthInfo instance."], ["authInfoOverwriteError", "Cannot create an AuthInfo instance that will overwrite existing auth data."], ["authInfoOverwriteError.actions", ["Create the AuthInfo instance using existing auth data by just passing the username. E.g., `AuthInfo.create({ username: 'my@user.org' });`."]], ["authCodeExchangeError", "Error authenticating with auth code due to: %s"], ["authCodeUsernameRetrievalError", "Could not retrieve the username after successful auth code exchange.\n\nDue to: %s"], ["jwtAuthError", "Error authenticating with JWT config due to: %s"], ["jwtAuthErrors", "Error authenticating with JWT.\nErrors encountered:\n%s"], ["refreshTokenAuthError", "Error authenticating with the refresh token due to: %s"], ["orgDataNotAvailableError", "An attempt to refresh the authentication token failed with a 'Data Not Found Error'. The org identified by username %s does not appear to exist. Likely cause is that the org was deleted by another user or has expired."], ["orgDataNotAvailableError.actions", ["Run `sfdx force:org:list --clean` to remove stale org authentications.", "Use `sfdx force:config:set` to update the defaultusername.", "Use `sfdx force:org:create` to create a new org.", "Use `sfdx auth` to authenticate an existing org."]], ["namedOrgNotFound", "No authorization information found for %s."], ["noAliasesFound", "Nothing to set."], ["invalidFormat", "Setting aliases must be in the format <key>=<value> but found: [%s]."], ["invalidJsonCasing", "All JSON input must have heads down camelcase keys. E.g., `{ sfdcLoginUrl: \"https://login.salesforce.com\" }`\nFound \"%s\" at %s"], ["missingClientId", "Client ID is required for JWT authentication."]]));
33
24
  /**
34
25
  * The sfdx-project.json config object. This file determines if a folder is a valid sfdx project.
35
26
  *
@@ -73,8 +73,7 @@ class BaseOrgAccessor extends kit_1.AsyncOptionalCreatable {
73
73
  get(username, decrypt = false, throwOnNotFound = false) {
74
74
  const config = this.configs.get(username);
75
75
  if (throwOnNotFound && config?.keys().length === 0) {
76
- messages_1.Messages.importMessagesDirectory(__dirname);
77
- const messages = messages_1.Messages.load('@salesforce/core', 'core', ['namedOrgNotFound']);
76
+ const messages = new messages_1.Messages('@salesforce/core', 'core', new Map([["authInfoCreationError", "Must pass a username and/or OAuth options when creating an AuthInfo instance."], ["authInfoOverwriteError", "Cannot create an AuthInfo instance that will overwrite existing auth data."], ["authInfoOverwriteError.actions", ["Create the AuthInfo instance using existing auth data by just passing the username. E.g., `AuthInfo.create({ username: 'my@user.org' });`."]], ["authCodeExchangeError", "Error authenticating with auth code due to: %s"], ["authCodeUsernameRetrievalError", "Could not retrieve the username after successful auth code exchange.\n\nDue to: %s"], ["jwtAuthError", "Error authenticating with JWT config due to: %s"], ["jwtAuthErrors", "Error authenticating with JWT.\nErrors encountered:\n%s"], ["refreshTokenAuthError", "Error authenticating with the refresh token due to: %s"], ["orgDataNotAvailableError", "An attempt to refresh the authentication token failed with a 'Data Not Found Error'. The org identified by username %s does not appear to exist. Likely cause is that the org was deleted by another user or has expired."], ["orgDataNotAvailableError.actions", ["Run `sfdx force:org:list --clean` to remove stale org authentications.", "Use `sfdx force:config:set` to update the defaultusername.", "Use `sfdx force:org:create` to create a new org.", "Use `sfdx auth` to authenticate an existing org."]], ["namedOrgNotFound", "No authorization information found for %s."], ["noAliasesFound", "Nothing to set."], ["invalidFormat", "Setting aliases must be in the format <key>=<value> but found: [%s]."], ["invalidJsonCasing", "All JSON input must have heads down camelcase keys. E.g., `{ sfdcLoginUrl: \"https://login.salesforce.com\" }`\nFound \"%s\" at %s"], ["missingClientId", "Client ID is required for JWT authentication."]]));
78
77
  throw messages.createError('namedOrgNotFound', [username]);
79
78
  }
80
79
  if (config) {
@@ -17,14 +17,7 @@ const sfError_1 = require("../sfError");
17
17
  const messages_1 = require("../messages");
18
18
  const types_1 = require("./types");
19
19
  Object.defineProperty(exports, "CometClient", { enumerable: true, get: function () { return types_1.CometClient; } });
20
- messages_1.Messages.importMessagesDirectory(__dirname);
21
- const messages = messages_1.Messages.load('@salesforce/core', 'streaming', [
22
- 'waitParamValidValueError',
23
- 'genericHandshakeTimeout',
24
- 'invalidApiVersion',
25
- 'genericTimeout',
26
- 'handshakeApiVersionError',
27
- ]);
20
+ const messages = new messages_1.Messages('@salesforce/core', 'streaming', new Map([["genericTimeout", "Socket timeout occurred while listening for results."], ["genericHandshakeTimeout", "The streaming request failed to handshake at %s."], ["handshakeApiVersionError", "Invalid API version specified for streaming connection handshake: %s"], ["handshakeApiVersionError.actions", ["Set the API version to match the org as an environment variable (e.g., SFDX_API_VERSION=XX.0)."]], ["waitParamValidValueError", "Invalid value was specified for wait. Please provide a wait value greater than %s minutes."], ["invalidApiVersion", "Invalid api version is being reported by config (apiVersion=%s)."]]));
28
21
  /**
29
22
  * Validation helper
30
23
  *
package/lib/testSetup.js CHANGED
@@ -53,8 +53,6 @@ class TestContext {
53
53
  this.stubs = {};
54
54
  const opts = { setup: true, ...options };
55
55
  const sinon = this.requireSinon(opts.sinon);
56
- // Import all the messages files in the sfdx-core messages dir.
57
- messages_1.Messages.importMessagesDirectory((0, path_1.join)(__dirname));
58
56
  // Create a global sinon sandbox and a test logger instance for use within tests.
59
57
  this.SANDBOX = opts.sandbox ?? sinon.createSandbox();
60
58
  this.SANDBOXES = {
@@ -10,8 +10,7 @@ exports.traverse = exports.resolveProjectPathSync = exports.resolveProjectPath =
10
10
  const fs = require("fs");
11
11
  const path_1 = require("path");
12
12
  const messages_1 = require("../messages");
13
- messages_1.Messages.importMessagesDirectory(__dirname);
14
- const messages = messages_1.Messages.load('@salesforce/core', 'config', ['invalidProjectWorkspace']);
13
+ const messages = new messages_1.Messages('@salesforce/core', 'config', new Map([["unknownConfigKey", "Unknown config name: %s."], ["deprecatedConfigKey", "Deprecated config name: %s. Please use %s instead."], ["invalidWrite", "The writeSync method is not allowed on SfdxConfig. Use the async write method instead."], ["invalidConfigValue", "Invalid config value: %s."], ["invalidInstanceUrl", "Specify a valid Salesforce instance URL."], ["invalidApiVersion", "Specify a valid Salesforce API version, for example, 42.0."], ["invalidCustomOrgMetadataTemplates", "Specify a valid repository URL or directory for the custom org metadata templates."], ["invalidIsvDebuggerSid", "Specify a valid Debugger SID."], ["invalidIsvDebuggerUrl", "Specify a valid Debugger URL."], ["invalidNumberConfigValue", "Specify a valid positive integer, for example, 150000."], ["invalidBooleanConfigValue", "The config value can only be set to true or false."], ["invalidProjectWorkspace", "This directory does not contain a valid Salesforce DX project."], ["schemaValidationError", "The config file \"%s\" is not schema valid.\nDue to: %s"], ["schemaValidationError.actions", ["Fix the invalid entries at %s."]], ["missingDefaultPath", "In sfdx-project.json, be sure to specify which package directory (path) is the default. Example: `[{ \"path\": \"packageDirectory1\", \"default\": true }, { \"path\": \"packageDirectory2\" }]`"], ["missingPackageDirectory", "The path \"%s\", specified in sfdx-project.json, does not exist. Be sure this directory is included in your project root."], ["invalidPackageDirectory", "The path \"%s\", specified in sfdx-project.json, must be indicated as a relative path to the project root."], ["multipleDefaultPaths", "In sfdx-project.json, indicate only one package directory (path) as the default."], ["singleNonDefaultPackage", "The sfdx-project.json file must include one, and only one, default package directory (path). Because your sfdx-project.json file contains only one package directory, it must be the default. Remove the `\"default\": false` key and try again."], ["target-org", "Username or alias of the org that all commands run against by default. (sf only)"], ["target-dev-hub", "Username or alias of your default Dev Hub org. (sf only)"], ["defaultUsername", "Username or alias of the org that all commands run against by default. (sfdx only)"], ["defaultDevHubUsername", "Username or alias of your default Dev Hub org. (sfdx only)"], ["isvDebuggerSid", "ISV debugger SID (sfdx only)"], ["isvDebuggerUrl", "ISV debugger URL (sfdx only)"], ["org-isv-debugger-sid", "ISV debugger SID."], ["org-isv-debugger-url", "ISV debugger URL."], ["apiVersion", "API version of your project. Default: API version of your Dev Hub org. (sfdx only)"], ["org-api-version", "API version of your project. Default: API version of your Dev Hub org."], ["disableTelemetry", "Disables the collection of usage and user environment information, etc. Default: false. (sfdx only)"], ["disable-telemetry", "Disables the collection of usage and user environment information, etc. Default: false."], ["maxQueryLimit", "Maximum number of Salesforce records returned by a CLI command. Default: 10,000. (sfdx only)"], ["org-max-query-limit", "Maximum number of Salesforce records returned by a CLI command. Default: 10,000."], ["restDeploy", "Whether deployments use the Metadata REST API (true) or SOAP API (false, default value). (sfdx only)"], ["instanceUrl", "URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com. (sfdx only)"], ["org-instance-url", "URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com."], ["customOrgMetadataTemplates", "A valid repository URL or directory for the custom org metadata templates."], ["org-custom-metadata-templates", "A valid repository URL or directory for the custom org metadata templates."], ["invalidId", "The given id %s is not a valid 15 or 18 character Salesforce ID."]]));
15
14
  /**
16
15
  * The name of the project config file.
17
16
  *
@@ -21,15 +21,7 @@ const org_1 = require("./org");
21
21
  const sfError_1 = require("./sfError");
22
22
  const messages_1 = require("./messages");
23
23
  const sfProject_1 = require("./sfProject");
24
- messages_1.Messages.importMessagesDirectory(__dirname);
25
- const messages = messages_1.Messages.load('@salesforce/core', 'auth', [
26
- 'invalidRequestUri',
27
- 'invalidRequestMethod',
28
- 'missingAuthCode',
29
- 'serverErrorHTMLResponse',
30
- 'portInUse',
31
- 'portInUse.actions',
32
- ]);
24
+ const messages = new messages_1.Messages('@salesforce/core', 'auth', new Map([["targetOrgNotSet", "A default user is not set."], ["targetOrgNotSet.actions", ["Run the \"sfdx auth\" commands with --setdefaultusername to connect to an org and set it as your default org.", "Run \"force:org:create\" with --setdefaultusername to create a scratch org and set it as your default org.", "Run \"sfdx config:set defaultusername=<username>\" to set your default username."]], ["portInUse", "Cannot start the OAuth redirect server on port %s."], ["portInUse.actions", ["Kill the process running on port %s or use a custom connected app and update OauthLocalPort in the sfdx-project.json file."]], ["invalidRequestMethod", "Invalid request method: %s"], ["invalidRequestUri", "Invalid request uri: %s"], ["pollingTimeout", "The device authorization request timed out. After executing force:auth:device:login, you must approve access to the device within 10 minutes. This can happen if the URL wasn\u2019t copied into the browser, login was not attempted, or the 2FA process was not completed within 10 minutes. Request authorization again."], ["serverErrorHTMLResponse", "<h1>%s</h1><br />This is most likely <b>not</b> an error with the Salesforce CLI. Please ensure all information is accurate and try again."], ["missingAuthCode", "No authentication code found on login response."]]));
33
25
  /**
34
26
  * Handles the creation of a web server for web based login flows.
35
27
  *
@@ -0,0 +1,93 @@
1
+ /*
2
+ * Copyright (c) 2023, salesforce.com, inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ */
7
+ /* eslint-disable no-console */
8
+ /* eslint-disable complexity */
9
+
10
+ import * as ts from 'typescript';
11
+ import { Messages, StoredMessageMap } from '../src/messages';
12
+
13
+ /**
14
+ *
15
+ * @experimental
16
+ * transforms `messages` references from dynamic run-time to static compile-time values
17
+ */
18
+ const transformer = (program: ts.Program, pluginOptions: {}) => {
19
+ Messages.importMessagesDirectory(process.cwd());
20
+ const transformerFactory: ts.TransformerFactory<ts.SourceFile> = (context) => {
21
+ return (sourceFile) => {
22
+ // if there are no messages, no transformation is needed
23
+ if (
24
+ !sourceFile.statements.some((i) => ts.isImportDeclaration(i) && i.importClause?.getText().includes('Messages'))
25
+ ) {
26
+ return sourceFile;
27
+ }
28
+
29
+ const visitor = (node: ts.Node): ts.VisitResult<ts.Node> => {
30
+ if (ts.isExpressionStatement(node) && node.getText().includes('importMessagesDirectory')) {
31
+ // importMessagesDirectory now happens at compile, not in runtime
32
+ // returning undefined removes the node
33
+ return undefined;
34
+ }
35
+ if (
36
+ // transform a runtime load call into hardcoded messages values
37
+ // const foo = Messages.load|loadMessages('pluginName', 'messagesFile' ...) =>
38
+ // const foo = new Messages('pluginName', 'messagesFile', new Map([['key', 'value']]))
39
+ ts.isCallExpression(node) &&
40
+ ts.isPropertyAccessExpression(node.expression) &&
41
+ node.expression.expression.getText() === 'Messages' &&
42
+ node.expression.name.getText().includes('load')
43
+ ) {
44
+ // we always want the first two arguments, which are the plugin name and the messages file name
45
+ const arrayMembers = node.arguments.slice(0, 2);
46
+ const arrayMembersText = arrayMembers.map(getTextWithoutQuotes);
47
+
48
+ // Messages doesn't care whether you call messages.load or loadMessages, it loads the whole file
49
+ const messagesInstance = Messages.loadMessages(arrayMembersText[0], arrayMembersText[1]);
50
+ return context.factory.createNewExpression(node.expression.expression, undefined, [
51
+ arrayMembers[0],
52
+ arrayMembers[1],
53
+ context.factory.createNewExpression(context.factory.createIdentifier('Map'), undefined, [
54
+ messageMapToHardcodedMap(messagesInstance.messages),
55
+ ]),
56
+ ]);
57
+ }
58
+ // it might be a node that contains one of the things we're interested in, so keep digging
59
+ return ts.visitEachChild(node, visitor, context);
60
+ };
61
+ return ts.visitNode(sourceFile, visitor);
62
+ };
63
+ };
64
+ return transformerFactory;
65
+ };
66
+
67
+ export default transformer;
68
+
69
+ const getTextWithoutQuotes = (node: ts.Node): string => node.getText().replace(/'/g, '');
70
+
71
+ /** turn a loaded message map into */
72
+ const messageMapToHardcodedMap = (messages: StoredMessageMap): ts.ArrayLiteralExpression => {
73
+ return ts.factory.createArrayLiteralExpression(
74
+ Array.from(messages).map(([key, value]) => {
75
+ // case 1: string
76
+ if (typeof value === 'string') {
77
+ return ts.factory.createArrayLiteralExpression([
78
+ ts.factory.createStringLiteral(key),
79
+ ts.factory.createStringLiteral(value),
80
+ ]);
81
+ } else if (Array.isArray(value)) {
82
+ // case 2: string[]
83
+ return ts.factory.createArrayLiteralExpression([
84
+ ts.factory.createStringLiteral(key),
85
+ ts.factory.createArrayLiteralExpression(value.map((v) => ts.factory.createStringLiteral(v))),
86
+ ]);
87
+ } else {
88
+ // turn the object into a map and recurse!
89
+ return messageMapToHardcodedMap(new Map(Object.entries(value)));
90
+ }
91
+ })
92
+ );
93
+ };
@@ -21,3 +21,7 @@ The ancestor package version [%s] specified in the sfdx-project.json file may ex
21
21
  # AncestorIdVersionMismatchError
22
22
 
23
23
  The ancestorVersion in sfdx-project.json is not the version expected for the ancestorId you supplied. ancestorVersion %s. ancestorID %s."
24
+
25
+ # unsupportedSnapshotOrgCreateOptions
26
+
27
+ Org snapshots don’t support one or more options you specified: %s
package/package.json CHANGED
@@ -1,25 +1,26 @@
1
1
  {
2
2
  "name": "@salesforce/core",
3
- "version": "3.33.1",
3
+ "version": "3.33.3",
4
4
  "description": "Core libraries to interact with SFDX projects, orgs, and APIs.",
5
5
  "main": "lib/exported",
6
6
  "types": "lib/exported.d.ts",
7
7
  "license": "BSD-3-Clause",
8
8
  "scripts": {
9
- "build": "sf-build",
9
+ "build": "wireit",
10
10
  "ci-docs": "yarn sf-ci-docs",
11
11
  "clean": "sf-clean",
12
12
  "clean-all": "sf-clean all",
13
- "compile": "sf-compile",
13
+ "compile": "wireit",
14
14
  "docs": "sf-docs",
15
- "format": "sf-format",
16
- "lint": "sf-lint",
15
+ "format": "wireit",
16
+ "lint": "wireit",
17
17
  "lint-fix": "yarn sf-lint --fix",
18
- "postcompile": "tsc -p test && tsc -p typedocExamples",
18
+ "postcompile": "tsc -p typedocExamples",
19
19
  "prepack": "sf-prepack",
20
20
  "prepare": "sf-install",
21
- "pretest": "sf-compile-test",
22
- "test": "sf-test"
21
+ "test": "wireit",
22
+ "test:compile": "wireit",
23
+ "test:only": "wireit"
23
24
  },
24
25
  "keywords": [
25
26
  "force",
@@ -31,11 +32,12 @@
31
32
  "docs",
32
33
  "lib",
33
34
  "messages",
34
- "!lib/**/*.map"
35
+ "!lib/**/*.map",
36
+ "messageTransformer/messageTransformer.ts"
35
37
  ],
36
38
  "dependencies": {
37
39
  "@salesforce/bunyan": "^2.0.0",
38
- "@salesforce/kit": "^1.8.0",
40
+ "@salesforce/kit": "^1.9.0",
39
41
  "@salesforce/schemas": "^1.4.0",
40
42
  "@salesforce/ts-types": "^1.7.2",
41
43
  "@types/graceful-fs": "^4.1.5",
@@ -54,7 +56,7 @@
54
56
  },
55
57
  "devDependencies": {
56
58
  "@salesforce/dev-config": "^3.0.1",
57
- "@salesforce/dev-scripts": "^3.1.0",
59
+ "@salesforce/dev-scripts": "^4.0.0-beta.7",
58
60
  "@salesforce/prettier-config": "^0.0.2",
59
61
  "@salesforce/ts-sinon": "^1.4.4",
60
62
  "@types/archiver": "^5.3.1",
@@ -86,7 +88,9 @@
86
88
  "shelljs": "0.8.5",
87
89
  "sinon": "^14.0.2",
88
90
  "ts-node": "^10.4.0",
89
- "typescript": "^4.9.4"
91
+ "ttypescript": "^1.5.15",
92
+ "typescript": "^4.9.4",
93
+ "wireit": "^0.9.3"
90
94
  },
91
95
  "repository": {
92
96
  "type": "git",
@@ -94,5 +98,65 @@
94
98
  },
95
99
  "publishConfig": {
96
100
  "access": "public"
101
+ },
102
+ "wireit": {
103
+ "build": {
104
+ "dependencies": [
105
+ "compile",
106
+ "lint"
107
+ ]
108
+ },
109
+ "compile": {
110
+ "command": "ttsc -p . --pretty --incremental",
111
+ "files": [
112
+ "src/**/*.ts",
113
+ "tsconfig.json",
114
+ "messages",
115
+ "messageTransformer"
116
+ ],
117
+ "output": [
118
+ "lib/**",
119
+ "*.tsbuildinfo"
120
+ ],
121
+ "clean": "if-file-deleted"
122
+ },
123
+ "format": {
124
+ "command": "prettier --write \"+(src|test|schemas)/**/*.+(ts|js|json)|command-snapshot.json\""
125
+ },
126
+ "lint": {
127
+ "command": "eslint --color --cache --cache-location .eslintcache",
128
+ "files": [
129
+ "src/**/*.ts",
130
+ "test/**/*.ts",
131
+ ".eslintignore",
132
+ ".eslintrc.js"
133
+ ],
134
+ "output": []
135
+ },
136
+ "test:compile": {
137
+ "command": "tsc -p \"./test\" --pretty",
138
+ "files": [
139
+ "test/**/*.ts",
140
+ "tsconfig.json",
141
+ "test/tsconfig.json"
142
+ ],
143
+ "output": []
144
+ },
145
+ "test:only": {
146
+ "command": "nyc mocha \"test/**/*Test.ts\"",
147
+ "files": [
148
+ "test/**/*.ts",
149
+ "src/**/*.ts",
150
+ "tsconfig.json",
151
+ "test/tsconfig.json"
152
+ ],
153
+ "output": []
154
+ },
155
+ "test": {
156
+ "dependencies": [
157
+ "test:only",
158
+ "test:compile"
159
+ ]
160
+ }
97
161
  }
98
162
  }