idea-aws 3.11.5 → 3.11.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.
- package/{.eslintrc.js → .eslintrc.cjs} +0 -0
- package/README.md +1 -1
- package/dist/index.js +13 -25
- package/dist/src/attachments.js +5 -9
- package/dist/src/cognito.js +15 -19
- package/dist/src/comprehend.js +3 -7
- package/dist/src/dynamoDB.js +13 -17
- package/dist/src/genericController.js +21 -25
- package/dist/src/logger.js +1 -5
- package/dist/src/resourceController.d.ts +2 -2
- package/dist/src/resourceController.js +20 -25
- package/dist/src/s3.js +10 -14
- package/dist/src/secretsManager.js +3 -7
- package/dist/src/ses.js +12 -16
- package/dist/src/sns.js +13 -17
- package/dist/src/streamController.js +4 -8
- package/dist/src/translate.js +10 -14
- package/package.json +11 -10
|
File without changes
|
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ import { ResourceController } from 'idea-aws';
|
|
|
14
14
|
|
|
15
15
|
## Documentation
|
|
16
16
|
|
|
17
|
-
Documentation generated with TypeDoc: [link](https://
|
|
17
|
+
Documentation generated with TypeDoc: [link](https://iter-idea.github.io/IDEA-AWS).
|
|
18
18
|
|
|
19
19
|
## Notes
|
|
20
20
|
|
package/dist/index.js
CHANGED
|
@@ -1,25 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
__exportStar(require("./src/resourceController"), exports);
|
|
15
|
-
__exportStar(require("./src/streamController"), exports);
|
|
16
|
-
__exportStar(require("./src/dynamoDB"), exports);
|
|
17
|
-
__exportStar(require("./src/cognito"), exports);
|
|
18
|
-
__exportStar(require("./src/comprehend"), exports);
|
|
19
|
-
__exportStar(require("./src/s3"), exports);
|
|
20
|
-
__exportStar(require("./src/secretsManager"), exports);
|
|
21
|
-
__exportStar(require("./src/ses"), exports);
|
|
22
|
-
__exportStar(require("./src/sns"), exports);
|
|
23
|
-
__exportStar(require("./src/translate"), exports);
|
|
24
|
-
__exportStar(require("./src/attachments"), exports);
|
|
25
|
-
__exportStar(require("./src/logger"), exports);
|
|
1
|
+
export * from './src/genericController';
|
|
2
|
+
export * from './src/resourceController';
|
|
3
|
+
export * from './src/streamController';
|
|
4
|
+
export * from './src/dynamoDB';
|
|
5
|
+
export * from './src/cognito';
|
|
6
|
+
export * from './src/comprehend';
|
|
7
|
+
export * from './src/s3';
|
|
8
|
+
export * from './src/secretsManager';
|
|
9
|
+
export * from './src/ses';
|
|
10
|
+
export * from './src/sns';
|
|
11
|
+
export * from './src/translate';
|
|
12
|
+
export * from './src/attachments';
|
|
13
|
+
export * from './src/logger';
|
package/dist/src/attachments.js
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.Attachments = void 0;
|
|
4
|
-
const dynamoDB_1 = require("./dynamoDB");
|
|
5
|
-
const s3_1 = require("./s3");
|
|
1
|
+
import { DynamoDB } from './dynamoDB';
|
|
2
|
+
import { S3 } from './s3';
|
|
6
3
|
/**
|
|
7
4
|
* A custom class that takes advantage of DynamoDB and S3 to easily manage attachments.
|
|
8
5
|
*/
|
|
9
|
-
class Attachments {
|
|
6
|
+
export class Attachments {
|
|
10
7
|
constructor() {
|
|
11
8
|
/**
|
|
12
9
|
* The bucket where from to retrieve the attachments. Fallback to IDEA's default one.
|
|
13
10
|
*/
|
|
14
11
|
this.S3_ATTACHMENTS_BUCKET = process.env['S3_ATTACHMENTS_BUCKET'] || 'idea-attachments';
|
|
15
12
|
this.IUID_ATTACHMENTS_PREFIX = process.env['IUID_ATTACHMENTS_PREFIX'] || 'ATT';
|
|
16
|
-
this.dynamo = new
|
|
17
|
-
this.s3 = new
|
|
13
|
+
this.dynamo = new DynamoDB();
|
|
14
|
+
this.s3 = new S3();
|
|
18
15
|
}
|
|
19
16
|
/**
|
|
20
17
|
* Get a signedURL to put an attachment.
|
|
@@ -35,4 +32,3 @@ class Attachments {
|
|
|
35
32
|
return signedURL;
|
|
36
33
|
}
|
|
37
34
|
}
|
|
38
|
-
exports.Attachments = Attachments;
|
package/dist/src/cognito.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.Cognito = void 0;
|
|
4
|
-
const aws_sdk_1 = require("aws-sdk");
|
|
5
|
-
const idea_toolbox_1 = require("idea-toolbox");
|
|
1
|
+
import { CognitoIdentityServiceProvider } from 'aws-sdk';
|
|
2
|
+
import { CognitoUser, isEmpty } from 'idea-toolbox';
|
|
6
3
|
/**
|
|
7
4
|
* A wrapper for AWS Cognito.
|
|
8
5
|
*/
|
|
9
|
-
class Cognito {
|
|
6
|
+
export class Cognito {
|
|
10
7
|
constructor(params = {}) {
|
|
11
|
-
this.cognito = new
|
|
8
|
+
this.cognito = new CognitoIdentityServiceProvider({ apiVersion: '2016-04-18', region: params.region });
|
|
12
9
|
}
|
|
13
10
|
/**
|
|
14
11
|
* Change the region in which to find the user pool.
|
|
@@ -16,7 +13,7 @@ class Cognito {
|
|
|
16
13
|
*/
|
|
17
14
|
setRegion(region) {
|
|
18
15
|
// there is no quick way to change the region without re-creating the object
|
|
19
|
-
this.cognito = new
|
|
16
|
+
this.cognito = new CognitoIdentityServiceProvider({ apiVersion: this.cognito.config.apiVersion, region });
|
|
20
17
|
}
|
|
21
18
|
/**
|
|
22
19
|
* Get the attributes of the user, from the authorizer claims.
|
|
@@ -43,8 +40,8 @@ class Cognito {
|
|
|
43
40
|
mapCognitoUserAttributesAsPlainObject(user) {
|
|
44
41
|
const userAttributes = {};
|
|
45
42
|
(user.Attributes || user.UserAttributes || []).forEach((a) => (userAttributes[a.Name] = a.Value));
|
|
46
|
-
if (!
|
|
47
|
-
|
|
43
|
+
if (!userAttributes.userId)
|
|
44
|
+
userAttributes.userId = userAttributes.sub;
|
|
48
45
|
return userAttributes;
|
|
49
46
|
}
|
|
50
47
|
/**
|
|
@@ -78,7 +75,7 @@ class Cognito {
|
|
|
78
75
|
params.PaginationToken = options.pagination;
|
|
79
76
|
const res = await this.cognito.listUsers(params).promise();
|
|
80
77
|
const pagination = res.PaginationToken;
|
|
81
|
-
const users = options.users.concat(res.Users.map(u => new
|
|
78
|
+
const users = options.users.concat(res.Users.map(u => new CognitoUser(this.mapCognitoUserAttributesAsPlainObject(u))));
|
|
82
79
|
if (pagination)
|
|
83
80
|
return await this.getAllUsers(cognitoUserPoolId, { pagination, users });
|
|
84
81
|
else
|
|
@@ -92,7 +89,7 @@ class Cognito {
|
|
|
92
89
|
const email = typeof cognitoUserOrEmail === 'string'
|
|
93
90
|
? cognitoUserOrEmail
|
|
94
91
|
: cognitoUserOrEmail.email;
|
|
95
|
-
if (
|
|
92
|
+
if (isEmpty(email, 'email'))
|
|
96
93
|
throw new Error('INVALID_EMAIL');
|
|
97
94
|
const UserAttributes = [
|
|
98
95
|
{ Name: 'email', Value: email },
|
|
@@ -124,7 +121,7 @@ class Cognito {
|
|
|
124
121
|
* Resend the password to a user who never logged in.
|
|
125
122
|
*/
|
|
126
123
|
async resendPassword(email, cognitoUserPoolId, options = {}) {
|
|
127
|
-
if (
|
|
124
|
+
if (isEmpty(email, 'email'))
|
|
128
125
|
throw new Error('Invalid email');
|
|
129
126
|
const params = {
|
|
130
127
|
UserPoolId: cognitoUserPoolId,
|
|
@@ -139,7 +136,7 @@ class Cognito {
|
|
|
139
136
|
* Delete a user by its email (username), in the pool specified.
|
|
140
137
|
*/
|
|
141
138
|
async deleteUser(email, cognitoUserPoolId) {
|
|
142
|
-
if (
|
|
139
|
+
if (isEmpty(email, 'email'))
|
|
143
140
|
throw new Error('Invalid email');
|
|
144
141
|
await this.cognito.adminDeleteUser({ UserPoolId: cognitoUserPoolId, Username: email }).promise();
|
|
145
142
|
}
|
|
@@ -181,7 +178,7 @@ class Cognito {
|
|
|
181
178
|
* Change the email address (== username) associated to a user.
|
|
182
179
|
*/
|
|
183
180
|
async updateEmail(email, newEmail, cognitoUserPoolId) {
|
|
184
|
-
if (
|
|
181
|
+
if (isEmpty(newEmail, 'email'))
|
|
185
182
|
throw new Error('Invalid new email');
|
|
186
183
|
await this.cognito
|
|
187
184
|
.adminUpdateUserAttributes({
|
|
@@ -274,14 +271,14 @@ class Cognito {
|
|
|
274
271
|
const usersInGroupList = await this.cognito
|
|
275
272
|
.listUsersInGroup({ UserPoolId: cognitoUserPoolId, GroupName: group })
|
|
276
273
|
.promise();
|
|
277
|
-
const users = usersInGroupList.Users.map(u => new
|
|
274
|
+
const users = usersInGroupList.Users.map(u => new CognitoUser(this.mapCognitoUserAttributesAsPlainObject(u)));
|
|
278
275
|
return users;
|
|
279
276
|
}
|
|
280
277
|
/**
|
|
281
278
|
* Add a user (by email) to a group in the user pool.
|
|
282
279
|
*/
|
|
283
280
|
async addUserToGroup(email, group, cognitoUserPoolId) {
|
|
284
|
-
const user = new
|
|
281
|
+
const user = new CognitoUser(await this.getUserByEmail(email, cognitoUserPoolId));
|
|
285
282
|
await this.cognito
|
|
286
283
|
.adminAddUserToGroup({ UserPoolId: cognitoUserPoolId, GroupName: group, Username: user.userId })
|
|
287
284
|
.promise();
|
|
@@ -290,10 +287,9 @@ class Cognito {
|
|
|
290
287
|
* Remove a user (by email) from a group in the user pool.
|
|
291
288
|
*/
|
|
292
289
|
async removeUserFromGroup(email, group, cognitoUserPoolId) {
|
|
293
|
-
const user = new
|
|
290
|
+
const user = new CognitoUser(await this.getUserByEmail(email, cognitoUserPoolId));
|
|
294
291
|
await this.cognito
|
|
295
292
|
.adminRemoveUserFromGroup({ UserPoolId: cognitoUserPoolId, GroupName: group, Username: user.userId })
|
|
296
293
|
.promise();
|
|
297
294
|
}
|
|
298
295
|
}
|
|
299
|
-
exports.Cognito = Cognito;
|
package/dist/src/comprehend.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Comprehend = void 0;
|
|
4
|
-
const aws_sdk_1 = require("aws-sdk");
|
|
1
|
+
import { Comprehend as AmazonComprehend } from 'aws-sdk';
|
|
5
2
|
/**
|
|
6
3
|
* A wrapper for Amazon Comprehend.
|
|
7
4
|
*/
|
|
8
|
-
class Comprehend {
|
|
5
|
+
export class Comprehend {
|
|
9
6
|
constructor() {
|
|
10
|
-
this.comprehend = new
|
|
7
|
+
this.comprehend = new AmazonComprehend({ apiVersion: '2017-11-27' });
|
|
11
8
|
}
|
|
12
9
|
/**
|
|
13
10
|
* Inspects text and returns an inference of the prevailing sentiment (POSITIVE, NEUTRAL, MIXED, or NEGATIVE).
|
|
@@ -21,4 +18,3 @@ class Comprehend {
|
|
|
21
18
|
return result.Sentiment;
|
|
22
19
|
}
|
|
23
20
|
}
|
|
24
|
-
exports.Comprehend = Comprehend;
|
package/dist/src/dynamoDB.js
CHANGED
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const shortid_1 = require("shortid");
|
|
9
|
-
const logger_1 = require("./logger");
|
|
10
|
-
const logger = new logger_1.Logger();
|
|
1
|
+
import { DynamoDB as DDB } from 'aws-sdk';
|
|
2
|
+
import { v4 as UUIDV4 } from 'uuid';
|
|
3
|
+
import { customAlphabet as AlphabetNanoID } from 'nanoid';
|
|
4
|
+
const NanoID = AlphabetNanoID('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', 25);
|
|
5
|
+
import { characters as ShortIdCharacters, generate as ShortIdGenerate } from 'shortid';
|
|
6
|
+
import { Logger } from './logger';
|
|
7
|
+
const logger = new Logger();
|
|
11
8
|
/**
|
|
12
9
|
* A wrapper for AWS DynamoDB.
|
|
13
10
|
*/
|
|
14
|
-
class DynamoDB {
|
|
11
|
+
export class DynamoDB {
|
|
15
12
|
constructor() {
|
|
16
|
-
this.dynamo = new
|
|
13
|
+
this.dynamo = new DDB.DocumentClient();
|
|
17
14
|
}
|
|
18
15
|
/**
|
|
19
16
|
* Convert a JSON object from dynamoDB format to simple JSON.
|
|
20
17
|
*/
|
|
21
18
|
unmarshall(data, options) {
|
|
22
|
-
return
|
|
19
|
+
return DDB.Converter.unmarshall(data, options);
|
|
23
20
|
}
|
|
24
21
|
/**
|
|
25
22
|
* Returns an IUID: IDEA's Unique IDentifier, which is an id unique through all IDEA's projects.
|
|
@@ -70,13 +67,13 @@ class DynamoDB {
|
|
|
70
67
|
result = `${project}_${id}`;
|
|
71
68
|
break;
|
|
72
69
|
case 'IUID':
|
|
73
|
-
id = (
|
|
70
|
+
id = UUIDV4();
|
|
74
71
|
result = `${project}_${id}`;
|
|
75
72
|
break;
|
|
76
73
|
case 'ISID':
|
|
77
74
|
// avoid _ characters (to avoid concatenation problems with ids) -- it must be anyway 64 chars-long
|
|
78
|
-
(
|
|
79
|
-
id = (
|
|
75
|
+
ShortIdCharacters('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-@');
|
|
76
|
+
id = ShortIdGenerate();
|
|
80
77
|
result = id;
|
|
81
78
|
break;
|
|
82
79
|
}
|
|
@@ -305,4 +302,3 @@ class DynamoDB {
|
|
|
305
302
|
return this.dynamo.createSet(array, options);
|
|
306
303
|
}
|
|
307
304
|
}
|
|
308
|
-
exports.DynamoDB = DynamoDB;
|
|
@@ -1,27 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const secretsManager_1 = require("./secretsManager");
|
|
12
|
-
const attachments_1 = require("./attachments");
|
|
13
|
-
const logger_1 = require("./logger");
|
|
1
|
+
import { DynamoDB } from './dynamoDB';
|
|
2
|
+
import { Cognito } from './cognito';
|
|
3
|
+
import { S3 } from './s3';
|
|
4
|
+
import { SES } from './ses';
|
|
5
|
+
import { SNS } from './sns';
|
|
6
|
+
import { Translate } from './translate';
|
|
7
|
+
import { Comprehend } from './comprehend';
|
|
8
|
+
import { SecretsManager } from './secretsManager';
|
|
9
|
+
import { Attachments } from './attachments';
|
|
10
|
+
import { Logger } from './logger';
|
|
14
11
|
/**
|
|
15
12
|
* An abstract class to inherit to manage some resources with an AWS Lambda function.
|
|
16
13
|
*/
|
|
17
|
-
class GenericController {
|
|
14
|
+
export class GenericController {
|
|
18
15
|
/**
|
|
19
16
|
* Initialize a new GenericController helper object.
|
|
20
17
|
* @param event the event that invoked the AWS lambda function
|
|
21
18
|
* @param callback the callback to resolve or reject the execution
|
|
22
19
|
*/
|
|
23
20
|
constructor(event, callback, options = {}) {
|
|
24
|
-
this.logger = new
|
|
21
|
+
this.logger = new Logger();
|
|
25
22
|
this.event = event;
|
|
26
23
|
this.callback = callback;
|
|
27
24
|
this.tables = options.tables || {};
|
|
@@ -44,7 +41,7 @@ class GenericController {
|
|
|
44
41
|
*/
|
|
45
42
|
get dynamoDB() {
|
|
46
43
|
if (!this._dynamoDB)
|
|
47
|
-
this._dynamoDB = new
|
|
44
|
+
this._dynamoDB = new DynamoDB();
|
|
48
45
|
return this._dynamoDB;
|
|
49
46
|
}
|
|
50
47
|
set dynamoDB(dynamoDB) {
|
|
@@ -55,7 +52,7 @@ class GenericController {
|
|
|
55
52
|
*/
|
|
56
53
|
get cognito() {
|
|
57
54
|
if (!this._cognito)
|
|
58
|
-
this._cognito = new
|
|
55
|
+
this._cognito = new Cognito();
|
|
59
56
|
return this._cognito;
|
|
60
57
|
}
|
|
61
58
|
set cognito(cognito) {
|
|
@@ -66,7 +63,7 @@ class GenericController {
|
|
|
66
63
|
*/
|
|
67
64
|
get s3() {
|
|
68
65
|
if (!this._s3)
|
|
69
|
-
this._s3 = new
|
|
66
|
+
this._s3 = new S3();
|
|
70
67
|
return this._s3;
|
|
71
68
|
}
|
|
72
69
|
set s3(s3) {
|
|
@@ -77,7 +74,7 @@ class GenericController {
|
|
|
77
74
|
*/
|
|
78
75
|
get ses() {
|
|
79
76
|
if (!this._ses)
|
|
80
|
-
this._ses = new
|
|
77
|
+
this._ses = new SES();
|
|
81
78
|
return this._ses;
|
|
82
79
|
}
|
|
83
80
|
set ses(ses) {
|
|
@@ -88,7 +85,7 @@ class GenericController {
|
|
|
88
85
|
*/
|
|
89
86
|
get sns() {
|
|
90
87
|
if (!this._sns)
|
|
91
|
-
this._sns = new
|
|
88
|
+
this._sns = new SNS();
|
|
92
89
|
return this._sns;
|
|
93
90
|
}
|
|
94
91
|
set sns(sns) {
|
|
@@ -99,7 +96,7 @@ class GenericController {
|
|
|
99
96
|
*/
|
|
100
97
|
get translate() {
|
|
101
98
|
if (!this._translate)
|
|
102
|
-
this._translate = new
|
|
99
|
+
this._translate = new Translate();
|
|
103
100
|
return this._translate;
|
|
104
101
|
}
|
|
105
102
|
set translate(translate) {
|
|
@@ -110,7 +107,7 @@ class GenericController {
|
|
|
110
107
|
*/
|
|
111
108
|
get comprehend() {
|
|
112
109
|
if (!this._comprehend)
|
|
113
|
-
this._comprehend = new
|
|
110
|
+
this._comprehend = new Comprehend();
|
|
114
111
|
return this._comprehend;
|
|
115
112
|
}
|
|
116
113
|
set comprehend(comprehend) {
|
|
@@ -121,7 +118,7 @@ class GenericController {
|
|
|
121
118
|
*/
|
|
122
119
|
get secrets() {
|
|
123
120
|
if (!this._secrets)
|
|
124
|
-
this._secrets = new
|
|
121
|
+
this._secrets = new SecretsManager();
|
|
125
122
|
return this._secrets;
|
|
126
123
|
}
|
|
127
124
|
set secrets(secrets) {
|
|
@@ -136,11 +133,10 @@ class GenericController {
|
|
|
136
133
|
*/
|
|
137
134
|
get attachments() {
|
|
138
135
|
if (!this._attachments)
|
|
139
|
-
this._attachments = new
|
|
136
|
+
this._attachments = new Attachments();
|
|
140
137
|
return this._attachments;
|
|
141
138
|
}
|
|
142
139
|
set attachments(attachments) {
|
|
143
140
|
this._attachments = attachments;
|
|
144
141
|
}
|
|
145
142
|
}
|
|
146
|
-
exports.GenericController = GenericController;
|
package/dist/src/logger.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Logger = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Manage structured logging.
|
|
6
3
|
*/
|
|
7
|
-
class Logger {
|
|
4
|
+
export class Logger {
|
|
8
5
|
constructor({ level = process.env.LOG_LEVEL } = {}) {
|
|
9
6
|
this.level = (level || 'DEBUG').toUpperCase();
|
|
10
7
|
this.originalLevel = this.level;
|
|
@@ -48,6 +45,5 @@ class Logger {
|
|
|
48
45
|
this.level = this.originalLevel;
|
|
49
46
|
}
|
|
50
47
|
}
|
|
51
|
-
exports.Logger = Logger;
|
|
52
48
|
// levels here are identical to bunyan practices (https://github.com/trentm/node-bunyan#levels)
|
|
53
49
|
const LogLevels = { DEBUG: 20, INFO: 30, WARN: 40, ERROR: 50 };
|
|
@@ -125,12 +125,12 @@ export declare abstract class ResourceController extends GenericController {
|
|
|
125
125
|
t(key: string, interpolateParams?: any): string;
|
|
126
126
|
/**
|
|
127
127
|
* Interpolates a string to replace parameters.
|
|
128
|
-
* "This is a {{ key }}" ==> "This is a value", with params = { key: "value" }
|
|
128
|
+
* `"This is a {{ key }}"` ==> `"This is a value", with params = { key: "value" }`.
|
|
129
129
|
*/
|
|
130
130
|
private interpolate;
|
|
131
131
|
/**
|
|
132
132
|
* Gets a value from an object by composed key.
|
|
133
|
-
* getValue({ key1: { keyA: 'valueI' }}, 'key1.keyA') ==> 'valueI'
|
|
133
|
+
* `getValue({ key1: { keyA: 'valueI' }}, 'key1.keyA')` ==> `'valueI'`.
|
|
134
134
|
*/
|
|
135
135
|
private getValue;
|
|
136
136
|
/**
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const idea_toolbox_1 = require("idea-toolbox");
|
|
8
|
-
const logger_1 = require("./logger");
|
|
9
|
-
const genericController_1 = require("./genericController");
|
|
1
|
+
import 'source-map-support/register';
|
|
2
|
+
import { existsSync, readFileSync } from 'fs';
|
|
3
|
+
import { Lambda, EventBridge } from 'aws-sdk';
|
|
4
|
+
import { APIRequestLog, CognitoUser } from 'idea-toolbox';
|
|
5
|
+
import { Logger } from './logger';
|
|
6
|
+
import { GenericController } from './genericController';
|
|
10
7
|
/**
|
|
11
8
|
* An abstract class to inherit to manage API requests (AWS API Gateway) in an AWS Lambda function.
|
|
12
9
|
*/
|
|
13
|
-
class ResourceController extends
|
|
10
|
+
export class ResourceController extends GenericController {
|
|
14
11
|
constructor(event, callback, options = {}) {
|
|
15
12
|
super(event, callback, options);
|
|
16
|
-
this.logger = new
|
|
13
|
+
this.logger = new Logger();
|
|
17
14
|
this.templateMatcher = /{{\s?([^{}\s]*)\s?}}/g;
|
|
18
15
|
///
|
|
19
16
|
/// REQUEST HANDLERS
|
|
@@ -109,7 +106,7 @@ class ResourceController extends genericController_1.GenericController {
|
|
|
109
106
|
const authorizer = event.requestContext?.authorizer ?? {};
|
|
110
107
|
const contextFromAuthorizer = authorizer.lambda ?? authorizer.jwt?.claims ?? {};
|
|
111
108
|
this.principalId = contextFromAuthorizer.principalId ?? contextFromAuthorizer.sub ?? null;
|
|
112
|
-
this.cognitoUser = authorizer.jwt?.claims ? new
|
|
109
|
+
this.cognitoUser = authorizer.jwt?.claims ? new CognitoUser(authorizer.jwt?.claims) : null;
|
|
113
110
|
this.stage = event.requestContext.stage;
|
|
114
111
|
this.httpMethod = event.requestContext.http.method;
|
|
115
112
|
this.resource = event.routeKey.replace('+', ''); // {proxy+} -> {proxy}
|
|
@@ -125,7 +122,7 @@ class ResourceController extends genericController_1.GenericController {
|
|
|
125
122
|
this.authorization = event.headers.Authorization;
|
|
126
123
|
this.claims = event.requestContext.authorizer?.claims || {};
|
|
127
124
|
this.principalId = this.claims.sub;
|
|
128
|
-
this.cognitoUser = this.principalId ? new
|
|
125
|
+
this.cognitoUser = this.principalId ? new CognitoUser(this.claims) : null;
|
|
129
126
|
this.stage = event.requestContext.stage;
|
|
130
127
|
this.httpMethod = event.httpMethod;
|
|
131
128
|
this.resource = event.resource.replace('+', ''); // {proxy+} -> {proxy}
|
|
@@ -242,7 +239,7 @@ class ResourceController extends genericController_1.GenericController {
|
|
|
242
239
|
* Store the log associated to the request (no response/error handling).
|
|
243
240
|
*/
|
|
244
241
|
storeLog(succeeded) {
|
|
245
|
-
const log = new
|
|
242
|
+
const log = new APIRequestLog({
|
|
246
243
|
logId: this.logRequestsWithKey,
|
|
247
244
|
userId: this.principalId,
|
|
248
245
|
resource: this.resource,
|
|
@@ -263,7 +260,7 @@ class ResourceController extends genericController_1.GenericController {
|
|
|
263
260
|
* Search for the specified file path in both the Lambda function's main folder and the layers folder.
|
|
264
261
|
*/
|
|
265
262
|
sharedResourceExists(filePath) {
|
|
266
|
-
return
|
|
263
|
+
return existsSync(`assets/${filePath}`) || existsSync(`/opt/nodejs/assets/${filePath}`);
|
|
267
264
|
}
|
|
268
265
|
/**
|
|
269
266
|
* Load a shared resource in the back-end (translation, template, etc.).
|
|
@@ -271,11 +268,11 @@ class ResourceController extends genericController_1.GenericController {
|
|
|
271
268
|
*/
|
|
272
269
|
loadSharedResource(filePath) {
|
|
273
270
|
let path = null;
|
|
274
|
-
if (
|
|
271
|
+
if (existsSync(`assets/${filePath}`))
|
|
275
272
|
path = `assets/${filePath}`;
|
|
276
|
-
else if (
|
|
273
|
+
else if (existsSync(`/opt/nodejs/assets/${filePath}`))
|
|
277
274
|
path = `/opt/nodejs/assets/${filePath}`;
|
|
278
|
-
return path ?
|
|
275
|
+
return path ? readFileSync(path, { encoding: 'utf-8' }) : null;
|
|
279
276
|
}
|
|
280
277
|
///
|
|
281
278
|
/// MANAGE INTERNAL API REQUESTS (lambda invokes masked as API requests)
|
|
@@ -299,7 +296,7 @@ class ResourceController extends genericController_1.GenericController {
|
|
|
299
296
|
Payload: this.mapEventForInternalApiRequest(params),
|
|
300
297
|
Qualifier: params.stage || this.stage
|
|
301
298
|
};
|
|
302
|
-
const res = await new
|
|
299
|
+
const res = await new Lambda().invoke(lambdaInvokeParams).promise();
|
|
303
300
|
const payload = JSON.parse(res.Payload);
|
|
304
301
|
const body = JSON.parse(payload.body);
|
|
305
302
|
if (Number(payload.statusCode) !== 200)
|
|
@@ -313,7 +310,7 @@ class ResourceController extends genericController_1.GenericController {
|
|
|
313
310
|
DetailType: params.eventBridge.target,
|
|
314
311
|
Detail: this.mapEventForInternalApiRequest(params)
|
|
315
312
|
};
|
|
316
|
-
return await new
|
|
313
|
+
return await new EventBridge().putEvents({ Entries: [request] }).promise();
|
|
317
314
|
}
|
|
318
315
|
mapEventForInternalApiRequest(params) {
|
|
319
316
|
const event = JSON.parse(JSON.stringify(this.event));
|
|
@@ -379,7 +376,7 @@ class ResourceController extends genericController_1.GenericController {
|
|
|
379
376
|
}
|
|
380
377
|
/**
|
|
381
378
|
* Interpolates a string to replace parameters.
|
|
382
|
-
* "This is a {{ key }}" ==> "This is a value", with params = { key: "value" }
|
|
379
|
+
* `"This is a {{ key }}"` ==> `"This is a value", with params = { key: "value" }`.
|
|
383
380
|
*/
|
|
384
381
|
interpolate(expr, params) {
|
|
385
382
|
if (!params || !expr)
|
|
@@ -391,7 +388,7 @@ class ResourceController extends genericController_1.GenericController {
|
|
|
391
388
|
}
|
|
392
389
|
/**
|
|
393
390
|
* Gets a value from an object by composed key.
|
|
394
|
-
* getValue({ key1: { keyA: 'valueI' }}, 'key1.keyA') ==> 'valueI'
|
|
391
|
+
* `getValue({ key1: { keyA: 'valueI' }}, 'key1.keyA')` ==> `'valueI'`.
|
|
395
392
|
*/
|
|
396
393
|
getValue(target, key) {
|
|
397
394
|
const keys = typeof key === 'string' ? key.split('.') : [key];
|
|
@@ -416,14 +413,12 @@ class ResourceController extends genericController_1.GenericController {
|
|
|
416
413
|
return value !== undefined && value !== null;
|
|
417
414
|
}
|
|
418
415
|
}
|
|
419
|
-
exports.ResourceController = ResourceController;
|
|
420
416
|
/**
|
|
421
417
|
* Explicitly define a specific type of error to use in the RC's handler, to distinguish it from the normal errors.
|
|
422
418
|
*/
|
|
423
|
-
class RCError extends Error {
|
|
419
|
+
export class RCError extends Error {
|
|
424
420
|
constructor(message) {
|
|
425
421
|
super(message);
|
|
426
422
|
Object.setPrototypeOf(this, RCError.prototype);
|
|
427
423
|
}
|
|
428
424
|
}
|
|
429
|
-
exports.RCError = RCError;
|
package/dist/src/s3.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const idea_toolbox_1 = require("idea-toolbox");
|
|
6
|
-
const logger_1 = require("./logger");
|
|
7
|
-
const logger = new logger_1.Logger();
|
|
1
|
+
import { S3 as AWSS3 } from 'aws-sdk';
|
|
2
|
+
import { SignedURL } from 'idea-toolbox';
|
|
3
|
+
import { Logger } from './logger';
|
|
4
|
+
const logger = new Logger();
|
|
8
5
|
/**
|
|
9
6
|
* A wrapper for AWS Simple Storage Service.
|
|
10
7
|
*/
|
|
11
|
-
class S3 {
|
|
8
|
+
export class S3 {
|
|
12
9
|
/**
|
|
13
10
|
* Initialize a new S3 helper object.
|
|
14
11
|
*/
|
|
@@ -17,7 +14,7 @@ class S3 {
|
|
|
17
14
|
this.DEFAULT_DOWNLOAD_BUCKET = 'idea-downloads';
|
|
18
15
|
this.DEFAULT_DOWNLOAD_BUCKET_SEC_TO_EXP = 180;
|
|
19
16
|
this.DEFAULT_UPLOAD_BUCKET_SEC_TO_EXP = 300;
|
|
20
|
-
this.s3 = new
|
|
17
|
+
this.s3 = new AWSS3({ apiVersion: '2006-03-01', signatureVersion: 'v4' });
|
|
21
18
|
}
|
|
22
19
|
/**
|
|
23
20
|
* Create a download link of a piece of data (through S3).
|
|
@@ -40,7 +37,7 @@ class S3 {
|
|
|
40
37
|
* @param expires seconds after which the signed URL expires
|
|
41
38
|
*/
|
|
42
39
|
signedURLPut(bucket, key, expires) {
|
|
43
|
-
return new
|
|
40
|
+
return new SignedURL({
|
|
44
41
|
url: this.s3.getSignedUrl('putObject', {
|
|
45
42
|
Bucket: bucket,
|
|
46
43
|
Key: key,
|
|
@@ -53,7 +50,7 @@ class S3 {
|
|
|
53
50
|
* @param expires seconds after which the signed URL expires
|
|
54
51
|
*/
|
|
55
52
|
signedURLGet(bucket, key, expires) {
|
|
56
|
-
return new
|
|
53
|
+
return new SignedURL({
|
|
57
54
|
url: this.s3.getSignedUrl('getObject', {
|
|
58
55
|
Bucket: bucket,
|
|
59
56
|
Key: key,
|
|
@@ -131,12 +128,11 @@ class S3 {
|
|
|
131
128
|
}
|
|
132
129
|
}
|
|
133
130
|
}
|
|
134
|
-
exports.S3 = S3;
|
|
135
131
|
/**
|
|
136
132
|
* The managed types to convert objects coming from an S3 bucket.
|
|
137
133
|
*/
|
|
138
|
-
var GetObjectTypes;
|
|
134
|
+
export var GetObjectTypes;
|
|
139
135
|
(function (GetObjectTypes) {
|
|
140
136
|
GetObjectTypes["JSON"] = "JSON";
|
|
141
137
|
GetObjectTypes["TEXT"] = "TEXT";
|
|
142
|
-
})(GetObjectTypes
|
|
138
|
+
})(GetObjectTypes || (GetObjectTypes = {}));
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SecretsManager = void 0;
|
|
4
|
-
const aws_sdk_1 = require("aws-sdk");
|
|
1
|
+
import { SecretsManager as AWSSecretsManager } from 'aws-sdk';
|
|
5
2
|
/**
|
|
6
3
|
* A wrapper for AWS Secrets manager.
|
|
7
4
|
*/
|
|
8
|
-
class SecretsManager {
|
|
5
|
+
export class SecretsManager {
|
|
9
6
|
constructor() {
|
|
10
|
-
this.sm = new
|
|
7
|
+
this.sm = new AWSSecretsManager();
|
|
11
8
|
}
|
|
12
9
|
/**
|
|
13
10
|
* Get a secret string from the Secret Manager by its id.
|
|
@@ -17,4 +14,3 @@ class SecretsManager {
|
|
|
17
14
|
return result.SecretString;
|
|
18
15
|
}
|
|
19
16
|
}
|
|
20
|
-
exports.SecretsManager = SecretsManager;
|
package/dist/src/ses.js
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const dynamoDB_1 = require("./dynamoDB");
|
|
7
|
-
const logger_1 = require("./logger");
|
|
8
|
-
const logger = new logger_1.Logger();
|
|
1
|
+
import { SES as AWSSES } from 'aws-sdk';
|
|
2
|
+
import { createTransport as NodemailerCreateTransport } from 'nodemailer';
|
|
3
|
+
import { DynamoDB } from './dynamoDB';
|
|
4
|
+
import { Logger } from './logger';
|
|
5
|
+
const logger = new Logger();
|
|
9
6
|
/**
|
|
10
7
|
* A wrapper for AWS Simple Email Service.
|
|
11
8
|
*/
|
|
12
|
-
class SES {
|
|
9
|
+
export class SES {
|
|
13
10
|
constructor(params = {}) {
|
|
14
|
-
this.ses = new
|
|
11
|
+
this.ses = new AWSSES({ region: params.region });
|
|
15
12
|
}
|
|
16
13
|
//
|
|
17
14
|
// CONFIG
|
|
@@ -63,7 +60,7 @@ class SES {
|
|
|
63
60
|
if (this.ses.config.region === sesParams.region)
|
|
64
61
|
ses = this.ses;
|
|
65
62
|
else
|
|
66
|
-
ses = new
|
|
63
|
+
ses = new AWSSES({ region: sesParams.region });
|
|
67
64
|
logger.debug('SES send templated email');
|
|
68
65
|
return await ses.sendTemplatedEmail(request).promise();
|
|
69
66
|
}
|
|
@@ -85,7 +82,7 @@ class SES {
|
|
|
85
82
|
if (!teamId)
|
|
86
83
|
return null;
|
|
87
84
|
try {
|
|
88
|
-
return await new
|
|
85
|
+
return await new DynamoDB().get({ TableName: 'idea_teamsSES', Key: { teamId } });
|
|
89
86
|
}
|
|
90
87
|
catch (err) {
|
|
91
88
|
return null;
|
|
@@ -103,7 +100,7 @@ class SES {
|
|
|
103
100
|
if (this.ses.config.region === sesParams.region)
|
|
104
101
|
ses = this.ses;
|
|
105
102
|
else
|
|
106
|
-
ses = new
|
|
103
|
+
ses = new AWSSES({ region: sesParams.region });
|
|
107
104
|
logger.debug('SES send email');
|
|
108
105
|
return await ses.sendEmail(request).promise();
|
|
109
106
|
}
|
|
@@ -127,9 +124,9 @@ class SES {
|
|
|
127
124
|
if (this.ses.config.region === sesParams.region)
|
|
128
125
|
ses = this.ses;
|
|
129
126
|
else
|
|
130
|
-
ses = new
|
|
127
|
+
ses = new AWSSES({ region: sesParams.region });
|
|
131
128
|
logger.debug('SES send email (Nodemailer)');
|
|
132
|
-
return await (
|
|
129
|
+
return await NodemailerCreateTransport({ SES: ses }).sendMail(mailOptions);
|
|
133
130
|
}
|
|
134
131
|
prepareEmailDestination(emailData) {
|
|
135
132
|
return {
|
|
@@ -152,4 +149,3 @@ class SES {
|
|
|
152
149
|
return message;
|
|
153
150
|
}
|
|
154
151
|
}
|
|
155
|
-
exports.SES = SES;
|
package/dist/src/sns.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.SNS = void 0;
|
|
4
|
-
const aws_sdk_1 = require("aws-sdk");
|
|
5
|
-
const idea_toolbox_1 = require("idea-toolbox");
|
|
1
|
+
import { SNS as AWSSNS } from 'aws-sdk';
|
|
2
|
+
import { PushNotificationsPlatforms, logger } from 'idea-toolbox';
|
|
6
3
|
/**
|
|
7
4
|
* A wrapper for AWS Simple Notification Service.
|
|
8
5
|
*/
|
|
9
|
-
class SNS {
|
|
6
|
+
export class SNS {
|
|
10
7
|
/**
|
|
11
8
|
* Create a new endpoint in the SNS platform specified.
|
|
12
9
|
* @return platform endpoint ARN
|
|
@@ -14,20 +11,20 @@ class SNS {
|
|
|
14
11
|
async createPushPlatormEndpoint(platform, token, snsParams) {
|
|
15
12
|
let platformARN;
|
|
16
13
|
switch (platform) {
|
|
17
|
-
case
|
|
14
|
+
case PushNotificationsPlatforms.APNS:
|
|
18
15
|
platformARN = snsParams.appleArn;
|
|
19
16
|
break;
|
|
20
|
-
case
|
|
17
|
+
case PushNotificationsPlatforms.APNS_SANDBOX:
|
|
21
18
|
platformARN = snsParams.appleDevArn;
|
|
22
19
|
break;
|
|
23
|
-
case
|
|
20
|
+
case PushNotificationsPlatforms.FCM:
|
|
24
21
|
platformARN = snsParams.androidArn;
|
|
25
22
|
break;
|
|
26
23
|
default:
|
|
27
24
|
throw new Error('Unsupported platform');
|
|
28
25
|
}
|
|
29
|
-
|
|
30
|
-
const result = await new
|
|
26
|
+
logger('SNS ADD PLATFORM ENDPOINT');
|
|
27
|
+
const result = await new AWSSNS({ apiVersion: '2010-03-31', region: snsParams.region })
|
|
31
28
|
.createPlatformEndpoint({ PlatformApplicationArn: platformARN, Token: token })
|
|
32
29
|
.promise();
|
|
33
30
|
return result.EndpointArn;
|
|
@@ -41,13 +38,13 @@ class SNS {
|
|
|
41
38
|
structuredMessage = { default: JSON.stringify(snsParams.json) };
|
|
42
39
|
else
|
|
43
40
|
switch (snsParams.platform) {
|
|
44
|
-
case
|
|
41
|
+
case PushNotificationsPlatforms.APNS:
|
|
45
42
|
structuredMessage = { APNS: JSON.stringify({ aps: { alert: snsParams.message } }) };
|
|
46
43
|
break;
|
|
47
|
-
case
|
|
44
|
+
case PushNotificationsPlatforms.APNS_SANDBOX:
|
|
48
45
|
structuredMessage = { APNS_SANDBOX: JSON.stringify({ aps: { alert: snsParams.message } }) };
|
|
49
46
|
break;
|
|
50
|
-
case
|
|
47
|
+
case PushNotificationsPlatforms.FCM:
|
|
51
48
|
structuredMessage = {
|
|
52
49
|
GCM: JSON.stringify({ notification: { body: snsParams.message, title: snsParams.message } })
|
|
53
50
|
};
|
|
@@ -55,10 +52,9 @@ class SNS {
|
|
|
55
52
|
default:
|
|
56
53
|
throw new Error('Unsupported platform');
|
|
57
54
|
}
|
|
58
|
-
|
|
59
|
-
return await new
|
|
55
|
+
logger('SNS PUBLISH IN TOPIC');
|
|
56
|
+
return await new AWSSNS({ apiVersion: '2010-03-31', region: snsParams.region })
|
|
60
57
|
.publish({ MessageStructure: 'json', Message: JSON.stringify(structuredMessage), TargetArn: snsParams.endpoint })
|
|
61
58
|
.promise();
|
|
62
59
|
}
|
|
63
60
|
}
|
|
64
|
-
exports.SNS = SNS;
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const genericController_1 = require("./genericController");
|
|
5
|
-
const logger_1 = require("./logger");
|
|
6
|
-
const logger = new logger_1.Logger();
|
|
1
|
+
import { GenericController } from './genericController';
|
|
2
|
+
import { Logger } from './logger';
|
|
3
|
+
const logger = new Logger();
|
|
7
4
|
/**
|
|
8
5
|
* An abstract class to inherit to manage AWS DDB streams in an AWS Lambda function.
|
|
9
6
|
*/
|
|
10
|
-
class StreamController extends
|
|
7
|
+
export class StreamController extends GenericController {
|
|
11
8
|
constructor(event, callback, options = {}) {
|
|
12
9
|
super(event, callback, options);
|
|
13
10
|
this.records = event.Records || [];
|
|
14
11
|
logger.info(`START STREAM: ${this.records.length || 0} records`);
|
|
15
12
|
}
|
|
16
13
|
}
|
|
17
|
-
exports.StreamController = StreamController;
|
package/dist/src/translate.js
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.Translate = void 0;
|
|
4
|
-
const aws_sdk_1 = require("aws-sdk");
|
|
5
|
-
const idea_toolbox_1 = require("idea-toolbox");
|
|
1
|
+
import { Translate as AWSTranslate } from 'aws-sdk';
|
|
2
|
+
import { PDFTemplateSectionTypes } from 'idea-toolbox';
|
|
6
3
|
/**
|
|
7
4
|
* A wrapper for Amazon Translate.
|
|
8
5
|
*/
|
|
9
|
-
class Translate {
|
|
6
|
+
export class Translate {
|
|
10
7
|
/**
|
|
11
8
|
* Initialize a new Translate helper object.
|
|
12
9
|
*/
|
|
13
10
|
constructor() {
|
|
14
|
-
this.translate = new
|
|
11
|
+
this.translate = new AWSTranslate({ apiVersion: '2017-07-01' });
|
|
15
12
|
this.sourceLanguageCode = 'en';
|
|
16
13
|
this.targetLanguageCode = 'en';
|
|
17
14
|
this.terminologyNames = new Array();
|
|
@@ -72,10 +69,10 @@ class Translate {
|
|
|
72
69
|
const toTranslate = new Set();
|
|
73
70
|
// gather the terms to translate from contents available on this level
|
|
74
71
|
template
|
|
75
|
-
.filter(s => s.isEither(
|
|
72
|
+
.filter(s => s.isEither(PDFTemplateSectionTypes.ROW, PDFTemplateSectionTypes.HEADER))
|
|
76
73
|
.forEach(s => {
|
|
77
74
|
switch (s.type) {
|
|
78
|
-
case
|
|
75
|
+
case PDFTemplateSectionTypes.ROW:
|
|
79
76
|
s.columns
|
|
80
77
|
.filter((_, index) => s.doesColumnContainAField(index))
|
|
81
78
|
.forEach(field => {
|
|
@@ -93,7 +90,7 @@ class Translate {
|
|
|
93
90
|
}
|
|
94
91
|
});
|
|
95
92
|
break;
|
|
96
|
-
case
|
|
93
|
+
case PDFTemplateSectionTypes.HEADER:
|
|
97
94
|
toTranslate.add(s.title[sourceLanguage]);
|
|
98
95
|
break;
|
|
99
96
|
}
|
|
@@ -101,13 +98,13 @@ class Translate {
|
|
|
101
98
|
// gather inner sections in a flat structure for further elaboraton
|
|
102
99
|
const innerSections = new Array();
|
|
103
100
|
template
|
|
104
|
-
.filter(s => s.isEither(
|
|
101
|
+
.filter(s => s.isEither(PDFTemplateSectionTypes.INNER_SECTION, PDFTemplateSectionTypes.REPEATED_INNER_SECTION))
|
|
105
102
|
.forEach(s => {
|
|
106
103
|
switch (s.type) {
|
|
107
|
-
case
|
|
104
|
+
case PDFTemplateSectionTypes.INNER_SECTION:
|
|
108
105
|
innerSections.push({ data: entity[s.context], template: s.innerTemplate });
|
|
109
106
|
break;
|
|
110
|
-
case
|
|
107
|
+
case PDFTemplateSectionTypes.REPEATED_INNER_SECTION:
|
|
111
108
|
entity[s.context].forEach((element) => innerSections.push({ data: element, template: s.innerTemplate }));
|
|
112
109
|
break;
|
|
113
110
|
}
|
|
@@ -121,4 +118,3 @@ class Translate {
|
|
|
121
118
|
return toTranslate;
|
|
122
119
|
}
|
|
123
120
|
}
|
|
124
|
-
exports.Translate = Translate;
|
package/package.json
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "idea-aws",
|
|
3
|
-
"version": "3.11.
|
|
3
|
+
"version": "3.11.8",
|
|
4
4
|
"description": "AWS wrappers to use in IDEA's back-ends",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"main": "dist/index.js",
|
|
6
7
|
"types": "dist/index.d.ts",
|
|
7
8
|
"scripts": {
|
|
8
9
|
"lint": "eslint --ext .ts",
|
|
9
10
|
"compile": "tsc --build",
|
|
10
|
-
"docs": "typedoc",
|
|
11
|
+
"docs": "typedoc index.ts",
|
|
11
12
|
"build": "./build.sh",
|
|
12
13
|
"publishPackage": "./build.sh && npm publish"
|
|
13
14
|
},
|
|
14
15
|
"repository": {
|
|
15
16
|
"type": "git",
|
|
16
|
-
"url": "git+https://github.com/
|
|
17
|
+
"url": "git+https://github.com/iter-idea/IDEA-AWS.git"
|
|
17
18
|
},
|
|
18
19
|
"keywords": [
|
|
19
20
|
"idea",
|
|
@@ -31,19 +32,19 @@
|
|
|
31
32
|
"author": "ITER IDEA <info@iter-idea.com> (https://iter-idea.com)",
|
|
32
33
|
"license": "ISC",
|
|
33
34
|
"bugs": {
|
|
34
|
-
"url": "https://github.com/
|
|
35
|
+
"url": "https://github.com/iter-idea/IDEA-AWS/issues"
|
|
35
36
|
},
|
|
36
|
-
"homepage": "https://
|
|
37
|
+
"homepage": "https://iter-idea.github.io/IDEA-AWS",
|
|
37
38
|
"dependencies": {
|
|
38
|
-
"idea-toolbox": "^6.5.
|
|
39
|
-
"nanoid": "^
|
|
40
|
-
"nodemailer": "^6.7.
|
|
39
|
+
"idea-toolbox": "^6.5.17",
|
|
40
|
+
"nanoid": "^4.0.0",
|
|
41
|
+
"nodemailer": "^6.7.5",
|
|
41
42
|
"shortid": "^2.2.16",
|
|
42
43
|
"source-map-support": "^0.5.21",
|
|
43
44
|
"uuid": "^8.3.2"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
|
-
"@tsconfig/
|
|
47
|
+
"@tsconfig/node16": "^1.0.3",
|
|
47
48
|
"@types/aws-lambda": "^8.10.91",
|
|
48
49
|
"@types/node": "^14.14.26",
|
|
49
50
|
"@types/nodemailer": "^6.4.4",
|
|
@@ -53,7 +54,7 @@
|
|
|
53
54
|
"@typescript-eslint/parser": "^4.31.1",
|
|
54
55
|
"aws-sdk": "^2.991.0",
|
|
55
56
|
"eslint": "^7.32.0",
|
|
56
|
-
"typedoc": "^0.
|
|
57
|
+
"typedoc": "^0.23.2",
|
|
57
58
|
"typescript": "^4.4.3"
|
|
58
59
|
}
|
|
59
60
|
}
|