Skip to content

Commit

Permalink
refactor: getFields from authinfo in scratch-id
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc committed May 12, 2021
1 parent 706eca8 commit c914648
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/commands/auth/device/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default class Login extends SfdxCommand {
const authInfo = await deviceOauthService.authorizeAndSave(approval);
await Common.handleSideEffects(authInfo, this.flags);
const fields = authInfo.getFields(true);
await Common.identifyPossibleScratchOrgs(fields, authInfo);
await Common.identifyPossibleScratchOrgs(authInfo);
const successMsg = messages.getMessage('success', [fields.username]);
this.ux.log(successMsg);
return fields;
Expand Down
2 changes: 1 addition & 1 deletion src/commands/auth/jwt/grant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default class Grant extends SfdxCommand {
const authInfo = await this.initAuthInfo();
await Common.handleSideEffects(authInfo, this.flags);
result = authInfo.getFields(true);
await Common.identifyPossibleScratchOrgs(result, authInfo);
await Common.identifyPossibleScratchOrgs(authInfo);
} catch (err) {
const msg = getString(err, 'message');
throw SfdxError.create('@salesforce/plugin-auth', 'jwt.grant', 'JwtGrantError', [msg]);
Expand Down
2 changes: 1 addition & 1 deletion src/commands/auth/sfdxurl/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default class Store extends SfdxCommand {
await Common.handleSideEffects(authInfo, this.flags);

const result = authInfo.getFields(true);
await Common.identifyPossibleScratchOrgs(result, authInfo);
await Common.identifyPossibleScratchOrgs(authInfo);

const successMsg = commonMessages.getMessage('authorizeCommandSuccess', [result.username, result.orgId]);
this.ux.log(successMsg);
Expand Down
2 changes: 1 addition & 1 deletion src/commands/auth/web/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default class Login extends SfdxCommand {
const authInfo = await this.executeLoginFlow(oauthConfig);
await Common.handleSideEffects(authInfo, this.flags);
const fields = authInfo.getFields(true);
await Common.identifyPossibleScratchOrgs(fields, authInfo);
await Common.identifyPossibleScratchOrgs(authInfo);

const successMsg = commonMessages.getMessage('authorizeCommandSuccess', [fields.username, fields.orgId]);
this.ux.log(successMsg);
Expand Down
5 changes: 3 additions & 2 deletions src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
import { basename } from 'path';
import { QueryResult } from 'jsforce';
import { AuthInfo, AuthFields, Logger, SfdcUrl, SfdxProject, Messages, Org, SfdxError, sfdc } from '@salesforce/core';
import { AuthInfo, Logger, SfdcUrl, SfdxProject, Messages, Org, SfdxError, sfdc } from '@salesforce/core';
import { getString, isObject, Optional } from '@salesforce/ts-types';

Messages.importMessagesDirectory(__dirname);
Expand Down Expand Up @@ -56,7 +56,8 @@ export class Common {
return loginUrl;
}

public static async identifyPossibleScratchOrgs(fields: AuthFields, orgAuthInfo: AuthInfo): Promise<void> {
public static async identifyPossibleScratchOrgs(orgAuthInfo: AuthInfo): Promise<void> {
const fields = orgAuthInfo.getFields();
const logger = await Logger.child('Common', { tag: 'identifyPossibleScratchOrgs' });

// return if we already know the hub or we know it is a devhub or prod-like
Expand Down

0 comments on commit c914648

Please sign in to comment.