@salesforce/core 3.19.6-dev.0 → 3.20.2

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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,25 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [3.20.2](https://github.com/forcedotcom/sfdx-core/compare/v3.20.1...v3.20.2) (2022-06-13)
6
+
7
+ ### Bug Fixes
8
+
9
+ - instanceUrl config now using org-instance-url ([54cb450](https://github.com/forcedotcom/sfdx-core/commit/54cb450c53f3db5352d9f0fdb83d33dce1da728e))
10
+
11
+ ### [3.20.1](https://github.com/forcedotcom/sfdx-core/compare/v3.19.5...v3.20.1) (2022-06-08)
12
+
13
+ ### Features
14
+
15
+ - cause a publish from previous skip ([069c366](https://github.com/forcedotcom/sfdx-core/commit/069c36646f5dc10a4172868ef7b5f9cd82ef7503))
16
+ - safer caching for nuts ([fa0af41](https://github.com/forcedotcom/sfdx-core/commit/fa0af41451a4363c84e9713685c8ece439acf3bc))
17
+
18
+ ## [3.20.0](https://github.com/forcedotcom/sfdx-core/compare/v3.19.6-dev.0...v3.20.0) (2022-06-08)
19
+
20
+ ### Features
21
+
22
+ - cache crypto keys by homedir ([dcd493e](https://github.com/forcedotcom/sfdx-core/commit/dcd493e7745bb2717da3a4ed9aff528a51391be6))
23
+
5
24
  ### [3.19.6-dev.0](https://github.com/forcedotcom/sfdx-core/compare/v3.19.5...v3.19.6-dev.0) (2022-06-07)
6
25
 
7
26
  ### Features
@@ -16,6 +16,7 @@ const kit_1 = require("@salesforce/kit");
16
16
  const logger_1 = require("../logger");
17
17
  const messages_1 = require("../messages");
18
18
  const cache_1 = require("../util/cache");
19
+ const global_1 = require("../global");
19
20
  const keyChain_1 = require("./keyChain");
20
21
  const secureBuffer_1 = require("./secureBuffer");
21
22
  const TAG_DELIMITER = ':';
@@ -49,20 +50,21 @@ const keychainPromises = {
49
50
  * @param account The keychain account name.
50
51
  */
51
52
  getPassword(_keychain, service, account) {
52
- const sb = cache_1.Cache.get(`${service}:${account}`);
53
+ const cacheKey = `${global_1.Global.DIR}:${service}:${account}`;
54
+ const sb = cache_1.Cache.get(cacheKey);
53
55
  if (!sb) {
54
56
  return new Promise((resolve, reject) => {
55
57
  return _keychain.getPassword({ service, account }, (err, password) => {
56
58
  if (err)
57
59
  return reject(err);
58
- cache_1.Cache.set(`${service}:${account}`, makeSecureBuffer(password));
60
+ cache_1.Cache.set(cacheKey, makeSecureBuffer(password));
59
61
  return resolve({ username: account, password: (0, ts_types_1.ensure)(password) });
60
62
  });
61
63
  });
62
64
  }
63
65
  else {
64
66
  const pw = sb.value((buffer) => buffer.toString('utf8'));
65
- cache_1.Cache.set(`${service}:${account}`, makeSecureBuffer(pw));
67
+ cache_1.Cache.set(cacheKey, makeSecureBuffer(pw));
66
68
  return new Promise((resolve) => {
67
69
  return resolve({ username: account, password: (0, ts_types_1.ensure)(pw) });
68
70
  });
@@ -317,6 +317,7 @@ const _darwinImpl = {
317
317
  }
318
318
  },
319
319
  };
320
+ const getSecretFile = () => path.join(global_1.Global.DIR, 'key.json');
320
321
  var SecretField;
321
322
  (function (SecretField) {
322
323
  SecretField["SERVICE"] = "service";
@@ -330,7 +331,7 @@ async function _writeFile(opts, fn) {
330
331
  [SecretField.KEY]: opts.password,
331
332
  [SecretField.SERVICE]: opts.service,
332
333
  };
333
- const secretFile = path.join(global_1.Global.DIR, 'key.json');
334
+ const secretFile = getSecretFile();
334
335
  await mkdirp(path.dirname(secretFile));
335
336
  await fs.promises.writeFile(secretFile, JSON.stringify(contents, null, 4), { mode: '600' });
336
337
  fn(null, contents);
@@ -341,7 +342,7 @@ async function _writeFile(opts, fn) {
341
342
  }
342
343
  async function _readFile() {
343
344
  // The file and access is validated before this method is called
344
- const fileContents = (0, kit_1.parseJsonMap)(await fs.promises.readFile(path.join(global_1.Global.DIR, 'key.json'), 'utf8'));
345
+ const fileContents = (0, kit_1.parseJsonMap)(await fs.promises.readFile(getSecretFile(), 'utf8'));
345
346
  return {
346
347
  account: (0, ts_types_1.ensureString)(fileContents[SecretField.ACCOUNT]),
347
348
  password: (0, ts_types_1.asString)(fileContents[SecretField.KEY]),
@@ -368,7 +369,7 @@ class GenericKeychainAccess {
368
369
  else {
369
370
  // if the service and account names don't match then maybe someone or something is editing
370
371
  // that file. #donotallow
371
- fn(messages.createError('genericKeychainServiceError', [path.join(global_1.Global.DIR, 'key.json')]));
372
+ fn(messages.createError('genericKeychainServiceError', [getSecretFile()]));
372
373
  }
373
374
  }
374
375
  catch (readJsonErr) {
@@ -428,7 +429,7 @@ class GenericUnixKeychainAccess extends GenericKeychainAccess {
428
429
  await cb(err);
429
430
  }
430
431
  else {
431
- const secretFile = path.join(global_1.Global.DIR, 'key.json');
432
+ const secretFile = getSecretFile();
432
433
  const stats = await fs.promises.stat(secretFile);
433
434
  const octalModeStr = (stats.mode & 0o777).toString(8);
434
435
  const EXPECTED_OCTAL_PERM_VALUE = '600';
@@ -454,7 +455,7 @@ class GenericWindowsKeychainAccess extends GenericKeychainAccess {
454
455
  }
455
456
  else {
456
457
  try {
457
- await fs.promises.access(path.join(global_1.Global.DIR, 'key.json'), fs.constants.R_OK | fs.constants.W_OK);
458
+ await fs.promises.access(getSecretFile(), fs.constants.R_OK | fs.constants.W_OK);
458
459
  await cb(null);
459
460
  }
460
461
  catch (e) {
package/lib/global.d.ts CHANGED
@@ -45,7 +45,7 @@ export declare class Global {
45
45
  */
46
46
  static get SF_DIR(): string;
47
47
  /**
48
- * The full system path to the preferred global state folder
48
+ * The full system path to the preferred global state folder
49
49
  */
50
50
  static get DIR(): string;
51
51
  /**
@@ -53,7 +53,7 @@ export declare class Global {
53
53
  */
54
54
  static readonly LOG_FILE_PATH: string;
55
55
  /**
56
- * Gets the curr ent mode environment variable as a {@link Mode} instance.
56
+ * Gets the current mode environment variable as a {@link Mode} instance.
57
57
  *
58
58
  * ```
59
59
  * console.log(Global.getEnvironmentMode() === Mode.PRODUCTION);
package/lib/global.js CHANGED
@@ -45,13 +45,13 @@ class Global {
45
45
  return path.join(os.homedir(), Global.SF_STATE_FOLDER);
46
46
  }
47
47
  /**
48
- * The full system path to the preferred global state folder
48
+ * The full system path to the preferred global state folder
49
49
  */
50
50
  static get DIR() {
51
51
  return path.join(os.homedir(), Global.SFDX_STATE_FOLDER);
52
52
  }
53
53
  /**
54
- * Gets the curr ent mode environment variable as a {@link Mode} instance.
54
+ * Gets the current mode environment variable as a {@link Mode} instance.
55
55
  *
56
56
  * ```
57
57
  * console.log(Global.getEnvironmentMode() === Mode.PRODUCTION);
@@ -562,7 +562,8 @@ class AuthInfo extends kit_1.AsyncOptionalCreatable {
562
562
  }
563
563
  }
564
564
  getInstanceUrl(options, aggregator) {
565
- const instanceUrl = (0, ts_types_1.getString)(options, 'instanceUrl') || aggregator.getPropertyValue('instanceUrl');
565
+ const instanceUrl = (0, ts_types_1.getString)(options, 'instanceUrl') ||
566
+ aggregator.getPropertyValue(orgConfigProperties_1.OrgConfigProperties.ORG_INSTANCE_URL);
566
567
  return instanceUrl || sfdcUrl_1.SfdcUrl.PRODUCTION;
567
568
  }
568
569
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/core",
3
- "version": "3.19.6-dev.0",
3
+ "version": "3.20.2",
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",