express-sweet 2.0.9 → 3.0.1

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 (71) hide show
  1. package/CHANGELOG.md +69 -1
  2. package/README.md +1039 -2137
  3. package/configuration_sample/cjs/authentication.js +50 -15
  4. package/configuration_sample/cjs/config.js +38 -21
  5. package/configuration_sample/cjs/database.js +90 -4
  6. package/configuration_sample/cjs/logging.js +41 -0
  7. package/configuration_sample/cjs/view.js +19 -1
  8. package/configuration_sample/esm/authentication.js +48 -15
  9. package/configuration_sample/esm/config.js +39 -22
  10. package/configuration_sample/esm/database.js +90 -4
  11. package/configuration_sample/esm/logging.js +41 -0
  12. package/configuration_sample/esm/view.js +20 -2
  13. package/dist/build.cjs +8 -8
  14. package/dist/build.mjs +4 -4
  15. package/package.json +9 -4
  16. package/types/database/DatabaseManager.d.ts +95 -0
  17. package/types/database/Model.d.ts +183 -20
  18. package/types/database/index.d.ts +47 -3
  19. package/types/database/loadModels.d.ts +19 -4
  20. package/types/handlebars_helpers/array.d.ts +3 -1
  21. package/types/handlebars_helpers/comparison.d.ts +55 -19
  22. package/types/handlebars_helpers/date.d.ts +3 -1
  23. package/types/handlebars_helpers/html.d.ts +6 -2
  24. package/types/handlebars_helpers/index.d.ts +73 -9
  25. package/types/handlebars_helpers/layouts.d.ts +5 -1
  26. package/types/handlebars_helpers/math.d.ts +21 -7
  27. package/types/handlebars_helpers/number.d.ts +3 -1
  28. package/types/handlebars_helpers/object.d.ts +6 -2
  29. package/types/handlebars_helpers/string.d.ts +9 -3
  30. package/types/index.d.ts +92 -5
  31. package/types/interfaces/AuthenticationConfig.d.ts +38 -1
  32. package/types/interfaces/BasicConfig.d.ts +26 -1
  33. package/types/interfaces/DatabaseConfig.d.ts +45 -1
  34. package/types/interfaces/LoggingConfig.d.ts +49 -0
  35. package/types/interfaces/ViewConfig.d.ts +21 -2
  36. package/types/interfaces/index.d.ts +25 -11
  37. package/types/middlewares/Authentication.d.ts +43 -6
  38. package/types/middlewares/CORS.d.ts +23 -5
  39. package/types/middlewares/Environment.d.ts +30 -4
  40. package/types/middlewares/ErrorHandler.d.ts +27 -5
  41. package/types/middlewares/Global.d.ts +20 -6
  42. package/types/middlewares/Http.d.ts +22 -5
  43. package/types/middlewares/Local.d.ts +35 -8
  44. package/types/middlewares/View.d.ts +39 -8
  45. package/types/middlewares/index.d.ts +47 -7
  46. package/types/mount.d.ts +16 -3
  47. package/types/routing/Router.d.ts +49 -7
  48. package/types/routing/index.d.ts +37 -1
  49. package/types/services/Authentication.d.ts +79 -16
  50. package/types/services/index.d.ts +33 -1
  51. package/types/types/global.d.ts +29 -8
  52. package/types/utils/Types.d.ts +5 -3
  53. package/types/utils/index.d.ts +71 -9
  54. package/types/utils/isArray.d.ts +12 -3
  55. package/types/utils/isAsyncFunction.d.ts +12 -5
  56. package/types/utils/isFunction.d.ts +13 -6
  57. package/types/utils/isObject.d.ts +14 -3
  58. package/types/utils/isString.d.ts +15 -4
  59. package/types/utils/loadAuthenticationConfig.d.ts +13 -3
  60. package/types/utils/loadBasicConfig.d.ts +13 -3
  61. package/types/utils/loadDatabaseConfig.d.ts +34 -3
  62. package/types/utils/loadLoggingConfig.d.ts +16 -0
  63. package/types/utils/loadViewConfig.d.ts +28 -3
  64. package/types/database/Database.d.ts +0 -18
  65. package/types/interfaces/BoundingBox.d.ts +0 -25
  66. package/types/interfaces/FaceDetails.d.ts +0 -30
  67. package/types/interfaces/FaceDetailsEmotions.d.ts +0 -40
  68. package/types/interfaces/FaceMatch.d.ts +0 -31
  69. package/types/interfaces/IndexFaceDetails.d.ts +0 -29
  70. package/types/interfaces/RekognitionOptions.d.ts +0 -26
  71. package/types/interfaces/SesOptions.d.ts +0 -27
package/CHANGELOG.md CHANGED
@@ -1,6 +1,72 @@
1
1
  # Changelog
2
+
2
3
  All notable changes to this project will be documented in this file.
3
4
 
5
+ ## [3.0.1] - 2025/9/2
6
+
7
+ ### Changed
8
+
9
+ - Add pool configuration examples and JSDoc documentation to sample database configuration.
10
+ - [ESM Configuration](configuration_sample/esm/database.js)
11
+ - [CJS Configuration](configuration_sample/cjs/database.js)
12
+
13
+ ## [3.0.0] - 2025/8/26
14
+
15
+ This release introduces significant improvements to database layer architecture and adds configurable logging support.
16
+
17
+ ### Breaking Changes
18
+
19
+ **Database Layer Refactoring**
20
+ - `Database` class removed → Use `DatabaseManager` singleton pattern
21
+ - All models now share a single database connection for improved performance
22
+ - Enhanced database management with connection testing and graceful shutdown
23
+
24
+ ### Added
25
+
26
+ #### Database Management
27
+ - **`DatabaseManager.getInstance()`** - Get singleton Sequelize database instance
28
+ - **`DatabaseManager.isConnected()`** - Test database connectivity
29
+ - **`DatabaseManager.getConfig()`** - Access original database configuration
30
+ - **`DatabaseManager.getSequelizeOptions()`** - Access runtime Sequelize options
31
+ - **`DatabaseManager.close()`** - Graceful database connection shutdown
32
+
33
+ #### Logging Configuration
34
+ - **`config/logging.js`** - Morgan logging configuration support
35
+
36
+ Create `config/logging.js` to customize HTTP request logging:
37
+ ```js
38
+ // config/logging.js
39
+ export default {
40
+ format: 'combined', // Options: 'combined', 'common', 'dev', 'short', 'tiny'
41
+ skip: (req, res) => {
42
+ // Skip logging for health check endpoints
43
+ return req.path === '/health';
44
+ }
45
+ };
46
+ ```
47
+
48
+ **Default behavior**: Uses 'combined' format with no skip conditions if config file is not provided.
49
+
50
+ ### Changed
51
+
52
+ - Updated `sequelize` dependency from v6.37.1 to v6.37.7
53
+
54
+ ### Migration Guide
55
+
56
+ **Database Usage Migration:**
57
+ ```js
58
+ // v2.x - Old way
59
+ import * as expx from 'express-sweet';
60
+
61
+ const config = await expx.utils.loadDatabaseConfig();
62
+ const db = new expx.database.Database(config.database, config.username, config.password, config);
63
+
64
+ // v3.x - New way
65
+ import * as expx from 'express-sweet';
66
+
67
+ const db = await expx.database.DatabaseManager.getInstance();
68
+ ```
69
+
4
70
  ## [2.0.9] - 2025/8/12
5
71
 
6
72
  ### Added
@@ -635,4 +701,6 @@ All notable changes to this project will be documented in this file.
635
701
  [2.0.6]: https://github.com/takuya-motoshima/express-sweet/compare/v2.0.5...v2.0.6
636
702
  [2.0.7]: https://github.com/takuya-motoshima/express-sweet/compare/v2.0.6...v2.0.7
637
703
  [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
704
+ [2.0.9]: https://github.com/takuya-motoshima/express-sweet/compare/v2.0.8...v2.0.9
705
+ [3.0.0]: https://github.com/takuya-motoshima/express-sweet/compare/v2.0.9...v3.0.0
706
+ [3.0.1]: https://github.com/takuya-motoshima/express-sweet/compare/v3.0.0...v3.0.1