idea-aws 4.4.10 → 4.4.12

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.
@@ -25,7 +25,7 @@ export interface DetectSentimentParameters {
25
25
  * All contents must be in the same language. Required.
26
26
  * Valid Values: en | es | fr | de | it | pt | ar | hi | ja | ko | zh | zh-TW
27
27
  */
28
- language: string;
28
+ language: AmazonComprehend.LanguageCode | string;
29
29
  /**
30
30
  * The text to analyze. Required.
31
31
  * A UTF-8 text string. Each string must contain fewer that 5,000 bytes of UTF-8 encoded characters.
@@ -38,7 +38,10 @@ class Comprehend {
38
38
  async detectSentiment(params) {
39
39
  if (!params.language || !params.text)
40
40
  throw new Error('Missing some parameters');
41
- const command = new AmazonComprehend.DetectSentimentCommand({ LanguageCode: params.language, Text: params.text });
41
+ const command = new AmazonComprehend.DetectSentimentCommand({
42
+ LanguageCode: params.language,
43
+ Text: params.text
44
+ });
42
45
  const { Sentiment } = await this.client.send(command);
43
46
  return Sentiment;
44
47
  }
@@ -10,8 +10,8 @@ export declare class DynamoDB {
10
10
  constructor();
11
11
  /**
12
12
  * Convert a JSON object from DynamoDB format to simple JSON.
13
- * @data the data in DynamoDB's original format to convert in plain objects
14
- * @options the options to use to convert the data
13
+ * @param data the data in DynamoDB's original format to convert in plain objects
14
+ * @param options the options to use to convert the data
15
15
  */
16
16
  unmarshall(data: Record<string, any>, options?: DDBUtils.unmarshallOptions): Record<string, any>;
17
17
  /**
@@ -42,8 +42,8 @@ class DynamoDB {
42
42
  }
43
43
  /**
44
44
  * Convert a JSON object from DynamoDB format to simple JSON.
45
- * @data the data in DynamoDB's original format to convert in plain objects
46
- * @options the options to use to convert the data
45
+ * @param data the data in DynamoDB's original format to convert in plain objects
46
+ * @param options the options to use to convert the data
47
47
  */
48
48
  unmarshall(data, options) {
49
49
  return DDBUtils.unmarshall(data, options);
@@ -3,7 +3,7 @@
3
3
  * Note: the log level is controlled by each Lambda function's configuration.
4
4
  */
5
5
  export declare class LambdaLogger {
6
- shouldLog: (logLevel: 'TRACE' | 'DEBUG' | 'INFO' | 'WARN' | 'ERROR' | 'FATAL') => boolean;
6
+ shouldLog: (logLevel: "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR" | "FATAL") => boolean;
7
7
  trace: (summary: string, content?: object) => void;
8
8
  debug: (summary: string, content?: object) => void;
9
9
  info: (summary: string, content?: object) => void;
@@ -46,6 +46,10 @@ export declare abstract class ResourceController extends GenericController {
46
46
  * Force the parsing of a query parameter as an array of strings.
47
47
  */
48
48
  protected getQueryParamAsArray(paramName: string): string[];
49
+ /**
50
+ * Force the parsing of a query parameter as a boolean.
51
+ */
52
+ protected getQueryParamAsBoolean(paramName: string): boolean;
49
53
  handleRequest: () => Promise<void>;
50
54
  protected done(error?: Error | any, rawResult?: any, statusCode?: number): void;
51
55
  /**
@@ -227,6 +227,12 @@ class ResourceController extends genericController_1.GenericController {
227
227
  else
228
228
  return String(this.queryParams[paramName]).split(',');
229
229
  }
230
+ /**
231
+ * Force the parsing of a query parameter as a boolean.
232
+ */
233
+ getQueryParamAsBoolean(paramName) {
234
+ return this.queryParams[paramName] && this.queryParams[paramName].toLowerCase() !== 'false';
235
+ }
230
236
  done(error, rawResult, statusCode = this.returnStatusCode ?? (error ? 400 : 200)) {
231
237
  const result = error ? { message: error.message } : rawResult ?? {};
232
238
  const responseTrace = { result: Array.isArray(result) ? { array: result.length } : result };
package/dist/src/s3.d.ts CHANGED
@@ -182,7 +182,7 @@ export interface PutObjectOptions {
182
182
  /**
183
183
  * Access-control list (e.g. public-read).
184
184
  */
185
- acl?: string;
185
+ acl?: AWSS3.ObjectCannedACL | string;
186
186
  /**
187
187
  * A set of metadata as attributes
188
188
  */
package/dist/src/s3.js CHANGED
@@ -153,7 +153,7 @@ class S3 {
153
153
  */
154
154
  async listObjectsKeys(options) {
155
155
  const result = await this.listObjects(options);
156
- return result.Contents.map(obj => obj.Key);
156
+ return result.Contents ? result.Contents.map(obj => obj.Key) : [];
157
157
  }
158
158
  /**
159
159
  * Check whether an object exists in an S3 bucket.
package/dist/src/ses.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import * as AWSSES from '@aws-sdk/client-sesv2';
3
2
  import { SentMessageInfo as NodemailerSentMessageInfo } from 'nodemailer';
4
3
  import { Headers } from 'nodemailer/lib/mailer';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "idea-aws",
3
- "version": "4.4.10",
3
+ "version": "4.4.12",
4
4
  "description": "AWS wrappers to use in IDEA's back-ends",
5
5
  "license": "MPL-2.0",
6
6
  "main": "dist/index.js",
@@ -37,40 +37,40 @@
37
37
  },
38
38
  "homepage": "https://iter-idea.github.io/IDEA-AWS",
39
39
  "dependencies": {
40
- "@aws-lambda-powertools/metrics": "^1.17.0",
41
- "@aws-lambda-powertools/tracer": "^1.18.0",
42
- "idea-toolbox": "^7.0.6",
40
+ "@aws-lambda-powertools/metrics": "^1.18.1",
41
+ "@aws-lambda-powertools/tracer": "^1.18.1",
42
+ "idea-toolbox": "^7.0.8",
43
43
  "nanoid": "^3.3.7",
44
- "nodemailer": "^6.9.8",
44
+ "nodemailer": "^6.9.14",
45
45
  "source-map-support": "^0.5.21"
46
46
  },
47
47
  "peerDependencies": {
48
- "@aws-sdk/client-cognito-identity-provider": "^3.388.0",
49
- "@aws-sdk/client-comprehend": "^3.388.0",
50
- "@aws-sdk/client-dynamodb": "^3.388.0",
51
- "@aws-sdk/client-eventbridge": "^3.388.0",
52
- "@aws-sdk/client-lambda": "^3.388.0",
53
- "@aws-sdk/client-s3": "^3.388.0",
54
- "@aws-sdk/client-secrets-manager": "^3.389.0",
55
- "@aws-sdk/client-ses": "^3.398.0",
56
- "@aws-sdk/client-sesv2": "^3.388.0",
57
- "@aws-sdk/client-sns": "^3.388.0",
58
- "@aws-sdk/client-ssm": "^3.419.0",
59
- "@aws-sdk/client-translate": "^3.388.0",
60
- "@aws-sdk/lib-dynamodb": "^3.388.0",
61
- "@aws-sdk/lib-storage": "^3.388.0",
62
- "@aws-sdk/s3-request-presigner": "^3.388.0",
63
- "@aws-sdk/util-dynamodb": "^3.388.0"
48
+ "@aws-sdk/client-cognito-identity-provider": "^3.616.0",
49
+ "@aws-sdk/client-comprehend": "^3.616.0",
50
+ "@aws-sdk/client-dynamodb": "^3.616.0",
51
+ "@aws-sdk/client-eventbridge": "^3.616.0",
52
+ "@aws-sdk/client-lambda": "^3.616.0",
53
+ "@aws-sdk/client-s3": "^3.614.0",
54
+ "@aws-sdk/client-secrets-manager": "^3.616.0",
55
+ "@aws-sdk/client-ses": "^3.616.0",
56
+ "@aws-sdk/client-sesv2": "^3.616.0",
57
+ "@aws-sdk/client-sns": "^3.616.0",
58
+ "@aws-sdk/client-ssm": "^3.616.0",
59
+ "@aws-sdk/client-translate": "^3.616.0",
60
+ "@aws-sdk/lib-dynamodb": "^3.616.0",
61
+ "@aws-sdk/lib-storage": "^3.616.0",
62
+ "@aws-sdk/s3-request-presigner": "^3.616.0",
63
+ "@aws-sdk/util-dynamodb": "^3.616.0"
64
64
  },
65
65
  "devDependencies": {
66
- "@tsconfig/node18": "^18.2.0",
67
- "@types/aws-lambda": "^8.10.131",
68
- "@types/node": "^18.17.4",
69
- "@types/nodemailer": "^6.4.14",
70
- "@typescript-eslint/eslint-plugin": "^5.47.0",
71
- "@typescript-eslint/parser": "^5.47.0",
72
- "eslint": "^8.46.0",
73
- "typedoc": "^0.24.8",
74
- "typescript": "^5.1.6"
66
+ "@tsconfig/node20": "^20.1.4",
67
+ "@types/aws-lambda": "^8.10.141",
68
+ "@types/node": "^20.14.11",
69
+ "@types/nodemailer": "^6.4.15",
70
+ "@typescript-eslint/eslint-plugin": "^7.16.1",
71
+ "@typescript-eslint/parser": "^7.16.1",
72
+ "eslint": "^8.57.0",
73
+ "typedoc": "^0.26.5",
74
+ "typescript": "^5.5.2"
75
75
  }
76
76
  }