@salesforce/core 3.7.5 → 3.7.8

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 (79) hide show
  1. package/CHANGELOG.md +219 -0
  2. package/README.md +4 -4
  3. package/lib/config/config.d.ts +7 -5
  4. package/lib/config/config.js +14 -9
  5. package/lib/config/configAggregator.d.ts +2 -2
  6. package/lib/config/configAggregator.js +2 -2
  7. package/lib/config/configFile.d.ts +2 -2
  8. package/lib/config/configFile.js +22 -20
  9. package/lib/config/configStore.js +7 -6
  10. package/lib/config/keychainConfig.js +4 -3
  11. package/lib/crypto/keyChainImpl.js +12 -11
  12. package/lib/deviceOauthService.js +2 -2
  13. package/lib/exported.d.ts +6 -5
  14. package/lib/exported.js +11 -7
  15. package/lib/global.js +2 -2
  16. package/lib/globalInfo/accessors/aliasAccessor.js +2 -2
  17. package/lib/globalInfo/sfdxDataHandler.d.ts +1 -1
  18. package/lib/globalInfo/sfdxDataHandler.js +5 -4
  19. package/lib/lifecycleEvents.js +1 -1
  20. package/lib/logger.d.ts +3 -3
  21. package/lib/logger.js +20 -19
  22. package/lib/messages.d.ts +42 -3
  23. package/lib/messages.js +55 -12
  24. package/lib/org/authInfo.d.ts +1 -1
  25. package/lib/org/authInfo.js +8 -9
  26. package/lib/org/authRemover.d.ts +2 -2
  27. package/lib/org/authRemover.js +2 -2
  28. package/lib/org/connection.d.ts +7 -2
  29. package/lib/org/connection.js +17 -4
  30. package/lib/org/org.d.ts +16 -6
  31. package/lib/org/org.js +54 -51
  32. package/lib/org/permissionSetAssignment.js +2 -2
  33. package/lib/org/scratchOrgCreate.d.ts +43 -0
  34. package/lib/org/scratchOrgCreate.js +142 -0
  35. package/lib/org/scratchOrgErrorCodes.d.ts +4 -0
  36. package/lib/org/scratchOrgErrorCodes.js +62 -0
  37. package/lib/org/scratchOrgFeatureDeprecation.d.ts +26 -0
  38. package/lib/org/scratchOrgFeatureDeprecation.js +110 -0
  39. package/lib/org/scratchOrgInfoApi.d.ts +94 -0
  40. package/lib/org/scratchOrgInfoApi.js +350 -0
  41. package/lib/org/scratchOrgInfoGenerator.d.ts +63 -0
  42. package/lib/org/scratchOrgInfoGenerator.js +223 -0
  43. package/lib/org/scratchOrgSettingsGenerator.d.ts +56 -0
  44. package/lib/org/scratchOrgSettingsGenerator.js +210 -0
  45. package/lib/org/user.js +8 -7
  46. package/lib/schema/printer.js +2 -2
  47. package/lib/schema/validator.d.ts +4 -4
  48. package/lib/schema/validator.js +13 -13
  49. package/lib/{sfdxError.d.ts → sfError.d.ts} +14 -14
  50. package/lib/{sfdxError.js → sfError.js} +20 -21
  51. package/lib/{sfdxProject.d.ts → sfProject.d.ts} +37 -27
  52. package/lib/{sfdxProject.js → sfProject.js} +77 -65
  53. package/lib/status/pollingClient.d.ts +2 -2
  54. package/lib/status/pollingClient.js +10 -4
  55. package/lib/status/streamingClient.d.ts +1 -1
  56. package/lib/status/streamingClient.js +6 -6
  57. package/lib/testSetup.d.ts +4 -4
  58. package/lib/testSetup.js +8 -8
  59. package/lib/util/internal.d.ts +28 -2
  60. package/lib/util/internal.js +64 -6
  61. package/lib/util/jsonXmlTools.d.ts +14 -0
  62. package/lib/util/jsonXmlTools.js +41 -0
  63. package/lib/util/mapKeys.d.ts +14 -0
  64. package/lib/util/mapKeys.js +48 -0
  65. package/lib/util/sfdcUrl.d.ts +2 -2
  66. package/lib/util/sfdcUrl.js +2 -2
  67. package/lib/util/zipWriter.d.ts +14 -0
  68. package/lib/util/zipWriter.js +68 -0
  69. package/lib/webOAuthServer.js +11 -11
  70. package/messages/org.md +4 -0
  71. package/messages/scratchOrgCreate.md +27 -0
  72. package/messages/scratchOrgErrorCodes.md +99 -0
  73. package/messages/scratchOrgFeatureDeprecation.md +11 -0
  74. package/messages/scratchOrgInfoApi.md +11 -0
  75. package/messages/scratchOrgInfoGenerator.md +19 -0
  76. package/messages/user.md +4 -0
  77. package/package.json +4 -1
  78. package/lib/util/fs.d.ts +0 -201
  79. package/lib/util/fs.js +0 -378
package/CHANGELOG.md CHANGED
@@ -2,6 +2,225 @@
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.8](https://github.com/forcedotcom/sfdx-core/compare/v3.7.7...v3.7.8) (2022-03-03)
6
+
7
+ ### Bug Fixes
8
+
9
+ - add create warning and info convenience functions ([#526](https://github.com/forcedotcom/sfdx-core/issues/526)) ([e3428b3](https://github.com/forcedotcom/sfdx-core/commit/e3428b35e00b9cee3c90153ed6ce08b352535ff7))
10
+
11
+ ### [3.7.7](https://github.com/forcedotcom/sfdx-core/compare/v3.7.6...v3.7.7) (2022-03-01)
12
+
13
+ ### [3.7.6](https://github.com/forcedotcom/sfdx-core/compare/v4.0.0...v3.7.6) (2022-02-28)
14
+
15
+ ## [4.0.0](https://github.com/forcedotcom/sfdx-core/compare/v2.35.2...v4.0.0) (2022-02-28)
16
+
17
+ ### Bug Fixes
18
+
19
+ - work through conflicts, UTs, pushing for comparison ([476c6fe](https://github.com/forcedotcom/sfdx-core/commit/476c6fe13514903ac97f7def2aba39b070ee2c33))
20
+
21
+ ### [3.7.5](https://github.com/forcedotcom/sfdx-core/compare/v2.35.1...v3.7.5) (2022-02-14)
22
+
23
+ ### Bug Fixes
24
+
25
+ - 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))
26
+
27
+ ### [3.7.4](https://github.com/forcedotcom/sfdx-core/compare/v2.35.0...v3.7.4) (2022-02-07)
28
+
29
+ ### Bug Fixes
30
+
31
+ - 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))
32
+
33
+ ### [3.7.3](https://github.com/forcedotcom/sfdx-core/compare/v2.33.1...v3.7.3) (2021-12-16)
34
+
35
+ ### [3.7.2](https://github.com/forcedotcom/sfdx-core/compare/v3.7.1...v3.7.2) (2021-10-28)
36
+
37
+ ### Bug Fixes
38
+
39
+ - make @types/sfdx-faye a dependendcy ([683680b](https://github.com/forcedotcom/sfdx-core/commit/683680b8133048f71d25ef4df7aa24d9700dc5e8))
40
+
41
+ ### [3.7.1](https://github.com/forcedotcom/sfdx-core/compare/v2.28.2...v3.7.1) (2021-10-28)
42
+
43
+ ## [3.7.0](https://github.com/forcedotcom/sfdx-core/compare/v3.6.6...v3.7.0) (2021-10-12)
44
+
45
+ ### Features
46
+
47
+ - use jsforce v2 ([#457](https://github.com/forcedotcom/sfdx-core/issues/457)) ([4a9094e](https://github.com/forcedotcom/sfdx-core/commit/4a9094e958288cdcc6c69f5d87b10a70a437d8e9))
48
+
49
+ ### [3.6.6](https://github.com/forcedotcom/sfdx-core/compare/v2.28.1...v3.6.6) (2021-10-08)
50
+
51
+ ### [3.6.5](https://github.com/forcedotcom/sfdx-core/compare/v3.6.4...v3.6.5) (2021-09-29)
52
+
53
+ ### Bug Fixes
54
+
55
+ - add getValue to AliasAccessor ([c4b69f5](https://github.com/forcedotcom/sfdx-core/commit/c4b69f5ff38547fad640c64833291fe0c6e06a79))
56
+
57
+ ### [3.6.4](https://github.com/forcedotcom/sfdx-core/compare/v3.6.3...v3.6.4) (2021-09-23)
58
+
59
+ ### Bug Fixes
60
+
61
+ - edit the env var blurbs ([#482](https://github.com/forcedotcom/sfdx-core/issues/482)) ([bbbdb6d](https://github.com/forcedotcom/sfdx-core/commit/bbbdb6d0800015e94ce0f0c551eec8ed73dd87c6))
62
+
63
+ ### [3.6.3](https://github.com/forcedotcom/sfdx-core/compare/v3.6.2...v3.6.3) (2021-09-23)
64
+
65
+ ### Bug Fixes
66
+
67
+ - edit the config var blurbs ([#480](https://github.com/forcedotcom/sfdx-core/issues/480)) ([f845512](https://github.com/forcedotcom/sfdx-core/commit/f8455121bfd96f27495bc124dc06570632dfce70))
68
+
69
+ ### [3.6.2](https://github.com/forcedotcom/sfdx-core/compare/v2.28.0...v3.6.2) (2021-09-17)
70
+
71
+ ### Bug Fixes
72
+
73
+ - improve time to build auths for many orgs @W-9914839@ ([#478](https://github.com/forcedotcom/sfdx-core/issues/478)) ([c788541](https://github.com/forcedotcom/sfdx-core/commit/c7885415d59994b28552227f0b84dcee5d3ec7cf))
74
+
75
+ ### [3.6.1](https://github.com/forcedotcom/sfdx-core/compare/v3.6.0...v3.6.1) (2021-09-13)
76
+
77
+ ### Bug Fixes
78
+
79
+ - remove tokens associated with org ([#477](https://github.com/forcedotcom/sfdx-core/issues/477)) ([5034fa2](https://github.com/forcedotcom/sfdx-core/commit/5034fa2d4c52d347c00499e137a71366e4feba7f))
80
+
81
+ ## [3.6.0](https://github.com/forcedotcom/sfdx-core/compare/v3.5.0...v3.6.0) (2021-09-10)
82
+
83
+ ### Features
84
+
85
+ - add help section helper ([#474](https://github.com/forcedotcom/sfdx-core/issues/474)) ([b34c2d7](https://github.com/forcedotcom/sfdx-core/commit/b34c2d7a442aed2cf091fd394a7c3656287d1dbf))
86
+
87
+ ## [3.5.0](https://github.com/forcedotcom/sfdx-core/compare/v3.4.5...v3.5.0) (2021-09-09)
88
+
89
+ ### Features
90
+
91
+ - expose well known env vars as part of core ([#473](https://github.com/forcedotcom/sfdx-core/issues/473)) ([11c3f53](https://github.com/forcedotcom/sfdx-core/commit/11c3f53f964459072826274e6ebb33d4a9ecb990))
92
+
93
+ ### [3.4.5](https://github.com/forcedotcom/sfdx-core/compare/v3.4.4...v3.4.5) (2021-09-03)
94
+
95
+ ### Bug Fixes
96
+
97
+ - provide the correct options to SfdxConfig ([fa2117e](https://github.com/forcedotcom/sfdx-core/commit/fa2117e12d7a903f26067bdcf35d7ec9c142101e))
98
+
99
+ ### [3.4.4](https://github.com/forcedotcom/sfdx-core/compare/v3.4.3...v3.4.4) (2021-09-03)
100
+
101
+ ### [3.4.3](https://github.com/forcedotcom/sfdx-core/compare/v3.4.2...v3.4.3) (2021-08-26)
102
+
103
+ ### [3.4.2](https://github.com/forcedotcom/sfdx-core/compare/v3.4.1...v3.4.2) (2021-08-17)
104
+
105
+ ### Bug Fixes
106
+
107
+ - improve interoperability when unsetting ([#467](https://github.com/forcedotcom/sfdx-core/issues/467)) ([ad781d5](https://github.com/forcedotcom/sfdx-core/commit/ad781d5378652dfd64ccb476c11f418e940b8669))
108
+
109
+ ### [3.4.1](https://github.com/forcedotcom/sfdx-core/compare/v3.4.0...v3.4.1) (2021-08-11)
110
+
111
+ ### Bug Fixes
112
+
113
+ - optionally throw error when reading deprecated config key ([#466](https://github.com/forcedotcom/sfdx-core/issues/466)) ([3118ad8](https://github.com/forcedotcom/sfdx-core/commit/3118ad836db384ac27c2b1db88c4753e6121e4db))
114
+
115
+ ## [3.4.0](https://github.com/forcedotcom/sfdx-core/compare/v3.3.12...v3.4.0) (2021-08-11)
116
+
117
+ ### Features
118
+
119
+ - config interoperability ([#461](https://github.com/forcedotcom/sfdx-core/issues/461)) ([11b60ad](https://github.com/forcedotcom/sfdx-core/commit/11b60adbe54acc8e16a90327c77abbe2613fbaab))
120
+
121
+ ### [3.3.12](https://github.com/forcedotcom/sfdx-core/compare/v2.27.2...v3.3.12) (2021-08-10)
122
+
123
+ ### Bug Fixes
124
+
125
+ - add predicate function to list all auths ([ccdb02c](https://github.com/forcedotcom/sfdx-core/commit/ccdb02c268fae7532b23e0c791bcdd831f77cf98))
126
+
127
+ ### [3.3.11](https://github.com/forcedotcom/sfdx-core/compare/v3.3.10...v3.3.11) (2021-08-04)
128
+
129
+ ### Bug Fixes
130
+
131
+ - allows for message keys of error and errors ([#455](https://github.com/forcedotcom/sfdx-core/issues/455)) ([3bfac58](https://github.com/forcedotcom/sfdx-core/commit/3bfac587c6cf1734af6f2b517439d278591ddd50))
132
+
133
+ ### [3.3.10](https://github.com/forcedotcom/sfdx-core/compare/v3.3.9...v3.3.10) (2021-08-04)
134
+
135
+ ### [3.3.9](https://github.com/forcedotcom/sfdx-core/compare/v3.3.8...v3.3.9) (2021-08-04)
136
+
137
+ ### Bug Fixes
138
+
139
+ - merge main(v2) into v3 ([#452](https://github.com/forcedotcom/sfdx-core/issues/452)) ([3a003b9](https://github.com/forcedotcom/sfdx-core/commit/3a003b9c17962f77344e4a23314bb608e1ae50db))
140
+
141
+ ### [3.3.8](https://github.com/forcedotcom/sfdx-core/compare/v3.3.7...v3.3.8) (2021-08-02)
142
+
143
+ ### Bug Fixes
144
+
145
+ - return all info from AuthInfo.listAllAuthorizations ([#449](https://github.com/forcedotcom/sfdx-core/issues/449)) ([17e60ea](https://github.com/forcedotcom/sfdx-core/commit/17e60eabe87c73a83c26344967076f365ddea81c))
146
+
147
+ ### [3.3.7](https://github.com/forcedotcom/sfdx-core/compare/v2.27.0...v3.3.7) (2021-07-30)
148
+
149
+ ### [3.3.6](https://github.com/forcedotcom/sfdx-core/compare/v3.3.5...v3.3.6) (2021-07-28)
150
+
151
+ ### Bug Fixes
152
+
153
+ - use correct method to get username ([#446](https://github.com/forcedotcom/sfdx-core/issues/446)) ([79a6b2f](https://github.com/forcedotcom/sfdx-core/commit/79a6b2f069f95b0c50a6c03ecbac07cf0d1832b1))
154
+
155
+ ### [3.3.5](https://github.com/forcedotcom/sfdx-core/compare/v3.3.4...v3.3.5) (2021-07-28)
156
+
157
+ ### [3.3.4](https://github.com/forcedotcom/sfdx-core/compare/v3.3.3...v3.3.4) (2021-07-26)
158
+
159
+ ### Bug Fixes
160
+
161
+ - remove bad validator function ([1b97dc6](https://github.com/forcedotcom/sfdx-core/commit/1b97dc6f4d657a5b86489d33c4843ebfd54b3715))
162
+
163
+ ### [3.3.3](https://github.com/forcedotcom/sfdx-core/compare/v3.3.2...v3.3.3) (2021-07-22)
164
+
165
+ ### Bug Fixes
166
+
167
+ - write sf.json contents on init ([c47f649](https://github.com/forcedotcom/sfdx-core/commit/c47f64954118d0d2f7f4a8e992d3450516239084))
168
+
169
+ ### [3.3.2](https://github.com/forcedotcom/sfdx-core/compare/v2.26.1...v3.3.2) (2021-07-21)
170
+
171
+ ### Bug Fixes
172
+
173
+ - correct jsdoc ([a362e94](https://github.com/forcedotcom/sfdx-core/commit/a362e94c4ae7538cbbcd7dae8fcd3244629d845c))
174
+
175
+ ### [3.3.1](https://github.com/forcedotcom/sfdx-core/compare/v3.3.0...v3.3.1) (2021-07-15)
176
+
177
+ ### Bug Fixes
178
+
179
+ - temporarily point Alias back to .sfdx ([#438](https://github.com/forcedotcom/sfdx-core/issues/438)) ([4bffcd8](https://github.com/forcedotcom/sfdx-core/commit/4bffcd84362d5b3049ef428e90dc1b538a435f81))
180
+
181
+ ## [3.3.0](https://github.com/forcedotcom/sfdx-core/compare/v3.2.0-v3.0...v3.3.0) (2021-07-14)
182
+
183
+ ### Features
184
+
185
+ - V3 merge ([#436](https://github.com/forcedotcom/sfdx-core/issues/436)) ([1193449](https://github.com/forcedotcom/sfdx-core/commit/119344969147679088e30bae4c4fc5e941661078)), closes [#413](https://github.com/forcedotcom/sfdx-core/issues/413) [#415](https://github.com/forcedotcom/sfdx-core/issues/415) [#428](https://github.com/forcedotcom/sfdx-core/issues/428) [#429](https://github.com/forcedotcom/sfdx-core/issues/429) [#427](https://github.com/forcedotcom/sfdx-core/issues/427) [#432](https://github.com/forcedotcom/sfdx-core/issues/432)
186
+
187
+ ## [3.2.0-v3.0](https://github.com/forcedotcom/sfdx-core/compare/v2.26.0...v3.2.0-v3.0) (2021-07-14)
188
+
189
+ ### Features
190
+
191
+ - use .sf/config.json @W-9546117@ ([#433](https://github.com/forcedotcom/sfdx-core/issues/433)) ([6c41653](https://github.com/forcedotcom/sfdx-core/commit/6c416531a9bae10e855ded3efc289a99196bc26b))
192
+
193
+ ### [3.1.1-v3.2](https://github.com/forcedotcom/sfdx-core/compare/v2.24.2...v3.1.1-v3.2) (2021-06-29)
194
+
195
+ ### Bug Fixes
196
+
197
+ - do not use function prop ([#426](https://github.com/forcedotcom/sfdx-core/issues/426)) ([39efe0c](https://github.com/forcedotcom/sfdx-core/commit/39efe0ccc84b05bc891e54b24bfcddc62790ae0e))
198
+
199
+ ### [3.1.1-v3.1](https://github.com/forcedotcom/sfdx-core/compare/v2.24.0...v3.1.1-v3.1) (2021-06-14)
200
+
201
+ ### Bug Fixes
202
+
203
+ - keep track of auth changes ([210be6c](https://github.com/forcedotcom/sfdx-core/commit/210be6cb408bd9ecc861989570df0e14f6a3a566))
204
+
205
+ ### [3.1.1-v3.0](https://github.com/forcedotcom/sfdx-core/compare/v2.23.3...v3.1.1-v3.0) (2021-06-03)
206
+
207
+ ### ⚠ BREAKING CHANGES
208
+
209
+ - default to reading files from cache
210
+
211
+ ### Features
212
+
213
+ - add GlobalInfo config file ([#397](https://github.com/forcedotcom/sfdx-core/issues/397)) ([889425c](https://github.com/forcedotcom/sfdx-core/commit/889425c06e8ed6a364d9a2bc3dd5ef0a38a66046))
214
+ - add message support for markdown files ([0f235a2](https://github.com/forcedotcom/sfdx-core/commit/0f235a23d5dddbd7b3f07544d8c7e380875c6c55))
215
+ - default to reading files from cache ([558319d](https://github.com/forcedotcom/sfdx-core/commit/558319dfdc81e2bae549d58be75a701162801994))
216
+ - move crypto to config file @W-9225317@ ([#406](https://github.com/forcedotcom/sfdx-core/issues/406)) ([bac83c3](https://github.com/forcedotcom/sfdx-core/commit/bac83c3a52b15c9b462dfb68be9d080e710493cd))
217
+
218
+ ### Bug Fixes
219
+
220
+ - compilation errors ([33a9876](https://github.com/forcedotcom/sfdx-core/commit/33a9876575eff7944bb287d428f52413831725d9))
221
+ - unit test failures ([4507575](https://github.com/forcedotcom/sfdx-core/commit/45075754175d411b6cb71eb809096e6eb3e23d95))
222
+ - unsetAuthorization ([#399](https://github.com/forcedotcom/sfdx-core/issues/399)) ([dd57438](https://github.com/forcedotcom/sfdx-core/commit/dd57438a95b49515f560d3b915cdf916a4b8643b))
223
+
5
224
  ### [3.7.5](https://github.com/forcedotcom/sfdx-core/compare/v3.7.4...v3.7.5) (2022-02-14)
6
225
 
7
226
  ### Bug Fixes
package/README.md CHANGED
@@ -52,7 +52,7 @@ describe('Mocking Auth data', () => {
52
52
  After having a valid AuthInfo object you can then create fake connections to a Salesforce.com scratch org. This allows for writing tests that can validate result responses for SOQL queries and REST endpoints.
53
53
 
54
54
  ```typescript
55
- import { AuthInfo, Connection, SfdxError } from '@salesforce/core';
55
+ import { AuthInfo, Connection, SfError } from '@salesforce/core';
56
56
  import { MockTestOrgData, testSetup } from '@salesforce/core/lib/testSetup';
57
57
  import { AnyJson, ensureJsonMap, JsonMap } from '@salesforce/ts-types';
58
58
  import { ensureString } from '@salesforce/ts-types';
@@ -77,7 +77,7 @@ describe('Mocking a force server call', () => {
77
77
  if (request && ensureString(_request.url).includes('Account')) {
78
78
  return Promise.resolve(records);
79
79
  } else {
80
- return Promise.reject(new SfdxError(`Unexpected request: ${_request.url}`));
80
+ return Promise.reject(new SfError(`Unexpected request: ${_request.url}`));
81
81
  }
82
82
  };
83
83
  const connection: Connection = await Connection.create({
@@ -117,13 +117,13 @@ describe('Using the built in Sinon sandbox.', () => {
117
117
  It's important to have negative tests that ensure proper error handling. With `shouldThrow` it's easy to test for expected async rejections.
118
118
 
119
119
  ```typescript
120
- import { SfdxError } from '@salesforce/core';
120
+ import { SfError } from '@salesforce/core';
121
121
  import { shouldThrow } from '@salesforce/core/lib/testSetup';
122
122
  import { strictEqual } from 'assert';
123
123
 
124
124
  class TestObject {
125
125
  public static async method() {
126
- throw new SfdxError('Error', 'ExpectedError');
126
+ throw new SfError('Error', 'ExpectedError');
127
127
  }
128
128
  }
129
129
 
@@ -56,12 +56,14 @@ export declare enum SfdxPropertyKeys {
56
56
  * Username associated with the default dev hub org.
57
57
  *
58
58
  * @deprecated Replaced by OrgConfigProperties.TARGET_DEV_HUB in v3 {@link https://github.com/forcedotcom/sfdx-core/blob/v3/MIGRATING_V2-V3.md#config}
59
+ * will remain in v3 for the foreseeable future so that `sfdx-core` can map between `sf` and `sfdx` config values
59
60
  */
60
61
  DEFAULT_DEV_HUB_USERNAME = "defaultdevhubusername",
61
62
  /**
62
63
  * Username associate with the default org.
63
64
  *
64
65
  * @deprecated Replaced by OrgConfigProperties.TARGET_ORG in v3 {@link https://github.com/forcedotcom/sfdx-core/blob/v3/MIGRATING_V2-V3.md#config}
66
+ * will remain in v3 for the foreseeable future so that `sfdx-core` can map between `sf` and `sfdx` config values
65
67
  */
66
68
  DEFAULT_USERNAME = "defaultusername",
67
69
  /**
@@ -202,7 +204,7 @@ export declare class Config extends ConfigFile<ConfigFile.Options, ConfigPropert
202
204
  * DO NOT CALL - The config file needs to encrypt values which can only be done asynchronously.
203
205
  * Call {@link SfdxConfig.write} instead.
204
206
  *
205
- * **Throws** *{@link SfdxError}{ name: 'InvalidWriteError' }* Always.
207
+ * **Throws** *{@link SfError}{ name: 'InvalidWriteError' }* Always.
206
208
  *
207
209
  * @param newContents Contents to write
208
210
  */
@@ -210,8 +212,8 @@ export declare class Config extends ConfigFile<ConfigFile.Options, ConfigPropert
210
212
  /**
211
213
  * Sets a value for a property.
212
214
  *
213
- * **Throws** *{@link SfdxError}{ name: 'UnknownConfigKeyError' }* An attempt to get a property that's not supported.
214
- * **Throws** *{@link SfdxError}{ name: 'InvalidConfigValueError' }* If the input validator fails.
215
+ * **Throws** *{@link SfError}{ name: 'UnknownConfigKeyError' }* An attempt to get a property that's not supported.
216
+ * **Throws** *{@link SfError}{ name: 'InvalidConfigValueError' }* If the input validator fails.
215
217
  *
216
218
  * @param key The property to set.
217
219
  * @param value The value of the property.
@@ -220,7 +222,7 @@ export declare class Config extends ConfigFile<ConfigFile.Options, ConfigPropert
220
222
  /**
221
223
  * Unsets a value for a property.
222
224
  *
223
- * **Throws** *{@link SfdxError}{ name: 'UnknownConfigKeyError' }* If the input validator fails.
225
+ * **Throws** *{@link SfError}{ name: 'UnknownConfigKeyError' }* If the input validator fails.
224
226
  *
225
227
  * @param key The property to unset.
226
228
  */
@@ -228,7 +230,7 @@ export declare class Config extends ConfigFile<ConfigFile.Options, ConfigPropert
228
230
  /**
229
231
  * Get an individual property config.
230
232
  *
231
- * **Throws** *{@link SfdxError}{ name: 'UnknownConfigKeyError' }* An attempt to get a property that's not supported.
233
+ * **Throws** *{@link SfError}{ name: 'UnknownConfigKeyError' }* An attempt to get a property that's not supported.
232
234
  *
233
235
  * @param propertyName The name of the property.
234
236
  */
@@ -8,13 +8,14 @@
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.Config = exports.SfProperty = exports.SFDX_ALLOWED_PROPERTIES = exports.SfdxPropertyKeys = void 0;
10
10
  const path_1 = require("path");
11
+ const fs = require("fs");
11
12
  const kit_1 = require("@salesforce/kit");
12
13
  const ts_types_1 = require("@salesforce/ts-types");
14
+ const mkdirp = require("mkdirp");
13
15
  const global_1 = require("../global");
14
16
  const logger_1 = require("../logger");
15
17
  const messages_1 = require("../messages");
16
18
  const sfdc_1 = require("../util/sfdc");
17
- const fs_1 = require("../util/fs");
18
19
  const sfdcUrl_1 = require("../util/sfdcUrl");
19
20
  const orgConfigProperties_1 = require("../org/orgConfigProperties");
20
21
  const configFile_1 = require("./configFile");
@@ -49,12 +50,14 @@ var SfdxPropertyKeys;
49
50
  * Username associated with the default dev hub org.
50
51
  *
51
52
  * @deprecated Replaced by OrgConfigProperties.TARGET_DEV_HUB in v3 {@link https://github.com/forcedotcom/sfdx-core/blob/v3/MIGRATING_V2-V3.md#config}
53
+ * will remain in v3 for the foreseeable future so that `sfdx-core` can map between `sf` and `sfdx` config values
52
54
  */
53
55
  SfdxPropertyKeys["DEFAULT_DEV_HUB_USERNAME"] = "defaultdevhubusername";
54
56
  /**
55
57
  * Username associate with the default org.
56
58
  *
57
59
  * @deprecated Replaced by OrgConfigProperties.TARGET_ORG in v3 {@link https://github.com/forcedotcom/sfdx-core/blob/v3/MIGRATING_V2-V3.md#config}
60
+ * will remain in v3 for the foreseeable future so that `sfdx-core` can map between `sf` and `sfdx` config values
58
61
  */
59
62
  SfdxPropertyKeys["DEFAULT_USERNAME"] = "defaultusername";
60
63
  /**
@@ -115,12 +118,14 @@ exports.SFDX_ALLOWED_PROPERTIES = [
115
118
  },
116
119
  },
117
120
  {
121
+ // will remain in v3 for the foreseeable future so that `sfdx-core` can map between `sf` and `sfdx` config values
118
122
  key: SfdxPropertyKeys.DEFAULT_DEV_HUB_USERNAME,
119
123
  newKey: orgConfigProperties_1.OrgConfigProperties.TARGET_DEV_HUB,
120
124
  deprecated: true,
121
125
  description: messages.getMessage('defaultDevHubUsername'),
122
126
  },
123
127
  {
128
+ // will remain in v3 for the foreseeable future so that `sfdx-core` can map between `sf` and `sfdx` config values
124
129
  key: SfdxPropertyKeys.DEFAULT_USERNAME,
125
130
  newKey: orgConfigProperties_1.OrgConfigProperties.TARGET_ORG,
126
131
  deprecated: true,
@@ -308,7 +313,7 @@ class Config extends configFile_1.ConfigFile {
308
313
  * DO NOT CALL - The config file needs to encrypt values which can only be done asynchronously.
309
314
  * Call {@link SfdxConfig.write} instead.
310
315
  *
311
- * **Throws** *{@link SfdxError}{ name: 'InvalidWriteError' }* Always.
316
+ * **Throws** *{@link SfError}{ name: 'InvalidWriteError' }* Always.
312
317
  *
313
318
  * @param newContents Contents to write
314
319
  */
@@ -319,8 +324,8 @@ class Config extends configFile_1.ConfigFile {
319
324
  /**
320
325
  * Sets a value for a property.
321
326
  *
322
- * **Throws** *{@link SfdxError}{ name: 'UnknownConfigKeyError' }* An attempt to get a property that's not supported.
323
- * **Throws** *{@link SfdxError}{ name: 'InvalidConfigValueError' }* If the input validator fails.
327
+ * **Throws** *{@link SfError}{ name: 'UnknownConfigKeyError' }* An attempt to get a property that's not supported.
328
+ * **Throws** *{@link SfError}{ name: 'InvalidConfigValueError' }* If the input validator fails.
324
329
  *
325
330
  * @param key The property to set.
326
331
  * @param value The value of the property.
@@ -355,7 +360,7 @@ class Config extends configFile_1.ConfigFile {
355
360
  /**
356
361
  * Unsets a value for a property.
357
362
  *
358
- * **Throws** *{@link SfdxError}{ name: 'UnknownConfigKeyError' }* If the input validator fails.
363
+ * **Throws** *{@link SfError}{ name: 'UnknownConfigKeyError' }* If the input validator fails.
359
364
  *
360
365
  * @param key The property to unset.
361
366
  */
@@ -372,7 +377,7 @@ class Config extends configFile_1.ConfigFile {
372
377
  /**
373
378
  * Get an individual property config.
374
379
  *
375
- * **Throws** *{@link SfdxError}{ name: 'UnknownConfigKeyError' }* An attempt to get a property that's not supported.
380
+ * **Throws** *{@link SfError}{ name: 'UnknownConfigKeyError' }* An attempt to get a property that's not supported.
376
381
  *
377
382
  * @param propertyName The name of the property.
378
383
  */
@@ -446,7 +451,7 @@ class SfdxConfig {
446
451
  }
447
452
  readSync() {
448
453
  try {
449
- const contents = fs_1.fs.readJsonMapSync(this.getSfdxPath());
454
+ const contents = (0, kit_1.parseJsonMap)(fs.readFileSync(this.getSfdxPath(), 'utf8'));
450
455
  return this.normalize(contents, 'toNew');
451
456
  }
452
457
  catch (error) {
@@ -457,9 +462,9 @@ class SfdxConfig {
457
462
  async writeSync(config = this.config.toObject()) {
458
463
  try {
459
464
  const sfdxPath = this.getSfdxPath();
460
- await fs_1.fs.mkdirp((0, path_1.dirname)(sfdxPath));
465
+ await mkdirp((0, path_1.dirname)(sfdxPath));
461
466
  const mapped = this.normalize(config, 'toOld');
462
- await fs_1.fs.writeJson(sfdxPath, mapped);
467
+ await fs.promises.writeFile(sfdxPath, JSON.stringify(mapped, null, 2));
463
468
  }
464
469
  catch (error) {
465
470
  /* Do nothing */
@@ -88,7 +88,7 @@ export declare class ConfigAggregator extends AsyncOptionalCreatable<JsonMap> {
88
88
  /**
89
89
  * Get a resolved config property.
90
90
  *
91
- * **Throws** *{@link SfdxError}{ name: 'UnknownConfigKeyError' }* An attempt to get a property that's not supported.
91
+ * **Throws** *{@link SfError}{ name: 'UnknownConfigKeyError' }* An attempt to get a property that's not supported.
92
92
  *
93
93
  * @param key The key of the property.
94
94
  */
@@ -96,7 +96,7 @@ export declare class ConfigAggregator extends AsyncOptionalCreatable<JsonMap> {
96
96
  /**
97
97
  * Get a resolved config property meta.
98
98
  *
99
- * **Throws** *{@link SfdxError}{ name: 'UnknownConfigKeyError' }* An attempt to get a property that's not supported.
99
+ * **Throws** *{@link SfError}{ name: 'UnknownConfigKeyError' }* An attempt to get a property that's not supported.
100
100
  *
101
101
  * @param key The key of the property.
102
102
  */
@@ -100,7 +100,7 @@ class ConfigAggregator extends kit_1.AsyncOptionalCreatable {
100
100
  /**
101
101
  * Get a resolved config property.
102
102
  *
103
- * **Throws** *{@link SfdxError}{ name: 'UnknownConfigKeyError' }* An attempt to get a property that's not supported.
103
+ * **Throws** *{@link SfError}{ name: 'UnknownConfigKeyError' }* An attempt to get a property that's not supported.
104
104
  *
105
105
  * @param key The key of the property.
106
106
  */
@@ -115,7 +115,7 @@ class ConfigAggregator extends kit_1.AsyncOptionalCreatable {
115
115
  /**
116
116
  * Get a resolved config property meta.
117
117
  *
118
- * **Throws** *{@link SfdxError}{ name: 'UnknownConfigKeyError' }* An attempt to get a property that's not supported.
118
+ * **Throws** *{@link SfError}{ name: 'UnknownConfigKeyError' }* An attempt to get a property that's not supported.
119
119
  *
120
120
  * @param key The key of the property.
121
121
  */
@@ -78,7 +78,7 @@ export declare class ConfigFile<T extends ConfigFile.Options = ConfigFile.Option
78
78
  * Read the config file and set the config contents. Returns the config contents of the config file. As an
79
79
  * optimization, files are only read once per process and updated in memory and via `write()`. To force
80
80
  * a read from the filesystem pass `force=true`.
81
- * **Throws** *{@link SfdxError}{ name: 'UnexpectedJsonFileFormat' }* There was a problem reading or parsing the file.
81
+ * **Throws** *{@link SfError}{ name: 'UnexpectedJsonFileFormat' }* There was a problem reading or parsing the file.
82
82
  *
83
83
  * @param [throwOnNotFound = false] Optionally indicate if a throw should occur on file read.
84
84
  * @param [force = false] Optionally force the file to be read from disk even when already read within the process.
@@ -88,7 +88,7 @@ export declare class ConfigFile<T extends ConfigFile.Options = ConfigFile.Option
88
88
  * Read the config file and set the config contents. Returns the config contents of the config file. As an
89
89
  * optimization, files are only read once per process and updated in memory and via `write()`. To force
90
90
  * a read from the filesystem pass `force=true`.
91
- * **Throws** *{@link SfdxError}{ name: 'UnexpectedJsonFileFormat' }* There was a problem reading or parsing the file.
91
+ * **Throws** *{@link SfError}{ name: 'UnexpectedJsonFileFormat' }* There was a problem reading or parsing the file.
92
92
  *
93
93
  * @param [throwOnNotFound = false] Optionally indicate if a throw should occur on file read.
94
94
  * @param [force = false] Optionally force the file to be read from disk even when already read within the process.
@@ -7,14 +7,16 @@
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.ConfigFile = void 0;
10
+ const fs = require("fs");
10
11
  const fs_1 = require("fs");
11
12
  const os_1 = require("os");
12
13
  const path_1 = require("path");
13
14
  const ts_types_1 = require("@salesforce/ts-types");
15
+ const kit_1 = require("@salesforce/kit");
16
+ const mkdirp = require("mkdirp");
14
17
  const global_1 = require("../global");
15
18
  const logger_1 = require("../logger");
16
- const sfdxError_1 = require("../sfdxError");
17
- const fs_2 = require("../util/fs");
19
+ const sfError_1 = require("../sfError");
18
20
  const internal_1 = require("../util/internal");
19
21
  const configStore_1 = require("./configStore");
20
22
  /**
@@ -65,7 +67,7 @@ class ConfigFile extends configStore_1.BaseConfigStore {
65
67
  */
66
68
  static getFileName() {
67
69
  // Can not have abstract static methods, so throw a runtime error.
68
- throw new sfdxError_1.SfdxError('Unknown filename for config file.');
70
+ throw new sfError_1.SfError('Unknown filename for config file.');
69
71
  }
70
72
  /**
71
73
  * Returns the default options for the config file.
@@ -107,7 +109,7 @@ class ConfigFile extends configStore_1.BaseConfigStore {
107
109
  */
108
110
  async access(perm) {
109
111
  try {
110
- await fs_2.fs.access(this.getPath(), perm);
112
+ await fs.promises.access(this.getPath(), perm);
111
113
  return true;
112
114
  }
113
115
  catch (err) {
@@ -124,7 +126,7 @@ class ConfigFile extends configStore_1.BaseConfigStore {
124
126
  */
125
127
  accessSync(perm) {
126
128
  try {
127
- fs_2.fs.accessSync(this.getPath(), perm);
129
+ fs.accessSync(this.getPath(), perm);
128
130
  return true;
129
131
  }
130
132
  catch (err) {
@@ -135,7 +137,7 @@ class ConfigFile extends configStore_1.BaseConfigStore {
135
137
  * Read the config file and set the config contents. Returns the config contents of the config file. As an
136
138
  * optimization, files are only read once per process and updated in memory and via `write()`. To force
137
139
  * a read from the filesystem pass `force=true`.
138
- * **Throws** *{@link SfdxError}{ name: 'UnexpectedJsonFileFormat' }* There was a problem reading or parsing the file.
140
+ * **Throws** *{@link SfError}{ name: 'UnexpectedJsonFileFormat' }* There was a problem reading or parsing the file.
139
141
  *
140
142
  * @param [throwOnNotFound = false] Optionally indicate if a throw should occur on file read.
141
143
  * @param [force = false] Optionally force the file to be read from disk even when already read within the process.
@@ -146,7 +148,7 @@ class ConfigFile extends configStore_1.BaseConfigStore {
146
148
  // internally and updated persistently via write().
147
149
  if (!this.hasRead || force) {
148
150
  this.logger.info(`Reading config file: ${this.getPath()}`);
149
- const obj = await fs_2.fs.readJsonMap(this.getPath());
151
+ const obj = (0, kit_1.parseJsonMap)(await fs.promises.readFile(this.getPath(), 'utf8'));
150
152
  this.setContentsFromObject(obj);
151
153
  }
152
154
  return this.getContents();
@@ -170,7 +172,7 @@ class ConfigFile extends configStore_1.BaseConfigStore {
170
172
  * Read the config file and set the config contents. Returns the config contents of the config file. As an
171
173
  * optimization, files are only read once per process and updated in memory and via `write()`. To force
172
174
  * a read from the filesystem pass `force=true`.
173
- * **Throws** *{@link SfdxError}{ name: 'UnexpectedJsonFileFormat' }* There was a problem reading or parsing the file.
175
+ * **Throws** *{@link SfError}{ name: 'UnexpectedJsonFileFormat' }* There was a problem reading or parsing the file.
174
176
  *
175
177
  * @param [throwOnNotFound = false] Optionally indicate if a throw should occur on file read.
176
178
  * @param [force = false] Optionally force the file to be read from disk even when already read within the process.
@@ -181,7 +183,7 @@ class ConfigFile extends configStore_1.BaseConfigStore {
181
183
  // internally and updated persistently via write().
182
184
  if (!this.hasRead || force) {
183
185
  this.logger.info(`Reading config file: ${this.getPath()}`);
184
- const obj = fs_2.fs.readJsonMapSync(this.getPath());
186
+ const obj = (0, kit_1.parseJsonMap)(fs.readFileSync(this.getPath(), 'utf8'));
185
187
  this.setContentsFromObject(obj);
186
188
  }
187
189
  return this.getContents();
@@ -211,9 +213,9 @@ class ConfigFile extends configStore_1.BaseConfigStore {
211
213
  if (newContents) {
212
214
  this.setContents(newContents);
213
215
  }
214
- await fs_2.fs.mkdirp((0, path_1.dirname)(this.getPath()));
216
+ await mkdirp((0, path_1.dirname)(this.getPath()));
215
217
  this.logger.info(`Writing to config file: ${this.getPath()}`);
216
- await fs_2.fs.writeJson(this.getPath(), this.toObject());
218
+ await fs.promises.writeFile(this.getPath(), JSON.stringify(this.toObject(), null, 2));
217
219
  return this.getContents();
218
220
  }
219
221
  /**
@@ -226,9 +228,9 @@ class ConfigFile extends configStore_1.BaseConfigStore {
226
228
  if ((0, ts_types_1.isPlainObject)(newContents)) {
227
229
  this.setContents(newContents);
228
230
  }
229
- fs_2.fs.mkdirpSync((0, path_1.dirname)(this.getPath()));
231
+ mkdirp.sync((0, path_1.dirname)(this.getPath()));
230
232
  this.logger.info(`Writing to config file: ${this.getPath()}`);
231
- fs_2.fs.writeJsonSync(this.getPath(), this.toObject());
233
+ fs.writeFileSync(this.getPath(), JSON.stringify(this.toObject(), null, 2));
232
234
  return this.getContents();
233
235
  }
234
236
  /**
@@ -249,7 +251,7 @@ class ConfigFile extends configStore_1.BaseConfigStore {
249
251
  * {@link fs.stat}
250
252
  */
251
253
  async stat() {
252
- return fs_2.fs.stat(this.getPath());
254
+ return fs.promises.stat(this.getPath());
253
255
  }
254
256
  /**
255
257
  * Get the stats of the file. Returns the stats of the file.
@@ -257,7 +259,7 @@ class ConfigFile extends configStore_1.BaseConfigStore {
257
259
  * {@link fs.stat}
258
260
  */
259
261
  statSync() {
260
- return fs_2.fs.statSync(this.getPath());
262
+ return fs.statSync(this.getPath());
261
263
  }
262
264
  /**
263
265
  * Delete the config file if it exists.
@@ -268,9 +270,9 @@ class ConfigFile extends configStore_1.BaseConfigStore {
268
270
  async unlink() {
269
271
  const exists = await this.exists();
270
272
  if (exists) {
271
- return await fs_2.fs.unlink(this.getPath());
273
+ return await fs.promises.unlink(this.getPath());
272
274
  }
273
- throw new sfdxError_1.SfdxError(`Target file doesn't exist. path: ${this.getPath()}`, 'TargetFileNotFound');
275
+ throw new sfError_1.SfError(`Target file doesn't exist. path: ${this.getPath()}`, 'TargetFileNotFound');
274
276
  }
275
277
  /**
276
278
  * Delete the config file if it exists.
@@ -281,9 +283,9 @@ class ConfigFile extends configStore_1.BaseConfigStore {
281
283
  unlinkSync() {
282
284
  const exists = this.existsSync();
283
285
  if (exists) {
284
- return fs_2.fs.unlinkSync(this.getPath());
286
+ return fs.unlinkSync(this.getPath());
285
287
  }
286
- throw new sfdxError_1.SfdxError(`Target file doesn't exist. path: ${this.getPath()}`, 'TargetFileNotFound');
288
+ throw new sfError_1.SfError(`Target file doesn't exist. path: ${this.getPath()}`, 'TargetFileNotFound');
287
289
  }
288
290
  /**
289
291
  * Returns the absolute path to the config file.
@@ -295,7 +297,7 @@ class ConfigFile extends configStore_1.BaseConfigStore {
295
297
  getPath() {
296
298
  if (!this.path) {
297
299
  if (!this.options.filename) {
298
- throw new sfdxError_1.SfdxError('The ConfigOptions filename parameter is invalid.', 'InvalidParameter');
300
+ throw new sfError_1.SfError('The ConfigOptions filename parameter is invalid.', 'InvalidParameter');
299
301
  }
300
302
  const _isGlobal = (0, ts_types_1.isBoolean)(this.options.isGlobal) && this.options.isGlobal;
301
303
  const _isState = (0, ts_types_1.isBoolean)(this.options.isState) && this.options.isState;