@salesforce/core-bundle 8.8.4 → 8.8.6

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.
Files changed (2) hide show
  1. package/lib/index.js +27 -10
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -12310,7 +12310,7 @@ var require_package2 = __commonJS({
12310
12310
  "package.json"(exports2, module2) {
12311
12311
  module2.exports = {
12312
12312
  name: "@salesforce/core-bundle",
12313
- version: "8.8.4",
12313
+ version: "8.8.6",
12314
12314
  description: "Core libraries to interact with SFDX projects, orgs, and APIs.",
12315
12315
  main: "lib/index",
12316
12316
  types: "lib/index.d.ts",
@@ -13148,25 +13148,29 @@ var require_keyChain = __commonJS({
13148
13148
  var messages = new messages_12.Messages("@salesforce/core-bundle", "encryption", /* @__PURE__ */ 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: %s"], ["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."], ["v1CryptoWithV2KeyWarning", 'The SF_CRYPTO_V2 environment variable was set to "false" but a v2 crypto key was detected. v1 crypto can only be used with a v1 key. Unset the SF_CRYPTO_V2 environment variable.'], ["v2CryptoWithV1KeyWarning", 'SF_CRYPTO_V2 was set to "true" but a v1 crypto key was detected. v2 crypto can only be used with a v2 key. To generate a v2 key:\n\n1. Logout of all orgs: `sf org logout --all`\n2. Delete the sfdx keychain entry (account: local, service: sfdx). If `SF_USE_GENERIC_UNIX_KEYCHAIN=true` env var is set, you can delete the `key.json` file.\n3. Set `SF_CRYPTO_V2=true` env var.\n4. Re-Authenticate with your orgs using the CLI org login commands.']]));
13149
13149
  var retrieveKeychain = async (platform) => {
13150
13150
  const logger = await logger_12.Logger.child("keyChain");
13151
- logger.debug(`platform: ${platform}`);
13152
13151
  const useGenericUnixKeychainVar = kit_1.env.getBoolean("SF_USE_GENERIC_UNIX_KEYCHAIN");
13153
- const shouldUseGenericUnixKeychain = useGenericUnixKeychainVar && useGenericUnixKeychainVar;
13154
13152
  if (platform.startsWith("win")) {
13153
+ logger.debug(`platform: ${platform}. Using generic Windows keychain.`);
13155
13154
  return keyChainImpl_1.keyChainImpl.generic_windows;
13156
13155
  } else if (platform.includes("darwin")) {
13157
- if (shouldUseGenericUnixKeychain) {
13156
+ if (useGenericUnixKeychainVar) {
13157
+ logger.debug(`platform: ${platform}. Using generic Unix keychain.`);
13158
13158
  return keyChainImpl_1.keyChainImpl.generic_unix;
13159
13159
  } else {
13160
+ logger.debug(`platform: ${platform}. Using Darwin native keychain.`);
13160
13161
  return keyChainImpl_1.keyChainImpl.darwin;
13161
13162
  }
13162
13163
  } else if (platform.includes("linux")) {
13163
- if (shouldUseGenericUnixKeychain) {
13164
+ if (useGenericUnixKeychainVar) {
13165
+ logger.debug(`platform: ${platform}. Using generic Unix keychain.`);
13164
13166
  return keyChainImpl_1.keyChainImpl.generic_unix;
13165
13167
  } else {
13166
13168
  try {
13169
+ logger.debug(`platform: ${platform}. Using Linux keychain.`);
13167
13170
  await keyChainImpl_1.keyChainImpl.linux.validateProgram();
13168
13171
  return keyChainImpl_1.keyChainImpl.linux;
13169
13172
  } catch (e) {
13173
+ logger.debug(`platform: ${platform}. Using generic Unix keychain.`);
13170
13174
  return keyChainImpl_1.keyChainImpl.generic_unix;
13171
13175
  }
13172
13176
  }
@@ -15927,7 +15931,7 @@ var require_aliasAccessor = __commonJS({
15927
15931
  try {
15928
15932
  this.aliasStore = fileContentsRawToAliasStore(await (0, promises_1.readFile)(this.fileLocation, "utf-8"));
15929
15933
  } catch (e) {
15930
- if (e instanceof Error && "code" in e && e.code === "ENOENT") {
15934
+ if (e instanceof Error && "code" in e && typeof e.code === "string" && ["ENOENT", "ENOTDIR"].includes(e.code)) {
15931
15935
  this.aliasStore = /* @__PURE__ */ new Map();
15932
15936
  await (0, promises_1.mkdir)((0, node_path_1.dirname)(this.fileLocation), { recursive: true });
15933
15937
  await this.saveAliasStoreToFile();
@@ -16042,6 +16046,7 @@ var require_orgAccessor = __commonJS({
16042
16046
  var logger_12 = require_logger();
16043
16047
  var messages_12 = require_messages();
16044
16048
  var lifecycleEvents_12 = require_lifecycleEvents();
16049
+ var sfError_12 = require_sfError();
16045
16050
  function chunk(array, chunkSize) {
16046
16051
  const final = [];
16047
16052
  for (let i = 0, len = array.length; i < len; i += chunkSize)
@@ -16066,9 +16071,11 @@ var require_orgAccessor = __commonJS({
16066
16071
  this.configs.set(username, config);
16067
16072
  return this.get(username, decrypt);
16068
16073
  } catch (err) {
16069
- if (err instanceof Error && err.name === "JsonParseError") {
16074
+ const error = sfError_12.SfError.wrap(err);
16075
+ if (["JsonParseError", "GenericKeychainInvalidPermsError"].includes(error.name)) {
16070
16076
  throw err;
16071
16077
  }
16078
+ this.logger.debug(`Error when reading auth file for user: ${username} due to: ${error.name}:${error.message}`);
16072
16079
  return null;
16073
16080
  }
16074
16081
  }
@@ -16086,7 +16093,13 @@ var require_orgAccessor = __commonJS({
16086
16093
  const config = await this.initAuthFile(username);
16087
16094
  this.configs.set(username, config);
16088
16095
  } catch (e) {
16089
- await lifecycleEvents_12.Lifecycle.getInstance().emitWarning(`The auth file for ${username} is invalid.`);
16096
+ const error = sfError_12.SfError.wrap(e);
16097
+ let warningMsg = `The auth file for ${username} is invalid.`;
16098
+ if (error.message) {
16099
+ warningMsg += ` Due to: ${error.message}`;
16100
+ }
16101
+ await lifecycleEvents_12.Lifecycle.getInstance().emitWarning(warningMsg);
16102
+ this.logger.debug(`Error when reading auth file for user: ${username} due to: ${error.name}:${error.message}`);
16090
16103
  }
16091
16104
  });
16092
16105
  await Promise.all(promises);
@@ -16220,8 +16233,12 @@ var require_orgAccessor = __commonJS({
16220
16233
  const contents = this.contents.get(username) ?? {};
16221
16234
  await this.read(username, false, false);
16222
16235
  const readConfig = this.configs.get(username);
16223
- readConfig.setContentsFromObject(contents);
16224
- return await readConfig.write();
16236
+ if (readConfig) {
16237
+ readConfig.setContentsFromObject(contents);
16238
+ return await readConfig.write();
16239
+ } else {
16240
+ this.logger.debug(`Failed to write auth file for ${username}. readConfig not found.`);
16241
+ }
16225
16242
  }
16226
16243
  }
16227
16244
  async init() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/core-bundle",
3
- "version": "8.8.4",
3
+ "version": "8.8.6",
4
4
  "description": "Core libraries to interact with SFDX projects, orgs, and APIs.",
5
5
  "main": "lib/index",
6
6
  "types": "lib/index.d.ts",