idea-aws 4.4.8 → 4.4.9
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.
- package/dist/src/cognito.d.ts +1 -1
- package/dist/src/cognito.js +4 -9
- package/package.json +1 -1
package/dist/src/cognito.d.ts
CHANGED
|
@@ -45,7 +45,7 @@ export declare class Cognito {
|
|
|
45
45
|
}): Promise<CognitoUser[]>;
|
|
46
46
|
/**
|
|
47
47
|
* List all the users of the pool, including the information about the groups they're in.
|
|
48
|
-
* Note: it's slower than the alternative `
|
|
48
|
+
* Note: it's slower than the alternative `listUsers`: use it only when needed.
|
|
49
49
|
*/
|
|
50
50
|
listUsersWithGroupsDetail(cognitoUserPoolId: string): Promise<CognitoUser[]>;
|
|
51
51
|
/**
|
package/dist/src/cognito.js
CHANGED
|
@@ -123,23 +123,18 @@ class Cognito {
|
|
|
123
123
|
}
|
|
124
124
|
/**
|
|
125
125
|
* List all the users of the pool, including the information about the groups they're in.
|
|
126
|
-
* Note: it's slower than the alternative `
|
|
126
|
+
* Note: it's slower than the alternative `listUsers`: use it only when needed.
|
|
127
127
|
*/
|
|
128
128
|
async listUsersWithGroupsDetail(cognitoUserPoolId) {
|
|
129
|
-
const groups = await this.listGroups(cognitoUserPoolId);
|
|
130
|
-
|
|
131
|
-
for (const group of groups) {
|
|
129
|
+
const [users, groups] = await Promise.all([this.listUsers(cognitoUserPoolId), this.listGroups(cognitoUserPoolId)]);
|
|
130
|
+
await Promise.all(groups.map(async (group) => {
|
|
132
131
|
const usersOfGroup = await this.listUsersInGroup(group.name, cognitoUserPoolId);
|
|
133
132
|
usersOfGroup.forEach(userInGroup => {
|
|
134
133
|
const userAlreadyInOutputList = users.find(u => u.userId === userInGroup.userId);
|
|
135
134
|
if (userAlreadyInOutputList)
|
|
136
135
|
userAlreadyInOutputList.groups.push(group.name);
|
|
137
|
-
else {
|
|
138
|
-
userInGroup.groups.push(group.name);
|
|
139
|
-
users.push(userInGroup);
|
|
140
|
-
}
|
|
141
136
|
});
|
|
142
|
-
}
|
|
137
|
+
}));
|
|
143
138
|
return users;
|
|
144
139
|
}
|
|
145
140
|
/**
|