Skip to content
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: add a "--verbose" flag to log old/new sub #33

Merged
merged 2 commits into from
Mar 17, 2023

Conversation

jakub-qg
Copy link
Contributor

@jakub-qg jakub-qg commented Mar 14, 2023

$ node cli.js restore-users eu-west-2_x --file x.json Temp1234! --profile jakub --verbose                                                                                                                      
Restored user - oldSub: "bf8c6d7f-a198-4f1e-bf26-163014f7eb12" newSub: "4a136bac-1c64-4cdb-9e28-f9d714a3251b"

Closes #32

cli.js Outdated
if (verbose) {
const oldSub = user.Attributes.find((attribute) => attribute.Name === 'sub');
const newSub = response?.User.Attributes.find((attribute) => attribute.Name === 'sub');
console.log(`Restored user - oldSub: "${oldSub.Value}" newSub: "${newSub.Value}"`);
Copy link
Owner

Choose a reason for hiding this comment

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

what if sub is missing, then this will crash. is sub guaranteed to exist inside attributes? maybe we should do sub?.Value?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi, I believe it's guaranteed to exist:

https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html

Except for sub, standard attributes are optional by default for all users

Thanks for your time!

cli.js Outdated Show resolved Hide resolved
@mifi mifi merged commit 0acb221 into mifi:master Mar 17, 2023
@jakub-qg jakub-qg deleted the feat/restore-logging branch March 17, 2023 11:12
@jakub-qg
Copy link
Contributor Author

Thanks for coop!

Can we release?

@mifi
Copy link
Owner

mifi commented Mar 17, 2023

done

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.

More detailed restore logging
2 participants