express-sweet 2.0.7 → 2.0.9

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/CHANGELOG.md CHANGED
@@ -1,17 +1,33 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [2.0.9] - 2025/8/12
5
+
6
+ ### Added
7
+
8
+ - Added `getConfig()` method to Database class to retrieve the current database configuration object containing all sequelize options.
9
+
10
+ ### Changed
11
+
12
+ - Updated `multer` dependency from v1.4.5-lts.1 to v2.0.2 for improved file upload handling and security enhancements.
13
+
14
+ ## [2.0.8] - 2025/7/29
15
+
16
+ ### Changed
17
+
18
+ - Updated the usage example of the `isConnect` method in the `Database` class in the README reference.
19
+
4
20
  ## [2.0.7] - 2025/7/22
5
21
 
6
22
  ### Changed
7
23
 
8
24
  - Updated dependencies to address vulnerabilities
9
- - `express`: 4.19.2 => 4.21.2
10
- - `express-session`: 1.18.0 => 1.18.2
11
- - `body-parser`: 1.19.0 => 2.2.0
12
- - `cookie-parser`: 1.4.4 => 1.4.7
13
- - `morgan`: 1.10.0 => 1.10.1
14
- - `rollup`: 4.21.2 => 4.45.1
25
+ - `express`: 4.19.2 => 4.21.2
26
+ - `express-session`: 1.18.0 => 1.18.2
27
+ - `body-parser`: 1.19.0 => 2.2.0
28
+ - `cookie-parser`: 1.4.4 => 1.4.7
29
+ - `morgan`: 1.10.0 => 1.10.1
30
+ - `rollup`: 4.21.2 => 4.45.1
15
31
 
16
32
  ## [2.0.6] - 2025/2/9
17
33
 
@@ -25,18 +41,18 @@ All notable changes to this project will be documented in this file.
25
41
 
26
42
  - Added a Handlebars helper, available for use in views, to replace HTML tags in a string.
27
43
 
28
- Example:
44
+ Example:
29
45
 
30
- ```html
31
- {{!-- results in: lorem ipsum dolor sit amet --}}
32
- {{{stripTags '<a href="https://example.com">lorem ipsum <strong>dolor</strong> <em>sit</em> amet</a>'}}}
46
+ ```html
47
+ {{!-- results in: lorem ipsum dolor sit amet --}}
48
+ {{{stripTags '<a href="https://example.com">lorem ipsum <strong>dolor</strong> <em>sit</em> amet</a>'}}}
33
49
 
34
- {{!-- results in: lorem ipsum <strong>dolor</strong> sit amet --}}
35
- {{{stripTags '<a href="https://example.com">lorem ipsum <strong>dolor</strong> <em>sit</em> amet</a>' '<strong>' ''}}}
50
+ {{!-- results in: lorem ipsum <strong>dolor</strong> sit amet --}}
51
+ {{{stripTags '<a href="https://example.com">lorem ipsum <strong>dolor</strong> <em>sit</em> amet</a>' '<strong>' ''}}}
36
52
 
37
- {{!-- results in: 🍩lorem ipsum 🍩dolor🍩 🍩sit🍩 amet🍩 --}}
38
- {{{stripTags '<a href="https://example.com">lorem ipsum <strong>dolor</strong> <em>sit</em> amet</a>' [] '🍩'}}}
39
- ```
53
+ {{!-- results in: 🍩lorem ipsum 🍩dolor🍩 🍩sit🍩 amet🍩 --}}
54
+ {{{stripTags '<a href="https://example.com">lorem ipsum <strong>dolor</strong> <em>sit</em> amet</a>' [] '🍩'}}}
55
+ ```
40
56
 
41
57
  ## [2.0.4] - 2025/1/14
42
58
 
@@ -51,19 +67,19 @@ All notable changes to this project will be documented in this file.
51
67
 
52
68
  - **`findObjectInArray` Handlebars helper:** This helper is added to the view, allowing you to find an object in an array based on a specified field name and value.
53
69
 
54
- Example:
70
+ Example:
55
71
 
56
- ```html
57
- {{!--
58
- items is an array of objects: [{id: 123, name: 'Item A'}, {id: 456, name: 'Item B'}]
59
- This code will output: "Item A"
60
- --}}
61
- {{#each items}}
62
- {{#if (eq id 123)}}
63
- {{lookup (findObjectInArray ../items 'id' id) 'name'}}
64
- {{/if}}
65
- {{/each}}
66
- ```
72
+ ```html
73
+ {{!--
74
+ items is an array of objects: [{id: 123, name: 'Item A'}, {id: 456, name: 'Item B'}]
75
+ This code will output: "Item A"
76
+ --}}
77
+ {{#each items}}
78
+ {{#if (eq id 123)}}
79
+ {{lookup (findObjectInArray ../items 'id' id) 'name'}}
80
+ {{/if}}
81
+ {{/each}}
82
+ ```
67
83
 
68
84
  ## [2.0.3] - 2024/9/3
69
85
 
@@ -72,7 +88,7 @@ All notable changes to this project will be documented in this file.
72
88
  - Add `"type": "module"` to the `package.json` of the esm app generated by `express-sweet-generator`. It is fully esm compliant.
73
89
  - `require` was changed to dynamic import.
74
90
  - Template engine changed from `express-hbs` to `express-handlebars`.
75
- However, the `block` and `contentFor` helpers are still available.
91
+ However, the `block` and `contentFor` helpers are still available.
76
92
  - `database/Database` has been changed from a `sequelize.Sequelize` instance to a `sequelize.Sequelize` class. If you use it in the future, you need to instantiate it.
77
93
  - Return type of `mount()` changed from `void` to `Promise<void>`.
78
94
  - Return type of `middlewares/CORS.mount()` changed from `void` to `Promise<void>`.
@@ -93,24 +109,24 @@ All notable changes to this project will be documented in this file.
93
109
  - Return type of `database/Model.initialize()` changed from `typeof Model` to `Promise<typeof Model>`.
94
110
  - Return type of `database/loadModels()` changed from `void` to `Promise<void>`.
95
111
  - DB connection check method has been changed.
96
- - After:
97
- ```js
98
- const expressExtension = require('express-sweet');
99
-
100
- // Create Database instance.
101
- const config = await expressExtension.utils.loadDatabaseConfig();
102
- const database = new expressExtension.database.Database(config.database, config.username, config.password, config);
103
-
104
- // Check database connection.
105
- await database.isConnect();
106
- ```
107
- - Before:
108
- ```js
109
- const expressExtension = require('express-sweet');
110
-
111
- // Check database connection.
112
- await expressExtension.database.Database.isConnect();
113
- ```
112
+ - After:
113
+ ```js
114
+ const expx = require('express-sweet');
115
+
116
+ // Create Database instance.
117
+ const config = await expx.utils.loadDatabaseConfig();
118
+ const database = new expx.database.Database(config.database, config.username, config.password, config);
119
+
120
+ // Check database connection.
121
+ await database.isConnect();
122
+ ```
123
+ - Before:
124
+ ```js
125
+ const expx = require('express-sweet');
126
+
127
+ // Check database connection.
128
+ await expx.database.Database.isConnect();
129
+ ```
114
130
  - Update passport from 0.4.1 to 0.7.0
115
131
 
116
132
  ## [2.0.2] - 2024/9/1
@@ -133,7 +149,7 @@ All notable changes to this project will be documented in this file.
133
149
  ### Changed
134
150
 
135
151
  - EXPRESS SWEET version 2 no longer depends on the AWS SDK.
136
- The `services.AWSRekognitionClient` and `services.AWSSesClient` have been migrated to the [AWS SDK Extension](https://www.npmjs.com/package/aws-sdk-extension) NPM package, so please install from there if needed.
152
+ The `services.AWSRekognitionClient` and `services.AWSSesClient` have been migrated to the [AWS SDK Extension](https://www.npmjs.com/package/aws-sdk-extension) NPM package, so please install from there if needed.
137
153
 
138
154
  ## [1.1.1] - 2024/3/23
139
155
 
@@ -149,12 +165,12 @@ All notable changes to this project will be documented in this file.
149
165
  ### Changed
150
166
 
151
167
  - Updated EXPRESS SWEET's dependency packages.
152
- - [express](https://www.npmjs.com/package/express) from v4.18.2 to v4.18.3
153
- - [multer](https://www.npmjs.com/package/multer) from v1.4.4 to v1.4.5-lts.1
154
- - [express-session](https://www.npmjs.com/package/express-session) from v1.17.3 to v1.18.0
155
- - [sequelize](https://www.npmjs.com/package/sequelize) from v6.32.0 to v6.37.1
156
- - [mariadb](https://www.npmjs.com/package/mariadb) from v2.4.0 to v3.2.3
157
- - [moment](https://www.npmjs.com/package/moment) from v2.29.4 to v2.30.1
168
+ - [express](https://www.npmjs.com/package/express) from v4.18.2 to v4.18.3
169
+ - [multer](https://www.npmjs.com/package/multer) from v1.4.4 to v1.4.5-lts.1
170
+ - [express-session](https://www.npmjs.com/package/express-session) from v1.17.3 to v1.18.0
171
+ - [sequelize](https://www.npmjs.com/package/sequelize) from v6.32.0 to v6.37.1
172
+ - [mariadb](https://www.npmjs.com/package/mariadb) from v2.4.0 to v3.2.3
173
+ - [moment](https://www.npmjs.com/package/moment) from v2.29.4 to v2.30.1
158
174
 
159
175
  ## [1.0.44] - 2023/12/30
160
176
 
@@ -174,10 +190,10 @@ All notable changes to this project will be documented in this file.
174
190
 
175
191
  - Update TypeScript version from 4.8.4 to 5.2.2.
176
192
  - Update redis dependency package used for user authentication.
177
- - Updated redis package version from 4.3.1 to 4.6.8.
178
- [Here](https://github.com/redis/node-redis/blob/master/CHANGELOG.md) are the changes.
179
- - Updated connect-redis package version from 6.1.3 to 7.1.0.
180
- [Here](https://github.com/tj/connect-redis/releases) are the changes.
193
+ - Updated redis package version from 4.3.1 to 4.6.8.
194
+ [Here](https://github.com/redis/node-redis/blob/master/CHANGELOG.md) are the changes.
195
+ - Updated connect-redis package version from 6.1.3 to 7.1.0.
196
+ [Here](https://github.com/tj/connect-redis/releases) are the changes.
181
197
 
182
198
 
183
199
  ## [1.0.41] - 2023/8/4
@@ -197,73 +213,73 @@ All notable changes to this project will be documented in this file.
197
213
  ### Changed
198
214
 
199
215
  - Changed exception class name.
200
- <table>
201
- <thead>
202
- <tr>
203
- <th>Before Class Name</th>
204
- <th>After class name</th>
205
- <th>Instance member</th>
206
- <th>Description</th>
207
- </tr>
208
- </thead>
209
- <tbody>
210
- <tr>
211
- <td>CollectionCreationError</td>
212
- <td>FaceCollectionCreateFailed</td>
213
- <td>
214
- <ul>
215
- <li>name: Error Name.</li>
216
- <li>collectionId: Collection ID.</li>
217
- <li>httpStatusCode: HTTP status code.</li>
218
- </ul>
219
- </td>
220
- <td>Thrown when face collection creation (<code>AWSRekognitionClient.createCollection()</code>) fails.</td>
221
- </tr>
222
- <tr>
223
- <td>CollectionDeletionError</td>
224
- <td>FaceCollectionDeleteFailed</td>
225
- <td>
226
- <ul>
227
- <li>name: Error Name.</li>
228
- <li>collectionId: Collection ID.</li>
229
- <li>httpStatusCode: HTTP status code.</li>
230
- </ul>
231
- </td>
232
- <td>Thrown when deleting a face collection (<code>AWSRekognitionClient.deleteCollection()</code>) fails.</td>
233
- </tr>
234
- <tr>
235
- <td>FaceIndexError</td>
236
- <td>FaceIndexFailed</td>
237
- <td>
238
- <ul>
239
- <li>name: Error Name.</li>
240
- <li>collectionId: Collection ID.</li>
241
- </ul>
242
- </td>
243
- <td>Thrown when face indexing (<code>AWSRekognitionClient.indexFace()</code>) fails.</td>
244
- </tr>
245
- <tr>
246
- <td>MissingFaceInImageError</td>
247
- <td>FaceMissingInPhoto</td>
248
- <td>
249
- <ul>
250
- <li>name: Error Name.</li>
251
- </ul>
252
- </td>
253
- <td>Thrown if the face to index (<code>AWSRekognitionClient.indexFace()</code>) is not in the photo.</td>
254
- </tr>
255
- <tr>
256
- <td>MultipleFacesInImageError</td>
257
- <td>FacesMultipleInPhoto</td>
258
- <td>
259
- <ul>
260
- <li>name: Error Name.</li>
261
- </ul>
262
- </td>
263
- <td>Thrown when there are multiple faces to index (<code>AWSRekognitionClient.indexFace()</code>) in a photo.</td>
264
- </tr>
265
- </tbody>
266
- </table>
216
+ <table>
217
+ <thead>
218
+ <tr>
219
+ <th>Before Class Name</th>
220
+ <th>After class name</th>
221
+ <th>Instance member</th>
222
+ <th>Description</th>
223
+ </tr>
224
+ </thead>
225
+ <tbody>
226
+ <tr>
227
+ <td>CollectionCreationError</td>
228
+ <td>FaceCollectionCreateFailed</td>
229
+ <td>
230
+ <ul>
231
+ <li>name: Error Name.</li>
232
+ <li>collectionId: Collection ID.</li>
233
+ <li>httpStatusCode: HTTP status code.</li>
234
+ </ul>
235
+ </td>
236
+ <td>Thrown when face collection creation (<code>AWSRekognitionClient.createCollection()</code>) fails.</td>
237
+ </tr>
238
+ <tr>
239
+ <td>CollectionDeletionError</td>
240
+ <td>FaceCollectionDeleteFailed</td>
241
+ <td>
242
+ <ul>
243
+ <li>name: Error Name.</li>
244
+ <li>collectionId: Collection ID.</li>
245
+ <li>httpStatusCode: HTTP status code.</li>
246
+ </ul>
247
+ </td>
248
+ <td>Thrown when deleting a face collection (<code>AWSRekognitionClient.deleteCollection()</code>) fails.</td>
249
+ </tr>
250
+ <tr>
251
+ <td>FaceIndexError</td>
252
+ <td>FaceIndexFailed</td>
253
+ <td>
254
+ <ul>
255
+ <li>name: Error Name.</li>
256
+ <li>collectionId: Collection ID.</li>
257
+ </ul>
258
+ </td>
259
+ <td>Thrown when face indexing (<code>AWSRekognitionClient.indexFace()</code>) fails.</td>
260
+ </tr>
261
+ <tr>
262
+ <td>MissingFaceInImageError</td>
263
+ <td>FaceMissingInPhoto</td>
264
+ <td>
265
+ <ul>
266
+ <li>name: Error Name.</li>
267
+ </ul>
268
+ </td>
269
+ <td>Thrown if the face to index (<code>AWSRekognitionClient.indexFace()</code>) is not in the photo.</td>
270
+ </tr>
271
+ <tr>
272
+ <td>MultipleFacesInImageError</td>
273
+ <td>FacesMultipleInPhoto</td>
274
+ <td>
275
+ <ul>
276
+ <li>name: Error Name.</li>
277
+ </ul>
278
+ </td>
279
+ <td>Thrown when there are multiple faces to index (<code>AWSRekognitionClient.indexFace()</code>) in a photo.</td>
280
+ </tr>
281
+ </tbody>
282
+ </table>
267
283
 
268
284
  ## [1.0.38] - 2023/7/17
269
285
 
@@ -318,14 +334,14 @@ All notable changes to this project will be documented in this file.
318
334
  ### Changed
319
335
 
320
336
  - Changed helper function names in the view (Handlebars) from SnakeCase to CamelCase.
321
- |After|Before|Description|
322
- |--|--|--|
323
- |notEmpty|not_empty|Check that it is not empty.|
324
- |formatDate|format_date|Use moment to format the date.|
325
- |cacheBusting|cache_busting|Returns the Assets path containing the file update time parameter.|
326
- |jsonStringify|json_stringify|Stringify an object using JSON.stringify.|
327
- |jsonParse|json_parse|Parses the given string using JSON.parse.|
328
- |formatBytes|format_bytes|Convert bytes to just the right units(KB, MB, GB, TB, PB, EB, ZB, YB).|
337
+ |After|Before|Description|
338
+ |--|--|--|
339
+ |notEmpty|not_empty|Check that it is not empty.|
340
+ |formatDate|format_date|Use moment to format the date.|
341
+ |cacheBusting|cache_busting|Returns the Assets path containing the file update time parameter.|
342
+ |jsonStringify|json_stringify|Stringify an object using JSON.stringify.|
343
+ |jsonParse|json_parse|Parses the given string using JSON.parse.|
344
+ |formatBytes|format_bytes|Convert bytes to just the right units(KB, MB, GB, TB, PB, EB, ZB, YB).|
329
345
 
330
346
  ### Added
331
347
 
@@ -365,10 +381,10 @@ All notable changes to this project will be documented in this file.
365
381
 
366
382
  - Update Sequelize from v5 to v6.
367
383
  - Changed the framework debug log to output only when the environment variable EXPRESS_DEBUG is defined.
368
- .env:
369
- ```
370
- EXPRESS_DEBUG=true
371
- ```
384
+ .env:
385
+ ```
386
+ EXPRESS_DEBUG=true
387
+ ```
372
388
 
373
389
  ## [1.0.25] - 2022/11/24
374
390
 
@@ -417,11 +433,11 @@ All notable changes to this project will be documented in this file.
417
433
  ### Added
418
434
 
419
435
  - User authentication sessions can now be stored in redis. To use redis for session storage, simply add the following option to config/authentication.js. Please give it a try.
420
- config/authentication.js:
421
- ```json
422
- session_store: 'redis',
423
- redis_host: 'redis://localhost:6379'
424
- ```
436
+ config/authentication.js:
437
+ ```json
438
+ session_store: 'redis',
439
+ redis_host: 'redis://localhost:6379'
440
+ ```
425
441
 
426
442
  ## [1.0.17] - 2022/5/17
427
443
 
@@ -452,40 +468,40 @@ All notable changes to this project will be documented in this file.
452
468
  ### Added
453
469
 
454
470
  - The model's begin method now accepts the transaction option.
455
- ```js
456
- let transaction;
457
- try {
458
- transaction = await BookModel.begin({
459
- isolationLevel: BookModel.Transaction.ISOLATION_LEVELS.REPEATABLE_READ,
460
- type: BookModel.Transaction.TYPES.DEFERRED,
461
- });
462
- const book = await BookModel.findOne({where: {id: 1}}, {transaction});
463
- book.title = 'When Im Gone';
464
- await book.save({transaction});
465
- await transaction.commit();
466
-
467
- // Load updated data.
468
- await book.reload();
469
- } catch (error) {
470
- if (transaction)
471
- await transaction.rollback();
472
- }
473
- ```
471
+ ```js
472
+ let transaction;
473
+ try {
474
+ transaction = await BookModel.begin({
475
+ isolationLevel: BookModel.Transaction.ISOLATION_LEVELS.REPEATABLE_READ,
476
+ type: BookModel.Transaction.TYPES.DEFERRED,
477
+ });
478
+ const book = await BookModel.findOne({where: {id: 1}}, {transaction});
479
+ book.title = 'When Im Gone';
480
+ await book.save({transaction});
481
+ await transaction.commit();
482
+
483
+ // Load updated data.
484
+ await book.reload();
485
+ } catch (error) {
486
+ if (transaction)
487
+ await transaction.rollback();
488
+ }
489
+ ```
474
490
 
475
491
  ## [1.0.12] - 2021/11/16
476
492
 
477
493
  ### Added
478
494
 
479
495
  - Added a method to the model that can execute raw SQL. As there are often use cases in which it is just easier to execute raw / already prepared SQL queries, you can use the Model.query method.
480
- ```js
481
- // By default the function will return two arguments - a results array, and an object containing metadata (such as amount of affected rows, etc).
482
- // Note that since this is a raw query, the metadata are dialect specific.
483
- const [results, metadata] = await BookModel.query("UPDATE book SET title = 'When Im Gone' WHERE id = 1");
496
+ ```js
497
+ // By default the function will return two arguments - a results array, and an object containing metadata (such as amount of affected rows, etc).
498
+ // Note that since this is a raw query, the metadata are dialect specific.
499
+ const [results, metadata] = await BookModel.query("UPDATE book SET title = 'When Im Gone' WHERE id = 1");
484
500
 
485
- // In cases where you don't need to access the metadata you can pass in a query type to tell sequelize how to format the results. For example, for a simple select query you could do:
486
- // We didn't need to destructure the result here - the results were returned directly
487
- const users = await BookModel.query("SELECT * FROM book", {type: BookModel.QueryTypes.SELECT});
488
- ```
501
+ // In cases where you don't need to access the metadata you can pass in a query type to tell sequelize how to format the results. For example, for a simple select query you could do:
502
+ // We didn't need to destructure the result here - the results were returned directly
503
+ const users = await BookModel.query("SELECT * FROM book", {type: BookModel.QueryTypes.SELECT});
504
+ ```
489
505
 
490
506
  ## [1.0.11] - 2021/11/10
491
507
 
@@ -542,10 +558,10 @@ All notable changes to this project will be documented in this file.
542
558
  ### Changed
543
559
 
544
560
  - Change the current URL path of a local variable.app.locals.currentPath is a USVString containing an initial '/' followed by the path of the URL not including the query string or fragment.
545
- ```js
546
- // For example, when the current URL is "https://example.com/docs/api?q=value", "/docs/api" is set for "app.locals.currentPath".
547
- console.log(app.locals.currentPath);
548
- ```
561
+ ```js
562
+ // For example, when the current URL is "https://example.com/docs/api?q=value", "/docs/api" is set for "app.locals.currentPath".
563
+ console.log(app.locals.currentPath);
564
+ ```
549
565
 
550
566
  ## [1.0.2] - 2021//6/10
551
567
 
@@ -617,4 +633,6 @@ All notable changes to this project will be documented in this file.
617
633
  [2.0.4]: https://github.com/takuya-motoshima/express-sweet/compare/v2.0.3...v2.0.4
618
634
  [2.0.5]: https://github.com/takuya-motoshima/express-sweet/compare/v2.0.4...v2.0.5
619
635
  [2.0.6]: https://github.com/takuya-motoshima/express-sweet/compare/v2.0.5...v2.0.6
620
- [2.0.7]: https://github.com/takuya-motoshima/express-sweet/compare/v2.0.6...v2.0.7
636
+ [2.0.7]: https://github.com/takuya-motoshima/express-sweet/compare/v2.0.6...v2.0.7
637
+ [2.0.8]: https://github.com/takuya-motoshima/express-sweet/compare/v2.0.7...v2.0.8
638
+ [2.0.9]: https://github.com/takuya-motoshima/express-sweet/compare/v2.0.8...v2.0.9