express-sweet 2.0.6 → 2.0.8

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,12 +1,34 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [2.0.8] - 2025/7/29
5
+
6
+ ### Changed
7
+
8
+ - Updated the usage example of the `isConnect` method in the `Database` class in the README reference.
9
+
10
+ ## [2.0.7] - 2025/7/22
11
+
12
+ ### Changed
13
+
14
+ - Updated dependencies to address vulnerabilities
15
+ - `express`: 4.19.2 => 4.21.2
16
+ - `express-session`: 1.18.0 => 1.18.2
17
+ - `body-parser`: 1.19.0 => 2.2.0
18
+ - `cookie-parser`: 1.4.4 => 1.4.7
19
+ - `morgan`: 1.10.0 => 1.10.1
20
+ - `rollup`: 4.21.2 => 4.45.1
21
+
4
22
  ## [2.0.6] - 2025/2/9
23
+
5
24
  ### Fixed
25
+
6
26
  - Fixed a bug that caused redirection to fail when a path with query parameters was set for the logout redirect URL (`failure_redirect` in `config/authentication.js`).
7
27
 
8
28
  ## [2.0.5] - 2025/2/4
29
+
9
30
  ### Added
31
+
10
32
  - Added a Handlebars helper, available for use in views, to replace HTML tags in a string.
11
33
 
12
34
  Example:
@@ -23,13 +45,16 @@ All notable changes to this project will be documented in this file.
23
45
  ```
24
46
 
25
47
  ## [2.0.4] - 2025/1/14
48
+
26
49
  ### Changed
50
+
27
51
  - Refactored variable names.
28
52
  - Fix Docker demo.
29
53
  - Changed the directory name for storing custom error classes in the demo from `exceptions` to `errors`.
30
54
  - Added a section to the README.md API reference about considerations when using the `hasMany` association with the `findAll` method.
31
55
 
32
56
  ### Added
57
+
33
58
  - **`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.
34
59
 
35
60
  Example:
@@ -47,7 +72,9 @@ All notable changes to this project will be documented in this file.
47
72
  ```
48
73
 
49
74
  ## [2.0.3] - 2024/9/3
75
+
50
76
  ### Changed
77
+
51
78
  - Add `"type": "module"` to the `package.json` of the esm app generated by `express-sweet-generator`. It is fully esm compliant.
52
79
  - `require` was changed to dynamic import.
53
80
  - Template engine changed from `express-hbs` to `express-handlebars`.
@@ -93,30 +120,40 @@ All notable changes to this project will be documented in this file.
93
120
  - Update passport from 0.4.1 to 0.7.0
94
121
 
95
122
  ## [2.0.2] - 2024/9/1
123
+
96
124
  ### Changed
125
+
97
126
  - Update express from 4.18.3 to 4.19.2.
98
127
  - Update rollup from 2.79.1 to 4.21.2.
99
128
  - Rename build files (build.common.js => build.cjs, build.esm.js => build.mjs).
100
129
  - The express package was excluded from the build file. Instead, users should install express on their own.
101
130
 
102
131
  ## [2.0.1] - 2024/4/5
132
+
103
133
  ### Changed
134
+
104
135
  - Removed [nodejs-shared](https://www.npmjs.com/package/nodejs-shared) package dependency.
105
136
 
106
137
  ## [2.0.0] - 2024/3/24
138
+
107
139
  ### Changed
140
+
108
141
  - EXPRESS SWEET version 2 no longer depends on the AWS SDK.
109
142
  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.
110
143
 
111
144
  ## [1.1.1] - 2024/3/23
145
+
112
146
  ### Changed
147
+
113
148
  - When cookie security is enabled (`config/authentication.js#cookie_secure`) and the application is running on the HTTP protocol, the following warning message is output upon user authentication.
114
149
  ```bash
115
150
  Warning: Cookie security must be disabled for user authentication to work over the HTTP protocol (config/authentication.js#cookie_secure)
116
151
  ```
117
152
 
118
153
  ## [1.1.0] - 2024/3/6
154
+
119
155
  ### Changed
156
+
120
157
  - Updated EXPRESS SWEET's dependency packages.
121
158
  - [express](https://www.npmjs.com/package/express) from v4.18.2 to v4.18.3
122
159
  - [multer](https://www.npmjs.com/package/multer) from v1.4.4 to v1.4.5-lts.1
@@ -126,15 +163,21 @@ All notable changes to this project will be documented in this file.
126
163
  - [moment](https://www.npmjs.com/package/moment) from v2.29.4 to v2.30.1
127
164
 
128
165
  ## [1.0.44] - 2023/12/30
166
+
129
167
  ### Changed
168
+
130
169
  - The `Secure` and `HttpOnly` attributes of the session cookie can now be set from the authentication configuration file (`config/authentication.js`).
131
170
 
132
171
  ## [1.0.43] - 2023/12/30
172
+
133
173
  ### Changed
174
+
134
175
  - The cookie name for storing session IDs can now be set in the `cookie_name` field of the authentication configuration file (`config/authentication.js`).
135
176
 
136
177
  ## [1.0.42] - 2023/8/31
178
+
137
179
  ### Changed
180
+
138
181
  - Update TypeScript version from 4.8.4 to 5.2.2.
139
182
  - Update redis dependency package used for user authentication.
140
183
  - Updated redis package version from 4.3.1 to 4.6.8.
@@ -144,15 +187,21 @@ All notable changes to this project will be documented in this file.
144
187
 
145
188
 
146
189
  ## [1.0.41] - 2023/8/4
190
+
147
191
  ### Changed
192
+
148
193
  - Added an option to the method that searches for faces in the collection to throw an exception if a face is not found or if multiple faces are found.
149
194
 
150
195
  ## [1.0.40] - 2023/8/4
196
+
151
197
  ### Changed
198
+
152
199
  - Fixed to return null instead of throwing an error when looking for faces in the collection using images without faces (<code>AWSRekognitionClient.searchFaces()</code>).
153
200
 
154
201
  ## [1.0.39] - 2023/7/24
202
+
155
203
  ### Changed
204
+
156
205
  - Changed exception class name.
157
206
  <table>
158
207
  <thead>
@@ -223,40 +272,57 @@ All notable changes to this project will be documented in this file.
223
272
  </table>
224
273
 
225
274
  ## [1.0.38] - 2023/7/17
275
+
226
276
  ### Fixed
277
+
227
278
  - Fixed a bug that login user data (req.user) could not be referenced in the function called just before view rendering (config/view.js#beforeRender).
228
279
 
229
280
  ## [1.0.37] - 2023/7/17
281
+
230
282
  ### Changed
283
+
231
284
  - The beforeRender option in the view configuration (config/view.js) can now specify asynchronous functions.
232
285
 
233
286
  ### Added
287
+
234
288
  - New Math-related view helpers have been added.
235
289
 
236
290
  ## [1.0.36] - 2023/7/12
291
+
237
292
  ### Changed
293
+
238
294
  - Moved the Ajax determination option (is_ajax) in the authentication configuration (config/authentication.js) to the basic configuration (config/config.js).
239
295
  - The error handle option (error_handler) in the basic configuration (config/config.js) has been removed and an option to hook error handles (hook_handle_error) added instead.
240
296
 
241
297
  ## [1.0.35] - 2023/7/11
298
+
242
299
  ### Changed
300
+
243
301
  - The URL to redirect to when login fails (failure_redirect) option in the authentication configuration (config/authentication.js) can now be defined with a function.
244
302
  - The arguments of the failureRedirect method of the authentication service class (services/Authentication) have changed. The argument to the Authentication.failureRedirect method used to be just express.Response, but now it requires express.Request and express.Response.
245
303
 
246
304
  ## [1.0.34] - 2023/7/1
305
+
247
306
  ### Changed
307
+
248
308
  - Changed the response status code from 403 to 401 when asynchronous communication requiring authentication fails to authenticate.
249
309
 
250
310
  ## [1.0.33] - 2023/7/1
311
+
251
312
  ### Added
313
+
252
314
  - Added regular expression comparison view helper.
253
315
 
254
316
  ## [1.0.32] - 2023/7/1
317
+
255
318
  ### Fixed
319
+
256
320
  - Fixed a bug that cookies (req.cookies) cannot be referenced in the hook function before view rendering (config/view.js#beforeRender).
257
321
 
258
322
  ## [1.0.31] - 2023/6/29
323
+
259
324
  ### Changed
325
+
260
326
  - Changed helper function names in the view (Handlebars) from SnakeCase to CamelCase.
261
327
  |After|Before|Description|
262
328
  |--|--|--|
@@ -268,29 +334,41 @@ All notable changes to this project will be documented in this file.
268
334
  |formatBytes|format_bytes|Convert bytes to just the right units(KB, MB, GB, TB, PB, EB, ZB, YB).|
269
335
 
270
336
  ### Added
337
+
271
338
  - Added view helper to convert numeric values to strings with language-sensitive representations.
272
339
 
273
340
  ## [1.0.30] - 2023/6/26
341
+
274
342
  ### Changed
343
+
275
344
  - Fixed AWS Rekognition credentials passing.
276
345
 
277
346
  ## [1.0.29] - 2023/6/20
347
+
278
348
  ### Changed
349
+
279
350
  - Changed class private variables and methods from soft private to hard private.
280
351
 
281
352
  ### Added
353
+
282
354
  - Added AWS SES email sending client class.
283
355
 
284
356
  ## [1.0.28] - 2023/6/16
357
+
285
358
  ### Changed
359
+
286
360
  - Updated AWS SDK version from 2 to 3.
287
361
 
288
362
  ## [1.0.27] - 2023/6/12
363
+
289
364
  ### Changed
365
+
290
366
  - Request object has been added to the arguments of the beforeRender function in the view configuration (config/view.js).
291
367
 
292
368
  ## [1.0.26] - 2023/6/11
369
+
293
370
  ### Changed
371
+
294
372
  - Update Sequelize from v5 to v6.
295
373
  - Changed the framework debug log to output only when the environment variable EXPRESS_DEBUG is defined.
296
374
  .env:
@@ -299,35 +377,51 @@ All notable changes to this project will be documented in this file.
299
377
  ```
300
378
 
301
379
  ## [1.0.25] - 2022/11/24
380
+
302
381
  ### Added
382
+
303
383
  - Added formatBytes view helper to convert bytes to appropriate units.
304
384
 
305
385
  ## [1.0.24] - 2022/10/24
386
+
306
387
  ### Added
388
+
307
389
  - Added is_ajax option to user authentication (config/authentication.js).
308
390
 
309
391
  ## [1.0.23] - 2022/10/20
392
+
310
393
  ### Added
394
+
311
395
  - A request body object has been added to the parameters of the callback function for user authentication.
312
396
 
313
397
  ## [1.0.22] - 2022/7/27
398
+
314
399
  ### Added
400
+
315
401
  - You can now set hook functions that are called before the view is rendered. Hook functions can be used, for example, to set local variables that can be used in the view.
316
402
 
317
403
  ## [1.0.21] - 2022/526
404
+
318
405
  ### Added
406
+
319
407
  - Added an option to the face indexing method to retrieve details (gender, emotion, age group) of indexed faces.
320
408
 
321
409
  ## [1.0.20] - 2022/5/25
410
+
322
411
  ### Added
412
+
323
413
  - Added an option to get details (emotion, gender, age group) to the face detection method.
324
414
 
325
415
  ## [1.0.19] - 2022/5/20
416
+
326
417
  ### Added
418
+
327
419
  - Add date format helper to view.
328
420
 
329
421
  ## [1.0.18] - 2022/5/18
422
+
330
423
  ### Added
424
+
331
425
  - 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.
332
426
  config/authentication.js:
333
427
  ```json
@@ -336,23 +430,33 @@ All notable changes to this project will be documented in this file.
336
430
  ```
337
431
 
338
432
  ## [1.0.17] - 2022/5/17
433
+
339
434
  ### Changed
435
+
340
436
  - Updated documentation and refactored variable names.
341
437
 
342
438
  ## [1.0.16] - 2022/2/14
439
+
343
440
  ### Fixed
441
+
344
442
  - I forgot to include the build file, so I added the build file.
345
443
 
346
444
  ## [1.0.15] - 2022/2/14
445
+
347
446
  ### Changed
447
+
348
448
  - Changed the type of 'config/authentication.js#allow_unauthenticated' from'string[]' to'(string|RegExp)[]}'.
349
449
 
350
450
  ## [1.0.14] - 2022/1/17
451
+
351
452
  ### Changed
453
+
352
454
  - empty view helper can now check any type. Previously I could only check arrays.
353
455
 
354
456
  ## [1.0.13] - 2021/12/13
457
+
355
458
  ### Added
459
+
356
460
  - The model's begin method now accepts the transaction option.
357
461
  ```js
358
462
  let transaction;
@@ -375,7 +479,9 @@ All notable changes to this project will be documented in this file.
375
479
  ```
376
480
 
377
481
  ## [1.0.12] - 2021/11/16
482
+
378
483
  ### Added
484
+
379
485
  - 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.
380
486
  ```js
381
487
  // By default the function will return two arguments - a results array, and an object containing metadata (such as amount of affected rows, etc).
@@ -388,41 +494,59 @@ All notable changes to this project will be documented in this file.
388
494
  ```
389
495
 
390
496
  ## [1.0.11] - 2021/11/10
497
+
391
498
  ### Fixed
499
+
392
500
  - Fixed a bug that the database config was read before NODE_ENV was set and the database config matching NODE_ENV could not be read.
393
501
 
394
502
  ## [1.0.10] - 2021/10/19
503
+
395
504
  ### Changed
505
+
396
506
  - Added face similarity found to face search results in collection.
397
507
 
398
508
  ## [1.0.9] - 2021/10/13
509
+
399
510
  ### Changed
511
+
400
512
  - Updated dependent package'sharp'from 0.25.4 to 0.29.1.
401
513
  This update statically links sharp's pre-built libvips binaries, eliminating the need to install Phton.
402
514
  Click [here](https://sharp.pixelplumbing.com/changelog) for sharp change log.
403
515
 
404
516
  ## [1.0.8] - 2021/9/25
517
+
405
518
  ### Fixed
519
+
406
520
  - Fixed a bug where the default router couldn't aqua from the endpoint URL.
407
521
 
408
522
  ## [1.0.7] - 2021/8/13
523
+
409
524
  ### Added
525
+
410
526
  - Added where member functions to Model class.
411
527
 
412
528
  ## [1.0.6] - 2021/8/13
529
+
413
530
  ### Added
531
+
414
532
  - Added fn, col and literal member functions to Model class.
415
533
 
416
534
  ## [1.0.5] - 2021/8/12
535
+
417
536
  ### Changed
537
+
418
538
  - Changed the maximum size per field for multipart (multipart/form-data) requests from 1MB to unlimited.
419
539
 
420
540
  ## [1.0.4] - 2021/6/13
541
+
421
542
  ### Fixed
543
+
422
544
  - Fixed a bug where the referrer URL was set in app.locals.currentPath instead of the current URL.
423
545
 
424
546
  ## [1.0.3] - 2021/6/13
547
+
425
548
  ### Changed
549
+
426
550
  - 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.
427
551
  ```js
428
552
  // For example, when the current URL is "https://example.com/docs/api?q=value", "/docs/api" is set for "app.locals.currentPath".
@@ -430,14 +554,19 @@ All notable changes to this project will be documented in this file.
430
554
  ```
431
555
 
432
556
  ## [1.0.2] - 2021//6/10
557
+
433
558
  ### Changed
559
+
434
560
  - Updated rollup from version 2.44 to 2.51.
435
561
 
436
562
  ### Fixed
563
+
437
564
  - Fixed a bug where preloading models failed in cjs.
438
565
 
439
566
  ## [1.0.1] - 2021/6/2
567
+
440
568
  ### Fixed
569
+
441
570
  - Fixed a bug that caused an error when reading options defined in ESM's default Export.
442
571
 
443
572
  [1.0.1]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.0...v1.0.1
@@ -493,4 +622,5 @@ All notable changes to this project will be documented in this file.
493
622
  [2.0.3]: https://github.com/takuya-motoshima/express-sweet/compare/v2.0.2...v2.0.3
494
623
  [2.0.4]: https://github.com/takuya-motoshima/express-sweet/compare/v2.0.3...v2.0.4
495
624
  [2.0.5]: https://github.com/takuya-motoshima/express-sweet/compare/v2.0.4...v2.0.5
496
- [2.0.6]: https://github.com/takuya-motoshima/express-sweet/compare/v2.0.5...v2.0.6
625
+ [2.0.6]: https://github.com/takuya-motoshima/express-sweet/compare/v2.0.5...v2.0.6
626
+ [2.0.7]: https://github.com/takuya-motoshima/express-sweet/compare/v2.0.6...v2.0.7
package/README.md CHANGED
@@ -1218,7 +1218,12 @@ For more information on database configuration, see [Database configuration](#co
1218
1218
  ```js
1219
1219
  import * as expressExtension from 'express-sweet';
1220
1220
 
1221
- await expressExtension.database.Database.isConnect();
1221
+ // Create Database instance.
1222
+ const config = await expressExtension.utils.loadDatabaseConfig();
1223
+ const database = new expressExtension.database.Database(config.database, config.username, config.password, config);
1224
+
1225
+ // Check database connection.
1226
+ await database.isConnect();
1222
1227
  ```
1223
1228
 
1224
1229
  #### Model Class extends [sequelize.Model](https://sequelize.org/api/v6/class/src/model.js~model)