idea-aws 3.10.5 → 3.10.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.
@@ -84,6 +84,14 @@ export declare class Cognito {
84
84
  * List the groups of the user pool.
85
85
  */
86
86
  listGroups(cognitoUserPoolId: string): Promise<CognitoGroup[]>;
87
+ /**
88
+ * Create a new group in the user pool.
89
+ */
90
+ createGroup(groupName: string, cognitoUserPoolId: string): Promise<void>;
91
+ /**
92
+ * Delete a group from the user pool.
93
+ */
94
+ deleteGroup(groupName: string, cognitoUserPoolId: string): Promise<void>;
87
95
  /**
88
96
  * List the users part of a group in the user pool.
89
97
  */
@@ -99,6 +99,7 @@ class Cognito {
99
99
  if (typeof cognitoUserOrEmail === 'object') {
100
100
  const user = cognitoUserOrEmail;
101
101
  UserAttributes.push({ Name: 'name', Value: user.name });
102
+ UserAttributes.push({ Name: 'picture', Value: user.picture });
102
103
  Object.keys(user.attributes).forEach(a => UserAttributes.push({ Name: 'custom:'.concat(a), Value: String(user.attributes[a]) }));
103
104
  }
104
105
  const params = {
@@ -212,7 +213,10 @@ class Cognito {
212
213
  * Update a (Cognito)User's attributes, excluding the attributes that require specific methods.
213
214
  */
214
215
  async updateUser(user, cognitoUserPoolId) {
215
- const UserAttributes = [{ Name: 'name', Value: user.name }];
216
+ const UserAttributes = [
217
+ { Name: 'name', Value: user.name },
218
+ { Name: 'picture', Value: user.picture }
219
+ ];
216
220
  Object.keys(user.attributes).forEach(customAttribute => UserAttributes.push({
217
221
  Name: 'custom:'.concat(customAttribute),
218
222
  Value: String(user.attributes[customAttribute])
@@ -249,6 +253,18 @@ class Cognito {
249
253
  const groups = groupsList.Groups.map(g => ({ name: g.GroupName, description: g.Description }));
250
254
  return groups;
251
255
  }
256
+ /**
257
+ * Create a new group in the user pool.
258
+ */
259
+ async createGroup(groupName, cognitoUserPoolId) {
260
+ await this.cognito.createGroup({ GroupName: groupName, UserPoolId: cognitoUserPoolId }).promise();
261
+ }
262
+ /**
263
+ * Delete a group from the user pool.
264
+ */
265
+ async deleteGroup(groupName, cognitoUserPoolId) {
266
+ await this.cognito.deleteGroup({ GroupName: groupName, UserPoolId: cognitoUserPoolId }).promise();
267
+ }
252
268
  /**
253
269
  * List the users part of a group in the user pool.
254
270
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "idea-aws",
3
- "version": "3.10.5",
3
+ "version": "3.10.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",
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "homepage": "https://uatisdeproblem.github.io/IDEA-AWS",
37
37
  "dependencies": {
38
- "idea-toolbox": "^6.5.11",
38
+ "idea-toolbox": "^6.5.14",
39
39
  "nanoid": "^3.2.0",
40
40
  "nodemailer": "^6.7.2",
41
41
  "shortid": "^2.2.16",