@salesforce/core 2.28.3 → 2.30.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +65 -58
- package/lib/authInfo.d.ts +1 -6
- package/lib/authInfo.js +2 -1
- package/lib/connection.js +2 -1
- package/lib/lifecycleEvents.d.ts +38 -1
- package/lib/lifecycleEvents.js +73 -2
- package/lib/logger.js +1 -0
- package/lib/org.d.ts +30 -0
- package/lib/org.js +131 -3
- package/lib/sfdxError.d.ts +1 -1
- package/lib/sfdxError.js +1 -0
- package/lib/testSetup.d.ts +3 -1
- package/lib/testSetup.js +3 -3
- package/lib/util/sfdcUrl.js +2 -1
- package/messages/org.json +9 -3
- package/package.json +11 -9
package/CHANGELOG.md
CHANGED
|
@@ -2,195 +2,202 @@
|
|
|
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
|
-
### [2.
|
|
5
|
+
### [2.30.1](https://github.com/forcedotcom/sfdx-core/compare/v2.30.0...v2.30.1) (2021-11-30)
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
### Bug Fixes
|
|
9
9
|
|
|
10
|
-
*
|
|
11
|
-
* force new release ([124bb74](https://github.com/forcedotcom/sfdx-core/commit/124bb744c5ecc28cb8babf285c6d8c3032eb7ef6))
|
|
12
|
-
* improve error message when providing an invalid username ([2ab4bbd](https://github.com/forcedotcom/sfdx-core/commit/2ab4bbdefd962283d88ccb735de88c88fe189d39))
|
|
10
|
+
* better output for authUrl errors ([f3ec729](https://github.com/forcedotcom/sfdx-core/commit/f3ec7298bdbd3194d3d14bfea09f47f413669376))
|
|
13
11
|
|
|
14
|
-
|
|
12
|
+
## [2.30.0](https://github.com/forcedotcom/sfdx-core/compare/v2.29.0...v2.30.0) (2021-11-25)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* delete scratch orgs and sandboxes ([#491](https://github.com/forcedotcom/sfdx-core/issues/491)) ([468c348](https://github.com/forcedotcom/sfdx-core/commit/468c348f0ecc69ddeea02927bf7a26ca660a86ca))
|
|
15
18
|
|
|
19
|
+
## [2.29.0](https://github.com/forcedotcom/sfdx-core/compare/v2.28.4...v2.29.0) (2021-11-17)
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
- cleans up old listeners from upgraded instance ([e3f2d69](https://github.com/forcedotcom/sfdx-core/commit/e3f2d69ccd5c096d37addb1b982e19354175f11a))
|
|
24
|
+
- use warnings instead of process in sfdx-core ([c1f7e98](https://github.com/forcedotcom/sfdx-core/commit/c1f7e98f6b19d57da1a2ee0cdf58e449079f0ee7))
|
|
25
|
+
- warning and telemetry events ([80a8039](https://github.com/forcedotcom/sfdx-core/commit/80a8039e2f686d973ddbc24c9a2980fb93928d13))
|
|
26
|
+
- warning and telemetry events ([a04b293](https://github.com/forcedotcom/sfdx-core/commit/a04b29355c8ca6c7e37e071ccc159aff5e5e9ca0))
|
|
16
27
|
|
|
17
28
|
### Bug Fixes
|
|
18
29
|
|
|
19
|
-
|
|
30
|
+
- transfer listeners when upgrading the global instance to newer version ([0a40831](https://github.com/forcedotcom/sfdx-core/commit/0a408317c132548771ced0fe196178d2e9c76232))
|
|
20
31
|
|
|
21
|
-
### [2.28.
|
|
32
|
+
### [2.28.4](https://github.com/forcedotcom/sfdx-core/compare/v2.28.3...v2.28.4) (2021-11-10)
|
|
33
|
+
|
|
34
|
+
### Bug Fixes
|
|
22
35
|
|
|
36
|
+
- 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))
|
|
37
|
+
|
|
38
|
+
### [2.28.3](https://github.com/forcedotcom/sfdx-core/compare/v2.28.2...v2.28.3) (2021-11-08)
|
|
23
39
|
|
|
24
40
|
### Bug Fixes
|
|
25
41
|
|
|
26
|
-
|
|
42
|
+
- fix unit test ([d903c04](https://github.com/forcedotcom/sfdx-core/commit/d903c04e5f3e4f01fccb3f00b91560c443013ddf))
|
|
43
|
+
- force new release ([124bb74](https://github.com/forcedotcom/sfdx-core/commit/124bb744c5ecc28cb8babf285c6d8c3032eb7ef6))
|
|
44
|
+
- improve error message when providing an invalid username ([2ab4bbd](https://github.com/forcedotcom/sfdx-core/commit/2ab4bbdefd962283d88ccb735de88c88fe189d39))
|
|
27
45
|
|
|
28
|
-
|
|
46
|
+
### [2.28.2](https://github.com/forcedotcom/sfdx-core/compare/v2.28.1...v2.28.2) (2021-10-13)
|
|
47
|
+
|
|
48
|
+
### Bug Fixes
|
|
29
49
|
|
|
50
|
+
- support for .mil sandboxes ([9ef35c7](https://github.com/forcedotcom/sfdx-core/commit/9ef35c7b1ef0fe974c3bd3b89b862a436e00f7d9))
|
|
51
|
+
|
|
52
|
+
### [2.28.1](https://github.com/forcedotcom/sfdx-core/compare/v2.28.0...v2.28.1) (2021-10-06)
|
|
53
|
+
|
|
54
|
+
### Bug Fixes
|
|
55
|
+
|
|
56
|
+
- crmforce.mil ([e263d5d](https://github.com/forcedotcom/sfdx-core/commit/e263d5d74be9c0651e5c2676d6eec1c31fca05e4))
|
|
57
|
+
|
|
58
|
+
## [2.28.0](https://github.com/forcedotcom/sfdx-core/compare/v2.27.2...v2.28.0) (2021-09-16)
|
|
30
59
|
|
|
31
60
|
### Features
|
|
32
61
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
62
|
+
- add custom templates config ([3cf8a8c](https://github.com/forcedotcom/sfdx-core/commit/3cf8a8cee1e7196efced989dcca9b545e1283386))
|
|
63
|
+
- add validator for custom templates config ([dd2bcfe](https://github.com/forcedotcom/sfdx-core/commit/dd2bcfe8e7fee5c5c1c6321189ec04288103d5b6))
|
|
64
|
+
- update config name ([72e84bf](https://github.com/forcedotcom/sfdx-core/commit/72e84bfacef48a1c2d00a61ebbae3f632601abbd))
|
|
36
65
|
|
|
37
66
|
### [2.27.2](https://github.com/forcedotcom/sfdx-core/compare/v2.27.1...v2.27.2) (2021-08-05)
|
|
38
67
|
|
|
39
|
-
|
|
40
68
|
### Bug Fixes
|
|
41
69
|
|
|
42
|
-
|
|
70
|
+
- improve error handling while removing config props ([eecf7b0](https://github.com/forcedotcom/sfdx-core/commit/eecf7b0d0cf14e1371dc4c5ef03a413f864b0a8b))
|
|
43
71
|
|
|
44
72
|
### [2.27.1](https://github.com/forcedotcom/sfdx-core/compare/v2.27.0...v2.27.1) (2021-08-05)
|
|
45
73
|
|
|
46
|
-
|
|
47
74
|
### Bug Fixes
|
|
48
75
|
|
|
49
|
-
|
|
76
|
+
- dont fail when trying to unset sf config keys ([#456](https://github.com/forcedotcom/sfdx-core/issues/456)) ([8aff9fd](https://github.com/forcedotcom/sfdx-core/commit/8aff9fd4bdb73ec20e58f5a16a8192a8eecba912))
|
|
50
77
|
|
|
51
78
|
## [2.27.0](https://github.com/forcedotcom/sfdx-core/compare/v2.26.1...v2.27.0) (2021-07-29)
|
|
52
79
|
|
|
53
|
-
|
|
54
80
|
### Features
|
|
55
81
|
|
|
56
|
-
|
|
82
|
+
- Core URL class SfdcUrl ([#420](https://github.com/forcedotcom/sfdx-core/issues/420)) ([66881ea](https://github.com/forcedotcom/sfdx-core/commit/66881eae2f30215c862ea398bfc1630d9a5898fe))
|
|
57
83
|
|
|
58
84
|
### [2.26.1](https://github.com/forcedotcom/sfdx-core/compare/v2.26.0...v2.26.1) (2021-07-19)
|
|
59
85
|
|
|
60
|
-
|
|
61
86
|
### Bug Fixes
|
|
62
87
|
|
|
63
|
-
|
|
88
|
+
- force:org:open force:org:open --urlonly display bug ([#439](https://github.com/forcedotcom/sfdx-core/issues/439)) ([2ea0e74](https://github.com/forcedotcom/sfdx-core/commit/2ea0e74b8bf1bff6de8af70372025cac10fc8c18))
|
|
64
89
|
|
|
65
90
|
## [2.26.0](https://github.com/forcedotcom/sfdx-core/compare/v2.25.1...v2.26.0) (2021-07-13)
|
|
66
91
|
|
|
67
|
-
|
|
68
92
|
### Features
|
|
69
93
|
|
|
70
|
-
|
|
94
|
+
- update generate password functionality ([#432](https://github.com/forcedotcom/sfdx-core/issues/432)) ([ed65e83](https://github.com/forcedotcom/sfdx-core/commit/ed65e83da3afe0d101743ee89cc7b2a7a38d5254))
|
|
71
95
|
|
|
72
96
|
### [2.25.1](https://github.com/forcedotcom/sfdx-core/compare/v3.1.1-3.2...v2.25.1) (2021-06-30)
|
|
73
97
|
|
|
74
|
-
|
|
75
98
|
### Bug Fixes
|
|
76
99
|
|
|
77
|
-
|
|
100
|
+
- set retries to INFINITELY for polling client ([31539b4](https://github.com/forcedotcom/sfdx-core/commit/31539b4f0edd0cc1c049f70331ed5e40b8af55ea))
|
|
78
101
|
|
|
79
102
|
## [2.25.0](https://github.com/forcedotcom/sfdx-core/compare/v2.24.2...v2.25.0) (2021-06-30)
|
|
80
103
|
|
|
81
|
-
|
|
82
104
|
### Features
|
|
83
105
|
|
|
84
|
-
|
|
106
|
+
- @W-9517449@ Allow signupTargetLoginUrl to be overridden via env var ([#429](https://github.com/forcedotcom/sfdx-core/issues/429)) ([e2b8b36](https://github.com/forcedotcom/sfdx-core/commit/e2b8b36b2836b5277c83ffe22922978dc32e7b11)), closes [#427](https://github.com/forcedotcom/sfdx-core/issues/427)
|
|
85
107
|
|
|
86
108
|
### [2.24.2](https://github.com/forcedotcom/sfdx-core/compare/v3.1.1-3.1...v2.24.2) (2021-06-23)
|
|
87
109
|
|
|
88
|
-
|
|
89
110
|
### Bug Fixes
|
|
90
111
|
|
|
91
|
-
|
|
112
|
+
- puts some types back in dependencies ([94bea31](https://github.com/forcedotcom/sfdx-core/commit/94bea31037a41d4377faecb22bce8a2d12e95f4f))
|
|
92
113
|
|
|
93
114
|
### [2.24.1](https://github.com/forcedotcom/sfdx-core/compare/v2.24.0...v2.24.1) (2021-06-23)
|
|
94
115
|
|
|
95
|
-
|
|
96
116
|
### Bug Fixes
|
|
97
117
|
|
|
98
|
-
|
|
118
|
+
- rewrite polling client ([8d363d1](https://github.com/forcedotcom/sfdx-core/commit/8d363d13616f5efa944d4bb717a010add3c996b5))
|
|
99
119
|
|
|
100
120
|
## [2.24.0](https://github.com/forcedotcom/sfdx-core/compare/v2.23.5...v2.24.0) (2021-06-08)
|
|
101
121
|
|
|
102
|
-
|
|
103
122
|
### Features
|
|
104
123
|
|
|
105
|
-
|
|
124
|
+
- exported function checkLightningDomain() ([#415](https://github.com/forcedotcom/sfdx-core/issues/415)) ([8e75231](https://github.com/forcedotcom/sfdx-core/commit/8e752313abf4a383a6ef18250ffac78b398987dd))
|
|
106
125
|
|
|
107
126
|
### [2.23.5](https://github.com/forcedotcom/sfdx-core/compare/v3.1.1-3.0...v2.23.5) (2021-06-07)
|
|
108
127
|
|
|
109
|
-
|
|
110
128
|
### Bug Fixes
|
|
111
129
|
|
|
112
|
-
|
|
130
|
+
- w-9299422 (login url from config) and fs-parallelization ([043bb17](https://github.com/forcedotcom/sfdx-core/commit/043bb179dbf64f9c4522a4c0f0720ae09794227c))
|
|
113
131
|
|
|
114
132
|
### [2.23.4](https://github.com/forcedotcom/sfdx-core/compare/v2.23.3...v2.23.4) (2021-06-03)
|
|
115
133
|
|
|
116
|
-
|
|
117
134
|
### Bug Fixes
|
|
118
135
|
|
|
119
|
-
|
|
136
|
+
- works with TS4+ and jsforce types ([#413](https://github.com/forcedotcom/sfdx-core/issues/413)) ([b77cdad](https://github.com/forcedotcom/sfdx-core/commit/b77cdad56b114290b8e5fd23d968e23e7d4eedf4))
|
|
120
137
|
|
|
121
138
|
### [2.23.3](https://github.com/forcedotcom/sfdx-core/compare/v2.23.2...v2.23.3) (2021-06-03)
|
|
122
139
|
|
|
123
140
|
### [2.23.2](https://github.com/forcedotcom/sfdx-core/compare/v2.23.1...v2.23.2) (2021-06-02)
|
|
124
141
|
|
|
125
|
-
|
|
126
142
|
### Bug Fixes
|
|
127
143
|
|
|
128
|
-
|
|
144
|
+
- authinfo returning only lowercase usernames. ([#411](https://github.com/forcedotcom/sfdx-core/issues/411)) ([243668e](https://github.com/forcedotcom/sfdx-core/commit/243668e61cd8418b6acb2f0d4806da50ccf37b29)), closes [#405](https://github.com/forcedotcom/sfdx-core/issues/405)
|
|
129
145
|
|
|
130
146
|
### [2.23.1](https://github.com/forcedotcom/sfdx-core/compare/v2.23.0...v2.23.1) (2021-05-27)
|
|
131
147
|
|
|
132
148
|
## [2.23.0](https://github.com/forcedotcom/sfdx-core/compare/v2.22.0...v2.23.0) (2021-05-26)
|
|
133
149
|
|
|
134
|
-
|
|
135
150
|
### Features
|
|
136
151
|
|
|
137
|
-
|
|
138
|
-
|
|
152
|
+
- export getJwtAudienceUrl ([e7d26d2](https://github.com/forcedotcom/sfdx-core/commit/e7d26d20106d6abb6b424936bdf26c0a9f8cd175))
|
|
139
153
|
|
|
140
154
|
### Bug Fixes
|
|
141
155
|
|
|
142
|
-
|
|
156
|
+
- export library method ([d0016f9](https://github.com/forcedotcom/sfdx-core/commit/d0016f96da1246535049884c1043399239a33c00))
|
|
143
157
|
|
|
144
158
|
## [2.22.0](https://github.com/forcedotcom/sfdx-core/compare/v2.21.0...v2.22.0) (2021-05-24)
|
|
145
159
|
|
|
146
|
-
|
|
147
160
|
### Features
|
|
148
161
|
|
|
149
|
-
|
|
162
|
+
- export getJwtAudienceUrl ([#407](https://github.com/forcedotcom/sfdx-core/issues/407)) ([585bb07](https://github.com/forcedotcom/sfdx-core/commit/585bb073434d73473a855ee52b7ddc6f0228aae1))
|
|
150
163
|
|
|
151
164
|
## [2.21.0](https://github.com/forcedotcom/sfdx-core/compare/v2.20.11...v2.21.0) (2021-05-24)
|
|
152
165
|
|
|
153
|
-
|
|
154
166
|
### Features
|
|
155
167
|
|
|
156
|
-
|
|
168
|
+
- modify authInfo to return username for access token auth ([160b7d2](https://github.com/forcedotcom/sfdx-core/commit/160b7d20e32b80d7a54c8cf679154fcbaa9e8cda))
|
|
157
169
|
|
|
158
170
|
### [2.20.11](https://github.com/forcedotcom/sfdx-core/compare/v3.1.0-3.0...v2.20.11) (2021-05-12)
|
|
159
171
|
|
|
160
|
-
|
|
161
172
|
### Bug Fixes
|
|
162
173
|
|
|
163
|
-
|
|
174
|
+
- force release ([f0b837a](https://github.com/forcedotcom/sfdx-core/commit/f0b837ab7b4d0361c2fa3ba15fe56cd2f7cc1fd0))
|
|
164
175
|
|
|
165
176
|
### [2.20.10](https://github.com/forcedotcom/sfdx-core/compare/v2.20.9...v2.20.10) (2021-04-14)
|
|
166
177
|
|
|
167
|
-
|
|
168
178
|
### Bug Fixes
|
|
169
179
|
|
|
170
|
-
|
|
180
|
+
- add another internal test env domain ([6ea538f](https://github.com/forcedotcom/sfdx-core/commit/6ea538f2ce62daba7262a247472ce821c6e2616f))
|
|
171
181
|
|
|
172
182
|
### [2.20.9](https://github.com/forcedotcom/sfdx-core/compare/v2.20.8...v2.20.9) (2021-04-05)
|
|
173
183
|
|
|
174
|
-
|
|
175
184
|
### Bug Fixes
|
|
176
185
|
|
|
177
|
-
|
|
186
|
+
- allow = in authUrl tokens ([2337fcd](https://github.com/forcedotcom/sfdx-core/commit/2337fcddfb1907a7092cd52f5b3ad73ae963d59e))
|
|
178
187
|
|
|
179
188
|
### [2.20.8](https://github.com/forcedotcom/sfdx-core/compare/v2.20.7...v2.20.8) (2021-04-03)
|
|
180
189
|
|
|
181
|
-
|
|
182
190
|
### Bug Fixes
|
|
183
191
|
|
|
184
|
-
|
|
192
|
+
- debugEnabled should be public ([dbd0124](https://github.com/forcedotcom/sfdx-core/commit/dbd01243003f555b8b4db45c83e81cc08b8cb9a1))
|
|
185
193
|
|
|
186
194
|
### [2.20.7](https://github.com/forcedotcom/sfdx-core/compare/v2.20.6...v2.20.7) (2021-04-02)
|
|
187
195
|
|
|
188
|
-
|
|
189
196
|
### Bug Fixes
|
|
190
197
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
198
|
+
- add deployRecentValidation ([62d367b](https://github.com/forcedotcom/sfdx-core/commit/62d367b217e6b552573bd7176b064e28252348c5))
|
|
199
|
+
- add deployRecentValidation ([a39c329](https://github.com/forcedotcom/sfdx-core/commit/a39c329b3fab603b537ae5ed8cce4773bdf24eb6))
|
|
200
|
+
- add test, clarify comments ([8d5679e](https://github.com/forcedotcom/sfdx-core/commit/8d5679ecbd482af84842f5c1c8908a059d97ef3f))
|
|
194
201
|
|
|
195
202
|
### [2.20.6](https://github.com/forcedotcom/sfdx-core/compare/v2.20.5...v2.20.6) (2021-04-02)
|
|
196
203
|
|
package/lib/authInfo.d.ts
CHANGED
|
@@ -202,12 +202,7 @@ export declare class AuthInfo extends AsyncCreatable<AuthInfo.Options> {
|
|
|
202
202
|
* ```
|
|
203
203
|
* @param sfdxAuthUrl
|
|
204
204
|
*/
|
|
205
|
-
static parseSfdxAuthUrl(sfdxAuthUrl: string):
|
|
206
|
-
clientId: string;
|
|
207
|
-
clientSecret: string;
|
|
208
|
-
refreshToken: string;
|
|
209
|
-
loginUrl: string;
|
|
210
|
-
};
|
|
205
|
+
static parseSfdxAuthUrl(sfdxAuthUrl: string): Pick<AuthFields, 'clientId' | 'clientSecret' | 'refreshToken' | 'loginUrl'>;
|
|
211
206
|
/**
|
|
212
207
|
* Get the username.
|
|
213
208
|
*/
|
package/lib/authInfo.js
CHANGED
|
@@ -87,6 +87,7 @@ class OAuth2WithVerifier extends jsforce_1.OAuth2 {
|
|
|
87
87
|
*
|
|
88
88
|
* See https://github.com/jsforce/jsforce/issues/665
|
|
89
89
|
*/
|
|
90
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
90
91
|
async _postParams(params, callback) {
|
|
91
92
|
kit_1.set(params, 'code_verifier', this.codeVerifier);
|
|
92
93
|
// @ts-ignore TODO: need better typings for jsforce
|
|
@@ -329,7 +330,7 @@ class AuthInfo extends kit_1.AsyncCreatable {
|
|
|
329
330
|
static parseSfdxAuthUrl(sfdxAuthUrl) {
|
|
330
331
|
const match = sfdxAuthUrl.match(/^force:\/\/([a-zA-Z0-9._-]+):([a-zA-Z0-9._-]*):([a-zA-Z0-9._-]+={0,2})@([a-zA-Z0-9._-]+)/);
|
|
331
332
|
if (!match) {
|
|
332
|
-
throw new sfdxError_1.SfdxError('Invalid
|
|
333
|
+
throw new sfdxError_1.SfdxError('Invalid SFDX auth URL. Must be in the format "force://<clientId>:<clientSecret>:<refreshToken>@<instanceUrl>". Note that the SFDX auth URL uses the "force" protocol, and not "http" or "https". Also note that the "instanceUrl" inside the SFDX auth URL doesn\'t include the protocol ("https://").', 'INVALID_SFDX_AUTH_URL');
|
|
333
334
|
}
|
|
334
335
|
const [, clientId, clientSecret, refreshToken, loginUrl] = match;
|
|
335
336
|
return {
|
package/lib/connection.js
CHANGED
|
@@ -19,6 +19,7 @@ const configAggregator_1 = require("./config/configAggregator");
|
|
|
19
19
|
const logger_1 = require("./logger");
|
|
20
20
|
const sfdxError_1 = require("./sfdxError");
|
|
21
21
|
const sfdc_1 = require("./util/sfdc");
|
|
22
|
+
const lifecycleEvents_1 = require("./lifecycleEvents");
|
|
22
23
|
/**
|
|
23
24
|
* The 'async' in our request override replaces the jsforce promise with the node promise, then returns it back to
|
|
24
25
|
* jsforce which expects .thenCall. Add .thenCall to the node promise to prevent breakage.
|
|
@@ -356,7 +357,7 @@ class Connection extends jsforce_1.Connection {
|
|
|
356
357
|
.on('end', () => {
|
|
357
358
|
const totalSize = ts_types_1.getNumber(query, 'totalSize') || 0;
|
|
358
359
|
if (totalSize > records.length) {
|
|
359
|
-
|
|
360
|
+
void lifecycleEvents_1.Lifecycle.getInstance().emitWarning(`The query result is missing ${totalSize - records.length} records due to a ${maxFetch} record limit. Increase the number of records returned by setting the config value "maxQueryLimit" or the environment variable "SFDX_MAX_QUERY_LIMIT" to ${totalSize} or greater than ${maxFetch}.`);
|
|
360
361
|
}
|
|
361
362
|
resolve({
|
|
362
363
|
done: true,
|
package/lib/lifecycleEvents.d.ts
CHANGED
|
@@ -16,16 +16,29 @@ declare type callback = (data: any) => Promise<void>;
|
|
|
16
16
|
*
|
|
17
17
|
* // Deep in the deploy code, fire the event for all libraries and plugins to hear.
|
|
18
18
|
* Lifecycle.getInstance().emit('deploy-metadata', metadataToBeDeployed);
|
|
19
|
+
*
|
|
20
|
+
* // if you don't need to await anything
|
|
21
|
+
* use `void Lifecycle.getInstance().emit('deploy-metadata', metadataToBeDeployed)` ;
|
|
19
22
|
* ```
|
|
20
23
|
*/
|
|
21
24
|
export declare class Lifecycle {
|
|
22
|
-
private debug;
|
|
23
25
|
private readonly listeners;
|
|
26
|
+
static readonly telemetryEventName = "telemetry";
|
|
27
|
+
static readonly warningEventName = "warning";
|
|
28
|
+
private debug;
|
|
24
29
|
private constructor();
|
|
30
|
+
/**
|
|
31
|
+
* return the package.json version of the sfdx-core library.
|
|
32
|
+
*/
|
|
33
|
+
static staticVersion(): string;
|
|
25
34
|
/**
|
|
26
35
|
* Retrieve the singleton instance of this class so that all listeners and emitters can interact from any library or tool
|
|
27
36
|
*/
|
|
28
37
|
static getInstance(): Lifecycle;
|
|
38
|
+
/**
|
|
39
|
+
* return the package.json version of the sfdx-core library.
|
|
40
|
+
*/
|
|
41
|
+
version(): string;
|
|
29
42
|
/**
|
|
30
43
|
* Remove all listeners for a given event
|
|
31
44
|
*
|
|
@@ -38,6 +51,18 @@ export declare class Lifecycle {
|
|
|
38
51
|
* @param eventName The name of the event to get listeners of
|
|
39
52
|
*/
|
|
40
53
|
getListeners(eventName: string): callback[];
|
|
54
|
+
/**
|
|
55
|
+
* Create a listener for the `telemetry` event
|
|
56
|
+
*
|
|
57
|
+
* @param cb The callback function to run when the event is emitted
|
|
58
|
+
*/
|
|
59
|
+
onTelemetry(cb: (data: Record<string, unknown>) => Promise<void>): void;
|
|
60
|
+
/**
|
|
61
|
+
* Create a listener for the `warning` event
|
|
62
|
+
*
|
|
63
|
+
* @param cb The callback function to run when the event is emitted
|
|
64
|
+
*/
|
|
65
|
+
onWarning(cb: (warning: string) => Promise<void>): void;
|
|
41
66
|
/**
|
|
42
67
|
* Create a new listener for a given event
|
|
43
68
|
*
|
|
@@ -45,6 +70,18 @@ export declare class Lifecycle {
|
|
|
45
70
|
* @param cb The callback function to run when the event is emitted
|
|
46
71
|
*/
|
|
47
72
|
on<T = AnyJson>(eventName: string, cb: (data: T) => Promise<void>): void;
|
|
73
|
+
/**
|
|
74
|
+
* Emit a `telemetry` event, causing all callback functions to be run in the order they were registered
|
|
75
|
+
*
|
|
76
|
+
* @param data The data to emit
|
|
77
|
+
*/
|
|
78
|
+
emitTelemetry(data: AnyJson): Promise<void>;
|
|
79
|
+
/**
|
|
80
|
+
* Emit a `warning` event, causing all callback functions to be run in the order they were registered
|
|
81
|
+
*
|
|
82
|
+
* @param data The warning (string) to emit
|
|
83
|
+
*/
|
|
84
|
+
emitWarning(warning: string): Promise<void>;
|
|
48
85
|
/**
|
|
49
86
|
* Emit a given event, causing all callback functions to be run in the order they were registered
|
|
50
87
|
*
|
package/lib/lifecycleEvents.js
CHANGED
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.Lifecycle = void 0;
|
|
10
10
|
const Debug = require("debug");
|
|
11
|
+
const semver_1 = require("semver");
|
|
12
|
+
// needed for TS to not put everything inside /lib/src
|
|
13
|
+
// @ts-ignore
|
|
14
|
+
const pjson = require("../package.json");
|
|
11
15
|
/**
|
|
12
16
|
* An asynchronous event listener and emitter that follows the singleton pattern. The singleton pattern allows lifecycle
|
|
13
17
|
* events to be emitted from deep within a library and still be consumed by any other library or tool. It allows other
|
|
@@ -24,12 +28,21 @@ const Debug = require("debug");
|
|
|
24
28
|
*
|
|
25
29
|
* // Deep in the deploy code, fire the event for all libraries and plugins to hear.
|
|
26
30
|
* Lifecycle.getInstance().emit('deploy-metadata', metadataToBeDeployed);
|
|
31
|
+
*
|
|
32
|
+
* // if you don't need to await anything
|
|
33
|
+
* use `void Lifecycle.getInstance().emit('deploy-metadata', metadataToBeDeployed)` ;
|
|
27
34
|
* ```
|
|
28
35
|
*/
|
|
29
36
|
class Lifecycle {
|
|
30
|
-
constructor() {
|
|
37
|
+
constructor(listeners = {}) {
|
|
38
|
+
this.listeners = listeners;
|
|
31
39
|
this.debug = Debug(`sfdx:${this.constructor.name}`);
|
|
32
|
-
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* return the package.json version of the sfdx-core library.
|
|
43
|
+
*/
|
|
44
|
+
static staticVersion() {
|
|
45
|
+
return pjson.version;
|
|
33
46
|
}
|
|
34
47
|
/**
|
|
35
48
|
* Retrieve the singleton instance of this class so that all listeners and emitters can interact from any library or tool
|
|
@@ -52,10 +65,29 @@ class Lifecycle {
|
|
|
52
65
|
//
|
|
53
66
|
// Nothing should EVER be removed, even across major versions.
|
|
54
67
|
if (!global.salesforceCoreLifecycle) {
|
|
68
|
+
// it's not been loaded yet (basic singleton pattern)
|
|
55
69
|
global.salesforceCoreLifecycle = new Lifecycle();
|
|
56
70
|
}
|
|
71
|
+
else if (
|
|
72
|
+
// an older version was loaded that should be replaced
|
|
73
|
+
semver_1.compare(global.salesforceCoreLifecycle.version(), Lifecycle.staticVersion()) === -1) {
|
|
74
|
+
const oldInstance = global.salesforceCoreLifecycle;
|
|
75
|
+
// use the newer version and transfer any listeners from the old version
|
|
76
|
+
// object spread keeps them from being references
|
|
77
|
+
global.salesforceCoreLifecycle = new Lifecycle({ ...oldInstance.listeners });
|
|
78
|
+
// clean up any listeners on the old version
|
|
79
|
+
Object.keys(oldInstance.listeners).map((eventName) => {
|
|
80
|
+
oldInstance.removeAllListeners(eventName);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
57
83
|
return global.salesforceCoreLifecycle;
|
|
58
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* return the package.json version of the sfdx-core library.
|
|
87
|
+
*/
|
|
88
|
+
version() {
|
|
89
|
+
return pjson.version;
|
|
90
|
+
}
|
|
59
91
|
/**
|
|
60
92
|
* Remove all listeners for a given event
|
|
61
93
|
*
|
|
@@ -79,6 +111,22 @@ class Lifecycle {
|
|
|
79
111
|
return [];
|
|
80
112
|
}
|
|
81
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* Create a listener for the `telemetry` event
|
|
116
|
+
*
|
|
117
|
+
* @param cb The callback function to run when the event is emitted
|
|
118
|
+
*/
|
|
119
|
+
onTelemetry(cb) {
|
|
120
|
+
this.on(Lifecycle.telemetryEventName, cb);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Create a listener for the `warning` event
|
|
124
|
+
*
|
|
125
|
+
* @param cb The callback function to run when the event is emitted
|
|
126
|
+
*/
|
|
127
|
+
onWarning(cb) {
|
|
128
|
+
this.on(Lifecycle.warningEventName, cb);
|
|
129
|
+
}
|
|
82
130
|
/**
|
|
83
131
|
* Create a new listener for a given event
|
|
84
132
|
*
|
|
@@ -93,6 +141,27 @@ class Lifecycle {
|
|
|
93
141
|
listeners.push(cb);
|
|
94
142
|
this.listeners[eventName] = listeners;
|
|
95
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* Emit a `telemetry` event, causing all callback functions to be run in the order they were registered
|
|
146
|
+
*
|
|
147
|
+
* @param data The data to emit
|
|
148
|
+
*/
|
|
149
|
+
async emitTelemetry(data) {
|
|
150
|
+
return this.emit(Lifecycle.telemetryEventName, data);
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Emit a `warning` event, causing all callback functions to be run in the order they were registered
|
|
154
|
+
*
|
|
155
|
+
* @param data The warning (string) to emit
|
|
156
|
+
*/
|
|
157
|
+
async emitWarning(warning) {
|
|
158
|
+
// if there are no listeners, warnings should go to the node process so they're not lost
|
|
159
|
+
// this also preserves behavior in UT where there's a spy on process.emitWarning
|
|
160
|
+
if (this.getListeners(Lifecycle.warningEventName).length === 0) {
|
|
161
|
+
process.emitWarning(warning);
|
|
162
|
+
}
|
|
163
|
+
return this.emit(Lifecycle.warningEventName, warning);
|
|
164
|
+
}
|
|
96
165
|
/**
|
|
97
166
|
* Emit a given event, causing all callback functions to be run in the order they were registered
|
|
98
167
|
*
|
|
@@ -112,4 +181,6 @@ class Lifecycle {
|
|
|
112
181
|
}
|
|
113
182
|
}
|
|
114
183
|
exports.Lifecycle = Lifecycle;
|
|
184
|
+
Lifecycle.telemetryEventName = 'telemetry';
|
|
185
|
+
Lifecycle.warningEventName = 'warning';
|
|
115
186
|
//# sourceMappingURL=lifecycleEvents.js.map
|
package/lib/logger.js
CHANGED
package/lib/org.d.ts
CHANGED
|
@@ -60,6 +60,11 @@ export declare class Org extends AsyncCreatable<Org.Options> {
|
|
|
60
60
|
* @param throwWhenRemoveFails Determines if the call should throw an error or fail silently.
|
|
61
61
|
*/
|
|
62
62
|
remove(throwWhenRemoveFails?: boolean): Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Check if org is a sandbox org by checking its SandboxOrgConfig.
|
|
65
|
+
*
|
|
66
|
+
*/
|
|
67
|
+
isSandbox(): Promise<boolean>;
|
|
63
68
|
/**
|
|
64
69
|
* Check that this org is a scratch org by asking the dev hub if it knows about it.
|
|
65
70
|
*
|
|
@@ -82,6 +87,16 @@ export declare class Org extends AsyncCreatable<Org.Options> {
|
|
|
82
87
|
* dev hub**. If you need accuracy, use the {@link Org.determineIfDevHubOrg} method.
|
|
83
88
|
*/
|
|
84
89
|
isDevHubOrg(): boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Will delete 'this' instance remotely and any files locally
|
|
92
|
+
*
|
|
93
|
+
* @param controllingOrg username or Org that 'this.devhub' or 'this.production' refers to. AKA a DevHub for a scratch org, or a Production Org for a sandbox
|
|
94
|
+
*/
|
|
95
|
+
deleteFrom(controllingOrg: string | Org): Promise<void>;
|
|
96
|
+
/**
|
|
97
|
+
* Will delete 'this' instance remotely and any files locally
|
|
98
|
+
*/
|
|
99
|
+
delete(): Promise<void>;
|
|
85
100
|
/**
|
|
86
101
|
* Returns `true` if the org is a Dev Hub.
|
|
87
102
|
*
|
|
@@ -177,6 +192,21 @@ export declare class Org extends AsyncCreatable<Org.Options> {
|
|
|
177
192
|
* **Throws** *{@link SfdxError} Throws and unsupported error.
|
|
178
193
|
*/
|
|
179
194
|
protected getDefaultOptions(): Org.Options;
|
|
195
|
+
private queryProduction;
|
|
196
|
+
/**
|
|
197
|
+
* this method will delete the sandbox org from the production org and clean up any local files
|
|
198
|
+
*
|
|
199
|
+
* @param prodOrg - Production org associated with this sandbox
|
|
200
|
+
* @private
|
|
201
|
+
*/
|
|
202
|
+
private deleteSandbox;
|
|
203
|
+
/**
|
|
204
|
+
* If this Org is a scratch org, calling this method will delete the scratch org from the DevHub and clean up any local files
|
|
205
|
+
*
|
|
206
|
+
* @param devHub - optional DevHub Org of the to-be-deleted scratch org
|
|
207
|
+
* @private
|
|
208
|
+
*/
|
|
209
|
+
private deleteScratchOrg;
|
|
180
210
|
/**
|
|
181
211
|
* Returns a promise to delete an auth info file from the local file system and any related cache information for
|
|
182
212
|
* this Org.. You don't want to call this method directly. Instead consider calling Org.remove()
|
package/lib/org.js
CHANGED
|
@@ -72,7 +72,7 @@ class Org extends kit_1.AsyncCreatable {
|
|
|
72
72
|
this.logger.debug(`cleaning data for path: ${dataPath}`);
|
|
73
73
|
}
|
|
74
74
|
catch (err) {
|
|
75
|
-
if (err.name === 'InvalidProjectWorkspace') {
|
|
75
|
+
if (err instanceof Error && err.name === 'InvalidProjectWorkspace') {
|
|
76
76
|
// If we aren't in a project dir, we can't clean up data files.
|
|
77
77
|
// If the user unlink this org outside of the workspace they used it in,
|
|
78
78
|
// data files will be left over.
|
|
@@ -110,6 +110,13 @@ class Org extends kit_1.AsyncCreatable {
|
|
|
110
110
|
// So, just in case no users are added to this org we will try the remove again.
|
|
111
111
|
await this.removeAuth();
|
|
112
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* Check if org is a sandbox org by checking its SandboxOrgConfig.
|
|
115
|
+
*
|
|
116
|
+
*/
|
|
117
|
+
async isSandbox() {
|
|
118
|
+
return !!(await this.getSandboxOrgConfigField(sandboxOrgConfig_1.SandboxOrgConfig.Fields.PROD_ORG_USERNAME));
|
|
119
|
+
}
|
|
113
120
|
/**
|
|
114
121
|
* Check that this org is a scratch org by asking the dev hub if it knows about it.
|
|
115
122
|
*
|
|
@@ -133,7 +140,7 @@ class Org extends kit_1.AsyncCreatable {
|
|
|
133
140
|
results = await devHubConnection.query(DEV_HUB_SOQL);
|
|
134
141
|
}
|
|
135
142
|
catch (err) {
|
|
136
|
-
if (err.name === 'INVALID_TYPE') {
|
|
143
|
+
if (err instanceof Error && err.name === 'INVALID_TYPE') {
|
|
137
144
|
throw sfdxError_1.SfdxError.create('@salesforce/core', 'org', 'NotADevHub', [devHubConnection.getUsername()]);
|
|
138
145
|
}
|
|
139
146
|
throw err;
|
|
@@ -175,6 +182,36 @@ class Org extends kit_1.AsyncCreatable {
|
|
|
175
182
|
return false;
|
|
176
183
|
}
|
|
177
184
|
}
|
|
185
|
+
/**
|
|
186
|
+
* Will delete 'this' instance remotely and any files locally
|
|
187
|
+
*
|
|
188
|
+
* @param controllingOrg username or Org that 'this.devhub' or 'this.production' refers to. AKA a DevHub for a scratch org, or a Production Org for a sandbox
|
|
189
|
+
*/
|
|
190
|
+
async deleteFrom(controllingOrg) {
|
|
191
|
+
if (typeof controllingOrg === 'string') {
|
|
192
|
+
controllingOrg = await Org.create({
|
|
193
|
+
aggregator: this.configAggregator,
|
|
194
|
+
aliasOrUsername: controllingOrg,
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
if (await this.isSandbox()) {
|
|
198
|
+
await this.deleteSandbox(controllingOrg);
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
await this.deleteScratchOrg(controllingOrg);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Will delete 'this' instance remotely and any files locally
|
|
206
|
+
*/
|
|
207
|
+
async delete() {
|
|
208
|
+
if (await this.isSandbox()) {
|
|
209
|
+
await this.deleteSandbox();
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
await this.deleteScratchOrg();
|
|
213
|
+
}
|
|
214
|
+
}
|
|
178
215
|
/**
|
|
179
216
|
* Returns `true` if the org is a Dev Hub.
|
|
180
217
|
*
|
|
@@ -416,6 +453,98 @@ class Org extends kit_1.AsyncCreatable {
|
|
|
416
453
|
getDefaultOptions() {
|
|
417
454
|
throw new sfdxError_1.SfdxError('Not Supported');
|
|
418
455
|
}
|
|
456
|
+
async queryProduction(org, field, value) {
|
|
457
|
+
return org.connection.singleRecordQuery(`SELECT SandboxInfoId FROM SandboxProcess WHERE ${field} ='${value}' AND Status NOT IN ('D', 'E')`, { tooling: true });
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* this method will delete the sandbox org from the production org and clean up any local files
|
|
461
|
+
*
|
|
462
|
+
* @param prodOrg - Production org associated with this sandbox
|
|
463
|
+
* @private
|
|
464
|
+
*/
|
|
465
|
+
async deleteSandbox(prodOrg) {
|
|
466
|
+
prodOrg !== null && prodOrg !== void 0 ? prodOrg : (prodOrg = await Org.create({
|
|
467
|
+
aggregator: this.configAggregator,
|
|
468
|
+
aliasOrUsername: await this.getSandboxOrgConfigField(sandboxOrgConfig_1.SandboxOrgConfig.Fields.PROD_ORG_USERNAME),
|
|
469
|
+
}));
|
|
470
|
+
let result;
|
|
471
|
+
// attempt to locate sandbox id by username
|
|
472
|
+
try {
|
|
473
|
+
// try to calculate sandbox name from the production org
|
|
474
|
+
// production org: admin@integrationtesthub.org
|
|
475
|
+
// this.getUsername: admin@integrationtesthub.org.dev1
|
|
476
|
+
// sandboxName in Production: dev1
|
|
477
|
+
const sandboxName = (this.getUsername() || '').split(`${prodOrg.getUsername()}.`)[1];
|
|
478
|
+
if (!sandboxName) {
|
|
479
|
+
this.logger.debug('Could not construct a sandbox name');
|
|
480
|
+
throw new Error();
|
|
481
|
+
}
|
|
482
|
+
this.logger.debug(`attempting to locate sandbox with username ${sandboxName}`);
|
|
483
|
+
result = await this.queryProduction(prodOrg, 'SandboxName', sandboxName);
|
|
484
|
+
if (!result) {
|
|
485
|
+
this.logger.debug(`Failed to find sandbox with username: ${sandboxName}`);
|
|
486
|
+
throw new Error();
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
catch {
|
|
490
|
+
// if an error is thrown, don't panic yet. we'll try querying by orgId
|
|
491
|
+
const trimmedId = sfdc_1.sfdc.trimTo15(this.getOrgId());
|
|
492
|
+
this.logger.debug(`defaulting to trimming id from ${this.getOrgId()} to ${trimmedId}`);
|
|
493
|
+
try {
|
|
494
|
+
result = await this.queryProduction(prodOrg, 'SandboxOrganization', trimmedId);
|
|
495
|
+
}
|
|
496
|
+
catch {
|
|
497
|
+
throw sfdxError_1.SfdxError.create('@salesforce/core', 'org', 'SandboxNotFound', [trimmedId]);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
const deleteResult = await prodOrg.connection.tooling.delete('SandboxInfo', result.SandboxInfoId);
|
|
501
|
+
this.logger.debug('Return from calling tooling.delete: %o ', deleteResult);
|
|
502
|
+
await this.remove();
|
|
503
|
+
if (Array.isArray(deleteResult) || !deleteResult.success) {
|
|
504
|
+
throw sfdxError_1.SfdxError.create('@salesforce/core', 'org', 'SandboxDeleteFailed', [JSON.stringify(deleteResult)]);
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* If this Org is a scratch org, calling this method will delete the scratch org from the DevHub and clean up any local files
|
|
509
|
+
*
|
|
510
|
+
* @param devHub - optional DevHub Org of the to-be-deleted scratch org
|
|
511
|
+
* @private
|
|
512
|
+
*/
|
|
513
|
+
async deleteScratchOrg(devHub) {
|
|
514
|
+
// if we didn't get a devHub, we'll get it from the this org
|
|
515
|
+
devHub !== null && devHub !== void 0 ? devHub : (devHub = await this.getDevHubOrg());
|
|
516
|
+
if (!devHub) {
|
|
517
|
+
throw sfdxError_1.SfdxError.create('@salesforce/core', 'org', 'NoDevHubFound');
|
|
518
|
+
}
|
|
519
|
+
if (devHub.getOrgId() === this.getOrgId()) {
|
|
520
|
+
// we're attempting to delete a DevHub
|
|
521
|
+
throw sfdxError_1.SfdxError.create('@salesforce/core', 'org', 'DeleteOrgHubError');
|
|
522
|
+
}
|
|
523
|
+
try {
|
|
524
|
+
const devHubConn = devHub.getConnection();
|
|
525
|
+
const username = this.getUsername();
|
|
526
|
+
const activeScratchOrgRecordId = (await devHubConn.singleRecordQuery(`SELECT Id FROM ActiveScratchOrg WHERE SignupUsername='${username}'`)).Id;
|
|
527
|
+
this.logger.trace(`found matching ActiveScratchOrg with SignupUsername: ${username}. Deleting...`);
|
|
528
|
+
await devHubConn.delete('ActiveScratchOrg', activeScratchOrgRecordId);
|
|
529
|
+
await this.remove();
|
|
530
|
+
}
|
|
531
|
+
catch (err) {
|
|
532
|
+
this.logger.info(err instanceof Error ? err.message : err);
|
|
533
|
+
if (err instanceof Error && (err.name === 'INVALID_TYPE' || err.name === 'INSUFFICIENT_ACCESS_OR_READONLY')) {
|
|
534
|
+
// most likely from devHubConn.delete
|
|
535
|
+
this.logger.info('Insufficient privilege to access ActiveScratchOrgs.');
|
|
536
|
+
throw sfdxError_1.SfdxError.create('@salesforce/core', 'org', 'InsufficientAccessToDelete');
|
|
537
|
+
}
|
|
538
|
+
if (err instanceof Error && err.name === connection_1.SingleRecordQueryErrors.NoRecords) {
|
|
539
|
+
// most likely from singleRecordQuery
|
|
540
|
+
this.logger.info('The above error can be the result of deleting an expired or already deleted org.');
|
|
541
|
+
this.logger.info('attempting to cleanup the auth file');
|
|
542
|
+
await this.removeAuth();
|
|
543
|
+
throw sfdxError_1.SfdxError.create('@salesforce/core', 'org', 'ScratchOrgNotFound');
|
|
544
|
+
}
|
|
545
|
+
throw err;
|
|
546
|
+
}
|
|
547
|
+
}
|
|
419
548
|
/**
|
|
420
549
|
* Returns a promise to delete an auth info file from the local file system and any related cache information for
|
|
421
550
|
* this Org.. You don't want to call this method directly. Instead consider calling Org.remove()
|
|
@@ -465,7 +594,6 @@ class Org extends kit_1.AsyncCreatable {
|
|
|
465
594
|
*
|
|
466
595
|
* @param throwWhenRemoveFails true if manageDelete should throw or not if the deleted fails.
|
|
467
596
|
*/
|
|
468
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
469
597
|
async removeUsers(throwWhenRemoveFails) {
|
|
470
598
|
this.logger.debug(`Removing users associate with org: ${this.getOrgId()}`);
|
|
471
599
|
const config = await this.retrieveOrgUsersConfig();
|
package/lib/sfdxError.d.ts
CHANGED
|
@@ -149,7 +149,7 @@ export declare class SfdxError extends NamedError {
|
|
|
149
149
|
* @param err The error to convert.
|
|
150
150
|
*/
|
|
151
151
|
static wrap(err: Error | string): SfdxError;
|
|
152
|
-
get code(): string;
|
|
152
|
+
get code(): string | undefined | any;
|
|
153
153
|
set code(code: string);
|
|
154
154
|
/**
|
|
155
155
|
* Sets the name of the command. For convenience `this` object is returned.
|
package/lib/sfdxError.js
CHANGED
package/lib/testSetup.d.ts
CHANGED
|
@@ -388,7 +388,9 @@ export declare class MockTestOrgData {
|
|
|
388
388
|
refreshToken: string;
|
|
389
389
|
userId: string;
|
|
390
390
|
redirectUri: string;
|
|
391
|
-
constructor(id?: string
|
|
391
|
+
constructor(id?: string, options?: {
|
|
392
|
+
username: string;
|
|
393
|
+
});
|
|
392
394
|
createDevHubUsername(username: string): void;
|
|
393
395
|
makeDevHub(): void;
|
|
394
396
|
createUser(user: string): MockTestOrgData;
|
package/lib/testSetup.js
CHANGED
|
@@ -63,7 +63,7 @@ function defaultFakeConnectionRequest() {
|
|
|
63
63
|
* ```
|
|
64
64
|
* @param sinon
|
|
65
65
|
*/
|
|
66
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
66
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
|
|
67
67
|
const instantiateContext = (sinon) => {
|
|
68
68
|
if (!sinon) {
|
|
69
69
|
try {
|
|
@@ -464,11 +464,11 @@ exports.StreamingMockCometClient = StreamingMockCometClient;
|
|
|
464
464
|
* Mock class for OrgData.
|
|
465
465
|
*/
|
|
466
466
|
class MockTestOrgData {
|
|
467
|
-
constructor(id = uniqid()) {
|
|
467
|
+
constructor(id = uniqid(), options) {
|
|
468
468
|
this.testId = id;
|
|
469
469
|
this.userId = `user_id_${this.testId}`;
|
|
470
470
|
this.orgId = `${this.testId}`;
|
|
471
|
-
this.username = `admin_${this.testId}@gb.org`;
|
|
471
|
+
this.username = (options === null || options === void 0 ? void 0 : options.username) || `admin_${this.testId}@gb.org`;
|
|
472
472
|
this.loginUrl = `http://login.${this.testId}.salesforce.com`;
|
|
473
473
|
this.instanceUrl = `http://instance.${this.testId}.salesforce.com`;
|
|
474
474
|
this.clientId = `${this.testId}/client_id`;
|
package/lib/util/sfdcUrl.js
CHANGED
|
@@ -12,12 +12,13 @@ const kit_1 = require("@salesforce/kit");
|
|
|
12
12
|
const ts_types_1 = require("@salesforce/ts-types");
|
|
13
13
|
const myDomainResolver_1 = require("../status/myDomainResolver");
|
|
14
14
|
const logger_1 = require("../logger");
|
|
15
|
+
const lifecycleEvents_1 = require("../lifecycleEvents");
|
|
15
16
|
class SfdcUrl extends url_1.URL {
|
|
16
17
|
constructor(input, base) {
|
|
17
18
|
super(input.toString(), base);
|
|
18
19
|
if (this.protocol !== 'https:' && !SfdcUrl.cache.has(this.origin)) {
|
|
19
20
|
SfdcUrl.cache.add(this.origin);
|
|
20
|
-
|
|
21
|
+
void lifecycleEvents_1.Lifecycle.getInstance().emitWarning(`Using insecure protocol: ${this.protocol} on url: ${this.origin}`);
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
/**
|
package/messages/org.json
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
"NotFoundOnDevHub": "The scratch org does not belong to the dev hub username %s.",
|
|
3
|
+
"NotADevHub": "The provided dev hub username %s is not a valid dev hub.",
|
|
4
|
+
"NoDevHubFound": "Unable to associate this scratch org with a DevHub",
|
|
5
|
+
"DeleteOrgHubError": "The Dev Hub org cannot be deleted.",
|
|
6
|
+
"InsufficientAccessToDelete": "You do not have the appropriate permissions to delete a scratch org. Please contact your Salesforce admin.",
|
|
7
|
+
"ScratchOrgNotFound": "Attempting to delete an expired or deleted org",
|
|
8
|
+
"SandboxDeleteFailed": "The sandbox org deletion failed with a result of %s.",
|
|
9
|
+
"SandboxNotFound": "We can't find a SandboxProcess for the sandbox org %s."
|
|
10
|
+
}
|
package/package.json
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.30.1",
|
|
4
4
|
"description": "Core libraries to interact with SFDX projects, orgs, and APIs.",
|
|
5
5
|
"main": "lib/exported",
|
|
6
|
+
"types": "lib/exported.d.ts",
|
|
6
7
|
"license": "BSD-3-Clause",
|
|
7
8
|
"scripts": {
|
|
8
9
|
"build": "sf-build",
|
|
9
10
|
"ci-docs": "yarn sf-ci-docs",
|
|
10
11
|
"clean": "sf-clean",
|
|
11
|
-
"clean-all": "-clean all",
|
|
12
|
+
"clean-all": "sf-clean all",
|
|
12
13
|
"compile": "sf-compile",
|
|
13
14
|
"docs": "sf-docs",
|
|
14
15
|
"format": "sf-format",
|
|
15
16
|
"lint": "sf-lint",
|
|
16
17
|
"lint-fix": "yarn sf-lint --fix",
|
|
17
|
-
"postcompile": "tsc -p test
|
|
18
|
+
"postcompile": "tsc -p test && tsc -p typedocExamples",
|
|
18
19
|
"prepack": "sf-build",
|
|
19
20
|
"pretest": "sf-compile-test",
|
|
20
21
|
"test": "sf-test"
|
|
@@ -44,7 +45,7 @@
|
|
|
44
45
|
"@salesforce/schemas": "^1.0.1",
|
|
45
46
|
"@salesforce/ts-types": "^1.5.13",
|
|
46
47
|
"@types/graceful-fs": "^4.1.5",
|
|
47
|
-
"@types/jsforce": "^1.9.
|
|
48
|
+
"@types/jsforce": "^1.9.35",
|
|
48
49
|
"@types/mkdirp": "^1.0.1",
|
|
49
50
|
"debug": "^3.1.0",
|
|
50
51
|
"graceful-fs": "^4.2.4",
|
|
@@ -52,19 +53,21 @@
|
|
|
52
53
|
"jsforce": "^1.10.1",
|
|
53
54
|
"jsonwebtoken": "8.5.0",
|
|
54
55
|
"mkdirp": "1.0.4",
|
|
56
|
+
"semver": "^7.3.5",
|
|
55
57
|
"sfdx-faye": "^1.0.9",
|
|
56
58
|
"ts-retry-promise": "^0.6.0"
|
|
57
59
|
},
|
|
58
60
|
"devDependencies": {
|
|
59
61
|
"@salesforce/dev-config": "^2.0.0",
|
|
60
|
-
"@salesforce/dev-scripts": "^0.
|
|
61
|
-
"@salesforce/prettier-config": "^0.0.
|
|
62
|
+
"@salesforce/dev-scripts": "^0.9.18",
|
|
63
|
+
"@salesforce/prettier-config": "^0.0.2",
|
|
62
64
|
"@salesforce/ts-sinon": "^1.3.15",
|
|
63
65
|
"@types/debug": "0.0.30",
|
|
64
66
|
"@types/jsen": "0.0.19",
|
|
65
67
|
"@types/jsonwebtoken": "8.3.2",
|
|
68
|
+
"@types/semver": "^7.3.9",
|
|
66
69
|
"@types/shelljs": "0.7.8",
|
|
67
|
-
"@types/sinon": "^
|
|
70
|
+
"@types/sinon": "^10.0.6",
|
|
68
71
|
"@typescript-eslint/eslint-plugin": "^4.2.0",
|
|
69
72
|
"@typescript-eslint/parser": "4.26.0",
|
|
70
73
|
"chai": "^4.2.0",
|
|
@@ -84,11 +87,10 @@
|
|
|
84
87
|
"prettier": "^2.0.5",
|
|
85
88
|
"pretty-quick": "^2.0.1",
|
|
86
89
|
"shelljs": "0.8.1",
|
|
87
|
-
"sinon": "
|
|
90
|
+
"sinon": "10.0.0",
|
|
88
91
|
"ts-node": "^8.10.2",
|
|
89
92
|
"typescript": "^4.1.3"
|
|
90
93
|
},
|
|
91
|
-
"types": "lib/exported.d.ts",
|
|
92
94
|
"repository": {
|
|
93
95
|
"type": "git",
|
|
94
96
|
"url": "https://github.com/forcedotcom/sfdx-core.git"
|