idea-aws 3.13.7 → 3.14.1
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,6 +1,6 @@
|
|
|
1
1
|
import 'source-map-support/register';
|
|
2
2
|
import { APIGatewayProxyEventV2, APIGatewayProxyEvent, Callback } from 'aws-lambda';
|
|
3
|
-
import { CognitoUser } from 'idea-toolbox';
|
|
3
|
+
import { CognitoUser, Auth0User } from 'idea-toolbox';
|
|
4
4
|
import { Logger } from './logger';
|
|
5
5
|
import { GenericController, GenericControllerOptions } from './genericController';
|
|
6
6
|
/**
|
|
@@ -14,6 +14,7 @@ export declare abstract class ResourceController extends GenericController {
|
|
|
14
14
|
protected claims: any;
|
|
15
15
|
protected principalId: string;
|
|
16
16
|
protected cognitoUser: CognitoUser;
|
|
17
|
+
protected auth0User: Auth0User;
|
|
17
18
|
protected stage: string;
|
|
18
19
|
protected httpMethod: string;
|
|
19
20
|
protected body: any;
|
|
@@ -119,6 +119,7 @@ class ResourceController extends genericController_1.GenericController {
|
|
|
119
119
|
const contextFromAuthorizer = authorizer.lambda ?? authorizer.jwt?.claims ?? {};
|
|
120
120
|
this.principalId = contextFromAuthorizer.principalId ?? contextFromAuthorizer.sub ?? null;
|
|
121
121
|
this.cognitoUser = authorizer.jwt?.claims ? new idea_toolbox_1.CognitoUser(authorizer.jwt?.claims) : null;
|
|
122
|
+
this.auth0User = contextFromAuthorizer.auth0User ? new idea_toolbox_1.Auth0User(contextFromAuthorizer.auth0User) : null;
|
|
122
123
|
this.stage = event.requestContext.stage;
|
|
123
124
|
this.httpMethod = event.requestContext.http.method;
|
|
124
125
|
this.resource = event.routeKey.replace('+', ''); // {proxy+} -> {proxy}
|
|
@@ -140,6 +141,7 @@ class ResourceController extends genericController_1.GenericController {
|
|
|
140
141
|
this.claims = event.requestContext.authorizer?.claims || {};
|
|
141
142
|
this.principalId = this.claims.sub;
|
|
142
143
|
this.cognitoUser = this.principalId ? new idea_toolbox_1.CognitoUser(this.claims) : null;
|
|
144
|
+
this.auth0User = null;
|
|
143
145
|
this.stage = event.requestContext.stage;
|
|
144
146
|
this.httpMethod = event.httpMethod;
|
|
145
147
|
this.resource = event.resource.replace('+', ''); // {proxy+} -> {proxy}
|
package/dist/src/sns.js
CHANGED
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SNS = void 0;
|
|
4
4
|
const aws_sdk_1 = require("aws-sdk");
|
|
5
5
|
const idea_toolbox_1 = require("idea-toolbox");
|
|
6
|
+
const logger_1 = require("./logger");
|
|
7
|
+
const logger = new logger_1.Logger();
|
|
6
8
|
/**
|
|
7
9
|
* A wrapper for AWS Simple Notification Service.
|
|
8
10
|
*/
|
|
@@ -26,7 +28,7 @@ class SNS {
|
|
|
26
28
|
default:
|
|
27
29
|
throw new Error('Unsupported platform');
|
|
28
30
|
}
|
|
29
|
-
|
|
31
|
+
logger.debug('SNS ADD PLATFORM ENDPOINT');
|
|
30
32
|
const result = await new aws_sdk_1.SNS({ apiVersion: '2010-03-31', region: snsParams.region })
|
|
31
33
|
.createPlatformEndpoint({ PlatformApplicationArn: platformARN, Token: token })
|
|
32
34
|
.promise();
|
|
@@ -55,7 +57,7 @@ class SNS {
|
|
|
55
57
|
default:
|
|
56
58
|
throw new Error('Unsupported platform');
|
|
57
59
|
}
|
|
58
|
-
|
|
60
|
+
logger.debug('SNS PUBLISH IN TOPIC');
|
|
59
61
|
return await new aws_sdk_1.SNS({ apiVersion: '2010-03-31', region: snsParams.region })
|
|
60
62
|
.publish({ MessageStructure: 'json', Message: JSON.stringify(structuredMessage), TargetArn: snsParams.endpoint })
|
|
61
63
|
.promise();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "idea-aws",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.14.1",
|
|
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://iter-idea.github.io/IDEA-AWS",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"idea-toolbox": "^6.
|
|
38
|
+
"idea-toolbox": "^6.6.2",
|
|
39
39
|
"nanoid": "^3.3.4",
|
|
40
40
|
"nodemailer": "^6.7.7",
|
|
41
41
|
"shortid": "^2.2.16",
|