express-sweet 1.0.35 → 1.0.37
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 +66 -1
- package/dist/build.common.js +11 -11
- package/dist/build.esm.js +12 -12
- package/docs/index.html +321 -38
- package/package.json +1 -1
- package/types/database/index.d.ts +3 -3
- package/types/exceptions/index.d.ts +5 -5
- package/types/handlebars_helpers/index.d.ts +8 -7
- package/types/handlebars_helpers/math.d.ts +81 -0
- package/types/index.d.ts +7 -7
- package/types/interfaces/{AuthenticationOptions.d.ts → AuthenticationConfig.d.ts} +0 -14
- package/types/interfaces/BasicConfig.d.ts +74 -0
- package/types/interfaces/FaceMatch.d.ts +1 -1
- package/types/interfaces/{ViewOptions.d.ts → ViewConfig.d.ts} +2 -2
- package/types/interfaces/index.d.ts +9 -9
- package/types/middlewares/CORS.d.ts +0 -1
- package/types/middlewares/Environment.d.ts +0 -1
- package/types/middlewares/{ErrorHandling.d.ts → ErrorHandler.d.ts} +0 -1
- package/types/middlewares/Http.d.ts +0 -1
- package/types/middlewares/Local.d.ts +0 -1
- package/types/middlewares/View.d.ts +0 -1
- package/types/middlewares/index.d.ts +8 -8
- package/types/routing/Router.d.ts +0 -1
- package/types/routing/index.d.ts +1 -1
- package/types/services/Authentication.d.ts +0 -1
- package/types/services/index.d.ts +3 -3
- package/types/utils/index.d.ts +4 -0
- package/types/utils/loadAuthenticationConfig.d.ts +8 -0
- package/types/utils/loadBasicConfig.d.ts +8 -0
- package/types/utils/loadDatabaseConfig.d.ts +8 -0
- package/types/utils/loadViewConfig.d.ts +8 -0
- package/types/interfaces/Config.d.ts +0 -66
- /package/types/interfaces/{DatabaseOptions.d.ts → DatabaseConfig.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,69 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
|
3
3
|
|
|
4
|
+
## [1.0.37] - 2023/7/17
|
|
5
|
+
### Changed
|
|
6
|
+
- The beforeRender option in the view configuration (config/view.js) can now specify asynchronous functions.
|
|
7
|
+
|
|
8
|
+
### Added
|
|
9
|
+
- New Math-related view helpers have been added.
|
|
10
|
+
|
|
11
|
+
See [here](https://takuya-motoshima.github.io/express-sweet/#view-math-helper) how to use the helper.
|
|
12
|
+
|
|
13
|
+
Added view helpers:
|
|
14
|
+
|Helper|Description|
|
|
15
|
+
|--|--|
|
|
16
|
+
|add|Calculates the sum of two numbers.|
|
|
17
|
+
|sub|Calculates the difference of the given values.|
|
|
18
|
+
|multiply|Calculate the multiplication of the given values.|
|
|
19
|
+
|divide|Compute the division of the given values.|
|
|
20
|
+
|ceil|Round up the value.|
|
|
21
|
+
|floor|Rounds down a number.|
|
|
22
|
+
|abs|Returns an absolute value.|
|
|
23
|
+
|
|
24
|
+
## [1.0.36] - 2023/7/12
|
|
25
|
+
### Changed
|
|
26
|
+
- Moved the Ajax determination option (is_ajax) in the authentication configuration (config/authentication.js) to the basic configuration (config/config.js).
|
|
27
|
+
|
|
28
|
+
config/config.js:
|
|
29
|
+
```js
|
|
30
|
+
/**
|
|
31
|
+
* How to determine if it is an ajax request.
|
|
32
|
+
* The default is that if there is an XMLHttpRequest in the request header (req.xhr) returns true.
|
|
33
|
+
* For example, if there is no XMLHttpRequest in req(express.Request) and the Ajax endpoint starts with /api, a custom Ajax decision can be made like "return /^\/api\//.test(req.path)".
|
|
34
|
+
*
|
|
35
|
+
* @type {(req: express.Request) => boolean}
|
|
36
|
+
* @example
|
|
37
|
+
* is_ajax: req => {
|
|
38
|
+
* // If the request URL begins with /api, it is assumed to be Ajax.
|
|
39
|
+
* return /^\/api/.test(req.path);
|
|
40
|
+
* // return !!req.xhr;
|
|
41
|
+
* }
|
|
42
|
+
*/
|
|
43
|
+
is_ajax: req => !!req.xhr,
|
|
44
|
+
```
|
|
45
|
+
- 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.
|
|
46
|
+
|
|
47
|
+
config/config.js:
|
|
48
|
+
```js
|
|
49
|
+
/**
|
|
50
|
+
* Hooks the default behavior on request errors.
|
|
51
|
+
* If unset, simply returns an error HTTP status. (<code>res.status(err.status||500).end();</code>)
|
|
52
|
+
*
|
|
53
|
+
* @type {(err: any, req: express.Request, res: express.Response, next: express.NextFunction) => void}
|
|
54
|
+
* @example
|
|
55
|
+
* hook_handle_error: (err, req, res, next) => {
|
|
56
|
+
* if (err.status === 404)
|
|
57
|
+
* // If the URL cannot be found, a 404 error screen (views/error-404.hbs) is displayed.
|
|
58
|
+
* res.render('error-404');
|
|
59
|
+
* else
|
|
60
|
+
* // For other errors, unknown error screen (views/error-unknown.hbs) is displayed.
|
|
61
|
+
* res.render('error-unknown');
|
|
62
|
+
* },
|
|
63
|
+
*/
|
|
64
|
+
hook_handle_error: undefined,
|
|
65
|
+
```
|
|
66
|
+
|
|
4
67
|
## [1.0.35] - 2023/7/11
|
|
5
68
|
### Changed
|
|
6
69
|
- 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.
|
|
@@ -626,4 +689,6 @@ All notable changes to this project will be documented in this file.
|
|
|
626
689
|
[1.0.32]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.31...v1.0.32
|
|
627
690
|
[1.0.33]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.32...v1.0.33
|
|
628
691
|
[1.0.34]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.33...v1.0.34
|
|
629
|
-
[1.0.35]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.34...v1.0.35
|
|
692
|
+
[1.0.35]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.34...v1.0.35
|
|
693
|
+
[1.0.36]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.35...v1.0.36
|
|
694
|
+
[1.0.37]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.36...v1.0.37
|