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.
Files changed (100) hide show
  1. package/package.json +1 -1
  2. package/.prettierrc +0 -9
  3. package/.vscode/settings.json +0 -26
  4. package/HOW-TO-RELEASE.md +0 -8
  5. package/build.sh +0 -21
  6. package/dist/src/attachments.d.ts +0 -27
  7. package/dist/src/attachments.js +0 -39
  8. package/dist/src/cognito.d.ts +0 -177
  9. package/dist/src/cognito.js +0 -412
  10. package/dist/src/comprehend.d.ts +0 -34
  11. package/dist/src/comprehend.js +0 -58
  12. package/dist/src/dynamoDB.d.ts +0 -108
  13. package/dist/src/dynamoDB.js +0 -296
  14. package/dist/src/genericController.d.ts +0 -60
  15. package/dist/src/genericController.js +0 -89
  16. package/dist/src/lambdaLogger.d.ts +0 -13
  17. package/dist/src/lambdaLogger.js +0 -43
  18. package/dist/src/metrics.d.ts +0 -31
  19. package/dist/src/metrics.js +0 -45
  20. package/dist/src/resourceController.d.ts +0 -232
  21. package/dist/src/resourceController.js +0 -561
  22. package/dist/src/s3.d.ts +0 -225
  23. package/dist/src/s3.js +0 -180
  24. package/dist/src/secretsManager.d.ts +0 -15
  25. package/dist/src/secretsManager.js +0 -48
  26. package/dist/src/ses.d.ts +0 -161
  27. package/dist/src/ses.js +0 -196
  28. package/dist/src/sns.d.ts +0 -60
  29. package/dist/src/sns.js +0 -94
  30. package/dist/src/ssm.d.ts +0 -22
  31. package/dist/src/ssm.js +0 -54
  32. package/dist/src/streamController.d.ts +0 -11
  33. package/dist/src/streamController.js +0 -20
  34. package/dist/src/translate.d.ts +0 -61
  35. package/dist/src/translate.js +0 -155
  36. package/docs/.nojekyll +0 -1
  37. package/docs/assets/custom.css +0 -4
  38. package/docs/assets/highlight.css +0 -50
  39. package/docs/assets/main.js +0 -58
  40. package/docs/assets/search.js +0 -1
  41. package/docs/assets/style.css +0 -1367
  42. package/docs/classes/Attachments.html +0 -201
  43. package/docs/classes/Cognito.html +0 -713
  44. package/docs/classes/Comprehend.html +0 -176
  45. package/docs/classes/DynamoDB.html +0 -584
  46. package/docs/classes/GenericController.html +0 -262
  47. package/docs/classes/HandledError.html +0 -219
  48. package/docs/classes/LambdaLogger.html +0 -220
  49. package/docs/classes/ResourceController.html +0 -957
  50. package/docs/classes/S3.html +0 -391
  51. package/docs/classes/SES.html +0 -335
  52. package/docs/classes/SNS.html +0 -185
  53. package/docs/classes/SecretsManager.html +0 -159
  54. package/docs/classes/StreamController.html +0 -284
  55. package/docs/classes/SystemsManager.html +0 -184
  56. package/docs/classes/Translate.html +0 -239
  57. package/docs/classes/UnhandledError.html +0 -252
  58. package/docs/functions/cleanFilename.html +0 -93
  59. package/docs/index.html +0 -95
  60. package/docs/interfaces/BasicEmailData.html +0 -145
  61. package/docs/interfaces/CognitoGroup.html +0 -122
  62. package/docs/interfaces/CognitoUserGeneric.html +0 -125
  63. package/docs/interfaces/CopyObjectOptions.html +0 -132
  64. package/docs/interfaces/CreateDownloadURLFromDataOptions.html +0 -163
  65. package/docs/interfaces/CreateUserOptions.html +0 -122
  66. package/docs/interfaces/DeleteObjectOptions.html +0 -122
  67. package/docs/interfaces/DetectSentimentParameters.html +0 -121
  68. package/docs/interfaces/EmailAttachment.html +0 -176
  69. package/docs/interfaces/EmailData.html +0 -188
  70. package/docs/interfaces/GetObjectOptions.html +0 -133
  71. package/docs/interfaces/HeadObjectOptions.html +0 -132
  72. package/docs/interfaces/InternalAPIRequestParams.html +0 -207
  73. package/docs/interfaces/ListObjectsOptions.html +0 -122
  74. package/docs/interfaces/PutObjectOptions.html +0 -173
  75. package/docs/interfaces/ResourceControllerOptions.html +0 -142
  76. package/docs/interfaces/SESParams.html +0 -152
  77. package/docs/interfaces/SNSCreateEndpointParams.html +0 -132
  78. package/docs/interfaces/SNSPublishParams.html +0 -142
  79. package/docs/interfaces/SignedURLOptions.html +0 -123
  80. package/docs/interfaces/TemplatedEmailData.html +0 -186
  81. package/docs/interfaces/TranslateParameters.html +0 -140
  82. package/docs/modules.html +0 -130
  83. package/docs/variables/LOG_LEVELS_PRIORITY.html +0 -81
  84. package/docs.style.css +0 -4
  85. package/src/attachments.ts +0 -41
  86. package/src/cognito.ts +0 -511
  87. package/src/comprehend.ts +0 -52
  88. package/src/dynamoDB.ts +0 -311
  89. package/src/genericController.ts +0 -103
  90. package/src/lambdaLogger.ts +0 -39
  91. package/src/metrics.ts +0 -45
  92. package/src/resourceController.ts +0 -645
  93. package/src/s3.ts +0 -334
  94. package/src/secretsManager.ts +0 -24
  95. package/src/ses.ts +0 -313
  96. package/src/sns.ts +0 -118
  97. package/src/ssm.ts +0 -33
  98. package/src/streamController.ts +0 -25
  99. package/src/translate.ts +0 -174
  100. package/tsconfig.json +0 -10
@@ -1,232 +0,0 @@
1
- import { Tracer } from '@aws-lambda-powertools/tracer';
2
- import { APIGatewayProxyEventV2, APIGatewayProxyEvent, Callback } from 'aws-lambda';
3
- import { CognitoUser, Auth0User } from 'idea-toolbox';
4
- import { CloudWatchMetrics } from './metrics';
5
- import { GenericController } from './genericController';
6
- /**
7
- * An abstract class to inherit to manage API requests (AWS API Gateway) in an AWS Lambda function.
8
- */
9
- export declare abstract class ResourceController extends GenericController {
10
- protected event: APIGatewayProxyEventV2 | APIGatewayProxyEvent;
11
- protected callback: Callback;
12
- protected initError: boolean;
13
- protected authorization: string;
14
- protected claims: any;
15
- protected principalId: string;
16
- protected cognitoUser: CognitoUser;
17
- protected auth0User: Auth0User;
18
- protected project: string;
19
- protected stage: string;
20
- protected httpMethod: string;
21
- protected body: any;
22
- protected queryParams: any;
23
- protected resourcePath: string;
24
- protected path: string;
25
- protected pathParameters: any;
26
- protected resource: string;
27
- protected resourceId: string;
28
- protected clientVersion: string;
29
- protected clientPlatform: string;
30
- protected clientBundle: string;
31
- protected returnStatusCode?: number;
32
- protected logRequestsWithKey: string;
33
- protected metrics: CloudWatchMetrics;
34
- protected tracer: Tracer;
35
- protected currentLang: string;
36
- protected defaultLang: string;
37
- protected translations: any;
38
- protected templateMatcher: RegExp;
39
- constructor(event: APIGatewayProxyEventV2 | APIGatewayProxyEvent, callback: Callback, options?: ResourceControllerOptions);
40
- private initFromEventV2;
41
- private initFromEventV1;
42
- protected getEventSummary(): Record<string, any>;
43
- /**
44
- * Force the parsing of a query parameter as an array of strings.
45
- */
46
- protected getQueryParamAsArray(paramName: string): string[];
47
- handleRequest: () => Promise<void>;
48
- protected done(error?: Error | any, rawResult?: any, statusCode?: number): void;
49
- /**
50
- * To @override
51
- */
52
- protected checkAuthBeforeRequest(): Promise<void>;
53
- /**
54
- * To @override
55
- */
56
- protected getResource(): Promise<any>;
57
- /**
58
- * To @override
59
- */
60
- protected postResource(): Promise<any>;
61
- /**
62
- * To @override
63
- */
64
- protected putResource(): Promise<any>;
65
- /**
66
- * To @override
67
- */
68
- protected deleteResource(): Promise<any>;
69
- /**
70
- * To @override
71
- */
72
- protected headResource(): Promise<any>;
73
- /**
74
- * To @override
75
- */
76
- protected getResources(): Promise<any>;
77
- /**
78
- * To @override
79
- */
80
- protected postResources(): Promise<any>;
81
- /**
82
- * To @override
83
- */
84
- protected putResources(): Promise<any>;
85
- /**
86
- * To @override
87
- */
88
- protected patchResource(): Promise<any>;
89
- /**
90
- * To @override
91
- */
92
- protected patchResources(): Promise<any>;
93
- /**
94
- * To @override
95
- */
96
- protected deleteResources(): Promise<any>;
97
- /**
98
- * To @override
99
- */
100
- protected headResources(): Promise<any>;
101
- /**
102
- * Store the log associated to the request (no response/error handling).
103
- */
104
- protected storeLog(succeeded: boolean): Promise<void>;
105
- /**
106
- * Check whether shared resource exists in the back-end (translation, template, etc.).
107
- * Search for the specified file path in both the Lambda function's main folder and the layers folder.
108
- */
109
- protected sharedResourceExists(filePath: string): boolean;
110
- /**
111
- * Load a shared resource in the back-end (translation, template, etc.).
112
- * Search for the specified file path in both the Lambda function's main folder and the layers folder.
113
- */
114
- protected loadSharedResource(filePath: string): string;
115
- /**
116
- * Prepare the CloudWatch metrics at the beginning of a request.
117
- */
118
- protected prepareMetrics(): void;
119
- /**
120
- * Publish the CloudWatch metrics (default and custom-defined) at the end of a reqeust.
121
- */
122
- protected publishMetrics(statusCode: number, error?: any): void;
123
- /**
124
- * Simulate an internal API request, invoking directly the lambda and therefore saving resources.
125
- * @return the body of the response
126
- * @deprecated don't run a Lambda from another Lambda (bad practice)
127
- */
128
- invokeInternalAPIRequest(params: InternalAPIRequestParams): Promise<any>;
129
- private invokeInternalAPIRequestWithLambda;
130
- private invokeInternalAPIRequestWithEventBridge;
131
- private mapEventForInternalApiRequest;
132
- /**
133
- * Whether the current request comes from an internal API request, i.e. it was invoked by another controller.
134
- * @deprecated don't run a Lambda from another Lambda (bad practice)
135
- */
136
- comesFromInternalRequest(): boolean;
137
- /**
138
- * Load the translations from the shared resources and set them with a fallback language.
139
- */
140
- loadTranslations(lang: string, defLang?: string): void;
141
- /**
142
- * Get a translated term by key, optionally interpolating variables (e.g. `{{user}}`).
143
- * If the term doesn't exist in the current language, it is searched in the default language.
144
- */
145
- t(key: string, interpolateParams?: any): string;
146
- /**
147
- * Interpolates a string to replace parameters.
148
- * `"This is a {{ key }}"` ==> `"This is a value", with params = { key: "value" }`.
149
- */
150
- private interpolate;
151
- /**
152
- * Gets a value from an object by composed key.
153
- * `getValue({ key1: { keyA: 'valueI' }}, 'key1.keyA')` ==> `'valueI'`.
154
- */
155
- private getValue;
156
- /**
157
- * Helper to quicly check if the value is defined.
158
- */
159
- private isDefined;
160
- }
161
- /**
162
- * The initial options for a constructor of class ResourceController.
163
- */
164
- export interface ResourceControllerOptions {
165
- /**
166
- * The resourceId of the API request, to specify if different from "proxy".
167
- */
168
- resourceId?: string;
169
- /**
170
- * If set, the logs of the API requests on this resource will be stored (using this key).
171
- */
172
- logRequestsWithKey?: string;
173
- /**
174
- * Whether to automatically store usage metrics on CloudWatch.
175
- */
176
- useMetrics?: boolean;
177
- /**
178
- * The instance of the tracer to use in case of advanced monitoring.
179
- */
180
- tracer?: Tracer;
181
- }
182
- /**
183
- * The parameters needed to invoke an internal API request.
184
- * @deprecated don't run a Lambda from another Lambda (bad practice).
185
- */
186
- export interface InternalAPIRequestParams {
187
- /**
188
- * The name of the Lambda function receiving the request; e.g. `project_memberships`.
189
- * Note: the invocation is always syncronous.
190
- * Either this attribute or `eventBus` must be set.
191
- */
192
- lambda?: string;
193
- /**
194
- * The EventBridge destination of the request.
195
- * If the bus name or ARN isn't specified, the default one is used.
196
- * The `target` maps into the `DetailType` of the event.
197
- * Note: the invocation is always asyncronous.
198
- * Either this attribute or `lambda` must be set.
199
- */
200
- eventBridge?: {
201
- bus?: string;
202
- target?: string;
203
- };
204
- /**
205
- * The alias of the lambda function to invoke. Default: the value of the current API stage.
206
- */
207
- stage?: string;
208
- /**
209
- * The http method to use.
210
- */
211
- httpMethod: string;
212
- /**
213
- * The path (in the internal API) to the resource we need; e.g. `teams/{teamId}/memberships/{userId}`.
214
- */
215
- resource: string;
216
- /**
217
- * The parameters to substitute in the path.
218
- */
219
- pathParams?: {
220
- [index: string]: string | number;
221
- };
222
- /**
223
- * The parameters to substitute in the path.
224
- */
225
- queryParams?: {
226
- [index: string]: string | number;
227
- };
228
- /**
229
- * The body of the request.
230
- */
231
- body?: any;
232
- }