idea-aws 4.4.3 → 4.4.4
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/package.json +1 -1
- package/.prettierrc +0 -9
- package/.vscode/settings.json +0 -26
- package/HOW-TO-RELEASE.md +0 -8
- package/build.sh +0 -21
- package/dist/src/attachments.d.ts +0 -27
- package/dist/src/attachments.js +0 -39
- package/dist/src/cognito.d.ts +0 -177
- package/dist/src/cognito.js +0 -412
- package/dist/src/comprehend.d.ts +0 -34
- package/dist/src/comprehend.js +0 -58
- package/dist/src/dynamoDB.d.ts +0 -108
- package/dist/src/dynamoDB.js +0 -296
- package/dist/src/genericController.d.ts +0 -60
- package/dist/src/genericController.js +0 -89
- package/dist/src/lambdaLogger.d.ts +0 -13
- package/dist/src/lambdaLogger.js +0 -43
- package/dist/src/metrics.d.ts +0 -31
- package/dist/src/metrics.js +0 -45
- package/dist/src/resourceController.d.ts +0 -232
- package/dist/src/resourceController.js +0 -561
- package/dist/src/s3.d.ts +0 -225
- package/dist/src/s3.js +0 -180
- package/dist/src/secretsManager.d.ts +0 -15
- package/dist/src/secretsManager.js +0 -48
- package/dist/src/ses.d.ts +0 -161
- package/dist/src/ses.js +0 -196
- package/dist/src/sns.d.ts +0 -60
- package/dist/src/sns.js +0 -94
- package/dist/src/ssm.d.ts +0 -22
- package/dist/src/ssm.js +0 -54
- package/dist/src/streamController.d.ts +0 -11
- package/dist/src/streamController.js +0 -20
- package/dist/src/translate.d.ts +0 -61
- package/dist/src/translate.js +0 -155
- package/docs/.nojekyll +0 -1
- package/docs/assets/custom.css +0 -4
- package/docs/assets/highlight.css +0 -50
- package/docs/assets/main.js +0 -58
- package/docs/assets/search.js +0 -1
- package/docs/assets/style.css +0 -1367
- package/docs/classes/Attachments.html +0 -201
- package/docs/classes/Cognito.html +0 -713
- package/docs/classes/Comprehend.html +0 -176
- package/docs/classes/DynamoDB.html +0 -584
- package/docs/classes/GenericController.html +0 -262
- package/docs/classes/HandledError.html +0 -219
- package/docs/classes/LambdaLogger.html +0 -220
- package/docs/classes/ResourceController.html +0 -957
- package/docs/classes/S3.html +0 -391
- package/docs/classes/SES.html +0 -335
- package/docs/classes/SNS.html +0 -185
- package/docs/classes/SecretsManager.html +0 -159
- package/docs/classes/StreamController.html +0 -284
- package/docs/classes/SystemsManager.html +0 -184
- package/docs/classes/Translate.html +0 -239
- package/docs/classes/UnhandledError.html +0 -252
- package/docs/functions/cleanFilename.html +0 -93
- package/docs/index.html +0 -95
- package/docs/interfaces/BasicEmailData.html +0 -145
- package/docs/interfaces/CognitoGroup.html +0 -122
- package/docs/interfaces/CognitoUserGeneric.html +0 -125
- package/docs/interfaces/CopyObjectOptions.html +0 -132
- package/docs/interfaces/CreateDownloadURLFromDataOptions.html +0 -163
- package/docs/interfaces/CreateUserOptions.html +0 -122
- package/docs/interfaces/DeleteObjectOptions.html +0 -122
- package/docs/interfaces/DetectSentimentParameters.html +0 -121
- package/docs/interfaces/EmailAttachment.html +0 -176
- package/docs/interfaces/EmailData.html +0 -188
- package/docs/interfaces/GetObjectOptions.html +0 -133
- package/docs/interfaces/HeadObjectOptions.html +0 -132
- package/docs/interfaces/InternalAPIRequestParams.html +0 -207
- package/docs/interfaces/ListObjectsOptions.html +0 -122
- package/docs/interfaces/PutObjectOptions.html +0 -173
- package/docs/interfaces/ResourceControllerOptions.html +0 -142
- package/docs/interfaces/SESParams.html +0 -152
- package/docs/interfaces/SNSCreateEndpointParams.html +0 -132
- package/docs/interfaces/SNSPublishParams.html +0 -142
- package/docs/interfaces/SignedURLOptions.html +0 -123
- package/docs/interfaces/TemplatedEmailData.html +0 -186
- package/docs/interfaces/TranslateParameters.html +0 -140
- package/docs/modules.html +0 -130
- package/docs/variables/LOG_LEVELS_PRIORITY.html +0 -81
- package/docs.style.css +0 -4
- package/src/attachments.ts +0 -41
- package/src/cognito.ts +0 -511
- package/src/comprehend.ts +0 -52
- package/src/dynamoDB.ts +0 -311
- package/src/genericController.ts +0 -103
- package/src/lambdaLogger.ts +0 -39
- package/src/metrics.ts +0 -45
- package/src/resourceController.ts +0 -645
- package/src/s3.ts +0 -334
- package/src/secretsManager.ts +0 -24
- package/src/ses.ts +0 -313
- package/src/sns.ts +0 -118
- package/src/ssm.ts +0 -33
- package/src/streamController.ts +0 -25
- package/src/translate.ts +0 -174
- package/tsconfig.json +0 -10
package/package.json
CHANGED
package/.prettierrc
DELETED
package/.vscode/settings.json
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// Place your settings in this file to overwrite the default settings
|
|
2
|
-
{
|
|
3
|
-
"editor.tabSize": 2,
|
|
4
|
-
"editor.rulers": [120],
|
|
5
|
-
"editor.wordWrapColumn": 120,
|
|
6
|
-
"editor.wordWrap": "bounded",
|
|
7
|
-
"files.eol": "\n",
|
|
8
|
-
"files.exclude": {
|
|
9
|
-
"**/.git": true,
|
|
10
|
-
"**/.svn": true,
|
|
11
|
-
"**/.hg": true,
|
|
12
|
-
"**/.DS_Store": true,
|
|
13
|
-
"**/*.map": true,
|
|
14
|
-
"node_modules": true,
|
|
15
|
-
"npm-debug.log": true,
|
|
16
|
-
"www": true,
|
|
17
|
-
".vs": true
|
|
18
|
-
},
|
|
19
|
-
"files.trimTrailingWhitespace": true,
|
|
20
|
-
"git.confirmSync": false,
|
|
21
|
-
"editor.renderLineHighlight": "all",
|
|
22
|
-
"workbench.iconTheme": "vs-seti",
|
|
23
|
-
"window.zoomLevel": 0,
|
|
24
|
-
"extensions.ignoreRecommendations": false,
|
|
25
|
-
"editor.guides.indentation": true
|
|
26
|
-
}
|
package/HOW-TO-RELEASE.md
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# Release a new version on npm
|
|
2
|
-
|
|
3
|
-
1. `npm run build` to compile Typescript, check for errors and update the docs.
|
|
4
|
-
1. Pull request of the branch with the changes (GitHub).
|
|
5
|
-
1. When the pull is confirmed and the code is merged, update the versions in the files (find and replace, e.g. 0.0.1 -> 0.0.2).
|
|
6
|
-
1. Commit the files changed in the previous point and commit them using the name of the version
|
|
7
|
-
as commit description (e.g. v0.0.2).
|
|
8
|
-
1. Release the new version on npm with `npm run publishPackage`.
|
package/build.sh
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# other parameters
|
|
4
|
-
SRC_FOLDER='./src'
|
|
5
|
-
C='\033[4;32m' # color
|
|
6
|
-
NC='\033[0m' # reset (no color)
|
|
7
|
-
|
|
8
|
-
# set the script to exit in case of errors
|
|
9
|
-
set -o errexit
|
|
10
|
-
|
|
11
|
-
# lint the code in search for errors
|
|
12
|
-
echo -e "${C}Linting...${NC}"
|
|
13
|
-
npm run lint ${SRC_FOLDER} 1>/dev/null
|
|
14
|
-
|
|
15
|
-
# compile the project's typescript code
|
|
16
|
-
echo -e "${C}Compiling...${NC}"
|
|
17
|
-
npm run compile 1>/dev/null
|
|
18
|
-
|
|
19
|
-
# generate documentation
|
|
20
|
-
echo -e "${C}Documenting...${NC}"
|
|
21
|
-
npm run docs 1>/dev/null
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { SignedURL } from 'idea-toolbox';
|
|
2
|
-
import { DynamoDB } from './dynamoDB';
|
|
3
|
-
import { S3 } from './s3';
|
|
4
|
-
/**
|
|
5
|
-
* A custom class that takes advantage of DynamoDB and S3 to easily manage attachments.
|
|
6
|
-
*/
|
|
7
|
-
export declare class Attachments {
|
|
8
|
-
protected ddb: DynamoDB;
|
|
9
|
-
protected s3: S3;
|
|
10
|
-
/**
|
|
11
|
-
* The bucket where from to retrieve the attachments. Fallback to IDEA's default one.
|
|
12
|
-
*/
|
|
13
|
-
protected S3_ATTACHMENTS_BUCKET: string;
|
|
14
|
-
/**
|
|
15
|
-
* The prefix for attachment IDs. Fallback to IDEA's default one.
|
|
16
|
-
*/
|
|
17
|
-
protected IUID_ATTACHMENTS_PREFIX: string;
|
|
18
|
-
constructor(ddb: DynamoDB, s3: S3);
|
|
19
|
-
/**
|
|
20
|
-
* Get a signedURL to put an attachment.
|
|
21
|
-
*/
|
|
22
|
-
put(project: string, teamId: string): Promise<SignedURL>;
|
|
23
|
-
/**
|
|
24
|
-
* Get a signedURL to retrieve an attachment.
|
|
25
|
-
*/
|
|
26
|
-
get(attachmentId: string): Promise<SignedURL>;
|
|
27
|
-
}
|
package/dist/src/attachments.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Attachments = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* A custom class that takes advantage of DynamoDB and S3 to easily manage attachments.
|
|
6
|
-
*/
|
|
7
|
-
class Attachments {
|
|
8
|
-
constructor(ddb, s3) {
|
|
9
|
-
this.ddb = ddb;
|
|
10
|
-
this.s3 = s3;
|
|
11
|
-
/**
|
|
12
|
-
* The bucket where from to retrieve the attachments. Fallback to IDEA's default one.
|
|
13
|
-
*/
|
|
14
|
-
this.S3_ATTACHMENTS_BUCKET = process.env.S3_ATTACHMENTS_BUCKET ?? 'idea-attachments';
|
|
15
|
-
/**
|
|
16
|
-
* The prefix for attachment IDs. Fallback to IDEA's default one.
|
|
17
|
-
*/
|
|
18
|
-
this.IUID_ATTACHMENTS_PREFIX = process.env.IUID_ATTACHMENTS_PREFIX ?? 'ATT';
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Get a signedURL to put an attachment.
|
|
22
|
-
*/
|
|
23
|
-
async put(project, teamId) {
|
|
24
|
-
const attachmentIdPrefix = this.IUID_ATTACHMENTS_PREFIX.concat('_', project, '_', teamId);
|
|
25
|
-
const attachmentId = await this.ddb.IUNID(attachmentIdPrefix);
|
|
26
|
-
const signedURL = await this.s3.signedURLPut(this.S3_ATTACHMENTS_BUCKET, attachmentId);
|
|
27
|
-
signedURL.id = attachmentId;
|
|
28
|
-
return signedURL;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Get a signedURL to retrieve an attachment.
|
|
32
|
-
*/
|
|
33
|
-
async get(attachmentId) {
|
|
34
|
-
const signedURL = await this.s3.signedURLGet(this.S3_ATTACHMENTS_BUCKET, attachmentId);
|
|
35
|
-
signedURL.id = attachmentId;
|
|
36
|
-
return signedURL;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
exports.Attachments = Attachments;
|
package/dist/src/cognito.d.ts
DELETED
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import * as CognitoIP from '@aws-sdk/client-cognito-identity-provider';
|
|
2
|
-
import { CognitoUser } from 'idea-toolbox';
|
|
3
|
-
/**
|
|
4
|
-
* A wrapper for AWS Cognito.
|
|
5
|
-
*/
|
|
6
|
-
export declare class Cognito {
|
|
7
|
-
protected cognito: CognitoIP.CognitoIdentityProviderClient;
|
|
8
|
-
constructor(options?: {
|
|
9
|
-
region?: string;
|
|
10
|
-
});
|
|
11
|
-
/**
|
|
12
|
-
* Change the region in which to find the user pool.
|
|
13
|
-
* Default: the runner's (e.g. Lambda function) region.
|
|
14
|
-
*/
|
|
15
|
-
setRegion(region: string): void;
|
|
16
|
-
/**
|
|
17
|
-
* Get the attributes of the user, from the authorizer claims.
|
|
18
|
-
* @param claims authorizer claims
|
|
19
|
-
* @return user's data
|
|
20
|
-
* @deprecated use idea-toolbox's CognitoUser instead
|
|
21
|
-
*/
|
|
22
|
-
getUserByClaims(claims: Record<string, any>): CognitoUserGeneric;
|
|
23
|
-
/**
|
|
24
|
-
* Map the complex structure returned by Cognito for a user's attributes in a simple key-value object.
|
|
25
|
-
*/
|
|
26
|
-
private mapCognitoUserAttributesAsPlainObject;
|
|
27
|
-
/**
|
|
28
|
-
* Identify a user by its email address, returning its attributes.
|
|
29
|
-
*/
|
|
30
|
-
getUserByEmail(email: string, userPoolId: string): Promise<CognitoUserGeneric>;
|
|
31
|
-
/**
|
|
32
|
-
* Identify a user by its userId (sub), returning its attributes.
|
|
33
|
-
*/
|
|
34
|
-
getUserBySub(sub: string, userPoolId: string): Promise<CognitoUserGeneric>;
|
|
35
|
-
/**
|
|
36
|
-
* List all the users of the pool.
|
|
37
|
-
*/
|
|
38
|
-
listUsers(userPoolId: string, options?: {
|
|
39
|
-
pagination?: string;
|
|
40
|
-
users: CognitoUser[];
|
|
41
|
-
}): Promise<CognitoUser[]>;
|
|
42
|
-
/**
|
|
43
|
-
* List all the users of the pool, including the information about the groups they're in.
|
|
44
|
-
* Note: it's slower than the alternative `getAllUsers`: use it only when needed.
|
|
45
|
-
*/
|
|
46
|
-
listUsersWithGroupsDetail(cognitoUserPoolId: string): Promise<CognitoUser[]>;
|
|
47
|
-
/**
|
|
48
|
-
* Create a new user (by its email) in the pool specified.
|
|
49
|
-
* @return userId of the new user
|
|
50
|
-
*/
|
|
51
|
-
createUser(cognitoUserOrEmail: CognitoUser | string, userPoolId: string, options?: CreateUserOptions): Promise<string>;
|
|
52
|
-
/**
|
|
53
|
-
* Resend the password to a user who never logged in.
|
|
54
|
-
*/
|
|
55
|
-
resendPassword(email: string, userPoolId: string, options?: CreateUserOptions): Promise<void>;
|
|
56
|
-
/**
|
|
57
|
-
* Set a new password for a specific user identified by its email (admin-only).
|
|
58
|
-
* If not specified, the password is generated randomly, and the user must change it at the first login.
|
|
59
|
-
*/
|
|
60
|
-
setPassword(email: string, userPoolId: string, options?: {
|
|
61
|
-
password?: string;
|
|
62
|
-
permanent?: boolean;
|
|
63
|
-
}): Promise<void>;
|
|
64
|
-
/**
|
|
65
|
-
* Delete a user by its email (username), in the pool specified.
|
|
66
|
-
*/
|
|
67
|
-
deleteUser(email: string, userPoolId: string): Promise<void>;
|
|
68
|
-
/**
|
|
69
|
-
* Sign in a user of a specific pool through username and password.
|
|
70
|
-
*/
|
|
71
|
-
signIn(email: string, password: string, userPoolId: string, userPoolClientId: string): Promise<CognitoIP.AuthenticationResultType>;
|
|
72
|
-
/**
|
|
73
|
-
* Given a username and a refresh token (and pool data), refresh the session and return the new tokens.
|
|
74
|
-
*/
|
|
75
|
-
refreshSession(email: string, refreshToken: string, userPoolId: string, userPoolClientId: string): Promise<CognitoIP.AuthenticationResultType>;
|
|
76
|
-
/**
|
|
77
|
-
* Change the email address (== username) associated to a user.
|
|
78
|
-
*/
|
|
79
|
-
updateEmail(email: string, newEmail: string, userPoolId: string): Promise<void>;
|
|
80
|
-
/**
|
|
81
|
-
* Change the password to sign in for a user.
|
|
82
|
-
*/
|
|
83
|
-
updatePassword(email: string, oldPassword: string, newPassword: string, userPoolId: string, userPoolClientId: string): Promise<void>;
|
|
84
|
-
/**
|
|
85
|
-
* Send to a user the instructions to change the password.
|
|
86
|
-
*/
|
|
87
|
-
forgotPassword(email: string, userPoolClientId: string): Promise<CognitoIP.CodeDeliveryDetailsType>;
|
|
88
|
-
/**
|
|
89
|
-
* Complete the flow of a password forgot.
|
|
90
|
-
*/
|
|
91
|
-
confirmForgotPassword(email: string, newPassword: string, confirmationCode: string, userPoolClientId: string): Promise<void>;
|
|
92
|
-
/**
|
|
93
|
-
* Update a (Cognito)User's attributes, excluding the attributes that require specific methods.
|
|
94
|
-
*/
|
|
95
|
-
updateUser(user: CognitoUser, userPoolId: string): Promise<void>;
|
|
96
|
-
/**
|
|
97
|
-
* Sign out the user from all devices.
|
|
98
|
-
*/
|
|
99
|
-
globalSignOut(email: string, userPoolId: string): Promise<void>;
|
|
100
|
-
/**
|
|
101
|
-
* Confirm and conclude a registration, usign a confirmation code.
|
|
102
|
-
*/
|
|
103
|
-
confirmSignUp(email: string, confirmationCode: string, userPoolClientId: string): Promise<void>;
|
|
104
|
-
/**
|
|
105
|
-
* List the groups of the user pool.
|
|
106
|
-
*/
|
|
107
|
-
listGroups(userPoolId: string, options?: {
|
|
108
|
-
pagination?: string;
|
|
109
|
-
groups: CognitoGroup[];
|
|
110
|
-
}): Promise<CognitoGroup[]>;
|
|
111
|
-
/**
|
|
112
|
-
* Create a new group in the user pool.
|
|
113
|
-
*/
|
|
114
|
-
createGroup(groupName: string, userPoolId: string): Promise<void>;
|
|
115
|
-
/**
|
|
116
|
-
* Delete a group from the user pool.
|
|
117
|
-
*/
|
|
118
|
-
deleteGroup(groupName: string, userPoolId: string): Promise<void>;
|
|
119
|
-
/**
|
|
120
|
-
* List the users part of a group in the user pool.
|
|
121
|
-
*/
|
|
122
|
-
listUsersInGroup(group: string, userPoolId: string, options?: {
|
|
123
|
-
pagination?: string;
|
|
124
|
-
users: CognitoUser[];
|
|
125
|
-
}): Promise<CognitoUser[]>;
|
|
126
|
-
/**
|
|
127
|
-
* Add a user (by email) to a group in the user pool.
|
|
128
|
-
*/
|
|
129
|
-
addUserToGroup(email: string, group: string, userPoolId: string): Promise<void>;
|
|
130
|
-
/**
|
|
131
|
-
* Remove a user (by email) from a group in the user pool.
|
|
132
|
-
*/
|
|
133
|
-
removeUserFromGroup(email: string, group: string, userPoolId: string): Promise<void>;
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* The attributes of a generic Cognito user of which we don't know the custom attributes.
|
|
137
|
-
*/
|
|
138
|
-
export interface CognitoUserGeneric {
|
|
139
|
-
/**
|
|
140
|
-
* The user id (sub).
|
|
141
|
-
*/
|
|
142
|
-
userId: string;
|
|
143
|
-
/**
|
|
144
|
-
* The email (=== username).
|
|
145
|
-
*/
|
|
146
|
-
email: string;
|
|
147
|
-
/**
|
|
148
|
-
* Cognito can have custom attributes.
|
|
149
|
-
*/
|
|
150
|
-
[attribute: string]: string;
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Options when creating a new user.
|
|
154
|
-
*/
|
|
155
|
-
export interface CreateUserOptions {
|
|
156
|
-
/**
|
|
157
|
-
* Uf true, don't send the default Cognito email notification
|
|
158
|
-
*/
|
|
159
|
-
skipNotification?: boolean;
|
|
160
|
-
/**
|
|
161
|
-
* If null, randomly generated
|
|
162
|
-
*/
|
|
163
|
-
temporaryPassword?: string;
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* The attributes of a Cognito group.
|
|
167
|
-
*/
|
|
168
|
-
export interface CognitoGroup {
|
|
169
|
-
/**
|
|
170
|
-
* The name (and id) of the group.
|
|
171
|
-
*/
|
|
172
|
-
name: string;
|
|
173
|
-
/**
|
|
174
|
-
* The description of the group.
|
|
175
|
-
*/
|
|
176
|
-
description: string;
|
|
177
|
-
}
|