@salesforce/core 2.35.2 → 2.35.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 +6 -0
- package/lib/org.js +26 -28
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
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.35.3](https://github.com/forcedotcom/sfdx-core/compare/v2.35.2...v2.35.3) (2022-02-23)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
- always try to clean up aliases and configs ([cd0adc4](https://github.com/forcedotcom/sfdx-core/commit/cd0adc456978f27fc2d44cbcb61632925edcccd9))
|
|
10
|
+
|
|
5
11
|
### [2.35.2](https://github.com/forcedotcom/sfdx-core/compare/v2.35.1...v2.35.2) (2022-02-16)
|
|
6
12
|
|
|
7
13
|
### Bug Fixes
|
package/lib/org.js
CHANGED
|
@@ -644,35 +644,33 @@ class Org extends kit_1.AsyncCreatable {
|
|
|
644
644
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
645
645
|
async removeUsers(throwWhenRemoveFails) {
|
|
646
646
|
this.logger.debug(`Removing users associate with org: ${this.getOrgId()}`);
|
|
647
|
-
const config = await
|
|
647
|
+
const [config, authInfos, aliases] = await Promise.all([
|
|
648
|
+
this.retrieveOrgUsersConfig(),
|
|
649
|
+
this.readUserAuthFiles(),
|
|
650
|
+
aliases_1.Aliases.create(aliases_1.Aliases.getDefaultOptions()),
|
|
651
|
+
]);
|
|
648
652
|
this.logger.debug(`using path for org users: ${config.getPath()}`);
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
await config_1.Config.update(configInfo.isGlobal(), orgType, undefined);
|
|
671
|
-
}
|
|
672
|
-
await orgForUser.removeAuth();
|
|
673
|
-
}
|
|
674
|
-
await aliases.write();
|
|
675
|
-
}
|
|
653
|
+
this.logger.info(`Cleaning up usernames in org: ${this.getOrgId()}`);
|
|
654
|
+
await Promise.all(authInfos
|
|
655
|
+
.map((auth) => auth.getFields().username)
|
|
656
|
+
.map(async (username) => {
|
|
657
|
+
const aliasKeys = (username && aliases.getKeysByValue(username)) || [];
|
|
658
|
+
aliases.unsetAll(aliasKeys);
|
|
659
|
+
const orgForUser = username === this.getUsername()
|
|
660
|
+
? this
|
|
661
|
+
: await Org.create({
|
|
662
|
+
connection: await connection_1.Connection.create({ authInfo: await authInfo_1.AuthInfo.create({ username }) }),
|
|
663
|
+
});
|
|
664
|
+
const orgType = this.isDevHubOrg() ? config_1.Config.DEFAULT_DEV_HUB_USERNAME : config_1.Config.DEFAULT_USERNAME;
|
|
665
|
+
const configInfo = orgForUser.configAggregator.getInfo(orgType);
|
|
666
|
+
const needsConfigUpdate = (configInfo.isGlobal() || configInfo.isLocal()) &&
|
|
667
|
+
(configInfo.value === username || aliasKeys.includes(configInfo.value));
|
|
668
|
+
return [
|
|
669
|
+
orgForUser.removeAuth(),
|
|
670
|
+
needsConfigUpdate ? config_1.Config.update(configInfo.isGlobal(), orgType, undefined) : undefined,
|
|
671
|
+
].filter(Boolean);
|
|
672
|
+
}));
|
|
673
|
+
await aliases.write();
|
|
676
674
|
}
|
|
677
675
|
/**
|
|
678
676
|
* Remove an associate sandbox config.
|