idea-aws 4.4.7 → 4.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -32,6 +32,10 @@ export declare class Cognito {
32
32
  * Identify a user by its userId (sub), returning its attributes.
33
33
  */
34
34
  getUserBySub(sub: string, userPoolId: string): Promise<CognitoUserGeneric>;
35
+ /**
36
+ * Get the list of groups of a user by its email address.
37
+ */
38
+ getUserGroupsByEmail(email: string, userPoolId: string): Promise<string[]>;
35
39
  /**
36
40
  * List all the users of the pool.
37
41
  */
@@ -99,6 +99,14 @@ class Cognito {
99
99
  throw new Error('User not found');
100
100
  return this.mapCognitoUserAttributesAsPlainObject(Users[0]);
101
101
  }
102
+ /**
103
+ * Get the list of groups of a user by its email address.
104
+ */
105
+ async getUserGroupsByEmail(email, userPoolId) {
106
+ const command = new CognitoIP.AdminListGroupsForUserCommand({ UserPoolId: userPoolId, Username: email });
107
+ const { Groups } = await this.client.send(command);
108
+ return Groups.map(x => x.GroupName);
109
+ }
102
110
  /**
103
111
  * List all the users of the pool.
104
112
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "idea-aws",
3
- "version": "4.4.7",
3
+ "version": "4.4.8",
4
4
  "description": "AWS wrappers to use in IDEA's back-ends",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",