@salesforce/core 3.7.0 → 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.
Files changed (51) hide show
  1. package/CHANGELOG.md +92 -2
  2. package/LICENSE.txt +1 -1
  3. package/lib/config/config.js +15 -15
  4. package/lib/config/configAggregator.js +4 -4
  5. package/lib/config/configFile.js +9 -9
  6. package/lib/config/configStore.js +12 -13
  7. package/lib/config/envVars.js +5 -5
  8. package/lib/config/keychainConfig.js +1 -1
  9. package/lib/crypto/crypto.js +6 -6
  10. package/lib/crypto/keyChainImpl.js +6 -5
  11. package/lib/crypto/secureBuffer.js +1 -1
  12. package/lib/deviceOauthService.js +5 -4
  13. package/lib/exported.d.ts +1 -1
  14. package/lib/exported.js +4 -2
  15. package/lib/globalInfo/globalInfoConfig.js +1 -1
  16. package/lib/globalInfo/sfdxDataHandler.js +11 -11
  17. package/lib/lifecycleEvents.d.ts +38 -1
  18. package/lib/lifecycleEvents.js +73 -2
  19. package/lib/logger.js +13 -12
  20. package/lib/messages.js +10 -9
  21. package/lib/org/authInfo.d.ts +2 -6
  22. package/lib/org/authInfo.js +44 -41
  23. package/lib/org/connection.js +14 -11
  24. package/lib/org/org.d.ts +121 -9
  25. package/lib/org/org.js +373 -36
  26. package/lib/org/orgConfigProperties.js +1 -1
  27. package/lib/org/permissionSetAssignment.js +3 -3
  28. package/lib/org/user.js +20 -20
  29. package/lib/schema/printer.js +18 -18
  30. package/lib/schema/validator.js +8 -8
  31. package/lib/sfdxError.d.ts +1 -1
  32. package/lib/sfdxError.js +3 -2
  33. package/lib/sfdxProject.js +15 -13
  34. package/lib/status/myDomainResolver.js +3 -3
  35. package/lib/status/pollingClient.js +2 -2
  36. package/lib/status/streamingClient.d.ts +2 -3
  37. package/lib/status/streamingClient.js +16 -22
  38. package/lib/status/types.d.ts +89 -0
  39. package/lib/status/types.js +18 -0
  40. package/lib/testSetup.d.ts +6 -4
  41. package/lib/testSetup.js +25 -25
  42. package/lib/util/cache.js +3 -3
  43. package/lib/util/fs.js +12 -12
  44. package/lib/util/sfdc.js +3 -3
  45. package/lib/util/sfdcUrl.d.ts +2 -1
  46. package/lib/util/sfdcUrl.js +16 -8
  47. package/lib/webOAuthServer.js +7 -7
  48. package/messages/core.json +3 -3
  49. package/messages/core.md +1 -1
  50. package/messages/org.md +36 -0
  51. package/package.json +38 -45
package/CHANGELOG.md CHANGED
@@ -2,12 +2,27 @@
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.0](https://github.com/forcedotcom/sfdx-core/compare/v3.6.6...v3.7.0) (2021-10-12)
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
+
11
+ ### [3.7.3](https://github.com/forcedotcom/sfdx-core/compare/v3.7.2...v3.7.3) (2021-12-16)
12
+
13
+ ### [3.7.2](https://github.com/forcedotcom/sfdx-core/compare/v3.7.1...v3.7.2) (2021-10-28)
14
+
15
+ ### Bug Fixes
6
16
 
17
+ - make @types/sfdx-faye a dependendcy ([683680b](https://github.com/forcedotcom/sfdx-core/commit/683680b8133048f71d25ef4df7aa24d9700dc5e8))
18
+
19
+ ### [3.7.1](https://github.com/forcedotcom/sfdx-core/compare/v3.7.0...v3.7.1) (2021-10-28)
20
+
21
+ ## [3.7.0](https://github.com/forcedotcom/sfdx-core/compare/v3.6.6...v3.7.0) (2021-10-12)
7
22
 
8
23
  ### Features
9
24
 
10
- * use jsforce v2 ([#457](https://github.com/forcedotcom/sfdx-core/issues/457)) ([4a9094e](https://github.com/forcedotcom/sfdx-core/commit/4a9094e958288cdcc6c69f5d87b10a70a437d8e9))
25
+ - use jsforce v2 ([#457](https://github.com/forcedotcom/sfdx-core/issues/457)) ([4a9094e](https://github.com/forcedotcom/sfdx-core/commit/4a9094e958288cdcc6c69f5d87b10a70a437d8e9))
11
26
 
12
27
  ### [3.6.6](https://github.com/forcedotcom/sfdx-core/compare/v3.6.5...v3.6.6) (2021-10-08)
13
28
 
@@ -213,6 +228,81 @@ All notable changes to this project will be documented in this file. See [standa
213
228
  - add GlobalInfo config file ([#397](https://github.com/forcedotcom/sfdx-core/issues/397)) ([579998b](https://github.com/forcedotcom/sfdx-core/commit/579998b6ee70dbb9772e65896bbabf6d812aae23))
214
229
  - default to reading files from cache ([12b5930](https://github.com/forcedotcom/sfdx-core/commit/12b59301df96395c4edcbfb0816dbddd45af95db))
215
230
 
231
+ ### [2.33.1](https://github.com/forcedotcom/sfdx-core/compare/v2.33.0...v2.33.1) (2021-12-15)
232
+
233
+ ### Bug Fixes
234
+
235
+ - faye doesn't use custom stuff passed it ([b1cefc7](https://github.com/forcedotcom/sfdx-core/commit/b1cefc76afde7f0dd56ed72b5539a47c118eef63))
236
+
237
+ ## [2.33.0](https://github.com/forcedotcom/sfdx-core/compare/v2.32.0...v2.33.0) (2021-12-14)
238
+
239
+ ### Features
240
+
241
+ - sandbox creation ([314dcf1](https://github.com/forcedotcom/sfdx-core/commit/314dcf164d93bd0e3a5f4763a4dfcdde7d0cb14a))
242
+
243
+ ## [2.32.0](https://github.com/forcedotcom/sfdx-core/compare/v2.31.1...v2.32.0) (2021-12-14)
244
+
245
+ ### Features
246
+
247
+ - switch sfdx-faye with faye ([a0545e5](https://github.com/forcedotcom/sfdx-core/commit/a0545e57d5041c97e499f284afbd7fcb16cf2247))
248
+
249
+ ### Bug Fixes
250
+
251
+ - no maxquery warning when records.length is 0 ([758f912](https://github.com/forcedotcom/sfdx-core/commit/758f912a23bd3e9f8d4f854f3e07682dd4d4c4aa))
252
+
253
+ ### [2.31.1](https://github.com/forcedotcom/sfdx-core/compare/v2.31.0...v2.31.1) (2021-12-06)
254
+
255
+ ## [2.31.0](https://github.com/forcedotcom/sfdx-core/compare/v2.30.1...v2.31.0) (2021-11-30)
256
+
257
+ ### Features
258
+
259
+ - bump version of jsforce ([7d89024](https://github.com/forcedotcom/sfdx-core/commit/7d89024f593968c031af22ac817efc26d00fcd54))
260
+
261
+ ### [2.30.1](https://github.com/forcedotcom/sfdx-core/compare/v2.30.0...v2.30.1) (2021-11-30)
262
+
263
+ ### Bug Fixes
264
+
265
+ - better output for authUrl errors ([f3ec729](https://github.com/forcedotcom/sfdx-core/commit/f3ec7298bdbd3194d3d14bfea09f47f413669376))
266
+
267
+ ## [2.30.0](https://github.com/forcedotcom/sfdx-core/compare/v2.29.0...v2.30.0) (2021-11-25)
268
+
269
+ ### Features
270
+
271
+ - delete scratch orgs and sandboxes ([#491](https://github.com/forcedotcom/sfdx-core/issues/491)) ([468c348](https://github.com/forcedotcom/sfdx-core/commit/468c348f0ecc69ddeea02927bf7a26ca660a86ca))
272
+
273
+ ## [2.29.0](https://github.com/forcedotcom/sfdx-core/compare/v2.28.4...v2.29.0) (2021-11-17)
274
+
275
+ ### Features
276
+
277
+ - cleans up old listeners from upgraded instance ([e3f2d69](https://github.com/forcedotcom/sfdx-core/commit/e3f2d69ccd5c096d37addb1b982e19354175f11a))
278
+ - use warnings instead of process in sfdx-core ([c1f7e98](https://github.com/forcedotcom/sfdx-core/commit/c1f7e98f6b19d57da1a2ee0cdf58e449079f0ee7))
279
+ - warning and telemetry events ([80a8039](https://github.com/forcedotcom/sfdx-core/commit/80a8039e2f686d973ddbc24c9a2980fb93928d13))
280
+ - warning and telemetry events ([a04b293](https://github.com/forcedotcom/sfdx-core/commit/a04b29355c8ca6c7e37e071ccc159aff5e5e9ca0))
281
+
282
+ ### Bug Fixes
283
+
284
+ - transfer listeners when upgrading the global instance to newer version ([0a40831](https://github.com/forcedotcom/sfdx-core/commit/0a408317c132548771ced0fe196178d2e9c76232))
285
+
286
+ ### [2.28.4](https://github.com/forcedotcom/sfdx-core/compare/v2.28.3...v2.28.4) (2021-11-10)
287
+
288
+ ### Bug Fixes
289
+
290
+ - bump jsforce types and run unit tests on Windows ([#485](https://github.com/forcedotcom/sfdx-core/issues/485)) ([3952c8f](https://github.com/forcedotcom/sfdx-core/commit/3952c8fe248531a0597477ed12240f611048caba))
291
+
292
+ ### [2.28.3](https://github.com/forcedotcom/sfdx-core/compare/v2.28.2...v2.28.3) (2021-11-08)
293
+
294
+ ### Bug Fixes
295
+
296
+ - fix unit test ([d903c04](https://github.com/forcedotcom/sfdx-core/commit/d903c04e5f3e4f01fccb3f00b91560c443013ddf))
297
+ - force new release ([124bb74](https://github.com/forcedotcom/sfdx-core/commit/124bb744c5ecc28cb8babf285c6d8c3032eb7ef6))
298
+ - improve error message when providing an invalid username ([2ab4bbd](https://github.com/forcedotcom/sfdx-core/commit/2ab4bbdefd962283d88ccb735de88c88fe189d39))
299
+
300
+ ### [2.28.2](https://github.com/forcedotcom/sfdx-core/compare/v2.28.1...v2.28.2) (2021-10-13)
301
+
302
+ ### Bug Fixes
303
+
304
+ - support for .mil sandboxes ([9ef35c7](https://github.com/forcedotcom/sfdx-core/commit/9ef35c7b1ef0fe974c3bd3b89b862a436e00f7d9))
305
+
216
306
  ### [2.28.1](https://github.com/forcedotcom/sfdx-core/compare/v2.28.0...v2.28.1) (2021-10-06)
217
307
 
218
308
  ### Bug Fixes
package/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2018, 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
  }
@@ -218,15 +218,14 @@ class BaseConfigStore extends kit_1.AsyncOptionalCreatable {
218
218
  }
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
- // NOTE: Key and value must stay string and value to be reliably overwritten.
222
221
  setMethod(contents, key, value) {
223
- kit_1.set(contents, key, value);
222
+ (0, kit_1.set)(contents, key, value);
224
223
  }
225
224
  // Allows extended classes the ability to override the get method. i.e. maybe they want
226
225
  // nested object get from ts-types.
227
226
  // NOTE: Key must stay string to be reliably overwritten.
228
227
  getMethod(contents, key) {
229
- return ts_types_2.get(contents, key);
228
+ return (0, ts_types_2.get)(contents, key);
230
229
  }
231
230
  initialContents() {
232
231
  return {};
@@ -288,7 +287,7 @@ class BaseConfigStore extends kit_1.AsyncOptionalCreatable {
288
287
  return;
289
288
  if (!this.crypto)
290
289
  throw new sfdxError_1.SfdxError('crypto is not initialized', 'CryptoNotInitializedError');
291
- if (!ts_types_2.isString(value))
290
+ if (!(0, ts_types_2.isString)(value))
292
291
  throw new sfdxError_1.SfdxError(`can only encrypt strings but found: ${typeof value} : ${value}`, 'InvalidCryptoValueError');
293
292
  return this.crypto.isEncrypted(value) ? value : this.crypto.encrypt(value);
294
293
  }
@@ -297,7 +296,7 @@ class BaseConfigStore extends kit_1.AsyncOptionalCreatable {
297
296
  return;
298
297
  if (!this.crypto)
299
298
  throw new sfdxError_1.SfdxError('crypto is not initialized', 'CryptoNotInitializedError');
300
- if (!ts_types_2.isString(value))
299
+ if (!(0, ts_types_2.isString)(value))
301
300
  throw new sfdxError_1.SfdxError(`can only encrypt strings but found: ${typeof value} : ${value}`, 'InvalidCryptoValueError');
302
301
  return this.crypto.isEncrypted(value) ? this.crypto.decrypt(value) : value;
303
302
  }
@@ -334,7 +333,7 @@ class BaseConfigStore extends kit_1.AsyncOptionalCreatable {
334
333
  recursiveCrypto(method, keyPaths, data) {
335
334
  const key = keyPaths.pop();
336
335
  const value = data[key];
337
- if (ts_types_2.isJsonMap(value)) {
336
+ if ((0, ts_types_2.isJsonMap)(value)) {
338
337
  for (const newKey of Object.keys(value)) {
339
338
  this.recursiveCrypto(method, [...keyPaths, key, newKey], value);
340
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
package/lib/exported.d.ts CHANGED
@@ -17,7 +17,7 @@ export { SfdcUrl } from './util/sfdcUrl';
17
17
  export { getJwtAudienceUrl } from './util/getJwtAudienceUrl';
18
18
  export { Fields, FieldValue, LoggerLevel, LoggerLevelValue, LogLine, LoggerOptions, LoggerStream, Logger, } from './logger';
19
19
  export { Messages } from './messages';
20
- export { Org } from './org/org';
20
+ export { Org, SandboxProcessObject, StatusEvent, SandboxEvents, SandboxUserAuthResponse, SandboxUserAuthRequest, SandboxRequest, OrgTypes, ResultEvent, } from './org';
21
21
  export { OrgConfigProperties, ORG_CONFIG_ALLOWED_PROPERTIES } from './org/orgConfigProperties';
22
22
  export { PackageDir, NamedPackageDir, PackageDirDependency, SfdxProject, SfdxProjectJson } from './sfdxProject';
23
23
  export { SchemaPrinter } from './schema/printer';