@salesforce/core 8.8.5 → 8.8.7

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.
@@ -21,35 +21,39 @@ const messages = new messages_1.Messages('@salesforce/core', 'encryption', new M
21
21
  */
22
22
  const retrieveKeychain = async (platform) => {
23
23
  const logger = await logger_1.Logger.child('keyChain');
24
- logger.debug(`platform: ${platform}`);
25
24
  const useGenericUnixKeychainVar = kit_1.env.getBoolean('SF_USE_GENERIC_UNIX_KEYCHAIN');
26
- const shouldUseGenericUnixKeychain = useGenericUnixKeychainVar && useGenericUnixKeychainVar;
27
25
  if (platform.startsWith('win')) {
26
+ logger.debug(`platform: ${platform}. Using generic Windows keychain.`);
28
27
  return keyChainImpl_1.keyChainImpl.generic_windows;
29
28
  }
30
29
  else if (platform.includes('darwin')) {
31
30
  // OSX can use the generic keychain. This is useful when running under an
32
31
  // automation user.
33
- if (shouldUseGenericUnixKeychain) {
32
+ if (useGenericUnixKeychainVar) {
33
+ logger.debug(`platform: ${platform}. Using generic Unix keychain.`);
34
34
  return keyChainImpl_1.keyChainImpl.generic_unix;
35
35
  }
36
36
  else {
37
+ logger.debug(`platform: ${platform}. Using Darwin native keychain.`);
37
38
  return keyChainImpl_1.keyChainImpl.darwin;
38
39
  }
39
40
  }
40
41
  else if (platform.includes('linux')) {
41
42
  // Use the generic keychain if specified
42
- if (shouldUseGenericUnixKeychain) {
43
+ if (useGenericUnixKeychainVar) {
44
+ logger.debug(`platform: ${platform}. Using generic Unix keychain.`);
43
45
  return keyChainImpl_1.keyChainImpl.generic_unix;
44
46
  }
45
47
  else {
46
48
  // otherwise try and use the builtin keychain
47
49
  try {
50
+ logger.debug(`platform: ${platform}. Using Linux keychain.`);
48
51
  await keyChainImpl_1.keyChainImpl.linux.validateProgram();
49
52
  return keyChainImpl_1.keyChainImpl.linux;
50
53
  }
51
54
  catch (e) {
52
55
  // If the builtin keychain is not available use generic
56
+ logger.debug(`platform: ${platform}. Using generic Unix keychain.`);
53
57
  return keyChainImpl_1.keyChainImpl.generic_unix;
54
58
  }
55
59
  }
@@ -39,6 +39,7 @@ const global_1 = require("../../global");
39
39
  const logger_1 = require("../../logger/logger");
40
40
  const messages_1 = require("../../messages");
41
41
  const lifecycleEvents_1 = require("../../lifecycleEvents");
42
+ const sfError_1 = require("../../sfError");
42
43
  function chunk(array, chunkSize) {
43
44
  const final = [];
44
45
  for (let i = 0, len = array.length; i < len; i += chunkSize)
@@ -64,9 +65,11 @@ class BaseOrgAccessor extends kit_1.AsyncOptionalCreatable {
64
65
  return this.get(username, decrypt);
65
66
  }
66
67
  catch (err) {
67
- if (err instanceof Error && err.name === 'JsonParseError') {
68
+ const error = sfError_1.SfError.wrap(err);
69
+ if (['JsonParseError', 'GenericKeychainInvalidPermsError'].includes(error.name)) {
68
70
  throw err;
69
71
  }
72
+ this.logger.debug(`Error when reading auth file for user: ${username} due to: ${error.name}:${error.message}`);
70
73
  return null;
71
74
  }
72
75
  }
@@ -85,7 +88,13 @@ class BaseOrgAccessor extends kit_1.AsyncOptionalCreatable {
85
88
  this.configs.set(username, config);
86
89
  }
87
90
  catch (e) {
88
- await lifecycleEvents_1.Lifecycle.getInstance().emitWarning(`The auth file for ${username} is invalid.`);
91
+ const error = sfError_1.SfError.wrap(e);
92
+ let warningMsg = `The auth file for ${username} is invalid.`;
93
+ if (error.message) {
94
+ warningMsg += ` Due to: ${error.message}`;
95
+ }
96
+ await lifecycleEvents_1.Lifecycle.getInstance().emitWarning(warningMsg);
97
+ this.logger.debug(`Error when reading auth file for user: ${username} due to: ${error.name}:${error.message}`);
89
98
  }
90
99
  });
91
100
  // eslint-disable-next-line no-await-in-loop
@@ -222,10 +231,14 @@ class BaseOrgAccessor extends kit_1.AsyncOptionalCreatable {
222
231
  else {
223
232
  const contents = this.contents.get(username) ?? {};
224
233
  await this.read(username, false, false);
225
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
226
234
  const readConfig = this.configs.get(username);
227
- readConfig.setContentsFromObject(contents);
228
- return (await readConfig.write());
235
+ if (readConfig) {
236
+ readConfig.setContentsFromObject(contents);
237
+ return (await readConfig.write());
238
+ }
239
+ else {
240
+ this.logger.debug(`Failed to write auth file for ${username}. readConfig not found.`);
241
+ }
229
242
  }
230
243
  }
231
244
  async init() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/core",
3
- "version": "8.8.5",
3
+ "version": "8.8.7",
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",
@@ -53,7 +53,7 @@
53
53
  "messageTransformer/messageTransformer.ts"
54
54
  ],
55
55
  "dependencies": {
56
- "@jsforce/jsforce-node": "^3.6.5",
56
+ "@jsforce/jsforce-node": "^3.7.0",
57
57
  "@salesforce/kit": "^3.2.2",
58
58
  "@salesforce/schemas": "^1.9.0",
59
59
  "@salesforce/ts-types": "^2.0.10",