@salesforce/core 8.7.0 → 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/core",
3
- "version": "8.7.0",
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",