@salesforce/core 3.7.3 → 3.7.4

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,12 @@
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.7.4](https://github.com/forcedotcom/sfdx-core/compare/v3.7.3...v3.7.4) (2022-02-07)
6
+
7
+ ### Bug Fixes
8
+
9
+ - pin ts to 4.4.4 and bump other deps ([#509](https://github.com/forcedotcom/sfdx-core/issues/509)) ([1c0e15c](https://github.com/forcedotcom/sfdx-core/commit/1c0e15cd9a96f03e24476c13d73b62577a535fa3))
10
+
5
11
  ### [3.7.3](https://github.com/forcedotcom/sfdx-core/compare/v3.7.2...v3.7.3) (2021-12-16)
6
12
 
7
13
  ### [3.7.2](https://github.com/forcedotcom/sfdx-core/compare/v3.7.1...v3.7.2) (2021-10-28)
package/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2021, Salesforce.com, Inc.
1
+ Copyright (c) 2022, Salesforce.com, Inc.
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
@@ -97,7 +97,7 @@ exports.SFDX_ALLOWED_PROPERTIES = [
97
97
  return true;
98
98
  // validate if the value is a string and is a valid url and is either a salesforce domain
99
99
  // or an internal url.
100
- return (ts_types_1.isString(value) &&
100
+ return ((0, ts_types_1.isString)(value) &&
101
101
  sfdcUrl_1.SfdcUrl.isValidUrl(value) &&
102
102
  (new sfdcUrl_1.SfdcUrl(value).isSalesforceDomain() || new sfdcUrl_1.SfdcUrl(value).isInternalUrl()));
103
103
  },
@@ -110,7 +110,7 @@ exports.SFDX_ALLOWED_PROPERTIES = [
110
110
  hidden: true,
111
111
  input: {
112
112
  // If a value is provided validate it otherwise no value is unset.
113
- validator: (value) => value == null || (ts_types_1.isString(value) && sfdc_1.sfdc.validateApiVersion(value)),
113
+ validator: (value) => value == null || ((0, ts_types_1.isString)(value) && sfdc_1.sfdc.validateApiVersion(value)),
114
114
  failedMessage: messages.getMessage('invalidApiVersion'),
115
115
  },
116
116
  },
@@ -132,7 +132,7 @@ exports.SFDX_ALLOWED_PROPERTIES = [
132
132
  encrypted: true,
133
133
  input: {
134
134
  // If a value is provided validate it otherwise no value is unset.
135
- validator: (value) => value == null || ts_types_1.isString(value),
135
+ validator: (value) => value == null || (0, ts_types_1.isString)(value),
136
136
  failedMessage: messages.getMessage('invalidIsvDebuggerSid'),
137
137
  },
138
138
  },
@@ -141,7 +141,7 @@ exports.SFDX_ALLOWED_PROPERTIES = [
141
141
  description: messages.getMessage(SfdxPropertyKeys.ISV_DEBUGGER_URL),
142
142
  input: {
143
143
  // If a value is provided validate it otherwise no value is unset.
144
- validator: (value) => value == null || ts_types_1.isString(value),
144
+ validator: (value) => value == null || (0, ts_types_1.isString)(value),
145
145
  failedMessage: messages.getMessage('invalidIsvDebuggerUrl'),
146
146
  },
147
147
  },
@@ -247,7 +247,7 @@ class Config extends configFile_1.ConfigFile {
247
247
  delete content[propertyName];
248
248
  }
249
249
  else {
250
- kit_1.set(content, propertyName, value);
250
+ (0, kit_1.set)(content, propertyName, value);
251
251
  }
252
252
  return config.write(content);
253
253
  }
@@ -263,7 +263,7 @@ class Config extends configFile_1.ConfigFile {
263
263
  await localConfig.write();
264
264
  }
265
265
  static propertyConfigMap() {
266
- return kit_1.keyBy(Config.allowedProperties, 'key');
266
+ return (0, kit_1.keyBy)(Config.allowedProperties, 'key');
267
267
  }
268
268
  /**
269
269
  * Read, assign, and return the config contents.
@@ -340,7 +340,7 @@ class Config extends configFile_1.ConfigFile {
340
340
  else {
341
341
  let valueError = (value === null || value === void 0 ? void 0 : value.toString()) || '';
342
342
  if (property.input.failedMessage) {
343
- valueError = ts_types_1.isString(property.input.failedMessage)
343
+ valueError = (0, ts_types_1.isString)(property.input.failedMessage)
344
344
  ? property.input.failedMessage
345
345
  : property.input.failedMessage(value);
346
346
  }
@@ -403,10 +403,10 @@ class Config extends configFile_1.ConfigFile {
403
403
  });
404
404
  if (hasEncryptedProperties) {
405
405
  await this.initCrypto();
406
- const crypto = ts_types_1.ensure(this.crypto);
406
+ const crypto = (0, ts_types_1.ensure)(this.crypto);
407
407
  this.forEach((key, value) => {
408
- if (this.getPropertyConfig(key).encrypted && ts_types_1.isString(value)) {
409
- this.set(key, ts_types_1.ensure(encrypt ? crypto.encrypt(value) : crypto.decrypt(value)));
408
+ if (this.getPropertyConfig(key).encrypted && (0, ts_types_1.isString)(value)) {
409
+ this.set(key, (0, ts_types_1.ensure)(encrypt ? crypto.encrypt(value) : crypto.decrypt(value)));
410
410
  }
411
411
  });
412
412
  }
@@ -457,7 +457,7 @@ class SfdxConfig {
457
457
  async writeSync(config = this.config.toObject()) {
458
458
  try {
459
459
  const sfdxPath = this.getSfdxPath();
460
- await fs_1.fs.mkdirp(path_1.dirname(sfdxPath));
460
+ await fs_1.fs.mkdirp((0, path_1.dirname)(sfdxPath));
461
461
  const mapped = this.normalize(config, 'toOld');
462
462
  await fs_1.fs.writeJson(sfdxPath, mapped);
463
463
  }
@@ -469,16 +469,16 @@ class SfdxConfig {
469
469
  if (!this.sfdxPath) {
470
470
  const stateFolder = global_1.Global.SFDX_STATE_FOLDER;
471
471
  const fileName = SFDX_CONFIG_FILE_NAME;
472
- const _isGlobal = ts_types_1.isBoolean(this.options.isGlobal) && this.options.isGlobal;
473
- const _isState = ts_types_1.isBoolean(this.options.isState) && this.options.isState;
472
+ const _isGlobal = (0, ts_types_1.isBoolean)(this.options.isGlobal) && this.options.isGlobal;
473
+ const _isState = (0, ts_types_1.isBoolean)(this.options.isState) && this.options.isState;
474
474
  // Don't let users store config files in homedir without being in the state folder.
475
475
  let configRootFolder = this.options.rootFolder
476
476
  ? this.options.rootFolder
477
477
  : configFile_1.ConfigFile.resolveRootFolderSync(!!this.options.isGlobal);
478
478
  if (_isGlobal || _isState) {
479
- configRootFolder = path_1.join(configRootFolder, stateFolder);
479
+ configRootFolder = (0, path_1.join)(configRootFolder, stateFolder);
480
480
  }
481
- this.sfdxPath = path_1.join(configRootFolder, fileName);
481
+ this.sfdxPath = (0, path_1.join)(configRootFolder, fileName);
482
482
  }
483
483
  return this.sfdxPath;
484
484
  }
@@ -15,7 +15,7 @@ const envVars_1 = require("./envVars");
15
15
  const config_1 = require("./config");
16
16
  messages_1.Messages.importMessagesDirectory(__dirname);
17
17
  const messages = messages_1.Messages.load('@salesforce/core', 'config', ['unknownConfigKey', 'deprecatedConfigKey']);
18
- const propertyToEnvName = (property, prefix = 'SFDX_') => `${prefix || ''}${change_case_1.snakeCase(property).toUpperCase()}`;
18
+ const propertyToEnvName = (property, prefix = 'SFDX_') => `${prefix || ''}${(0, change_case_1.snakeCase)(property).toUpperCase()}`;
19
19
  /**
20
20
  * Aggregate global and local project config files, as well as environment variables for
21
21
  * `sfdx-config.json`. The resolution happens in the following bottom-up order:
@@ -214,7 +214,7 @@ class ConfigAggregator extends kit_1.AsyncOptionalCreatable {
214
214
  .filter((key) => this.getAllowedProperties().some((element) => key === element.key))
215
215
  .map((key) => this.getInfo(key))
216
216
  .filter((info) => !!info);
217
- return kit_1.sortBy(infos, 'key');
217
+ return (0, kit_1.sortBy)(infos, 'key');
218
218
  }
219
219
  /**
220
220
  * Get the local project config instance.
@@ -251,7 +251,7 @@ class ConfigAggregator extends kit_1.AsyncOptionalCreatable {
251
251
  * Add an allowed config property.
252
252
  */
253
253
  addAllowedProperties(configMetas) {
254
- if (ts_types_1.isArray(configMetas)) {
254
+ if ((0, ts_types_1.isArray)(configMetas)) {
255
255
  this.allowedProperties.push(...configMetas);
256
256
  }
257
257
  else {
@@ -285,7 +285,7 @@ class ConfigAggregator extends kit_1.AsyncOptionalCreatable {
285
285
  }
286
286
  configs.push(this.envVars.asDictionary());
287
287
  const json = {};
288
- const reduced = configs.filter(ts_types_1.isJsonMap).reduce((acc, el) => kit_1.merge(acc, el), json);
288
+ const reduced = configs.filter(ts_types_1.isJsonMap).reduce((acc, el) => (0, kit_1.merge)(acc, el), json);
289
289
  return reduced;
290
290
  }
291
291
  /**
@@ -87,7 +87,7 @@ class ConfigFile extends configStore_1.BaseConfigStore {
87
87
  * @param isGlobal True if the config should be global. False for local.
88
88
  */
89
89
  static async resolveRootFolder(isGlobal) {
90
- return isGlobal ? os_1.homedir() : await internal_1.resolveProjectPath();
90
+ return isGlobal ? (0, os_1.homedir)() : await (0, internal_1.resolveProjectPath)();
91
91
  }
92
92
  /**
93
93
  * Helper used to determine what the local and global folder point to. Returns the file path of the root folder.
@@ -95,7 +95,7 @@ class ConfigFile extends configStore_1.BaseConfigStore {
95
95
  * @param isGlobal True if the config should be global. False for local.
96
96
  */
97
97
  static resolveRootFolderSync(isGlobal) {
98
- return isGlobal ? os_1.homedir() : internal_1.resolveProjectPathSync();
98
+ return isGlobal ? (0, os_1.homedir)() : (0, internal_1.resolveProjectPathSync)();
99
99
  }
100
100
  /**
101
101
  * Determines if the config file is read/write accessible. Returns `true` if the user has capabilities specified
@@ -211,7 +211,7 @@ class ConfigFile extends configStore_1.BaseConfigStore {
211
211
  if (newContents) {
212
212
  this.setContents(newContents);
213
213
  }
214
- await fs_2.fs.mkdirp(path_1.dirname(this.getPath()));
214
+ await fs_2.fs.mkdirp((0, path_1.dirname)(this.getPath()));
215
215
  this.logger.info(`Writing to config file: ${this.getPath()}`);
216
216
  await fs_2.fs.writeJson(this.getPath(), this.toObject());
217
217
  return this.getContents();
@@ -223,10 +223,10 @@ class ConfigFile extends configStore_1.BaseConfigStore {
223
223
  * @param newContents The new contents of the file.
224
224
  */
225
225
  writeSync(newContents) {
226
- if (ts_types_1.isPlainObject(newContents)) {
226
+ if ((0, ts_types_1.isPlainObject)(newContents)) {
227
227
  this.setContents(newContents);
228
228
  }
229
- fs_2.fs.mkdirpSync(path_1.dirname(this.getPath()));
229
+ fs_2.fs.mkdirpSync((0, path_1.dirname)(this.getPath()));
230
230
  this.logger.info(`Writing to config file: ${this.getPath()}`);
231
231
  fs_2.fs.writeJsonSync(this.getPath(), this.toObject());
232
232
  return this.getContents();
@@ -297,16 +297,16 @@ class ConfigFile extends configStore_1.BaseConfigStore {
297
297
  if (!this.options.filename) {
298
298
  throw new sfdxError_1.SfdxError('The ConfigOptions filename parameter is invalid.', 'InvalidParameter');
299
299
  }
300
- const _isGlobal = ts_types_1.isBoolean(this.options.isGlobal) && this.options.isGlobal;
301
- const _isState = ts_types_1.isBoolean(this.options.isState) && this.options.isState;
300
+ const _isGlobal = (0, ts_types_1.isBoolean)(this.options.isGlobal) && this.options.isGlobal;
301
+ const _isState = (0, ts_types_1.isBoolean)(this.options.isState) && this.options.isState;
302
302
  // Don't let users store config files in homedir without being in the state folder.
303
303
  let configRootFolder = this.options.rootFolder
304
304
  ? this.options.rootFolder
305
305
  : ConfigFile.resolveRootFolderSync(!!this.options.isGlobal);
306
306
  if (_isGlobal || _isState) {
307
- configRootFolder = path_1.join(configRootFolder, this.options.stateFolder || global_1.Global.SFDX_STATE_FOLDER);
307
+ configRootFolder = (0, path_1.join)(configRootFolder, this.options.stateFolder || global_1.Global.SFDX_STATE_FOLDER);
308
308
  }
309
- this.path = path_1.join(configRootFolder, this.options.filePath ? this.options.filePath : '', this.options.filename);
309
+ this.path = (0, path_1.join)(configRootFolder, this.options.filePath ? this.options.filePath : '', this.options.filename);
310
310
  }
311
311
  return this.path;
312
312
  }
@@ -35,14 +35,14 @@ class BaseConfigStore extends kit_1.AsyncOptionalCreatable {
35
35
  * Returns an array of {@link ConfigEntry} for each element in the config.
36
36
  */
37
37
  entries() {
38
- return ts_types_2.definiteEntriesOf(this.contents);
38
+ return (0, ts_types_2.definiteEntriesOf)(this.contents);
39
39
  }
40
40
  get(key, decrypt = false) {
41
41
  const k = key;
42
42
  let value = this.getMethod(this.contents, k);
43
43
  if (this.hasEncryption() && decrypt) {
44
- if (ts_types_2.isJsonMap(value)) {
45
- value = this.recursiveDecrypt(kit_1.cloneJson(value), k);
44
+ if ((0, ts_types_2.isJsonMap)(value)) {
45
+ value = this.recursiveDecrypt((0, kit_1.cloneJson)(value), k);
46
46
  }
47
47
  else if (this.isCryptoKey(k)) {
48
48
  value = this.decrypt(value);
@@ -76,7 +76,7 @@ class BaseConfigStore extends kit_1.AsyncOptionalCreatable {
76
76
  }
77
77
  set(key, value) {
78
78
  if (this.hasEncryption()) {
79
- if (ts_types_2.isJsonMap(value)) {
79
+ if ((0, ts_types_2.isJsonMap)(value)) {
80
80
  value = this.recursiveEncrypt(value, key);
81
81
  }
82
82
  else if (this.isCryptoKey(key)) {
@@ -87,7 +87,7 @@ class BaseConfigStore extends kit_1.AsyncOptionalCreatable {
87
87
  }
88
88
  update(key, value) {
89
89
  const existingValue = this.get(key, true);
90
- if (ts_types_1.isPlainObject(existingValue) && ts_types_1.isPlainObject(value)) {
90
+ if ((0, ts_types_1.isPlainObject)(existingValue) && (0, ts_types_1.isPlainObject)(value)) {
91
91
  value = Object.assign({}, existingValue, value);
92
92
  }
93
93
  this.set(key, value);
@@ -130,7 +130,7 @@ class BaseConfigStore extends kit_1.AsyncOptionalCreatable {
130
130
  * Returns an array that contains the values for each element in the config object.
131
131
  */
132
132
  values() {
133
- return ts_types_2.definiteValuesOf(this.contents);
133
+ return (0, ts_types_2.definiteValuesOf)(this.contents);
134
134
  }
135
135
  /**
136
136
  * Returns the entire config contents.
@@ -147,7 +147,7 @@ class BaseConfigStore extends kit_1.AsyncOptionalCreatable {
147
147
  this.setContents();
148
148
  }
149
149
  if (this.hasEncryption() && decrypt) {
150
- return this.recursiveDecrypt(kit_1.cloneJson(this.contents));
150
+ return this.recursiveDecrypt((0, kit_1.cloneJson)(this.contents));
151
151
  }
152
152
  return this.contents;
153
153
  }
@@ -219,13 +219,13 @@ class BaseConfigStore extends kit_1.AsyncOptionalCreatable {
219
219
  // Allows extended classes the ability to override the set method. i.e. maybe they want
220
220
  // nested object set from kit.
221
221
  setMethod(contents, key, value) {
222
- kit_1.set(contents, key, value);
222
+ (0, kit_1.set)(contents, key, value);
223
223
  }
224
224
  // Allows extended classes the ability to override the get method. i.e. maybe they want
225
225
  // nested object get from ts-types.
226
226
  // NOTE: Key must stay string to be reliably overwritten.
227
227
  getMethod(contents, key) {
228
- return ts_types_2.get(contents, key);
228
+ return (0, ts_types_2.get)(contents, key);
229
229
  }
230
230
  initialContents() {
231
231
  return {};
@@ -287,7 +287,7 @@ class BaseConfigStore extends kit_1.AsyncOptionalCreatable {
287
287
  return;
288
288
  if (!this.crypto)
289
289
  throw new sfdxError_1.SfdxError('crypto is not initialized', 'CryptoNotInitializedError');
290
- if (!ts_types_2.isString(value))
290
+ if (!(0, ts_types_2.isString)(value))
291
291
  throw new sfdxError_1.SfdxError(`can only encrypt strings but found: ${typeof value} : ${value}`, 'InvalidCryptoValueError');
292
292
  return this.crypto.isEncrypted(value) ? value : this.crypto.encrypt(value);
293
293
  }
@@ -296,7 +296,7 @@ class BaseConfigStore extends kit_1.AsyncOptionalCreatable {
296
296
  return;
297
297
  if (!this.crypto)
298
298
  throw new sfdxError_1.SfdxError('crypto is not initialized', 'CryptoNotInitializedError');
299
- if (!ts_types_2.isString(value))
299
+ if (!(0, ts_types_2.isString)(value))
300
300
  throw new sfdxError_1.SfdxError(`can only encrypt strings but found: ${typeof value} : ${value}`, 'InvalidCryptoValueError');
301
301
  return this.crypto.isEncrypted(value) ? this.crypto.decrypt(value) : value;
302
302
  }
@@ -333,7 +333,7 @@ class BaseConfigStore extends kit_1.AsyncOptionalCreatable {
333
333
  recursiveCrypto(method, keyPaths, data) {
334
334
  const key = keyPaths.pop();
335
335
  const value = data[key];
336
- if (ts_types_2.isJsonMap(value)) {
336
+ if ((0, ts_types_2.isJsonMap)(value)) {
337
337
  for (const newKey of Object.keys(value)) {
338
338
  this.recursiveCrypto(method, [...keyPaths, key, newKey], value);
339
339
  }
@@ -12,7 +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(path_1.join(__dirname));
15
+ messages_1.Messages.importMessagesDirectory((0, path_1.join)(__dirname));
16
16
  const messages = messages_1.Messages.loadMessages('@salesforce/core', 'envVars');
17
17
  var EnvironmentVariable;
18
18
  (function (EnvironmentVariable) {
@@ -77,7 +77,7 @@ var EnvironmentVariable;
77
77
  EnvironmentVariable["SF_USE_GENERIC_UNIX_KEYCHAIN"] = "SF_USE_GENERIC_UNIX_KEYCHAIN";
78
78
  EnvironmentVariable["SF_USE_PROGRESS_BAR"] = "SF_USE_PROGRESS_BAR";
79
79
  })(EnvironmentVariable = exports.EnvironmentVariable || (exports.EnvironmentVariable = {}));
80
- const getMessage = (environmentVariable) => messages.getMessage(change_case_1.camelCase(environmentVariable));
80
+ const getMessage = (environmentVariable) => messages.getMessage((0, change_case_1.camelCase)(environmentVariable));
81
81
  exports.SUPPORTED_ENV_VARS = {
82
82
  [EnvironmentVariable.FORCE_SHOW_SPINNER]: {
83
83
  description: getMessage(EnvironmentVariable.FORCE_SHOW_SPINNER),
@@ -197,7 +197,7 @@ exports.SUPPORTED_ENV_VARS = {
197
197
  synonymOf: EnvironmentVariable.SF_PROJECT_AUTOUPDATE_DISABLE_FOR_PACKAGE_CREATE,
198
198
  },
199
199
  [EnvironmentVariable.SFDX_PROJECT_AUTOUPDATE_DISABLE_FOR_PACKAGE_VERSION_CREATE]: {
200
- description: messages.getMessage(change_case_1.camelCase(EnvironmentVariable.SFDX_PROJECT_AUTOUPDATE_DISABLE_FOR_PACKAGE_VERSION_CREATE)),
200
+ description: messages.getMessage((0, change_case_1.camelCase)(EnvironmentVariable.SFDX_PROJECT_AUTOUPDATE_DISABLE_FOR_PACKAGE_VERSION_CREATE)),
201
201
  synonymOf: EnvironmentVariable.SF_PROJECT_AUTOUPDATE_DISABLE_FOR_PACKAGE_VERSION_CREATE,
202
202
  },
203
203
  [EnvironmentVariable.SFDX_REST_DEPLOY]: {
@@ -306,7 +306,7 @@ exports.SUPPORTED_ENV_VARS = {
306
306
  synonymOf: null,
307
307
  },
308
308
  [EnvironmentVariable.SF_PROJECT_AUTOUPDATE_DISABLE_FOR_PACKAGE_VERSION_CREATE]: {
309
- description: messages.getMessage(change_case_1.camelCase(EnvironmentVariable.SF_PROJECT_AUTOUPDATE_DISABLE_FOR_PACKAGE_VERSION_CREATE)),
309
+ description: messages.getMessage((0, change_case_1.camelCase)(EnvironmentVariable.SF_PROJECT_AUTOUPDATE_DISABLE_FOR_PACKAGE_VERSION_CREATE)),
310
310
  synonymOf: null,
311
311
  },
312
312
  [EnvironmentVariable.SF_SOURCE_MEMBER_POLLING_TIMEOUT]: {
@@ -328,7 +328,7 @@ class EnvVars extends kit_1.Env {
328
328
  this.resolve();
329
329
  }
330
330
  propertyToEnvName(property, prefix = 'SFDX_') {
331
- return `${prefix || ''}${change_case_1.snakeCase(property).toUpperCase()}`;
331
+ return `${prefix || ''}${(0, change_case_1.snakeCase)(property).toUpperCase()}`;
332
332
  }
333
333
  setPropertyFromEnv(property, prefix = 'SFDX_') {
334
334
  const envName = this.propertyToEnvName(property, prefix);
@@ -34,7 +34,7 @@ class KeychainConfig extends configFile_1.ConfigFile {
34
34
  if (newContents != null) {
35
35
  this.setContents(newContents);
36
36
  }
37
- await fs_1.fs.mkdirp(path_1.dirname(this.getPath()));
37
+ await fs_1.fs.mkdirp((0, path_1.dirname)(this.getPath()));
38
38
  await fs_1.fs.writeFile(this.getPath(), JSON.stringify(this.getContents(), null, 4), { mode: '600' });
39
39
  return this.getContents();
40
40
  }
@@ -25,7 +25,7 @@ const AUTH_TAG_LENGTH = 32;
25
25
  const ENCRYPTED_CHARS = /[a-f0-9]/;
26
26
  const KEY_NAME = 'sfdx';
27
27
  const ACCOUNT = 'local';
28
- messages_1.Messages.importMessagesDirectory(path_1.join(__dirname));
28
+ messages_1.Messages.importMessagesDirectory((0, path_1.join)(__dirname));
29
29
  const messages = messages_1.Messages.load('@salesforce/core', 'encryption', [
30
30
  'keychainPasswordCreationError',
31
31
  'invalidEncryptedFormatError',
@@ -34,7 +34,7 @@ const messages = messages_1.Messages.load('@salesforce/core', 'encryption', [
34
34
  ]);
35
35
  const makeSecureBuffer = (password) => {
36
36
  const newSb = new secureBuffer_1.SecureBuffer();
37
- newSb.consume(Buffer.from(ts_types_1.ensure(password), 'utf8'));
37
+ newSb.consume(Buffer.from((0, ts_types_1.ensure)(password), 'utf8'));
38
38
  return newSb;
39
39
  };
40
40
  /**
@@ -56,7 +56,7 @@ const keychainPromises = {
56
56
  if (err)
57
57
  return reject(err);
58
58
  cache_1.Cache.set(`${service}:${account}`, makeSecureBuffer(password));
59
- return resolve({ username: account, password: ts_types_1.ensure(password) });
59
+ return resolve({ username: account, password: (0, ts_types_1.ensure)(password) });
60
60
  });
61
61
  });
62
62
  }
@@ -64,7 +64,7 @@ const keychainPromises = {
64
64
  const pw = sb.value((buffer) => buffer.toString('utf8'));
65
65
  cache_1.Cache.set(`${service}:${account}`, makeSecureBuffer(pw));
66
66
  return new Promise((resolve) => {
67
- return resolve({ username: account, password: ts_types_1.ensure(pw) });
67
+ return resolve({ username: account, password: (0, ts_types_1.ensure)(pw) });
68
68
  });
69
69
  }
70
70
  },
@@ -203,7 +203,7 @@ class Crypto extends kit_1.AsyncOptionalCreatable {
203
203
  }
204
204
  const key = crypto.randomBytes(Math.ceil(16)).toString('hex');
205
205
  // Create a new password in the KeyChain.
206
- await keychainPromises.setPassword(ts_types_1.ensure(this.options.keychain), KEY_NAME, ACCOUNT, key);
206
+ await keychainPromises.setPassword((0, ts_types_1.ensure)(this.options.keychain), KEY_NAME, ACCOUNT, key);
207
207
  return this.init();
208
208
  }
209
209
  else {
@@ -213,7 +213,7 @@ class Crypto extends kit_1.AsyncOptionalCreatable {
213
213
  }
214
214
  async getKeyChain(platform) {
215
215
  if (!this.options.keychain) {
216
- this.options.keychain = await keyChain_1.retrieveKeychain(platform);
216
+ this.options.keychain = await (0, keyChain_1.retrieveKeychain)(platform);
217
217
  }
218
218
  return this.options.keychain;
219
219
  }
@@ -135,6 +135,7 @@ class KeychainAccess {
135
135
  return await this.osImpl.onGetCommandClose(code, stdout, stderr, opts, fn);
136
136
  }
137
137
  catch (e) {
138
+ // @ts-ignore
138
139
  if (e.retry) {
139
140
  if (retryCount >= GET_PASSWORD_RETRY_COUNT) {
140
141
  throw messages.createError('passwordRetryError', [GET_PASSWORD_RETRY_COUNT]);
@@ -315,7 +316,7 @@ const _darwinImpl = {
315
316
  }
316
317
  },
317
318
  };
318
- const secretFile = path.join(os_1.homedir(), global_1.Global.SFDX_STATE_FOLDER, 'key.json');
319
+ const secretFile = path.join((0, os_1.homedir)(), global_1.Global.SFDX_STATE_FOLDER, 'key.json');
319
320
  var SecretField;
320
321
  (function (SecretField) {
321
322
  SecretField["SERVICE"] = "service";
@@ -341,9 +342,9 @@ async function _readFile() {
341
342
  // The file and access is validated before this method is called
342
343
  const fileContents = await fs_1.fs.readJsonMap(secretFile);
343
344
  return {
344
- account: ts_types_1.ensureString(fileContents[SecretField.ACCOUNT]),
345
- password: ts_types_1.asString(fileContents[SecretField.KEY]),
346
- service: ts_types_1.ensureString(fileContents[SecretField.SERVICE]),
345
+ account: (0, ts_types_1.ensureString)(fileContents[SecretField.ACCOUNT]),
346
+ password: (0, ts_types_1.asString)(fileContents[SecretField.KEY]),
347
+ service: (0, ts_types_1.ensureString)(fileContents[SecretField.SERVICE]),
347
348
  };
348
349
  }
349
350
  // istanbul ignore next - getPassword/setPassword is always mocked out
@@ -405,7 +406,7 @@ class GenericKeychainAccess {
405
406
  }
406
407
  async isValidFileAccess(cb) {
407
408
  try {
408
- const root = os_1.homedir();
409
+ const root = (0, os_1.homedir)();
409
410
  await fs_1.fs.access(path.join(root, global_1.Global.SFDX_STATE_FOLDER), fs_1.fs.constants.R_OK | fs_1.fs.constants.X_OK | fs_1.fs.constants.W_OK);
410
411
  await cb(null);
411
412
  }
@@ -40,7 +40,7 @@ class SecureBuffer {
40
40
  value(cb) {
41
41
  if (cb) {
42
42
  const cipher = crypto.createDecipheriv(cipherName, this.key, this.iv);
43
- const a = cipher.update(ts_types_1.ensure(this.secret));
43
+ const a = cipher.update((0, ts_types_1.ensure)(this.secret));
44
44
  const b = cipher.final();
45
45
  const c = Buffer.concat([a, b]);
46
46
  try {
@@ -27,7 +27,7 @@ async function wait(ms = 1000) {
27
27
  }
28
28
  async function makeRequest(options) {
29
29
  const rawResponse = await new transport_1.default().httpRequest(options);
30
- const response = kit_1.parseJsonMap(rawResponse.body);
30
+ const response = (0, kit_1.parseJsonMap)(rawResponse.body);
31
31
  if (response.error) {
32
32
  const err = new sfdxError_1.SfdxError('Request Failed.');
33
33
  err.data = Object.assign(response, { status: rawResponse.statusCode });
@@ -109,7 +109,7 @@ class DeviceOauthService extends kit_1.AsyncCreatable {
109
109
  }
110
110
  getLoginOptions(url) {
111
111
  const body = new url_1.URLSearchParams();
112
- body.append('client_id', ts_types_1.ensureString(this.options.clientId));
112
+ body.append('client_id', (0, ts_types_1.ensureString)(this.options.clientId));
113
113
  body.append('response_type', DeviceOauthService.RESPONSE_TYPE);
114
114
  body.append('scope', DeviceOauthService.SCOPE);
115
115
  return {
@@ -121,7 +121,7 @@ class DeviceOauthService extends kit_1.AsyncCreatable {
121
121
  }
122
122
  getPollingOptions(url, code) {
123
123
  const body = new url_1.URLSearchParams();
124
- body.append('client_id', ts_types_1.ensureString(this.options.clientId));
124
+ body.append('client_id', (0, ts_types_1.ensureString)(this.options.clientId));
125
125
  body.append('grant_type', DeviceOauthService.GRANT_TYPE);
126
126
  body.append('code', code);
127
127
  return {
@@ -132,7 +132,7 @@ class DeviceOauthService extends kit_1.AsyncCreatable {
132
132
  };
133
133
  }
134
134
  getDeviceFlowRequestUrl() {
135
- return `${ts_types_1.ensureString(this.options.loginUrl)}/services/oauth2/token`;
135
+ return `${(0, ts_types_1.ensureString)(this.options.loginUrl)}/services/oauth2/token`;
136
136
  }
137
137
  async poll(httpRequest) {
138
138
  this.logger.debug(`polling for device approval (attempt ${this.pollingCount} of ${DeviceOauthService.POLLING_COUNT_MAX})`);
@@ -140,6 +140,7 @@ class DeviceOauthService extends kit_1.AsyncCreatable {
140
140
  return await makeRequest(httpRequest);
141
141
  }
142
142
  catch (e) {
143
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
143
144
  const err = e.data;
144
145
  if (err.error && err.status === 400 && err.error === 'authorization_pending') {
145
146
  // do nothing because we're still waiting
@@ -65,7 +65,7 @@ class GlobalInfo extends configFile_1.ConfigFile {
65
65
  return new aliasAccessor_1.AliasAccessor(this);
66
66
  }
67
67
  set(key, value) {
68
- if (ts_types_1.isPlainObject(value)) {
68
+ if ((0, ts_types_1.isPlainObject)(value)) {
69
69
  value = this.timestamp(value);
70
70
  }
71
71
  super.set(key, value);
@@ -37,7 +37,7 @@ class SfdxDataHandler {
37
37
  }
38
38
  }
39
39
  async merge(sfData = globalInfoConfig_1.GlobalInfo.emptyDataModel) {
40
- let merged = globalInfoConfig_1.deepCopy(sfData);
40
+ let merged = (0, globalInfoConfig_1.deepCopy)(sfData);
41
41
  for (const handler of this.handlers) {
42
42
  merged = Object.assign(merged, await handler.merge(merged));
43
43
  }
@@ -45,7 +45,7 @@ class SfdxDataHandler {
45
45
  return merged;
46
46
  }
47
47
  setOriginal(data) {
48
- this.original = globalInfoConfig_1.deepCopy(data);
48
+ this.original = (0, globalInfoConfig_1.deepCopy)(data);
49
49
  }
50
50
  }
51
51
  exports.SfdxDataHandler = SfdxDataHandler;
@@ -53,7 +53,7 @@ class BaseHandler {
53
53
  async merge(sfData = globalInfoConfig_1.GlobalInfo.emptyDataModel) {
54
54
  var _a, _b;
55
55
  const sfdxData = await this.migrate();
56
- const merged = globalInfoConfig_1.deepCopy(sfData);
56
+ const merged = (0, globalInfoConfig_1.deepCopy)(sfData);
57
57
  // Only merge the key this handler is responsible for.
58
58
  const key = this.sfKey;
59
59
  const sfKeys = Object.keys((_a = sfData[key]) !== null && _a !== void 0 ? _a : {});
@@ -61,11 +61,11 @@ class BaseHandler {
61
61
  const commonKeys = sfKeys.filter((k) => sfdxKeys.includes(k));
62
62
  for (const k of commonKeys) {
63
63
  const [newer, older] = [sfData[key][k], sfdxData[key][k]].sort((a, b) => {
64
- if (ts_types_1.isPlainObject(a) && ts_types_1.isPlainObject(b))
64
+ if ((0, ts_types_1.isPlainObject)(a) && (0, ts_types_1.isPlainObject)(b))
65
65
  return new Date(a.timestamp) < new Date(b.timestamp) ? 1 : -1;
66
66
  return 0;
67
67
  });
68
- kit_1.set(merged, `${key}["${k}"]`, Object.assign({}, older, newer));
68
+ (0, kit_1.set)(merged, `${key}["${k}"]`, Object.assign({}, older, newer));
69
69
  }
70
70
  // Keys that exist in .sfdx but not .sf are added becase we assume
71
71
  // that this means the key was created using sfdx.
@@ -78,7 +78,7 @@ class BaseHandler {
78
78
  // assume that we should migrate any keys that exist in in .sfdx
79
79
  const unhandledSfdxKeys = sfdxKeys.filter((k) => !sfKeys.includes(k));
80
80
  for (const k of unhandledSfdxKeys) {
81
- kit_1.set(merged, `${key}["${k}"]`, sfdxData[key][k]);
81
+ (0, kit_1.set)(merged, `${key}["${k}"]`, sfdxData[key][k]);
82
82
  }
83
83
  // Keys that exist in .sf but not .sfdx are deleted because we assume
84
84
  // that this means the key was deleted while using sfdx.
@@ -98,7 +98,7 @@ class AuthHandler extends BaseHandler {
98
98
  }
99
99
  async migrate() {
100
100
  const oldAuths = await this.listAllAuthorizations();
101
- const newAuths = oldAuths.reduce((x, y) => Object.assign(x, { [ts_types_1.ensureString(y.username)]: y }), {});
101
+ const newAuths = oldAuths.reduce((x, y) => Object.assign(x, { [(0, ts_types_1.ensureString)(y.username)]: y }), {});
102
102
  return { [this.sfKey]: newAuths };
103
103
  }
104
104
  async write(latest, original) {
@@ -148,7 +148,7 @@ class AuthHandler extends BaseHandler {
148
148
  const filenames = await this.listAllAuthFiles();
149
149
  const auths = [];
150
150
  for (const filename of filenames) {
151
- const username = path_1.basename(filename, path_1.extname(filename));
151
+ const username = (0, path_1.basename)(filename, (0, path_1.extname)(filename));
152
152
  const configFile = await this.createAuthFileConfig(username);
153
153
  const contents = configFile.getContents();
154
154
  const stat = await configFile.stat();
@@ -167,7 +167,7 @@ class AliasesHandler extends BaseHandler {
167
167
  this.sfKey = types_1.SfInfoKeys.ALIASES;
168
168
  }
169
169
  async migrate() {
170
- const aliasesFilePath = path_1.join(global_1.Global.SFDX_DIR, AliasesHandler.SFDX_ALIASES_FILENAME);
170
+ const aliasesFilePath = (0, path_1.join)(global_1.Global.SFDX_DIR, AliasesHandler.SFDX_ALIASES_FILENAME);
171
171
  try {
172
172
  const sfdxAliases = (await fs_1.fs.readJson(aliasesFilePath)).orgs;
173
173
  return { [this.sfKey]: { ...sfdxAliases } };
@@ -179,7 +179,7 @@ class AliasesHandler extends BaseHandler {
179
179
  // AliasesHandler implements its own merge method because the structure of aliases is flat instead of nested by SfInfoKey types.
180
180
  async merge(sfData = globalInfoConfig_1.GlobalInfo.emptyDataModel) {
181
181
  const sfdxAliases = (await this.migrate())[types_1.SfInfoKeys.ALIASES];
182
- const merged = globalInfoConfig_1.deepCopy(sfData);
182
+ const merged = (0, globalInfoConfig_1.deepCopy)(sfData);
183
183
  /* Overwrite `sf` aliases with `sfdx` aliases
184
184
  * `sf` will always modify `sfdx` files but `sfdx` won't modify `sf` files
185
185
  * because of this we can assume that any changes in `sfdx` files that aren't
@@ -208,7 +208,7 @@ class AliasesHandler extends BaseHandler {
208
208
  return merged;
209
209
  }
210
210
  async write(latest) {
211
- const aliasesFilePath = path_1.join(global_1.Global.SFDX_DIR, AliasesHandler.SFDX_ALIASES_FILENAME);
211
+ const aliasesFilePath = (0, path_1.join)(global_1.Global.SFDX_DIR, AliasesHandler.SFDX_ALIASES_FILENAME);
212
212
  fs_1.fs.writeJson(aliasesFilePath, { orgs: latest[types_1.SfInfoKeys.ALIASES] });
213
213
  }
214
214
  }
@@ -70,7 +70,7 @@ class Lifecycle {
70
70
  }
71
71
  else if (
72
72
  // an older version was loaded that should be replaced
73
- semver_1.compare(global.salesforceCoreLifecycle.version(), Lifecycle.staticVersion()) === -1) {
73
+ (0, semver_1.compare)(global.salesforceCoreLifecycle.version(), Lifecycle.staticVersion()) === -1) {
74
74
  const oldInstance = global.salesforceCoreLifecycle;
75
75
  // use the newer version and transfer any listeners from the old version
76
76
  // object spread keeps them from being references