express-sweet 1.0.28 → 1.0.29

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "express-sweet",
3
- "version": "1.0.28",
3
+ "version": "1.0.29",
4
4
  "description": "Express framework extension.",
5
5
  "main": "dist/build.common.js",
6
6
  "module": "dist/build.esm.js",
@@ -66,7 +66,9 @@
66
66
  "homepage": "https://github.com/takuya-motoshima/express-sweet#readme",
67
67
  "dependencies": {
68
68
  "@aws-sdk/client-rekognition": "^3.352.0",
69
+ "@aws-sdk/client-ses": "^3.354.0",
69
70
  "@aws-sdk/node-http-handler": "^3.350.0",
71
+ "@types/libmime": "^5.0.0",
70
72
  "body-parser": "^1.19.0",
71
73
  "class-transformer": "^0.2.3",
72
74
  "class-validator": "^0.12.2",
@@ -81,9 +83,11 @@
81
83
  "express-session": "^1.17.1",
82
84
  "fs-extra": "^9.0.1",
83
85
  "glob": "^7.1.6",
86
+ "handlebars-extd": "^1.0.7",
84
87
  "hbs": "~4.0.4",
85
88
  "http-errors": "~1.6.3",
86
89
  "ioredis": "^4.27.6",
90
+ "libmime": "^5.2.1",
87
91
  "mariadb": "^2.4.0",
88
92
  "mime-types": "^2.1.27",
89
93
  "module-alias": "^2.2.2",
@@ -99,6 +103,7 @@
99
103
  },
100
104
  "devDependencies": {
101
105
  "@aws-sdk/types": "^3.347.0",
106
+ "@rollup/plugin-alias": "^5.0.0",
102
107
  "@types/connect-redis": "^0.0.18",
103
108
  "@types/cookie-parser": "^1.4.2",
104
109
  "@types/debug": "^4.1.5",
@@ -0,0 +1,27 @@
1
+ /**
2
+ * AWS SES Client Optional Interface.
3
+ */
4
+ export default interface {
5
+ /**
6
+ * API version in YYYYY-MM-DD format (or date).
7
+ * Specify 'latest' to use the latest possible version.
8
+ * The default is 'latest'.
9
+ * @type {string}
10
+ */
11
+ apiVersion: string;
12
+ /**
13
+ * The region to send service requests to.
14
+ * @type {string}
15
+ */
16
+ region: string;
17
+ /**
18
+ * Your AWS access key ID.
19
+ * @type {string}
20
+ */
21
+ accessKeyId: string;
22
+ /**
23
+ * Your AWS secret access key.
24
+ * @type {string}
25
+ */
26
+ secretAccessKey: string;
27
+ }
@@ -4,5 +4,6 @@ import DatabaseOptions from './DatabaseOptions';
4
4
  import FaceMatch from './FaceMatch';
5
5
  import BoundingBox from './BoundingBox';
6
6
  import RekognitionOptions from './RekognitionOptions';
7
+ import SesOptions from './SesOptions';
7
8
  import ViewOptions from './ViewOptions';
8
- export { AuthenticationOptions, Config, DatabaseOptions, FaceMatch, BoundingBox, RekognitionOptions, ViewOptions };
9
+ export { AuthenticationOptions, Config, DatabaseOptions, FaceMatch, BoundingBox, RekognitionOptions, SesOptions, ViewOptions };
@@ -5,22 +5,9 @@ import express from 'express';
5
5
  * If that access is asynchronous, a 403 error is returned.
6
6
  */
7
7
  export default class {
8
+ #private;
8
9
  /**
9
10
  * Mount on application.
10
11
  */
11
12
  static mount(app: express.Express): void;
12
- /**
13
- * Returns the option.
14
- *
15
- * @return {AuthenticationOptions} option.
16
- */
17
- private static loadOptions;
18
- /**
19
- * Check if the request URL does not require authentication.
20
- *
21
- * @param {express.Request} req The req object represents the HTTP request and has properties for the request query string, parameters, body, HTTP headers, and so on.
22
- * @param {(string|RegExp)[]} allowUrls A list of URLs that do not require authentication.
23
- * @returns {boolean} Return true if the request URL does not require authentication.
24
- */
25
- private static isNotRequireAuthentication;
26
13
  }
@@ -3,14 +3,9 @@ import express from 'express';
3
3
  * Enables the CORS.
4
4
  */
5
5
  export default class {
6
+ #private;
6
7
  /**
7
8
  * Mount on application.
8
9
  */
9
10
  static mount(app: express.Express): void;
10
- /**
11
- * Returns the option.
12
- *
13
- * @return {Config} option.
14
- */
15
- private static loadOptions;
16
11
  }
@@ -4,14 +4,9 @@
4
4
  * Read the environment variable file in options.path and set it in "process.env".
5
5
  */
6
6
  export default class {
7
+ #private;
7
8
  /**
8
9
  * Mount on application.
9
10
  */
10
11
  static mount(): void;
11
- /**
12
- * Returns the option.
13
- *
14
- * @return {Config} option.
15
- */
16
- private static loadOptions;
17
12
  }
@@ -3,14 +3,9 @@ import express from 'express';
3
3
  * Error handling.
4
4
  */
5
5
  export default class {
6
+ #private;
6
7
  /**
7
8
  * Mount on application.
8
9
  */
9
10
  static mount(app: express.Express): void;
10
- /**
11
- * Returns the option.
12
- *
13
- * @return {Config} option.
14
- */
15
- private static loadOptions;
16
11
  }
@@ -3,14 +3,9 @@ import express from 'express';
3
3
  * Defines all the requisites in HTTP.
4
4
  */
5
5
  export default class {
6
+ #private;
6
7
  /**
7
8
  * Mount on application.
8
9
  */
9
10
  static mount(app: express.Express): void;
10
- /**
11
- * Returns the option.
12
- *
13
- * @return {Config} option.
14
- */
15
- private static loadOptions;
16
11
  }
@@ -7,14 +7,9 @@ import express from 'express';
7
7
  * baseUrl: The base URL for this application.
8
8
  */
9
9
  export default class {
10
+ #private;
10
11
  /**
11
12
  * Mount on application.
12
13
  */
13
14
  static mount(app: express.Express): void;
14
- /**
15
- * Returns the option.
16
- *
17
- * @return {Config} option.
18
- */
19
- private static loadOptions;
20
15
  }
@@ -3,14 +3,9 @@ import express from 'express';
3
3
  * Enable Handlebars template engine.
4
4
  */
5
5
  export default class {
6
+ #private;
6
7
  /**
7
8
  * Mount on application.
8
9
  */
9
10
  static mount(app: express.Express): void;
10
- /**
11
- * Returns the option.
12
- *
13
- * @return {ViewOptions} option.
14
- */
15
- private static loadOptions;
16
11
  }
@@ -6,14 +6,9 @@ import express from 'express';
6
6
  * For example, if you have "routes/api/users.js", you can request the method in "user.js (ts)" with the base URL as "https:////api/users".
7
7
  */
8
8
  export default class {
9
+ #private;
9
10
  /**
10
11
  * Mount on application.
11
12
  */
12
13
  static mount(app: express.Express): void;
13
- /**
14
- * Returns the option.
15
- *
16
- * @return {Config} option.
17
- */
18
- private static loadOptions;
19
14
  }
@@ -7,11 +7,7 @@ import IndexFaceDetails from '~/interfaces/IndexFaceDetails';
7
7
  * AWS Rekognition Client.
8
8
  */
9
9
  export default class {
10
- /**
11
- * Rekognition Client.
12
- * @type {RekognitionClient}
13
- */
14
- private client;
10
+ #private;
15
11
  /**
16
12
  * Constructs a rekognition client object.
17
13
  */
@@ -119,11 +115,4 @@ export default class {
119
115
  * @return {Promise<boolean>} True on success.
120
116
  */
121
117
  deleteCollection(collectionId: string): Promise<boolean>;
122
- /**
123
- * Returns a buffer of images.
124
- *
125
- * @param {string|Buffer} img Image path or Data Url or image buffer.
126
- * @return {Buffer} Image buffer.
127
- */
128
- private image2buffer;
129
118
  }
@@ -0,0 +1,57 @@
1
+ import SesOptions from '~/interfaces/SesOptions';
2
+ /**
3
+ * AWS SES email sending client.
4
+ */
5
+ export default class AWSSesClient {
6
+ #private;
7
+ /**
8
+ * Constructs a SES client object.
9
+ */
10
+ constructor(options: SesOptions);
11
+ /**
12
+ * Set the sender's email address.
13
+ *
14
+ * @param {string} from Sender's email address.
15
+ * @param {string} name? Sender Name.
16
+ * @return {AWSSesClient}
17
+ */
18
+ from(from: string, name?: string): AWSSesClient;
19
+ /**
20
+ * Set the destination email address.
21
+ *
22
+ * @param {(string|string[])} to Email address to be sent to.
23
+ * @return {AWSSesClient}
24
+ */
25
+ to(to: string | string[]): AWSSesClient;
26
+ /**
27
+ * Set CC email address.
28
+ *
29
+ * @param {(string|string[])} cc CC email address.
30
+ * @return {AWSSesClient}
31
+ */
32
+ cc(cc: string | string[]): AWSSesClient;
33
+ /**
34
+ * Set the email subject.
35
+ *
36
+ * @param {string} subject Email Subject.
37
+ * @return {AWSSesClient}
38
+ */
39
+ subject(subject: string): AWSSesClient;
40
+ /**
41
+ * Set the body of the email.
42
+ *
43
+ * @param {string} body Email Body. The body can use the <a href="https://handlebarsjs.com/">handlebars</a> and <a href="https://www.npmjs.com/package/handlebars-extd">handlebars-extd</a> syntax.
44
+ * @param {{[key: string]: any}} vars The value of a variable in the body of the e-mail.
45
+ * @return {AWSSesClient}
46
+ */
47
+ body(body: string, vars?: {
48
+ [key: string]: any;
49
+ }): AWSSesClient;
50
+ /**
51
+ * Send email.
52
+ *
53
+ * @param {'text'|'html'} type E-Mail type ('html': HTML mail, 'text': text mail). Default is 'text'.
54
+ * @return {Promise<string>} Unique ID assigned by Amazon SES for a successfully sent email.
55
+ */
56
+ send(type?: 'text' | 'html'): Promise<string>;
57
+ }
@@ -3,6 +3,7 @@ import express from 'express';
3
3
  * User authentication service.
4
4
  */
5
5
  export default class {
6
+ #private;
6
7
  /**
7
8
  * Authenticate the user.
8
9
  *
@@ -30,10 +31,4 @@ export default class {
30
31
  * @param {express.Response} res The res object represents the HTTP response that an Express app sends when it gets an HTTP request.
31
32
  */
32
33
  static failureRedirect(res: express.Response): void;
33
- /**
34
- * Returns the option.
35
- *
36
- * @return {AuthenticationOptions} option.
37
- */
38
- private static loadOptions;
39
34
  }
@@ -1,3 +1,4 @@
1
1
  import AWSRekognitionClient from './AWSRekognitionClient';
2
2
  import Authentication from './Authentication';
3
- export { AWSRekognitionClient, Authentication, };
3
+ import AWSSesClient from './AWSSesClient';
4
+ export { AWSRekognitionClient, Authentication, AWSSesClient, };