@salesforce/core 2.28.1 → 2.29.0
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 +63 -52
- package/lib/authInfo.d.ts +2 -6
- package/lib/authInfo.js +5 -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.js +1 -0
- package/lib/sfdxError.d.ts +1 -1
- package/lib/sfdxError.js +1 -0
- package/lib/testSetup.js +1 -1
- package/lib/util/sfdcUrl.js +8 -2
- package/messages/core.json +3 -3
- package/package.json +9 -7
package/CHANGELOG.md
CHANGED
|
@@ -2,179 +2,190 @@
|
|
|
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
|
-
|
|
5
|
+
## [2.29.0](https://github.com/forcedotcom/sfdx-core/compare/v2.28.4...v2.29.0) (2021-11-17)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* cleans up old listeners from upgraded instance ([e3f2d69](https://github.com/forcedotcom/sfdx-core/commit/e3f2d69ccd5c096d37addb1b982e19354175f11a))
|
|
11
|
+
* use warnings instead of process in sfdx-core ([c1f7e98](https://github.com/forcedotcom/sfdx-core/commit/c1f7e98f6b19d57da1a2ee0cdf58e449079f0ee7))
|
|
12
|
+
* warning and telemetry events ([80a8039](https://github.com/forcedotcom/sfdx-core/commit/80a8039e2f686d973ddbc24c9a2980fb93928d13))
|
|
13
|
+
* warning and telemetry events ([a04b293](https://github.com/forcedotcom/sfdx-core/commit/a04b29355c8ca6c7e37e071ccc159aff5e5e9ca0))
|
|
6
14
|
|
|
7
15
|
|
|
8
16
|
### Bug Fixes
|
|
9
17
|
|
|
10
|
-
*
|
|
18
|
+
* transfer listeners when upgrading the global instance to newer version ([0a40831](https://github.com/forcedotcom/sfdx-core/commit/0a408317c132548771ced0fe196178d2e9c76232))
|
|
11
19
|
|
|
12
|
-
|
|
20
|
+
### [2.28.4](https://github.com/forcedotcom/sfdx-core/compare/v2.28.3...v2.28.4) (2021-11-10)
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
- 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))
|
|
25
|
+
|
|
26
|
+
### [2.28.3](https://github.com/forcedotcom/sfdx-core/compare/v2.28.2...v2.28.3) (2021-11-08)
|
|
27
|
+
|
|
28
|
+
### Bug Fixes
|
|
13
29
|
|
|
30
|
+
- fix unit test ([d903c04](https://github.com/forcedotcom/sfdx-core/commit/d903c04e5f3e4f01fccb3f00b91560c443013ddf))
|
|
31
|
+
- force new release ([124bb74](https://github.com/forcedotcom/sfdx-core/commit/124bb744c5ecc28cb8babf285c6d8c3032eb7ef6))
|
|
32
|
+
- improve error message when providing an invalid username ([2ab4bbd](https://github.com/forcedotcom/sfdx-core/commit/2ab4bbdefd962283d88ccb735de88c88fe189d39))
|
|
33
|
+
|
|
34
|
+
### [2.28.2](https://github.com/forcedotcom/sfdx-core/compare/v2.28.1...v2.28.2) (2021-10-13)
|
|
35
|
+
|
|
36
|
+
### Bug Fixes
|
|
37
|
+
|
|
38
|
+
- support for .mil sandboxes ([9ef35c7](https://github.com/forcedotcom/sfdx-core/commit/9ef35c7b1ef0fe974c3bd3b89b862a436e00f7d9))
|
|
39
|
+
|
|
40
|
+
### [2.28.1](https://github.com/forcedotcom/sfdx-core/compare/v2.28.0...v2.28.1) (2021-10-06)
|
|
41
|
+
|
|
42
|
+
### Bug Fixes
|
|
43
|
+
|
|
44
|
+
- crmforce.mil ([e263d5d](https://github.com/forcedotcom/sfdx-core/commit/e263d5d74be9c0651e5c2676d6eec1c31fca05e4))
|
|
45
|
+
|
|
46
|
+
## [2.28.0](https://github.com/forcedotcom/sfdx-core/compare/v2.27.2...v2.28.0) (2021-09-16)
|
|
14
47
|
|
|
15
48
|
### Features
|
|
16
49
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
50
|
+
- add custom templates config ([3cf8a8c](https://github.com/forcedotcom/sfdx-core/commit/3cf8a8cee1e7196efced989dcca9b545e1283386))
|
|
51
|
+
- add validator for custom templates config ([dd2bcfe](https://github.com/forcedotcom/sfdx-core/commit/dd2bcfe8e7fee5c5c1c6321189ec04288103d5b6))
|
|
52
|
+
- update config name ([72e84bf](https://github.com/forcedotcom/sfdx-core/commit/72e84bfacef48a1c2d00a61ebbae3f632601abbd))
|
|
20
53
|
|
|
21
54
|
### [2.27.2](https://github.com/forcedotcom/sfdx-core/compare/v2.27.1...v2.27.2) (2021-08-05)
|
|
22
55
|
|
|
23
|
-
|
|
24
56
|
### Bug Fixes
|
|
25
57
|
|
|
26
|
-
|
|
58
|
+
- improve error handling while removing config props ([eecf7b0](https://github.com/forcedotcom/sfdx-core/commit/eecf7b0d0cf14e1371dc4c5ef03a413f864b0a8b))
|
|
27
59
|
|
|
28
60
|
### [2.27.1](https://github.com/forcedotcom/sfdx-core/compare/v2.27.0...v2.27.1) (2021-08-05)
|
|
29
61
|
|
|
30
|
-
|
|
31
62
|
### Bug Fixes
|
|
32
63
|
|
|
33
|
-
|
|
64
|
+
- 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))
|
|
34
65
|
|
|
35
66
|
## [2.27.0](https://github.com/forcedotcom/sfdx-core/compare/v2.26.1...v2.27.0) (2021-07-29)
|
|
36
67
|
|
|
37
|
-
|
|
38
68
|
### Features
|
|
39
69
|
|
|
40
|
-
|
|
70
|
+
- Core URL class SfdcUrl ([#420](https://github.com/forcedotcom/sfdx-core/issues/420)) ([66881ea](https://github.com/forcedotcom/sfdx-core/commit/66881eae2f30215c862ea398bfc1630d9a5898fe))
|
|
41
71
|
|
|
42
72
|
### [2.26.1](https://github.com/forcedotcom/sfdx-core/compare/v2.26.0...v2.26.1) (2021-07-19)
|
|
43
73
|
|
|
44
|
-
|
|
45
74
|
### Bug Fixes
|
|
46
75
|
|
|
47
|
-
|
|
76
|
+
- 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))
|
|
48
77
|
|
|
49
78
|
## [2.26.0](https://github.com/forcedotcom/sfdx-core/compare/v2.25.1...v2.26.0) (2021-07-13)
|
|
50
79
|
|
|
51
|
-
|
|
52
80
|
### Features
|
|
53
81
|
|
|
54
|
-
|
|
82
|
+
- update generate password functionality ([#432](https://github.com/forcedotcom/sfdx-core/issues/432)) ([ed65e83](https://github.com/forcedotcom/sfdx-core/commit/ed65e83da3afe0d101743ee89cc7b2a7a38d5254))
|
|
55
83
|
|
|
56
84
|
### [2.25.1](https://github.com/forcedotcom/sfdx-core/compare/v3.1.1-3.2...v2.25.1) (2021-06-30)
|
|
57
85
|
|
|
58
|
-
|
|
59
86
|
### Bug Fixes
|
|
60
87
|
|
|
61
|
-
|
|
88
|
+
- set retries to INFINITELY for polling client ([31539b4](https://github.com/forcedotcom/sfdx-core/commit/31539b4f0edd0cc1c049f70331ed5e40b8af55ea))
|
|
62
89
|
|
|
63
90
|
## [2.25.0](https://github.com/forcedotcom/sfdx-core/compare/v2.24.2...v2.25.0) (2021-06-30)
|
|
64
91
|
|
|
65
|
-
|
|
66
92
|
### Features
|
|
67
93
|
|
|
68
|
-
|
|
94
|
+
- @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)
|
|
69
95
|
|
|
70
96
|
### [2.24.2](https://github.com/forcedotcom/sfdx-core/compare/v3.1.1-3.1...v2.24.2) (2021-06-23)
|
|
71
97
|
|
|
72
|
-
|
|
73
98
|
### Bug Fixes
|
|
74
99
|
|
|
75
|
-
|
|
100
|
+
- puts some types back in dependencies ([94bea31](https://github.com/forcedotcom/sfdx-core/commit/94bea31037a41d4377faecb22bce8a2d12e95f4f))
|
|
76
101
|
|
|
77
102
|
### [2.24.1](https://github.com/forcedotcom/sfdx-core/compare/v2.24.0...v2.24.1) (2021-06-23)
|
|
78
103
|
|
|
79
|
-
|
|
80
104
|
### Bug Fixes
|
|
81
105
|
|
|
82
|
-
|
|
106
|
+
- rewrite polling client ([8d363d1](https://github.com/forcedotcom/sfdx-core/commit/8d363d13616f5efa944d4bb717a010add3c996b5))
|
|
83
107
|
|
|
84
108
|
## [2.24.0](https://github.com/forcedotcom/sfdx-core/compare/v2.23.5...v2.24.0) (2021-06-08)
|
|
85
109
|
|
|
86
|
-
|
|
87
110
|
### Features
|
|
88
111
|
|
|
89
|
-
|
|
112
|
+
- exported function checkLightningDomain() ([#415](https://github.com/forcedotcom/sfdx-core/issues/415)) ([8e75231](https://github.com/forcedotcom/sfdx-core/commit/8e752313abf4a383a6ef18250ffac78b398987dd))
|
|
90
113
|
|
|
91
114
|
### [2.23.5](https://github.com/forcedotcom/sfdx-core/compare/v3.1.1-3.0...v2.23.5) (2021-06-07)
|
|
92
115
|
|
|
93
|
-
|
|
94
116
|
### Bug Fixes
|
|
95
117
|
|
|
96
|
-
|
|
118
|
+
- w-9299422 (login url from config) and fs-parallelization ([043bb17](https://github.com/forcedotcom/sfdx-core/commit/043bb179dbf64f9c4522a4c0f0720ae09794227c))
|
|
97
119
|
|
|
98
120
|
### [2.23.4](https://github.com/forcedotcom/sfdx-core/compare/v2.23.3...v2.23.4) (2021-06-03)
|
|
99
121
|
|
|
100
|
-
|
|
101
122
|
### Bug Fixes
|
|
102
123
|
|
|
103
|
-
|
|
124
|
+
- works with TS4+ and jsforce types ([#413](https://github.com/forcedotcom/sfdx-core/issues/413)) ([b77cdad](https://github.com/forcedotcom/sfdx-core/commit/b77cdad56b114290b8e5fd23d968e23e7d4eedf4))
|
|
104
125
|
|
|
105
126
|
### [2.23.3](https://github.com/forcedotcom/sfdx-core/compare/v2.23.2...v2.23.3) (2021-06-03)
|
|
106
127
|
|
|
107
128
|
### [2.23.2](https://github.com/forcedotcom/sfdx-core/compare/v2.23.1...v2.23.2) (2021-06-02)
|
|
108
129
|
|
|
109
|
-
|
|
110
130
|
### Bug Fixes
|
|
111
131
|
|
|
112
|
-
|
|
132
|
+
- 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)
|
|
113
133
|
|
|
114
134
|
### [2.23.1](https://github.com/forcedotcom/sfdx-core/compare/v2.23.0...v2.23.1) (2021-05-27)
|
|
115
135
|
|
|
116
136
|
## [2.23.0](https://github.com/forcedotcom/sfdx-core/compare/v2.22.0...v2.23.0) (2021-05-26)
|
|
117
137
|
|
|
118
|
-
|
|
119
138
|
### Features
|
|
120
139
|
|
|
121
|
-
|
|
122
|
-
|
|
140
|
+
- export getJwtAudienceUrl ([e7d26d2](https://github.com/forcedotcom/sfdx-core/commit/e7d26d20106d6abb6b424936bdf26c0a9f8cd175))
|
|
123
141
|
|
|
124
142
|
### Bug Fixes
|
|
125
143
|
|
|
126
|
-
|
|
144
|
+
- export library method ([d0016f9](https://github.com/forcedotcom/sfdx-core/commit/d0016f96da1246535049884c1043399239a33c00))
|
|
127
145
|
|
|
128
146
|
## [2.22.0](https://github.com/forcedotcom/sfdx-core/compare/v2.21.0...v2.22.0) (2021-05-24)
|
|
129
147
|
|
|
130
|
-
|
|
131
148
|
### Features
|
|
132
149
|
|
|
133
|
-
|
|
150
|
+
- export getJwtAudienceUrl ([#407](https://github.com/forcedotcom/sfdx-core/issues/407)) ([585bb07](https://github.com/forcedotcom/sfdx-core/commit/585bb073434d73473a855ee52b7ddc6f0228aae1))
|
|
134
151
|
|
|
135
152
|
## [2.21.0](https://github.com/forcedotcom/sfdx-core/compare/v2.20.11...v2.21.0) (2021-05-24)
|
|
136
153
|
|
|
137
|
-
|
|
138
154
|
### Features
|
|
139
155
|
|
|
140
|
-
|
|
156
|
+
- modify authInfo to return username for access token auth ([160b7d2](https://github.com/forcedotcom/sfdx-core/commit/160b7d20e32b80d7a54c8cf679154fcbaa9e8cda))
|
|
141
157
|
|
|
142
158
|
### [2.20.11](https://github.com/forcedotcom/sfdx-core/compare/v3.1.0-3.0...v2.20.11) (2021-05-12)
|
|
143
159
|
|
|
144
|
-
|
|
145
160
|
### Bug Fixes
|
|
146
161
|
|
|
147
|
-
|
|
162
|
+
- force release ([f0b837a](https://github.com/forcedotcom/sfdx-core/commit/f0b837ab7b4d0361c2fa3ba15fe56cd2f7cc1fd0))
|
|
148
163
|
|
|
149
164
|
### [2.20.10](https://github.com/forcedotcom/sfdx-core/compare/v2.20.9...v2.20.10) (2021-04-14)
|
|
150
165
|
|
|
151
|
-
|
|
152
166
|
### Bug Fixes
|
|
153
167
|
|
|
154
|
-
|
|
168
|
+
- add another internal test env domain ([6ea538f](https://github.com/forcedotcom/sfdx-core/commit/6ea538f2ce62daba7262a247472ce821c6e2616f))
|
|
155
169
|
|
|
156
170
|
### [2.20.9](https://github.com/forcedotcom/sfdx-core/compare/v2.20.8...v2.20.9) (2021-04-05)
|
|
157
171
|
|
|
158
|
-
|
|
159
172
|
### Bug Fixes
|
|
160
173
|
|
|
161
|
-
|
|
174
|
+
- allow = in authUrl tokens ([2337fcd](https://github.com/forcedotcom/sfdx-core/commit/2337fcddfb1907a7092cd52f5b3ad73ae963d59e))
|
|
162
175
|
|
|
163
176
|
### [2.20.8](https://github.com/forcedotcom/sfdx-core/compare/v2.20.7...v2.20.8) (2021-04-03)
|
|
164
177
|
|
|
165
|
-
|
|
166
178
|
### Bug Fixes
|
|
167
179
|
|
|
168
|
-
|
|
180
|
+
- debugEnabled should be public ([dbd0124](https://github.com/forcedotcom/sfdx-core/commit/dbd01243003f555b8b4db45c83e81cc08b8cb9a1))
|
|
169
181
|
|
|
170
182
|
### [2.20.7](https://github.com/forcedotcom/sfdx-core/compare/v2.20.6...v2.20.7) (2021-04-02)
|
|
171
183
|
|
|
172
|
-
|
|
173
184
|
### Bug Fixes
|
|
174
185
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
186
|
+
- add deployRecentValidation ([62d367b](https://github.com/forcedotcom/sfdx-core/commit/62d367b217e6b552573bd7176b064e28252348c5))
|
|
187
|
+
- add deployRecentValidation ([a39c329](https://github.com/forcedotcom/sfdx-core/commit/a39c329b3fab603b537ae5ed8cce4773bdf24eb6))
|
|
188
|
+
- add test, clarify comments ([8d5679e](https://github.com/forcedotcom/sfdx-core/commit/8d5679ecbd482af84842f5c1c8908a059d97ef3f))
|
|
178
189
|
|
|
179
190
|
### [2.20.6](https://github.com/forcedotcom/sfdx-core/compare/v2.20.5...v2.20.6) (2021-04-02)
|
|
180
191
|
|
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
|
*/
|
|
@@ -343,5 +338,6 @@ export declare namespace AuthInfo {
|
|
|
343
338
|
* creation.
|
|
344
339
|
*/
|
|
345
340
|
parentUsername?: string;
|
|
341
|
+
isDevHub?: boolean;
|
|
346
342
|
}
|
|
347
343
|
}
|
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
|
|
@@ -664,7 +665,10 @@ class AuthInfo extends kit_1.AsyncCreatable {
|
|
|
664
665
|
}
|
|
665
666
|
catch (e) {
|
|
666
667
|
if (e.code === 'ENOENT') {
|
|
667
|
-
throw sfdxError_1.SfdxError.create('@salesforce/core', 'core', 'NamedOrgNotFound', [
|
|
668
|
+
throw sfdxError_1.SfdxError.create('@salesforce/core', 'core', 'NamedOrgNotFound', [
|
|
669
|
+
this.options.isDevHub ? 'devhub username' : 'username',
|
|
670
|
+
username,
|
|
671
|
+
]);
|
|
668
672
|
}
|
|
669
673
|
else {
|
|
670
674
|
throw e;
|
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.js
CHANGED
|
@@ -402,6 +402,7 @@ class Org extends kit_1.AsyncCreatable {
|
|
|
402
402
|
// If no username is provided or resolvable from an alias, AuthInfo will throw an SfdxError.
|
|
403
403
|
authInfo: await authInfo_1.AuthInfo.create({
|
|
404
404
|
username: (username != null && (await aliases_1.Aliases.fetch(username))) || username,
|
|
405
|
+
isDevHub: this.options.isDevHub,
|
|
405
406
|
}),
|
|
406
407
|
});
|
|
407
408
|
}
|
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.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 {
|
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
|
/**
|
|
@@ -97,9 +98,13 @@ class SfdcUrl extends url_1.URL {
|
|
|
97
98
|
return LOCAL_PARTS.some((part) => this.origin.includes(part));
|
|
98
99
|
}
|
|
99
100
|
toLightningDomain() {
|
|
101
|
+
if (this.origin.endsWith('.my.salesforce.mil')) {
|
|
102
|
+
return this.origin.replace('.my.salesforce.mil', '.lightning.crmforce.mil');
|
|
103
|
+
}
|
|
104
|
+
// all non-mil domains
|
|
100
105
|
return `https://${ts_types_1.ensureArray(/https?:\/\/([^.]*)/.exec(this.origin))
|
|
101
106
|
.slice(1, 2)
|
|
102
|
-
.pop()}.lightning
|
|
107
|
+
.pop()}.lightning.force.com`;
|
|
103
108
|
}
|
|
104
109
|
/**
|
|
105
110
|
* Tests whether this url has the lightning domain extension
|
|
@@ -148,6 +153,7 @@ class SfdcUrl extends url_1.URL {
|
|
|
148
153
|
*/
|
|
149
154
|
isSandboxUrl(createdOrgInstance) {
|
|
150
155
|
return ((createdOrgInstance && /^cs|s$/gi.test(createdOrgInstance)) ||
|
|
156
|
+
this.origin.endsWith('sandbox.my.salesforce.mil') ||
|
|
151
157
|
/sandbox\.my\.salesforce\.com/gi.test(this.origin) || // enhanced domains >= 230
|
|
152
158
|
/(cs[0-9]+(\.my|)\.salesforce\.com)/gi.test(this.origin) || // my domains on CS instance OR CS instance without my domain
|
|
153
159
|
/([a-z]{3}[0-9]+s\.sfdc-.+\.salesforce\.com)/gi.test(this.origin) || // falcon sandbox ex: usa2s.sfdc-whatever.salesforce.com
|
package/messages/core.json
CHANGED
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
"OrgDataNotAvailableErrorAction2": "Use `sfdx force:config:set` to update the defaultusername.",
|
|
13
13
|
"OrgDataNotAvailableErrorAction3": "Use `sfdx force:org:create` to create a new org.",
|
|
14
14
|
"OrgDataNotAvailableErrorAction4": "Use `sfdx force:auth` to authenticate an existing org.",
|
|
15
|
-
"NamedOrgNotFound": "No
|
|
16
|
-
"NoAliasesFound": "Nothing to set",
|
|
17
|
-
"InvalidFormat": "Setting aliases must be in the format <key>=<value> but found: [%s]",
|
|
15
|
+
"NamedOrgNotFound": "No authorization information found for %s %s.",
|
|
16
|
+
"NoAliasesFound": "Nothing to set.",
|
|
17
|
+
"InvalidFormat": "Setting aliases must be in the format <key>=<value> but found: [%s].",
|
|
18
18
|
"NoAuthInfoFound": "No authorization information can be found.",
|
|
19
19
|
"InvalidJsonCasing": "All JSON input must have heads down camelcase keys. E.g., { sfdcLoginUrl: \"https://login.salesforce.com\" }\nFound \"%s\" at %s"
|
|
20
20
|
}
|
package/package.json
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.29.0",
|
|
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,17 +53,19 @@
|
|
|
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
70
|
"@types/sinon": "^9.0.8",
|
|
68
71
|
"@typescript-eslint/eslint-plugin": "^4.2.0",
|
|
@@ -88,7 +91,6 @@
|
|
|
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"
|