Skip to content

fix: add idp codegen and fix a couple of minor bugs#14143

Merged
abhi7cr merged 2 commits intoaws-amplify:migrationsfrom
bzsurbhi:migrations
Mar 20, 2025
Merged

fix: add idp codegen and fix a couple of minor bugs#14143
abhi7cr merged 2 commits intoaws-amplify:migrationsfrom
bzsurbhi:migrations

Conversation

@bzsurbhi
Copy link
Copy Markdown

@bzsurbhi bzsurbhi commented Mar 20, 2025

Description of changes

  1. codegen idp in backend.ts: https://app.asana.com/0/1209548398662250/1209688082354480/f

const providerSetupResult = (backend.auth.stack.node.children.find(child => child.node.id === "amplifyAuth") as any).providerSetupResult; Object.keys(providerSetupResult).forEach(provider => { const providerSetupPropertyValue = providerSetupResult[provider]; if (providerSetupPropertyValue.node && providerSetupPropertyValue.node.id.toLowerCase().endsWith("idp")) { userPoolClient.node.addDependency(providerSetupPropertyValue); } });

  1. don't throw an error if buildSpec is not found during getApp call: https://app.asana.com/0/1209548398662250/1209731110320988/f

  2. don't generate auth/resource.ts if authCategory doesn't exist

Description of how you validated changes

Checklist

  • PR description included
  • yarn test passes
  • Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)
  • New AWS SDK calls or CloudFormation actions have been added to relevant test and service IAM policies
  • Pull request labels are added

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@bzsurbhi bzsurbhi requested review from a team as code owners March 20, 2025 00:05

getDefinition = async (): Promise<AuthDefinition | undefined> => {
const referenceAuth = await this.getReferenceAuth();
const authCategory = await this.authCategory();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: rename authCategory to something like getAuthCategory to differentiate between the variable and method.

assert(buildSpec, 'buildSpec not found in the app');

await writeToAmplifyYmlFile(amplifyYmlPath, buildSpec);
if (buildSpec) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

factory.createVariableDeclarationList(
[
factory.createVariableDeclaration(
factory.createIdentifier('providerSetupResult'),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: move providerSetupResult to a constant since it's used in 2 places.

);

// Create Object.keys(providerSetupResult).forEach(...)
const forEachStatement = factory.createExpressionStatement(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we move the for loop contents into a separate method to reduce the size of this method?

@abhi7cr abhi7cr merged commit a51c8f5 into aws-amplify:migrations Mar 20, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants