idea-aws 3.12.1 → 3.13.2

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.
@@ -1,10 +1,10 @@
1
- import { CognitoIdentityServiceProvider } from 'aws-sdk';
1
+ import { CognitoIdentityServiceProvider as CognitoISP } from 'aws-sdk';
2
2
  import { CognitoUser } from 'idea-toolbox';
3
3
  /**
4
4
  * A wrapper for AWS Cognito.
5
5
  */
6
6
  export declare class Cognito {
7
- protected cognito: CognitoIdentityServiceProvider;
7
+ protected cognito: CognitoISP;
8
8
  constructor(params?: {
9
9
  region?: string;
10
10
  });
@@ -60,11 +60,11 @@ export declare class Cognito {
60
60
  /**
61
61
  * Sign in a user of a specific pool through username and password.
62
62
  */
63
- signIn(email: string, password: string, cognitoUserPoolId: string, cognitoUserPoolClientId: string): Promise<CognitoIdentityServiceProvider.AuthenticationResultType>;
63
+ signIn(email: string, password: string, cognitoUserPoolId: string, cognitoUserPoolClientId: string): Promise<CognitoISP.AuthenticationResultType>;
64
64
  /**
65
65
  * Given a username and a refresh token (and pool data), refresh the session and return the new tokens.
66
66
  */
67
- refreshSession(email: string, refreshToken: string, cognitoUserPoolId: string, cognitoUserPoolClientId: string): Promise<CognitoIdentityServiceProvider.AuthenticationResultType>;
67
+ refreshSession(email: string, refreshToken: string, cognitoUserPoolId: string, cognitoUserPoolClientId: string): Promise<CognitoISP.AuthenticationResultType>;
68
68
  /**
69
69
  * Change the email address (== username) associated to a user.
70
70
  */
@@ -73,6 +73,10 @@ export declare class Cognito {
73
73
  * Change the password to sign in for a user.
74
74
  */
75
75
  updatePassword(email: string, oldPassword: string, newPassword: string, cognitoUserPoolId: string, cognitoUserPoolClientId: string): Promise<void>;
76
+ /**
77
+ * Send to a user the instructions to change the password.
78
+ */
79
+ forgotPassword(email: string, cognitoUserPoolClientId: string): Promise<CognitoISP.CodeDeliveryDetailsType>;
76
80
  /**
77
81
  * Update a (Cognito)User's attributes, excluding the attributes that require specific methods.
78
82
  */
@@ -232,6 +232,15 @@ class Cognito {
232
232
  })
233
233
  .promise();
234
234
  }
235
+ /**
236
+ * Send to a user the instructions to change the password.
237
+ */
238
+ async forgotPassword(email, cognitoUserPoolClientId) {
239
+ const { CodeDeliveryDetails } = await this.cognito
240
+ .forgotPassword({ Username: email, ClientId: cognitoUserPoolClientId })
241
+ .promise();
242
+ return CodeDeliveryDetails;
243
+ }
235
244
  /**
236
245
  * Update a (Cognito)User's attributes, excluding the attributes that require specific methods.
237
246
  */
@@ -8,7 +8,9 @@ export declare class Comprehend {
8
8
  * The instance of Comprehend.
9
9
  */
10
10
  protected comprehend: AmazonComprehend;
11
- constructor();
11
+ constructor(params?: {
12
+ region?: string;
13
+ });
12
14
  /**
13
15
  * Inspects text and returns an inference of the prevailing sentiment (POSITIVE, NEUTRAL, MIXED, or NEGATIVE).
14
16
  */
@@ -6,8 +6,8 @@ const aws_sdk_1 = require("aws-sdk");
6
6
  * A wrapper for Amazon Comprehend.
7
7
  */
8
8
  class Comprehend {
9
- constructor() {
10
- this.comprehend = new aws_sdk_1.Comprehend({ apiVersion: '2017-11-27' });
9
+ constructor(params = {}) {
10
+ this.comprehend = new aws_sdk_1.Comprehend({ apiVersion: '2017-11-27', region: params.region });
11
11
  }
12
12
  /**
13
13
  * Inspects text and returns an inference of the prevailing sentiment (POSITIVE, NEUTRAL, MIXED, or NEGATIVE).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "idea-aws",
3
- "version": "3.12.1",
3
+ "version": "3.13.2",
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",