-
Notifications
You must be signed in to change notification settings - Fork 69
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
feat: save namespacePrefix in auth file #908
Conversation
); | ||
|
||
if (namespacePrefix) { | ||
authConfig.namespacePrefix = namespacePrefix; |
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.
getNamespacePrefix
will return undefined if an org doesn't have a namespace prefix we just set it if there's one.
const authInfo = await AuthInfo.create({ username: testOrg.username }); | ||
// @ts-expect-error because private method | ||
expect(await authInfo.getNamespacePrefix(testOrg.instanceUrl, testOrg.accessToken)).to.be.undefined; | ||
expect(authInfo.getFields().namespacePrefix).to.be.undefined; |
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 test verifies that getNamespacePrefix
returns undefined instead of an empty string to ensure we never end up with namespacePrefix: ""
in an auth file.
match({ | ||
url: `${testOrg.instanceUrl}//services/data/v51.0/query?q=Select%20Namespaceprefix%20FROM%20Organization`, | ||
}) | ||
) |
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.
use sinon matcher to only stub the namespace query:
https://sinonjs.org/releases/latest/matchers/
QA: linked this branch to plugin-auth, then authed an org that had a namespace. I see it in the auth file and it's returned with |
What does this PR do?
Save the namespace prefix of an org in its auth file.
When creating an instance of
AuthInfo
, sfdx-core will query the namespace prefix of an org and save it asnamespacePrefix
.Organization
object:https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_organization.htm
What issues does this PR fix or reference?
@W-12709731@
@W-12709714@