@salesforce/core 2.27.1 → 2.28.2
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 +30 -0
- package/lib/authInfo.d.ts +4 -0
- package/lib/authInfo.js +4 -0
- package/lib/authRemover.js +9 -6
- package/lib/config/aliases.d.ts +2 -0
- package/lib/config/aliases.js +2 -0
- package/lib/config/authInfoConfig.d.ts +2 -0
- package/lib/config/authInfoConfig.js +2 -0
- package/lib/config/config.d.ts +8 -0
- package/lib/config/config.js +19 -0
- package/lib/util/fs.d.ts +3 -0
- package/lib/util/fs.js +3 -0
- package/lib/util/sfdcUrl.d.ts +2 -1
- package/lib/util/sfdcUrl.js +13 -5
- package/messages/config.json +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,36 @@
|
|
|
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.28.2](https://github.com/forcedotcom/sfdx-core/compare/v2.28.1...v2.28.2) (2021-10-13)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* support for .mil sandboxes ([9ef35c7](https://github.com/forcedotcom/sfdx-core/commit/9ef35c7b1ef0fe974c3bd3b89b862a436e00f7d9))
|
|
11
|
+
|
|
12
|
+
### [2.28.1](https://github.com/forcedotcom/sfdx-core/compare/v2.28.0...v2.28.1) (2021-10-06)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* crmforce.mil ([e263d5d](https://github.com/forcedotcom/sfdx-core/commit/e263d5d74be9c0651e5c2676d6eec1c31fca05e4))
|
|
18
|
+
|
|
19
|
+
## [2.28.0](https://github.com/forcedotcom/sfdx-core/compare/v2.27.2...v2.28.0) (2021-09-16)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
* add custom templates config ([3cf8a8c](https://github.com/forcedotcom/sfdx-core/commit/3cf8a8cee1e7196efced989dcca9b545e1283386))
|
|
25
|
+
* add validator for custom templates config ([dd2bcfe](https://github.com/forcedotcom/sfdx-core/commit/dd2bcfe8e7fee5c5c1c6321189ec04288103d5b6))
|
|
26
|
+
* update config name ([72e84bf](https://github.com/forcedotcom/sfdx-core/commit/72e84bfacef48a1c2d00a61ebbae3f632601abbd))
|
|
27
|
+
|
|
28
|
+
### [2.27.2](https://github.com/forcedotcom/sfdx-core/compare/v2.27.1...v2.27.2) (2021-08-05)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Bug Fixes
|
|
32
|
+
|
|
33
|
+
* improve error handling while removing config props ([eecf7b0](https://github.com/forcedotcom/sfdx-core/commit/eecf7b0d0cf14e1371dc4c5ef03a413f864b0a8b))
|
|
34
|
+
|
|
5
35
|
### [2.27.1](https://github.com/forcedotcom/sfdx-core/compare/v2.27.0...v2.27.1) (2021-08-05)
|
|
6
36
|
|
|
7
37
|
|
package/lib/authInfo.d.ts
CHANGED
|
@@ -163,6 +163,8 @@ export declare class AuthInfo extends AsyncCreatable<AuthInfo.Options> {
|
|
|
163
163
|
* Get a list of all auth files stored in the global directory.
|
|
164
164
|
*
|
|
165
165
|
* @returns {Promise<string[]>}
|
|
166
|
+
*
|
|
167
|
+
* @deprecated Removed in v3 {@link https://github.com/forcedotcom/sfdx-core/blob/v3/MIGRATING_V2-V3.md#globalinfo}
|
|
166
168
|
*/
|
|
167
169
|
static listAllAuthFiles(): Promise<string[]>;
|
|
168
170
|
/**
|
|
@@ -187,6 +189,8 @@ export declare class AuthInfo extends AsyncCreatable<AuthInfo.Options> {
|
|
|
187
189
|
* Forces the auth file to be re-read from disk for a given user. Returns `true` if a value was removed.
|
|
188
190
|
*
|
|
189
191
|
* @param username The username for the auth info to re-read.
|
|
192
|
+
*
|
|
193
|
+
* @deprecated Removed in v3 {@link https://github.com/forcedotcom/sfdx-core/blob/v3/MIGRATING_V2-V3.md#configstore-configfile-authinfo-and-encrypting-values}
|
|
190
194
|
*/
|
|
191
195
|
static clearCache(username: string): boolean;
|
|
192
196
|
/**
|
package/lib/authInfo.js
CHANGED
|
@@ -216,6 +216,8 @@ class AuthInfo extends kit_1.AsyncCreatable {
|
|
|
216
216
|
* Get a list of all auth files stored in the global directory.
|
|
217
217
|
*
|
|
218
218
|
* @returns {Promise<string[]>}
|
|
219
|
+
*
|
|
220
|
+
* @deprecated Removed in v3 {@link https://github.com/forcedotcom/sfdx-core/blob/v3/MIGRATING_V2-V3.md#globalinfo}
|
|
219
221
|
*/
|
|
220
222
|
static async listAllAuthFiles() {
|
|
221
223
|
const globalFiles = await fs_1.fs.readdir(global_1.Global.DIR);
|
|
@@ -306,6 +308,8 @@ class AuthInfo extends kit_1.AsyncCreatable {
|
|
|
306
308
|
* Forces the auth file to be re-read from disk for a given user. Returns `true` if a value was removed.
|
|
307
309
|
*
|
|
308
310
|
* @param username The username for the auth info to re-read.
|
|
311
|
+
*
|
|
312
|
+
* @deprecated Removed in v3 {@link https://github.com/forcedotcom/sfdx-core/blob/v3/MIGRATING_V2-V3.md#configstore-configfile-authinfo-and-encrypting-values}
|
|
309
313
|
*/
|
|
310
314
|
static clearCache(username) {
|
|
311
315
|
if (username) {
|
package/lib/authRemover.js
CHANGED
|
@@ -209,12 +209,15 @@ class AuthRemover extends kit_1.AsyncOptionalCreatable {
|
|
|
209
209
|
.reduce((x, y) => x.concat(y), []);
|
|
210
210
|
const allKeys = keysWithUsername.concat(keysWithAlias);
|
|
211
211
|
this.logger.debug(`Found these config keys to remove: ${allKeys}`);
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
212
|
+
allKeys.forEach((key) => {
|
|
213
|
+
try {
|
|
214
|
+
config.unset(key);
|
|
215
|
+
}
|
|
216
|
+
catch {
|
|
217
|
+
this.logger.debug(`Failed to remove ${key}`);
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
await config.write();
|
|
218
221
|
}
|
|
219
222
|
}
|
|
220
223
|
}
|
package/lib/config/aliases.d.ts
CHANGED
|
@@ -22,6 +22,8 @@ export declare enum AliasGroup {
|
|
|
22
22
|
* const username: string = await Aliases.fetch('myAlias');
|
|
23
23
|
* ```
|
|
24
24
|
* https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_cli_usernames_orgs.htm
|
|
25
|
+
*
|
|
26
|
+
* @deprecated Replaced by GlobalInfo in v3 {@link https://github.com/forcedotcom/sfdx-core/blob/v3/MIGRATING_V2-V3.md#globalinfo}
|
|
25
27
|
*/
|
|
26
28
|
export declare class Aliases extends ConfigGroup<ConfigGroup.Options> {
|
|
27
29
|
/**
|
package/lib/config/aliases.js
CHANGED
|
@@ -33,6 +33,8 @@ var AliasGroup;
|
|
|
33
33
|
* const username: string = await Aliases.fetch('myAlias');
|
|
34
34
|
* ```
|
|
35
35
|
* https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_cli_usernames_orgs.htm
|
|
36
|
+
*
|
|
37
|
+
* @deprecated Replaced by GlobalInfo in v3 {@link https://github.com/forcedotcom/sfdx-core/blob/v3/MIGRATING_V2-V3.md#globalinfo}
|
|
36
38
|
*/
|
|
37
39
|
class Aliases extends configGroup_1.ConfigGroup {
|
|
38
40
|
/**
|
|
@@ -6,6 +6,8 @@ import { ConfigFile } from './configFile';
|
|
|
6
6
|
* ```
|
|
7
7
|
* const authInfo = await AuthInfoConfig.create(AuthInfoConfig.getOptions(username));
|
|
8
8
|
* ```
|
|
9
|
+
*
|
|
10
|
+
* @deprecated Replaced by GlobalInfo in v3 {@link https://github.com/forcedotcom/sfdx-core/blob/v3/MIGRATING_V2-V3.md#globalinfo}
|
|
9
11
|
*/
|
|
10
12
|
export declare class AuthInfoConfig extends ConfigFile<ConfigFile.Options> {
|
|
11
13
|
/**
|
|
@@ -15,6 +15,8 @@ const configFile_1 = require("./configFile");
|
|
|
15
15
|
* ```
|
|
16
16
|
* const authInfo = await AuthInfoConfig.create(AuthInfoConfig.getOptions(username));
|
|
17
17
|
* ```
|
|
18
|
+
*
|
|
19
|
+
* @deprecated Replaced by GlobalInfo in v3 {@link https://github.com/forcedotcom/sfdx-core/blob/v3/MIGRATING_V2-V3.md#globalinfo}
|
|
18
20
|
*/
|
|
19
21
|
class AuthInfoConfig extends configFile_1.ConfigFile {
|
|
20
22
|
/**
|
package/lib/config/config.d.ts
CHANGED
|
@@ -52,10 +52,14 @@ export interface ConfigPropertyMetaInput {
|
|
|
52
52
|
export declare class Config extends ConfigFile<ConfigFile.Options> {
|
|
53
53
|
/**
|
|
54
54
|
* Username associated with the default dev hub org.
|
|
55
|
+
*
|
|
56
|
+
* @deprecated Replaced by OrgConfigProperties.TARGET_DEV_HUB in v3 {@link https://github.com/forcedotcom/sfdx-core/blob/v3/MIGRATING_V2-V3.md#config}
|
|
55
57
|
*/
|
|
56
58
|
static readonly DEFAULT_DEV_HUB_USERNAME: string;
|
|
57
59
|
/**
|
|
58
60
|
* Username associate with the default org.
|
|
61
|
+
*
|
|
62
|
+
* @deprecated Replaced by OrgConfigProperties.TARGET_ORG in v3 {@link https://github.com/forcedotcom/sfdx-core/blob/v3/MIGRATING_V2-V3.md#config}
|
|
59
63
|
*/
|
|
60
64
|
static readonly DEFAULT_USERNAME: string;
|
|
61
65
|
/**
|
|
@@ -74,6 +78,10 @@ export declare class Config extends ConfigFile<ConfigFile.Options> {
|
|
|
74
78
|
* Disables telemetry reporting
|
|
75
79
|
*/
|
|
76
80
|
static readonly DISABLE_TELEMETRY = "disableTelemetry";
|
|
81
|
+
/**
|
|
82
|
+
* Custom templates repo or local location.
|
|
83
|
+
*/
|
|
84
|
+
static readonly CUSTOM_ORG_METADATA_TEMPLATES = "customOrgMetadataTemplates";
|
|
77
85
|
/**
|
|
78
86
|
* allows users to override the 10,000 result query limit
|
|
79
87
|
*/
|
package/lib/config/config.js
CHANGED
|
@@ -258,10 +258,14 @@ class Config extends configFile_1.ConfigFile {
|
|
|
258
258
|
exports.Config = Config;
|
|
259
259
|
/**
|
|
260
260
|
* Username associated with the default dev hub org.
|
|
261
|
+
*
|
|
262
|
+
* @deprecated Replaced by OrgConfigProperties.TARGET_DEV_HUB in v3 {@link https://github.com/forcedotcom/sfdx-core/blob/v3/MIGRATING_V2-V3.md#config}
|
|
261
263
|
*/
|
|
262
264
|
Config.DEFAULT_DEV_HUB_USERNAME = 'defaultdevhubusername';
|
|
263
265
|
/**
|
|
264
266
|
* Username associate with the default org.
|
|
267
|
+
*
|
|
268
|
+
* @deprecated Replaced by OrgConfigProperties.TARGET_ORG in v3 {@link https://github.com/forcedotcom/sfdx-core/blob/v3/MIGRATING_V2-V3.md#config}
|
|
265
269
|
*/
|
|
266
270
|
Config.DEFAULT_USERNAME = 'defaultusername';
|
|
267
271
|
/**
|
|
@@ -280,6 +284,10 @@ Config.API_VERSION = 'apiVersion';
|
|
|
280
284
|
* Disables telemetry reporting
|
|
281
285
|
*/
|
|
282
286
|
Config.DISABLE_TELEMETRY = 'disableTelemetry';
|
|
287
|
+
/**
|
|
288
|
+
* Custom templates repo or local location.
|
|
289
|
+
*/
|
|
290
|
+
Config.CUSTOM_ORG_METADATA_TEMPLATES = 'customOrgMetadataTemplates';
|
|
283
291
|
/**
|
|
284
292
|
* allows users to override the 10,000 result query limit
|
|
285
293
|
*/
|
|
@@ -308,6 +316,17 @@ Config.allowedProperties = [
|
|
|
308
316
|
},
|
|
309
317
|
},
|
|
310
318
|
},
|
|
319
|
+
{
|
|
320
|
+
key: Config.CUSTOM_ORG_METADATA_TEMPLATES,
|
|
321
|
+
input: {
|
|
322
|
+
// If a value is provided validate it otherwise no value is unset.
|
|
323
|
+
validator: (value) => value == null || ts_types_1.isString(value),
|
|
324
|
+
get failedMessage() {
|
|
325
|
+
var _a;
|
|
326
|
+
return (_a = Config.messages) === null || _a === void 0 ? void 0 : _a.getMessage('InvalidCustomOrgMetadataTemplates');
|
|
327
|
+
},
|
|
328
|
+
},
|
|
329
|
+
},
|
|
311
330
|
{ key: Config.DEFAULT_DEV_HUB_USERNAME },
|
|
312
331
|
{ key: Config.DEFAULT_USERNAME },
|
|
313
332
|
{
|
package/lib/util/fs.d.ts
CHANGED
package/lib/util/fs.js
CHANGED
|
@@ -14,6 +14,9 @@ const kit_1 = require("@salesforce/kit");
|
|
|
14
14
|
const fsLib = require("graceful-fs");
|
|
15
15
|
const mkdirpLib = require("mkdirp");
|
|
16
16
|
const sfdxError_1 = require("../sfdxError");
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated Use fs/promises instead
|
|
19
|
+
*/
|
|
17
20
|
exports.fs = Object.assign({}, fsLib, {
|
|
18
21
|
/**
|
|
19
22
|
* The default file system mode to use when creating directories.
|
package/lib/util/sfdcUrl.d.ts
CHANGED
|
@@ -35,9 +35,10 @@ export declare class SfdcUrl extends URL {
|
|
|
35
35
|
* @returns {boolean} true if this is a local machine
|
|
36
36
|
*/
|
|
37
37
|
isLocalUrl(): boolean;
|
|
38
|
+
toLightningDomain(): string;
|
|
38
39
|
/**
|
|
39
40
|
* Tests whether this url has the lightning domain extension
|
|
40
|
-
* This method that performs the dns lookup of the host. If the lookup fails the internal polling (1 second), client will try again
|
|
41
|
+
* This method that performs the dns lookup of the host. If the lookup fails the internal polling (1 second), client will try again until timeout
|
|
41
42
|
* If SFDX_DOMAIN_RETRY environment variable is set (number) it overrides the default timeout duration (240 seconds)
|
|
42
43
|
*
|
|
43
44
|
* @returns {Promise<true | never>} The resolved ip address or never
|
package/lib/util/sfdcUrl.js
CHANGED
|
@@ -61,6 +61,7 @@ class SfdcUrl extends url_1.URL {
|
|
|
61
61
|
'.salesforce.com',
|
|
62
62
|
'.salesforceliveagent.com',
|
|
63
63
|
'.secure.force.com',
|
|
64
|
+
'crmforce.mil',
|
|
64
65
|
];
|
|
65
66
|
const allowlistOfSalesforceHosts = ['developer.salesforce.com', 'trailhead.salesforce.com'];
|
|
66
67
|
return allowlistOfSalesforceDomainPatterns.some((pattern) => {
|
|
@@ -95,25 +96,31 @@ class SfdcUrl extends url_1.URL {
|
|
|
95
96
|
const LOCAL_PARTS = ['localhost.sfdcdev.', '.internal.'];
|
|
96
97
|
return LOCAL_PARTS.some((part) => this.origin.includes(part));
|
|
97
98
|
}
|
|
99
|
+
toLightningDomain() {
|
|
100
|
+
if (this.origin.endsWith('.my.salesforce.mil')) {
|
|
101
|
+
return this.origin.replace('.my.salesforce.mil', '.lightning.crmforce.mil');
|
|
102
|
+
}
|
|
103
|
+
// all non-mil domains
|
|
104
|
+
return `https://${ts_types_1.ensureArray(/https?:\/\/([^.]*)/.exec(this.origin))
|
|
105
|
+
.slice(1, 2)
|
|
106
|
+
.pop()}.lightning.force.com`;
|
|
107
|
+
}
|
|
98
108
|
/**
|
|
99
109
|
* Tests whether this url has the lightning domain extension
|
|
100
|
-
* This method that performs the dns lookup of the host. If the lookup fails the internal polling (1 second), client will try again
|
|
110
|
+
* This method that performs the dns lookup of the host. If the lookup fails the internal polling (1 second), client will try again until timeout
|
|
101
111
|
* If SFDX_DOMAIN_RETRY environment variable is set (number) it overrides the default timeout duration (240 seconds)
|
|
102
112
|
*
|
|
103
113
|
* @returns {Promise<true | never>} The resolved ip address or never
|
|
104
114
|
* @throws {@link SfdxError} If can't resolve DNS.
|
|
105
115
|
*/
|
|
106
116
|
async checkLightningDomain() {
|
|
107
|
-
const domain = `https://${ts_types_1.ensureArray(/https?:\/\/([^.]*)/.exec(this.origin))
|
|
108
|
-
.slice(1, 2)
|
|
109
|
-
.pop()}.lightning.force.com`;
|
|
110
117
|
const quantity = ts_types_1.ensureNumber(new kit_1.Env().getNumber('SFDX_DOMAIN_RETRY', 240));
|
|
111
118
|
const timeout = new kit_1.Duration(quantity, kit_1.Duration.Unit.SECONDS);
|
|
112
119
|
if (this.isInternalUrl() || timeout.seconds === 0) {
|
|
113
120
|
return true;
|
|
114
121
|
}
|
|
115
122
|
const resolver = await myDomainResolver_1.MyDomainResolver.create({
|
|
116
|
-
url: new url_1.URL(
|
|
123
|
+
url: new url_1.URL(this.toLightningDomain()),
|
|
117
124
|
timeout,
|
|
118
125
|
frequency: new kit_1.Duration(1, kit_1.Duration.Unit.SECONDS),
|
|
119
126
|
});
|
|
@@ -145,6 +152,7 @@ class SfdcUrl extends url_1.URL {
|
|
|
145
152
|
*/
|
|
146
153
|
isSandboxUrl(createdOrgInstance) {
|
|
147
154
|
return ((createdOrgInstance && /^cs|s$/gi.test(createdOrgInstance)) ||
|
|
155
|
+
this.origin.endsWith('sandbox.my.salesforce.mil') ||
|
|
148
156
|
/sandbox\.my\.salesforce\.com/gi.test(this.origin) || // enhanced domains >= 230
|
|
149
157
|
/(cs[0-9]+(\.my|)\.salesforce\.com)/gi.test(this.origin) || // my domains on CS instance OR CS instance without my domain
|
|
150
158
|
/([a-z]{3}[0-9]+s\.sfdc-.+\.salesforce\.com)/gi.test(this.origin) || // falcon sandbox ex: usa2s.sfdc-whatever.salesforce.com
|
package/messages/config.json
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
"InvalidConfigValue": "Invalid config value. %s",
|
|
4
4
|
"InvalidInstanceUrl": "Specify a valid Salesforce instance URL",
|
|
5
5
|
"InvalidApiVersion": "Specify a valid Salesforce API version, for example, 42.0",
|
|
6
|
+
"InvalidCustomOrgMetadataTemplates": "Specify a valid repository URL or directory for the custom org metadata templates.",
|
|
6
7
|
"InvalidIsvDebuggerSid": "Specify a valid Debugger SID",
|
|
7
8
|
"InvalidIsvDebuggerUrl": "Specify a valid Debugger URL",
|
|
8
9
|
"InvalidNumberConfigValue": "Specify a valid positive integer, for example, 150000",
|