express-sweet 2.0.2 → 2.0.3

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 (50) hide show
  1. package/CHANGELOG.md +51 -7
  2. package/README.md +2109 -20
  3. package/configuration_sample/cjs/authentication.js +103 -0
  4. package/configuration_sample/cjs/config.js +76 -0
  5. package/configuration_sample/cjs/database.js +35 -0
  6. package/configuration_sample/cjs/view.js +36 -0
  7. package/configuration_sample/esm/authentication.js +103 -0
  8. package/configuration_sample/esm/config.js +76 -0
  9. package/configuration_sample/esm/database.js +35 -0
  10. package/configuration_sample/esm/view.js +36 -0
  11. package/dist/build.cjs +22 -22
  12. package/dist/build.mjs +22 -22
  13. package/package.json +8 -11
  14. package/screencaps/belongs-to-many.png +0 -0
  15. package/screencaps/belongs-to.png +0 -0
  16. package/screencaps/demonstration.webp +0 -0
  17. package/screencaps/has-many.png +0 -0
  18. package/screencaps/has-one.png +0 -0
  19. package/types/database/Database.d.ts +3 -171
  20. package/types/database/Model.d.ts +9 -6
  21. package/types/database/loadModels.d.ts +2 -1
  22. package/types/handlebars_helpers/comparison.d.ts +40 -170
  23. package/types/handlebars_helpers/index.d.ts +1 -0
  24. package/types/handlebars_helpers/layouts.d.ts +21 -0
  25. package/types/handlebars_helpers/math.d.ts +0 -7
  26. package/types/handlebars_helpers/object.d.ts +2 -2
  27. package/types/handlebars_helpers/string.d.ts +1 -6
  28. package/types/interfaces/AuthenticationConfig.d.ts +0 -4
  29. package/types/interfaces/BasicConfig.d.ts +1 -4
  30. package/types/interfaces/ViewConfig.d.ts +0 -1
  31. package/types/middlewares/Authentication.d.ts +3 -1
  32. package/types/middlewares/CORS.d.ts +3 -1
  33. package/types/middlewares/Environment.d.ts +3 -3
  34. package/types/middlewares/ErrorHandler.d.ts +3 -1
  35. package/types/middlewares/Http.d.ts +3 -1
  36. package/types/middlewares/Local.d.ts +3 -1
  37. package/types/middlewares/View.d.ts +6 -2
  38. package/types/mount.d.ts +3 -2
  39. package/types/routing/Router.d.ts +3 -1
  40. package/types/services/Authentication.d.ts +4 -2
  41. package/types/utils/loadAuthenticationConfig.d.ts +2 -2
  42. package/types/utils/loadBasicConfig.d.ts +2 -2
  43. package/types/utils/loadDatabaseConfig.d.ts +2 -2
  44. package/types/utils/loadViewConfig.d.ts +2 -2
  45. package/INSTALL-Redis.md +0 -77
  46. package/QUICK_START.md +0 -149
  47. package/screencaps/login.jpg +0 -0
  48. package/screencaps/personal.jpg +0 -0
  49. package/screencaps/user-editing.jpg +0 -0
  50. package/screencaps/users.jpg +0 -0
package/CHANGELOG.md CHANGED
@@ -1,6 +1,52 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [2.0.3] - 2024/9/3
5
+ ### Changed
6
+ - Add `"type": "module"` to the `package.json` of the esm app generated by `express-sweet-generator`. It is fully esm compliant.
7
+ - `require` was changed to dynamic import.
8
+ - Template engine changed from `express-hbs` to `express-handlebars`.
9
+ However, the `block` and `contentFor` helpers are still available.
10
+ - `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.
11
+ - Return type of `mount()` changed from `void` to `Promise<void>`.
12
+ - Return type of `middlewares/CORS.mount()` changed from `void` to `Promise<void>`.
13
+ - Return type of `middlewares/Environment.mount()` changed from `void` to `Promise<void>`.
14
+ - Return type of `middlewares/ErrorHandler.mount()` changed from `void` to `Promise<void>`.
15
+ - Return type of `middlewares/Http.mount()` changed from `void` to `Promise<void>`.
16
+ - Return type of `middlewares/Local.mount()` changed from `void` to `Promise<void>`.
17
+ - Return type of `middlewares/Router.mount()` changed from `void` to `Promise<void>`.
18
+ - Return type of `middlewares/View.mount()` changed from `void` to `Promise<void>`.
19
+ - Return type of `middlewares/View.mountBeforeRender()` changed from `void` to `Promise<void>`.
20
+ - Return type of `middlewares/Authentication.mount()` changed from `void` to `Promise<void>`.
21
+ - Return type of `utils/loadAuthenticationConfig()` changed from `AuthenticationConfig` to `Promise<AuthenticationConfig>`.
22
+ - Return type of `utils/loadBasicConfig()` changed from `BasicConfig` to `Promise<BasicConfig>`.
23
+ - Return type of `utils/loadDatabaseConfig()` changed from `sequelize.Options` to `Promise<sequelize.Options>`.
24
+ - Return type of `utils/loadViewConfig()` changed from `ViewConfig` to `Promise<ViewConfig>`.
25
+ - Return type of `services/Authentication.successRedirect()` changed from `void` to `Promise<void>`.
26
+ - Return type of `services/Authentication.failureRedirect()` changed from `void` to `Promise<void>`.
27
+ - Return type of `database/Model.initialize()` changed from `typeof Model` to `Promise<typeof Model>`.
28
+ - Return type of `database/loadModels()` changed from `void` to `Promise<void>`.
29
+ - DB connection check method has been changed.
30
+ - After:
31
+ ```js
32
+ const expressExtension = require('express-sweet');
33
+
34
+ // Create Database instance.
35
+ const config = await expressExtension.utils.loadDatabaseConfig();
36
+ const database = new expressExtension.database.Database(config.database, config.username, config.password, config);
37
+
38
+ // Check database connection.
39
+ await database.isConnect();
40
+ ```
41
+ - Before:
42
+ ```js
43
+ const expressExtension = require('express-sweet');
44
+
45
+ // Check database connection.
46
+ await expressExtension.database.Database.isConnect();
47
+ ```
48
+ - Update passport from 0.4.1 to 0.7.0
49
+
4
50
  ## [2.0.2] - 2024/9/1
5
51
  ### Changed
6
52
  - Update express from 4.18.3 to 4.19.2.
@@ -14,7 +60,7 @@ All notable changes to this project will be documented in this file.
14
60
 
15
61
  ## [2.0.0] - 2024/3/24
16
62
  ### Changed
17
- - Express Sweet version 2 no longer depends on the AWS SDK.
63
+ - EXPRESS SWEET version 2 no longer depends on the AWS SDK.
18
64
  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.
19
65
 
20
66
  ## [1.1.1] - 2024/3/23
@@ -26,7 +72,7 @@ All notable changes to this project will be documented in this file.
26
72
 
27
73
  ## [1.1.0] - 2024/3/6
28
74
  ### Changed
29
- - Updated Express Sweet's dependency packages.
75
+ - Updated EXPRESS SWEET's dependency packages.
30
76
  - [express](https://www.npmjs.com/package/express) from v4.18.2 to v4.18.3
31
77
  - [multer](https://www.npmjs.com/package/multer) from v1.4.4 to v1.4.5-lts.1
32
78
  - [express-session](https://www.npmjs.com/package/express-session) from v1.17.3 to v1.18.0
@@ -275,10 +321,8 @@ All notable changes to this project will be documented in this file.
275
321
  await book.save({transaction});
276
322
  await transaction.commit();
277
323
 
278
- // Check the update result.
279
- // results in: New title of book: When Im Gone
324
+ // Load updated data.
280
325
  await book.reload();
281
- console.log(`New title of book: ${book.title}`);
282
326
  } catch (err) {
283
327
  if (transaction)
284
328
  await transaction.rollback();
@@ -335,7 +379,6 @@ All notable changes to this project will be documented in this file.
335
379
  ## [1.0.3] - 2021/6/13
336
380
  ### Changed
337
381
  - 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.
338
-
339
382
  ```js
340
383
  // For example, when the current URL is "https://example.com/docs/api?q=value", "/docs/api" is set for "app.locals.currentPath".
341
384
  console.log(app.locals.currentPath);
@@ -401,4 +444,5 @@ All notable changes to this project will be documented in this file.
401
444
  [1.1.1]: https://github.com/takuya-motoshima/express-sweet/compare/v1.1.0...v1.1.1
402
445
  [2.0.0]: https://github.com/takuya-motoshima/express-sweet/compare/v1.1.1...v2.0.0
403
446
  [2.0.1]: https://github.com/takuya-motoshima/express-sweet/compare/v2.0.0...v2.0.1
404
- [2.0.2]: https://github.com/takuya-motoshima/express-sweet/compare/v2.0.1...v2.0.2
447
+ [2.0.2]: https://github.com/takuya-motoshima/express-sweet/compare/v2.0.1...v2.0.2
448
+ [2.0.3]: https://github.com/takuya-motoshima/express-sweet/compare/v2.0.2...v2.0.3