@salesforce/core 8.6.4 → 8.8.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.
@@ -239,7 +239,7 @@ class AuthInfo extends kit_1.AsyncOptionalCreatable {
239
239
  * @param sfdxAuthUrl
240
240
  */
241
241
  static parseSfdxAuthUrl(sfdxAuthUrl) {
242
- const match = sfdxAuthUrl.match(/^force:\/\/([a-zA-Z0-9._-]+={0,2}):([a-zA-Z0-9._-]*={0,2}):([a-zA-Z0-9._-]+={0,2})@([a-zA-Z0-9._-]+)/);
242
+ const match = sfdxAuthUrl.match(/^force:\/\/([a-zA-Z0-9._-]+={0,2}):([a-zA-Z0-9._-]*={0,2}):([a-zA-Z0-9._-]+={0,2})@([a-zA-Z0-9:._-]+)/);
243
243
  if (!match) {
244
244
  throw new sfError_1.SfError(messages.getMessage('invalidSfdxAuthUrlError'), 'INVALID_SFDX_AUTH_URL');
245
245
  }
@@ -516,14 +516,12 @@ class AuthInfo extends kit_1.AsyncOptionalCreatable {
516
516
  * **See** [SFDX Authorization](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_auth.htm#cli_reference_force_auth)
517
517
  */
518
518
  getSfdxAuthUrl() {
519
- const decryptedFields = this.getFields(true);
520
- const instanceUrl = (0, ts_types_1.ensure)(decryptedFields.instanceUrl, 'undefined instanceUrl').replace(/^https?:\/\//, '');
521
- let sfdxAuthUrl = 'force://';
522
- if (decryptedFields.clientId) {
523
- sfdxAuthUrl += `${decryptedFields.clientId}:${decryptedFields.clientSecret ?? ''}:`;
524
- }
525
- sfdxAuthUrl += `${(0, ts_types_1.ensure)(decryptedFields.refreshToken, 'undefined refreshToken')}@${instanceUrl}`;
526
- return sfdxAuthUrl;
519
+ const { clientId, clientSecret, refreshToken, instanceUrl } = this.getFields(true);
520
+ // host includes an optional port on the instanceUrl
521
+ const url = new URL((0, ts_types_1.ensure)(instanceUrl, 'undefined instanceUrl')).host;
522
+ const clientIdAndSecret = clientId ? `${clientId}:${clientSecret ?? ''}` : '';
523
+ const token = (0, ts_types_1.ensure)(refreshToken, 'undefined refreshToken');
524
+ return `force://${clientIdAndSecret}:${token}@${url}`;
527
525
  }
528
526
  /**
529
527
  * Convenience function to handle typical side effects encountered when dealing with an AuthInfo.
@@ -73,25 +73,25 @@ class MyDomainResolver extends kit_1.AsyncOptionalCreatable {
73
73
  const self = this;
74
74
  const pollingOptions = {
75
75
  async poll() {
76
- const { host } = self.options.url;
76
+ const { hostname } = self.options.url;
77
77
  let dnsResult;
78
78
  try {
79
- self.logger.debug(`Attempting to resolve url: ${host}`);
79
+ self.logger.debug(`Attempting to resolve url: ${hostname}`);
80
80
  if (new sfdcUrl_1.SfdcUrl(self.options.url).isLocalUrl()) {
81
81
  return {
82
82
  completed: true,
83
83
  payload: '127.0.0.1',
84
84
  };
85
85
  }
86
- dnsResult = await (0, node_util_1.promisify)(node_dns_1.lookup)(host);
87
- self.logger.debug(`Successfully resolved host: ${host} result: ${JSON.stringify(dnsResult)}`);
86
+ dnsResult = await (0, node_util_1.promisify)(node_dns_1.lookup)(hostname);
87
+ self.logger.debug(`Successfully resolved host: ${hostname} result: ${JSON.stringify(dnsResult)}`);
88
88
  return {
89
89
  completed: true,
90
90
  payload: dnsResult.address,
91
91
  };
92
92
  }
93
93
  catch (e) {
94
- self.logger.debug(`An error occurred trying to resolve: ${host}`);
94
+ self.logger.debug(`An error occurred trying to resolve: ${hostname}`);
95
95
  self.logger.debug(`Error: ${e.message}`);
96
96
  self.logger.debug('Re-trying dns lookup again....');
97
97
  return {
@@ -119,7 +119,7 @@ class SfdcUrl extends node_url_1.URL {
119
119
  '.stm.salesforce.ms',
120
120
  '.pc-rnd.force.com',
121
121
  '.pc-rnd.salesforce.com',
122
- '.wc.crm.dev', // workspaces container
122
+ '.crm.dev', // workspaces container
123
123
  ];
124
124
  return (this.origin.startsWith('https://gs1.') ||
125
125
  this.isLocalUrl() ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/core",
3
- "version": "8.6.4",
3
+ "version": "8.8.0",
4
4
  "description": "Core libraries to interact with SFDX projects, orgs, and APIs.",
5
5
  "main": "lib/index",
6
6
  "types": "lib/index.d.ts",