Skip to content

Commit

Permalink
chore: fix issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mingxuanzhangsfdx committed Nov 12, 2024
1 parent 4c5a7ee commit 6cddd10
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import { OrgAuthInfo, workspaceUtils } from '../util';

export const getOrgShape = async (username: string): Promise<OrgShape> => {
if (workspaceUtils.hasRootWorkspace()) {
if (await OrgAuthInfo.isASandboxOrg(username)) {
return 'Sandbox';
} else if (await OrgAuthInfo.isAScratchOrg(username)) {
if (await OrgAuthInfo.isAScratchOrg(username)) {
return 'Scratch';
} else if (await OrgAuthInfo.isASandboxOrg(username)) {
return 'Sandbox';
} else if (await OrgAuthInfo.getTargetOrgOrAlias(false) !== undefined) {
return 'Production';
} else {
Expand Down
7 changes: 4 additions & 3 deletions packages/salesforcedx-vscode-core/src/util/authInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import { AuthInfo, Connection, StateAggregator, Org, ConfigAggregator } from '@salesforce/core-bundle';
import { AuthInfo, Connection, StateAggregator, Org } from '@salesforce/core-bundle';
import { ConfigSource, ConfigUtil } from '@salesforce/salesforcedx-utils-vscode';
import * as vscode from 'vscode';
import { channelService } from '../channels';
Expand Down Expand Up @@ -107,10 +107,11 @@ export class OrgAuthInfo {
if (await org.isSandbox()) {
return true;
}
// scratch org also makes IsSandbox true
const result = await org
.getConnection()
.singleRecordQuery<{ isSandbox: boolean }>('select isSandbox from organization');
return result?.isSandbox;
.singleRecordQuery<{ IsSandbox: boolean }>('select IsSandbox from organization');
return result?.IsSandbox;
}

public static async getDevHubIdFromScratchOrg(username: string): Promise<string | undefined> {
Expand Down

0 comments on commit 6cddd10

Please sign in to comment.