express-sweet 2.0.9 → 3.0.0

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