@salesforce/core 3.7.1 → 3.7.5

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 (54) hide show
  1. package/CHANGELOG.md +96 -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.d.ts +20 -5
  8. package/lib/config/envVars.js +75 -10
  9. package/lib/config/keychainConfig.js +1 -1
  10. package/lib/crypto/crypto.js +6 -6
  11. package/lib/crypto/keyChainImpl.js +6 -5
  12. package/lib/crypto/secureBuffer.js +1 -1
  13. package/lib/deviceOauthService.js +5 -4
  14. package/lib/exported.d.ts +2 -2
  15. package/lib/exported.js +6 -2
  16. package/lib/globalInfo/globalInfoConfig.js +1 -1
  17. package/lib/globalInfo/sfdxDataHandler.js +11 -11
  18. package/lib/lifecycleEvents.d.ts +38 -1
  19. package/lib/lifecycleEvents.js +73 -2
  20. package/lib/logger.js +13 -12
  21. package/lib/messages.js +10 -9
  22. package/lib/org/authInfo.d.ts +2 -6
  23. package/lib/org/authInfo.js +44 -41
  24. package/lib/org/connection.js +14 -11
  25. package/lib/org/org.d.ts +121 -9
  26. package/lib/org/org.js +373 -36
  27. package/lib/org/orgConfigProperties.js +1 -1
  28. package/lib/org/permissionSetAssignment.js +3 -3
  29. package/lib/org/user.js +20 -20
  30. package/lib/schema/printer.js +18 -18
  31. package/lib/schema/validator.js +8 -8
  32. package/lib/sfdxError.d.ts +1 -1
  33. package/lib/sfdxError.js +3 -2
  34. package/lib/sfdxProject.js +15 -13
  35. package/lib/status/myDomainResolver.js +3 -3
  36. package/lib/status/pollingClient.d.ts +0 -1
  37. package/lib/status/pollingClient.js +2 -2
  38. package/lib/status/streamingClient.d.ts +2 -3
  39. package/lib/status/streamingClient.js +16 -22
  40. package/lib/status/types.d.ts +89 -0
  41. package/lib/status/types.js +18 -0
  42. package/lib/testSetup.d.ts +3 -2
  43. package/lib/testSetup.js +25 -25
  44. package/lib/util/cache.js +3 -3
  45. package/lib/util/fs.js +12 -12
  46. package/lib/util/sfdc.js +3 -3
  47. package/lib/util/sfdcUrl.d.ts +2 -1
  48. package/lib/util/sfdcUrl.js +16 -8
  49. package/lib/webOAuthServer.js +7 -7
  50. package/messages/core.json +3 -3
  51. package/messages/core.md +1 -1
  52. package/messages/envVars.md +53 -13
  53. package/messages/org.md +36 -0
  54. package/package.json +39 -46
package/CHANGELOG.md CHANGED
@@ -2,14 +2,33 @@
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.5](https://github.com/forcedotcom/sfdx-core/compare/v3.7.4...v3.7.5) (2022-02-14)
6
+
7
+ ### Bug Fixes
8
+
9
+ - add env vars from sfdx-cli init to envvars ([#520](https://github.com/forcedotcom/sfdx-core/issues/520)) ([8ef2785](https://github.com/forcedotcom/sfdx-core/commit/8ef27859d95bfffc5999b14f4792874d04f0504c))
10
+
11
+ ### [3.7.4](https://github.com/forcedotcom/sfdx-core/compare/v3.7.3...v3.7.4) (2022-02-07)
12
+
13
+ ### Bug Fixes
14
+
15
+ - 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))
16
+
17
+ ### [3.7.3](https://github.com/forcedotcom/sfdx-core/compare/v3.7.2...v3.7.3) (2021-12-16)
18
+
19
+ ### [3.7.2](https://github.com/forcedotcom/sfdx-core/compare/v3.7.1...v3.7.2) (2021-10-28)
20
+
21
+ ### Bug Fixes
22
+
23
+ - make @types/sfdx-faye a dependendcy ([683680b](https://github.com/forcedotcom/sfdx-core/commit/683680b8133048f71d25ef4df7aa24d9700dc5e8))
24
+
5
25
  ### [3.7.1](https://github.com/forcedotcom/sfdx-core/compare/v3.7.0...v3.7.1) (2021-10-28)
6
26
 
7
27
  ## [3.7.0](https://github.com/forcedotcom/sfdx-core/compare/v3.6.6...v3.7.0) (2021-10-12)
8
28
 
9
-
10
29
  ### Features
11
30
 
12
- * use jsforce v2 ([#457](https://github.com/forcedotcom/sfdx-core/issues/457)) ([4a9094e](https://github.com/forcedotcom/sfdx-core/commit/4a9094e958288cdcc6c69f5d87b10a70a437d8e9))
31
+ - use jsforce v2 ([#457](https://github.com/forcedotcom/sfdx-core/issues/457)) ([4a9094e](https://github.com/forcedotcom/sfdx-core/commit/4a9094e958288cdcc6c69f5d87b10a70a437d8e9))
13
32
 
14
33
  ### [3.6.6](https://github.com/forcedotcom/sfdx-core/compare/v3.6.5...v3.6.6) (2021-10-08)
15
34
 
@@ -215,6 +234,81 @@ All notable changes to this project will be documented in this file. See [standa
215
234
  - add GlobalInfo config file ([#397](https://github.com/forcedotcom/sfdx-core/issues/397)) ([579998b](https://github.com/forcedotcom/sfdx-core/commit/579998b6ee70dbb9772e65896bbabf6d812aae23))
216
235
  - default to reading files from cache ([12b5930](https://github.com/forcedotcom/sfdx-core/commit/12b59301df96395c4edcbfb0816dbddd45af95db))
217
236
 
237
+ ### [2.33.1](https://github.com/forcedotcom/sfdx-core/compare/v2.33.0...v2.33.1) (2021-12-15)
238
+
239
+ ### Bug Fixes
240
+
241
+ - faye doesn't use custom stuff passed it ([b1cefc7](https://github.com/forcedotcom/sfdx-core/commit/b1cefc76afde7f0dd56ed72b5539a47c118eef63))
242
+
243
+ ## [2.33.0](https://github.com/forcedotcom/sfdx-core/compare/v2.32.0...v2.33.0) (2021-12-14)
244
+
245
+ ### Features
246
+
247
+ - sandbox creation ([314dcf1](https://github.com/forcedotcom/sfdx-core/commit/314dcf164d93bd0e3a5f4763a4dfcdde7d0cb14a))
248
+
249
+ ## [2.32.0](https://github.com/forcedotcom/sfdx-core/compare/v2.31.1...v2.32.0) (2021-12-14)
250
+
251
+ ### Features
252
+
253
+ - switch sfdx-faye with faye ([a0545e5](https://github.com/forcedotcom/sfdx-core/commit/a0545e57d5041c97e499f284afbd7fcb16cf2247))
254
+
255
+ ### Bug Fixes
256
+
257
+ - no maxquery warning when records.length is 0 ([758f912](https://github.com/forcedotcom/sfdx-core/commit/758f912a23bd3e9f8d4f854f3e07682dd4d4c4aa))
258
+
259
+ ### [2.31.1](https://github.com/forcedotcom/sfdx-core/compare/v2.31.0...v2.31.1) (2021-12-06)
260
+
261
+ ## [2.31.0](https://github.com/forcedotcom/sfdx-core/compare/v2.30.1...v2.31.0) (2021-11-30)
262
+
263
+ ### Features
264
+
265
+ - bump version of jsforce ([7d89024](https://github.com/forcedotcom/sfdx-core/commit/7d89024f593968c031af22ac817efc26d00fcd54))
266
+
267
+ ### [2.30.1](https://github.com/forcedotcom/sfdx-core/compare/v2.30.0...v2.30.1) (2021-11-30)
268
+
269
+ ### Bug Fixes
270
+
271
+ - better output for authUrl errors ([f3ec729](https://github.com/forcedotcom/sfdx-core/commit/f3ec7298bdbd3194d3d14bfea09f47f413669376))
272
+
273
+ ## [2.30.0](https://github.com/forcedotcom/sfdx-core/compare/v2.29.0...v2.30.0) (2021-11-25)
274
+
275
+ ### Features
276
+
277
+ - delete scratch orgs and sandboxes ([#491](https://github.com/forcedotcom/sfdx-core/issues/491)) ([468c348](https://github.com/forcedotcom/sfdx-core/commit/468c348f0ecc69ddeea02927bf7a26ca660a86ca))
278
+
279
+ ## [2.29.0](https://github.com/forcedotcom/sfdx-core/compare/v2.28.4...v2.29.0) (2021-11-17)
280
+
281
+ ### Features
282
+
283
+ - cleans up old listeners from upgraded instance ([e3f2d69](https://github.com/forcedotcom/sfdx-core/commit/e3f2d69ccd5c096d37addb1b982e19354175f11a))
284
+ - use warnings instead of process in sfdx-core ([c1f7e98](https://github.com/forcedotcom/sfdx-core/commit/c1f7e98f6b19d57da1a2ee0cdf58e449079f0ee7))
285
+ - warning and telemetry events ([80a8039](https://github.com/forcedotcom/sfdx-core/commit/80a8039e2f686d973ddbc24c9a2980fb93928d13))
286
+ - warning and telemetry events ([a04b293](https://github.com/forcedotcom/sfdx-core/commit/a04b29355c8ca6c7e37e071ccc159aff5e5e9ca0))
287
+
288
+ ### Bug Fixes
289
+
290
+ - transfer listeners when upgrading the global instance to newer version ([0a40831](https://github.com/forcedotcom/sfdx-core/commit/0a408317c132548771ced0fe196178d2e9c76232))
291
+
292
+ ### [2.28.4](https://github.com/forcedotcom/sfdx-core/compare/v2.28.3...v2.28.4) (2021-11-10)
293
+
294
+ ### Bug Fixes
295
+
296
+ - 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))
297
+
298
+ ### [2.28.3](https://github.com/forcedotcom/sfdx-core/compare/v2.28.2...v2.28.3) (2021-11-08)
299
+
300
+ ### Bug Fixes
301
+
302
+ - fix unit test ([d903c04](https://github.com/forcedotcom/sfdx-core/commit/d903c04e5f3e4f01fccb3f00b91560c443013ddf))
303
+ - force new release ([124bb74](https://github.com/forcedotcom/sfdx-core/commit/124bb744c5ecc28cb8babf285c6d8c3032eb7ef6))
304
+ - improve error message when providing an invalid username ([2ab4bbd](https://github.com/forcedotcom/sfdx-core/commit/2ab4bbdefd962283d88ccb735de88c88fe189d39))
305
+
306
+ ### [2.28.2](https://github.com/forcedotcom/sfdx-core/compare/v2.28.1...v2.28.2) (2021-10-13)
307
+
308
+ ### Bug Fixes
309
+
310
+ - support for .mil sandboxes ([9ef35c7](https://github.com/forcedotcom/sfdx-core/commit/9ef35c7b1ef0fe974c3bd3b89b862a436e00f7d9))
311
+
218
312
  ### [2.28.1](https://github.com/forcedotcom/sfdx-core/compare/v2.28.0...v2.28.1) (2021-10-06)
219
313
 
220
314
  ### 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
  }
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  import { Dictionary, Nullable } from '@salesforce/ts-types';
2
3
  import { Env } from '@salesforce/kit';
3
4
  export declare enum EnvironmentVariable {
@@ -35,6 +36,11 @@ export declare enum EnvironmentVariable {
35
36
  'SFDX_SOURCE_MEMBER_POLLING_TIMEOUT' = "SFDX_SOURCE_MEMBER_POLLING_TIMEOUT",
36
37
  'SFDX_USE_GENERIC_UNIX_KEYCHAIN' = "SFDX_USE_GENERIC_UNIX_KEYCHAIN",
37
38
  'SFDX_USE_PROGRESS_BAR' = "SFDX_USE_PROGRESS_BAR",
39
+ 'SFDX_LAZY_LOAD_MODULES' = "SFDX_LAZY_LOAD_MODULES",
40
+ 'SFDX_S3_HOST' = "SFDX_S3_HOST",
41
+ 'SFDX_UPDATE_INSTRUCTIONS' = "SFDX_UPDATE_INSTRUCTIONS",
42
+ 'SFDX_INSTALLER' = "SFDX_INSTALLER",
43
+ 'SFDX_ENV' = "SFDX_ENV",
38
44
  'SF_TARGET_ORG' = "SF_TARGET_ORG",
39
45
  'SF_TARGET_DEV_HUB' = "SF_TARGET_DEV_HUB",
40
46
  'SF_ACCESS_TOKEN' = "SF_ACCESS_TOKEN",
@@ -60,7 +66,12 @@ export declare enum EnvironmentVariable {
60
66
  'SF_PROJECT_AUTOUPDATE_DISABLE_FOR_PACKAGE_VERSION_CREATE' = "SF_PROJECT_AUTOUPDATE_DISABLE_FOR_PACKAGE_VERSION_CREATE",
61
67
  'SF_SOURCE_MEMBER_POLLING_TIMEOUT' = "SF_SOURCE_MEMBER_POLLING_TIMEOUT",
62
68
  'SF_USE_GENERIC_UNIX_KEYCHAIN' = "SF_USE_GENERIC_UNIX_KEYCHAIN",
63
- 'SF_USE_PROGRESS_BAR' = "SF_USE_PROGRESS_BAR"
69
+ 'SF_USE_PROGRESS_BAR' = "SF_USE_PROGRESS_BAR",
70
+ 'SF_LAZY_LOAD_MODULES' = "SF_LAZY_LOAD_MODULES",
71
+ 'SF_S3_HOST' = "SF_S3_HOST",
72
+ 'SF_UPDATE_INSTRUCTIONS' = "SF_UPDATE_INSTRUCTIONS",
73
+ 'SF_INSTALLER' = "SF_INSTALLER",
74
+ 'SF_ENV' = "SF_ENV"
64
75
  }
65
76
  declare type EnvMetaData = {
66
77
  description: string;
@@ -71,11 +82,15 @@ declare type EnvType = {
71
82
  };
72
83
  export declare const SUPPORTED_ENV_VARS: EnvType;
73
84
  export declare class EnvVars extends Env {
74
- constructor();
75
- propertyToEnvName(property: string, prefix?: string): string;
76
- setPropertyFromEnv(property: string, prefix?: string): void;
77
- asDictionary(): Dictionary<string>;
85
+ constructor(env?: NodeJS.ProcessEnv);
86
+ private static defaultPrefix;
87
+ propertyToEnvName(property: string, prefix?: string | undefined): string;
88
+ setPropertyFromEnv(property: string, prefix?: string | undefined): void;
89
+ getPropertyFromEnv<T>(property: string, prefix?: string | undefined): T | undefined;
90
+ asDictionary(): Dictionary<unknown>;
78
91
  asMap(): Map<string, string>;
79
92
  private resolve;
93
+ private get;
80
94
  }
95
+ export declare const envVars: EnvVars;
81
96
  export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EnvVars = exports.SUPPORTED_ENV_VARS = exports.EnvironmentVariable = void 0;
3
+ exports.envVars = exports.EnvVars = exports.SUPPORTED_ENV_VARS = exports.EnvironmentVariable = void 0;
4
4
  /*
5
5
  * Copyright (c) 2020, salesforce.com, inc.
6
6
  * All rights reserved.
@@ -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) {
@@ -50,6 +50,11 @@ var EnvironmentVariable;
50
50
  EnvironmentVariable["SFDX_SOURCE_MEMBER_POLLING_TIMEOUT"] = "SFDX_SOURCE_MEMBER_POLLING_TIMEOUT";
51
51
  EnvironmentVariable["SFDX_USE_GENERIC_UNIX_KEYCHAIN"] = "SFDX_USE_GENERIC_UNIX_KEYCHAIN";
52
52
  EnvironmentVariable["SFDX_USE_PROGRESS_BAR"] = "SFDX_USE_PROGRESS_BAR";
53
+ EnvironmentVariable["SFDX_LAZY_LOAD_MODULES"] = "SFDX_LAZY_LOAD_MODULES";
54
+ EnvironmentVariable["SFDX_S3_HOST"] = "SFDX_S3_HOST";
55
+ EnvironmentVariable["SFDX_UPDATE_INSTRUCTIONS"] = "SFDX_UPDATE_INSTRUCTIONS";
56
+ EnvironmentVariable["SFDX_INSTALLER"] = "SFDX_INSTALLER";
57
+ EnvironmentVariable["SFDX_ENV"] = "SFDX_ENV";
53
58
  EnvironmentVariable["SF_TARGET_ORG"] = "SF_TARGET_ORG";
54
59
  EnvironmentVariable["SF_TARGET_DEV_HUB"] = "SF_TARGET_DEV_HUB";
55
60
  EnvironmentVariable["SF_ACCESS_TOKEN"] = "SF_ACCESS_TOKEN";
@@ -76,8 +81,13 @@ var EnvironmentVariable;
76
81
  EnvironmentVariable["SF_SOURCE_MEMBER_POLLING_TIMEOUT"] = "SF_SOURCE_MEMBER_POLLING_TIMEOUT";
77
82
  EnvironmentVariable["SF_USE_GENERIC_UNIX_KEYCHAIN"] = "SF_USE_GENERIC_UNIX_KEYCHAIN";
78
83
  EnvironmentVariable["SF_USE_PROGRESS_BAR"] = "SF_USE_PROGRESS_BAR";
84
+ EnvironmentVariable["SF_LAZY_LOAD_MODULES"] = "SF_LAZY_LOAD_MODULES";
85
+ EnvironmentVariable["SF_S3_HOST"] = "SF_S3_HOST";
86
+ EnvironmentVariable["SF_UPDATE_INSTRUCTIONS"] = "SF_UPDATE_INSTRUCTIONS";
87
+ EnvironmentVariable["SF_INSTALLER"] = "SF_INSTALLER";
88
+ EnvironmentVariable["SF_ENV"] = "SF_ENV";
79
89
  })(EnvironmentVariable = exports.EnvironmentVariable || (exports.EnvironmentVariable = {}));
80
- const getMessage = (environmentVariable) => messages.getMessage(change_case_1.camelCase(environmentVariable));
90
+ const getMessage = (environmentVariable) => messages.getMessage((0, change_case_1.camelCase)(environmentVariable));
81
91
  exports.SUPPORTED_ENV_VARS = {
82
92
  [EnvironmentVariable.FORCE_SHOW_SPINNER]: {
83
93
  description: getMessage(EnvironmentVariable.FORCE_SHOW_SPINNER),
@@ -197,7 +207,7 @@ exports.SUPPORTED_ENV_VARS = {
197
207
  synonymOf: EnvironmentVariable.SF_PROJECT_AUTOUPDATE_DISABLE_FOR_PACKAGE_CREATE,
198
208
  },
199
209
  [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)),
210
+ description: messages.getMessage((0, change_case_1.camelCase)(EnvironmentVariable.SFDX_PROJECT_AUTOUPDATE_DISABLE_FOR_PACKAGE_VERSION_CREATE)),
201
211
  synonymOf: EnvironmentVariable.SF_PROJECT_AUTOUPDATE_DISABLE_FOR_PACKAGE_VERSION_CREATE,
202
212
  },
203
213
  [EnvironmentVariable.SFDX_REST_DEPLOY]: {
@@ -216,6 +226,26 @@ exports.SUPPORTED_ENV_VARS = {
216
226
  description: getMessage(EnvironmentVariable.SFDX_USE_PROGRESS_BAR),
217
227
  synonymOf: EnvironmentVariable.SF_USE_PROGRESS_BAR,
218
228
  },
229
+ [EnvironmentVariable.SFDX_LAZY_LOAD_MODULES]: {
230
+ description: getMessage(EnvironmentVariable.SFDX_USE_PROGRESS_BAR),
231
+ synonymOf: EnvironmentVariable.SF_LAZY_LOAD_MODULES,
232
+ },
233
+ [EnvironmentVariable.SFDX_S3_HOST]: {
234
+ description: getMessage(EnvironmentVariable.SFDX_S3_HOST),
235
+ synonymOf: EnvironmentVariable.SF_S3_HOST,
236
+ },
237
+ [EnvironmentVariable.SFDX_UPDATE_INSTRUCTIONS]: {
238
+ description: getMessage(EnvironmentVariable.SFDX_UPDATE_INSTRUCTIONS),
239
+ synonymOf: null,
240
+ },
241
+ [EnvironmentVariable.SFDX_INSTALLER]: {
242
+ description: getMessage(EnvironmentVariable.SFDX_INSTALLER),
243
+ synonymOf: null,
244
+ },
245
+ [EnvironmentVariable.SFDX_ENV]: {
246
+ description: getMessage(EnvironmentVariable.SFDX_ENV),
247
+ synonymOf: null,
248
+ },
219
249
  [EnvironmentVariable.SF_TARGET_ORG]: {
220
250
  description: getMessage(EnvironmentVariable.SF_TARGET_ORG),
221
251
  synonymOf: null,
@@ -306,7 +336,7 @@ exports.SUPPORTED_ENV_VARS = {
306
336
  synonymOf: null,
307
337
  },
308
338
  [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)),
339
+ description: messages.getMessage((0, change_case_1.camelCase)(EnvironmentVariable.SF_PROJECT_AUTOUPDATE_DISABLE_FOR_PACKAGE_VERSION_CREATE)),
310
340
  synonymOf: null,
311
341
  },
312
342
  [EnvironmentVariable.SF_SOURCE_MEMBER_POLLING_TIMEOUT]: {
@@ -321,22 +351,53 @@ exports.SUPPORTED_ENV_VARS = {
321
351
  description: getMessage(EnvironmentVariable.SF_USE_PROGRESS_BAR),
322
352
  synonymOf: null,
323
353
  },
354
+ [EnvironmentVariable.SF_LAZY_LOAD_MODULES]: {
355
+ description: getMessage(EnvironmentVariable.SF_LAZY_LOAD_MODULES),
356
+ synonymOf: null,
357
+ },
358
+ [EnvironmentVariable.SF_S3_HOST]: {
359
+ description: getMessage(EnvironmentVariable.SF_S3_HOST),
360
+ synonymOf: null,
361
+ },
362
+ [EnvironmentVariable.SF_UPDATE_INSTRUCTIONS]: {
363
+ description: getMessage(EnvironmentVariable.SF_UPDATE_INSTRUCTIONS),
364
+ synonymOf: null,
365
+ },
366
+ [EnvironmentVariable.SF_INSTALLER]: {
367
+ description: getMessage(EnvironmentVariable.SF_INSTALLER),
368
+ synonymOf: null,
369
+ },
370
+ [EnvironmentVariable.SF_ENV]: {
371
+ description: getMessage(EnvironmentVariable.SF_ENV),
372
+ synonymOf: null,
373
+ },
324
374
  };
325
375
  class EnvVars extends kit_1.Env {
326
- constructor() {
327
- super();
376
+ constructor(env = process.env) {
377
+ super(env);
328
378
  this.resolve();
329
379
  }
330
- propertyToEnvName(property, prefix = 'SFDX_') {
331
- return `${prefix || ''}${change_case_1.snakeCase(property).toUpperCase()}`;
380
+ static defaultPrefix() {
381
+ if (process.argv[0].startsWith('sfdx'))
382
+ return 'SFDX_';
383
+ if (process.argv[0].startsWith('sf'))
384
+ return 'SF_';
385
+ return 'SFDX_';
386
+ }
387
+ propertyToEnvName(property, prefix = EnvVars.defaultPrefix()) {
388
+ return `${prefix || ''}${(0, change_case_1.snakeCase)(property).toUpperCase()}`;
332
389
  }
333
- setPropertyFromEnv(property, prefix = 'SFDX_') {
390
+ setPropertyFromEnv(property, prefix = EnvVars.defaultPrefix()) {
334
391
  const envName = this.propertyToEnvName(property, prefix);
335
392
  const value = this.getString(envName);
336
393
  if (value) {
337
394
  this.setString(property, value);
338
395
  }
339
396
  }
397
+ getPropertyFromEnv(property, prefix = EnvVars.defaultPrefix()) {
398
+ const envName = this.propertyToEnvName(property, prefix);
399
+ return this.get(envName);
400
+ }
340
401
  asDictionary() {
341
402
  return this.entries().reduce((accumulator, [key, value]) => {
342
403
  accumulator[key] = value;
@@ -363,6 +424,10 @@ class EnvVars extends kit_1.Env {
363
424
  }
364
425
  });
365
426
  }
427
+ get(envName) {
428
+ return this.asDictionary()[envName];
429
+ }
366
430
  }
367
431
  exports.EnvVars = EnvVars;
432
+ exports.envVars = new EnvVars();
368
433
  //# sourceMappingURL=envVars.js.map
@@ -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
  }