@salesforce/core 2.27.2 → 2.28.3

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 CHANGED
@@ -2,6 +2,38 @@
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.3](https://github.com/forcedotcom/sfdx-core/compare/v2.28.2...v2.28.3) (2021-11-08)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * fix unit test ([d903c04](https://github.com/forcedotcom/sfdx-core/commit/d903c04e5f3e4f01fccb3f00b91560c443013ddf))
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))
13
+
14
+ ### [2.28.2](https://github.com/forcedotcom/sfdx-core/compare/v2.28.1...v2.28.2) (2021-10-13)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * support for .mil sandboxes ([9ef35c7](https://github.com/forcedotcom/sfdx-core/commit/9ef35c7b1ef0fe974c3bd3b89b862a436e00f7d9))
20
+
21
+ ### [2.28.1](https://github.com/forcedotcom/sfdx-core/compare/v2.28.0...v2.28.1) (2021-10-06)
22
+
23
+
24
+ ### Bug Fixes
25
+
26
+ * crmforce.mil ([e263d5d](https://github.com/forcedotcom/sfdx-core/commit/e263d5d74be9c0651e5c2676d6eec1c31fca05e4))
27
+
28
+ ## [2.28.0](https://github.com/forcedotcom/sfdx-core/compare/v2.27.2...v2.28.0) (2021-09-16)
29
+
30
+
31
+ ### Features
32
+
33
+ * add custom templates config ([3cf8a8c](https://github.com/forcedotcom/sfdx-core/commit/3cf8a8cee1e7196efced989dcca9b545e1283386))
34
+ * add validator for custom templates config ([dd2bcfe](https://github.com/forcedotcom/sfdx-core/commit/dd2bcfe8e7fee5c5c1c6321189ec04288103d5b6))
35
+ * update config name ([72e84bf](https://github.com/forcedotcom/sfdx-core/commit/72e84bfacef48a1c2d00a61ebbae3f632601abbd))
36
+
5
37
  ### [2.27.2](https://github.com/forcedotcom/sfdx-core/compare/v2.27.1...v2.27.2) (2021-08-05)
6
38
 
7
39
 
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
  /**
@@ -339,5 +343,6 @@ export declare namespace AuthInfo {
339
343
  * creation.
340
344
  */
341
345
  parentUsername?: string;
346
+ isDevHub?: boolean;
342
347
  }
343
348
  }
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) {
@@ -660,7 +664,10 @@ class AuthInfo extends kit_1.AsyncCreatable {
660
664
  }
661
665
  catch (e) {
662
666
  if (e.code === 'ENOENT') {
663
- throw sfdxError_1.SfdxError.create('@salesforce/core', 'core', 'NamedOrgNotFound', [username]);
667
+ throw sfdxError_1.SfdxError.create('@salesforce/core', 'core', 'NamedOrgNotFound', [
668
+ this.options.isDevHub ? 'devhub username' : 'username',
669
+ username,
670
+ ]);
664
671
  }
665
672
  else {
666
673
  throw e;
@@ -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
  /**
@@ -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
  /**
@@ -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
  */
@@ -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/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/util/fs.d.ts CHANGED
@@ -10,6 +10,9 @@ export declare type WriteJsonOptions = {
10
10
  */
11
11
  space?: number;
12
12
  };
13
+ /**
14
+ * @deprecated Use fs/promises instead
15
+ */
13
16
  export declare const fs: typeof fsLib & {
14
17
  /**
15
18
  * The default file system mode to use when creating directories.
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.
@@ -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 untill timeout
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
@@ -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 untill timeout
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(domain),
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
@@ -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",
@@ -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 AuthInfo found for name %s",
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/core",
3
- "version": "2.27.2",
3
+ "version": "2.28.3",
4
4
  "description": "Core libraries to interact with SFDX projects, orgs, and APIs.",
5
5
  "main": "lib/exported",
6
6
  "license": "BSD-3-Clause",