-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting Org connection from Salesforce Extensions services #55
Conversation
const getWorkspaceDirStub = sinon.stub( | ||
WorkspaceUtils, | ||
'getStaticResourcesDir' | ||
); | ||
getWorkspaceDirStub.returns(Promise.resolve('.')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This approach was breaking for me locally. Always dicey to use .
as a working directory, as it's hard to know where the code is executed from. Moved to creating a temporary directory for this I/O.
@@ -13,37 +13,51 @@ import { | |||
NoWorkspaceError, | |||
WorkspaceUtils | |||
} from '../../../utils/workspaceUtils'; | |||
import { TempProjectDirManager } from '../../TestHelper'; | |||
import { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of the changes in this file are just refactors to optimize the existing code. No new testing here, otherwise.
@@ -48,8 +49,8 @@ export type SObjectCompactLayout = { | |||
export class OrgUtils { | |||
public static async getSobjects(): Promise<SObject[]> { | |||
try { | |||
const org = await Org.create(); | |||
const conn = org.getConnection(); | |||
const conn = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes in this file represent the entry points for the heart of the changes. Most of the other changes were either in the implementation of the backing Salesforce Extensions service connector code, or the supporting code in the tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Glad you figured this out!
This PR tacks to a design pattern recommended by the Salesforce Extensions team, for consuming the services that their extension exports for Org-based administration, connections, etc. With the previous implementation, we weren't successfully able to bootstrap a connection to the user's default Org, for retrieving sObject metadata.